@squadico/chatbot 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -5
- package/dist/chatbot.global.js +6 -6
- package/dist/chatbot.global.js.map +1 -1
- package/dist/components/Approval.d.ts.map +1 -1
- package/dist/components/ChatbotWidget.d.ts.map +1 -1
- package/dist/element.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/jsx.d.ts +2 -0
- package/dist/jsx.d.ts.map +1 -1
- package/dist/lib/client.d.ts +6 -0
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/i18n.d.ts +2 -0
- package/dist/lib/i18n.d.ts.map +1 -1
- package/dist/lib/useChat.d.ts +7 -1
- package/dist/lib/useChat.d.ts.map +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +3 -2
- package/dist/react.js.map +1 -1
- package/dist/{src-CN1vDssu.js → src-BL9j5H3p.js} +619 -580
- package/dist/src-BL9j5H3p.js.map +1 -0
- package/dist/src-BSDQ6Xfm.cjs +8 -0
- package/dist/src-BSDQ6Xfm.cjs.map +1 -0
- package/dist/types.d.ts +27 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/src-CN1vDssu.js.map +0 -1
- package/dist/src-DvRdkFTu.cjs +0 -8
- package/dist/src-DvRdkFTu.cjs.map +0 -1
|
@@ -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),
|
|
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);
|
|
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 =
|
|
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);
|
|
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)),
|
|
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));
|
|
75
75
|
return r;
|
|
76
76
|
}
|
|
77
77
|
function j(e, t, n) {
|
|
@@ -125,7 +125,7 @@ function F(e) {
|
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function ee(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);
|
|
@@ -148,7 +148,7 @@ function I(e, n, r, i, a, o, s, c, l, u) {
|
|
|
148
148
|
else do
|
|
149
149
|
p.__d = !1, j && j(n), d = p.render(p.props, p.state, p.context), p.state = p.__s;
|
|
150
150
|
while (p.__d && ++M < 25);
|
|
151
|
-
p.state = p.__s, p.getChildContext != null && (i = v(v({}, i), p.getChildContext())), D && !m && p.getSnapshotBeforeUpdate != null && (x = p.getSnapshotBeforeUpdate(g, b)), N = d != null && d.type === S && d.key == null ?
|
|
151
|
+
p.state = p.__s, p.getChildContext != null && (i = v(v({}, i), p.getChildContext())), D && !m && p.getSnapshotBeforeUpdate != null && (x = p.getSnapshotBeforeUpdate(g, b)), N = d != null && d.type === S && d.key == null ? te(d.props.children) : d, c = k(e, _(N) ? N : [N], n, r, i, a, o, s, c, l, u), p.base = n.__e, n.__u &= -161, p.__h.length && s.push(p), T && (p.__E = p.__ = null);
|
|
152
152
|
} catch (e) {
|
|
153
153
|
if (s.length = f, n.__v = null, l || o != null) {
|
|
154
154
|
if (e.then) {
|
|
@@ -156,16 +156,16 @@ function I(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 ||
|
|
159
|
+
n.__k ?? (n.__k = r.__k || []), e.then || I(n), t.__e(e, n, r);
|
|
160
160
|
}
|
|
161
|
-
} else o == null && n.__v == r.__v ? (n.__k = r.__k, n.__e = r.__e) : c = n.__e =
|
|
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
|
|
165
|
-
e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(
|
|
164
|
+
function I(e) {
|
|
165
|
+
e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(I));
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
for (var i = 0; i < r.length; i++)
|
|
167
|
+
function L(e, n, r) {
|
|
168
|
+
for (var i = 0; i < r.length; i++) ne(r[i], r[++i], r[++i]);
|
|
169
169
|
t.__c && t.__c(n, e), e.some(function(n) {
|
|
170
170
|
try {
|
|
171
171
|
e = n.__h, n.__h = [], e.some(function(e) {
|
|
@@ -176,10 +176,10 @@ function ee(e, n, r) {
|
|
|
176
176
|
}
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
|
-
function
|
|
180
|
-
return typeof e != "object" || !e || e.__b > 0 ? e : _(e) ? e.map(
|
|
179
|
+
function te(e) {
|
|
180
|
+
return typeof e != "object" || !e || e.__b > 0 ? e : _(e) ? e.map(te) : e.constructor === void 0 ? v({}, e) : null;
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function R(n, r, i, a, o, s, c, l, u) {
|
|
183
183
|
var d, f, p, h, g, v, b, x = i.props || m, S = r.props, C = r.type;
|
|
184
184
|
if (C == "svg" ? o = "http://www.w3.org/2000/svg" : C == "math" ? o = "http://www.w3.org/1998/Math/MathML" : o || (o = "http://www.w3.org/1999/xhtml"), s != null) {
|
|
185
185
|
for (d = 0; d < s.length; d++) if ((g = s[d]) && "setAttribute" in g == !!C && (C ? g.localName == C : g.nodeType == 3)) {
|
|
@@ -202,7 +202,7 @@ function te(n, r, i, a, o, s, c, l, u) {
|
|
|
202
202
|
}
|
|
203
203
|
return n;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function ne(e, n, r) {
|
|
206
206
|
try {
|
|
207
207
|
if (typeof e == "function") {
|
|
208
208
|
var i = typeof e.__u == "function";
|
|
@@ -212,9 +212,9 @@ function z(e, n, r) {
|
|
|
212
212
|
t.__e(e, r);
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function z(e, n, r) {
|
|
216
216
|
var i, a;
|
|
217
|
-
if (t.unmount && t.unmount(e), (i = e.ref) && (i.current && i.current != e.__e ||
|
|
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 {
|
|
219
219
|
i.componentWillUnmount();
|
|
220
220
|
} catch (e) {
|
|
@@ -222,7 +222,7 @@ function ne(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] &&
|
|
225
|
+
if (i = e.__k) for (a = 0; a < i.length; a++) i[a] && z(i[a], n, r || typeof e.type != "function");
|
|
226
226
|
r || y(e.__e), e.__c = e.__ = e.__e = void 0;
|
|
227
227
|
}
|
|
228
228
|
function re(e, t, n) {
|
|
@@ -230,7 +230,7 @@ function re(e, t, n) {
|
|
|
230
230
|
}
|
|
231
231
|
function ie(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 = [],
|
|
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;
|
|
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
|
|
253
|
-
function
|
|
254
|
-
|
|
255
|
-
var n =
|
|
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 = {
|
|
256
256
|
__: [],
|
|
257
257
|
__h: []
|
|
258
258
|
});
|
|
259
259
|
return e >= n.__.length && n.__.push({}), n.__[e];
|
|
260
260
|
}
|
|
261
|
-
function
|
|
262
|
-
return
|
|
261
|
+
function U(e) {
|
|
262
|
+
return se = 1, ge(we, e);
|
|
263
263
|
}
|
|
264
|
-
function
|
|
265
|
-
var r =
|
|
266
|
-
if (r.t = e, !r.__c && (r.__ = [n ? n(t) :
|
|
264
|
+
function ge(e, t, n) {
|
|
265
|
+
var r = he(B++, 2);
|
|
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 =
|
|
269
|
+
}], r.__c = V, !V.__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,116 +282,116 @@ function _e(e, t, n) {
|
|
|
282
282
|
}
|
|
283
283
|
return !i || o;
|
|
284
284
|
};
|
|
285
|
-
|
|
286
|
-
var a =
|
|
287
|
-
|
|
285
|
+
V.__f = !0;
|
|
286
|
+
var a = V.shouldComponentUpdate, o = V.componentWillUpdate;
|
|
287
|
+
V.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
|
-
},
|
|
293
|
+
}, V.shouldComponentUpdate = i;
|
|
294
294
|
}
|
|
295
295
|
return r.__N || r.__;
|
|
296
296
|
}
|
|
297
|
-
function
|
|
298
|
-
var n =
|
|
299
|
-
!
|
|
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));
|
|
300
300
|
}
|
|
301
|
-
function
|
|
302
|
-
var n =
|
|
303
|
-
!
|
|
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));
|
|
304
304
|
}
|
|
305
|
-
function
|
|
306
|
-
return
|
|
305
|
+
function G(e) {
|
|
306
|
+
return se = 5, K(function() {
|
|
307
307
|
return { current: e };
|
|
308
308
|
}, []);
|
|
309
309
|
}
|
|
310
|
-
function G(e, t) {
|
|
311
|
-
var n = ge(ae++, 7);
|
|
312
|
-
return we(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
|
|
313
|
-
}
|
|
314
310
|
function K(e, t) {
|
|
315
|
-
|
|
311
|
+
var n = he(B++, 7);
|
|
312
|
+
return Ce(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
|
|
313
|
+
}
|
|
314
|
+
function q(e, t) {
|
|
315
|
+
return se = 8, K(function() {
|
|
316
316
|
return e;
|
|
317
317
|
}, t);
|
|
318
318
|
}
|
|
319
|
-
function
|
|
320
|
-
for (var e; e =
|
|
319
|
+
function ve() {
|
|
320
|
+
for (var e; e = ce.shift();) {
|
|
321
321
|
var t = e.__H;
|
|
322
322
|
if (e.__P && t) try {
|
|
323
|
-
t.__h.some(
|
|
323
|
+
t.__h.some(xe), t.__h.some(Se), t.__h = [];
|
|
324
324
|
} catch (n) {
|
|
325
|
-
t.__h = [],
|
|
325
|
+
t.__h = [], H.__e(n, e.__v);
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
},
|
|
332
|
-
e && t.__k && t.__k.__m && (e.__m = t.__k.__m),
|
|
333
|
-
},
|
|
334
|
-
|
|
335
|
-
var t = (
|
|
336
|
-
t && (
|
|
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) {
|
|
337
337
|
e.__N && (e.__ = e.__N), e.u = e.__N = void 0;
|
|
338
|
-
})) : (t.__h.some(
|
|
339
|
-
},
|
|
340
|
-
|
|
338
|
+
})) : (t.__h.some(xe), t.__h.some(Se), t.__h = [], B = 0)), ae = V;
|
|
339
|
+
}, H.diffed = function(e) {
|
|
340
|
+
de && de(e);
|
|
341
341
|
var t = e.__c;
|
|
342
|
-
t && t.__H && (t.__H.__h.length && (
|
|
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) {
|
|
343
343
|
e.u && (e.__H = e.u, e.u = void 0);
|
|
344
|
-
})),
|
|
345
|
-
},
|
|
344
|
+
})), ae = V = null;
|
|
345
|
+
}, H.__c = function(e, t) {
|
|
346
346
|
t.some(function(e) {
|
|
347
347
|
try {
|
|
348
|
-
e.__h.some(
|
|
349
|
-
return !e.__ ||
|
|
348
|
+
e.__h.some(xe), e.__h = e.__h.filter(function(e) {
|
|
349
|
+
return !e.__ || Se(e);
|
|
350
350
|
});
|
|
351
351
|
} catch (n) {
|
|
352
352
|
t.some(function(e) {
|
|
353
353
|
e.__h && (e.__h = []);
|
|
354
|
-
}), t = [],
|
|
354
|
+
}), t = [], H.__e(n, e.__v);
|
|
355
355
|
}
|
|
356
|
-
}),
|
|
357
|
-
},
|
|
358
|
-
|
|
356
|
+
}), fe && fe(e, t);
|
|
357
|
+
}, H.unmount = function(e) {
|
|
358
|
+
pe && pe(e);
|
|
359
359
|
var t, n = e.__c;
|
|
360
360
|
n && n.__H && (n.__H.__.some(function(e) {
|
|
361
361
|
try {
|
|
362
|
-
|
|
362
|
+
xe(e);
|
|
363
363
|
} catch (e) {
|
|
364
364
|
t = e;
|
|
365
365
|
}
|
|
366
|
-
}), n.__H = void 0, t &&
|
|
366
|
+
}), n.__H = void 0, t && H.__e(t, n.__v));
|
|
367
367
|
};
|
|
368
|
-
var
|
|
369
|
-
function
|
|
368
|
+
var ye = typeof requestAnimationFrame == "function";
|
|
369
|
+
function be(e) {
|
|
370
370
|
var t, n = function() {
|
|
371
|
-
clearTimeout(r),
|
|
371
|
+
clearTimeout(r), ye && cancelAnimationFrame(t), setTimeout(e);
|
|
372
372
|
}, r = setTimeout(n, 35);
|
|
373
|
-
|
|
373
|
+
ye && (t = requestAnimationFrame(n));
|
|
374
374
|
}
|
|
375
|
-
function
|
|
376
|
-
var t =
|
|
377
|
-
typeof n == "function" && (e.__c = void 0, n()),
|
|
375
|
+
function xe(e) {
|
|
376
|
+
var t = V, n = e.__c;
|
|
377
|
+
typeof n == "function" && (e.__c = void 0, n()), V = t;
|
|
378
378
|
}
|
|
379
|
-
function
|
|
380
|
-
var t =
|
|
381
|
-
e.__c = e.__(),
|
|
379
|
+
function Se(e) {
|
|
380
|
+
var t = V;
|
|
381
|
+
e.__c = e.__(), V = t;
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function Ce(e, t) {
|
|
384
384
|
return !e || e.length !== t.length || t.some(function(t, n) {
|
|
385
385
|
return t !== e[n];
|
|
386
386
|
});
|
|
387
387
|
}
|
|
388
|
-
function
|
|
388
|
+
function we(e, t) {
|
|
389
389
|
return typeof t == "function" ? t(e) : t;
|
|
390
390
|
}
|
|
391
391
|
//#endregion
|
|
392
392
|
//#region src/lib/context.ts
|
|
393
|
-
var
|
|
394
|
-
function
|
|
393
|
+
var Te = /* @__PURE__ */ new Set(["sessionId"]);
|
|
394
|
+
function Ee(e) {
|
|
395
395
|
if (typeof e == "string") return e.length > 0 ? { id: e } : void 0;
|
|
396
396
|
if (!e || typeof e != "object" || Array.isArray(e)) return;
|
|
397
397
|
let { id: t, name: n } = e;
|
|
@@ -400,32 +400,32 @@ function De(e) {
|
|
|
400
400
|
name: n
|
|
401
401
|
} : { id: t };
|
|
402
402
|
}
|
|
403
|
-
function
|
|
404
|
-
let t =
|
|
403
|
+
function De(e) {
|
|
404
|
+
let t = Ee(e);
|
|
405
405
|
if (t) return t.name ?? t.id;
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function Oe(e) {
|
|
408
408
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
409
409
|
}
|
|
410
|
-
function
|
|
410
|
+
function ke(e) {
|
|
411
411
|
let t = {};
|
|
412
412
|
for (let [n, r] of Object.entries(e)) {
|
|
413
|
-
if (
|
|
413
|
+
if (Te.has(n) || !Oe(r)) {
|
|
414
414
|
t[n] = r;
|
|
415
415
|
continue;
|
|
416
416
|
}
|
|
417
|
-
let e =
|
|
417
|
+
let e = Ee(r);
|
|
418
418
|
e && (t[`${n}Id`] = e.id, e.name && (t[`${n}Name`] = e.name));
|
|
419
419
|
}
|
|
420
420
|
return t;
|
|
421
421
|
}
|
|
422
422
|
//#endregion
|
|
423
423
|
//#region src/lib/i18n.ts
|
|
424
|
-
var
|
|
424
|
+
var Ae = "en", je = [
|
|
425
425
|
"en",
|
|
426
426
|
"fr",
|
|
427
427
|
"es"
|
|
428
|
-
],
|
|
428
|
+
], Me = {
|
|
429
429
|
en: {
|
|
430
430
|
heading: "Assistant",
|
|
431
431
|
subheading: "Squadico",
|
|
@@ -464,6 +464,7 @@ var je = "en", Me = [
|
|
|
464
464
|
noValue: "no"
|
|
465
465
|
},
|
|
466
466
|
choices: "Suggested options",
|
|
467
|
+
poweredBy: "Powered by Squadico",
|
|
467
468
|
handles: {
|
|
468
469
|
picker: "Agents you can address",
|
|
469
470
|
unknown: "Nobody answers to that name here:",
|
|
@@ -533,6 +534,7 @@ var je = "en", Me = [
|
|
|
533
534
|
noValue: "non"
|
|
534
535
|
},
|
|
535
536
|
choices: "Options proposées",
|
|
537
|
+
poweredBy: "Propulsé par Squadico",
|
|
536
538
|
handles: {
|
|
537
539
|
picker: "Agents que vous pouvez adresser",
|
|
538
540
|
unknown: "Personne ne répond à ce nom ici :",
|
|
@@ -602,6 +604,7 @@ var je = "en", Me = [
|
|
|
602
604
|
noValue: "no"
|
|
603
605
|
},
|
|
604
606
|
choices: "Opciones propuestas",
|
|
607
|
+
poweredBy: "Con la tecnología de Squadico",
|
|
605
608
|
handles: {
|
|
606
609
|
picker: "Agentes a los que puedes dirigirte",
|
|
607
610
|
unknown: "Nadie responde a ese nombre aquí:",
|
|
@@ -633,50 +636,50 @@ var je = "en", Me = [
|
|
|
633
636
|
error: "Se ha producido un error, el asistente no ha podido responder. Inténtelo de nuevo.",
|
|
634
637
|
withHuman: "Un miembro del equipo le responderá aquí."
|
|
635
638
|
}
|
|
636
|
-
},
|
|
639
|
+
}, Ne = {
|
|
637
640
|
en: "en-GB",
|
|
638
641
|
fr: "fr-FR",
|
|
639
642
|
es: "es-ES"
|
|
640
643
|
};
|
|
641
|
-
function
|
|
644
|
+
function Pe(e) {
|
|
642
645
|
let t = e?.trim().toLowerCase().split(/[-_]/)[0];
|
|
643
|
-
return t && t in
|
|
646
|
+
return t && t in Me ? t : void 0;
|
|
644
647
|
}
|
|
645
|
-
function
|
|
648
|
+
function Fe() {
|
|
646
649
|
return typeof navigator > "u" ? [] : navigator.languages?.length ? navigator.languages : [navigator.language];
|
|
647
650
|
}
|
|
648
|
-
function
|
|
649
|
-
let t = e?.trim(), n = (t ? [t] :
|
|
651
|
+
function Ie(e) {
|
|
652
|
+
let t = e?.trim(), n = (t ? [t] : Fe()).find(Pe), r = Pe(n) ?? "en";
|
|
650
653
|
return {
|
|
651
654
|
code: r,
|
|
652
|
-
tag: n?.includes("-") ? n :
|
|
653
|
-
t:
|
|
655
|
+
tag: n?.includes("-") ? n : Ne[r],
|
|
656
|
+
t: Me[r]
|
|
654
657
|
};
|
|
655
658
|
}
|
|
656
659
|
//#endregion
|
|
657
660
|
//#region src/lib/openState.ts
|
|
658
|
-
var
|
|
659
|
-
function
|
|
661
|
+
var Le = "squadico-chatbot:open";
|
|
662
|
+
function Re() {
|
|
660
663
|
try {
|
|
661
664
|
if (typeof sessionStorage > "u") return;
|
|
662
|
-
let e = sessionStorage.getItem(
|
|
665
|
+
let e = sessionStorage.getItem(Le);
|
|
663
666
|
return e === "1" || e !== "0" && void 0;
|
|
664
667
|
} catch {
|
|
665
668
|
return;
|
|
666
669
|
}
|
|
667
670
|
}
|
|
668
|
-
function
|
|
671
|
+
function ze(e) {
|
|
669
672
|
try {
|
|
670
673
|
if (typeof sessionStorage > "u") return;
|
|
671
|
-
sessionStorage.setItem(
|
|
674
|
+
sessionStorage.setItem(Le, e ? "1" : "0");
|
|
672
675
|
} catch {}
|
|
673
676
|
}
|
|
674
|
-
function
|
|
675
|
-
return t === !1 ? e ?? !1 :
|
|
677
|
+
function Be(e, t) {
|
|
678
|
+
return t === !1 ? e ?? !1 : Re() ?? e ?? !1;
|
|
676
679
|
}
|
|
677
680
|
//#endregion
|
|
678
681
|
//#region src/lib/uid.ts
|
|
679
|
-
function
|
|
682
|
+
function Ve() {
|
|
680
683
|
let e = globalThis.crypto;
|
|
681
684
|
if (e && typeof e.randomUUID == "function") return e.randomUUID();
|
|
682
685
|
let t = /* @__PURE__ */ new Uint8Array(16);
|
|
@@ -689,36 +692,36 @@ function He() {
|
|
|
689
692
|
}
|
|
690
693
|
//#endregion
|
|
691
694
|
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/typeof.js
|
|
692
|
-
function
|
|
695
|
+
function He(e) {
|
|
693
696
|
"@babel/helpers - typeof";
|
|
694
|
-
return
|
|
697
|
+
return He = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
695
698
|
return typeof e;
|
|
696
699
|
} : function(e) {
|
|
697
700
|
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
698
|
-
},
|
|
701
|
+
}, He(e);
|
|
699
702
|
}
|
|
700
703
|
//#endregion
|
|
701
704
|
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/toPrimitive.js
|
|
702
|
-
function
|
|
703
|
-
if (
|
|
705
|
+
function Ue(e, t) {
|
|
706
|
+
if (He(e) != "object" || !e) return e;
|
|
704
707
|
var n = e[Symbol.toPrimitive];
|
|
705
708
|
if (n !== void 0) {
|
|
706
709
|
var r = n.call(e, t || "default");
|
|
707
|
-
if (
|
|
710
|
+
if (He(r) != "object") return r;
|
|
708
711
|
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
709
712
|
}
|
|
710
713
|
return (t === "string" ? String : Number)(e);
|
|
711
714
|
}
|
|
712
715
|
//#endregion
|
|
713
716
|
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/toPropertyKey.js
|
|
714
|
-
function
|
|
715
|
-
var t =
|
|
716
|
-
return
|
|
717
|
+
function We(e) {
|
|
718
|
+
var t = Ue(e, "string");
|
|
719
|
+
return He(t) == "symbol" ? t : t + "";
|
|
717
720
|
}
|
|
718
721
|
//#endregion
|
|
719
722
|
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/defineProperty.js
|
|
720
|
-
function
|
|
721
|
-
return (t =
|
|
723
|
+
function Ge(e, t, n) {
|
|
724
|
+
return (t = We(t)) in e ? Object.defineProperty(e, t, {
|
|
722
725
|
value: n,
|
|
723
726
|
enumerable: !0,
|
|
724
727
|
configurable: !0,
|
|
@@ -727,36 +730,37 @@ function Ke(e, t, n) {
|
|
|
727
730
|
}
|
|
728
731
|
//#endregion
|
|
729
732
|
//#region src/lib/client.ts
|
|
730
|
-
var
|
|
733
|
+
var Ke = "https://api.squadico.com", qe = 2e4, J = class extends Error {
|
|
731
734
|
constructor(e, t, n) {
|
|
732
|
-
super(e),
|
|
735
|
+
super(e), Ge(this, "status", void 0), Ge(this, "code", void 0), this.name = "ChatHttpError", this.status = t, this.code = n;
|
|
733
736
|
}
|
|
734
737
|
};
|
|
735
|
-
function
|
|
738
|
+
function Je(e, t) {
|
|
736
739
|
return `${e.replace(/\/+$/, "")}${t}`;
|
|
737
740
|
}
|
|
738
|
-
function
|
|
741
|
+
function Ye(e, t) {
|
|
739
742
|
return {
|
|
740
743
|
"Content-Type": "application/json",
|
|
741
744
|
Accept: "text/event-stream, application/json",
|
|
742
|
-
...e ? { "X-Visitor-Token": e } : {}
|
|
745
|
+
...e ? { "X-Visitor-Token": e } : {},
|
|
746
|
+
...t ? { "X-Subject-Token": t } : {}
|
|
743
747
|
};
|
|
744
748
|
}
|
|
745
|
-
function
|
|
749
|
+
function Xe(e) {
|
|
746
750
|
if (!e || typeof e != "object") return;
|
|
747
751
|
let { loc: t, msg: n } = e;
|
|
748
752
|
if (typeof n != "string" || !n) return;
|
|
749
753
|
let r = (Array.isArray(t) ? t.filter((e) => typeof e == "string") : []).at(-1);
|
|
750
754
|
return r && r !== "body" ? `${r}: ${n}` : n;
|
|
751
755
|
}
|
|
752
|
-
async function
|
|
756
|
+
async function Ze(e) {
|
|
753
757
|
let t = "", n;
|
|
754
758
|
try {
|
|
755
759
|
let r = await e.text();
|
|
756
760
|
if (r) try {
|
|
757
761
|
let e = JSON.parse(r), i = e.detail ?? e.message;
|
|
758
762
|
if (Array.isArray(i)) {
|
|
759
|
-
let e = i.map((e) =>
|
|
763
|
+
let e = i.map((e) => Xe(e) ?? (typeof e == "string" ? e : void 0)).filter((e) => e !== void 0);
|
|
760
764
|
t = e.length > 0 ? e.join(", ") : r;
|
|
761
765
|
} else t = typeof i == "string" ? i : r;
|
|
762
766
|
n = typeof e.code == "string" ? e.code : void 0;
|
|
@@ -764,9 +768,9 @@ async function Qe(e) {
|
|
|
764
768
|
t = r;
|
|
765
769
|
}
|
|
766
770
|
} catch {}
|
|
767
|
-
return new
|
|
771
|
+
return new J(t || `The API answered ${e.status}`, e.status, n);
|
|
768
772
|
}
|
|
769
|
-
function
|
|
773
|
+
function Qe(e) {
|
|
770
774
|
if (!e || typeof e != "object") return;
|
|
771
775
|
let t = e;
|
|
772
776
|
if (!(typeof t.handle != "string" || !t.handle)) return {
|
|
@@ -776,10 +780,10 @@ function $e(e) {
|
|
|
776
780
|
color: typeof t.color == "string" ? t.color : void 0
|
|
777
781
|
};
|
|
778
782
|
}
|
|
779
|
-
function
|
|
780
|
-
return (Array.isArray(e) ? e : []).map(
|
|
783
|
+
function $e(e) {
|
|
784
|
+
return (Array.isArray(e) ? e : []).map(Qe).filter((e) => e !== void 0);
|
|
781
785
|
}
|
|
782
|
-
function
|
|
786
|
+
function et(e) {
|
|
783
787
|
if (!e || typeof e != "object") return;
|
|
784
788
|
let t = e;
|
|
785
789
|
if (!(typeof t.tool_call_id != "string" || !t.tool_call_id)) return {
|
|
@@ -788,26 +792,26 @@ function tt(e) {
|
|
|
788
792
|
arguments: t.arguments && typeof t.arguments == "object" ? t.arguments : {}
|
|
789
793
|
};
|
|
790
794
|
}
|
|
791
|
-
var
|
|
792
|
-
function
|
|
793
|
-
if (typeof e.role != "string" || !
|
|
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;
|
|
794
798
|
let t = typeof e.created_at == "string" ? Date.parse(e.created_at) : NaN;
|
|
795
799
|
return {
|
|
796
|
-
id: typeof e.id == "string" && e.id ? e.id :
|
|
800
|
+
id: typeof e.id == "string" && e.id ? e.id : Ve(),
|
|
797
801
|
role: e.role,
|
|
798
802
|
content: e.content,
|
|
799
803
|
createdAt: Number.isNaN(t) ? Date.now() : t,
|
|
800
|
-
agent:
|
|
801
|
-
attachments:
|
|
804
|
+
agent: Qe(e.agent),
|
|
805
|
+
attachments: rt(e.attachments),
|
|
802
806
|
authorName: e.kind === "human" && typeof e.author_name == "string" && e.author_name ? e.author_name : void 0
|
|
803
807
|
};
|
|
804
808
|
}
|
|
805
|
-
function
|
|
809
|
+
function rt(e) {
|
|
806
810
|
if (!Array.isArray(e)) return;
|
|
807
|
-
let t = e.map((e) =>
|
|
811
|
+
let t = e.map((e) => it(e)).filter((e) => e !== null);
|
|
808
812
|
return t.length > 0 ? t : void 0;
|
|
809
813
|
}
|
|
810
|
-
function
|
|
814
|
+
function it(e) {
|
|
811
815
|
if (!e || typeof e != "object") return null;
|
|
812
816
|
let { id: t, kind: n, filename: r, content_type: i } = e;
|
|
813
817
|
return typeof t != "string" || !t || typeof r != "string" || !r ? null : {
|
|
@@ -817,20 +821,20 @@ function at(e) {
|
|
|
817
821
|
contentType: typeof i == "string" ? i : "application/octet-stream"
|
|
818
822
|
};
|
|
819
823
|
}
|
|
820
|
-
async function
|
|
821
|
-
let t = await fetch(
|
|
824
|
+
async function at(e) {
|
|
825
|
+
let t = await fetch(Je(e.apiUrl, `/public/applications/${encodeURIComponent(e.embedKey)}/conversations`), {
|
|
822
826
|
method: "POST",
|
|
823
|
-
headers:
|
|
827
|
+
headers: Ye(),
|
|
824
828
|
body: JSON.stringify({
|
|
825
829
|
...e.user ? { user: e.user } : {},
|
|
826
830
|
...e.agent ? { agent: e.agent } : {}
|
|
827
831
|
}),
|
|
828
832
|
signal: e.signal
|
|
829
833
|
});
|
|
830
|
-
if (!t.ok) throw await
|
|
834
|
+
if (!t.ok) throw await Ze(t);
|
|
831
835
|
let n = await t.json();
|
|
832
|
-
if (typeof n.id != "string" || typeof n.visitor_token != "string") throw new
|
|
833
|
-
let r = (Array.isArray(n.messages) ? n.messages : []).map(
|
|
836
|
+
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);
|
|
834
838
|
return {
|
|
835
839
|
conversationId: n.id,
|
|
836
840
|
visitorToken: n.visitor_token,
|
|
@@ -838,87 +842,89 @@ async function ot(e) {
|
|
|
838
842
|
agentSlug: typeof n.agent_slug == "string" ? n.agent_slug : "",
|
|
839
843
|
welcomeMessage: typeof n.welcome_message == "string" && n.welcome_message ? n.welcome_message : void 0,
|
|
840
844
|
messages: r,
|
|
841
|
-
handles:
|
|
845
|
+
handles: $e(n.handles),
|
|
842
846
|
agentHandle: typeof n.agent_handle == "string" && n.agent_handle ? n.agent_handle : void 0,
|
|
843
|
-
withHuman: typeof n.handling == "string" && n.handling !== "agents"
|
|
847
|
+
withHuman: typeof n.handling == "string" && n.handling !== "agents",
|
|
848
|
+
branding: n.branding === !0
|
|
844
849
|
};
|
|
845
850
|
}
|
|
846
|
-
async function
|
|
847
|
-
let t = await fetch(
|
|
851
|
+
async function ot(e) {
|
|
852
|
+
let t = await fetch(Je(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}`), {
|
|
848
853
|
method: "GET",
|
|
849
|
-
headers:
|
|
854
|
+
headers: Ye(e.visitorToken),
|
|
850
855
|
signal: e.signal
|
|
851
856
|
});
|
|
852
|
-
if (!t.ok) throw await
|
|
857
|
+
if (!t.ok) throw await Ze(t);
|
|
853
858
|
let n = await t.json();
|
|
854
|
-
if (typeof n.id != "string") throw new
|
|
859
|
+
if (typeof n.id != "string") throw new J("The API replayed a conversation without an id");
|
|
855
860
|
return {
|
|
856
861
|
conversationId: n.id,
|
|
857
862
|
visitorToken: e.visitorToken,
|
|
858
863
|
agentName: typeof n.agent_name == "string" ? n.agent_name : "",
|
|
859
864
|
agentSlug: typeof n.agent_slug == "string" ? n.agent_slug : "",
|
|
860
865
|
welcomeMessage: typeof n.welcome_message == "string" && n.welcome_message ? n.welcome_message : void 0,
|
|
861
|
-
messages: (Array.isArray(n.messages) ? n.messages : []).map(
|
|
862
|
-
handles:
|
|
866
|
+
messages: (Array.isArray(n.messages) ? n.messages : []).map(nt).filter((e) => e !== null),
|
|
867
|
+
handles: $e(n.handles),
|
|
863
868
|
agentHandle: typeof n.agent_handle == "string" && n.agent_handle ? n.agent_handle : void 0,
|
|
864
|
-
withHuman: typeof n.handling == "string" && n.handling !== "agents"
|
|
869
|
+
withHuman: typeof n.handling == "string" && n.handling !== "agents",
|
|
870
|
+
branding: n.branding === !0
|
|
865
871
|
};
|
|
866
872
|
}
|
|
867
|
-
async function
|
|
873
|
+
async function st(e) {
|
|
868
874
|
let t = new FormData();
|
|
869
875
|
t.append("file", e.file);
|
|
870
|
-
let n = await fetch(
|
|
876
|
+
let n = await fetch(ut(e), {
|
|
871
877
|
method: "POST",
|
|
872
878
|
headers: { "X-Visitor-Token": e.visitorToken },
|
|
873
879
|
body: t,
|
|
874
880
|
signal: e.signal
|
|
875
881
|
});
|
|
876
|
-
if (!n.ok) throw await
|
|
877
|
-
let r =
|
|
878
|
-
if (!r) throw new
|
|
882
|
+
if (!n.ok) throw await Ze(n);
|
|
883
|
+
let r = it(await n.json());
|
|
884
|
+
if (!r) throw new J("The upload could not be read", n.status);
|
|
879
885
|
return r;
|
|
880
886
|
}
|
|
881
|
-
async function
|
|
882
|
-
let t = await fetch(`${
|
|
887
|
+
async function ct(e) {
|
|
888
|
+
let t = await fetch(`${ut(e)}/${encodeURIComponent(e.attachmentId)}`, {
|
|
883
889
|
method: "DELETE",
|
|
884
890
|
headers: { "X-Visitor-Token": e.visitorToken },
|
|
885
891
|
signal: e.signal
|
|
886
892
|
});
|
|
887
|
-
if (!t.ok) throw await
|
|
893
|
+
if (!t.ok) throw await Ze(t);
|
|
888
894
|
}
|
|
889
|
-
async function
|
|
890
|
-
let t = await fetch(`${
|
|
895
|
+
async function lt(e) {
|
|
896
|
+
let t = await fetch(`${ut(e)}/${encodeURIComponent(e.attachmentId)}/content`, {
|
|
891
897
|
headers: { "X-Visitor-Token": e.visitorToken },
|
|
892
898
|
signal: e.signal
|
|
893
899
|
});
|
|
894
|
-
if (!t.ok) throw await
|
|
900
|
+
if (!t.ok) throw await Ze(t);
|
|
895
901
|
return t.blob();
|
|
896
902
|
}
|
|
897
|
-
function
|
|
898
|
-
return
|
|
903
|
+
function ut(e) {
|
|
904
|
+
return Je(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/attachments`);
|
|
899
905
|
}
|
|
900
|
-
async function
|
|
901
|
-
return
|
|
906
|
+
async function dt(e) {
|
|
907
|
+
return pt(Je(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/messages`), {
|
|
902
908
|
content: e.message,
|
|
903
909
|
attachment_ids: e.attachmentIds ?? [],
|
|
904
910
|
...e.context && Object.keys(e.context).length > 0 ? { context: e.context } : {}
|
|
905
911
|
}, e);
|
|
906
912
|
}
|
|
907
|
-
async function
|
|
908
|
-
return
|
|
913
|
+
async function ft(e) {
|
|
914
|
+
return pt(Je(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/approvals`), {
|
|
909
915
|
tool_call_id: e.toolCallId,
|
|
910
916
|
approved: e.approved
|
|
911
917
|
}, e);
|
|
912
918
|
}
|
|
913
|
-
async function
|
|
919
|
+
async function pt(e, t, n) {
|
|
914
920
|
let r = await fetch(e, {
|
|
915
921
|
method: "POST",
|
|
916
|
-
headers:
|
|
922
|
+
headers: Ye(n.visitorToken, n.subjectToken),
|
|
917
923
|
body: JSON.stringify(t),
|
|
918
924
|
signal: n.signal
|
|
919
925
|
});
|
|
920
|
-
if (!r.ok) throw await
|
|
921
|
-
if (!r.body) throw new
|
|
926
|
+
if (!r.ok) throw await Ze(r);
|
|
927
|
+
if (!r.body) throw new J("Answer with no stream body");
|
|
922
928
|
let i = r.body.getReader(), a = new TextDecoder(), o = "", s = "", c = "", l, u, d = { answer: "" };
|
|
923
929
|
try {
|
|
924
930
|
for (;;) {
|
|
@@ -946,23 +952,23 @@ async function mt(e, t, n) {
|
|
|
946
952
|
} catch {
|
|
947
953
|
continue;
|
|
948
954
|
}
|
|
949
|
-
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 =
|
|
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");
|
|
950
956
|
}
|
|
951
957
|
if (l) break;
|
|
952
958
|
}
|
|
953
959
|
} finally {
|
|
954
960
|
i.cancel().catch(() => void 0);
|
|
955
961
|
}
|
|
956
|
-
if (l) throw new
|
|
962
|
+
if (l) throw new J(l);
|
|
957
963
|
return !d.answer && !d.approval && (d.answer = c), u && !d.agent && (d.authorName = u), d;
|
|
958
964
|
}
|
|
959
965
|
//#endregion
|
|
960
966
|
//#region src/lib/conversation.ts
|
|
961
|
-
var
|
|
962
|
-
function
|
|
967
|
+
var mt = "squadico-chatbot:conversation";
|
|
968
|
+
function ht() {
|
|
963
969
|
try {
|
|
964
970
|
if (typeof sessionStorage > "u") return;
|
|
965
|
-
let e = sessionStorage.getItem(
|
|
971
|
+
let e = sessionStorage.getItem(mt);
|
|
966
972
|
if (!e) return;
|
|
967
973
|
let t = JSON.parse(e);
|
|
968
974
|
return !t.sessionId || !t.visitorToken || !t.embedKey ? void 0 : {
|
|
@@ -975,103 +981,110 @@ function gt() {
|
|
|
975
981
|
return;
|
|
976
982
|
}
|
|
977
983
|
}
|
|
978
|
-
function
|
|
984
|
+
function gt(e) {
|
|
979
985
|
try {
|
|
980
986
|
if (typeof sessionStorage > "u") return;
|
|
981
|
-
sessionStorage.setItem(
|
|
987
|
+
sessionStorage.setItem(mt, JSON.stringify(e));
|
|
982
988
|
} catch {}
|
|
983
989
|
}
|
|
984
|
-
function
|
|
990
|
+
function _t() {
|
|
985
991
|
try {
|
|
986
992
|
if (typeof sessionStorage > "u") return;
|
|
987
|
-
sessionStorage.removeItem(
|
|
993
|
+
sessionStorage.removeItem(mt);
|
|
988
994
|
} catch {}
|
|
989
995
|
}
|
|
990
|
-
function
|
|
996
|
+
function vt(e, { embedKey: t, user: n }) {
|
|
991
997
|
return e.embedKey === t && e.user === n;
|
|
992
998
|
}
|
|
993
999
|
//#endregion
|
|
994
1000
|
//#region src/lib/useChat.ts
|
|
1001
|
+
async function yt(e) {
|
|
1002
|
+
if (e) try {
|
|
1003
|
+
return await e() || void 0;
|
|
1004
|
+
} catch {
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
995
1008
|
function bt(e) {
|
|
996
|
-
let t = e instanceof
|
|
1009
|
+
let t = e instanceof J ? e.status : void 0;
|
|
997
1010
|
return t === 415 ? "unsupported" : t === 413 ? "tooLarge" : t === 409 ? "tooMany" : t === 422 ? "unreadable" : "failed";
|
|
998
1011
|
}
|
|
999
1012
|
var xt = 5e3;
|
|
1000
1013
|
function St(e) {
|
|
1001
|
-
return e instanceof
|
|
1014
|
+
return e instanceof J && e.code === "conversation_retired";
|
|
1002
1015
|
}
|
|
1003
1016
|
function Ct(e) {
|
|
1004
|
-
let [t, n] =
|
|
1005
|
-
|
|
1006
|
-
let
|
|
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 ? {
|
|
1007
1020
|
id: "greeting",
|
|
1008
1021
|
role: "assistant",
|
|
1009
|
-
content:
|
|
1022
|
+
content: O,
|
|
1010
1023
|
createdAt: Date.now()
|
|
1011
|
-
} : null, [
|
|
1012
|
-
|
|
1013
|
-
}, []),
|
|
1024
|
+
} : null, [O]), A = q((e) => {
|
|
1025
|
+
w.current.onEvent?.(e);
|
|
1026
|
+
}, []), j = q((e, t) => {
|
|
1014
1027
|
n((n) => n.map((n) => n.id === e ? {
|
|
1015
1028
|
...n,
|
|
1016
1029
|
...t
|
|
1017
1030
|
} : n));
|
|
1018
|
-
}, []),
|
|
1019
|
-
let n = e instanceof
|
|
1020
|
-
t &&
|
|
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, {
|
|
1021
1034
|
content: i,
|
|
1022
1035
|
streaming: !1,
|
|
1023
1036
|
error: !0
|
|
1024
|
-
}),
|
|
1037
|
+
}), A({
|
|
1025
1038
|
type: "chatbot-error",
|
|
1026
1039
|
message: r,
|
|
1027
1040
|
status: n,
|
|
1028
|
-
sessionId:
|
|
1041
|
+
sessionId: E.current?.sessionId ?? ""
|
|
1029
1042
|
}), typeof console < "u" && console.error("[squadico-chatbot]", r);
|
|
1030
|
-
}, [
|
|
1031
|
-
if (
|
|
1032
|
-
if (
|
|
1033
|
-
let e =
|
|
1034
|
-
if (!e.embedKey) throw new
|
|
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;
|
|
1047
|
+
if (!e.embedKey) throw new J("No embed key: nothing says which application to open");
|
|
1035
1048
|
let t = e.user, r = e.apiUrl ?? "https://api.squadico.com", i = e.embedKey, a = (r) => {
|
|
1036
1049
|
let a = {
|
|
1037
1050
|
sessionId: r.conversationId,
|
|
1038
1051
|
visitorToken: r.visitorToken
|
|
1039
1052
|
};
|
|
1040
|
-
return
|
|
1053
|
+
return E.current = a, D.current = t?.id, gt({
|
|
1041
1054
|
...a,
|
|
1042
1055
|
embedKey: i,
|
|
1043
1056
|
user: t?.id
|
|
1044
|
-
}), o(r.conversationId), c(r.handles), u(e.agent && r.agentHandle ? r.agentHandle : ""), m(!!r.withHuman), r.messages.length > 0 && n((e) => [...r.messages, ...e]), a;
|
|
1045
|
-
}, s = () =>
|
|
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({
|
|
1046
1059
|
apiUrl: r,
|
|
1047
1060
|
embedKey: i,
|
|
1048
1061
|
user: t,
|
|
1049
1062
|
agent: e.agent
|
|
1050
|
-
}).then(a), l =
|
|
1063
|
+
}).then(a), l = ht(), d = l && vt(l, {
|
|
1051
1064
|
embedKey: i,
|
|
1052
1065
|
user: t?.id
|
|
1053
|
-
}) ?
|
|
1066
|
+
}) ? ot({
|
|
1054
1067
|
apiUrl: r,
|
|
1055
1068
|
conversationId: l.sessionId,
|
|
1056
1069
|
visitorToken: l.visitorToken
|
|
1057
|
-
}).then(a).catch(() => (
|
|
1058
|
-
|
|
1070
|
+
}).then(a).catch(() => (_t(), s())) : s();
|
|
1071
|
+
T.current = d;
|
|
1059
1072
|
try {
|
|
1060
1073
|
return await d;
|
|
1061
1074
|
} finally {
|
|
1062
|
-
|
|
1075
|
+
T.current = null;
|
|
1063
1076
|
}
|
|
1064
|
-
}, []),
|
|
1065
|
-
|
|
1066
|
-
}, [
|
|
1067
|
-
if (
|
|
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;
|
|
1068
1081
|
let o = new AbortController();
|
|
1069
|
-
|
|
1070
|
-
let s =
|
|
1082
|
+
C.current = o, i(!0), f(null);
|
|
1083
|
+
let s = Ve();
|
|
1071
1084
|
n((t) => [
|
|
1072
1085
|
...t,
|
|
1073
1086
|
{
|
|
1074
|
-
id:
|
|
1087
|
+
id: Ve(),
|
|
1075
1088
|
role: "user",
|
|
1076
1089
|
content: e,
|
|
1077
1090
|
createdAt: Date.now(),
|
|
@@ -1085,27 +1098,27 @@ function Ct(e) {
|
|
|
1085
1098
|
streaming: !0
|
|
1086
1099
|
}
|
|
1087
1100
|
]), (async () => {
|
|
1088
|
-
let i = await
|
|
1089
|
-
|
|
1101
|
+
let i = await N();
|
|
1102
|
+
A({
|
|
1090
1103
|
type: "chatbot-message",
|
|
1091
1104
|
role: "user",
|
|
1092
1105
|
content: e,
|
|
1093
1106
|
sessionId: i.sessionId
|
|
1094
1107
|
});
|
|
1095
1108
|
let a = "", c = (e) => {
|
|
1096
|
-
a += e,
|
|
1109
|
+
a += e, j(s, { content: a });
|
|
1097
1110
|
}, l;
|
|
1098
1111
|
try {
|
|
1099
1112
|
l = await t(i, c, o.signal);
|
|
1100
1113
|
} catch (e) {
|
|
1101
|
-
if (!St(e) || (
|
|
1102
|
-
i = await
|
|
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);
|
|
1103
1116
|
}
|
|
1104
1117
|
if (l.withHuman && m(!0), l.held) {
|
|
1105
1118
|
n((e) => e.filter((e) => e.id !== s));
|
|
1106
1119
|
return;
|
|
1107
1120
|
}
|
|
1108
|
-
|
|
1121
|
+
j(s, {
|
|
1109
1122
|
content: l.answer,
|
|
1110
1123
|
streaming: !1,
|
|
1111
1124
|
agent: l.agent,
|
|
@@ -1113,7 +1126,7 @@ function Ct(e) {
|
|
|
1113
1126
|
approval: l.approval,
|
|
1114
1127
|
unknownHandle: l.unknownHandle,
|
|
1115
1128
|
offered: l.offered
|
|
1116
|
-
}), f(l.approval ?? null),
|
|
1129
|
+
}), f(l.approval ?? null), A({
|
|
1117
1130
|
type: "chatbot-message",
|
|
1118
1131
|
role: "assistant",
|
|
1119
1132
|
content: l.answer,
|
|
@@ -1122,67 +1135,69 @@ function Ct(e) {
|
|
|
1122
1135
|
});
|
|
1123
1136
|
})().catch((e) => {
|
|
1124
1137
|
if (o.signal.aborted) {
|
|
1125
|
-
|
|
1138
|
+
j(s, { streaming: !1 });
|
|
1126
1139
|
return;
|
|
1127
1140
|
}
|
|
1128
|
-
|
|
1141
|
+
M(e, s);
|
|
1129
1142
|
}).finally(() => {
|
|
1130
|
-
|
|
1143
|
+
C.current = null, i(!1);
|
|
1131
1144
|
});
|
|
1132
1145
|
}, [
|
|
1133
|
-
|
|
1134
|
-
O,
|
|
1146
|
+
N,
|
|
1135
1147
|
A,
|
|
1136
|
-
|
|
1137
|
-
|
|
1148
|
+
M,
|
|
1149
|
+
j
|
|
1150
|
+
]), ee = q((e) => {
|
|
1138
1151
|
let t = e.trim();
|
|
1139
|
-
if (!t &&
|
|
1140
|
-
let n =
|
|
1141
|
-
|
|
1142
|
-
|
|
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",
|
|
1143
1157
|
conversationId: e.sessionId,
|
|
1144
1158
|
visitorToken: e.visitorToken,
|
|
1145
1159
|
message: t,
|
|
1146
1160
|
attachmentIds: n.map((e) => e.id),
|
|
1147
|
-
context:
|
|
1161
|
+
context: w.current.context ? ke(w.current.context) : void 0,
|
|
1148
1162
|
onToken: r,
|
|
1149
1163
|
signal: i
|
|
1150
1164
|
}), {
|
|
1151
1165
|
retry: !0,
|
|
1152
1166
|
carried: n
|
|
1153
1167
|
});
|
|
1154
|
-
}, [
|
|
1155
|
-
|
|
1156
|
-
apiUrl:
|
|
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",
|
|
1157
1171
|
conversationId: t.sessionId,
|
|
1158
1172
|
visitorToken: t.visitorToken,
|
|
1159
1173
|
file: e
|
|
1160
|
-
})).then((e) =>
|
|
1174
|
+
})).then((e) => v((t) => [...t, e])).catch((e) => S(bt(e))).finally(() => b((t) => {
|
|
1161
1175
|
let n = t.indexOf(e.name);
|
|
1162
1176
|
return n < 0 ? t : [...t.slice(0, n), ...t.slice(n + 1)];
|
|
1163
1177
|
}));
|
|
1164
|
-
}, [
|
|
1165
|
-
|
|
1166
|
-
let t =
|
|
1167
|
-
t &&
|
|
1168
|
-
apiUrl:
|
|
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",
|
|
1169
1183
|
conversationId: t.sessionId,
|
|
1170
1184
|
visitorToken: t.visitorToken,
|
|
1171
1185
|
attachmentId: e
|
|
1172
1186
|
}).catch(() => {});
|
|
1173
|
-
}, []),
|
|
1174
|
-
let t =
|
|
1175
|
-
if (!t) throw new
|
|
1176
|
-
return
|
|
1177
|
-
apiUrl:
|
|
1187
|
+
}, []), te = q(async (e) => {
|
|
1188
|
+
let t = E.current;
|
|
1189
|
+
if (!t) throw new J("No conversation to read that file from");
|
|
1190
|
+
return lt({
|
|
1191
|
+
apiUrl: w.current.apiUrl ?? "https://api.squadico.com",
|
|
1178
1192
|
conversationId: t.sessionId,
|
|
1179
1193
|
visitorToken: t.visitorToken,
|
|
1180
1194
|
attachmentId: e
|
|
1181
1195
|
});
|
|
1182
|
-
}, []),
|
|
1196
|
+
}, []), R = q((e, t) => {
|
|
1183
1197
|
let n = d;
|
|
1184
|
-
n &&
|
|
1185
|
-
|
|
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",
|
|
1186
1201
|
conversationId: t.sessionId,
|
|
1187
1202
|
visitorToken: t.visitorToken,
|
|
1188
1203
|
toolCallId: n.toolCallId,
|
|
@@ -1190,61 +1205,62 @@ function Ct(e) {
|
|
|
1190
1205
|
onToken: r,
|
|
1191
1206
|
signal: i
|
|
1192
1207
|
}));
|
|
1193
|
-
}, [d,
|
|
1194
|
-
|
|
1195
|
-
}, []),
|
|
1196
|
-
|
|
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({
|
|
1197
1212
|
type: "chatbot-reset",
|
|
1198
1213
|
sessionId: ""
|
|
1199
1214
|
});
|
|
1200
|
-
}, [
|
|
1201
|
-
|
|
1215
|
+
}, [A]), re = e.humanPollMs ?? xt;
|
|
1216
|
+
W(() => {
|
|
1202
1217
|
if (!p || !a) return;
|
|
1203
1218
|
let e = setInterval(() => {
|
|
1204
|
-
let e =
|
|
1205
|
-
!e ||
|
|
1206
|
-
apiUrl:
|
|
1219
|
+
let e = E.current;
|
|
1220
|
+
!e || C.current || ot({
|
|
1221
|
+
apiUrl: w.current.apiUrl ?? "https://api.squadico.com",
|
|
1207
1222
|
conversationId: e.sessionId,
|
|
1208
1223
|
visitorToken: e.visitorToken
|
|
1209
1224
|
}).then((e) => {
|
|
1210
1225
|
n(e.messages), m(!!e.withHuman);
|
|
1211
1226
|
}).catch(() => {});
|
|
1212
|
-
},
|
|
1227
|
+
}, re);
|
|
1213
1228
|
return () => clearInterval(e);
|
|
1214
1229
|
}, [
|
|
1215
1230
|
p,
|
|
1216
1231
|
a,
|
|
1217
|
-
|
|
1232
|
+
re
|
|
1218
1233
|
]);
|
|
1219
|
-
let
|
|
1220
|
-
return
|
|
1221
|
-
|
|
1222
|
-
}, [
|
|
1223
|
-
messages:
|
|
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]),
|
|
1224
1239
|
busy: r,
|
|
1225
1240
|
sessionId: a,
|
|
1226
1241
|
handles: s,
|
|
1227
1242
|
addressee: l,
|
|
1228
1243
|
approval: d,
|
|
1229
1244
|
withHuman: p,
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
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
|
|
1241
1257
|
};
|
|
1242
1258
|
}
|
|
1243
1259
|
//#endregion
|
|
1244
1260
|
//#region node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
|
|
1245
1261
|
var wt = 0;
|
|
1246
1262
|
Array.isArray;
|
|
1247
|
-
function
|
|
1263
|
+
function Y(e, n, r, i, a, o) {
|
|
1248
1264
|
n || (n = {});
|
|
1249
1265
|
var s, c, l = n;
|
|
1250
1266
|
if ("ref" in l) for (c in l = {}, n) c == "ref" ? s = n[c] : l[c] = n[c];
|
|
@@ -1281,25 +1297,25 @@ function Ot(e, t) {
|
|
|
1281
1297
|
} : null;
|
|
1282
1298
|
}
|
|
1283
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 }) {
|
|
1284
|
-
let [p, m] =
|
|
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(() => {
|
|
1285
1301
|
if (!h || !i || i.length === 0) return [];
|
|
1286
1302
|
let e = h.query.toLowerCase();
|
|
1287
1303
|
return i.filter((t) => t.handle.startsWith(e));
|
|
1288
|
-
}, [i, h]), D = E.length > 0, O =
|
|
1304
|
+
}, [i, h]), D = E.length > 0, O = q(() => {
|
|
1289
1305
|
let e = x.current;
|
|
1290
1306
|
if (!e) return;
|
|
1291
1307
|
e.style.height = "auto";
|
|
1292
1308
|
let t = e.scrollHeight > Tt;
|
|
1293
1309
|
e.style.height = `${Math.min(e.scrollHeight, Tt)}px`, e.style.overflowY = t ? "auto" : "hidden";
|
|
1294
1310
|
}, []);
|
|
1295
|
-
|
|
1311
|
+
W(() => {
|
|
1296
1312
|
r && x.current?.focus(), O();
|
|
1297
|
-
}, [r, O]),
|
|
1313
|
+
}, [r, O]), W(() => {
|
|
1298
1314
|
a && (m((e) => e || `@${a} `), requestAnimationFrame(O));
|
|
1299
1315
|
}, [a, O]);
|
|
1300
|
-
let k =
|
|
1316
|
+
let k = q((e) => {
|
|
1301
1317
|
g(Ot(e.value, e.selectionStart ?? e.value.length)), v(0);
|
|
1302
|
-
}, []), A =
|
|
1318
|
+
}, []), A = q((e) => {
|
|
1303
1319
|
let t = x.current;
|
|
1304
1320
|
if (!t || !h) return;
|
|
1305
1321
|
let n = t.selectionStart ?? t.value.length, r = `${p.slice(0, h.start)}@${e} ${p.slice(n)}`, i = h.start + e.length + 2;
|
|
@@ -1310,9 +1326,9 @@ function kt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addr
|
|
|
1310
1326
|
O,
|
|
1311
1327
|
h,
|
|
1312
1328
|
p
|
|
1313
|
-
]), j =
|
|
1329
|
+
]), j = q((e) => {
|
|
1314
1330
|
if (!(!l || !e)) for (let t of Array.from(e)) l(t);
|
|
1315
|
-
}, [l]), M =
|
|
1331
|
+
}, [l]), M = q(() => {
|
|
1316
1332
|
let e = p.trim();
|
|
1317
1333
|
!e && o.length === 0 || n || T || (d(e), m(""), g(null), requestAnimationFrame(O));
|
|
1318
1334
|
}, [
|
|
@@ -1322,7 +1338,7 @@ function kt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addr
|
|
|
1322
1338
|
d,
|
|
1323
1339
|
p,
|
|
1324
1340
|
T
|
|
1325
|
-
]), N =
|
|
1341
|
+
]), N = q((e) => {
|
|
1326
1342
|
if (D && !e.isComposing) {
|
|
1327
1343
|
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
1328
1344
|
e.preventDefault();
|
|
@@ -1346,8 +1362,8 @@ function kt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addr
|
|
|
1346
1362
|
A,
|
|
1347
1363
|
D,
|
|
1348
1364
|
M
|
|
1349
|
-
]), P =
|
|
1350
|
-
return /* @__PURE__ */
|
|
1365
|
+
]), P = qe - p.length;
|
|
1366
|
+
return /* @__PURE__ */ Y("form", {
|
|
1351
1367
|
class: `sqc-composer${y ? " sqc-composer--dropping" : ""}`,
|
|
1352
1368
|
onSubmit: (e) => {
|
|
1353
1369
|
e.preventDefault(), M();
|
|
@@ -1360,16 +1376,16 @@ function kt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addr
|
|
|
1360
1376
|
w && (e.preventDefault(), b(!1), j(e.dataTransfer?.files ?? null));
|
|
1361
1377
|
},
|
|
1362
1378
|
children: [
|
|
1363
|
-
(o.length > 0 || T || c) && /* @__PURE__ */
|
|
1379
|
+
(o.length > 0 || T || c) && /* @__PURE__ */ Y("div", {
|
|
1364
1380
|
class: "sqc-attachments",
|
|
1365
1381
|
children: [
|
|
1366
|
-
o.map((e) => /* @__PURE__ */
|
|
1382
|
+
o.map((e) => /* @__PURE__ */ Y("span", {
|
|
1367
1383
|
class: "sqc-chip",
|
|
1368
1384
|
"data-kind": e.kind,
|
|
1369
|
-
children: [/* @__PURE__ */
|
|
1385
|
+
children: [/* @__PURE__ */ Y("span", {
|
|
1370
1386
|
class: "sqc-chip__name",
|
|
1371
1387
|
children: e.filename
|
|
1372
|
-
}), /* @__PURE__ */
|
|
1388
|
+
}), /* @__PURE__ */ Y("button", {
|
|
1373
1389
|
type: "button",
|
|
1374
1390
|
class: "sqc-chip__remove",
|
|
1375
1391
|
"aria-label": t.t.composer.remove.replace("{name}", e.filename),
|
|
@@ -1377,28 +1393,28 @@ function kt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addr
|
|
|
1377
1393
|
children: "×"
|
|
1378
1394
|
})]
|
|
1379
1395
|
}, e.id)),
|
|
1380
|
-
s.map((e) => /* @__PURE__ */
|
|
1396
|
+
s.map((e) => /* @__PURE__ */ Y("span", {
|
|
1381
1397
|
class: "sqc-chip sqc-chip--waiting",
|
|
1382
|
-
children: /* @__PURE__ */
|
|
1398
|
+
children: /* @__PURE__ */ Y("span", {
|
|
1383
1399
|
class: "sqc-chip__name",
|
|
1384
1400
|
children: e
|
|
1385
1401
|
})
|
|
1386
1402
|
}, e)),
|
|
1387
|
-
c && /* @__PURE__ */
|
|
1403
|
+
c && /* @__PURE__ */ Y("p", {
|
|
1388
1404
|
class: "sqc-attachments__error",
|
|
1389
1405
|
role: "status",
|
|
1390
1406
|
children: c
|
|
1391
1407
|
})
|
|
1392
1408
|
]
|
|
1393
1409
|
}),
|
|
1394
|
-
/* @__PURE__ */
|
|
1410
|
+
/* @__PURE__ */ Y("div", {
|
|
1395
1411
|
class: "sqc-composer__field",
|
|
1396
1412
|
children: [
|
|
1397
|
-
D && /* @__PURE__ */
|
|
1413
|
+
D && /* @__PURE__ */ Y("ul", {
|
|
1398
1414
|
class: "sqc-mentions",
|
|
1399
1415
|
role: "listbox",
|
|
1400
1416
|
"aria-label": t.t.handles.picker,
|
|
1401
|
-
children: E.map((e, t) => /* @__PURE__ */
|
|
1417
|
+
children: E.map((e, t) => /* @__PURE__ */ Y("li", {
|
|
1402
1418
|
role: "option",
|
|
1403
1419
|
"aria-selected": t === _,
|
|
1404
1420
|
class: `sqc-mention${t === _ ? " sqc-mention--active" : ""}`,
|
|
@@ -1406,29 +1422,29 @@ function kt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addr
|
|
|
1406
1422
|
onMouseEnter: () => v(t),
|
|
1407
1423
|
onClick: () => A(e.handle),
|
|
1408
1424
|
children: [
|
|
1409
|
-
/* @__PURE__ */
|
|
1425
|
+
/* @__PURE__ */ Y("span", {
|
|
1410
1426
|
class: "sqc-mention__icon",
|
|
1411
1427
|
"aria-hidden": "true",
|
|
1412
1428
|
children: e.avatarEmoji ?? "@"
|
|
1413
1429
|
}),
|
|
1414
|
-
/* @__PURE__ */
|
|
1430
|
+
/* @__PURE__ */ Y("span", {
|
|
1415
1431
|
class: "sqc-mention__handle",
|
|
1416
1432
|
children: ["@", e.handle]
|
|
1417
1433
|
}),
|
|
1418
|
-
/* @__PURE__ */
|
|
1434
|
+
/* @__PURE__ */ Y("span", {
|
|
1419
1435
|
class: "sqc-mention__name",
|
|
1420
1436
|
children: e.name
|
|
1421
1437
|
})
|
|
1422
1438
|
]
|
|
1423
1439
|
}, e.handle))
|
|
1424
1440
|
}),
|
|
1425
|
-
/* @__PURE__ */
|
|
1441
|
+
/* @__PURE__ */ Y("textarea", {
|
|
1426
1442
|
ref: x,
|
|
1427
1443
|
class: "sqc-composer__input",
|
|
1428
1444
|
rows: 1,
|
|
1429
1445
|
value: p,
|
|
1430
1446
|
placeholder: e,
|
|
1431
|
-
maxLength:
|
|
1447
|
+
maxLength: qe,
|
|
1432
1448
|
"aria-label": t.t.composer.label,
|
|
1433
1449
|
onInput: (e) => {
|
|
1434
1450
|
m(e.currentTarget.value), k(e.currentTarget), O();
|
|
@@ -1440,14 +1456,14 @@ function kt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addr
|
|
|
1440
1456
|
!w || !t || t.length === 0 || (e.preventDefault(), j(t));
|
|
1441
1457
|
}
|
|
1442
1458
|
}),
|
|
1443
|
-
P <= 200 && /* @__PURE__ */
|
|
1459
|
+
P <= 200 && /* @__PURE__ */ Y("span", {
|
|
1444
1460
|
class: "sqc-composer__count",
|
|
1445
1461
|
"aria-live": "polite",
|
|
1446
1462
|
children: P
|
|
1447
1463
|
})
|
|
1448
1464
|
]
|
|
1449
1465
|
}),
|
|
1450
|
-
w && /* @__PURE__ */
|
|
1466
|
+
w && /* @__PURE__ */ Y(S, { children: [/* @__PURE__ */ Y("input", {
|
|
1451
1467
|
ref: C,
|
|
1452
1468
|
type: "file",
|
|
1453
1469
|
multiple: !0,
|
|
@@ -1456,13 +1472,13 @@ function kt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addr
|
|
|
1456
1472
|
onChange: (e) => {
|
|
1457
1473
|
j(e.currentTarget.files), e.currentTarget.value = "";
|
|
1458
1474
|
}
|
|
1459
|
-
}), /* @__PURE__ */
|
|
1475
|
+
}), /* @__PURE__ */ Y("button", {
|
|
1460
1476
|
type: "button",
|
|
1461
1477
|
class: "sqc-btn sqc-btn--attach",
|
|
1462
1478
|
onClick: () => C.current?.click(),
|
|
1463
1479
|
"aria-label": t.t.composer.attach,
|
|
1464
1480
|
title: t.t.composer.attachTitle,
|
|
1465
|
-
children: /* @__PURE__ */
|
|
1481
|
+
children: /* @__PURE__ */ Y("svg", {
|
|
1466
1482
|
viewBox: "0 0 24 24",
|
|
1467
1483
|
fill: "none",
|
|
1468
1484
|
stroke: "currentColor",
|
|
@@ -1470,19 +1486,19 @@ function kt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addr
|
|
|
1470
1486
|
"stroke-linecap": "round",
|
|
1471
1487
|
"stroke-linejoin": "round",
|
|
1472
1488
|
"aria-hidden": "true",
|
|
1473
|
-
children: /* @__PURE__ */
|
|
1489
|
+
children: /* @__PURE__ */ Y("path", { d: "M21 11.5l-8.8 8.8a5 5 0 01-7.1-7.1l9-9a3.3 3.3 0 014.7 4.7l-9 9a1.6 1.6 0 01-2.3-2.3l8.3-8.3" })
|
|
1474
1490
|
})
|
|
1475
1491
|
})] }),
|
|
1476
|
-
n ? /* @__PURE__ */
|
|
1492
|
+
n ? /* @__PURE__ */ Y("button", {
|
|
1477
1493
|
type: "button",
|
|
1478
1494
|
class: "sqc-btn sqc-btn--stop",
|
|
1479
1495
|
onClick: f,
|
|
1480
1496
|
"aria-label": t.t.composer.stop,
|
|
1481
1497
|
title: t.t.composer.stopTitle,
|
|
1482
|
-
children: /* @__PURE__ */
|
|
1498
|
+
children: /* @__PURE__ */ Y("svg", {
|
|
1483
1499
|
viewBox: "0 0 24 24",
|
|
1484
1500
|
"aria-hidden": "true",
|
|
1485
|
-
children: /* @__PURE__ */
|
|
1501
|
+
children: /* @__PURE__ */ Y("rect", {
|
|
1486
1502
|
x: "7",
|
|
1487
1503
|
y: "7",
|
|
1488
1504
|
width: "10",
|
|
@@ -1491,13 +1507,13 @@ function kt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addr
|
|
|
1491
1507
|
fill: "currentColor"
|
|
1492
1508
|
})
|
|
1493
1509
|
})
|
|
1494
|
-
}) : /* @__PURE__ */
|
|
1510
|
+
}) : /* @__PURE__ */ Y("button", {
|
|
1495
1511
|
type: "submit",
|
|
1496
1512
|
class: "sqc-btn sqc-btn--send",
|
|
1497
1513
|
disabled: !p.trim() && o.length === 0 || T,
|
|
1498
1514
|
"aria-label": t.t.composer.send,
|
|
1499
1515
|
title: t.t.composer.sendTitle,
|
|
1500
|
-
children: /* @__PURE__ */
|
|
1516
|
+
children: /* @__PURE__ */ Y("svg", {
|
|
1501
1517
|
viewBox: "0 0 24 24",
|
|
1502
1518
|
fill: "none",
|
|
1503
1519
|
stroke: "currentColor",
|
|
@@ -1505,7 +1521,7 @@ function kt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addr
|
|
|
1505
1521
|
"stroke-linecap": "round",
|
|
1506
1522
|
"stroke-linejoin": "round",
|
|
1507
1523
|
"aria-hidden": "true",
|
|
1508
|
-
children: /* @__PURE__ */
|
|
1524
|
+
children: /* @__PURE__ */ Y("path", { d: "M5 12l14-7-5 14-2.5-5.5L5 12z" })
|
|
1509
1525
|
})
|
|
1510
1526
|
})
|
|
1511
1527
|
]
|
|
@@ -1550,52 +1566,52 @@ function Nt(e, t = "en") {
|
|
|
1550
1566
|
}
|
|
1551
1567
|
//#endregion
|
|
1552
1568
|
//#region src/components/Approval.tsx
|
|
1553
|
-
var Pt = /^
|
|
1569
|
+
var Pt = /^(?:mcp|custom|a2a)_[0-9a-f]{8}_/;
|
|
1554
1570
|
function Ft(e) {
|
|
1555
1571
|
let t = e.replace(Pt, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim().toLowerCase();
|
|
1556
1572
|
return t ? t.charAt(0).toUpperCase() + t.slice(1) : e;
|
|
1557
1573
|
}
|
|
1558
|
-
function It(e) {
|
|
1559
|
-
return typeof e == "string" ? e : JSON.stringify(e) ?? String(e);
|
|
1574
|
+
function It(e, t) {
|
|
1575
|
+
return e === !0 ? t.t.confirm.yes : e === !1 ? t.t.confirm.no : typeof e == "string" ? e : JSON.stringify(e) ?? String(e);
|
|
1560
1576
|
}
|
|
1561
1577
|
function Lt({ locale: e, call: t, onDecide: n }) {
|
|
1562
|
-
let { approval: r, confirm: i } = e.t, [a, o] =
|
|
1578
|
+
let { approval: r, confirm: i } = e.t, [a, o] = U(null), s = !!n && a === null, c = (e, t) => {
|
|
1563
1579
|
o(t), n?.(e, t);
|
|
1564
1580
|
}, l = t ? Object.entries(t.arguments) : [];
|
|
1565
|
-
return /* @__PURE__ */
|
|
1581
|
+
return /* @__PURE__ */ Y("div", {
|
|
1566
1582
|
class: "sqc-approval",
|
|
1567
1583
|
role: "group",
|
|
1568
1584
|
"aria-label": r.group,
|
|
1569
1585
|
children: [
|
|
1570
|
-
t && /* @__PURE__ */
|
|
1586
|
+
t && /* @__PURE__ */ Y("p", {
|
|
1571
1587
|
class: "sqc-approval__request",
|
|
1572
1588
|
"data-testid": "sqc-approval-tool",
|
|
1573
1589
|
children: r.request.replace("{tool}", Ft(t.tool))
|
|
1574
1590
|
}),
|
|
1575
|
-
l.length > 0 && /* @__PURE__ */
|
|
1591
|
+
l.length > 0 && /* @__PURE__ */ Y("dl", {
|
|
1576
1592
|
class: "sqc-approval__args",
|
|
1577
1593
|
"data-testid": "sqc-approval-arguments",
|
|
1578
|
-
children: l.map(([
|
|
1594
|
+
children: l.map(([t, n]) => /* @__PURE__ */ Y("div", {
|
|
1579
1595
|
class: "sqc-approval__arg",
|
|
1580
|
-
children: [/* @__PURE__ */
|
|
1596
|
+
children: [/* @__PURE__ */ Y("dt", {
|
|
1581
1597
|
class: "sqc-approval__arg-name",
|
|
1582
|
-
children: Ft(
|
|
1583
|
-
}), /* @__PURE__ */
|
|
1598
|
+
children: Ft(t)
|
|
1599
|
+
}), /* @__PURE__ */ Y("dd", {
|
|
1584
1600
|
class: "sqc-approval__arg-value",
|
|
1585
|
-
children: It(
|
|
1601
|
+
children: It(n, e)
|
|
1586
1602
|
})]
|
|
1587
|
-
},
|
|
1603
|
+
}, t))
|
|
1588
1604
|
}),
|
|
1589
|
-
/* @__PURE__ */
|
|
1605
|
+
/* @__PURE__ */ Y("div", {
|
|
1590
1606
|
class: "sqc-approval__actions",
|
|
1591
|
-
children: [/* @__PURE__ */
|
|
1607
|
+
children: [/* @__PURE__ */ Y("button", {
|
|
1592
1608
|
type: "button",
|
|
1593
1609
|
class: "sqc-approval__btn sqc-approval__btn--yes",
|
|
1594
1610
|
"aria-pressed": a === i.yes,
|
|
1595
1611
|
disabled: !s,
|
|
1596
1612
|
onClick: () => c(!0, i.yes),
|
|
1597
1613
|
children: r.approve
|
|
1598
|
-
}), /* @__PURE__ */
|
|
1614
|
+
}), /* @__PURE__ */ Y("button", {
|
|
1599
1615
|
type: "button",
|
|
1600
1616
|
class: "sqc-approval__btn sqc-approval__btn--no",
|
|
1601
1617
|
"aria-pressed": a === i.no,
|
|
@@ -1610,7 +1626,7 @@ function Lt({ locale: e, call: t, onDecide: n }) {
|
|
|
1610
1626
|
//#endregion
|
|
1611
1627
|
//#region src/components/Confirm.tsx
|
|
1612
1628
|
function Rt({ locale: e, onPick: t }) {
|
|
1613
|
-
let [n, r] =
|
|
1629
|
+
let [n, r] = U(null), i = !!t && n === null, { confirm: a } = e.t, o = [{
|
|
1614
1630
|
value: a.yesValue,
|
|
1615
1631
|
label: a.yes,
|
|
1616
1632
|
kind: "yes"
|
|
@@ -1619,11 +1635,11 @@ function Rt({ locale: e, onPick: t }) {
|
|
|
1619
1635
|
label: a.no,
|
|
1620
1636
|
kind: "no"
|
|
1621
1637
|
}];
|
|
1622
|
-
return /* @__PURE__ */
|
|
1638
|
+
return /* @__PURE__ */ Y("div", {
|
|
1623
1639
|
class: "sqc-confirm",
|
|
1624
1640
|
role: "group",
|
|
1625
1641
|
"aria-label": a.group,
|
|
1626
|
-
children: o.map((e) => /* @__PURE__ */
|
|
1642
|
+
children: o.map((e) => /* @__PURE__ */ Y("button", {
|
|
1627
1643
|
type: "button",
|
|
1628
1644
|
class: `sqc-confirm__btn sqc-confirm__btn--${e.kind}`,
|
|
1629
1645
|
"aria-pressed": n === e.value,
|
|
@@ -1638,13 +1654,13 @@ function Rt({ locale: e, onPick: t }) {
|
|
|
1638
1654
|
//#endregion
|
|
1639
1655
|
//#region src/components/Choices.tsx
|
|
1640
1656
|
function zt() {
|
|
1641
|
-
return /* @__PURE__ */
|
|
1657
|
+
return /* @__PURE__ */ Y("svg", {
|
|
1642
1658
|
viewBox: "0 0 16 16",
|
|
1643
1659
|
fill: "none",
|
|
1644
1660
|
stroke: "currentColor",
|
|
1645
1661
|
"stroke-width": "2.2",
|
|
1646
1662
|
"aria-hidden": "true",
|
|
1647
|
-
children: /* @__PURE__ */
|
|
1663
|
+
children: /* @__PURE__ */ Y("path", {
|
|
1648
1664
|
d: "M3.5 8.5l3 3 6-7",
|
|
1649
1665
|
"stroke-linecap": "round",
|
|
1650
1666
|
"stroke-linejoin": "round"
|
|
@@ -1652,14 +1668,14 @@ function zt() {
|
|
|
1652
1668
|
});
|
|
1653
1669
|
}
|
|
1654
1670
|
function Bt({ items: e, locale: t, onPick: n }) {
|
|
1655
|
-
let [r, i] =
|
|
1656
|
-
return /* @__PURE__ */
|
|
1671
|
+
let [r, i] = U(null), a = !!n && r === null;
|
|
1672
|
+
return /* @__PURE__ */ Y("div", {
|
|
1657
1673
|
class: "sqc-choices",
|
|
1658
1674
|
role: "group",
|
|
1659
1675
|
"aria-label": t.t.choices,
|
|
1660
1676
|
children: e.map((e, t) => {
|
|
1661
1677
|
let o = r === null ? e.checked : r === e.label;
|
|
1662
|
-
return /* @__PURE__ */
|
|
1678
|
+
return /* @__PURE__ */ Y("button", {
|
|
1663
1679
|
type: "button",
|
|
1664
1680
|
class: "sqc-choice",
|
|
1665
1681
|
"aria-pressed": o,
|
|
@@ -1667,11 +1683,11 @@ function Bt({ items: e, locale: t, onPick: n }) {
|
|
|
1667
1683
|
onClick: () => {
|
|
1668
1684
|
i(e.label), n?.(e.label);
|
|
1669
1685
|
},
|
|
1670
|
-
children: [/* @__PURE__ */
|
|
1686
|
+
children: [/* @__PURE__ */ Y("span", {
|
|
1671
1687
|
class: `sqc-choice__box${o ? " sqc-choice__box--on" : ""}`,
|
|
1672
1688
|
"aria-hidden": "true",
|
|
1673
|
-
children: o && /* @__PURE__ */
|
|
1674
|
-
}), /* @__PURE__ */
|
|
1689
|
+
children: o && /* @__PURE__ */ Y(zt, {})
|
|
1690
|
+
}), /* @__PURE__ */ Y("span", {
|
|
1675
1691
|
class: "sqc-choice__label",
|
|
1676
1692
|
children: e.content
|
|
1677
1693
|
})]
|
|
@@ -1683,36 +1699,36 @@ function Bt({ items: e, locale: t, onPick: n }) {
|
|
|
1683
1699
|
//#region src/components/RichText.tsx
|
|
1684
1700
|
var Vt = /(\*\*[^*\n]+\*\*|`[^`\n]+`|~~[^~\n]+~~|\[[^\]\n]+\]\([^)\s]+\)|\*[^*\n]+\*|https?:\/\/[^\s<>()]+)/g, Ht = /^\[([^\]\n]+)\]\(([^)\s]+)\)$/, Ut = /^(https?:|mailto:)/i;
|
|
1685
1701
|
function Wt(e, t, n) {
|
|
1686
|
-
return Ut.test(e) ? /* @__PURE__ */
|
|
1702
|
+
return Ut.test(e) ? /* @__PURE__ */ Y("a", {
|
|
1687
1703
|
href: e,
|
|
1688
1704
|
target: "_blank",
|
|
1689
1705
|
rel: "noopener noreferrer",
|
|
1690
1706
|
children: t
|
|
1691
1707
|
}, n) : t;
|
|
1692
1708
|
}
|
|
1693
|
-
function
|
|
1709
|
+
function Gt(e, t) {
|
|
1694
1710
|
let n = e.split(Vt), r = [];
|
|
1695
1711
|
return n.forEach((e, n) => {
|
|
1696
1712
|
if (!e) return;
|
|
1697
1713
|
let i = `${t}-${n}`, a = Ht.exec(e);
|
|
1698
|
-
e.startsWith("**") && e.endsWith("**") && e.length > 4 ? r.push(/* @__PURE__ */
|
|
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);
|
|
1699
1715
|
}), r;
|
|
1700
1716
|
}
|
|
1701
|
-
var
|
|
1702
|
-
function
|
|
1717
|
+
var Kt = /^\s*(?:[-*•]\s+)?\[([ xX])\]\s+(.+)$/;
|
|
1718
|
+
function qt(e) {
|
|
1703
1719
|
return e.replace(/\[([^\]\n]+)\]\([^)\s]+\)/g, "$1").replace(/\*\*|~~|`|\*/g, "").trim();
|
|
1704
1720
|
}
|
|
1705
|
-
var
|
|
1706
|
-
function
|
|
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) {
|
|
1707
1723
|
return e.replace(/^\s*\|/, "").replace(/\|\s*$/, "").split("|").map((e) => e.trim());
|
|
1708
1724
|
}
|
|
1709
|
-
function
|
|
1725
|
+
function rn(e, t, n, r) {
|
|
1710
1726
|
let i = e[t].ordered, a = [], o = t;
|
|
1711
1727
|
for (; o < e.length && e[o].depth >= n;) {
|
|
1712
1728
|
let t = e[o];
|
|
1713
1729
|
if (t.depth === n && t.ordered !== i) break;
|
|
1714
1730
|
if (t.depth > n) {
|
|
1715
|
-
let [n, i] =
|
|
1731
|
+
let [n, i] = rn(e, o, t.depth, `${r}-${o}`), s = a[a.length - 1];
|
|
1716
1732
|
s ? s.nested.push(n) : a.push({
|
|
1717
1733
|
key: `${r}-${o}`,
|
|
1718
1734
|
text: null,
|
|
@@ -1726,48 +1742,48 @@ function nn(e, t, n, r) {
|
|
|
1726
1742
|
nested: []
|
|
1727
1743
|
}), o += 1;
|
|
1728
1744
|
}
|
|
1729
|
-
let s = a.map((e) => /* @__PURE__ */
|
|
1730
|
-
return [
|
|
1745
|
+
let s = a.map((e) => /* @__PURE__ */ Y("li", { children: [e.text === null ? null : Gt(e.text, e.key), e.nested] }, e.key));
|
|
1746
|
+
return [Y(i ? "ol" : "ul", { children: s }, r), o];
|
|
1731
1747
|
}
|
|
1732
|
-
function
|
|
1748
|
+
function an({ text: e, locale: t, onChoice: n }) {
|
|
1733
1749
|
let r = e.split("\n"), i = [], a = [], o = [], s = [], c = () => {
|
|
1734
1750
|
if (!a.length) return;
|
|
1735
1751
|
let e = `p${i.length}`;
|
|
1736
|
-
i.push(/* @__PURE__ */
|
|
1752
|
+
i.push(/* @__PURE__ */ Y("p", { children: Gt(a.join("\n"), e) }, e)), a = [];
|
|
1737
1753
|
}, l = () => {
|
|
1738
1754
|
if (!o.length) return;
|
|
1739
1755
|
let e = 0;
|
|
1740
1756
|
for (; e < o.length;) {
|
|
1741
|
-
let t = `l${i.length}`, [n, r] =
|
|
1757
|
+
let t = `l${i.length}`, [n, r] = rn(o, e, o[e].depth, t);
|
|
1742
1758
|
i.push(n), e = r;
|
|
1743
1759
|
}
|
|
1744
1760
|
o = [];
|
|
1745
1761
|
}, u = () => {
|
|
1746
1762
|
if (!s.length) return;
|
|
1747
1763
|
let e = `q${i.length}`;
|
|
1748
|
-
i.push(/* @__PURE__ */
|
|
1764
|
+
i.push(/* @__PURE__ */ Y("blockquote", { children: Gt(s.join("\n"), e) }, e)), s = [];
|
|
1749
1765
|
}, d = () => {
|
|
1750
1766
|
c(), l(), u();
|
|
1751
1767
|
};
|
|
1752
1768
|
for (let e = 0; e < r.length; e += 1) {
|
|
1753
1769
|
let f = r[e];
|
|
1754
|
-
if (
|
|
1770
|
+
if (tn.test(f)) {
|
|
1755
1771
|
d();
|
|
1756
1772
|
let t = [];
|
|
1757
|
-
for (e += 1; e < r.length && !
|
|
1773
|
+
for (e += 1; e < r.length && !tn.test(r[e]);) t.push(r[e]), e += 1;
|
|
1758
1774
|
let n = `c${i.length}`;
|
|
1759
|
-
i.push(/* @__PURE__ */
|
|
1775
|
+
i.push(/* @__PURE__ */ Y("pre", { children: /* @__PURE__ */ Y("code", { children: t.join("\n") }) }, n));
|
|
1760
1776
|
continue;
|
|
1761
1777
|
}
|
|
1762
|
-
if (
|
|
1778
|
+
if ($t.test(f) && e + 1 < r.length && en.test(r[e + 1])) {
|
|
1763
1779
|
d();
|
|
1764
|
-
let t =
|
|
1765
|
-
for (e += 2; e < r.length &&
|
|
1780
|
+
let t = nn(f), n = [];
|
|
1781
|
+
for (e += 2; e < r.length && $t.test(r[e]);) n.push(nn(r[e])), e += 1;
|
|
1766
1782
|
--e;
|
|
1767
1783
|
let a = `t${i.length}`;
|
|
1768
|
-
i.push(/* @__PURE__ */
|
|
1784
|
+
i.push(/* @__PURE__ */ Y("div", {
|
|
1769
1785
|
class: "sqc-table",
|
|
1770
|
-
children: /* @__PURE__ */
|
|
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}`)) })] })
|
|
1771
1787
|
}, a));
|
|
1772
1788
|
continue;
|
|
1773
1789
|
}
|
|
@@ -1775,43 +1791,43 @@ function rn({ text: e, locale: t, onChoice: n }) {
|
|
|
1775
1791
|
d();
|
|
1776
1792
|
continue;
|
|
1777
1793
|
}
|
|
1778
|
-
if (
|
|
1794
|
+
if (Kt.test(f)) {
|
|
1779
1795
|
d();
|
|
1780
1796
|
let a = [];
|
|
1781
1797
|
for (; e < r.length;) {
|
|
1782
|
-
let t =
|
|
1798
|
+
let t = Kt.exec(r[e]);
|
|
1783
1799
|
if (!t) break;
|
|
1784
1800
|
let n = t[2].trim(), o = `o${i.length}-${a.length}`;
|
|
1785
1801
|
a.push({
|
|
1786
|
-
label:
|
|
1802
|
+
label: qt(n),
|
|
1787
1803
|
checked: t[1].toLowerCase() === "x",
|
|
1788
|
-
content:
|
|
1804
|
+
content: Gt(n, o)
|
|
1789
1805
|
}), e += 1;
|
|
1790
1806
|
}
|
|
1791
|
-
--e, i.push(/* @__PURE__ */
|
|
1807
|
+
--e, i.push(/* @__PURE__ */ Y(Bt, {
|
|
1792
1808
|
items: a,
|
|
1793
1809
|
locale: t,
|
|
1794
1810
|
onPick: n
|
|
1795
1811
|
}, `o${i.length}`));
|
|
1796
1812
|
continue;
|
|
1797
1813
|
}
|
|
1798
|
-
let p =
|
|
1814
|
+
let p = Xt.exec(f);
|
|
1799
1815
|
if (p) {
|
|
1800
1816
|
d();
|
|
1801
1817
|
let e = p[1].length, t = e <= 2 ? "h3" : e === 3 ? "h4" : "h5", n = `h${i.length}`;
|
|
1802
|
-
i.push(/* @__PURE__ */
|
|
1818
|
+
i.push(/* @__PURE__ */ Y(t, { children: Gt(p[2], n) }, n));
|
|
1803
1819
|
continue;
|
|
1804
1820
|
}
|
|
1805
|
-
if (
|
|
1806
|
-
d(), i.push(/* @__PURE__ */
|
|
1821
|
+
if (Zt.test(f)) {
|
|
1822
|
+
d(), i.push(/* @__PURE__ */ Y("hr", {}, `r${i.length}`));
|
|
1807
1823
|
continue;
|
|
1808
1824
|
}
|
|
1809
|
-
let m =
|
|
1825
|
+
let m = Qt.exec(f);
|
|
1810
1826
|
if (m) {
|
|
1811
1827
|
c(), l(), s.push(m[1]);
|
|
1812
1828
|
continue;
|
|
1813
1829
|
}
|
|
1814
|
-
let h =
|
|
1830
|
+
let h = Jt.exec(f), g = h ? null : Yt.exec(f), _ = h ?? g;
|
|
1815
1831
|
if (_) {
|
|
1816
1832
|
c(), u(), o.push({
|
|
1817
1833
|
depth: _[1].replace(/\t/g, " ").length,
|
|
@@ -1822,14 +1838,14 @@ function rn({ text: e, locale: t, onChoice: n }) {
|
|
|
1822
1838
|
}
|
|
1823
1839
|
l(), u(), a.push(f);
|
|
1824
1840
|
}
|
|
1825
|
-
return d(), /* @__PURE__ */
|
|
1841
|
+
return d(), /* @__PURE__ */ Y(S, { children: i });
|
|
1826
1842
|
}
|
|
1827
1843
|
//#endregion
|
|
1828
1844
|
//#region src/components/MessageList.tsx
|
|
1829
|
-
var
|
|
1830
|
-
function
|
|
1845
|
+
var on = 80;
|
|
1846
|
+
function sn({ at: e, locale: t }) {
|
|
1831
1847
|
let n = new Date(e);
|
|
1832
|
-
return /* @__PURE__ */
|
|
1848
|
+
return /* @__PURE__ */ Y("time", {
|
|
1833
1849
|
class: "sqc-msg__time",
|
|
1834
1850
|
dateTime: n.toISOString(),
|
|
1835
1851
|
children: n.toLocaleTimeString(t.tag, {
|
|
@@ -1838,117 +1854,117 @@ function on({ at: e, locale: t }) {
|
|
|
1838
1854
|
})
|
|
1839
1855
|
});
|
|
1840
1856
|
}
|
|
1841
|
-
function
|
|
1842
|
-
let [n, r] =
|
|
1843
|
-
return
|
|
1857
|
+
function cn({ file: e, load: t }) {
|
|
1858
|
+
let [n, r] = U(null);
|
|
1859
|
+
return W(() => {
|
|
1844
1860
|
let n = null, i = !0;
|
|
1845
1861
|
return t(e.id).then((e) => {
|
|
1846
1862
|
i && (n = URL.createObjectURL(e), r(n));
|
|
1847
1863
|
}).catch(() => {}), () => {
|
|
1848
1864
|
i = !1, n && URL.revokeObjectURL(n);
|
|
1849
1865
|
};
|
|
1850
|
-
}, [e.id, t]), n ? /* @__PURE__ */
|
|
1866
|
+
}, [e.id, t]), n ? /* @__PURE__ */ Y("img", {
|
|
1851
1867
|
class: "sqc-attachment__image",
|
|
1852
1868
|
src: n,
|
|
1853
1869
|
alt: e.filename
|
|
1854
|
-
}) : /* @__PURE__ */
|
|
1870
|
+
}) : /* @__PURE__ */ Y("span", {
|
|
1855
1871
|
class: "sqc-chip sqc-chip--waiting",
|
|
1856
1872
|
children: e.filename
|
|
1857
1873
|
});
|
|
1858
1874
|
}
|
|
1859
|
-
function
|
|
1860
|
-
return e.length === 0 || !t ? null : /* @__PURE__ */
|
|
1875
|
+
function ln({ files: e, load: t }) {
|
|
1876
|
+
return e.length === 0 || !t ? null : /* @__PURE__ */ Y("div", {
|
|
1861
1877
|
class: "sqc-attachments sqc-attachments--sent",
|
|
1862
|
-
children: e.map((e) => e.kind === "image" ? /* @__PURE__ */
|
|
1878
|
+
children: e.map((e) => e.kind === "image" ? /* @__PURE__ */ Y(cn, {
|
|
1863
1879
|
file: e,
|
|
1864
1880
|
load: t
|
|
1865
|
-
}, e.id) : /* @__PURE__ */
|
|
1881
|
+
}, e.id) : /* @__PURE__ */ Y("span", {
|
|
1866
1882
|
class: "sqc-chip",
|
|
1867
1883
|
"data-kind": "document",
|
|
1868
|
-
children: /* @__PURE__ */
|
|
1884
|
+
children: /* @__PURE__ */ Y("span", {
|
|
1869
1885
|
class: "sqc-chip__name",
|
|
1870
1886
|
children: e.filename
|
|
1871
1887
|
})
|
|
1872
1888
|
}, e.id))
|
|
1873
1889
|
});
|
|
1874
1890
|
}
|
|
1875
|
-
function
|
|
1891
|
+
function un({ message: e, locale: t, assistantName: n, onChoice: r, onDecide: i, onLoadAttachment: a }) {
|
|
1876
1892
|
let o = e.streaming && !e.content, s = !!e.approval;
|
|
1877
|
-
return /* @__PURE__ */
|
|
1893
|
+
return /* @__PURE__ */ Y("div", {
|
|
1878
1894
|
class: `sqc-msg sqc-msg--${e.role}${e.error ? " sqc-msg--error" : ""}`,
|
|
1879
|
-
children: [e.role === "assistant" && /* @__PURE__ */
|
|
1895
|
+
children: [e.role === "assistant" && /* @__PURE__ */ Y("div", {
|
|
1880
1896
|
class: "sqc-msg__who",
|
|
1881
|
-
children: [e.agent?.avatarEmoji ? /* @__PURE__ */
|
|
1897
|
+
children: [e.agent?.avatarEmoji ? /* @__PURE__ */ Y("span", {
|
|
1882
1898
|
class: "sqc-msg__emoji",
|
|
1883
1899
|
"aria-hidden": "true",
|
|
1884
1900
|
children: e.agent.avatarEmoji
|
|
1885
|
-
}) : /* @__PURE__ */
|
|
1886
|
-
}), /* @__PURE__ */
|
|
1901
|
+
}) : /* @__PURE__ */ Y(fn, {}), e.authorName ?? e.agent?.name ?? n]
|
|
1902
|
+
}), /* @__PURE__ */ Y("div", {
|
|
1887
1903
|
class: "sqc-msg__bubble",
|
|
1888
|
-
children: [o ? /* @__PURE__ */
|
|
1904
|
+
children: [o ? /* @__PURE__ */ Y("span", {
|
|
1889
1905
|
class: "sqc-typing",
|
|
1890
1906
|
"aria-label": t.t.typing,
|
|
1891
1907
|
children: [
|
|
1892
|
-
/* @__PURE__ */
|
|
1893
|
-
/* @__PURE__ */
|
|
1894
|
-
/* @__PURE__ */
|
|
1908
|
+
/* @__PURE__ */ Y("i", {}),
|
|
1909
|
+
/* @__PURE__ */ Y("i", {}),
|
|
1910
|
+
/* @__PURE__ */ Y("i", {})
|
|
1895
1911
|
]
|
|
1896
|
-
}) : /* @__PURE__ */
|
|
1912
|
+
}) : /* @__PURE__ */ Y("div", {
|
|
1897
1913
|
class: "sqc-msg__body",
|
|
1898
1914
|
children: [
|
|
1899
|
-
/* @__PURE__ */
|
|
1915
|
+
/* @__PURE__ */ Y(an, {
|
|
1900
1916
|
text: e.content,
|
|
1901
1917
|
locale: t,
|
|
1902
1918
|
onChoice: r
|
|
1903
1919
|
}),
|
|
1904
|
-
e.streaming && /* @__PURE__ */
|
|
1920
|
+
e.streaming && /* @__PURE__ */ Y("span", {
|
|
1905
1921
|
class: "sqc-caret",
|
|
1906
1922
|
"aria-hidden": "true"
|
|
1907
1923
|
}),
|
|
1908
|
-
s && /* @__PURE__ */
|
|
1924
|
+
s && /* @__PURE__ */ Y(Lt, {
|
|
1909
1925
|
locale: t,
|
|
1910
1926
|
call: e.content.trim() === "" ? e.approval : void 0,
|
|
1911
1927
|
onDecide: i
|
|
1912
1928
|
}),
|
|
1913
|
-
!s && !e.streaming && !e.error && Nt(e.content, t.code) && /* @__PURE__ */
|
|
1929
|
+
!s && !e.streaming && !e.error && Nt(e.content, t.code) && /* @__PURE__ */ Y(Rt, {
|
|
1914
1930
|
locale: t,
|
|
1915
1931
|
onPick: r
|
|
1916
1932
|
}),
|
|
1917
|
-
e.unknownHandle && !e.streaming && /* @__PURE__ */
|
|
1933
|
+
e.unknownHandle && !e.streaming && /* @__PURE__ */ Y(dn, {
|
|
1918
1934
|
message: e,
|
|
1919
1935
|
locale: t
|
|
1920
1936
|
}),
|
|
1921
|
-
/* @__PURE__ */
|
|
1937
|
+
/* @__PURE__ */ Y(ln, {
|
|
1922
1938
|
files: e.attachments ?? [],
|
|
1923
1939
|
load: a
|
|
1924
1940
|
})
|
|
1925
1941
|
]
|
|
1926
|
-
}), !o && /* @__PURE__ */
|
|
1942
|
+
}), !o && /* @__PURE__ */ Y(sn, {
|
|
1927
1943
|
at: e.createdAt,
|
|
1928
1944
|
locale: t
|
|
1929
1945
|
})]
|
|
1930
1946
|
})]
|
|
1931
1947
|
});
|
|
1932
1948
|
}
|
|
1933
|
-
function
|
|
1949
|
+
function dn({ message: e, locale: t }) {
|
|
1934
1950
|
let n = e.offered ?? [];
|
|
1935
|
-
return /* @__PURE__ */
|
|
1951
|
+
return /* @__PURE__ */ Y("p", {
|
|
1936
1952
|
class: "sqc-msg__unaddressed",
|
|
1937
1953
|
children: [
|
|
1938
|
-
/* @__PURE__ */
|
|
1954
|
+
/* @__PURE__ */ Y("span", { children: t.t.handles.unknown }),
|
|
1939
1955
|
" ",
|
|
1940
|
-
/* @__PURE__ */
|
|
1941
|
-
n.length > 0 && /* @__PURE__ */
|
|
1956
|
+
/* @__PURE__ */ Y("code", { children: ["@", e.unknownHandle] }),
|
|
1957
|
+
n.length > 0 && /* @__PURE__ */ Y(S, { children: [
|
|
1942
1958
|
" ",
|
|
1943
|
-
/* @__PURE__ */
|
|
1959
|
+
/* @__PURE__ */ Y("span", { children: t.t.handles.instead }),
|
|
1944
1960
|
" ",
|
|
1945
|
-
n.map((e) => /* @__PURE__ */
|
|
1961
|
+
n.map((e) => /* @__PURE__ */ Y("code", { children: ["@", e.handle] }, e.handle))
|
|
1946
1962
|
] })
|
|
1947
1963
|
]
|
|
1948
1964
|
});
|
|
1949
1965
|
}
|
|
1950
|
-
function
|
|
1951
|
-
return /* @__PURE__ */
|
|
1966
|
+
function fn() {
|
|
1967
|
+
return /* @__PURE__ */ Y("svg", {
|
|
1952
1968
|
viewBox: "0 0 24 24",
|
|
1953
1969
|
fill: "none",
|
|
1954
1970
|
stroke: "currentColor",
|
|
@@ -1956,29 +1972,29 @@ function dn() {
|
|
|
1956
1972
|
"stroke-linecap": "round",
|
|
1957
1973
|
"stroke-linejoin": "round",
|
|
1958
1974
|
"aria-hidden": "true",
|
|
1959
|
-
children: /* @__PURE__ */
|
|
1975
|
+
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" })
|
|
1960
1976
|
});
|
|
1961
1977
|
}
|
|
1962
|
-
function
|
|
1963
|
-
let d =
|
|
1964
|
-
return
|
|
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(() => {
|
|
1965
1981
|
let e = d.current;
|
|
1966
1982
|
e && f.current && (e.scrollTop = e.scrollHeight);
|
|
1967
|
-
}, [e]),
|
|
1983
|
+
}, [e]), W(() => {
|
|
1968
1984
|
let e = d.current;
|
|
1969
1985
|
if (!e) return;
|
|
1970
1986
|
let t = () => {
|
|
1971
|
-
f.current = e.scrollHeight - e.scrollTop - e.clientHeight <
|
|
1987
|
+
f.current = e.scrollHeight - e.scrollTop - e.clientHeight < on;
|
|
1972
1988
|
};
|
|
1973
1989
|
return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
|
|
1974
|
-
}, []), /* @__PURE__ */
|
|
1990
|
+
}, []), /* @__PURE__ */ Y("div", {
|
|
1975
1991
|
class: "sqc-messages",
|
|
1976
1992
|
ref: d,
|
|
1977
1993
|
role: "log",
|
|
1978
1994
|
"aria-live": "polite",
|
|
1979
1995
|
"aria-atomic": "false",
|
|
1980
1996
|
children: [
|
|
1981
|
-
e.map((r, i) => /* @__PURE__ */
|
|
1997
|
+
e.map((r, i) => /* @__PURE__ */ Y(un, {
|
|
1982
1998
|
message: r,
|
|
1983
1999
|
locale: t,
|
|
1984
2000
|
assistantName: n,
|
|
@@ -1986,14 +2002,14 @@ function fn({ messages: e, locale: t, assistantName: n, suggestions: r, showSugg
|
|
|
1986
2002
|
onDecide: !a && r.role === "assistant" && i === e.length - 1 ? l : void 0,
|
|
1987
2003
|
onLoadAttachment: u
|
|
1988
2004
|
}, r.id)),
|
|
1989
|
-
o && /* @__PURE__ */
|
|
2005
|
+
o && /* @__PURE__ */ Y("p", {
|
|
1990
2006
|
class: "sqc-with-human",
|
|
1991
2007
|
role: "status",
|
|
1992
2008
|
children: t.t.withHuman
|
|
1993
2009
|
}),
|
|
1994
|
-
i && r && r.length > 0 && /* @__PURE__ */
|
|
2010
|
+
i && r && r.length > 0 && /* @__PURE__ */ Y("div", {
|
|
1995
2011
|
class: "sqc-suggestions",
|
|
1996
|
-
children: r.map((e) => /* @__PURE__ */
|
|
2012
|
+
children: r.map((e) => /* @__PURE__ */ Y("button", {
|
|
1997
2013
|
type: "button",
|
|
1998
2014
|
class: "sqc-suggestion",
|
|
1999
2015
|
onClick: () => s(e),
|
|
@@ -2005,30 +2021,30 @@ function fn({ messages: e, locale: t, assistantName: n, suggestions: r, showSugg
|
|
|
2005
2021
|
}
|
|
2006
2022
|
//#endregion
|
|
2007
2023
|
//#region src/components/ChatbotWidget.tsx
|
|
2008
|
-
var
|
|
2009
|
-
function
|
|
2024
|
+
var mn = { width: "min(392px, 100vw)" }, hn = /* @__PURE__ */ new Set(["sessionId"]);
|
|
2025
|
+
function gn(e) {
|
|
2010
2026
|
let t = e.replace(/Id$|Ref$/, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim().toLowerCase();
|
|
2011
2027
|
return t ? t.charAt(0).toUpperCase() + t.slice(1) : e;
|
|
2012
2028
|
}
|
|
2013
|
-
function
|
|
2029
|
+
function _n(e) {
|
|
2014
2030
|
if (!e) return [];
|
|
2015
2031
|
let t = [];
|
|
2016
2032
|
for (let [n, r] of Object.entries(e)) {
|
|
2017
|
-
if (
|
|
2018
|
-
let e =
|
|
2033
|
+
if (hn.has(n) || typeof r != "string" && !Oe(r)) continue;
|
|
2034
|
+
let e = De(r);
|
|
2019
2035
|
e && t.push({
|
|
2020
|
-
label:
|
|
2036
|
+
label: gn(n),
|
|
2021
2037
|
value: e
|
|
2022
2038
|
});
|
|
2023
2039
|
}
|
|
2024
2040
|
return t;
|
|
2025
2041
|
}
|
|
2026
|
-
function
|
|
2042
|
+
function vn(e, t) {
|
|
2027
2043
|
return e?.trim() ? e : t;
|
|
2028
2044
|
}
|
|
2029
|
-
function
|
|
2030
|
-
let [t, n] =
|
|
2031
|
-
return
|
|
2045
|
+
function yn(e) {
|
|
2046
|
+
let [t, n] = U(!1);
|
|
2047
|
+
return W(() => {
|
|
2032
2048
|
if (e !== "auto" || typeof matchMedia != "function") return;
|
|
2033
2049
|
let t = matchMedia("(prefers-color-scheme: dark)");
|
|
2034
2050
|
n(t.matches);
|
|
@@ -2036,109 +2052,111 @@ function vn(e) {
|
|
|
2036
2052
|
return t.addEventListener("change", r), () => t.removeEventListener("change", r);
|
|
2037
2053
|
}, [e]), e === "dark" ? "dark" : e === "light" ? "light" : t ? "dark" : "light";
|
|
2038
2054
|
}
|
|
2039
|
-
function
|
|
2040
|
-
let t = e.persistOpen ?? !0, [n, r] =
|
|
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({
|
|
2041
2057
|
embedKey: e.embedKey,
|
|
2042
2058
|
user: e.user,
|
|
2059
|
+
getSubjectToken: e.getSubjectToken,
|
|
2043
2060
|
agent: e.agent,
|
|
2044
2061
|
context: e.context,
|
|
2045
2062
|
greeting: h,
|
|
2046
2063
|
locale: d,
|
|
2047
2064
|
onEvent: g
|
|
2048
2065
|
});
|
|
2049
|
-
|
|
2066
|
+
W(() => {
|
|
2050
2067
|
!n && C.some((e) => e.role === "assistant" && e.id !== "greeting") && s(!0);
|
|
2051
2068
|
}, [C, n]);
|
|
2052
|
-
let
|
|
2053
|
-
|
|
2054
|
-
let
|
|
2055
|
-
s(!1), !
|
|
2069
|
+
let F = G(n);
|
|
2070
|
+
F.current = n;
|
|
2071
|
+
let ee = q(() => {
|
|
2072
|
+
s(!1), !F.current && (F.current = !0, r(!0), t && ze(!0), g?.({
|
|
2056
2073
|
type: "chatbot-open",
|
|
2057
|
-
sessionId:
|
|
2074
|
+
sessionId: E
|
|
2058
2075
|
}));
|
|
2059
2076
|
}, [
|
|
2060
2077
|
g,
|
|
2061
2078
|
t,
|
|
2062
|
-
|
|
2063
|
-
]), I =
|
|
2064
|
-
|
|
2079
|
+
E
|
|
2080
|
+
]), I = q(() => {
|
|
2081
|
+
F.current && (F.current = !1, r(!1), t && ze(!1), g?.({
|
|
2065
2082
|
type: "chatbot-close",
|
|
2066
|
-
sessionId:
|
|
2083
|
+
sessionId: E
|
|
2067
2084
|
}), l.current?.focus());
|
|
2068
2085
|
}, [
|
|
2069
2086
|
g,
|
|
2070
2087
|
t,
|
|
2071
|
-
|
|
2088
|
+
E
|
|
2072
2089
|
]);
|
|
2073
|
-
|
|
2090
|
+
W(() => {
|
|
2074
2091
|
n && x();
|
|
2075
2092
|
}, [n, x]);
|
|
2076
|
-
let L =
|
|
2093
|
+
let L = q((e) => {
|
|
2077
2094
|
a(!0), _(e);
|
|
2078
|
-
}, [_]),
|
|
2095
|
+
}, [_]), te = q(() => {
|
|
2079
2096
|
a(!1), s(!1), v();
|
|
2080
|
-
}, [v]), R =
|
|
2081
|
-
openPanel:
|
|
2097
|
+
}, [v]), R = G({
|
|
2098
|
+
openPanel: ee,
|
|
2082
2099
|
closePanel: I,
|
|
2083
2100
|
send: L,
|
|
2084
|
-
reset:
|
|
2085
|
-
sessionId:
|
|
2101
|
+
reset: te,
|
|
2102
|
+
sessionId: E
|
|
2086
2103
|
});
|
|
2087
2104
|
R.current = {
|
|
2088
|
-
openPanel:
|
|
2105
|
+
openPanel: ee,
|
|
2089
2106
|
closePanel: I,
|
|
2090
2107
|
send: L,
|
|
2091
|
-
reset:
|
|
2092
|
-
sessionId:
|
|
2108
|
+
reset: te,
|
|
2109
|
+
sessionId: E
|
|
2093
2110
|
};
|
|
2094
|
-
let
|
|
2111
|
+
let ne = G({
|
|
2095
2112
|
open: () => R.current.openPanel(),
|
|
2096
2113
|
close: () => R.current.closePanel(),
|
|
2097
|
-
toggle: () =>
|
|
2114
|
+
toggle: () => F.current ? R.current.closePanel() : R.current.openPanel(),
|
|
2098
2115
|
reset: () => R.current.reset(),
|
|
2099
2116
|
send: (e) => {
|
|
2100
2117
|
R.current.openPanel(), R.current.send(e);
|
|
2101
2118
|
},
|
|
2102
|
-
isOpen: () =>
|
|
2119
|
+
isOpen: () => F.current,
|
|
2103
2120
|
sessionId: () => R.current.sessionId
|
|
2104
2121
|
}), z = e.bind;
|
|
2105
|
-
|
|
2122
|
+
_e(() => (z?.(ne.current), () => z?.(null)), [z]), W(() => {
|
|
2106
2123
|
if (!n) return;
|
|
2107
2124
|
let e = (e) => {
|
|
2108
2125
|
e.key === "Escape" && (e.stopPropagation(), I());
|
|
2109
2126
|
};
|
|
2110
2127
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
2111
2128
|
}, [I, n]);
|
|
2112
|
-
let
|
|
2129
|
+
let re = K(() => C.some((e) => e.id !== "greeting"), [C]), ie = K(() => _n(e.context), [e.context]), B = {
|
|
2113
2130
|
...e.accent ? { "--sqc-accent": e.accent } : {},
|
|
2114
|
-
"--sqc-width": e.width ??
|
|
2131
|
+
"--sqc-width": e.width ?? mn.width
|
|
2115
2132
|
};
|
|
2116
|
-
return /* @__PURE__ */
|
|
2133
|
+
return /* @__PURE__ */ Y("div", {
|
|
2117
2134
|
class: "sqc",
|
|
2118
2135
|
"data-theme": u,
|
|
2119
2136
|
"data-position": e.position ?? "bottom-right",
|
|
2137
|
+
"data-layout": e.layout ?? "sidebar",
|
|
2120
2138
|
"data-open": n ? "true" : "false",
|
|
2121
|
-
style:
|
|
2122
|
-
children: [/* @__PURE__ */
|
|
2139
|
+
style: B,
|
|
2140
|
+
children: [/* @__PURE__ */ Y("button", {
|
|
2123
2141
|
ref: l,
|
|
2124
2142
|
type: "button",
|
|
2125
2143
|
class: "sqc-launcher",
|
|
2126
2144
|
"aria-label": p,
|
|
2127
2145
|
"aria-expanded": n,
|
|
2128
2146
|
"aria-haspopup": "dialog",
|
|
2129
|
-
onClick:
|
|
2130
|
-
children: [/* @__PURE__ */
|
|
2147
|
+
onClick: ee,
|
|
2148
|
+
children: [/* @__PURE__ */ Y("span", {
|
|
2131
2149
|
class: "sqc-launcher__icon",
|
|
2132
|
-
children: /* @__PURE__ */
|
|
2150
|
+
children: /* @__PURE__ */ Y("slot", {
|
|
2133
2151
|
name: "launcher-icon",
|
|
2134
2152
|
class: "sqc-slot-icon",
|
|
2135
|
-
children: /* @__PURE__ */
|
|
2153
|
+
children: /* @__PURE__ */ Y(fn, {})
|
|
2136
2154
|
})
|
|
2137
|
-
}), o && /* @__PURE__ */
|
|
2155
|
+
}), o && /* @__PURE__ */ Y("span", {
|
|
2138
2156
|
class: "sqc-launcher__badge",
|
|
2139
2157
|
"aria-hidden": "true"
|
|
2140
2158
|
})]
|
|
2141
|
-
}), /* @__PURE__ */
|
|
2159
|
+
}), /* @__PURE__ */ Y("aside", {
|
|
2142
2160
|
ref: c,
|
|
2143
2161
|
class: "sqc-panel",
|
|
2144
2162
|
role: "dialog",
|
|
@@ -2146,53 +2164,53 @@ function yn(e) {
|
|
|
2146
2164
|
"aria-label": p,
|
|
2147
2165
|
...n ? {} : { inert: !0 },
|
|
2148
2166
|
children: [
|
|
2149
|
-
/* @__PURE__ */
|
|
2167
|
+
/* @__PURE__ */ Y("header", {
|
|
2150
2168
|
class: "sqc-header",
|
|
2151
2169
|
children: [
|
|
2152
|
-
/* @__PURE__ */
|
|
2170
|
+
/* @__PURE__ */ Y("span", {
|
|
2153
2171
|
class: "sqc-header__icon",
|
|
2154
2172
|
"aria-hidden": "true",
|
|
2155
|
-
children: /* @__PURE__ */
|
|
2173
|
+
children: /* @__PURE__ */ Y(fn, {})
|
|
2156
2174
|
}),
|
|
2157
|
-
/* @__PURE__ */
|
|
2175
|
+
/* @__PURE__ */ Y("div", {
|
|
2158
2176
|
class: "sqc-header__titles",
|
|
2159
|
-
children: [/* @__PURE__ */
|
|
2177
|
+
children: [/* @__PURE__ */ Y("p", {
|
|
2160
2178
|
class: "sqc-header__heading",
|
|
2161
2179
|
children: p
|
|
2162
|
-
}), /* @__PURE__ */
|
|
2180
|
+
}), /* @__PURE__ */ Y("p", {
|
|
2163
2181
|
class: "sqc-header__sub",
|
|
2164
|
-
children:
|
|
2182
|
+
children: vn(e.subheading, f.subheading)
|
|
2165
2183
|
})]
|
|
2166
2184
|
}),
|
|
2167
|
-
/* @__PURE__ */
|
|
2185
|
+
/* @__PURE__ */ Y("button", {
|
|
2168
2186
|
type: "button",
|
|
2169
2187
|
class: "sqc-icon-btn",
|
|
2170
|
-
onClick:
|
|
2188
|
+
onClick: te,
|
|
2171
2189
|
"aria-label": f.newConversation,
|
|
2172
2190
|
"data-tip": f.newConversation,
|
|
2173
|
-
children: /* @__PURE__ */
|
|
2191
|
+
children: /* @__PURE__ */ Y("svg", {
|
|
2174
2192
|
viewBox: "0 0 24 24",
|
|
2175
2193
|
fill: "none",
|
|
2176
2194
|
stroke: "currentColor",
|
|
2177
2195
|
"stroke-width": "1.8",
|
|
2178
|
-
children: /* @__PURE__ */
|
|
2196
|
+
children: /* @__PURE__ */ Y("path", {
|
|
2179
2197
|
d: "M20 12a8 8 0 1 1-2.6-5.9M20 4v4h-4",
|
|
2180
2198
|
"stroke-linecap": "round"
|
|
2181
2199
|
})
|
|
2182
2200
|
})
|
|
2183
2201
|
}),
|
|
2184
|
-
/* @__PURE__ */
|
|
2202
|
+
/* @__PURE__ */ Y("button", {
|
|
2185
2203
|
type: "button",
|
|
2186
2204
|
class: "sqc-icon-btn",
|
|
2187
2205
|
onClick: I,
|
|
2188
2206
|
"aria-label": f.close,
|
|
2189
2207
|
"data-tip": f.closeTitle,
|
|
2190
|
-
children: /* @__PURE__ */
|
|
2208
|
+
children: /* @__PURE__ */ Y("svg", {
|
|
2191
2209
|
viewBox: "0 0 24 24",
|
|
2192
2210
|
fill: "none",
|
|
2193
2211
|
stroke: "currentColor",
|
|
2194
2212
|
"stroke-width": "1.8",
|
|
2195
|
-
children: /* @__PURE__ */
|
|
2213
|
+
children: /* @__PURE__ */ Y("path", {
|
|
2196
2214
|
d: "M6 6l12 12M18 6L6 18",
|
|
2197
2215
|
"stroke-linecap": "round"
|
|
2198
2216
|
})
|
|
@@ -2200,46 +2218,55 @@ function yn(e) {
|
|
|
2200
2218
|
})
|
|
2201
2219
|
]
|
|
2202
2220
|
}),
|
|
2203
|
-
|
|
2221
|
+
ie.length > 0 && /* @__PURE__ */ Y("div", {
|
|
2204
2222
|
class: "sqc-context",
|
|
2205
2223
|
"aria-label": f.context.region,
|
|
2206
|
-
children:
|
|
2224
|
+
children: ie.map((e) => /* @__PURE__ */ Y("span", {
|
|
2207
2225
|
class: "sqc-chip",
|
|
2208
2226
|
title: `${e.label}: ${e.value}`,
|
|
2209
|
-
children: [/* @__PURE__ */
|
|
2227
|
+
children: [/* @__PURE__ */ Y("b", { children: e.label }), e.value]
|
|
2210
2228
|
}, e.label))
|
|
2211
2229
|
}),
|
|
2212
|
-
/* @__PURE__ */
|
|
2230
|
+
/* @__PURE__ */ Y(pn, {
|
|
2213
2231
|
messages: C,
|
|
2214
2232
|
locale: d,
|
|
2215
2233
|
assistantName: m,
|
|
2216
2234
|
suggestions: e.suggestions,
|
|
2217
|
-
showSuggestions: !i && !
|
|
2235
|
+
showSuggestions: !i && !re,
|
|
2218
2236
|
busy: S,
|
|
2219
2237
|
withHuman: w,
|
|
2220
2238
|
onSuggestion: L,
|
|
2221
2239
|
onChoice: L,
|
|
2222
2240
|
onDecide: y,
|
|
2223
|
-
onLoadAttachment:
|
|
2241
|
+
onLoadAttachment: P
|
|
2224
2242
|
}),
|
|
2225
|
-
/* @__PURE__ */
|
|
2226
|
-
placeholder:
|
|
2243
|
+
/* @__PURE__ */ Y(kt, {
|
|
2244
|
+
placeholder: vn(e.placeholder, f.placeholder),
|
|
2227
2245
|
locale: d,
|
|
2228
2246
|
busy: S,
|
|
2229
2247
|
autoFocus: n,
|
|
2230
|
-
handles:
|
|
2231
|
-
addressee:
|
|
2232
|
-
attachments:
|
|
2233
|
-
uploading:
|
|
2234
|
-
attachmentError:
|
|
2235
|
-
onAttach:
|
|
2236
|
-
onDetach:
|
|
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,
|
|
2237
2255
|
onSend: L,
|
|
2238
2256
|
onStop: b
|
|
2239
2257
|
}),
|
|
2240
|
-
/* @__PURE__ */
|
|
2258
|
+
/* @__PURE__ */ Y("p", {
|
|
2241
2259
|
class: "sqc-hint",
|
|
2242
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
|
+
})
|
|
2243
2270
|
})
|
|
2244
2271
|
]
|
|
2245
2272
|
})]
|
|
@@ -2247,21 +2274,21 @@ function yn(e) {
|
|
|
2247
2274
|
}
|
|
2248
2275
|
//#endregion
|
|
2249
2276
|
//#region src/styles.css?inline
|
|
2250
|
-
var bn = ":host{--sqc-width:min(392px, 100vw);--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-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}@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}}@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}";
|
|
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}";
|
|
2251
2278
|
//#endregion
|
|
2252
2279
|
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/checkPrivateRedeclaration.js
|
|
2253
|
-
function
|
|
2280
|
+
function Sn(e, t) {
|
|
2254
2281
|
if (t.has(e)) throw TypeError("Cannot initialize the same private elements twice on an object");
|
|
2255
2282
|
}
|
|
2256
2283
|
//#endregion
|
|
2257
2284
|
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/classPrivateMethodInitSpec.js
|
|
2258
|
-
function
|
|
2259
|
-
|
|
2285
|
+
function Cn(e, t) {
|
|
2286
|
+
Sn(e, t), t.add(e);
|
|
2260
2287
|
}
|
|
2261
2288
|
//#endregion
|
|
2262
2289
|
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/classPrivateFieldInitSpec.js
|
|
2263
2290
|
function X(e, t, n) {
|
|
2264
|
-
|
|
2291
|
+
Sn(e, t), t.set(e, n);
|
|
2265
2292
|
}
|
|
2266
2293
|
//#endregion
|
|
2267
2294
|
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/assertClassBrand.js
|
|
@@ -2281,7 +2308,7 @@ function $(e, t) {
|
|
|
2281
2308
|
}
|
|
2282
2309
|
//#endregion
|
|
2283
2310
|
//#region src/element.tsx
|
|
2284
|
-
var
|
|
2311
|
+
var wn = "squadico-chatbot", Tn = [
|
|
2285
2312
|
"embed-key",
|
|
2286
2313
|
"context",
|
|
2287
2314
|
"user",
|
|
@@ -2296,24 +2323,25 @@ var Cn = "squadico-chatbot", wn = [
|
|
|
2296
2323
|
"accent",
|
|
2297
2324
|
"theme",
|
|
2298
2325
|
"position",
|
|
2326
|
+
"layout",
|
|
2299
2327
|
"open",
|
|
2300
2328
|
"persist-open",
|
|
2301
2329
|
"locale"
|
|
2302
|
-
],
|
|
2303
|
-
function
|
|
2304
|
-
if (
|
|
2330
|
+
], En;
|
|
2331
|
+
function Dn() {
|
|
2332
|
+
if (En !== void 0) return En;
|
|
2305
2333
|
try {
|
|
2306
2334
|
let e = new CSSStyleSheet();
|
|
2307
|
-
e.replaceSync(
|
|
2335
|
+
e.replaceSync(xn), En = e;
|
|
2308
2336
|
} catch {
|
|
2309
|
-
|
|
2337
|
+
En = null;
|
|
2310
2338
|
}
|
|
2311
|
-
return
|
|
2339
|
+
return En;
|
|
2312
2340
|
}
|
|
2313
|
-
function
|
|
2314
|
-
typeof console < "u" && console.warn(`[${
|
|
2341
|
+
function On(e, t) {
|
|
2342
|
+
typeof console < "u" && console.warn(`[${wn}] ${e}`, t ?? "");
|
|
2315
2343
|
}
|
|
2316
|
-
function
|
|
2344
|
+
function kn(e) {
|
|
2317
2345
|
if (!(!e || !e.trim())) try {
|
|
2318
2346
|
let t = JSON.parse(e);
|
|
2319
2347
|
if (t && typeof t == "object" && !Array.isArray(t)) {
|
|
@@ -2324,65 +2352,68 @@ function On(e) {
|
|
|
2324
2352
|
digest: typeof e.digest == "string" && e.digest ? e.digest : void 0
|
|
2325
2353
|
};
|
|
2326
2354
|
}
|
|
2327
|
-
|
|
2355
|
+
On("the \"user\" attribute needs an object with an id", e);
|
|
2328
2356
|
} catch (e) {
|
|
2329
|
-
|
|
2357
|
+
On("the \"user\" attribute is not valid JSON", e);
|
|
2330
2358
|
}
|
|
2331
2359
|
}
|
|
2332
|
-
function
|
|
2360
|
+
function An(e) {
|
|
2333
2361
|
if (!(!e || !e.trim())) try {
|
|
2334
2362
|
let t = JSON.parse(e);
|
|
2335
2363
|
if (t && typeof t == "object" && !Array.isArray(t)) return t;
|
|
2336
|
-
|
|
2364
|
+
On("the `context` attribute must be a JSON object", e);
|
|
2337
2365
|
} catch (e) {
|
|
2338
|
-
|
|
2366
|
+
On("the `context` attribute is not valid JSON", e);
|
|
2339
2367
|
}
|
|
2340
2368
|
}
|
|
2341
|
-
function
|
|
2369
|
+
function jn(e) {
|
|
2342
2370
|
if (!(!e || !e.trim())) {
|
|
2343
2371
|
if (e.trim().startsWith("[")) try {
|
|
2344
2372
|
let t = JSON.parse(e);
|
|
2345
2373
|
if (Array.isArray(t)) return t.map(String);
|
|
2346
2374
|
} catch (e) {
|
|
2347
|
-
|
|
2375
|
+
On("the `suggestions` attribute is not valid JSON", e);
|
|
2348
2376
|
return;
|
|
2349
2377
|
}
|
|
2350
2378
|
return e.split("|").map((e) => e.trim()).filter(Boolean);
|
|
2351
2379
|
}
|
|
2352
2380
|
}
|
|
2353
|
-
function
|
|
2381
|
+
function Mn(e) {
|
|
2354
2382
|
if (e !== null) return e !== "false" && e !== "0";
|
|
2355
2383
|
}
|
|
2356
|
-
function
|
|
2384
|
+
function Nn(e) {
|
|
2357
2385
|
return e === "dark" || e === "light" || e === "auto" ? e : void 0;
|
|
2358
2386
|
}
|
|
2359
|
-
function
|
|
2387
|
+
function Pn(e) {
|
|
2360
2388
|
return e === "bottom-left" || e === "bottom-right" ? e : void 0;
|
|
2361
2389
|
}
|
|
2362
|
-
function
|
|
2363
|
-
|
|
2364
|
-
|
|
2390
|
+
function Fn(e) {
|
|
2391
|
+
return e === "floating" || e === "sidebar" ? e : void 0;
|
|
2392
|
+
}
|
|
2393
|
+
function In() {
|
|
2394
|
+
var e, t, n, r, i, a, o, s, c, l, u, d, f, p;
|
|
2395
|
+
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 {
|
|
2365
2396
|
constructor() {
|
|
2366
|
-
super(),
|
|
2397
|
+
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) => {
|
|
2367
2398
|
let { type: t, ...n } = e;
|
|
2368
2399
|
Q(a, this, n.sessionId), this.dispatchEvent(new CustomEvent(t, {
|
|
2369
2400
|
detail: n,
|
|
2370
2401
|
bubbles: !0,
|
|
2371
2402
|
composed: !0
|
|
2372
2403
|
}));
|
|
2373
|
-
}), X(this,
|
|
2404
|
+
}), X(this, p, (e) => {
|
|
2374
2405
|
Q(n, this, e), e && Q(a, this, e.sessionId());
|
|
2375
2406
|
});
|
|
2376
|
-
let e = this.attachShadow({ mode: "open" }),
|
|
2377
|
-
if (
|
|
2407
|
+
let e = this.attachShadow({ mode: "open" }), m = Dn();
|
|
2408
|
+
if (m) e.adoptedStyleSheets = [m];
|
|
2378
2409
|
else {
|
|
2379
2410
|
let t = document.createElement("style");
|
|
2380
|
-
t.textContent =
|
|
2411
|
+
t.textContent = xn, e.append(t);
|
|
2381
2412
|
}
|
|
2382
2413
|
Q(t, this, document.createElement("div")), e.append($(t, this));
|
|
2383
2414
|
}
|
|
2384
2415
|
connectedCallback() {
|
|
2385
|
-
Q(i, this, !0), Z(
|
|
2416
|
+
Q(i, this, !0), Z(d, this, h).call(this);
|
|
2386
2417
|
}
|
|
2387
2418
|
disconnectedCallback() {
|
|
2388
2419
|
Q(i, this, !1), ie(null, $(t, this)), Q(n, this, null);
|
|
@@ -2390,38 +2421,44 @@ function Pn() {
|
|
|
2390
2421
|
attributeChangedCallback(e, t, r) {
|
|
2391
2422
|
if (t !== r) {
|
|
2392
2423
|
if (e === "open" && $(n, this)) {
|
|
2393
|
-
|
|
2424
|
+
Mn(r) ? $(n, this).open() : $(n, this).close();
|
|
2394
2425
|
return;
|
|
2395
2426
|
}
|
|
2396
|
-
Z(
|
|
2427
|
+
Z(d, this, m).call(this);
|
|
2397
2428
|
}
|
|
2398
2429
|
}
|
|
2399
2430
|
get context() {
|
|
2400
|
-
return $(o, this) ??
|
|
2431
|
+
return $(o, this) ?? An(this.getAttribute("context"));
|
|
2401
2432
|
}
|
|
2402
2433
|
set context(e) {
|
|
2403
|
-
Q(o, this, e), Z(
|
|
2434
|
+
Q(o, this, e), Z(d, this, m).call(this);
|
|
2404
2435
|
}
|
|
2405
2436
|
get embedKey() {
|
|
2406
|
-
return $(
|
|
2437
|
+
return $(u, this) ?? this.getAttribute("embed-key") ?? void 0;
|
|
2407
2438
|
}
|
|
2408
2439
|
set embedKey(e) {
|
|
2409
|
-
Q(
|
|
2440
|
+
Q(u, this, e), Z(d, this, m).call(this);
|
|
2410
2441
|
}
|
|
2411
2442
|
get user() {
|
|
2412
|
-
return $(s, this) ??
|
|
2443
|
+
return $(s, this) ?? kn(this.getAttribute("user"));
|
|
2413
2444
|
}
|
|
2414
2445
|
set user(e) {
|
|
2415
|
-
Q(s, this, e), Z(
|
|
2446
|
+
Q(s, this, e), Z(d, this, m).call(this);
|
|
2447
|
+
}
|
|
2448
|
+
get getSubjectToken() {
|
|
2449
|
+
return $(c, this);
|
|
2450
|
+
}
|
|
2451
|
+
set getSubjectToken(e) {
|
|
2452
|
+
Q(c, this, e), Z(d, this, m).call(this);
|
|
2416
2453
|
}
|
|
2417
2454
|
get agent() {
|
|
2418
|
-
return $(
|
|
2455
|
+
return $(l, this) ?? this.getAttribute("agent") ?? void 0;
|
|
2419
2456
|
}
|
|
2420
2457
|
set agent(e) {
|
|
2421
|
-
Q(
|
|
2458
|
+
Q(l, this, e), Z(d, this, m).call(this);
|
|
2422
2459
|
}
|
|
2423
2460
|
get open() {
|
|
2424
|
-
return $(n, this)?.isOpen() ??
|
|
2461
|
+
return $(n, this)?.isOpen() ?? Mn(this.getAttribute("open")) ?? !1;
|
|
2425
2462
|
}
|
|
2426
2463
|
set open(e) {
|
|
2427
2464
|
e ? this.openChat() : this.closeChat();
|
|
@@ -2443,50 +2480,52 @@ function Pn() {
|
|
|
2443
2480
|
}
|
|
2444
2481
|
sendMessage(e) {
|
|
2445
2482
|
if (!$(n, this)) {
|
|
2446
|
-
|
|
2483
|
+
On("sendMessage() called before the component was mounted — ignored");
|
|
2447
2484
|
return;
|
|
2448
2485
|
}
|
|
2449
2486
|
$(n, this).send(e);
|
|
2450
2487
|
}
|
|
2451
|
-
},
|
|
2452
|
-
function
|
|
2488
|
+
}, Ge(e, "observedAttributes", Tn), e;
|
|
2489
|
+
function m() {
|
|
2453
2490
|
$(r, this) || !$(i, this) || (Q(r, this, !0), queueMicrotask(() => {
|
|
2454
|
-
Q(r, this, !1), $(i, this) && Z(
|
|
2491
|
+
Q(r, this, !1), $(i, this) && Z(d, this, h).call(this);
|
|
2455
2492
|
}));
|
|
2456
2493
|
}
|
|
2457
|
-
function
|
|
2494
|
+
function h() {
|
|
2458
2495
|
let e = (e) => this.getAttribute(e) ?? void 0;
|
|
2459
|
-
ie(/* @__PURE__ */
|
|
2496
|
+
ie(/* @__PURE__ */ Y(bn, {
|
|
2460
2497
|
embedKey: this.embedKey,
|
|
2461
2498
|
context: this.context,
|
|
2462
2499
|
user: this.user,
|
|
2500
|
+
getSubjectToken: this.getSubjectToken,
|
|
2463
2501
|
agent: this.agent,
|
|
2464
2502
|
heading: e("heading"),
|
|
2465
2503
|
subheading: e("subheading"),
|
|
2466
2504
|
assistantName: e("assistant-name"),
|
|
2467
2505
|
placeholder: e("placeholder"),
|
|
2468
2506
|
greeting: e("greeting"),
|
|
2469
|
-
suggestions:
|
|
2507
|
+
suggestions: jn(this.getAttribute("suggestions")),
|
|
2470
2508
|
width: e("width"),
|
|
2471
2509
|
accent: e("accent"),
|
|
2472
|
-
theme:
|
|
2473
|
-
position:
|
|
2474
|
-
|
|
2475
|
-
|
|
2510
|
+
theme: Nn(this.getAttribute("theme")),
|
|
2511
|
+
position: Pn(this.getAttribute("position")),
|
|
2512
|
+
layout: Fn(this.getAttribute("layout")),
|
|
2513
|
+
defaultOpen: Mn(this.getAttribute("open")) ?? !1,
|
|
2514
|
+
persistOpen: Mn(this.getAttribute("persist-open")) ?? !0,
|
|
2476
2515
|
locale: e("locale"),
|
|
2477
|
-
onEvent: $(
|
|
2478
|
-
bind: $(
|
|
2516
|
+
onEvent: $(f, this),
|
|
2517
|
+
bind: $(p, this)
|
|
2479
2518
|
}), $(t, this));
|
|
2480
2519
|
}
|
|
2481
2520
|
}
|
|
2482
|
-
var
|
|
2483
|
-
function
|
|
2484
|
-
typeof window > "u" || typeof HTMLElement > "u" || (
|
|
2521
|
+
var Ln;
|
|
2522
|
+
function Rn(e = wn) {
|
|
2523
|
+
typeof window > "u" || typeof HTMLElement > "u" || (Ln ?? (Ln = In()), window.customElements.get(e) || window.customElements.define(e, Ln));
|
|
2485
2524
|
}
|
|
2486
2525
|
//#endregion
|
|
2487
2526
|
//#region src/index.ts
|
|
2488
|
-
|
|
2527
|
+
Rn();
|
|
2489
2528
|
//#endregion
|
|
2490
|
-
export {
|
|
2529
|
+
export { qe as a, je as c, J as i, Rn as n, Be as o, Ke as r, Ae as s, wn as t };
|
|
2491
2530
|
|
|
2492
|
-
//# sourceMappingURL=src-
|
|
2531
|
+
//# sourceMappingURL=src-BL9j5H3p.js.map
|