@squadico/chatbot 1.2.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +109 -19
- package/dist/answer-CDGrP8YE.js +1193 -0
- package/dist/answer-CDGrP8YE.js.map +1 -0
- package/dist/answer-DRaV2dVt.cjs +8 -0
- package/dist/answer-DRaV2dVt.cjs.map +1 -0
- package/dist/chatbot-widgets.global.js +4 -0
- package/dist/chatbot-widgets.global.js.map +1 -0
- package/dist/chatbot.global.js +12 -7
- package/dist/chatbot.global.js.map +1 -1
- package/dist/components/ChatbotWidget.d.ts.map +1 -1
- package/dist/components/MessageList.d.ts +4 -1
- package/dist/components/MessageList.d.ts.map +1 -1
- package/dist/components/RichText.d.ts +6 -4
- package/dist/components/RichText.d.ts.map +1 -1
- package/dist/element.d.ts.map +1 -1
- package/dist/extras-ClIRRLqo.js +604 -0
- package/dist/extras-ClIRRLqo.js.map +1 -0
- package/dist/extras-lsCe4xgN.cjs +4 -0
- package/dist/extras-lsCe4xgN.cjs.map +1 -0
- 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 +3 -2
- package/dist/jsx.d.ts +43 -0
- package/dist/jsx.d.ts.map +1 -1
- package/dist/lib/client.d.ts +8 -4
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/i18n.d.ts +20 -0
- package/dist/lib/i18n.d.ts.map +1 -1
- package/dist/lib/useChat.d.ts.map +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +2 -2
- package/dist/react.js.map +1 -1
- package/dist/src-BjqOavOO.js +1984 -0
- package/dist/src-BjqOavOO.js.map +1 -0
- package/dist/src-DS8P9HdZ.cjs +7 -0
- package/dist/src-DS8P9HdZ.cjs.map +1 -0
- package/dist/types.d.ts +14 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/widgets/approval/SqcApproval.d.ts +17 -0
- package/dist/widgets/approval/SqcApproval.d.ts.map +1 -0
- package/dist/widgets/approval/name.d.ts +3 -0
- package/dist/widgets/approval/name.d.ts.map +1 -0
- package/dist/widgets/chart/SqcChart.d.ts +19 -0
- package/dist/widgets/chart/SqcChart.d.ts.map +1 -0
- package/dist/widgets/chart/draw.d.ts +31 -0
- package/dist/widgets/chart/draw.d.ts.map +1 -0
- package/dist/widgets/chart/png.d.ts +10 -0
- package/dist/widgets/chart/png.d.ts.map +1 -0
- package/dist/widgets/chart/read.d.ts +11 -0
- package/dist/widgets/chart/read.d.ts.map +1 -0
- package/dist/widgets/chart/strings.d.ts +32 -0
- package/dist/widgets/chart/strings.d.ts.map +1 -0
- package/dist/widgets/choices/SqcChoices.d.ts +17 -0
- package/dist/widgets/choices/SqcChoices.d.ts.map +1 -0
- package/dist/widgets/confirm/SqcConfirm.d.ts +12 -0
- package/dist/widgets/confirm/SqcConfirm.d.ts.map +1 -0
- package/dist/widgets/define.d.ts +8 -0
- package/dist/widgets/define.d.ts.map +1 -0
- package/dist/widgets/element.d.ts +26 -0
- package/dist/widgets/element.d.ts.map +1 -0
- package/dist/widgets/extras-loader.d.ts +21 -0
- package/dist/widgets/extras-loader.d.ts.map +1 -0
- package/dist/widgets/extras.d.ts +3 -0
- package/dist/widgets/extras.d.ts.map +1 -0
- package/dist/widgets/extras.global.d.ts +2 -0
- package/dist/widgets/extras.global.d.ts.map +1 -0
- package/dist/widgets/form/SqcForm.d.ts +14 -0
- package/dist/widgets/form/SqcForm.d.ts.map +1 -0
- package/dist/widgets/form/reply.d.ts +7 -0
- package/dist/widgets/form/reply.d.ts.map +1 -0
- package/dist/widgets/i18n.d.ts +4 -0
- package/dist/widgets/i18n.d.ts.map +1 -0
- package/dist/widgets/index.d.ts +10 -0
- package/dist/widgets/index.d.ts.map +1 -0
- package/dist/widgets/inline.d.ts +11 -0
- package/dist/widgets/inline.d.ts.map +1 -0
- package/dist/widgets/live.d.ts +12 -0
- package/dist/widgets/live.d.ts.map +1 -0
- package/dist/widgets/names.d.ts +10 -0
- package/dist/widgets/names.d.ts.map +1 -0
- package/dist/widgets/parse/answer.d.ts +11 -0
- package/dist/widgets/parse/answer.d.ts.map +1 -0
- package/dist/widgets/parse/confirm.d.ts +19 -0
- package/dist/widgets/parse/confirm.d.ts.map +1 -0
- package/dist/widgets/parse/form.d.ts +6 -0
- package/dist/widgets/parse/form.d.ts.map +1 -0
- package/dist/widgets/styles.d.ts +3 -0
- package/dist/widgets/styles.d.ts.map +1 -0
- package/dist/widgets/table/SqcTable.d.ts +16 -0
- package/dist/widgets/table/SqcTable.d.ts.map +1 -0
- package/dist/widgets/types.d.ts +68 -0
- package/dist/widgets/types.d.ts.map +1 -0
- package/dist/widgets.cjs +1 -0
- package/dist/widgets.js +3 -0
- package/package.json +7 -2
- package/dist/components/Approval.d.ts +0 -37
- package/dist/components/Approval.d.ts.map +0 -1
- package/dist/components/Choices.d.ts +0 -27
- package/dist/components/Choices.d.ts.map +0 -1
- package/dist/components/Confirm.d.ts +0 -16
- package/dist/components/Confirm.d.ts.map +0 -1
- package/dist/lib/confirm.d.ts +0 -17
- package/dist/lib/confirm.d.ts.map +0 -1
- package/dist/src-2GKPJcbZ.js +0 -2708
- package/dist/src-2GKPJcbZ.js.map +0 -1
- package/dist/src-CcILETWB.cjs +0 -8
- package/dist/src-CcILETWB.cjs.map +0 -1
package/dist/src-2GKPJcbZ.js
DELETED
|
@@ -1,2708 +0,0 @@
|
|
|
1
|
-
//#region node_modules/preact/dist/preact.module.js
|
|
2
|
-
var e, t, n, r, i, a, o, s, c, l, u, d, f, p, m = {}, h = [], g = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, _ = Array.isArray;
|
|
3
|
-
function v(e, t) {
|
|
4
|
-
for (var n in t) e[n] = t[n];
|
|
5
|
-
return e;
|
|
6
|
-
}
|
|
7
|
-
function y(e) {
|
|
8
|
-
e && e.parentNode && e.parentNode.removeChild(e);
|
|
9
|
-
}
|
|
10
|
-
function b(t, n, r) {
|
|
11
|
-
var i, a, o, s = {};
|
|
12
|
-
for (o in n) o == "key" ? i = n[o] : o == "ref" ? a = n[o] : s[o] = n[o];
|
|
13
|
-
if (arguments.length > 2 && (s.children = arguments.length > 3 ? e.call(arguments, 2) : r), typeof t == "function" && t.defaultProps != null) for (o in t.defaultProps) s[o] === void 0 && (s[o] = t.defaultProps[o]);
|
|
14
|
-
return x(t, s, i, a, null);
|
|
15
|
-
}
|
|
16
|
-
function x(e, r, i, a, o) {
|
|
17
|
-
var s = {
|
|
18
|
-
type: e,
|
|
19
|
-
props: r,
|
|
20
|
-
key: i,
|
|
21
|
-
ref: a,
|
|
22
|
-
__k: null,
|
|
23
|
-
__: null,
|
|
24
|
-
__b: 0,
|
|
25
|
-
__e: null,
|
|
26
|
-
__c: null,
|
|
27
|
-
constructor: void 0,
|
|
28
|
-
__v: o ?? ++n,
|
|
29
|
-
__i: -1,
|
|
30
|
-
__u: 0
|
|
31
|
-
};
|
|
32
|
-
return o == null && t.vnode != null && t.vnode(s), s;
|
|
33
|
-
}
|
|
34
|
-
function S(e) {
|
|
35
|
-
return e.children;
|
|
36
|
-
}
|
|
37
|
-
function C(e, t) {
|
|
38
|
-
this.props = e, this.context = t;
|
|
39
|
-
}
|
|
40
|
-
function w(e, t) {
|
|
41
|
-
if (t == null) return e.__ ? w(e.__, e.__i + 1) : null;
|
|
42
|
-
for (var n; t < e.__k.length; t++) if ((n = e.__k[t]) != null && n.__e != null) return n.__e;
|
|
43
|
-
return typeof e.type == "function" ? w(e) : null;
|
|
44
|
-
}
|
|
45
|
-
function T(e) {
|
|
46
|
-
if (e.__P && e.__d) {
|
|
47
|
-
var n = e.__v, r = n.__e, i = [], a = [], o = v({}, n);
|
|
48
|
-
o.__v = n.__v + 1, t.vnode && t.vnode(o), I(e.__P, o, n, e.__n, e.__P.namespaceURI, 32 & n.__u ? [r] : null, i, r ?? w(n), !!(32 & n.__u), a), o.__v = n.__v, o.__.__k[o.__i] = o, L(i, o, a), n.__e = n.__ = null, o.__e != r && E(o);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
function E(e) {
|
|
52
|
-
if ((e = e.__) != null && e.__c != null) return e.__e = e.__c.base = null, e.__k.some(function(t) {
|
|
53
|
-
if (t != null && t.__e != null) return e.__e = e.__c.base = t.__e;
|
|
54
|
-
}), E(e);
|
|
55
|
-
}
|
|
56
|
-
function D(e) {
|
|
57
|
-
(!e.__d && (e.__d = !0) && r.push(e) && !O.__r++ || i != t.debounceRendering) && ((i = t.debounceRendering) || a)(O);
|
|
58
|
-
}
|
|
59
|
-
function O() {
|
|
60
|
-
try {
|
|
61
|
-
for (var e, t = 1; r.length;) r.length > t && r.sort(o), e = r.shift(), t = r.length, T(e);
|
|
62
|
-
} finally {
|
|
63
|
-
r.length = O.__r = 0;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
function k(e, t, n, r, i, a, o, s, c, l, u) {
|
|
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 = I(e, p, f, i, a, o, s, c, l, u), g = p.__e, p.ref && f.ref != p.ref && (f.ref && ne(f.ref, null, p), u.push(p.ref, p.__c || g, p)), _ == null && g != null && (_ = g), 4 & p.__u ? (c = j(p, c, e), f.__e && (f.__e = null)) : typeof p.type == "function" && v !== void 0 ? c = v : g && (c = g.nextSibling), p.__u &= -7);
|
|
69
|
-
return n.__e = _, c;
|
|
70
|
-
}
|
|
71
|
-
function A(e, t, n, r, i) {
|
|
72
|
-
var a, o, s, c, l, u = n.length, d = u, f = 0;
|
|
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)), re(s, s));
|
|
75
|
-
return r;
|
|
76
|
-
}
|
|
77
|
-
function j(e, t, n) {
|
|
78
|
-
var r, i;
|
|
79
|
-
if (typeof e.type == "function") {
|
|
80
|
-
for (r = e.__k, i = 0; r && i < r.length; i++) r[i] && (r[i].__ = e, t = j(r[i], t, n));
|
|
81
|
-
return t;
|
|
82
|
-
}
|
|
83
|
-
e.__e != t && (t && e.type && !t.parentNode && (t = w(e)), t = n.insertBefore(e.__e, t || null));
|
|
84
|
-
do
|
|
85
|
-
t = t && t.nextSibling;
|
|
86
|
-
while (t != null && t.nodeType == 8);
|
|
87
|
-
return t;
|
|
88
|
-
}
|
|
89
|
-
function M(e, t, n, r) {
|
|
90
|
-
var i, a, o, s = e.key, c = e.type, l = t[n], u = l != null && !(2 & l.__u);
|
|
91
|
-
if (l === null && s == null || u && s == l.key && c == l.type) return n;
|
|
92
|
-
if (r > +!!u) {
|
|
93
|
-
for (i = n - 1, a = n + 1; i >= 0 || a < t.length;) if ((l = t[o = i >= 0 ? i-- : a++]) != null && !(2 & l.__u) && s == l.key && c == l.type) return o;
|
|
94
|
-
}
|
|
95
|
-
return -1;
|
|
96
|
-
}
|
|
97
|
-
function N(e, t, n) {
|
|
98
|
-
t[0] == "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || g.test(t) ? n : n + "px";
|
|
99
|
-
}
|
|
100
|
-
function P(e, t, n, r, i) {
|
|
101
|
-
var a, o;
|
|
102
|
-
n: if (t == "style") {
|
|
103
|
-
if (typeof n == "string") e.style.cssText = n;
|
|
104
|
-
else {
|
|
105
|
-
if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || N(e.style, t, "");
|
|
106
|
-
if (n) for (t in n) r && n[t] == r[t] || N(e.style, t, n[t]);
|
|
107
|
-
}
|
|
108
|
-
} else if (t[0] == "o" && t[1] == "n") a = t != (t = t.replace(u, "$1")), o = t.toLowerCase(), t = o in e || t == "onFocusOut" || t == "onFocusIn" ? o.slice(2) : t.slice(2), e.l || (e.l = {}), e.l[t + a] = n, n ? r ? n[l] = r[l] : (n[l] = d, e.addEventListener(t, a ? p : f, a)) : e.removeEventListener(t, a ? p : f, a);
|
|
109
|
-
else {
|
|
110
|
-
if (i == "http://www.w3.org/2000/svg") t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
111
|
-
else if (t != "width" && t != "height" && t != "href" && t != "list" && t != "form" && t != "tabIndex" && t != "download" && t != "rowSpan" && t != "colSpan" && t != "role" && t != "popover" && t in e) try {
|
|
112
|
-
e[t] = n ?? "";
|
|
113
|
-
break n;
|
|
114
|
-
} catch {}
|
|
115
|
-
typeof n == "function" || (n == null || !1 === n && t[4] != "-" ? e.removeAttribute(t) : e.setAttribute(t, t == "popover" && n == 1 ? "" : n));
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
function F(e) {
|
|
119
|
-
return function(n) {
|
|
120
|
-
if (this.l) {
|
|
121
|
-
var r = this.l[n.type + e];
|
|
122
|
-
if (n[c] == null) n[c] = d++;
|
|
123
|
-
else if (n[c] < r[l]) return;
|
|
124
|
-
return r(t.event ? t.event(n) : n);
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
function I(e, n, r, i, a, o, s, c, l, u) {
|
|
129
|
-
var d, f, p, m, g, b, x, T, E, D, O, A, j, M, N, P, F = n.type;
|
|
130
|
-
if (n.constructor !== void 0) return null;
|
|
131
|
-
128 & r.__u && (l = !!(32 & r.__u), o = [c = n.__e = r.__e]), (d = t.__b) && d(n);
|
|
132
|
-
n: if (typeof F == "function") {
|
|
133
|
-
f = s.length;
|
|
134
|
-
try {
|
|
135
|
-
if (E = n.props, D = F.prototype && F.prototype.render, O = (d = F.contextType) && i[d.__c], A = d ? O ? O.props.value : d.__ : i, r.__c ? T = (p = n.__c = r.__c).__ = p.__E : (D ? n.__c = p = new F(E, A) : (n.__c = p = new C(E, A), p.constructor = F, p.render = ie), O && O.sub(p), p.state || (p.state = {}), p.__n = i, m = p.__d = !0, p.__h = [], p._sb = []), D && p.__s == null && (p.__s = p.state), D && F.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = v({}, p.__s)), v(p.__s, F.getDerivedStateFromProps(E, p.__s))), g = p.props, b = p.state, p.__v = n, m) D && F.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), D && p.componentDidMount != null && p.__h.push(p.componentDidMount);
|
|
136
|
-
else {
|
|
137
|
-
if (D && F.getDerivedStateFromProps == null && E !== g && p.componentWillReceiveProps != null && p.componentWillReceiveProps(E, A), n.__v == r.__v || !p.__e && p.shouldComponentUpdate != null && !1 === p.shouldComponentUpdate(E, p.__s, A)) {
|
|
138
|
-
n.__v != r.__v && (p.props = E, p.state = p.__s, p.__d = !1), n.__e = r.__e, n.__k = r.__k, n.__k.some(function(e) {
|
|
139
|
-
e && (e.__ = n);
|
|
140
|
-
}), h.push.apply(p.__h, p._sb), p._sb = [], p.__h.length && s.push(p), c = w(r);
|
|
141
|
-
break n;
|
|
142
|
-
}
|
|
143
|
-
p.componentWillUpdate != null && p.componentWillUpdate(E, p.__s, A), D && p.componentDidUpdate != null && p.__h.push(function() {
|
|
144
|
-
p.componentDidUpdate(g, b, x);
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
if (p.context = A, p.props = E, p.__P = e, p.__e = !1, j = t.__r, M = 0, D) p.state = p.__s, p.__d = !1, j && j(n), d = p.render(p.props, p.state, p.context), h.push.apply(p.__h, p._sb), p._sb = [];
|
|
148
|
-
else do
|
|
149
|
-
p.__d = !1, j && j(n), d = p.render(p.props, p.state, p.context), p.state = p.__s;
|
|
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 ? 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
|
-
} catch (e) {
|
|
153
|
-
if (s.length = f, n.__v = null, l || o != null) {
|
|
154
|
-
if (e.then) {
|
|
155
|
-
for (n.__u |= l ? 160 : 128; c && c.nodeType == 8 && c.nextSibling;) c = c.nextSibling;
|
|
156
|
-
o != null && (o[o.indexOf(c)] = null), n.__e = c;
|
|
157
|
-
} else if (o != null) for (P = o.length; P--;) y(o[P]);
|
|
158
|
-
} else n.__e = r.__e;
|
|
159
|
-
n.__k ?? (n.__k = r.__k || []), e.then || ee(n), t.__e(e, n, r);
|
|
160
|
-
}
|
|
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
|
-
return (d = t.diffed) && d(n), 128 & n.__u ? void 0 : c;
|
|
163
|
-
}
|
|
164
|
-
function ee(e) {
|
|
165
|
-
e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(ee));
|
|
166
|
-
}
|
|
167
|
-
function L(e, n, r) {
|
|
168
|
-
for (var i = 0; i < r.length; i++) ne(r[i], r[++i], r[++i]);
|
|
169
|
-
t.__c && t.__c(n, e), e.some(function(n) {
|
|
170
|
-
try {
|
|
171
|
-
e = n.__h, n.__h = [], e.some(function(e) {
|
|
172
|
-
e.call(n);
|
|
173
|
-
});
|
|
174
|
-
} catch (e) {
|
|
175
|
-
t.__e(e, n.__v);
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
}
|
|
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
|
-
}
|
|
182
|
-
function R(n, r, i, a, o, s, c, l, u) {
|
|
183
|
-
var d, f, p, h, g, v, b, x = i.props || m, S = r.props, C = r.type;
|
|
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
|
-
for (d = 0; d < s.length; d++) if ((g = s[d]) && "setAttribute" in g == !!C && (C ? g.localName == C : g.nodeType == 3)) {
|
|
186
|
-
n = g, s[d] = null;
|
|
187
|
-
break;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
if (n == null) {
|
|
191
|
-
if (C == null) return document.createTextNode(S);
|
|
192
|
-
n = document.createElementNS(o, C, S.is && S), l && (t.__m && t.__m(r, s), l = !1), s = null;
|
|
193
|
-
}
|
|
194
|
-
if (C == null) x === S || l && n.data == S || (n.data = S);
|
|
195
|
-
else {
|
|
196
|
-
if (s = C == "textarea" && S.defaultValue != null ? null : s && e.call(n.childNodes), !l && s != null) for (x = {}, d = 0; d < n.attributes.length; d++) x[(g = n.attributes[d]).name] = g.value;
|
|
197
|
-
for (d in x) g = x[d], d == "dangerouslySetInnerHTML" ? p = g : d == "children" || d in S || d == "value" && "defaultValue" in S || d == "checked" && "defaultChecked" in S || P(n, d, null, g, o);
|
|
198
|
-
for (d in S) g = S[d], d == "children" ? h = g : d == "dangerouslySetInnerHTML" ? f = g : d == "value" ? v = g : d == "checked" ? b = g : l && typeof g != "function" || x[d] === g || P(n, d, g, x[d], o);
|
|
199
|
-
if (f) l || p && (f.__html == p.__html || f.__html == n.innerHTML) || (n.innerHTML = f.__html), r.__k = [];
|
|
200
|
-
else if (p && (n.innerHTML = ""), k(r.type == "template" ? n.content : n, _(h) ? h : [h], r, i, a, C == "foreignObject" ? "http://www.w3.org/1999/xhtml" : o, s, c, s ? s[0] : i.__k && w(i, 0), l, u), s != null) for (d = s.length; d--;) y(s[d]);
|
|
201
|
-
l && C != "textarea" || (d = "value", C == "progress" && v == null ? n.removeAttribute("value") : v != null && (v !== n[d] || C == "progress" && !v || C == "option" && v != x[d]) && P(n, d, v, x[d], o), d = "checked", b != null && b != n[d] && P(n, d, b, x[d], o));
|
|
202
|
-
}
|
|
203
|
-
return n;
|
|
204
|
-
}
|
|
205
|
-
function ne(e, n, r) {
|
|
206
|
-
try {
|
|
207
|
-
if (typeof e == "function") {
|
|
208
|
-
var i = typeof e.__u == "function";
|
|
209
|
-
i && e.__u(), i && n == null || (e.__u = e(n));
|
|
210
|
-
} else e.current = n;
|
|
211
|
-
} catch (e) {
|
|
212
|
-
t.__e(e, r);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
function re(e, n, r) {
|
|
216
|
-
var i, a;
|
|
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
|
-
if (i.componentWillUnmount) try {
|
|
219
|
-
i.componentWillUnmount();
|
|
220
|
-
} catch (e) {
|
|
221
|
-
t.__e(e, n);
|
|
222
|
-
}
|
|
223
|
-
i.base = i.__P = i.__n = null;
|
|
224
|
-
}
|
|
225
|
-
if (i = e.__k) for (a = 0; a < i.length; a++) i[a] && re(i[a], n, r || typeof e.type != "function");
|
|
226
|
-
r || y(e.__e), e.__c = e.__ = e.__e = void 0;
|
|
227
|
-
}
|
|
228
|
-
function ie(e, t, n) {
|
|
229
|
-
return this.constructor(e, n);
|
|
230
|
-
}
|
|
231
|
-
function ae(n, r, i) {
|
|
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 = [], I(r, n = (!a && i || r).__k = b(S, null, [n]), o || m, m, r.namespaceURI, !a && i ? [i] : o ? null : r.firstChild ? e.call(r.childNodes) : null, s, !a && i ? i : o ? o.__e : r.firstChild, a, c), L(s, n, c), n.props.children = null;
|
|
234
|
-
}
|
|
235
|
-
e = h.slice, t = { __e: function(e, t, n, r) {
|
|
236
|
-
for (var i, a, o; t = t.__;) if ((i = t.__c) && !i.__) try {
|
|
237
|
-
if ((a = i.constructor) && a.getDerivedStateFromError != null && (i.setState(a.getDerivedStateFromError(e)), o = i.__d), i.componentDidCatch != null && (i.componentDidCatch(e, r || {}), o = i.__d), o) return i.__E = i;
|
|
238
|
-
} catch (t) {
|
|
239
|
-
e = t;
|
|
240
|
-
}
|
|
241
|
-
throw e;
|
|
242
|
-
} }, n = 0, C.prototype.setState = function(e, t) {
|
|
243
|
-
var n = this.__s != null && this.__s != this.state ? this.__s : this.__s = v({}, this.state);
|
|
244
|
-
typeof e == "function" && (e = e(v({}, n), this.props)), e && v(n, e), e != null && this.__v && (t && this._sb.push(t), D(this));
|
|
245
|
-
}, C.prototype.forceUpdate = function(e) {
|
|
246
|
-
this.__v && (this.__e = !0, e && this.__h.push(e), D(this));
|
|
247
|
-
}, C.prototype.render = S, r = [], a = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, o = function(e, t) {
|
|
248
|
-
return e.__v.__b - t.__v.__b;
|
|
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
|
-
//#endregion
|
|
251
|
-
//#region node_modules/preact/hooks/dist/hooks.module.js
|
|
252
|
-
var z, B, V, oe, H = 0, se = [], U = t, ce = U.__b, le = U.__r, ue = U.diffed, de = U.__c, fe = U.unmount, pe = U.__;
|
|
253
|
-
function me(e, t) {
|
|
254
|
-
U.__h && U.__h(B, e, H || t), H = 0;
|
|
255
|
-
var n = B.__H || (B.__H = {
|
|
256
|
-
__: [],
|
|
257
|
-
__h: []
|
|
258
|
-
});
|
|
259
|
-
return e >= n.__.length && n.__.push({}), n.__[e];
|
|
260
|
-
}
|
|
261
|
-
function W(e) {
|
|
262
|
-
return H = 1, he(we, e);
|
|
263
|
-
}
|
|
264
|
-
function he(e, t, n) {
|
|
265
|
-
var r = me(z++, 2);
|
|
266
|
-
if (r.t = e, !r.__c && (r.__ = [n ? n(t) : we(void 0, t), function(e) {
|
|
267
|
-
var t = r.__N ? r.__N[0] : r.__[0], n = r.t(t, e);
|
|
268
|
-
t !== n && (r.__N = [n, r.__[1]], r.__c.setState({}));
|
|
269
|
-
}], r.__c = B, !B.__f)) {
|
|
270
|
-
var i = function(e, t, n) {
|
|
271
|
-
if (!r.__c.__H) return !0;
|
|
272
|
-
var i = !1, o = r.__c.props !== e;
|
|
273
|
-
if (r.__c.__H.__.some(function(e) {
|
|
274
|
-
if (e.__N) {
|
|
275
|
-
i = !0;
|
|
276
|
-
var t = e.__[0];
|
|
277
|
-
e.__ = e.__N, e.__N = void 0, t !== e.__[0] && (o = !0);
|
|
278
|
-
}
|
|
279
|
-
}), a) {
|
|
280
|
-
var s = a.call(this, e, t, n);
|
|
281
|
-
return i ? s || o : s;
|
|
282
|
-
}
|
|
283
|
-
return !i || o;
|
|
284
|
-
};
|
|
285
|
-
B.__f = !0;
|
|
286
|
-
var a = B.shouldComponentUpdate, o = B.componentWillUpdate;
|
|
287
|
-
B.componentWillUpdate = function(e, t, n) {
|
|
288
|
-
if (this.__e) {
|
|
289
|
-
var r = a;
|
|
290
|
-
a = void 0, i(e, t, n), a = r;
|
|
291
|
-
}
|
|
292
|
-
o && o.call(this, e, t, n);
|
|
293
|
-
}, B.shouldComponentUpdate = i;
|
|
294
|
-
}
|
|
295
|
-
return r.__N || r.__;
|
|
296
|
-
}
|
|
297
|
-
function G(e, t) {
|
|
298
|
-
var n = me(z++, 3);
|
|
299
|
-
!U.__s && Ce(n.__H, t) && (n.__ = e, n.u = t, B.__H.__h.push(n));
|
|
300
|
-
}
|
|
301
|
-
function ge(e, t) {
|
|
302
|
-
var n = me(z++, 4);
|
|
303
|
-
!U.__s && Ce(n.__H, t) && (n.__ = e, n.u = t, B.__h.push(n));
|
|
304
|
-
}
|
|
305
|
-
function K(e) {
|
|
306
|
-
return H = 5, _e(function() {
|
|
307
|
-
return { current: e };
|
|
308
|
-
}, []);
|
|
309
|
-
}
|
|
310
|
-
function _e(e, t) {
|
|
311
|
-
var n = me(z++, 7);
|
|
312
|
-
return Ce(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
|
|
313
|
-
}
|
|
314
|
-
function q(e, t) {
|
|
315
|
-
return H = 8, _e(function() {
|
|
316
|
-
return e;
|
|
317
|
-
}, t);
|
|
318
|
-
}
|
|
319
|
-
function ve() {
|
|
320
|
-
for (var e; e = se.shift();) {
|
|
321
|
-
var t = e.__H;
|
|
322
|
-
if (e.__P && t) try {
|
|
323
|
-
t.__h.some(xe), t.__h.some(Se), t.__h = [];
|
|
324
|
-
} catch (n) {
|
|
325
|
-
t.__h = [], U.__e(n, e.__v);
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
U.__b = function(e) {
|
|
330
|
-
B = null, ce && ce(e);
|
|
331
|
-
}, U.__ = function(e, t) {
|
|
332
|
-
e && t.__k && t.__k.__m && (e.__m = t.__k.__m), pe && pe(e, t);
|
|
333
|
-
}, U.__r = function(e) {
|
|
334
|
-
le && le(e), z = 0;
|
|
335
|
-
var t = (B = e.__c).__H;
|
|
336
|
-
t && (V === B ? (t.__h = [], B.__h = [], t.__.some(function(e) {
|
|
337
|
-
e.__N && (e.__ = e.__N), e.u = e.__N = void 0;
|
|
338
|
-
})) : (t.__h.some(xe), t.__h.some(Se), t.__h = [], z = 0)), V = B;
|
|
339
|
-
}, U.diffed = function(e) {
|
|
340
|
-
ue && ue(e);
|
|
341
|
-
var t = e.__c;
|
|
342
|
-
t && t.__H && (t.__H.__h.length && (se.push(t) !== 1 && oe === U.requestAnimationFrame || ((oe = U.requestAnimationFrame) || be)(ve)), t.__H.__.some(function(e) {
|
|
343
|
-
e.u && (e.__H = e.u, e.u = void 0);
|
|
344
|
-
})), V = B = null;
|
|
345
|
-
}, U.__c = function(e, t) {
|
|
346
|
-
t.some(function(e) {
|
|
347
|
-
try {
|
|
348
|
-
e.__h.some(xe), e.__h = e.__h.filter(function(e) {
|
|
349
|
-
return !e.__ || Se(e);
|
|
350
|
-
});
|
|
351
|
-
} catch (n) {
|
|
352
|
-
t.some(function(e) {
|
|
353
|
-
e.__h && (e.__h = []);
|
|
354
|
-
}), t = [], U.__e(n, e.__v);
|
|
355
|
-
}
|
|
356
|
-
}), de && de(e, t);
|
|
357
|
-
}, U.unmount = function(e) {
|
|
358
|
-
fe && fe(e);
|
|
359
|
-
var t, n = e.__c;
|
|
360
|
-
n && n.__H && (n.__H.__.some(function(e) {
|
|
361
|
-
try {
|
|
362
|
-
xe(e);
|
|
363
|
-
} catch (e) {
|
|
364
|
-
t = e;
|
|
365
|
-
}
|
|
366
|
-
}), n.__H = void 0, t && U.__e(t, n.__v));
|
|
367
|
-
};
|
|
368
|
-
var ye = typeof requestAnimationFrame == "function";
|
|
369
|
-
function be(e) {
|
|
370
|
-
var t, n = function() {
|
|
371
|
-
clearTimeout(r), ye && cancelAnimationFrame(t), setTimeout(e);
|
|
372
|
-
}, r = setTimeout(n, 35);
|
|
373
|
-
ye && (t = requestAnimationFrame(n));
|
|
374
|
-
}
|
|
375
|
-
function xe(e) {
|
|
376
|
-
var t = B, n = e.__c;
|
|
377
|
-
typeof n == "function" && (e.__c = void 0, n()), B = t;
|
|
378
|
-
}
|
|
379
|
-
function Se(e) {
|
|
380
|
-
var t = B;
|
|
381
|
-
e.__c = e.__(), B = t;
|
|
382
|
-
}
|
|
383
|
-
function Ce(e, t) {
|
|
384
|
-
return !e || e.length !== t.length || t.some(function(t, n) {
|
|
385
|
-
return t !== e[n];
|
|
386
|
-
});
|
|
387
|
-
}
|
|
388
|
-
function we(e, t) {
|
|
389
|
-
return typeof t == "function" ? t(e) : t;
|
|
390
|
-
}
|
|
391
|
-
//#endregion
|
|
392
|
-
//#region src/lib/context.ts
|
|
393
|
-
var Te = /* @__PURE__ */ new Set(["sessionId"]);
|
|
394
|
-
function Ee(e) {
|
|
395
|
-
if (typeof e == "string") return e.length > 0 ? { id: e } : void 0;
|
|
396
|
-
if (!e || typeof e != "object" || Array.isArray(e)) return;
|
|
397
|
-
let { id: t, name: n } = e;
|
|
398
|
-
if (typeof t == "string" && t.length !== 0) return typeof n == "string" && n.length > 0 ? {
|
|
399
|
-
id: t,
|
|
400
|
-
name: n
|
|
401
|
-
} : { id: t };
|
|
402
|
-
}
|
|
403
|
-
function De(e) {
|
|
404
|
-
let t = Ee(e);
|
|
405
|
-
if (t) return t.name ?? t.id;
|
|
406
|
-
}
|
|
407
|
-
function Oe(e) {
|
|
408
|
-
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
409
|
-
}
|
|
410
|
-
function ke(e) {
|
|
411
|
-
let t = {};
|
|
412
|
-
for (let [n, r] of Object.entries(e)) {
|
|
413
|
-
if (Te.has(n) || !Oe(r)) {
|
|
414
|
-
t[n] = r;
|
|
415
|
-
continue;
|
|
416
|
-
}
|
|
417
|
-
let e = Ee(r);
|
|
418
|
-
e && (t[`${n}Id`] = e.id, e.name && (t[`${n}Name`] = e.name));
|
|
419
|
-
}
|
|
420
|
-
return t;
|
|
421
|
-
}
|
|
422
|
-
//#endregion
|
|
423
|
-
//#region src/lib/i18n.ts
|
|
424
|
-
var Ae = "en", je = [
|
|
425
|
-
"en",
|
|
426
|
-
"fr",
|
|
427
|
-
"es"
|
|
428
|
-
], Me = {
|
|
429
|
-
en: {
|
|
430
|
-
heading: "Assistant",
|
|
431
|
-
subheading: "Squadico",
|
|
432
|
-
placeholder: "Ask your question…",
|
|
433
|
-
greeting: "Hello! I am your assistant. What would you like to do?",
|
|
434
|
-
hint: "The assistant proposes an action; nothing is applied without your confirmation.",
|
|
435
|
-
assistant: "Assistant",
|
|
436
|
-
typing: "The assistant is writing its answer",
|
|
437
|
-
newConversation: "New conversation",
|
|
438
|
-
close: "Close the assistant",
|
|
439
|
-
closeTitle: "Close",
|
|
440
|
-
history: {
|
|
441
|
-
open: "Conversation history",
|
|
442
|
-
menu: "Previous conversations",
|
|
443
|
-
loading: "Loading…",
|
|
444
|
-
empty: "No previous conversation.",
|
|
445
|
-
untitled: "Conversation"
|
|
446
|
-
},
|
|
447
|
-
context: { region: "Context sent to the assistant" },
|
|
448
|
-
approval: {
|
|
449
|
-
group: "Write confirmation",
|
|
450
|
-
approve: "Yes, apply",
|
|
451
|
-
reject: "No, cancel",
|
|
452
|
-
request: "The agent wants to use {tool}.",
|
|
453
|
-
arguments: "With",
|
|
454
|
-
edit: "Change…",
|
|
455
|
-
correction: "What to change — e.g. “the due date is next Monday”",
|
|
456
|
-
correctionLabel: "Correction to make before approving",
|
|
457
|
-
send: "Send"
|
|
458
|
-
},
|
|
459
|
-
confirm: {
|
|
460
|
-
group: "Confirmation",
|
|
461
|
-
yes: "Yes",
|
|
462
|
-
no: "No",
|
|
463
|
-
yesValue: "yes",
|
|
464
|
-
noValue: "no"
|
|
465
|
-
},
|
|
466
|
-
choices: "Suggested options",
|
|
467
|
-
poweredBy: "Powered by Squadico",
|
|
468
|
-
handles: {
|
|
469
|
-
picker: "Agents you can address",
|
|
470
|
-
unknown: "Nobody answers to that name here:",
|
|
471
|
-
instead: "You can address:",
|
|
472
|
-
rail: "Agents"
|
|
473
|
-
},
|
|
474
|
-
selection: {
|
|
475
|
-
group: "Suggested choice",
|
|
476
|
-
single: "Pick one option.",
|
|
477
|
-
multiple: "Pick one or more options, then validate.",
|
|
478
|
-
validate: "Validate"
|
|
479
|
-
},
|
|
480
|
-
composer: {
|
|
481
|
-
label: "Your message",
|
|
482
|
-
send: "Send the message",
|
|
483
|
-
sendTitle: "Send",
|
|
484
|
-
stop: "Stop the answer",
|
|
485
|
-
stopTitle: "Stop",
|
|
486
|
-
attach: "Attach a file",
|
|
487
|
-
attachTitle: "Attach",
|
|
488
|
-
remove: "Remove {name}"
|
|
489
|
-
},
|
|
490
|
-
attachments: {
|
|
491
|
-
unsupported: "This kind of file cannot be attached to a message.",
|
|
492
|
-
tooLarge: "This file is too large.",
|
|
493
|
-
tooMany: "This message already carries as many files as it may.",
|
|
494
|
-
unreadable: "This file could not be read.",
|
|
495
|
-
failed: "This file could not be attached."
|
|
496
|
-
},
|
|
497
|
-
error: "Something went wrong, the assistant could not answer. Try again in a moment.",
|
|
498
|
-
withHuman: "A member of the team will reply to you here."
|
|
499
|
-
},
|
|
500
|
-
fr: {
|
|
501
|
-
heading: "Assistant",
|
|
502
|
-
subheading: "Squadico",
|
|
503
|
-
placeholder: "Posez votre question…",
|
|
504
|
-
greeting: "Bonjour ! Je suis votre assistant. Que souhaitez-vous faire ?",
|
|
505
|
-
hint: "L'assistant propose une action ; rien n'est appliqué sans votre confirmation.",
|
|
506
|
-
assistant: "Assistant",
|
|
507
|
-
typing: "L'assistant rédige sa réponse",
|
|
508
|
-
newConversation: "Nouvelle conversation",
|
|
509
|
-
close: "Fermer l'assistant",
|
|
510
|
-
closeTitle: "Fermer",
|
|
511
|
-
history: {
|
|
512
|
-
open: "Historique des conversations",
|
|
513
|
-
menu: "Conversations précédentes",
|
|
514
|
-
loading: "Chargement…",
|
|
515
|
-
empty: "Aucune conversation précédente.",
|
|
516
|
-
untitled: "Conversation"
|
|
517
|
-
},
|
|
518
|
-
context: { region: "Contexte transmis à l'assistant" },
|
|
519
|
-
approval: {
|
|
520
|
-
group: "Validation de l'écriture",
|
|
521
|
-
approve: "Oui, appliquer",
|
|
522
|
-
reject: "Non, annuler",
|
|
523
|
-
request: "L'agent souhaite utiliser {tool}.",
|
|
524
|
-
arguments: "Avec",
|
|
525
|
-
edit: "Modifier…",
|
|
526
|
-
correction: "Ce qu'il faut changer — ex. « l'échéance est lundi prochain »",
|
|
527
|
-
correctionLabel: "Correction à apporter avant validation",
|
|
528
|
-
send: "Envoyer"
|
|
529
|
-
},
|
|
530
|
-
confirm: {
|
|
531
|
-
group: "Confirmation",
|
|
532
|
-
yes: "Oui",
|
|
533
|
-
no: "Non",
|
|
534
|
-
yesValue: "oui",
|
|
535
|
-
noValue: "non"
|
|
536
|
-
},
|
|
537
|
-
choices: "Options proposées",
|
|
538
|
-
poweredBy: "Propulsé par Squadico",
|
|
539
|
-
handles: {
|
|
540
|
-
picker: "Agents que vous pouvez adresser",
|
|
541
|
-
unknown: "Personne ne répond à ce nom ici :",
|
|
542
|
-
instead: "Vous pouvez adresser :",
|
|
543
|
-
rail: "Agents"
|
|
544
|
-
},
|
|
545
|
-
selection: {
|
|
546
|
-
group: "Choix proposé",
|
|
547
|
-
single: "Sélectionnez une option.",
|
|
548
|
-
multiple: "Sélectionnez une ou plusieurs options, puis validez.",
|
|
549
|
-
validate: "Valider"
|
|
550
|
-
},
|
|
551
|
-
composer: {
|
|
552
|
-
label: "Votre message",
|
|
553
|
-
send: "Envoyer le message",
|
|
554
|
-
sendTitle: "Envoyer",
|
|
555
|
-
stop: "Interrompre la réponse",
|
|
556
|
-
stopTitle: "Interrompre",
|
|
557
|
-
attach: "Joindre un fichier",
|
|
558
|
-
attachTitle: "Joindre",
|
|
559
|
-
remove: "Retirer {name}"
|
|
560
|
-
},
|
|
561
|
-
attachments: {
|
|
562
|
-
unsupported: "Ce format de fichier ne peut pas être joint à un message.",
|
|
563
|
-
tooLarge: "Ce fichier est trop volumineux.",
|
|
564
|
-
tooMany: "Ce message porte déjà autant de fichiers qu'il le peut.",
|
|
565
|
-
unreadable: "Ce fichier n'a pas pu être lu.",
|
|
566
|
-
failed: "Impossible de joindre ce fichier."
|
|
567
|
-
},
|
|
568
|
-
error: "Une erreur est survenue, l'assistant n'a pas pu répondre. Réessayez dans un instant.",
|
|
569
|
-
withHuman: "Un membre de l'équipe va vous répondre ici."
|
|
570
|
-
},
|
|
571
|
-
es: {
|
|
572
|
-
heading: "Asistente",
|
|
573
|
-
subheading: "Squadico",
|
|
574
|
-
placeholder: "Haga su pregunta…",
|
|
575
|
-
greeting: "¡Hola! Soy su asistente. ¿Qué desea hacer?",
|
|
576
|
-
hint: "El asistente propone una acción; no se aplica nada sin su confirmación.",
|
|
577
|
-
assistant: "Asistente",
|
|
578
|
-
typing: "El asistente está redactando su respuesta",
|
|
579
|
-
newConversation: "Nueva conversación",
|
|
580
|
-
close: "Cerrar el asistente",
|
|
581
|
-
closeTitle: "Cerrar",
|
|
582
|
-
history: {
|
|
583
|
-
open: "Historial de conversaciones",
|
|
584
|
-
menu: "Conversaciones anteriores",
|
|
585
|
-
loading: "Cargando…",
|
|
586
|
-
empty: "Ninguna conversación anterior.",
|
|
587
|
-
untitled: "Conversación"
|
|
588
|
-
},
|
|
589
|
-
context: { region: "Contexto enviado al asistente" },
|
|
590
|
-
approval: {
|
|
591
|
-
group: "Validación de la escritura",
|
|
592
|
-
approve: "Sí, aplicar",
|
|
593
|
-
reject: "No, cancelar",
|
|
594
|
-
request: "El agente quiere usar {tool}.",
|
|
595
|
-
arguments: "Con",
|
|
596
|
-
edit: "Modificar…",
|
|
597
|
-
correction: "Lo que hay que cambiar — p. ej. «el vencimiento es el lunes»",
|
|
598
|
-
correctionLabel: "Corrección antes de validar",
|
|
599
|
-
send: "Enviar"
|
|
600
|
-
},
|
|
601
|
-
confirm: {
|
|
602
|
-
group: "Confirmación",
|
|
603
|
-
yes: "Sí",
|
|
604
|
-
no: "No",
|
|
605
|
-
yesValue: "sí",
|
|
606
|
-
noValue: "no"
|
|
607
|
-
},
|
|
608
|
-
choices: "Opciones propuestas",
|
|
609
|
-
poweredBy: "Con la tecnología de Squadico",
|
|
610
|
-
handles: {
|
|
611
|
-
picker: "Agentes a los que puedes dirigirte",
|
|
612
|
-
unknown: "Nadie responde a ese nombre aquí:",
|
|
613
|
-
instead: "Puedes dirigirte a:",
|
|
614
|
-
rail: "Agentes"
|
|
615
|
-
},
|
|
616
|
-
selection: {
|
|
617
|
-
group: "Opción propuesta",
|
|
618
|
-
single: "Seleccione una opción.",
|
|
619
|
-
multiple: "Seleccione una o varias opciones y valide.",
|
|
620
|
-
validate: "Validar"
|
|
621
|
-
},
|
|
622
|
-
composer: {
|
|
623
|
-
label: "Su mensaje",
|
|
624
|
-
send: "Enviar el mensaje",
|
|
625
|
-
sendTitle: "Enviar",
|
|
626
|
-
stop: "Interrumpir la respuesta",
|
|
627
|
-
stopTitle: "Interrumpir",
|
|
628
|
-
attach: "Adjuntar un archivo",
|
|
629
|
-
attachTitle: "Adjuntar",
|
|
630
|
-
remove: "Quitar {name}"
|
|
631
|
-
},
|
|
632
|
-
attachments: {
|
|
633
|
-
unsupported: "Este tipo de archivo no se puede adjuntar a un mensaje.",
|
|
634
|
-
tooLarge: "Este archivo es demasiado grande.",
|
|
635
|
-
tooMany: "Este mensaje ya lleva todos los archivos que puede llevar.",
|
|
636
|
-
unreadable: "No se ha podido leer este archivo.",
|
|
637
|
-
failed: "No se ha podido adjuntar este archivo."
|
|
638
|
-
},
|
|
639
|
-
error: "Se ha producido un error, el asistente no ha podido responder. Inténtelo de nuevo.",
|
|
640
|
-
withHuman: "Un miembro del equipo le responderá aquí."
|
|
641
|
-
}
|
|
642
|
-
}, Ne = {
|
|
643
|
-
en: "en-GB",
|
|
644
|
-
fr: "fr-FR",
|
|
645
|
-
es: "es-ES"
|
|
646
|
-
};
|
|
647
|
-
function Pe(e) {
|
|
648
|
-
let t = e?.trim().toLowerCase().split(/[-_]/)[0];
|
|
649
|
-
return t && t in Me ? t : void 0;
|
|
650
|
-
}
|
|
651
|
-
function Fe() {
|
|
652
|
-
return typeof navigator > "u" ? [] : navigator.languages?.length ? navigator.languages : [navigator.language];
|
|
653
|
-
}
|
|
654
|
-
function Ie(e) {
|
|
655
|
-
let t = e?.trim(), n = (t ? [t] : Fe()).find(Pe), r = Pe(n) ?? "en";
|
|
656
|
-
return {
|
|
657
|
-
code: r,
|
|
658
|
-
tag: n?.includes("-") ? n : Ne[r],
|
|
659
|
-
t: Me[r]
|
|
660
|
-
};
|
|
661
|
-
}
|
|
662
|
-
//#endregion
|
|
663
|
-
//#region src/lib/openState.ts
|
|
664
|
-
var Le = "squadico-chatbot:open";
|
|
665
|
-
function Re() {
|
|
666
|
-
try {
|
|
667
|
-
if (typeof sessionStorage > "u") return;
|
|
668
|
-
let e = sessionStorage.getItem(Le);
|
|
669
|
-
return e === "1" || e !== "0" && void 0;
|
|
670
|
-
} catch {
|
|
671
|
-
return;
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
function ze(e) {
|
|
675
|
-
try {
|
|
676
|
-
if (typeof sessionStorage > "u") return;
|
|
677
|
-
sessionStorage.setItem(Le, e ? "1" : "0");
|
|
678
|
-
} catch {}
|
|
679
|
-
}
|
|
680
|
-
function Be(e, t) {
|
|
681
|
-
return t === !1 ? e ?? !1 : Re() ?? e ?? !1;
|
|
682
|
-
}
|
|
683
|
-
//#endregion
|
|
684
|
-
//#region src/lib/rail.ts
|
|
685
|
-
function Ve(e, t) {
|
|
686
|
-
for (let t = e.length - 1; t >= 0; --t) {
|
|
687
|
-
let n = e[t];
|
|
688
|
-
if (n.role === "assistant" && n.agent) return n.agent.handle;
|
|
689
|
-
}
|
|
690
|
-
return t;
|
|
691
|
-
}
|
|
692
|
-
function He(e, t, n) {
|
|
693
|
-
return !t || t === n || e.trimStart().startsWith("@") ? e : `@${t} ${e}`;
|
|
694
|
-
}
|
|
695
|
-
//#endregion
|
|
696
|
-
//#region src/lib/uid.ts
|
|
697
|
-
function Ue() {
|
|
698
|
-
let e = globalThis.crypto;
|
|
699
|
-
if (e && typeof e.randomUUID == "function") return e.randomUUID();
|
|
700
|
-
let t = /* @__PURE__ */ new Uint8Array(16);
|
|
701
|
-
if (e && typeof e.getRandomValues == "function") e.getRandomValues(t);
|
|
702
|
-
else for (let e = 0; e < 16; e++) t[e] = Math.floor(Math.random() * 256);
|
|
703
|
-
t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128;
|
|
704
|
-
let n = [];
|
|
705
|
-
for (let e = 0; e < 16; e++) n.push(t[e].toString(16).padStart(2, "0"));
|
|
706
|
-
return n.slice(0, 4).join("") + "-" + n.slice(4, 6).join("") + "-" + n.slice(6, 8).join("") + "-" + n.slice(8, 10).join("") + "-" + n.slice(10, 16).join("");
|
|
707
|
-
}
|
|
708
|
-
//#endregion
|
|
709
|
-
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/typeof.js
|
|
710
|
-
function We(e) {
|
|
711
|
-
"@babel/helpers - typeof";
|
|
712
|
-
return We = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
713
|
-
return typeof e;
|
|
714
|
-
} : function(e) {
|
|
715
|
-
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
716
|
-
}, We(e);
|
|
717
|
-
}
|
|
718
|
-
//#endregion
|
|
719
|
-
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/toPrimitive.js
|
|
720
|
-
function Ge(e, t) {
|
|
721
|
-
if (We(e) != "object" || !e) return e;
|
|
722
|
-
var n = e[Symbol.toPrimitive];
|
|
723
|
-
if (n !== void 0) {
|
|
724
|
-
var r = n.call(e, t || "default");
|
|
725
|
-
if (We(r) != "object") return r;
|
|
726
|
-
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
727
|
-
}
|
|
728
|
-
return (t === "string" ? String : Number)(e);
|
|
729
|
-
}
|
|
730
|
-
//#endregion
|
|
731
|
-
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/toPropertyKey.js
|
|
732
|
-
function Ke(e) {
|
|
733
|
-
var t = Ge(e, "string");
|
|
734
|
-
return We(t) == "symbol" ? t : t + "";
|
|
735
|
-
}
|
|
736
|
-
//#endregion
|
|
737
|
-
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/defineProperty.js
|
|
738
|
-
function qe(e, t, n) {
|
|
739
|
-
return (t = Ke(t)) in e ? Object.defineProperty(e, t, {
|
|
740
|
-
value: n,
|
|
741
|
-
enumerable: !0,
|
|
742
|
-
configurable: !0,
|
|
743
|
-
writable: !0
|
|
744
|
-
}) : e[t] = n, e;
|
|
745
|
-
}
|
|
746
|
-
//#endregion
|
|
747
|
-
//#region src/lib/client.ts
|
|
748
|
-
var Je = "https://api.squadico.com", Ye = 2e4, J = class extends Error {
|
|
749
|
-
constructor(e, t, n) {
|
|
750
|
-
super(e), qe(this, "status", void 0), qe(this, "code", void 0), this.name = "ChatHttpError", this.status = t, this.code = n;
|
|
751
|
-
}
|
|
752
|
-
};
|
|
753
|
-
function Xe(e, t) {
|
|
754
|
-
return `${e.replace(/\/+$/, "")}${t}`;
|
|
755
|
-
}
|
|
756
|
-
function Ze(e, t) {
|
|
757
|
-
return {
|
|
758
|
-
"Content-Type": "application/json",
|
|
759
|
-
Accept: "text/event-stream, application/json",
|
|
760
|
-
...e ? { "X-Visitor-Token": e } : {},
|
|
761
|
-
...t ? { "X-Subject-Token": t } : {}
|
|
762
|
-
};
|
|
763
|
-
}
|
|
764
|
-
function Qe(e) {
|
|
765
|
-
if (!e || typeof e != "object") return;
|
|
766
|
-
let { loc: t, msg: n } = e;
|
|
767
|
-
if (typeof n != "string" || !n) return;
|
|
768
|
-
let r = (Array.isArray(t) ? t.filter((e) => typeof e == "string") : []).at(-1);
|
|
769
|
-
return r && r !== "body" ? `${r}: ${n}` : n;
|
|
770
|
-
}
|
|
771
|
-
async function $e(e) {
|
|
772
|
-
let t = "", n;
|
|
773
|
-
try {
|
|
774
|
-
let r = await e.text();
|
|
775
|
-
if (r) try {
|
|
776
|
-
let e = JSON.parse(r), i = e.detail ?? e.message;
|
|
777
|
-
if (Array.isArray(i)) {
|
|
778
|
-
let e = i.map((e) => Qe(e) ?? (typeof e == "string" ? e : void 0)).filter((e) => e !== void 0);
|
|
779
|
-
t = e.length > 0 ? e.join(", ") : r;
|
|
780
|
-
} else t = typeof i == "string" ? i : r;
|
|
781
|
-
n = typeof e.code == "string" ? e.code : void 0;
|
|
782
|
-
} catch {
|
|
783
|
-
t = r;
|
|
784
|
-
}
|
|
785
|
-
} catch {}
|
|
786
|
-
return new J(t || `The API answered ${e.status}`, e.status, n);
|
|
787
|
-
}
|
|
788
|
-
function et(e, t) {
|
|
789
|
-
if (!e || typeof e != "object") return;
|
|
790
|
-
let n = e;
|
|
791
|
-
if (!(typeof n.handle != "string" || !n.handle)) return {
|
|
792
|
-
handle: n.handle,
|
|
793
|
-
name: typeof n.name == "string" ? n.name : n.handle,
|
|
794
|
-
avatarUrl: typeof n.avatar_url == "string" && n.avatar_url ? Xe(t, n.avatar_url) : void 0,
|
|
795
|
-
color: typeof n.color == "string" ? n.color : void 0
|
|
796
|
-
};
|
|
797
|
-
}
|
|
798
|
-
function tt(e, t) {
|
|
799
|
-
return (Array.isArray(e) ? e : []).map((e) => et(e, t)).filter((e) => e !== void 0);
|
|
800
|
-
}
|
|
801
|
-
function nt(e) {
|
|
802
|
-
if (!e || typeof e != "object") return;
|
|
803
|
-
let t = e;
|
|
804
|
-
if (!(typeof t.tool_call_id != "string" || !t.tool_call_id)) return {
|
|
805
|
-
toolCallId: t.tool_call_id,
|
|
806
|
-
tool: typeof t.tool == "string" ? t.tool : "",
|
|
807
|
-
arguments: t.arguments && typeof t.arguments == "object" ? t.arguments : {}
|
|
808
|
-
};
|
|
809
|
-
}
|
|
810
|
-
var rt = /* @__PURE__ */ new Set(["user", "assistant"]);
|
|
811
|
-
function it(e, t) {
|
|
812
|
-
if (typeof e.role != "string" || !rt.has(e.role) || typeof e.content != "string" || !e.content) return null;
|
|
813
|
-
let n = typeof e.created_at == "string" ? Date.parse(e.created_at) : NaN;
|
|
814
|
-
return {
|
|
815
|
-
id: typeof e.id == "string" && e.id ? e.id : Ue(),
|
|
816
|
-
role: e.role,
|
|
817
|
-
content: e.content,
|
|
818
|
-
createdAt: Number.isNaN(n) ? Date.now() : n,
|
|
819
|
-
agent: et(e.agent, t),
|
|
820
|
-
attachments: at(e.attachments),
|
|
821
|
-
authorName: e.kind === "human" && typeof e.author_name == "string" && e.author_name ? e.author_name : void 0
|
|
822
|
-
};
|
|
823
|
-
}
|
|
824
|
-
function at(e) {
|
|
825
|
-
if (!Array.isArray(e)) return;
|
|
826
|
-
let t = e.map((e) => ot(e)).filter((e) => e !== null);
|
|
827
|
-
return t.length > 0 ? t : void 0;
|
|
828
|
-
}
|
|
829
|
-
function ot(e) {
|
|
830
|
-
if (!e || typeof e != "object") return null;
|
|
831
|
-
let { id: t, kind: n, filename: r, content_type: i } = e;
|
|
832
|
-
return typeof t != "string" || !t || typeof r != "string" || !r ? null : {
|
|
833
|
-
id: t,
|
|
834
|
-
kind: n === "image" ? "image" : "document",
|
|
835
|
-
filename: r,
|
|
836
|
-
contentType: typeof i == "string" ? i : "application/octet-stream"
|
|
837
|
-
};
|
|
838
|
-
}
|
|
839
|
-
async function st(e) {
|
|
840
|
-
let t = e.agent ? `?agent=${encodeURIComponent(e.agent)}` : "", n = await fetch(Xe(e.apiUrl, `/public/applications/${encodeURIComponent(e.embedKey)}${t}`), {
|
|
841
|
-
method: "GET",
|
|
842
|
-
headers: Ze(),
|
|
843
|
-
signal: e.signal
|
|
844
|
-
});
|
|
845
|
-
if (!n.ok) throw await $e(n);
|
|
846
|
-
let r = await n.json();
|
|
847
|
-
return {
|
|
848
|
-
welcomeMessage: typeof r.welcome_message == "string" && r.welcome_message ? r.welcome_message : void 0,
|
|
849
|
-
agent: et(r.agent, e.apiUrl),
|
|
850
|
-
handles: tt(r.handles, e.apiUrl),
|
|
851
|
-
agentHandle: typeof r.agent_handle == "string" && r.agent_handle ? r.agent_handle : void 0,
|
|
852
|
-
branding: r.branding === !0
|
|
853
|
-
};
|
|
854
|
-
}
|
|
855
|
-
async function ct(e) {
|
|
856
|
-
let t = await fetch(Xe(e.apiUrl, `/public/applications/${encodeURIComponent(e.embedKey)}/conversations`), {
|
|
857
|
-
method: "POST",
|
|
858
|
-
headers: Ze(),
|
|
859
|
-
body: JSON.stringify({
|
|
860
|
-
...e.user ? { user: e.user } : {},
|
|
861
|
-
...e.agent ? { agent: e.agent } : {}
|
|
862
|
-
}),
|
|
863
|
-
signal: e.signal
|
|
864
|
-
});
|
|
865
|
-
if (!t.ok) throw await $e(t);
|
|
866
|
-
let n = await t.json();
|
|
867
|
-
if (typeof n.id != "string" || typeof n.visitor_token != "string") throw new J("The API opened a conversation without an id or a token");
|
|
868
|
-
let r = (Array.isArray(n.messages) ? n.messages : []).map((t) => it(t, e.apiUrl)).filter((e) => e !== null);
|
|
869
|
-
return {
|
|
870
|
-
conversationId: n.id,
|
|
871
|
-
visitorToken: n.visitor_token,
|
|
872
|
-
agentName: typeof n.agent_name == "string" ? n.agent_name : "",
|
|
873
|
-
agentSlug: typeof n.agent_slug == "string" ? n.agent_slug : "",
|
|
874
|
-
welcomeMessage: typeof n.welcome_message == "string" && n.welcome_message ? n.welcome_message : void 0,
|
|
875
|
-
messages: r,
|
|
876
|
-
handles: tt(n.handles, e.apiUrl),
|
|
877
|
-
agentHandle: typeof n.agent_handle == "string" && n.agent_handle ? n.agent_handle : void 0,
|
|
878
|
-
withHuman: typeof n.handling == "string" && n.handling !== "agents",
|
|
879
|
-
branding: n.branding === !0
|
|
880
|
-
};
|
|
881
|
-
}
|
|
882
|
-
async function lt(e) {
|
|
883
|
-
let t = await fetch(Xe(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}`), {
|
|
884
|
-
method: "GET",
|
|
885
|
-
headers: Ze(e.visitorToken),
|
|
886
|
-
signal: e.signal
|
|
887
|
-
});
|
|
888
|
-
if (!t.ok) throw await $e(t);
|
|
889
|
-
let n = await t.json();
|
|
890
|
-
if (typeof n.id != "string") throw new J("The API replayed a conversation without an id");
|
|
891
|
-
return {
|
|
892
|
-
conversationId: n.id,
|
|
893
|
-
visitorToken: e.visitorToken,
|
|
894
|
-
agentName: typeof n.agent_name == "string" ? n.agent_name : "",
|
|
895
|
-
agentSlug: typeof n.agent_slug == "string" ? n.agent_slug : "",
|
|
896
|
-
welcomeMessage: typeof n.welcome_message == "string" && n.welcome_message ? n.welcome_message : void 0,
|
|
897
|
-
messages: (Array.isArray(n.messages) ? n.messages : []).map((t) => it(t, e.apiUrl)).filter((e) => e !== null),
|
|
898
|
-
handles: tt(n.handles, e.apiUrl),
|
|
899
|
-
agentHandle: typeof n.agent_handle == "string" && n.agent_handle ? n.agent_handle : void 0,
|
|
900
|
-
withHuman: typeof n.handling == "string" && n.handling !== "agents",
|
|
901
|
-
branding: n.branding === !0
|
|
902
|
-
};
|
|
903
|
-
}
|
|
904
|
-
async function ut(e) {
|
|
905
|
-
let t = new FormData();
|
|
906
|
-
t.append("file", e.file);
|
|
907
|
-
let n = await fetch(pt(e), {
|
|
908
|
-
method: "POST",
|
|
909
|
-
headers: { "X-Visitor-Token": e.visitorToken },
|
|
910
|
-
body: t,
|
|
911
|
-
signal: e.signal
|
|
912
|
-
});
|
|
913
|
-
if (!n.ok) throw await $e(n);
|
|
914
|
-
let r = ot(await n.json());
|
|
915
|
-
if (!r) throw new J("The upload could not be read", n.status);
|
|
916
|
-
return r;
|
|
917
|
-
}
|
|
918
|
-
async function dt(e) {
|
|
919
|
-
let t = await fetch(`${pt(e)}/${encodeURIComponent(e.attachmentId)}`, {
|
|
920
|
-
method: "DELETE",
|
|
921
|
-
headers: { "X-Visitor-Token": e.visitorToken },
|
|
922
|
-
signal: e.signal
|
|
923
|
-
});
|
|
924
|
-
if (!t.ok) throw await $e(t);
|
|
925
|
-
}
|
|
926
|
-
async function ft(e) {
|
|
927
|
-
let t = await fetch(`${pt(e)}/${encodeURIComponent(e.attachmentId)}/content`, {
|
|
928
|
-
headers: { "X-Visitor-Token": e.visitorToken },
|
|
929
|
-
signal: e.signal
|
|
930
|
-
});
|
|
931
|
-
if (!t.ok) throw await $e(t);
|
|
932
|
-
return t.blob();
|
|
933
|
-
}
|
|
934
|
-
function pt(e) {
|
|
935
|
-
return Xe(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/attachments`);
|
|
936
|
-
}
|
|
937
|
-
async function mt(e) {
|
|
938
|
-
return gt(Xe(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/messages`), {
|
|
939
|
-
content: e.message,
|
|
940
|
-
attachment_ids: e.attachmentIds ?? [],
|
|
941
|
-
...e.context && Object.keys(e.context).length > 0 ? { context: e.context } : {}
|
|
942
|
-
}, e);
|
|
943
|
-
}
|
|
944
|
-
async function ht(e) {
|
|
945
|
-
return gt(Xe(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/approvals`), {
|
|
946
|
-
tool_call_id: e.toolCallId,
|
|
947
|
-
approved: e.approved
|
|
948
|
-
}, e);
|
|
949
|
-
}
|
|
950
|
-
async function gt(e, t, n) {
|
|
951
|
-
let r = await fetch(e, {
|
|
952
|
-
method: "POST",
|
|
953
|
-
headers: Ze(n.visitorToken, n.subjectToken),
|
|
954
|
-
body: JSON.stringify(t),
|
|
955
|
-
signal: n.signal
|
|
956
|
-
});
|
|
957
|
-
if (!r.ok) throw await $e(r);
|
|
958
|
-
if (!r.body) throw new J("Answer with no stream body");
|
|
959
|
-
let i = r.body.getReader(), a = new TextDecoder(), o = "", s = "", c = "", l, u, d = { answer: "" };
|
|
960
|
-
try {
|
|
961
|
-
for (;;) {
|
|
962
|
-
let { value: e, done: t } = await i.read();
|
|
963
|
-
if (t) break;
|
|
964
|
-
o += a.decode(e, { stream: !0 });
|
|
965
|
-
let r = o.split("\n");
|
|
966
|
-
o = r.pop() ?? "";
|
|
967
|
-
for (let e of r) {
|
|
968
|
-
let t = e.trim();
|
|
969
|
-
if (!t) {
|
|
970
|
-
s = "";
|
|
971
|
-
continue;
|
|
972
|
-
}
|
|
973
|
-
if (t.startsWith("event:")) {
|
|
974
|
-
s = t.slice(6).trim();
|
|
975
|
-
continue;
|
|
976
|
-
}
|
|
977
|
-
if (!t.startsWith("data:")) continue;
|
|
978
|
-
let r = t.slice(5).trim();
|
|
979
|
-
if (!r) continue;
|
|
980
|
-
let i;
|
|
981
|
-
try {
|
|
982
|
-
i = JSON.parse(r);
|
|
983
|
-
} catch {
|
|
984
|
-
continue;
|
|
985
|
-
}
|
|
986
|
-
s === "token" && typeof i.text == "string" ? (c += i.text, n.onToken(i.text)) : s === "done" ? (d.answer = typeof i.content == "string" ? i.content : c, d.agent = et(i.agent, n.apiUrl), typeof i.unknown_handle == "string" && i.unknown_handle && (d.unknownHandle = i.unknown_handle, d.offered = tt(i.handles, n.apiUrl))) : s === "handoff" ? (typeof i.to_agent_name == "string" && (u = i.to_agent_name), c = "") : s === "escalated" ? d.withHuman = !0 : s === "held" ? (d.held = !0, d.withHuman = !0) : s === "approval_required" ? d.approval = nt(i) : s === "error" && (l = typeof i.detail == "string" ? i.detail : "The turn failed");
|
|
987
|
-
}
|
|
988
|
-
if (l) break;
|
|
989
|
-
}
|
|
990
|
-
} finally {
|
|
991
|
-
i.cancel().catch(() => void 0);
|
|
992
|
-
}
|
|
993
|
-
if (l) throw new J(l);
|
|
994
|
-
return !d.answer && !d.approval && (d.answer = c), u && !d.agent && (d.authorName = u), d;
|
|
995
|
-
}
|
|
996
|
-
//#endregion
|
|
997
|
-
//#region src/lib/conversation.ts
|
|
998
|
-
var _t = "squadico-chatbot:conversation";
|
|
999
|
-
function vt() {
|
|
1000
|
-
try {
|
|
1001
|
-
if (typeof sessionStorage > "u") return;
|
|
1002
|
-
let e = sessionStorage.getItem(_t);
|
|
1003
|
-
if (!e) return;
|
|
1004
|
-
let t = JSON.parse(e);
|
|
1005
|
-
return !t.sessionId || !t.visitorToken || !t.embedKey ? void 0 : {
|
|
1006
|
-
sessionId: t.sessionId,
|
|
1007
|
-
visitorToken: t.visitorToken,
|
|
1008
|
-
embedKey: t.embedKey,
|
|
1009
|
-
user: typeof t.user == "string" ? t.user : void 0
|
|
1010
|
-
};
|
|
1011
|
-
} catch {
|
|
1012
|
-
return;
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
function yt(e) {
|
|
1016
|
-
try {
|
|
1017
|
-
if (typeof sessionStorage > "u") return;
|
|
1018
|
-
sessionStorage.setItem(_t, JSON.stringify(e));
|
|
1019
|
-
} catch {}
|
|
1020
|
-
}
|
|
1021
|
-
function bt() {
|
|
1022
|
-
try {
|
|
1023
|
-
if (typeof sessionStorage > "u") return;
|
|
1024
|
-
sessionStorage.removeItem(_t);
|
|
1025
|
-
} catch {}
|
|
1026
|
-
}
|
|
1027
|
-
function xt(e, { embedKey: t, user: n }) {
|
|
1028
|
-
return e.embedKey === t && e.user === n;
|
|
1029
|
-
}
|
|
1030
|
-
//#endregion
|
|
1031
|
-
//#region src/lib/useChat.ts
|
|
1032
|
-
async function St(e) {
|
|
1033
|
-
if (e) try {
|
|
1034
|
-
return await e() || void 0;
|
|
1035
|
-
} catch {
|
|
1036
|
-
return;
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
var Ct = "preview-welcome";
|
|
1040
|
-
function wt(e) {
|
|
1041
|
-
let t = e instanceof J ? e.status : void 0;
|
|
1042
|
-
return t === 415 ? "unsupported" : t === 413 ? "tooLarge" : t === 409 ? "tooMany" : t === 422 ? "unreadable" : "failed";
|
|
1043
|
-
}
|
|
1044
|
-
var Tt = 5e3;
|
|
1045
|
-
function Et(e) {
|
|
1046
|
-
return e instanceof J && e.code === "conversation_retired";
|
|
1047
|
-
}
|
|
1048
|
-
function Dt(e) {
|
|
1049
|
-
let [t, n] = W([]), [r, i] = W(!1), [a, o] = W(""), [s, c] = W([]), [l, u] = W(""), [d, f] = W(""), [p, m] = W(null), [h, g] = W(!1), [_, v] = W(!1), [y, b] = W([]), [x, S] = W([]), [C, w] = W(null), T = K(null), E = K(e);
|
|
1050
|
-
E.current = e;
|
|
1051
|
-
let D = K(null), O = K(null), k = K(null), A = K(null), j = K(void 0), M = e.greeting, N = _e(() => M ? {
|
|
1052
|
-
id: "greeting",
|
|
1053
|
-
role: "assistant",
|
|
1054
|
-
content: M,
|
|
1055
|
-
createdAt: Date.now()
|
|
1056
|
-
} : null, [M]), P = q((e) => {
|
|
1057
|
-
E.current.onEvent?.(e);
|
|
1058
|
-
}, []), F = q((e, t) => {
|
|
1059
|
-
n((n) => n.map((n) => n.id === e ? {
|
|
1060
|
-
...n,
|
|
1061
|
-
...t
|
|
1062
|
-
} : n));
|
|
1063
|
-
}, []), I = q((e, t) => {
|
|
1064
|
-
let n = e instanceof J ? e.status : void 0, r = e instanceof Error ? e.message : String(e), i = (E.current.locale ?? Ie(void 0)).t.error;
|
|
1065
|
-
t && F(t, {
|
|
1066
|
-
content: i,
|
|
1067
|
-
streaming: !1,
|
|
1068
|
-
error: !0
|
|
1069
|
-
}), P({
|
|
1070
|
-
type: "chatbot-error",
|
|
1071
|
-
message: r,
|
|
1072
|
-
status: n,
|
|
1073
|
-
sessionId: O.current?.sessionId ?? ""
|
|
1074
|
-
}), typeof console < "u" && console.error("[squadico-chatbot]", r);
|
|
1075
|
-
}, [P, F]), ee = q(() => {
|
|
1076
|
-
let e = E.current;
|
|
1077
|
-
if (!e.embedKey) throw new J("No embed key: nothing says which application to open");
|
|
1078
|
-
return {
|
|
1079
|
-
opts: e,
|
|
1080
|
-
apiUrl: e.apiUrl ?? "https://api.squadico.com",
|
|
1081
|
-
embedKey: e.embedKey,
|
|
1082
|
-
claim: e.user
|
|
1083
|
-
};
|
|
1084
|
-
}, []), L = q((e, t) => {
|
|
1085
|
-
let r = {
|
|
1086
|
-
sessionId: t.conversationId,
|
|
1087
|
-
visitorToken: t.visitorToken
|
|
1088
|
-
};
|
|
1089
|
-
return O.current = r, j.current = e.claim?.id, yt({
|
|
1090
|
-
...r,
|
|
1091
|
-
embedKey: e.embedKey,
|
|
1092
|
-
user: e.claim?.id
|
|
1093
|
-
}), o(t.conversationId), c(t.handles), u(e.opts.agent && t.agentHandle ? t.agentHandle : ""), f(t.agentHandle ?? ""), g(!!t.withHuman), v(t.branding), n((e) => [...t.messages, ...e.filter((e) => e.id !== Ct)]), r;
|
|
1094
|
-
}, []), te = q((e) => {
|
|
1095
|
-
if (k.current) return k.current;
|
|
1096
|
-
let t = vt();
|
|
1097
|
-
if (!t || !xt(t, {
|
|
1098
|
-
embedKey: e.embedKey,
|
|
1099
|
-
user: e.claim?.id
|
|
1100
|
-
})) return Promise.resolve(null);
|
|
1101
|
-
let n = lt({
|
|
1102
|
-
apiUrl: e.apiUrl,
|
|
1103
|
-
conversationId: t.sessionId,
|
|
1104
|
-
visitorToken: t.visitorToken
|
|
1105
|
-
}).then((t) => L(e, t)).catch(() => (bt(), null)).finally(() => {
|
|
1106
|
-
k.current = null;
|
|
1107
|
-
});
|
|
1108
|
-
return k.current = n, n;
|
|
1109
|
-
}, [L]), R = q(async () => {
|
|
1110
|
-
if (O.current) return O.current;
|
|
1111
|
-
if (D.current) return D.current;
|
|
1112
|
-
let e = ee(), t = te(e).then((t) => t ?? ct({
|
|
1113
|
-
apiUrl: e.apiUrl,
|
|
1114
|
-
embedKey: e.embedKey,
|
|
1115
|
-
user: e.claim,
|
|
1116
|
-
agent: e.opts.agent
|
|
1117
|
-
}).then((t) => L(e, t)));
|
|
1118
|
-
D.current = t;
|
|
1119
|
-
try {
|
|
1120
|
-
return await t;
|
|
1121
|
-
} finally {
|
|
1122
|
-
D.current = null;
|
|
1123
|
-
}
|
|
1124
|
-
}, [
|
|
1125
|
-
L,
|
|
1126
|
-
te,
|
|
1127
|
-
ee
|
|
1128
|
-
]), ne = q(() => {
|
|
1129
|
-
if (O.current || D.current || A.current) return;
|
|
1130
|
-
let e;
|
|
1131
|
-
try {
|
|
1132
|
-
e = ee();
|
|
1133
|
-
} catch (e) {
|
|
1134
|
-
I(e);
|
|
1135
|
-
return;
|
|
1136
|
-
}
|
|
1137
|
-
let t = te(e).then(async (t) => {
|
|
1138
|
-
if (t || O.current || D.current) return;
|
|
1139
|
-
let r = await st({
|
|
1140
|
-
apiUrl: e.apiUrl,
|
|
1141
|
-
embedKey: e.embedKey,
|
|
1142
|
-
agent: e.opts.agent
|
|
1143
|
-
});
|
|
1144
|
-
if (O.current || D.current) return;
|
|
1145
|
-
c(r.handles), u(e.opts.agent && r.agentHandle ? r.agentHandle : ""), f(r.agentHandle ?? ""), v(r.branding);
|
|
1146
|
-
let i = r.welcomeMessage;
|
|
1147
|
-
i && n((e) => e.length > 0 ? e : [{
|
|
1148
|
-
id: Ct,
|
|
1149
|
-
role: "assistant",
|
|
1150
|
-
content: i,
|
|
1151
|
-
createdAt: Date.now(),
|
|
1152
|
-
agent: r.agent
|
|
1153
|
-
}]);
|
|
1154
|
-
});
|
|
1155
|
-
A.current = t, t.catch((e) => {
|
|
1156
|
-
A.current = null, I(e);
|
|
1157
|
-
});
|
|
1158
|
-
}, [
|
|
1159
|
-
I,
|
|
1160
|
-
te,
|
|
1161
|
-
ee
|
|
1162
|
-
]), re = q((e, t, { retry: r = !1, carried: a = [] } = {}) => {
|
|
1163
|
-
if (T.current) return;
|
|
1164
|
-
let o = new AbortController();
|
|
1165
|
-
T.current = o, i(!0), m(null);
|
|
1166
|
-
let s = Ue();
|
|
1167
|
-
n((t) => [
|
|
1168
|
-
...t,
|
|
1169
|
-
{
|
|
1170
|
-
id: Ue(),
|
|
1171
|
-
role: "user",
|
|
1172
|
-
content: e,
|
|
1173
|
-
createdAt: Date.now(),
|
|
1174
|
-
attachments: a.length > 0 ? a : void 0
|
|
1175
|
-
},
|
|
1176
|
-
{
|
|
1177
|
-
id: s,
|
|
1178
|
-
role: "assistant",
|
|
1179
|
-
content: "",
|
|
1180
|
-
createdAt: Date.now(),
|
|
1181
|
-
streaming: !0
|
|
1182
|
-
}
|
|
1183
|
-
]), (async () => {
|
|
1184
|
-
let i = await R();
|
|
1185
|
-
P({
|
|
1186
|
-
type: "chatbot-message",
|
|
1187
|
-
role: "user",
|
|
1188
|
-
content: e,
|
|
1189
|
-
sessionId: i.sessionId
|
|
1190
|
-
});
|
|
1191
|
-
let a = "", c = (e) => {
|
|
1192
|
-
a += e, F(s, { content: a });
|
|
1193
|
-
}, l;
|
|
1194
|
-
try {
|
|
1195
|
-
l = await t(i, c, o.signal);
|
|
1196
|
-
} catch (e) {
|
|
1197
|
-
if (!Et(e) || (bt(), O.current = null, D.current = null, !r)) throw e;
|
|
1198
|
-
i = await R(), a = "", F(s, { content: "" }), l = await t(i, c, o.signal);
|
|
1199
|
-
}
|
|
1200
|
-
if (l.withHuman && g(!0), l.held) {
|
|
1201
|
-
n((e) => e.filter((e) => e.id !== s));
|
|
1202
|
-
return;
|
|
1203
|
-
}
|
|
1204
|
-
F(s, {
|
|
1205
|
-
content: l.answer,
|
|
1206
|
-
streaming: !1,
|
|
1207
|
-
agent: l.agent,
|
|
1208
|
-
authorName: l.authorName,
|
|
1209
|
-
approval: l.approval,
|
|
1210
|
-
unknownHandle: l.unknownHandle,
|
|
1211
|
-
offered: l.offered
|
|
1212
|
-
}), m(l.approval ?? null), P({
|
|
1213
|
-
type: "chatbot-message",
|
|
1214
|
-
role: "assistant",
|
|
1215
|
-
content: l.answer,
|
|
1216
|
-
sessionId: i.sessionId,
|
|
1217
|
-
agent: l.agent?.handle
|
|
1218
|
-
});
|
|
1219
|
-
})().catch((e) => {
|
|
1220
|
-
if (o.signal.aborted) {
|
|
1221
|
-
F(s, { streaming: !1 });
|
|
1222
|
-
return;
|
|
1223
|
-
}
|
|
1224
|
-
I(e, s);
|
|
1225
|
-
}).finally(() => {
|
|
1226
|
-
T.current = null, i(!1);
|
|
1227
|
-
});
|
|
1228
|
-
}, [
|
|
1229
|
-
R,
|
|
1230
|
-
P,
|
|
1231
|
-
I,
|
|
1232
|
-
F
|
|
1233
|
-
]), ie = q((e) => {
|
|
1234
|
-
let t = e.trim();
|
|
1235
|
-
if (!t && y.length === 0) return;
|
|
1236
|
-
let n = y;
|
|
1237
|
-
b([]), w(null), re(t, async (e, r, i) => mt({
|
|
1238
|
-
subjectToken: await St(E.current.getSubjectToken),
|
|
1239
|
-
apiUrl: E.current.apiUrl ?? "https://api.squadico.com",
|
|
1240
|
-
conversationId: e.sessionId,
|
|
1241
|
-
visitorToken: e.visitorToken,
|
|
1242
|
-
message: t,
|
|
1243
|
-
attachmentIds: n.map((e) => e.id),
|
|
1244
|
-
context: E.current.context ? ke(E.current.context) : void 0,
|
|
1245
|
-
onToken: r,
|
|
1246
|
-
signal: i
|
|
1247
|
-
}), {
|
|
1248
|
-
retry: !0,
|
|
1249
|
-
carried: n
|
|
1250
|
-
});
|
|
1251
|
-
}, [y, re]), ae = q((e) => {
|
|
1252
|
-
w(null), S((t) => [...t, e.name]), R().then((t) => ut({
|
|
1253
|
-
apiUrl: E.current.apiUrl ?? "https://api.squadico.com",
|
|
1254
|
-
conversationId: t.sessionId,
|
|
1255
|
-
visitorToken: t.visitorToken,
|
|
1256
|
-
file: e
|
|
1257
|
-
})).then((e) => b((t) => [...t, e])).catch((e) => w(wt(e))).finally(() => S((t) => {
|
|
1258
|
-
let n = t.indexOf(e.name);
|
|
1259
|
-
return n < 0 ? t : [...t.slice(0, n), ...t.slice(n + 1)];
|
|
1260
|
-
}));
|
|
1261
|
-
}, [R]), z = q((e) => {
|
|
1262
|
-
b((t) => t.filter((t) => t.id !== e));
|
|
1263
|
-
let t = O.current;
|
|
1264
|
-
t && dt({
|
|
1265
|
-
apiUrl: E.current.apiUrl ?? "https://api.squadico.com",
|
|
1266
|
-
conversationId: t.sessionId,
|
|
1267
|
-
visitorToken: t.visitorToken,
|
|
1268
|
-
attachmentId: e
|
|
1269
|
-
}).catch(() => {});
|
|
1270
|
-
}, []), B = q(async (e) => {
|
|
1271
|
-
let t = O.current;
|
|
1272
|
-
if (!t) throw new J("No conversation to read that file from");
|
|
1273
|
-
return ft({
|
|
1274
|
-
apiUrl: E.current.apiUrl ?? "https://api.squadico.com",
|
|
1275
|
-
conversationId: t.sessionId,
|
|
1276
|
-
visitorToken: t.visitorToken,
|
|
1277
|
-
attachmentId: e
|
|
1278
|
-
});
|
|
1279
|
-
}, []), V = q((e, t) => {
|
|
1280
|
-
let n = p;
|
|
1281
|
-
n && re(t, async (t, r, i) => ht({
|
|
1282
|
-
subjectToken: await St(E.current.getSubjectToken),
|
|
1283
|
-
apiUrl: E.current.apiUrl ?? "https://api.squadico.com",
|
|
1284
|
-
conversationId: t.sessionId,
|
|
1285
|
-
visitorToken: t.visitorToken,
|
|
1286
|
-
toolCallId: n.toolCallId,
|
|
1287
|
-
approved: e,
|
|
1288
|
-
onToken: r,
|
|
1289
|
-
signal: i
|
|
1290
|
-
}));
|
|
1291
|
-
}, [p, re]), oe = q(() => {
|
|
1292
|
-
T.current?.abort(), T.current = null, i(!1);
|
|
1293
|
-
}, []), H = q(() => {
|
|
1294
|
-
T.current?.abort(), T.current = null, O.current = null, D.current = null, k.current = null, A.current = null, j.current = void 0, bt(), i(!1), m(null), g(!1), o(""), u(""), f(""), n([]), P({
|
|
1295
|
-
type: "chatbot-reset",
|
|
1296
|
-
sessionId: ""
|
|
1297
|
-
});
|
|
1298
|
-
}, [P]), se = e.humanPollMs ?? Tt;
|
|
1299
|
-
G(() => {
|
|
1300
|
-
if (!h || !a) return;
|
|
1301
|
-
let e = setInterval(() => {
|
|
1302
|
-
let e = O.current;
|
|
1303
|
-
!e || T.current || lt({
|
|
1304
|
-
apiUrl: E.current.apiUrl ?? "https://api.squadico.com",
|
|
1305
|
-
conversationId: e.sessionId,
|
|
1306
|
-
visitorToken: e.visitorToken
|
|
1307
|
-
}).then((e) => {
|
|
1308
|
-
n(e.messages), g(!!e.withHuman);
|
|
1309
|
-
}).catch(() => {});
|
|
1310
|
-
}, se);
|
|
1311
|
-
return () => clearInterval(e);
|
|
1312
|
-
}, [
|
|
1313
|
-
h,
|
|
1314
|
-
a,
|
|
1315
|
-
se
|
|
1316
|
-
]);
|
|
1317
|
-
let U = e.user?.id;
|
|
1318
|
-
return G(() => {
|
|
1319
|
-
O.current && j.current !== U && H();
|
|
1320
|
-
}, [U, H]), {
|
|
1321
|
-
messages: _e(() => t.length === 0 && N ? [N] : t, [N, t]),
|
|
1322
|
-
busy: r,
|
|
1323
|
-
sessionId: a,
|
|
1324
|
-
handles: s,
|
|
1325
|
-
addressee: l,
|
|
1326
|
-
agentHandle: d,
|
|
1327
|
-
approval: p,
|
|
1328
|
-
withHuman: h,
|
|
1329
|
-
branding: _,
|
|
1330
|
-
start: ne,
|
|
1331
|
-
send: ie,
|
|
1332
|
-
attachments: y,
|
|
1333
|
-
uploading: x,
|
|
1334
|
-
attachmentError: C,
|
|
1335
|
-
attach: ae,
|
|
1336
|
-
detach: z,
|
|
1337
|
-
loadAttachment: B,
|
|
1338
|
-
decide: V,
|
|
1339
|
-
stop: oe,
|
|
1340
|
-
reset: H
|
|
1341
|
-
};
|
|
1342
|
-
}
|
|
1343
|
-
//#endregion
|
|
1344
|
-
//#region node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
|
|
1345
|
-
var Ot = 0;
|
|
1346
|
-
Array.isArray;
|
|
1347
|
-
function Y(e, n, r, i, a, o) {
|
|
1348
|
-
n || (n = {});
|
|
1349
|
-
var s, c, l = n;
|
|
1350
|
-
if ("ref" in l) for (c in l = {}, n) c == "ref" ? s = n[c] : l[c] = n[c];
|
|
1351
|
-
var u = {
|
|
1352
|
-
type: e,
|
|
1353
|
-
props: l,
|
|
1354
|
-
key: r,
|
|
1355
|
-
ref: s,
|
|
1356
|
-
__k: null,
|
|
1357
|
-
__: null,
|
|
1358
|
-
__b: 0,
|
|
1359
|
-
__e: null,
|
|
1360
|
-
__c: null,
|
|
1361
|
-
constructor: void 0,
|
|
1362
|
-
__v: --Ot,
|
|
1363
|
-
__i: -1,
|
|
1364
|
-
__u: 0,
|
|
1365
|
-
__source: a,
|
|
1366
|
-
__self: o
|
|
1367
|
-
};
|
|
1368
|
-
if (typeof e == "function" && (s = e.defaultProps)) for (c in s) l[c] === void 0 && (l[c] = s[c]);
|
|
1369
|
-
return t.vnode && t.vnode(u), u;
|
|
1370
|
-
}
|
|
1371
|
-
//#endregion
|
|
1372
|
-
//#region src/components/Avatar.tsx
|
|
1373
|
-
function kt({ name: e, color: t, url: n, size: r = 16 }) {
|
|
1374
|
-
let [i, a] = W(void 0), o = !!n && i !== n;
|
|
1375
|
-
return /* @__PURE__ */ Y("span", {
|
|
1376
|
-
class: "sqc-avatar",
|
|
1377
|
-
"aria-hidden": "true",
|
|
1378
|
-
style: {
|
|
1379
|
-
width: `${r}px`,
|
|
1380
|
-
height: `${r}px`,
|
|
1381
|
-
fontSize: `${Math.round(r * .45)}px`,
|
|
1382
|
-
borderRadius: `${Math.round(r * .25)}px`,
|
|
1383
|
-
...o || !t ? {} : { backgroundColor: t }
|
|
1384
|
-
},
|
|
1385
|
-
children: o ? /* @__PURE__ */ Y("img", {
|
|
1386
|
-
src: n,
|
|
1387
|
-
alt: "",
|
|
1388
|
-
onError: () => a(n)
|
|
1389
|
-
}) : At(e)
|
|
1390
|
-
});
|
|
1391
|
-
}
|
|
1392
|
-
function At(e) {
|
|
1393
|
-
let t = Array.from(e.trim())[0];
|
|
1394
|
-
return t ? t.toLocaleUpperCase() : "?";
|
|
1395
|
-
}
|
|
1396
|
-
//#endregion
|
|
1397
|
-
//#region src/components/AgentRail.tsx
|
|
1398
|
-
function jt({ handles: e, active: t, disabled: n, onPick: r, label: i }) {
|
|
1399
|
-
return /* @__PURE__ */ Y("nav", {
|
|
1400
|
-
class: "sqc-rail",
|
|
1401
|
-
"aria-label": i,
|
|
1402
|
-
children: e.map((e) => /* @__PURE__ */ Y("button", {
|
|
1403
|
-
type: "button",
|
|
1404
|
-
class: "sqc-rail__item",
|
|
1405
|
-
"aria-label": e.name,
|
|
1406
|
-
"aria-pressed": e.handle === t,
|
|
1407
|
-
"data-tip": e.name,
|
|
1408
|
-
disabled: n,
|
|
1409
|
-
onClick: () => r(e.handle),
|
|
1410
|
-
children: [/* @__PURE__ */ Y(kt, {
|
|
1411
|
-
name: e.name,
|
|
1412
|
-
color: e.color,
|
|
1413
|
-
url: e.avatarUrl,
|
|
1414
|
-
size: 40
|
|
1415
|
-
}), /* @__PURE__ */ Y("span", {
|
|
1416
|
-
class: "sqc-rail__label",
|
|
1417
|
-
"aria-hidden": "true",
|
|
1418
|
-
children: Mt(e.handle)
|
|
1419
|
-
})]
|
|
1420
|
-
}, e.handle))
|
|
1421
|
-
});
|
|
1422
|
-
}
|
|
1423
|
-
function Mt(e) {
|
|
1424
|
-
let t = e.split(/[-_]/)[0] ?? e;
|
|
1425
|
-
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
1426
|
-
}
|
|
1427
|
-
//#endregion
|
|
1428
|
-
//#region src/components/Composer.tsx
|
|
1429
|
-
var Nt = 132, Pt = "image/png,image/jpeg,image/gif,image/webp,application/pdf,.docx,.txt,.md,.csv,.json", Ft = /^[a-zA-Z0-9_-]*$/;
|
|
1430
|
-
function It(e, t) {
|
|
1431
|
-
let n = e.slice(0, t), r = n.lastIndexOf("@");
|
|
1432
|
-
if (r < 0 || r > 0 && !/\s/.test(n[r - 1] ?? "")) return null;
|
|
1433
|
-
let i = n.slice(r + 1);
|
|
1434
|
-
return Ft.test(i) ? {
|
|
1435
|
-
start: r,
|
|
1436
|
-
query: i
|
|
1437
|
-
} : null;
|
|
1438
|
-
}
|
|
1439
|
-
function Lt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addressee: a, attachments: o = [], uploading: s = [], attachmentError: c, onAttach: l, onDetach: u, onSend: d, onStop: f }) {
|
|
1440
|
-
let [p, m] = W(""), [h, g] = W(null), [_, v] = W(0), [y, b] = W(!1), x = K(null), C = K(null), w = !!l, T = s.length > 0, E = _e(() => {
|
|
1441
|
-
if (!h || !i || i.length === 0) return [];
|
|
1442
|
-
let e = h.query.toLowerCase();
|
|
1443
|
-
return i.filter((t) => t.handle.startsWith(e));
|
|
1444
|
-
}, [i, h]), D = E.length > 0, O = q(() => {
|
|
1445
|
-
let e = x.current;
|
|
1446
|
-
if (!e) return;
|
|
1447
|
-
e.style.height = "auto";
|
|
1448
|
-
let t = e.scrollHeight > Nt;
|
|
1449
|
-
e.style.height = `${Math.min(e.scrollHeight, Nt)}px`, e.style.overflowY = t ? "auto" : "hidden";
|
|
1450
|
-
}, []);
|
|
1451
|
-
G(() => {
|
|
1452
|
-
r && x.current?.focus(), O();
|
|
1453
|
-
}, [r, O]), G(() => {
|
|
1454
|
-
a && (m((e) => e || `@${a} `), requestAnimationFrame(O));
|
|
1455
|
-
}, [a, O]);
|
|
1456
|
-
let k = q((e) => {
|
|
1457
|
-
g(It(e.value, e.selectionStart ?? e.value.length)), v(0);
|
|
1458
|
-
}, []), A = q((e) => {
|
|
1459
|
-
let t = x.current;
|
|
1460
|
-
if (!t || !h) return;
|
|
1461
|
-
let n = t.selectionStart ?? t.value.length, r = `${p.slice(0, h.start)}@${e} ${p.slice(n)}`, i = h.start + e.length + 2;
|
|
1462
|
-
m(r), g(null), requestAnimationFrame(() => {
|
|
1463
|
-
t.focus(), t.setSelectionRange(i, i), O();
|
|
1464
|
-
});
|
|
1465
|
-
}, [
|
|
1466
|
-
O,
|
|
1467
|
-
h,
|
|
1468
|
-
p
|
|
1469
|
-
]), j = q((e) => {
|
|
1470
|
-
if (!(!l || !e)) for (let t of Array.from(e)) l(t);
|
|
1471
|
-
}, [l]), M = q(() => {
|
|
1472
|
-
let e = p.trim();
|
|
1473
|
-
!e && o.length === 0 || n || T || (d(e), m(""), g(null), requestAnimationFrame(O));
|
|
1474
|
-
}, [
|
|
1475
|
-
o.length,
|
|
1476
|
-
n,
|
|
1477
|
-
O,
|
|
1478
|
-
d,
|
|
1479
|
-
p,
|
|
1480
|
-
T
|
|
1481
|
-
]), N = q((e) => {
|
|
1482
|
-
if (D && !e.isComposing) {
|
|
1483
|
-
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
1484
|
-
e.preventDefault();
|
|
1485
|
-
let t = e.key === "ArrowDown" ? 1 : E.length - 1;
|
|
1486
|
-
v((e) => (e + t) % E.length);
|
|
1487
|
-
return;
|
|
1488
|
-
}
|
|
1489
|
-
if (e.key === "Enter" || e.key === "Tab") {
|
|
1490
|
-
e.preventDefault(), A((E[_] ?? E[0]).handle);
|
|
1491
|
-
return;
|
|
1492
|
-
}
|
|
1493
|
-
if (e.key === "Escape") {
|
|
1494
|
-
e.preventDefault(), e.stopPropagation(), g(null);
|
|
1495
|
-
return;
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
e.key === "Enter" && !e.shiftKey && !e.isComposing && (e.preventDefault(), M());
|
|
1499
|
-
}, [
|
|
1500
|
-
_,
|
|
1501
|
-
E,
|
|
1502
|
-
A,
|
|
1503
|
-
D,
|
|
1504
|
-
M
|
|
1505
|
-
]), P = Ye - p.length;
|
|
1506
|
-
return /* @__PURE__ */ Y("form", {
|
|
1507
|
-
class: `sqc-composer${y ? " sqc-composer--dropping" : ""}`,
|
|
1508
|
-
onSubmit: (e) => {
|
|
1509
|
-
e.preventDefault(), M();
|
|
1510
|
-
},
|
|
1511
|
-
onDragOver: (e) => {
|
|
1512
|
-
w && (e.preventDefault(), b(!0));
|
|
1513
|
-
},
|
|
1514
|
-
onDragLeave: () => b(!1),
|
|
1515
|
-
onDrop: (e) => {
|
|
1516
|
-
w && (e.preventDefault(), b(!1), j(e.dataTransfer?.files ?? null));
|
|
1517
|
-
},
|
|
1518
|
-
children: [
|
|
1519
|
-
(o.length > 0 || T || c) && /* @__PURE__ */ Y("div", {
|
|
1520
|
-
class: "sqc-attachments",
|
|
1521
|
-
children: [
|
|
1522
|
-
o.map((e) => /* @__PURE__ */ Y("span", {
|
|
1523
|
-
class: "sqc-chip",
|
|
1524
|
-
"data-kind": e.kind,
|
|
1525
|
-
children: [/* @__PURE__ */ Y("span", {
|
|
1526
|
-
class: "sqc-chip__name",
|
|
1527
|
-
children: e.filename
|
|
1528
|
-
}), /* @__PURE__ */ Y("button", {
|
|
1529
|
-
type: "button",
|
|
1530
|
-
class: "sqc-chip__remove",
|
|
1531
|
-
"aria-label": t.t.composer.remove.replace("{name}", e.filename),
|
|
1532
|
-
onClick: () => u?.(e.id),
|
|
1533
|
-
children: "×"
|
|
1534
|
-
})]
|
|
1535
|
-
}, e.id)),
|
|
1536
|
-
s.map((e) => /* @__PURE__ */ Y("span", {
|
|
1537
|
-
class: "sqc-chip sqc-chip--waiting",
|
|
1538
|
-
children: /* @__PURE__ */ Y("span", {
|
|
1539
|
-
class: "sqc-chip__name",
|
|
1540
|
-
children: e
|
|
1541
|
-
})
|
|
1542
|
-
}, e)),
|
|
1543
|
-
c && /* @__PURE__ */ Y("p", {
|
|
1544
|
-
class: "sqc-attachments__error",
|
|
1545
|
-
role: "status",
|
|
1546
|
-
children: c
|
|
1547
|
-
})
|
|
1548
|
-
]
|
|
1549
|
-
}),
|
|
1550
|
-
/* @__PURE__ */ Y("div", {
|
|
1551
|
-
class: "sqc-composer__field",
|
|
1552
|
-
children: [
|
|
1553
|
-
D && /* @__PURE__ */ Y("ul", {
|
|
1554
|
-
class: "sqc-mentions",
|
|
1555
|
-
role: "listbox",
|
|
1556
|
-
"aria-label": t.t.handles.picker,
|
|
1557
|
-
children: E.map((e, t) => /* @__PURE__ */ Y("li", {
|
|
1558
|
-
role: "option",
|
|
1559
|
-
"aria-selected": t === _,
|
|
1560
|
-
class: `sqc-mention${t === _ ? " sqc-mention--active" : ""}`,
|
|
1561
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
1562
|
-
onMouseEnter: () => v(t),
|
|
1563
|
-
onClick: () => A(e.handle),
|
|
1564
|
-
children: [
|
|
1565
|
-
/* @__PURE__ */ Y("span", {
|
|
1566
|
-
class: "sqc-mention__icon",
|
|
1567
|
-
children: /* @__PURE__ */ Y(kt, {
|
|
1568
|
-
name: e.name,
|
|
1569
|
-
color: e.color,
|
|
1570
|
-
url: e.avatarUrl,
|
|
1571
|
-
size: 18
|
|
1572
|
-
})
|
|
1573
|
-
}),
|
|
1574
|
-
/* @__PURE__ */ Y("span", {
|
|
1575
|
-
class: "sqc-mention__handle",
|
|
1576
|
-
children: ["@", e.handle]
|
|
1577
|
-
}),
|
|
1578
|
-
/* @__PURE__ */ Y("span", {
|
|
1579
|
-
class: "sqc-mention__name",
|
|
1580
|
-
children: e.name
|
|
1581
|
-
})
|
|
1582
|
-
]
|
|
1583
|
-
}, e.handle))
|
|
1584
|
-
}),
|
|
1585
|
-
/* @__PURE__ */ Y("textarea", {
|
|
1586
|
-
ref: x,
|
|
1587
|
-
class: "sqc-composer__input",
|
|
1588
|
-
rows: 1,
|
|
1589
|
-
value: p,
|
|
1590
|
-
placeholder: e,
|
|
1591
|
-
maxLength: Ye,
|
|
1592
|
-
"aria-label": t.t.composer.label,
|
|
1593
|
-
onInput: (e) => {
|
|
1594
|
-
m(e.currentTarget.value), k(e.currentTarget), O();
|
|
1595
|
-
},
|
|
1596
|
-
onKeyDown: N,
|
|
1597
|
-
onClick: (e) => k(e.currentTarget),
|
|
1598
|
-
onPaste: (e) => {
|
|
1599
|
-
let t = e.clipboardData?.files;
|
|
1600
|
-
!w || !t || t.length === 0 || (e.preventDefault(), j(t));
|
|
1601
|
-
}
|
|
1602
|
-
}),
|
|
1603
|
-
P <= 200 && /* @__PURE__ */ Y("span", {
|
|
1604
|
-
class: "sqc-composer__count",
|
|
1605
|
-
"aria-live": "polite",
|
|
1606
|
-
children: P
|
|
1607
|
-
})
|
|
1608
|
-
]
|
|
1609
|
-
}),
|
|
1610
|
-
w && /* @__PURE__ */ Y(S, { children: [/* @__PURE__ */ Y("input", {
|
|
1611
|
-
ref: C,
|
|
1612
|
-
type: "file",
|
|
1613
|
-
multiple: !0,
|
|
1614
|
-
accept: Pt,
|
|
1615
|
-
class: "sqc-file-input",
|
|
1616
|
-
onChange: (e) => {
|
|
1617
|
-
j(e.currentTarget.files), e.currentTarget.value = "";
|
|
1618
|
-
}
|
|
1619
|
-
}), /* @__PURE__ */ Y("button", {
|
|
1620
|
-
type: "button",
|
|
1621
|
-
class: "sqc-btn sqc-btn--attach",
|
|
1622
|
-
onClick: () => C.current?.click(),
|
|
1623
|
-
"aria-label": t.t.composer.attach,
|
|
1624
|
-
title: t.t.composer.attachTitle,
|
|
1625
|
-
children: /* @__PURE__ */ Y("svg", {
|
|
1626
|
-
viewBox: "0 0 24 24",
|
|
1627
|
-
fill: "none",
|
|
1628
|
-
stroke: "currentColor",
|
|
1629
|
-
"stroke-width": "1.9",
|
|
1630
|
-
"stroke-linecap": "round",
|
|
1631
|
-
"stroke-linejoin": "round",
|
|
1632
|
-
"aria-hidden": "true",
|
|
1633
|
-
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" })
|
|
1634
|
-
})
|
|
1635
|
-
})] }),
|
|
1636
|
-
n ? /* @__PURE__ */ Y("button", {
|
|
1637
|
-
type: "button",
|
|
1638
|
-
class: "sqc-btn sqc-btn--stop",
|
|
1639
|
-
onClick: f,
|
|
1640
|
-
"aria-label": t.t.composer.stop,
|
|
1641
|
-
title: t.t.composer.stopTitle,
|
|
1642
|
-
children: /* @__PURE__ */ Y("svg", {
|
|
1643
|
-
viewBox: "0 0 24 24",
|
|
1644
|
-
"aria-hidden": "true",
|
|
1645
|
-
children: /* @__PURE__ */ Y("rect", {
|
|
1646
|
-
x: "7",
|
|
1647
|
-
y: "7",
|
|
1648
|
-
width: "10",
|
|
1649
|
-
height: "10",
|
|
1650
|
-
rx: "2",
|
|
1651
|
-
fill: "currentColor"
|
|
1652
|
-
})
|
|
1653
|
-
})
|
|
1654
|
-
}) : /* @__PURE__ */ Y("button", {
|
|
1655
|
-
type: "submit",
|
|
1656
|
-
class: "sqc-btn sqc-btn--send",
|
|
1657
|
-
disabled: !p.trim() && o.length === 0 || T,
|
|
1658
|
-
"aria-label": t.t.composer.send,
|
|
1659
|
-
title: t.t.composer.sendTitle,
|
|
1660
|
-
children: /* @__PURE__ */ Y("svg", {
|
|
1661
|
-
viewBox: "0 0 24 24",
|
|
1662
|
-
fill: "none",
|
|
1663
|
-
stroke: "currentColor",
|
|
1664
|
-
"stroke-width": "1.9",
|
|
1665
|
-
"stroke-linecap": "round",
|
|
1666
|
-
"stroke-linejoin": "round",
|
|
1667
|
-
"aria-hidden": "true",
|
|
1668
|
-
children: /* @__PURE__ */ Y("path", { d: "M5 12l14-7-5 14-2.5-5.5L5 12z" })
|
|
1669
|
-
})
|
|
1670
|
-
})
|
|
1671
|
-
]
|
|
1672
|
-
});
|
|
1673
|
-
}
|
|
1674
|
-
//#endregion
|
|
1675
|
-
//#region src/lib/confirm.ts
|
|
1676
|
-
var Rt = {
|
|
1677
|
-
fr: /\br[ée]ponde?z? +«?\s*oui\b/i,
|
|
1678
|
-
en: /\b(?:reply|answer|respond) +[“"']?\s*yes\b/i,
|
|
1679
|
-
es: /\bresponda?e?d? +«?\s*s[íi]\b/i
|
|
1680
|
-
}, zt = {
|
|
1681
|
-
fr: [
|
|
1682
|
-
/\b(?:confirmes?[- ]tu|confirmez[- ]vous)\b/i,
|
|
1683
|
-
/\b(?:valides?[- ]tu|validez[- ]vous)\b/i,
|
|
1684
|
-
/\b(?:es[- ]tu s[ûu]re?|[êe]tes[- ]vous s[ûu]re?s?)\b/i,
|
|
1685
|
-
/\b(?:dois[- ]je|puis[- ]je)\b/i,
|
|
1686
|
-
/\b(?:je continue|on continue|on y va|je lance)\b/i,
|
|
1687
|
-
Rt.fr
|
|
1688
|
-
],
|
|
1689
|
-
en: [
|
|
1690
|
-
/\bdo you confirm\b/i,
|
|
1691
|
-
/\bdo you (?:want|wish) me to\b/i,
|
|
1692
|
-
/\b(?:shall|should) I\b/i,
|
|
1693
|
-
/\bare you sure\b/i,
|
|
1694
|
-
/\b(?:shall we|should I) (?:proceed|continue|go ahead)\b/i,
|
|
1695
|
-
Rt.en
|
|
1696
|
-
],
|
|
1697
|
-
es: [
|
|
1698
|
-
/\b(?:confirmas|confirma|confirm[áa]is)\b/i,
|
|
1699
|
-
/\b(?:validas|valida|valid[áa]is)\b/i,
|
|
1700
|
-
/\best[áa]s? seguro\b/i,
|
|
1701
|
-
/\b(?:contin[úu]o|procedo|lo lanzo|lo hago)\b/i,
|
|
1702
|
-
/\bquieres? que\b/i,
|
|
1703
|
-
Rt.es
|
|
1704
|
-
]
|
|
1705
|
-
}, Bt = /^\s*(?:[-*•]\s+)?\[[ xX]\]\s+/m;
|
|
1706
|
-
function Vt(e, t = "en") {
|
|
1707
|
-
if (Bt.test(e)) return !1;
|
|
1708
|
-
let n = e.split("\n").map((e) => e.trim()).filter(Boolean), r = n[n.length - 1];
|
|
1709
|
-
return !r || !r.includes("?") && !Rt[t].test(r) ? !1 : zt[t].some((e) => e.test(r));
|
|
1710
|
-
}
|
|
1711
|
-
//#endregion
|
|
1712
|
-
//#region src/components/Approval.tsx
|
|
1713
|
-
var Ht = /^(?:mcp|custom|a2a)_[0-9a-f]{8}_/;
|
|
1714
|
-
function Ut(e) {
|
|
1715
|
-
let t = e.replace(Ht, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim().toLowerCase();
|
|
1716
|
-
return t ? t.charAt(0).toUpperCase() + t.slice(1) : e;
|
|
1717
|
-
}
|
|
1718
|
-
function Wt(e, t) {
|
|
1719
|
-
return e === !0 ? t.t.confirm.yes : e === !1 ? t.t.confirm.no : typeof e == "string" ? e : JSON.stringify(e) ?? String(e);
|
|
1720
|
-
}
|
|
1721
|
-
function Gt({ locale: e, call: t, onDecide: n }) {
|
|
1722
|
-
let { approval: r, confirm: i } = e.t, [a, o] = W(null), s = !!n && a === null, c = (e, t) => {
|
|
1723
|
-
o(t), n?.(e, t);
|
|
1724
|
-
}, l = t ? Object.entries(t.arguments) : [];
|
|
1725
|
-
return /* @__PURE__ */ Y("div", {
|
|
1726
|
-
class: "sqc-approval",
|
|
1727
|
-
role: "group",
|
|
1728
|
-
"aria-label": r.group,
|
|
1729
|
-
children: [
|
|
1730
|
-
t && /* @__PURE__ */ Y("p", {
|
|
1731
|
-
class: "sqc-approval__request",
|
|
1732
|
-
"data-testid": "sqc-approval-tool",
|
|
1733
|
-
children: r.request.replace("{tool}", Ut(t.tool))
|
|
1734
|
-
}),
|
|
1735
|
-
l.length > 0 && /* @__PURE__ */ Y("dl", {
|
|
1736
|
-
class: "sqc-approval__args",
|
|
1737
|
-
"data-testid": "sqc-approval-arguments",
|
|
1738
|
-
children: l.map(([t, n]) => /* @__PURE__ */ Y("div", {
|
|
1739
|
-
class: "sqc-approval__arg",
|
|
1740
|
-
children: [/* @__PURE__ */ Y("dt", {
|
|
1741
|
-
class: "sqc-approval__arg-name",
|
|
1742
|
-
children: Ut(t)
|
|
1743
|
-
}), /* @__PURE__ */ Y("dd", {
|
|
1744
|
-
class: "sqc-approval__arg-value",
|
|
1745
|
-
children: Wt(n, e)
|
|
1746
|
-
})]
|
|
1747
|
-
}, t))
|
|
1748
|
-
}),
|
|
1749
|
-
/* @__PURE__ */ Y("div", {
|
|
1750
|
-
class: "sqc-approval__actions",
|
|
1751
|
-
children: [/* @__PURE__ */ Y("button", {
|
|
1752
|
-
type: "button",
|
|
1753
|
-
class: "sqc-approval__btn sqc-approval__btn--yes",
|
|
1754
|
-
"aria-pressed": a === i.yes,
|
|
1755
|
-
disabled: !s,
|
|
1756
|
-
onClick: () => c(!0, i.yes),
|
|
1757
|
-
children: r.approve
|
|
1758
|
-
}), /* @__PURE__ */ Y("button", {
|
|
1759
|
-
type: "button",
|
|
1760
|
-
class: "sqc-approval__btn sqc-approval__btn--no",
|
|
1761
|
-
"aria-pressed": a === i.no,
|
|
1762
|
-
disabled: !s,
|
|
1763
|
-
onClick: () => c(!1, i.no),
|
|
1764
|
-
children: r.reject
|
|
1765
|
-
})]
|
|
1766
|
-
})
|
|
1767
|
-
]
|
|
1768
|
-
});
|
|
1769
|
-
}
|
|
1770
|
-
//#endregion
|
|
1771
|
-
//#region src/components/Confirm.tsx
|
|
1772
|
-
function Kt({ locale: e, onPick: t }) {
|
|
1773
|
-
let [n, r] = W(null), i = !!t && n === null, { confirm: a } = e.t, o = [{
|
|
1774
|
-
value: a.yesValue,
|
|
1775
|
-
label: a.yes,
|
|
1776
|
-
kind: "yes"
|
|
1777
|
-
}, {
|
|
1778
|
-
value: a.noValue,
|
|
1779
|
-
label: a.no,
|
|
1780
|
-
kind: "no"
|
|
1781
|
-
}];
|
|
1782
|
-
return /* @__PURE__ */ Y("div", {
|
|
1783
|
-
class: "sqc-confirm",
|
|
1784
|
-
role: "group",
|
|
1785
|
-
"aria-label": a.group,
|
|
1786
|
-
children: o.map((e) => /* @__PURE__ */ Y("button", {
|
|
1787
|
-
type: "button",
|
|
1788
|
-
class: `sqc-confirm__btn sqc-confirm__btn--${e.kind}`,
|
|
1789
|
-
"aria-pressed": n === e.value,
|
|
1790
|
-
disabled: !i,
|
|
1791
|
-
onClick: () => {
|
|
1792
|
-
r(e.value), t?.(e.value);
|
|
1793
|
-
},
|
|
1794
|
-
children: e.label
|
|
1795
|
-
}, e.value))
|
|
1796
|
-
});
|
|
1797
|
-
}
|
|
1798
|
-
//#endregion
|
|
1799
|
-
//#region src/components/Choices.tsx
|
|
1800
|
-
function qt() {
|
|
1801
|
-
return /* @__PURE__ */ Y("svg", {
|
|
1802
|
-
viewBox: "0 0 16 16",
|
|
1803
|
-
fill: "none",
|
|
1804
|
-
stroke: "currentColor",
|
|
1805
|
-
"stroke-width": "2.2",
|
|
1806
|
-
"aria-hidden": "true",
|
|
1807
|
-
children: /* @__PURE__ */ Y("path", {
|
|
1808
|
-
d: "M3.5 8.5l3 3 6-7",
|
|
1809
|
-
"stroke-linecap": "round",
|
|
1810
|
-
"stroke-linejoin": "round"
|
|
1811
|
-
})
|
|
1812
|
-
});
|
|
1813
|
-
}
|
|
1814
|
-
function Jt({ items: e, locale: t, onPick: n }) {
|
|
1815
|
-
let [r, i] = W(null), a = !!n && r === null;
|
|
1816
|
-
return /* @__PURE__ */ Y("div", {
|
|
1817
|
-
class: "sqc-choices",
|
|
1818
|
-
role: "group",
|
|
1819
|
-
"aria-label": t.t.choices,
|
|
1820
|
-
children: e.map((e, t) => {
|
|
1821
|
-
let o = r === null ? e.checked : r === e.label;
|
|
1822
|
-
return /* @__PURE__ */ Y("button", {
|
|
1823
|
-
type: "button",
|
|
1824
|
-
class: "sqc-choice",
|
|
1825
|
-
"aria-pressed": o,
|
|
1826
|
-
disabled: !a,
|
|
1827
|
-
onClick: () => {
|
|
1828
|
-
i(e.label), n?.(e.label);
|
|
1829
|
-
},
|
|
1830
|
-
children: [/* @__PURE__ */ Y("span", {
|
|
1831
|
-
class: `sqc-choice__box${o ? " sqc-choice__box--on" : ""}`,
|
|
1832
|
-
"aria-hidden": "true",
|
|
1833
|
-
children: o && /* @__PURE__ */ Y(qt, {})
|
|
1834
|
-
}), /* @__PURE__ */ Y("span", {
|
|
1835
|
-
class: "sqc-choice__label",
|
|
1836
|
-
children: e.content
|
|
1837
|
-
})]
|
|
1838
|
-
}, `${t}-${e.label}`);
|
|
1839
|
-
})
|
|
1840
|
-
});
|
|
1841
|
-
}
|
|
1842
|
-
//#endregion
|
|
1843
|
-
//#region src/components/RichText.tsx
|
|
1844
|
-
var Yt = /(\*\*[^*\n]+\*\*|`[^`\n]+`|~~[^~\n]+~~|\[[^\]\n]+\]\([^)\s]+\)|\*[^*\n]+\*|https?:\/\/[^\s<>()]+)/g, Xt = /^\[([^\]\n]+)\]\(([^)\s]+)\)$/, Zt = /^(https?:|mailto:)/i;
|
|
1845
|
-
function Qt(e, t, n) {
|
|
1846
|
-
return Zt.test(e) ? /* @__PURE__ */ Y("a", {
|
|
1847
|
-
href: e,
|
|
1848
|
-
target: "_blank",
|
|
1849
|
-
rel: "noopener noreferrer",
|
|
1850
|
-
children: t
|
|
1851
|
-
}, n) : t;
|
|
1852
|
-
}
|
|
1853
|
-
function $t(e, t) {
|
|
1854
|
-
let n = e.split(Yt), r = [];
|
|
1855
|
-
return n.forEach((e, n) => {
|
|
1856
|
-
if (!e) return;
|
|
1857
|
-
let i = `${t}-${n}`, a = Xt.exec(e);
|
|
1858
|
-
e.startsWith("**") && e.endsWith("**") && e.length > 4 ? r.push(/* @__PURE__ */ Y("strong", { children: e.slice(2, -2) }, i)) : e.startsWith("`") && e.endsWith("`") && e.length > 2 ? r.push(/* @__PURE__ */ Y("code", { children: e.slice(1, -1) }, i)) : e.startsWith("~~") && e.endsWith("~~") && e.length > 4 ? r.push(/* @__PURE__ */ Y("del", { children: e.slice(2, -2) }, i)) : a ? r.push(Qt(a[2], a[1], i)) : e.startsWith("*") && e.endsWith("*") && e.length > 2 ? r.push(/* @__PURE__ */ Y("em", { children: e.slice(1, -1) }, i)) : /^https?:\/\//.test(e) ? r.push(Qt(e, e, i)) : r.push(e);
|
|
1859
|
-
}), r;
|
|
1860
|
-
}
|
|
1861
|
-
var en = /^\s*(?:[-*•]\s+)?\[([ xX])\]\s+(.+)$/;
|
|
1862
|
-
function tn(e) {
|
|
1863
|
-
return e.replace(/\[([^\]\n]+)\]\([^)\s]+\)/g, "$1").replace(/\*\*|~~|`|\*/g, "").trim();
|
|
1864
|
-
}
|
|
1865
|
-
var nn = /^(\s*)[-*•]\s+/, rn = /^(\s*)\d+[.)]\s+/, an = /^\s{0,3}(#{1,6})\s+(.+?)#*\s*$/, on = /^\s*([-*_])(?:\s*\1){2,}\s*$/, sn = /^\s*>\s?(.*)$/, cn = /^\s*\|.*\|\s*$/, ln = /^\s*\|(?:\s*:?-{1,}:?\s*\|)+\s*$/, un = /^\s*```/;
|
|
1866
|
-
function dn(e) {
|
|
1867
|
-
return e.replace(/^\s*\|/, "").replace(/\|\s*$/, "").split("|").map((e) => e.trim());
|
|
1868
|
-
}
|
|
1869
|
-
function fn(e, t, n, r) {
|
|
1870
|
-
let i = e[t].ordered, a = [], o = t;
|
|
1871
|
-
for (; o < e.length && e[o].depth >= n;) {
|
|
1872
|
-
let t = e[o];
|
|
1873
|
-
if (t.depth === n && t.ordered !== i) break;
|
|
1874
|
-
if (t.depth > n) {
|
|
1875
|
-
let [n, i] = fn(e, o, t.depth, `${r}-${o}`), s = a[a.length - 1];
|
|
1876
|
-
s ? s.nested.push(n) : a.push({
|
|
1877
|
-
key: `${r}-${o}`,
|
|
1878
|
-
text: null,
|
|
1879
|
-
nested: [n]
|
|
1880
|
-
}), o = i;
|
|
1881
|
-
continue;
|
|
1882
|
-
}
|
|
1883
|
-
a.push({
|
|
1884
|
-
key: `${r}-${o}`,
|
|
1885
|
-
text: t.text,
|
|
1886
|
-
nested: []
|
|
1887
|
-
}), o += 1;
|
|
1888
|
-
}
|
|
1889
|
-
let s = a.map((e) => /* @__PURE__ */ Y("li", { children: [e.text === null ? null : $t(e.text, e.key), e.nested] }, e.key));
|
|
1890
|
-
return [Y(i ? "ol" : "ul", { children: s }, r), o];
|
|
1891
|
-
}
|
|
1892
|
-
function pn({ text: e, locale: t, onChoice: n }) {
|
|
1893
|
-
let r = e.split("\n"), i = [], a = [], o = [], s = [], c = () => {
|
|
1894
|
-
if (!a.length) return;
|
|
1895
|
-
let e = `p${i.length}`;
|
|
1896
|
-
i.push(/* @__PURE__ */ Y("p", { children: $t(a.join("\n"), e) }, e)), a = [];
|
|
1897
|
-
}, l = () => {
|
|
1898
|
-
if (!o.length) return;
|
|
1899
|
-
let e = 0;
|
|
1900
|
-
for (; e < o.length;) {
|
|
1901
|
-
let t = `l${i.length}`, [n, r] = fn(o, e, o[e].depth, t);
|
|
1902
|
-
i.push(n), e = r;
|
|
1903
|
-
}
|
|
1904
|
-
o = [];
|
|
1905
|
-
}, u = () => {
|
|
1906
|
-
if (!s.length) return;
|
|
1907
|
-
let e = `q${i.length}`;
|
|
1908
|
-
i.push(/* @__PURE__ */ Y("blockquote", { children: $t(s.join("\n"), e) }, e)), s = [];
|
|
1909
|
-
}, d = () => {
|
|
1910
|
-
c(), l(), u();
|
|
1911
|
-
};
|
|
1912
|
-
for (let e = 0; e < r.length; e += 1) {
|
|
1913
|
-
let f = r[e];
|
|
1914
|
-
if (un.test(f)) {
|
|
1915
|
-
d();
|
|
1916
|
-
let t = [];
|
|
1917
|
-
for (e += 1; e < r.length && !un.test(r[e]);) t.push(r[e]), e += 1;
|
|
1918
|
-
let n = `c${i.length}`;
|
|
1919
|
-
i.push(/* @__PURE__ */ Y("pre", { children: /* @__PURE__ */ Y("code", { children: t.join("\n") }) }, n));
|
|
1920
|
-
continue;
|
|
1921
|
-
}
|
|
1922
|
-
if (cn.test(f) && e + 1 < r.length && ln.test(r[e + 1])) {
|
|
1923
|
-
d();
|
|
1924
|
-
let t = dn(f), n = [];
|
|
1925
|
-
for (e += 2; e < r.length && cn.test(r[e]);) n.push(dn(r[e])), e += 1;
|
|
1926
|
-
--e;
|
|
1927
|
-
let a = `t${i.length}`;
|
|
1928
|
-
i.push(/* @__PURE__ */ Y("div", {
|
|
1929
|
-
class: "sqc-table",
|
|
1930
|
-
children: /* @__PURE__ */ Y("table", { children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ Y("tr", { children: t.map((e, t) => /* @__PURE__ */ Y("th", { children: $t(e, `${a}-h${t}`) }, `${a}-h${t}`)) }) }), /* @__PURE__ */ Y("tbody", { children: n.map((e, n) => /* @__PURE__ */ Y("tr", { children: t.map((t, r) => /* @__PURE__ */ Y("td", { children: $t(e[r] ?? "", `${a}-r${n}c${r}`) }, `${a}-r${n}c${r}`)) }, `${a}-r${n}`)) })] })
|
|
1931
|
-
}, a));
|
|
1932
|
-
continue;
|
|
1933
|
-
}
|
|
1934
|
-
if (!f.trim()) {
|
|
1935
|
-
d();
|
|
1936
|
-
continue;
|
|
1937
|
-
}
|
|
1938
|
-
if (en.test(f)) {
|
|
1939
|
-
d();
|
|
1940
|
-
let a = [];
|
|
1941
|
-
for (; e < r.length;) {
|
|
1942
|
-
let t = en.exec(r[e]);
|
|
1943
|
-
if (!t) break;
|
|
1944
|
-
let n = t[2].trim(), o = `o${i.length}-${a.length}`;
|
|
1945
|
-
a.push({
|
|
1946
|
-
label: tn(n),
|
|
1947
|
-
checked: t[1].toLowerCase() === "x",
|
|
1948
|
-
content: $t(n, o)
|
|
1949
|
-
}), e += 1;
|
|
1950
|
-
}
|
|
1951
|
-
--e, i.push(/* @__PURE__ */ Y(Jt, {
|
|
1952
|
-
items: a,
|
|
1953
|
-
locale: t,
|
|
1954
|
-
onPick: n
|
|
1955
|
-
}, `o${i.length}`));
|
|
1956
|
-
continue;
|
|
1957
|
-
}
|
|
1958
|
-
let p = an.exec(f);
|
|
1959
|
-
if (p) {
|
|
1960
|
-
d();
|
|
1961
|
-
let e = p[1].length, t = e <= 2 ? "h3" : e === 3 ? "h4" : "h5", n = `h${i.length}`;
|
|
1962
|
-
i.push(/* @__PURE__ */ Y(t, { children: $t(p[2], n) }, n));
|
|
1963
|
-
continue;
|
|
1964
|
-
}
|
|
1965
|
-
if (on.test(f)) {
|
|
1966
|
-
d(), i.push(/* @__PURE__ */ Y("hr", {}, `r${i.length}`));
|
|
1967
|
-
continue;
|
|
1968
|
-
}
|
|
1969
|
-
let m = sn.exec(f);
|
|
1970
|
-
if (m) {
|
|
1971
|
-
c(), l(), s.push(m[1]);
|
|
1972
|
-
continue;
|
|
1973
|
-
}
|
|
1974
|
-
let h = nn.exec(f), g = h ? null : rn.exec(f), _ = h ?? g;
|
|
1975
|
-
if (_) {
|
|
1976
|
-
c(), u(), o.push({
|
|
1977
|
-
depth: _[1].replace(/\t/g, " ").length,
|
|
1978
|
-
ordered: !!g,
|
|
1979
|
-
text: f.slice(_[0].length)
|
|
1980
|
-
});
|
|
1981
|
-
continue;
|
|
1982
|
-
}
|
|
1983
|
-
l(), u(), a.push(f);
|
|
1984
|
-
}
|
|
1985
|
-
return d(), /* @__PURE__ */ Y(S, { children: i });
|
|
1986
|
-
}
|
|
1987
|
-
//#endregion
|
|
1988
|
-
//#region src/components/MessageList.tsx
|
|
1989
|
-
var mn = 80;
|
|
1990
|
-
function hn({ at: e, locale: t }) {
|
|
1991
|
-
let n = new Date(e);
|
|
1992
|
-
return /* @__PURE__ */ Y("time", {
|
|
1993
|
-
class: "sqc-msg__time",
|
|
1994
|
-
dateTime: n.toISOString(),
|
|
1995
|
-
children: n.toLocaleTimeString(t.tag, {
|
|
1996
|
-
hour: "2-digit",
|
|
1997
|
-
minute: "2-digit"
|
|
1998
|
-
})
|
|
1999
|
-
});
|
|
2000
|
-
}
|
|
2001
|
-
function gn({ file: e, load: t }) {
|
|
2002
|
-
let [n, r] = W(null);
|
|
2003
|
-
return G(() => {
|
|
2004
|
-
let n = null, i = !0;
|
|
2005
|
-
return t(e.id).then((e) => {
|
|
2006
|
-
i && (n = URL.createObjectURL(e), r(n));
|
|
2007
|
-
}).catch(() => {}), () => {
|
|
2008
|
-
i = !1, n && URL.revokeObjectURL(n);
|
|
2009
|
-
};
|
|
2010
|
-
}, [e.id, t]), n ? /* @__PURE__ */ Y("img", {
|
|
2011
|
-
class: "sqc-attachment__image",
|
|
2012
|
-
src: n,
|
|
2013
|
-
alt: e.filename
|
|
2014
|
-
}) : /* @__PURE__ */ Y("span", {
|
|
2015
|
-
class: "sqc-chip sqc-chip--waiting",
|
|
2016
|
-
children: e.filename
|
|
2017
|
-
});
|
|
2018
|
-
}
|
|
2019
|
-
function _n({ files: e, load: t }) {
|
|
2020
|
-
return e.length === 0 || !t ? null : /* @__PURE__ */ Y("div", {
|
|
2021
|
-
class: "sqc-attachments sqc-attachments--sent",
|
|
2022
|
-
children: e.map((e) => e.kind === "image" ? /* @__PURE__ */ Y(gn, {
|
|
2023
|
-
file: e,
|
|
2024
|
-
load: t
|
|
2025
|
-
}, e.id) : /* @__PURE__ */ Y("span", {
|
|
2026
|
-
class: "sqc-chip",
|
|
2027
|
-
"data-kind": "document",
|
|
2028
|
-
children: /* @__PURE__ */ Y("span", {
|
|
2029
|
-
class: "sqc-chip__name",
|
|
2030
|
-
children: e.filename
|
|
2031
|
-
})
|
|
2032
|
-
}, e.id))
|
|
2033
|
-
});
|
|
2034
|
-
}
|
|
2035
|
-
function vn({ message: e, locale: t, assistantName: n, onChoice: r, onDecide: i, onLoadAttachment: a }) {
|
|
2036
|
-
let o = e.streaming && !e.content, s = !!e.approval;
|
|
2037
|
-
return /* @__PURE__ */ Y("div", {
|
|
2038
|
-
class: `sqc-msg sqc-msg--${e.role}${e.error ? " sqc-msg--error" : ""}`,
|
|
2039
|
-
children: [e.role === "assistant" && /* @__PURE__ */ Y("div", {
|
|
2040
|
-
class: "sqc-msg__who",
|
|
2041
|
-
children: [e.agent ? /* @__PURE__ */ Y(kt, {
|
|
2042
|
-
name: e.agent.name,
|
|
2043
|
-
color: e.agent.color,
|
|
2044
|
-
url: e.agent.avatarUrl
|
|
2045
|
-
}) : /* @__PURE__ */ Y(bn, {}), e.authorName ?? e.agent?.name ?? n]
|
|
2046
|
-
}), /* @__PURE__ */ Y("div", {
|
|
2047
|
-
class: "sqc-msg__bubble",
|
|
2048
|
-
children: [o ? /* @__PURE__ */ Y("span", {
|
|
2049
|
-
class: "sqc-typing",
|
|
2050
|
-
"aria-label": t.t.typing,
|
|
2051
|
-
children: [
|
|
2052
|
-
/* @__PURE__ */ Y("i", {}),
|
|
2053
|
-
/* @__PURE__ */ Y("i", {}),
|
|
2054
|
-
/* @__PURE__ */ Y("i", {})
|
|
2055
|
-
]
|
|
2056
|
-
}) : /* @__PURE__ */ Y("div", {
|
|
2057
|
-
class: "sqc-msg__body",
|
|
2058
|
-
children: [
|
|
2059
|
-
/* @__PURE__ */ Y(pn, {
|
|
2060
|
-
text: e.content,
|
|
2061
|
-
locale: t,
|
|
2062
|
-
onChoice: r
|
|
2063
|
-
}),
|
|
2064
|
-
e.streaming && /* @__PURE__ */ Y("span", {
|
|
2065
|
-
class: "sqc-caret",
|
|
2066
|
-
"aria-hidden": "true"
|
|
2067
|
-
}),
|
|
2068
|
-
s && /* @__PURE__ */ Y(Gt, {
|
|
2069
|
-
locale: t,
|
|
2070
|
-
call: e.content.trim() === "" ? e.approval : void 0,
|
|
2071
|
-
onDecide: i
|
|
2072
|
-
}),
|
|
2073
|
-
e.role === "assistant" && !s && !e.streaming && !e.error && Vt(e.content, t.code) && /* @__PURE__ */ Y(Kt, {
|
|
2074
|
-
locale: t,
|
|
2075
|
-
onPick: r
|
|
2076
|
-
}),
|
|
2077
|
-
e.unknownHandle && !e.streaming && /* @__PURE__ */ Y(yn, {
|
|
2078
|
-
message: e,
|
|
2079
|
-
locale: t
|
|
2080
|
-
}),
|
|
2081
|
-
/* @__PURE__ */ Y(_n, {
|
|
2082
|
-
files: e.attachments ?? [],
|
|
2083
|
-
load: a
|
|
2084
|
-
})
|
|
2085
|
-
]
|
|
2086
|
-
}), !o && /* @__PURE__ */ Y(hn, {
|
|
2087
|
-
at: e.createdAt,
|
|
2088
|
-
locale: t
|
|
2089
|
-
})]
|
|
2090
|
-
})]
|
|
2091
|
-
});
|
|
2092
|
-
}
|
|
2093
|
-
function yn({ message: e, locale: t }) {
|
|
2094
|
-
let n = e.offered ?? [];
|
|
2095
|
-
return /* @__PURE__ */ Y("p", {
|
|
2096
|
-
class: "sqc-msg__unaddressed",
|
|
2097
|
-
children: [
|
|
2098
|
-
/* @__PURE__ */ Y("span", { children: t.t.handles.unknown }),
|
|
2099
|
-
" ",
|
|
2100
|
-
/* @__PURE__ */ Y("code", { children: ["@", e.unknownHandle] }),
|
|
2101
|
-
n.length > 0 && /* @__PURE__ */ Y(S, { children: [
|
|
2102
|
-
" ",
|
|
2103
|
-
/* @__PURE__ */ Y("span", { children: t.t.handles.instead }),
|
|
2104
|
-
" ",
|
|
2105
|
-
n.map((e) => /* @__PURE__ */ Y("code", { children: ["@", e.handle] }, e.handle))
|
|
2106
|
-
] })
|
|
2107
|
-
]
|
|
2108
|
-
});
|
|
2109
|
-
}
|
|
2110
|
-
function bn() {
|
|
2111
|
-
return /* @__PURE__ */ Y("svg", {
|
|
2112
|
-
viewBox: "0 0 24 24",
|
|
2113
|
-
fill: "none",
|
|
2114
|
-
stroke: "currentColor",
|
|
2115
|
-
"stroke-width": "2",
|
|
2116
|
-
"stroke-linecap": "round",
|
|
2117
|
-
"stroke-linejoin": "round",
|
|
2118
|
-
"aria-hidden": "true",
|
|
2119
|
-
children: /* @__PURE__ */ Y("path", { d: "M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719" })
|
|
2120
|
-
});
|
|
2121
|
-
}
|
|
2122
|
-
function xn({ messages: e, locale: t, assistantName: n, suggestions: r, showSuggestions: i, busy: a, withHuman: o, onSuggestion: s, onChoice: c, onDecide: l, onLoadAttachment: u }) {
|
|
2123
|
-
let d = K(null), f = K(!0);
|
|
2124
|
-
return ge(() => {
|
|
2125
|
-
let e = d.current;
|
|
2126
|
-
e && f.current && (e.scrollTop = e.scrollHeight);
|
|
2127
|
-
}, [e]), G(() => {
|
|
2128
|
-
let e = d.current;
|
|
2129
|
-
if (!e) return;
|
|
2130
|
-
let t = () => {
|
|
2131
|
-
f.current = e.scrollHeight - e.scrollTop - e.clientHeight < mn;
|
|
2132
|
-
};
|
|
2133
|
-
return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
|
|
2134
|
-
}, []), /* @__PURE__ */ Y("div", {
|
|
2135
|
-
class: "sqc-messages",
|
|
2136
|
-
ref: d,
|
|
2137
|
-
role: "log",
|
|
2138
|
-
"aria-live": "polite",
|
|
2139
|
-
"aria-atomic": "false",
|
|
2140
|
-
children: [
|
|
2141
|
-
e.map((r, i) => /* @__PURE__ */ Y(vn, {
|
|
2142
|
-
message: r,
|
|
2143
|
-
locale: t,
|
|
2144
|
-
assistantName: n,
|
|
2145
|
-
onChoice: !a && r.role === "assistant" && i === e.length - 1 ? c : void 0,
|
|
2146
|
-
onDecide: !a && r.role === "assistant" && i === e.length - 1 ? l : void 0,
|
|
2147
|
-
onLoadAttachment: u
|
|
2148
|
-
}, r.id)),
|
|
2149
|
-
o && /* @__PURE__ */ Y("p", {
|
|
2150
|
-
class: "sqc-with-human",
|
|
2151
|
-
role: "status",
|
|
2152
|
-
children: t.t.withHuman
|
|
2153
|
-
}),
|
|
2154
|
-
i && r && r.length > 0 && /* @__PURE__ */ Y("div", {
|
|
2155
|
-
class: "sqc-suggestions",
|
|
2156
|
-
children: r.map((e) => /* @__PURE__ */ Y("button", {
|
|
2157
|
-
type: "button",
|
|
2158
|
-
class: "sqc-suggestion",
|
|
2159
|
-
onClick: () => s(e),
|
|
2160
|
-
children: e
|
|
2161
|
-
}, e))
|
|
2162
|
-
})
|
|
2163
|
-
]
|
|
2164
|
-
});
|
|
2165
|
-
}
|
|
2166
|
-
//#endregion
|
|
2167
|
-
//#region src/components/ChatbotWidget.tsx
|
|
2168
|
-
var Sn = { width: "min(392px, 100vw)" }, Cn = /* @__PURE__ */ new Set(["sessionId"]);
|
|
2169
|
-
function wn(e) {
|
|
2170
|
-
let t = e.replace(/Id$|Ref$/, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim().toLowerCase();
|
|
2171
|
-
return t ? t.charAt(0).toUpperCase() + t.slice(1) : e;
|
|
2172
|
-
}
|
|
2173
|
-
function Tn(e) {
|
|
2174
|
-
if (!e) return [];
|
|
2175
|
-
let t = [];
|
|
2176
|
-
for (let [n, r] of Object.entries(e)) {
|
|
2177
|
-
if (Cn.has(n) || typeof r != "string" && !Oe(r)) continue;
|
|
2178
|
-
let e = De(r);
|
|
2179
|
-
e && t.push({
|
|
2180
|
-
label: wn(n),
|
|
2181
|
-
value: e
|
|
2182
|
-
});
|
|
2183
|
-
}
|
|
2184
|
-
return t;
|
|
2185
|
-
}
|
|
2186
|
-
function En(e, t) {
|
|
2187
|
-
return e?.trim() ? e : t;
|
|
2188
|
-
}
|
|
2189
|
-
function Dn(e) {
|
|
2190
|
-
let [t, n] = W(!1);
|
|
2191
|
-
return G(() => {
|
|
2192
|
-
if (e !== "auto" || typeof matchMedia != "function") return;
|
|
2193
|
-
let t = matchMedia("(prefers-color-scheme: dark)");
|
|
2194
|
-
n(t.matches);
|
|
2195
|
-
let r = (e) => n(e.matches);
|
|
2196
|
-
return t.addEventListener("change", r), () => t.removeEventListener("change", r);
|
|
2197
|
-
}, [e]), e === "dark" ? "dark" : e === "light" ? "light" : t ? "dark" : "light";
|
|
2198
|
-
}
|
|
2199
|
-
function On(e) {
|
|
2200
|
-
let t = e.persistOpen ?? !0, [n, r] = W(() => Be(e.defaultOpen, t)), [i, a] = W(!1), [o, s] = W(!1), c = K(null), l = K(null), u = Dn(e.theme ?? "light"), d = _e(() => Ie(e.locale), [e.locale]), f = d.t, p = En(e.heading, f.heading), m = En(e.assistantName, f.assistant), h = En(e.greeting, f.greeting), g = e.onEvent, { send: _, reset: v, decide: y, stop: b, start: x, busy: S, messages: C, withHuman: w, branding: T, sessionId: E, handles: D, addressee: O, agentHandle: k, attachments: A, uploading: j, attachmentError: M, attach: N, detach: P, loadAttachment: F } = Dt({
|
|
2201
|
-
embedKey: e.embedKey,
|
|
2202
|
-
user: e.user,
|
|
2203
|
-
getSubjectToken: e.getSubjectToken,
|
|
2204
|
-
agent: e.agent,
|
|
2205
|
-
context: e.context,
|
|
2206
|
-
greeting: h,
|
|
2207
|
-
locale: d,
|
|
2208
|
-
onEvent: g
|
|
2209
|
-
});
|
|
2210
|
-
G(() => {
|
|
2211
|
-
!n && C.some((e) => e.role === "assistant" && e.id !== "greeting") && s(!0);
|
|
2212
|
-
}, [C, n]);
|
|
2213
|
-
let I = K(n);
|
|
2214
|
-
I.current = n;
|
|
2215
|
-
let ee = q(() => {
|
|
2216
|
-
s(!1), !I.current && (I.current = !0, r(!0), t && ze(!0), g?.({
|
|
2217
|
-
type: "chatbot-open",
|
|
2218
|
-
sessionId: E
|
|
2219
|
-
}));
|
|
2220
|
-
}, [
|
|
2221
|
-
g,
|
|
2222
|
-
t,
|
|
2223
|
-
E
|
|
2224
|
-
]), L = q(() => {
|
|
2225
|
-
I.current && (I.current = !1, r(!1), t && ze(!1), g?.({
|
|
2226
|
-
type: "chatbot-close",
|
|
2227
|
-
sessionId: E
|
|
2228
|
-
}), l.current?.focus());
|
|
2229
|
-
}, [
|
|
2230
|
-
g,
|
|
2231
|
-
t,
|
|
2232
|
-
E
|
|
2233
|
-
]);
|
|
2234
|
-
G(() => {
|
|
2235
|
-
n && x();
|
|
2236
|
-
}, [n, x]);
|
|
2237
|
-
let te = D.length >= 2, R = Ve(C, k || void 0), [ne, re] = W(void 0), ie = K(void 0), ae = q((e) => {
|
|
2238
|
-
ie.current = e, re(e);
|
|
2239
|
-
}, []);
|
|
2240
|
-
G(() => {
|
|
2241
|
-
ie.current = void 0, re(void 0);
|
|
2242
|
-
}, [R]);
|
|
2243
|
-
let z = q((e) => {
|
|
2244
|
-
a(!0), _(te ? He(e, ie.current, R) : e);
|
|
2245
|
-
}, [
|
|
2246
|
-
_,
|
|
2247
|
-
te,
|
|
2248
|
-
R
|
|
2249
|
-
]), B = q(() => {
|
|
2250
|
-
a(!1), s(!1), v();
|
|
2251
|
-
}, [v]), V = K({
|
|
2252
|
-
openPanel: ee,
|
|
2253
|
-
closePanel: L,
|
|
2254
|
-
send: z,
|
|
2255
|
-
reset: B,
|
|
2256
|
-
sessionId: E
|
|
2257
|
-
});
|
|
2258
|
-
V.current = {
|
|
2259
|
-
openPanel: ee,
|
|
2260
|
-
closePanel: L,
|
|
2261
|
-
send: z,
|
|
2262
|
-
reset: B,
|
|
2263
|
-
sessionId: E
|
|
2264
|
-
};
|
|
2265
|
-
let oe = K({
|
|
2266
|
-
open: () => V.current.openPanel(),
|
|
2267
|
-
close: () => V.current.closePanel(),
|
|
2268
|
-
toggle: () => I.current ? V.current.closePanel() : V.current.openPanel(),
|
|
2269
|
-
reset: () => V.current.reset(),
|
|
2270
|
-
send: (e) => {
|
|
2271
|
-
V.current.openPanel(), V.current.send(e);
|
|
2272
|
-
},
|
|
2273
|
-
isOpen: () => I.current,
|
|
2274
|
-
sessionId: () => V.current.sessionId
|
|
2275
|
-
}), H = e.bind;
|
|
2276
|
-
ge(() => (H?.(oe.current), () => H?.(null)), [H]), G(() => {
|
|
2277
|
-
if (!n) return;
|
|
2278
|
-
let e = (e) => {
|
|
2279
|
-
e.key === "Escape" && (e.stopPropagation(), L());
|
|
2280
|
-
};
|
|
2281
|
-
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
2282
|
-
}, [L, n]);
|
|
2283
|
-
let se = _e(() => C.some((e) => e.id !== "greeting"), [C]), U = _e(() => Tn(e.context), [e.context]), ce = {
|
|
2284
|
-
...e.accent ? { "--sqc-accent": e.accent } : {},
|
|
2285
|
-
"--sqc-width": e.width ?? Sn.width
|
|
2286
|
-
};
|
|
2287
|
-
return /* @__PURE__ */ Y("div", {
|
|
2288
|
-
class: "sqc",
|
|
2289
|
-
"data-theme": u,
|
|
2290
|
-
"data-position": e.position ?? "bottom-right",
|
|
2291
|
-
"data-layout": e.layout ?? "sidebar",
|
|
2292
|
-
"data-open": n ? "true" : "false",
|
|
2293
|
-
style: ce,
|
|
2294
|
-
children: [/* @__PURE__ */ Y("button", {
|
|
2295
|
-
ref: l,
|
|
2296
|
-
type: "button",
|
|
2297
|
-
class: "sqc-launcher",
|
|
2298
|
-
"aria-label": p,
|
|
2299
|
-
"aria-expanded": n,
|
|
2300
|
-
"aria-haspopup": "dialog",
|
|
2301
|
-
onClick: ee,
|
|
2302
|
-
children: [/* @__PURE__ */ Y("span", {
|
|
2303
|
-
class: "sqc-launcher__icon",
|
|
2304
|
-
children: /* @__PURE__ */ Y("slot", {
|
|
2305
|
-
name: "launcher-icon",
|
|
2306
|
-
class: "sqc-slot-icon",
|
|
2307
|
-
children: /* @__PURE__ */ Y(bn, {})
|
|
2308
|
-
})
|
|
2309
|
-
}), o && /* @__PURE__ */ Y("span", {
|
|
2310
|
-
class: "sqc-launcher__badge",
|
|
2311
|
-
"aria-hidden": "true"
|
|
2312
|
-
})]
|
|
2313
|
-
}), /* @__PURE__ */ Y("aside", {
|
|
2314
|
-
ref: c,
|
|
2315
|
-
class: "sqc-panel",
|
|
2316
|
-
role: "dialog",
|
|
2317
|
-
"aria-modal": "false",
|
|
2318
|
-
"aria-label": p,
|
|
2319
|
-
...n ? {} : { inert: !0 },
|
|
2320
|
-
children: [/* @__PURE__ */ Y("header", {
|
|
2321
|
-
class: "sqc-header",
|
|
2322
|
-
children: [
|
|
2323
|
-
/* @__PURE__ */ Y("span", {
|
|
2324
|
-
class: "sqc-header__icon",
|
|
2325
|
-
"aria-hidden": "true",
|
|
2326
|
-
children: /* @__PURE__ */ Y(bn, {})
|
|
2327
|
-
}),
|
|
2328
|
-
/* @__PURE__ */ Y("div", {
|
|
2329
|
-
class: "sqc-header__titles",
|
|
2330
|
-
children: [/* @__PURE__ */ Y("p", {
|
|
2331
|
-
class: "sqc-header__heading",
|
|
2332
|
-
children: p
|
|
2333
|
-
}), /* @__PURE__ */ Y("p", {
|
|
2334
|
-
class: "sqc-header__sub",
|
|
2335
|
-
children: En(e.subheading, f.subheading)
|
|
2336
|
-
})]
|
|
2337
|
-
}),
|
|
2338
|
-
/* @__PURE__ */ Y("button", {
|
|
2339
|
-
type: "button",
|
|
2340
|
-
class: "sqc-icon-btn",
|
|
2341
|
-
onClick: B,
|
|
2342
|
-
"aria-label": f.newConversation,
|
|
2343
|
-
"data-tip": f.newConversation,
|
|
2344
|
-
children: /* @__PURE__ */ Y("svg", {
|
|
2345
|
-
viewBox: "0 0 24 24",
|
|
2346
|
-
fill: "none",
|
|
2347
|
-
stroke: "currentColor",
|
|
2348
|
-
"stroke-width": "1.8",
|
|
2349
|
-
children: /* @__PURE__ */ Y("path", {
|
|
2350
|
-
d: "M20 12a8 8 0 1 1-2.6-5.9M20 4v4h-4",
|
|
2351
|
-
"stroke-linecap": "round"
|
|
2352
|
-
})
|
|
2353
|
-
})
|
|
2354
|
-
}),
|
|
2355
|
-
/* @__PURE__ */ Y("button", {
|
|
2356
|
-
type: "button",
|
|
2357
|
-
class: "sqc-icon-btn",
|
|
2358
|
-
onClick: L,
|
|
2359
|
-
"aria-label": f.close,
|
|
2360
|
-
"data-tip": f.closeTitle,
|
|
2361
|
-
children: /* @__PURE__ */ Y("svg", {
|
|
2362
|
-
viewBox: "0 0 24 24",
|
|
2363
|
-
fill: "none",
|
|
2364
|
-
stroke: "currentColor",
|
|
2365
|
-
"stroke-width": "1.8",
|
|
2366
|
-
children: /* @__PURE__ */ Y("path", {
|
|
2367
|
-
d: "M6 6l12 12M18 6L6 18",
|
|
2368
|
-
"stroke-linecap": "round"
|
|
2369
|
-
})
|
|
2370
|
-
})
|
|
2371
|
-
})
|
|
2372
|
-
]
|
|
2373
|
-
}), /* @__PURE__ */ Y("div", {
|
|
2374
|
-
class: "sqc-panel__body",
|
|
2375
|
-
children: [te && /* @__PURE__ */ Y(jt, {
|
|
2376
|
-
handles: D,
|
|
2377
|
-
active: ne ?? R,
|
|
2378
|
-
disabled: w,
|
|
2379
|
-
onPick: ae,
|
|
2380
|
-
label: f.handles.rail
|
|
2381
|
-
}), /* @__PURE__ */ Y("div", {
|
|
2382
|
-
class: "sqc-panel__main",
|
|
2383
|
-
children: [
|
|
2384
|
-
U.length > 0 && /* @__PURE__ */ Y("div", {
|
|
2385
|
-
class: "sqc-context",
|
|
2386
|
-
"aria-label": f.context.region,
|
|
2387
|
-
children: U.map((e) => /* @__PURE__ */ Y("span", {
|
|
2388
|
-
class: "sqc-chip",
|
|
2389
|
-
title: `${e.label}: ${e.value}`,
|
|
2390
|
-
children: [/* @__PURE__ */ Y("b", { children: e.label }), e.value]
|
|
2391
|
-
}, e.label))
|
|
2392
|
-
}),
|
|
2393
|
-
/* @__PURE__ */ Y(xn, {
|
|
2394
|
-
messages: C,
|
|
2395
|
-
locale: d,
|
|
2396
|
-
assistantName: m,
|
|
2397
|
-
suggestions: e.suggestions,
|
|
2398
|
-
showSuggestions: !i && !se,
|
|
2399
|
-
busy: S,
|
|
2400
|
-
withHuman: w,
|
|
2401
|
-
onSuggestion: z,
|
|
2402
|
-
onChoice: z,
|
|
2403
|
-
onDecide: y,
|
|
2404
|
-
onLoadAttachment: F
|
|
2405
|
-
}),
|
|
2406
|
-
/* @__PURE__ */ Y(Lt, {
|
|
2407
|
-
placeholder: En(e.placeholder, f.placeholder),
|
|
2408
|
-
locale: d,
|
|
2409
|
-
busy: S,
|
|
2410
|
-
autoFocus: n,
|
|
2411
|
-
handles: D,
|
|
2412
|
-
addressee: O,
|
|
2413
|
-
attachments: A,
|
|
2414
|
-
uploading: j,
|
|
2415
|
-
attachmentError: M ? f.attachments[M] : void 0,
|
|
2416
|
-
onAttach: N,
|
|
2417
|
-
onDetach: P,
|
|
2418
|
-
onSend: z,
|
|
2419
|
-
onStop: b
|
|
2420
|
-
}),
|
|
2421
|
-
/* @__PURE__ */ Y("p", {
|
|
2422
|
-
class: "sqc-hint",
|
|
2423
|
-
children: f.hint
|
|
2424
|
-
}),
|
|
2425
|
-
T && /* @__PURE__ */ Y("p", {
|
|
2426
|
-
class: "sqc-powered",
|
|
2427
|
-
children: /* @__PURE__ */ Y("a", {
|
|
2428
|
-
href: "https://squadico.com",
|
|
2429
|
-
target: "_blank",
|
|
2430
|
-
rel: "noopener noreferrer",
|
|
2431
|
-
children: f.poweredBy
|
|
2432
|
-
})
|
|
2433
|
-
})
|
|
2434
|
-
]
|
|
2435
|
-
})]
|
|
2436
|
-
})]
|
|
2437
|
-
})]
|
|
2438
|
-
});
|
|
2439
|
-
}
|
|
2440
|
-
//#endregion
|
|
2441
|
-
//#region src/styles.css?inline
|
|
2442
|
-
var kn = ":host{--sqc-width:min(392px, 100vw);--sqc-height:640px;--sqc-z:2147480000;--sqc-radius:16px;--sqc-font-family:\"Plus Jakarta Sans\", ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif;--sqc-font-heading:var(--sqc-font-family);z-index:var(--sqc-z);pointer-events:none;font-family:var(--sqc-font-family);-webkit-font-smoothing:antialiased;text-align:left;font-size:14px;line-height:1.5;display:block;position:fixed;top:0;bottom:0;left:0;right:0;margin:0!important}:host([hidden]){display:none}.sqc{--sqc-neutral-50:#f8fafc;--sqc-neutral-100:#f1f5f9;--sqc-neutral-200:#e2e8f0;--sqc-neutral-300:#cbd5e1;--sqc-neutral-400:#94a3b8;--sqc-neutral-500:#64748b;--sqc-neutral-600:#475569;--sqc-neutral-900:#0f172a;--sqc-error-50:#fff1f2;--sqc-error-100:#ffe4e6;--sqc-error-600:#e11d48;--sqc-accent-default:#000;--sqc-accent-color:var(--sqc-accent,var(--sqc-accent-default));--sqc-on-accent:#fff;--sqc-accent-hover:color-mix(in oklab, var(--sqc-accent-color) 84%, var(--sqc-on-accent));--sqc-accent-fg:var(--sqc-accent,var(--sqc-text));--sqc-bg:#fff;--sqc-surface:var(--sqc-neutral-50);--sqc-selected:var(--sqc-neutral-100);--sqc-border:var(--sqc-neutral-200);--sqc-border-strong:var(--sqc-neutral-300);--sqc-text:var(--sqc-neutral-900);--sqc-text-muted:var(--sqc-neutral-500);--sqc-link:#2563eb;--sqc-bubble-user:var(--sqc-accent-color);--sqc-bubble-user-text:var(--sqc-on-accent);--sqc-code-bg:var(--sqc-neutral-100);--sqc-disabled:var(--sqc-neutral-300);--sqc-shadow:0 10px 15px -3px #0f172a1a, 0 4px 6px -4px #0f172a1a;--sqc-shadow-bottom:0 6px 8px -6px #0f172a2e;--sqc-focus:0 0 0 2px var(--sqc-bg), 0 0 0 4px #0f172a4d;--sqc-focus-input:0 0 0 3px #0f172a1a;--sqc-danger:var(--sqc-error-600);color:var(--sqc-text);position:absolute;top:0;bottom:0;left:0;right:0}.sqc[data-theme=dark]{--sqc-neutral-50:#172033;--sqc-neutral-100:#1e293b;--sqc-neutral-200:#334155;--sqc-neutral-300:#475569;--sqc-neutral-400:#64748b;--sqc-neutral-500:#94a3b8;--sqc-neutral-600:#cbd5e1;--sqc-neutral-900:#f8fafc;--sqc-error-50:#2a0a12;--sqc-error-100:#4c0519;--sqc-error-600:#fb7185;--sqc-accent-default:#fff;--sqc-on-accent:#0f172a;--sqc-bg:#0f172a;--sqc-link:#60a5fa;--sqc-code-bg:#020617;--sqc-shadow:0 10px 24px -4px #0000008c;--sqc-shadow-bottom:0 6px 8px -6px #0000008c;--sqc-focus:0 0 0 2px var(--sqc-bg), 0 0 0 4px #f8fafc59;--sqc-focus-input:0 0 0 3px #f8fafc1f}@supports (color:oklch(from red l c h)){.sqc{--sqc-on-accent:oklch(from var(--sqc-accent-color) clamp(.208, (.62 - l) * 1000, 1) 0 0)}}.sqc *,.sqc :before,.sqc :after{box-sizing:border-box}.sqc-launcher{background:var(--sqc-accent-color);width:56px;height:56px;color:var(--sqc-on-accent);cursor:pointer;pointer-events:auto;box-shadow:var(--sqc-shadow);border:none;border-radius:50%;place-items:center;padding:0;transition:transform .18s,opacity .18s,background .18s,box-shadow .18s;display:grid;position:absolute;bottom:24px;right:24px}.sqc[data-position=bottom-left] .sqc-launcher{left:24px;right:auto}.sqc-launcher:hover{background:var(--sqc-accent-hover);transform:scale(1.06)}.sqc-launcher:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc[data-open=true] .sqc-launcher{opacity:0;pointer-events:none;transform:scale(.5)}.sqc-launcher__icon svg{width:26px;height:26px;display:block}.sqc-slot-icon::slotted(*){justify-content:center;align-items:center;width:26px;height:26px;display:inline-flex}.sqc-launcher__badge{background:var(--sqc-error-600);border:2px solid var(--sqc-bg);border-radius:50%;width:12px;height:12px;position:absolute;top:6px;right:6px}.sqc-panel{width:var(--sqc-width);background:var(--sqc-bg);border-left:1px solid var(--sqc-border);box-shadow:var(--sqc-shadow);pointer-events:auto;visibility:hidden;flex-direction:column;transition:transform .26s cubic-bezier(.22,1,.36,1),visibility 0s linear .26s;display:flex;position:absolute;top:0;bottom:0;right:0;transform:translate(100%)}.sqc-panel__body{flex:1;min-height:0;display:flex}.sqc-panel__main{flex-direction:column;flex:1;min-width:0;min-height:0;display:flex}.sqc-rail{border-right:1px solid var(--sqc-border);background:color-mix(in oklab, var(--sqc-accent-color) 7%, var(--sqc-bg));flex-direction:column;flex-shrink:0;align-items:stretch;gap:6px;width:72px;padding:12px 0;display:flex;overflow:visible}.sqc-rail__item{color:var(--sqc-text-muted);font:inherit;cursor:pointer;background:0 0;border:0;flex-direction:column;align-items:center;gap:4px;padding:4px 0;display:flex;position:relative}.sqc-rail__label{white-space:nowrap;text-overflow:ellipsis;max-width:64px;font-size:10.5px;font-weight:500;line-height:1.2;overflow:hidden}.sqc-rail__item:hover,.sqc-rail__item[aria-pressed=true]{color:var(--sqc-text)}.sqc-rail__item[aria-pressed=true] .sqc-rail__label{font-weight:600}.sqc-rail__item .sqc-avatar{transition:box-shadow .15s}.sqc-rail__item[aria-pressed=true] .sqc-avatar{box-shadow:0 0 0 2px var(--sqc-bg), 0 0 0 4px var(--sqc-accent-color)}.sqc-rail__item:before{content:\"\";background:var(--sqc-text);border-radius:0 4px 4px 0;width:4px;height:0;transition:height .15s;position:absolute;top:24px;left:0;transform:translateY(-50%)}.sqc-rail__item:hover:before{height:12px}.sqc-rail__item[aria-pressed=true]:before{height:32px}.sqc-rail__item:focus-visible{outline:2px solid var(--sqc-accent-color);outline-offset:-2px;border-radius:8px}.sqc-rail__item:disabled{cursor:not-allowed;opacity:.5}.sqc-rail__item[data-tip]:after{content:attr(data-tip);z-index:2;background:var(--sqc-text);color:var(--sqc-bg);white-space:nowrap;pointer-events:none;opacity:0;border-radius:6px;padding:4px 8px;font-size:12px;font-weight:500;transition:opacity .12s;position:absolute;top:24px;left:calc(100% + 6px);transform:translateY(-50%)}.sqc-rail__item[data-tip]:hover:after{opacity:1}.sqc-rail__item[data-tip]:focus-visible:after{opacity:1}.sqc[data-open=true] .sqc-panel{visibility:visible;transition:transform .26s cubic-bezier(.22,1,.36,1),visibility;transform:translate(0)}.sqc[data-layout=floating] .sqc-panel{max-width:calc(100% - 48px);height:var(--sqc-height);border:1px solid var(--sqc-border);border-radius:var(--sqc-radius);opacity:0;transform-origin:100% 100%;max-height:calc(100% - 48px);transition:transform .22s cubic-bezier(.22,1,.36,1),opacity .22s,visibility 0s linear .22s;top:auto;bottom:24px;right:24px;overflow:hidden;transform:translateY(16px)scale(.96)}.sqc[data-layout=floating][data-position=bottom-left] .sqc-panel{transform-origin:0 100%;left:24px;right:auto}.sqc[data-layout=floating][data-open=true] .sqc-panel{opacity:1;transition:transform .22s cubic-bezier(.22,1,.36,1),opacity .22s,visibility;transform:none}.sqc-header{background:var(--sqc-bg);color:var(--sqc-text);border-bottom:1px solid var(--sqc-border);flex-shrink:0;align-items:center;gap:8px;padding:13px 12px 13px 16px;display:flex}.sqc-header__icon{color:var(--sqc-accent-fg);flex-shrink:0;place-items:center;display:grid}.sqc-header__icon svg{width:17px;height:17px;display:block}.sqc-header__titles{flex:1;min-width:0}.sqc-header__heading,.sqc-header__sub{text-overflow:ellipsis;white-space:nowrap;margin:0;overflow:hidden}.sqc-header__heading{font-family:var(--sqc-font-heading);letter-spacing:-.2px;font-size:15px;font-weight:700}.sqc-header__sub{color:var(--sqc-text-muted);font-size:12px}.sqc-icon-btn{width:26px;height:26px;color:var(--sqc-text-muted);cursor:pointer;background:0 0;border:none;border-radius:8px;flex-shrink:0;place-items:center;transition:background .15s;display:grid}.sqc-icon-btn:hover{background:var(--sqc-surface);color:var(--sqc-text)}.sqc-icon-btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-icon-btn svg{width:16px;height:16px}.sqc-icon-btn[data-tip]{position:relative}.sqc-icon-btn[data-tip]:after{content:attr(data-tip);z-index:6;background:var(--sqc-text);color:var(--sqc-bg);font-family:var(--sqc-font-family);white-space:nowrap;pointer-events:none;opacity:0;border-radius:8px;padding:4px 8px;font-size:11px;font-weight:500;line-height:1.3;transition:opacity .12s .15s;position:absolute;top:calc(100% + 6px);right:0}.sqc-icon-btn[data-tip]:hover:after{opacity:1}.sqc-icon-btn[data-tip]:focus-visible:after{opacity:1}.sqc-history-pop{z-index:5;position:absolute;top:54px;left:0;right:0}.sqc-history{background:var(--sqc-bg);max-height:320px;box-shadow:var(--sqc-shadow-bottom);flex-direction:column;display:flex;overflow-y:auto}.sqc-history__empty{color:var(--sqc-text-muted);text-align:center;margin:0;padding:14px 16px;font-size:12px}.sqc-history__item{border:none;border-bottom:1px solid var(--sqc-border);width:100%;color:var(--sqc-text);text-align:left;cursor:pointer;background:0 0;flex-direction:column;gap:2px;padding:10px 16px;transition:background .15s;display:flex}.sqc-history__item:last-child{border-bottom:none}.sqc-history__item:hover{background:var(--sqc-surface)}.sqc-history__item:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-history__item[aria-current=true]{background:var(--sqc-selected)}.sqc-history__item[aria-current=true] .sqc-history__title{color:var(--sqc-text);font-weight:600}.sqc-history__title{text-overflow:ellipsis;white-space:nowrap;font-size:13px;overflow:hidden}.sqc-history__date{color:var(--sqc-text-muted);font-size:11px}.sqc-context{background:var(--sqc-selected);border:1px solid var(--sqc-border);color:var(--sqc-text);border-radius:12px;flex-wrap:wrap;flex-shrink:0;align-items:center;gap:8px;margin:12px 16px 4px;padding:8px 11px;font-size:12px;display:flex}.sqc-chip{text-overflow:ellipsis;white-space:nowrap;align-items:baseline;gap:4px;max-width:100%;display:inline-flex;overflow:hidden}.sqc-chip b{font-weight:600}.sqc-chip:not(:last-child):after{content:\"·\";opacity:.5;margin-left:4px}.sqc-messages{overscroll-behavior:contain;background:var(--sqc-bg);scrollbar-width:thin;scrollbar-color:var(--sqc-neutral-300) transparent;flex-direction:column;flex:1;gap:13px;min-height:0;padding:12px 16px;display:flex;overflow-y:auto}.sqc-messages::-webkit-scrollbar{width:6px}.sqc-messages::-webkit-scrollbar-thumb{background:var(--sqc-neutral-300);border-radius:99px}.sqc-msg{flex-direction:column;max-width:93%;font-size:13.5px;display:flex}.sqc-msg--assistant{align-self:flex-start}.sqc-msg--user{align-self:flex-end}.sqc-msg__who{color:var(--sqc-text-muted);align-items:center;gap:6px;margin-bottom:4px;font-size:11px;font-weight:500;display:flex}.sqc-msg__who svg{width:12px;height:12px;color:var(--sqc-accent-fg);flex-shrink:0}.sqc-avatar{background:var(--sqc-accent-color);color:var(--sqc-on-accent);-webkit-user-select:none;user-select:none;flex-shrink:0;justify-content:center;align-items:center;font-weight:600;line-height:1;display:inline-flex;overflow:hidden}.sqc-avatar img{object-fit:cover;width:100%;height:100%}.sqc-msg__unaddressed{color:var(--sqc-text-muted);margin:8px 0 0;font-size:11.5px;line-height:1.5}.sqc-msg__unaddressed code{background:var(--sqc-code-bg);color:var(--sqc-text);border-radius:4px;margin-right:4px;padding:1px 4px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px}.sqc-msg--user .sqc-msg__bubble{background:var(--sqc-bubble-user);color:var(--sqc-bubble-user-text);border-radius:var(--sqc-radius) var(--sqc-radius) 4px var(--sqc-radius);padding:9px 13px}.sqc-msg--error .sqc-msg__bubble{background:var(--sqc-error-50);color:var(--sqc-error-600);border:1px solid var(--sqc-error-100);border-radius:12px;padding:11px}.sqc-msg__body{overflow-wrap:anywhere}.sqc-msg--assistant .sqc-msg__body{font-size:14px;line-height:1.6}.sqc-msg__body>:first-child{margin-top:0}.sqc-msg__body>:last-child{margin-bottom:0}.sqc-msg__body p{white-space:pre-wrap;margin:0 0 8px}.sqc-msg__body ul,.sqc-msg__body ol{margin:0 0 8px;padding-left:20px}.sqc-msg__body li{margin-bottom:3px}.sqc-msg__body code{background:var(--sqc-code-bg);border-radius:4px;padding:1px 4px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.85em}.sqc-msg--user .sqc-msg__body code{background:#ffffff38}.sqc-msg__body pre{background:var(--sqc-code-bg);border-radius:8px;margin:0 0 8px;padding:9px 11px;overflow-x:auto}.sqc-msg__body pre code{background:0 0;padding:0}.sqc-msg__body a{color:inherit;text-underline-offset:2px;text-decoration:underline}.sqc-msg--assistant .sqc-msg__body a{color:var(--sqc-link);text-decoration:none}.sqc-msg--assistant .sqc-msg__body a:hover{text-decoration:underline}.sqc-msg__body h3,.sqc-msg__body h4,.sqc-msg__body h5,.sqc-msg__body h6{font-family:var(--sqc-font-heading);letter-spacing:-.2px;margin:12px 0 6px;font-weight:700;line-height:1.3}.sqc-msg__body h3{font-size:1.05em}.sqc-msg__body h4{font-size:1em}.sqc-msg__body h5,.sqc-msg__body h6{font-size:.94em}.sqc-msg__body ul ul,.sqc-msg__body ul ol,.sqc-msg__body ol ul,.sqc-msg__body ol ol{margin:3px 0 0}.sqc-msg__body blockquote{border-left:2px solid var(--sqc-border-strong);color:var(--sqc-text-muted);white-space:pre-wrap;margin:0 0 8px;padding:2px 0 2px 10px}.sqc-msg--user .sqc-msg__body blockquote{color:inherit;opacity:.85;border-left-color:#ffffff73}.sqc-msg__body hr{border:0;border-top:1px solid var(--sqc-border);margin:10px 0}.sqc-msg--user .sqc-msg__body hr{border-top-color:#ffffff4d}.sqc-msg__body del{opacity:.7}.sqc-approval{flex-direction:column;gap:8px;margin:11px 0 2px;display:flex}.sqc-approval__actions{flex-wrap:wrap;gap:8px;display:flex}.sqc-approval__request{color:var(--sqc-text);margin:0;font-size:13px}.sqc-approval__args{border:1px solid var(--sqc-border);background:var(--sqc-surface);border-radius:12px;flex-direction:column;gap:4px;margin:0;padding:8px 10px;font-size:12px;display:flex}.sqc-approval__arg{gap:8px;display:flex}.sqc-approval__arg-name{color:var(--sqc-text-muted);flex:none;font-weight:500}.sqc-approval__arg-value{overflow-wrap:anywhere;min-width:0;color:var(--sqc-text);margin:0}.sqc-approval__btn{height:32px;font-family:var(--sqc-font-family);border:1px solid var(--sqc-border);background:var(--sqc-bg);color:var(--sqc-text);cursor:pointer;border-radius:12px;flex:auto;justify-content:center;align-items:center;padding:0 12px;font-size:13px;font-weight:500;transition:border-color .12s,background .12s;display:inline-flex}.sqc-approval__btn--yes:not(:disabled),.sqc-approval__btn--send:not(:disabled){background:var(--sqc-accent-color);color:var(--sqc-on-accent);border-color:#0000;font-weight:600}.sqc-approval__btn:hover:not(:disabled){border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-approval__btn--yes:hover:not(:disabled),.sqc-approval__btn--send:hover:not(:disabled){background:var(--sqc-accent-hover);border-color:#0000}.sqc-approval__btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-approval__btn:disabled{cursor:default}.sqc-approval__btn:disabled[aria-pressed=false]{opacity:.45}.sqc-approval__btn[aria-pressed=true]{border-color:var(--sqc-border-strong);background:var(--sqc-selected);color:var(--sqc-text);font-weight:600}.sqc-approval__edit{flex-direction:column;gap:8px;display:flex}.sqc-approval__input{width:100%;font-family:var(--sqc-font-family);color:var(--sqc-text);background:var(--sqc-bg);border:1px solid var(--sqc-border-strong);resize:vertical;border-radius:12px;padding:8px 10px;font-size:13px;line-height:1.4}.sqc-approval__input:focus-visible{border-color:var(--sqc-text);box-shadow:var(--sqc-focus-input);outline:none}.sqc-approval__btn--send{flex:none;align-self:flex-end}.sqc-confirm{gap:8px;margin:11px 0 2px;display:flex}.sqc-confirm__btn{height:32px;font-family:var(--sqc-font-family);border:1px solid var(--sqc-border);background:var(--sqc-bg);color:var(--sqc-text);cursor:pointer;border-radius:12px;flex:1 1 0;justify-content:center;align-items:center;padding:0 12px;font-size:13px;font-weight:500;transition:border-color .12s,background .12s;display:inline-flex}.sqc-confirm__btn--yes:not(:disabled){background:var(--sqc-accent-color);color:var(--sqc-on-accent);border-color:#0000;font-weight:600}.sqc-confirm__btn:hover:not(:disabled){border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-confirm__btn--yes:hover:not(:disabled){background:var(--sqc-accent-hover);border-color:#0000}.sqc-confirm__btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-confirm__btn:disabled{cursor:default}.sqc-confirm__btn:disabled[aria-pressed=false]{opacity:.45}.sqc-confirm__btn[aria-pressed=true]{border-color:var(--sqc-border-strong);background:var(--sqc-selected);color:var(--sqc-text);font-weight:600}.sqc-choices{flex-direction:column;gap:7px;margin:10px 0 2px;display:flex}.sqc-choice{width:100%;font-family:var(--sqc-font-family);text-align:left;color:var(--sqc-text);background:var(--sqc-bg);border:1px solid var(--sqc-border);cursor:pointer;border-radius:12px;align-items:center;gap:8px;padding:8px 11px;font-size:12.5px;transition:border-color .12s,background .12s;display:flex}.sqc-choice:hover:not(:disabled){border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-choice:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-choice:disabled{cursor:default}.sqc-choice:disabled[aria-pressed=false]{opacity:.55}.sqc-choice[aria-pressed=true]{border-color:var(--sqc-border-strong);background:var(--sqc-selected)}.sqc-choice__box{border:1.5px solid var(--sqc-border-strong);border-radius:4px;flex:none;justify-content:center;align-items:center;width:15px;height:15px;display:inline-flex}.sqc-choice__box--on{color:var(--sqc-on-accent);background:var(--sqc-accent-color);border-color:var(--sqc-accent-color)}.sqc-choice__box svg{width:11px;height:11px}.sqc-choice__label{overflow-wrap:anywhere}.sqc-choice__detail{color:var(--sqc-text-muted);margin-top:1px;font-size:11.5px;display:block}.sqc-selection{flex-direction:column;gap:10px;margin:2px 0;display:flex}.sqc-selection__question{flex-direction:column;gap:2px;display:flex}.sqc-selection__ask{font-family:var(--sqc-font-family);color:var(--sqc-text);margin:0;font-size:13px;font-weight:600}.sqc-selection__actions{display:flex}.sqc-selection__validate{height:32px;font-family:var(--sqc-font-family);color:var(--sqc-on-accent);background:var(--sqc-accent-color);cursor:pointer;border:1px solid #0000;border-radius:12px;flex:auto;justify-content:center;align-items:center;padding:0 12px;font-size:13px;font-weight:600;transition:filter .12s,background .12s;display:inline-flex}.sqc-selection__validate:hover:not(:disabled){background:var(--sqc-accent-hover)}.sqc-selection__validate:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-selection__validate:disabled{cursor:not-allowed;color:#fff;background:var(--sqc-disabled)}.sqc-selection__hint{font-family:var(--sqc-font-family);color:var(--sqc-text-muted);margin:0;font-size:11.5px}.sqc-table{scrollbar-width:thin;margin:0 0 8px;overflow-x:auto}.sqc-table table{border-collapse:collapse;min-width:100%;font-family:var(--sqc-font-family);white-space:nowrap;font-size:12.5px}.sqc-table th,.sqc-table td{text-align:left;vertical-align:top;border-bottom:1px solid var(--sqc-border);padding:6px 10px 6px 0}.sqc-table thead th{text-transform:uppercase;letter-spacing:.05em;color:var(--sqc-text-muted);font-size:10.5px;font-weight:600}.sqc-table tbody th{font-weight:500}.sqc-msg--user .sqc-table th,.sqc-msg--user .sqc-table td{border-bottom-color:#ffffff40}.sqc-msg--user .sqc-table thead th{color:#fffc}.sqc-table tbody tr:last-child th,.sqc-table tbody tr:last-child td{border-bottom:0}.sqc-msg__time{color:var(--sqc-text-muted);font-variant-numeric:tabular-nums;margin-top:3px;font-size:10px;display:block}.sqc-msg--user .sqc-msg__time{color:#ffffffb3;text-align:right}.sqc-caret{vertical-align:text-bottom;background:currentColor;width:2px;height:1em;margin-left:2px;animation:1s step-end infinite sqc-blink;display:inline-block}@keyframes sqc-blink{0%,to{opacity:1}50%{opacity:0}}.sqc-typing{gap:3px;padding:2px 0;display:inline-flex}.sqc-typing i{background:var(--sqc-neutral-400);border-radius:50%;width:5px;height:5px;animation:1.2s infinite sqc-pulse}.sqc-typing i:nth-child(2){animation-delay:.2s}.sqc-typing i:nth-child(3){animation-delay:.4s}@keyframes sqc-pulse{0%,60%,to{opacity:.25}30%{opacity:1}}.sqc-suggestions{flex-direction:column;gap:7px;display:flex}.sqc-suggestion{border:1px solid var(--sqc-border);background:var(--sqc-bg);width:100%;color:var(--sqc-text);font-family:var(--sqc-font-family);cursor:pointer;text-align:left;border-radius:12px;align-items:center;gap:8px;padding:8px 11px;font-size:12.5px;transition:background .15s,border-color .15s;display:flex}.sqc-suggestion:before{content:\"\";background:var(--sqc-accent-fg);border-radius:50%;flex:none;width:5px;height:5px}.sqc-suggestion:hover{background:var(--sqc-surface);border-color:var(--sqc-border-strong)}.sqc-suggestion:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-composer{border-top:1px solid var(--sqc-border);background:var(--sqc-bg);flex-wrap:wrap;flex-shrink:0;align-items:flex-end;gap:8px;padding:12px 14px;display:flex}.sqc-composer--dropping{outline:2px dashed var(--sqc-accent-color);outline-offset:-4px}.sqc-attachments{flex-wrap:wrap;flex-basis:100%;gap:6px;display:flex}.sqc-attachments--sent{margin-top:8px}.sqc-chip{border:1px solid var(--sqc-border);background:var(--sqc-selected);max-width:100%;color:var(--sqc-text);border-radius:999px;align-items:center;gap:4px;padding:3px 4px 3px 10px;font-size:12px;display:inline-flex}.sqc-chip--waiting{opacity:.6;padding-right:10px}.sqc-chip__name{text-overflow:ellipsis;white-space:nowrap;max-width:180px;overflow:hidden}.sqc-chip__remove{width:18px;height:18px;color:var(--sqc-text-muted);cursor:pointer;background:0 0;border:0;border-radius:999px;justify-content:center;align-items:center;padding:0;font-size:14px;line-height:1;display:inline-flex}.sqc-chip__remove:hover{background:var(--sqc-selected);color:var(--sqc-text)}.sqc-attachments__error{color:var(--sqc-error-600);flex-basis:100%;margin:0;font-size:12px}.sqc-attachment__image{border-radius:12px;max-width:100%;max-height:180px;display:block}.sqc-file-input{display:none}.sqc-btn--attach{color:var(--sqc-text-muted);background:0 0}.sqc-btn--attach:hover{background:var(--sqc-selected);color:var(--sqc-text)}.sqc-composer__field{flex:1;min-width:0;position:relative}.sqc-composer__input{border:1px solid var(--sqc-border-strong);background:var(--sqc-bg);width:100%;min-height:38px;max-height:132px;color:var(--sqc-text);font-family:var(--sqc-font-family);resize:none;border-radius:12px;outline:none;padding:9px 12px;font-size:13.5px;line-height:1.4;transition:border-color .15s,box-shadow .15s;display:block;overflow-y:hidden}.sqc-composer__input::placeholder{color:var(--sqc-neutral-400)}.sqc-composer__input:focus{border-color:var(--sqc-text);box-shadow:var(--sqc-focus-input)}.sqc-mentions{z-index:2;border:1px solid var(--sqc-border);background:var(--sqc-bg);max-height:184px;box-shadow:var(--sqc-shadow);scrollbar-width:thin;border-radius:12px;margin:0;padding:4px;list-style:none;position:absolute;bottom:calc(100% + 6px);left:0;right:0;overflow-y:auto}.sqc-mention{cursor:pointer;color:var(--sqc-text);border-radius:8px;align-items:baseline;gap:6px;padding:6px 8px;font-size:12.5px;display:flex}.sqc-mention--active{background:var(--sqc-neutral-100)}.sqc-mention__icon{flex-shrink:0}.sqc-mention__handle{font-weight:600}.sqc-mention__name{text-overflow:ellipsis;white-space:nowrap;color:var(--sqc-text-muted);overflow:hidden}.sqc-composer__count{color:var(--sqc-text-muted);pointer-events:none;font-variant-numeric:tabular-nums;font-size:10px;position:absolute;bottom:4px;right:8px}.sqc-btn{cursor:pointer;border:none;border-radius:12px;flex-shrink:0;place-items:center;width:38px;height:38px;transition:background .15s,opacity .15s;display:grid}.sqc-btn svg{width:17px;height:17px}.sqc-btn--send{background:var(--sqc-accent-color);color:var(--sqc-on-accent)}.sqc-btn--send:hover:not(:disabled){background:var(--sqc-accent-hover)}.sqc-btn--send:disabled{background:var(--sqc-disabled);color:#fff;cursor:not-allowed}.sqc-btn--stop{background:var(--sqc-bg);color:var(--sqc-text);border:1px solid var(--sqc-border)}.sqc-btn--stop:hover{border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-hint{padding:0 16px max(9px, env(safe-area-inset-bottom));color:var(--sqc-text-muted);text-align:center;flex-shrink:0;margin:0;font-size:10.5px;line-height:1.35}.sqc-powered{padding:0 16px max(9px, env(safe-area-inset-bottom));text-align:center;flex-shrink:0;margin:0;font-size:10.5px;line-height:1.35}.sqc-powered a{color:var(--sqc-text-muted);text-decoration:none}.sqc-powered a:hover{text-decoration:underline}@media (max-width:520px){.sqc{--sqc-width:100vw}.sqc-panel{border-left:none}.sqc-launcher{bottom:16px;right:16px}.sqc[data-position=bottom-left] .sqc-launcher{left:16px}.sqc[data-layout=floating] .sqc-panel,.sqc[data-layout=floating][data-position=bottom-left] .sqc-panel{border:none;border-radius:0;max-width:none;height:auto;max-height:none;top:0;bottom:0;left:0;right:0}}@media (prefers-reduced-motion:reduce){.sqc-launcher,.sqc-panel,.sqc-btn,.sqc-suggestion,.sqc-choice,.sqc-confirm__btn,.sqc-icon-btn,.sqc-icon-btn[data-tip]:after,.sqc-rail__item:before,.sqc-rail__item[data-tip]:after,.sqc-rail__item .sqc-avatar{transition:none}.sqc-typing i,.sqc-caret{animation:none}}.sqc-with-human{border:1px solid var(--sqc-border);background:var(--sqc-selected);color:var(--sqc-neutral-600);border-radius:12px;margin:8px 0 0;padding:8px 12px;font-size:13px}";
|
|
2443
|
-
//#endregion
|
|
2444
|
-
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/checkPrivateRedeclaration.js
|
|
2445
|
-
function An(e, t) {
|
|
2446
|
-
if (t.has(e)) throw TypeError("Cannot initialize the same private elements twice on an object");
|
|
2447
|
-
}
|
|
2448
|
-
//#endregion
|
|
2449
|
-
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/classPrivateMethodInitSpec.js
|
|
2450
|
-
function jn(e, t) {
|
|
2451
|
-
An(e, t), t.add(e);
|
|
2452
|
-
}
|
|
2453
|
-
//#endregion
|
|
2454
|
-
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/classPrivateFieldInitSpec.js
|
|
2455
|
-
function X(e, t, n) {
|
|
2456
|
-
An(e, t), t.set(e, n);
|
|
2457
|
-
}
|
|
2458
|
-
//#endregion
|
|
2459
|
-
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/assertClassBrand.js
|
|
2460
|
-
function Z(e, t, n) {
|
|
2461
|
-
if (typeof e == "function" ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
2462
|
-
throw TypeError("Private element is not present on this object");
|
|
2463
|
-
}
|
|
2464
|
-
//#endregion
|
|
2465
|
-
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/classPrivateFieldSet2.js
|
|
2466
|
-
function Q(e, t, n) {
|
|
2467
|
-
return e.set(Z(e, t), n), n;
|
|
2468
|
-
}
|
|
2469
|
-
//#endregion
|
|
2470
|
-
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/classPrivateFieldGet2.js
|
|
2471
|
-
function $(e, t) {
|
|
2472
|
-
return e.get(Z(e, t));
|
|
2473
|
-
}
|
|
2474
|
-
//#endregion
|
|
2475
|
-
//#region src/element.tsx
|
|
2476
|
-
var Mn = "squadico-chatbot", Nn = [
|
|
2477
|
-
"embed-key",
|
|
2478
|
-
"context",
|
|
2479
|
-
"user",
|
|
2480
|
-
"agent",
|
|
2481
|
-
"heading",
|
|
2482
|
-
"subheading",
|
|
2483
|
-
"assistant-name",
|
|
2484
|
-
"placeholder",
|
|
2485
|
-
"greeting",
|
|
2486
|
-
"suggestions",
|
|
2487
|
-
"width",
|
|
2488
|
-
"accent",
|
|
2489
|
-
"theme",
|
|
2490
|
-
"position",
|
|
2491
|
-
"layout",
|
|
2492
|
-
"open",
|
|
2493
|
-
"persist-open",
|
|
2494
|
-
"locale"
|
|
2495
|
-
], Pn;
|
|
2496
|
-
function Fn() {
|
|
2497
|
-
if (Pn !== void 0) return Pn;
|
|
2498
|
-
try {
|
|
2499
|
-
let e = new CSSStyleSheet();
|
|
2500
|
-
e.replaceSync(kn), Pn = e;
|
|
2501
|
-
} catch {
|
|
2502
|
-
Pn = null;
|
|
2503
|
-
}
|
|
2504
|
-
return Pn;
|
|
2505
|
-
}
|
|
2506
|
-
function In(e, t) {
|
|
2507
|
-
typeof console < "u" && console.warn(`[${Mn}] ${e}`, t ?? "");
|
|
2508
|
-
}
|
|
2509
|
-
function Ln(e) {
|
|
2510
|
-
if (!(!e || !e.trim())) try {
|
|
2511
|
-
let t = JSON.parse(e);
|
|
2512
|
-
if (t && typeof t == "object" && !Array.isArray(t)) {
|
|
2513
|
-
let e = t;
|
|
2514
|
-
if (typeof e.id == "string" && e.id) return {
|
|
2515
|
-
id: e.id,
|
|
2516
|
-
name: typeof e.name == "string" && e.name ? e.name : void 0,
|
|
2517
|
-
digest: typeof e.digest == "string" && e.digest ? e.digest : void 0
|
|
2518
|
-
};
|
|
2519
|
-
}
|
|
2520
|
-
In("the \"user\" attribute needs an object with an id", e);
|
|
2521
|
-
} catch (e) {
|
|
2522
|
-
In("the \"user\" attribute is not valid JSON", e);
|
|
2523
|
-
}
|
|
2524
|
-
}
|
|
2525
|
-
function Rn(e) {
|
|
2526
|
-
if (!(!e || !e.trim())) try {
|
|
2527
|
-
let t = JSON.parse(e);
|
|
2528
|
-
if (t && typeof t == "object" && !Array.isArray(t)) return t;
|
|
2529
|
-
In("the `context` attribute must be a JSON object", e);
|
|
2530
|
-
} catch (e) {
|
|
2531
|
-
In("the `context` attribute is not valid JSON", e);
|
|
2532
|
-
}
|
|
2533
|
-
}
|
|
2534
|
-
function zn(e) {
|
|
2535
|
-
if (!(!e || !e.trim())) {
|
|
2536
|
-
if (e.trim().startsWith("[")) try {
|
|
2537
|
-
let t = JSON.parse(e);
|
|
2538
|
-
if (Array.isArray(t)) return t.map(String);
|
|
2539
|
-
} catch (e) {
|
|
2540
|
-
In("the `suggestions` attribute is not valid JSON", e);
|
|
2541
|
-
return;
|
|
2542
|
-
}
|
|
2543
|
-
return e.split("|").map((e) => e.trim()).filter(Boolean);
|
|
2544
|
-
}
|
|
2545
|
-
}
|
|
2546
|
-
function Bn(e) {
|
|
2547
|
-
if (e !== null) return e !== "false" && e !== "0";
|
|
2548
|
-
}
|
|
2549
|
-
function Vn(e) {
|
|
2550
|
-
return e === "dark" || e === "light" || e === "auto" ? e : void 0;
|
|
2551
|
-
}
|
|
2552
|
-
function Hn(e) {
|
|
2553
|
-
return e === "bottom-left" || e === "bottom-right" ? e : void 0;
|
|
2554
|
-
}
|
|
2555
|
-
function Un(e) {
|
|
2556
|
-
return e === "floating" || e === "sidebar" ? e : void 0;
|
|
2557
|
-
}
|
|
2558
|
-
var Wn = [
|
|
2559
|
-
"context",
|
|
2560
|
-
"embedKey",
|
|
2561
|
-
"user",
|
|
2562
|
-
"getSubjectToken",
|
|
2563
|
-
"agent"
|
|
2564
|
-
];
|
|
2565
|
-
function Gn() {
|
|
2566
|
-
var e, t, n, r, i, a, o, s, c, l, u, d, f, p;
|
|
2567
|
-
return t = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap(), s = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), l = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakSet(), f = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new WeakMap(), e = class extends HTMLElement {
|
|
2568
|
-
constructor() {
|
|
2569
|
-
super(), jn(this, d), X(this, t, void 0), X(this, n, null), X(this, r, !1), X(this, i, !1), X(this, a, ""), X(this, o, void 0), X(this, s, void 0), X(this, c, void 0), X(this, l, void 0), X(this, u, void 0), X(this, f, (e) => {
|
|
2570
|
-
let { type: t, ...n } = e;
|
|
2571
|
-
Q(a, this, n.sessionId), this.dispatchEvent(new CustomEvent(t, {
|
|
2572
|
-
detail: n,
|
|
2573
|
-
bubbles: !0,
|
|
2574
|
-
composed: !0
|
|
2575
|
-
}));
|
|
2576
|
-
}), X(this, p, (e) => {
|
|
2577
|
-
Q(n, this, e), e && Q(a, this, e.sessionId());
|
|
2578
|
-
});
|
|
2579
|
-
let e = this.attachShadow({ mode: "open" }), m = Fn();
|
|
2580
|
-
if (m) e.adoptedStyleSheets = [m];
|
|
2581
|
-
else {
|
|
2582
|
-
let t = document.createElement("style");
|
|
2583
|
-
t.textContent = kn, e.append(t);
|
|
2584
|
-
}
|
|
2585
|
-
Q(t, this, document.createElement("div")), e.append($(t, this));
|
|
2586
|
-
for (let e of Wn) {
|
|
2587
|
-
if (!Object.hasOwn(this, e)) continue;
|
|
2588
|
-
let t = this[e];
|
|
2589
|
-
delete this[e], this[e] = t;
|
|
2590
|
-
}
|
|
2591
|
-
}
|
|
2592
|
-
connectedCallback() {
|
|
2593
|
-
Q(i, this, !0), Z(d, this, h).call(this);
|
|
2594
|
-
}
|
|
2595
|
-
disconnectedCallback() {
|
|
2596
|
-
Q(i, this, !1), ae(null, $(t, this)), Q(n, this, null);
|
|
2597
|
-
}
|
|
2598
|
-
attributeChangedCallback(e, t, r) {
|
|
2599
|
-
if (t !== r) {
|
|
2600
|
-
if (e === "open" && $(n, this)) {
|
|
2601
|
-
Bn(r) ? $(n, this).open() : $(n, this).close();
|
|
2602
|
-
return;
|
|
2603
|
-
}
|
|
2604
|
-
Z(d, this, m).call(this);
|
|
2605
|
-
}
|
|
2606
|
-
}
|
|
2607
|
-
get context() {
|
|
2608
|
-
return $(o, this) ?? Rn(this.getAttribute("context"));
|
|
2609
|
-
}
|
|
2610
|
-
set context(e) {
|
|
2611
|
-
Q(o, this, e), Z(d, this, m).call(this);
|
|
2612
|
-
}
|
|
2613
|
-
get embedKey() {
|
|
2614
|
-
return $(u, this) ?? this.getAttribute("embed-key") ?? void 0;
|
|
2615
|
-
}
|
|
2616
|
-
set embedKey(e) {
|
|
2617
|
-
Q(u, this, e), Z(d, this, m).call(this);
|
|
2618
|
-
}
|
|
2619
|
-
get user() {
|
|
2620
|
-
return $(s, this) ?? Ln(this.getAttribute("user"));
|
|
2621
|
-
}
|
|
2622
|
-
set user(e) {
|
|
2623
|
-
Q(s, this, e), Z(d, this, m).call(this);
|
|
2624
|
-
}
|
|
2625
|
-
get getSubjectToken() {
|
|
2626
|
-
return $(c, this);
|
|
2627
|
-
}
|
|
2628
|
-
set getSubjectToken(e) {
|
|
2629
|
-
Q(c, this, e), Z(d, this, m).call(this);
|
|
2630
|
-
}
|
|
2631
|
-
get agent() {
|
|
2632
|
-
return $(l, this) ?? this.getAttribute("agent") ?? void 0;
|
|
2633
|
-
}
|
|
2634
|
-
set agent(e) {
|
|
2635
|
-
Q(l, this, e), Z(d, this, m).call(this);
|
|
2636
|
-
}
|
|
2637
|
-
get open() {
|
|
2638
|
-
return $(n, this)?.isOpen() ?? Bn(this.getAttribute("open")) ?? !1;
|
|
2639
|
-
}
|
|
2640
|
-
set open(e) {
|
|
2641
|
-
e ? this.openChat() : this.closeChat();
|
|
2642
|
-
}
|
|
2643
|
-
get sessionId() {
|
|
2644
|
-
return $(n, this)?.sessionId() ?? $(a, this);
|
|
2645
|
-
}
|
|
2646
|
-
openChat() {
|
|
2647
|
-
$(n, this)?.open();
|
|
2648
|
-
}
|
|
2649
|
-
closeChat() {
|
|
2650
|
-
$(n, this)?.close();
|
|
2651
|
-
}
|
|
2652
|
-
toggleChat() {
|
|
2653
|
-
$(n, this)?.toggle();
|
|
2654
|
-
}
|
|
2655
|
-
reset() {
|
|
2656
|
-
$(n, this)?.reset();
|
|
2657
|
-
}
|
|
2658
|
-
sendMessage(e) {
|
|
2659
|
-
if (!$(n, this)) {
|
|
2660
|
-
In("sendMessage() called before the component was mounted — ignored");
|
|
2661
|
-
return;
|
|
2662
|
-
}
|
|
2663
|
-
$(n, this).send(e);
|
|
2664
|
-
}
|
|
2665
|
-
}, qe(e, "observedAttributes", Nn), e;
|
|
2666
|
-
function m() {
|
|
2667
|
-
$(r, this) || !$(i, this) || (Q(r, this, !0), queueMicrotask(() => {
|
|
2668
|
-
Q(r, this, !1), $(i, this) && Z(d, this, h).call(this);
|
|
2669
|
-
}));
|
|
2670
|
-
}
|
|
2671
|
-
function h() {
|
|
2672
|
-
let e = (e) => this.getAttribute(e) ?? void 0;
|
|
2673
|
-
ae(/* @__PURE__ */ Y(On, {
|
|
2674
|
-
embedKey: this.embedKey,
|
|
2675
|
-
context: this.context,
|
|
2676
|
-
user: this.user,
|
|
2677
|
-
getSubjectToken: this.getSubjectToken,
|
|
2678
|
-
agent: this.agent,
|
|
2679
|
-
heading: e("heading"),
|
|
2680
|
-
subheading: e("subheading"),
|
|
2681
|
-
assistantName: e("assistant-name"),
|
|
2682
|
-
placeholder: e("placeholder"),
|
|
2683
|
-
greeting: e("greeting"),
|
|
2684
|
-
suggestions: zn(this.getAttribute("suggestions")),
|
|
2685
|
-
width: e("width"),
|
|
2686
|
-
accent: e("accent"),
|
|
2687
|
-
theme: Vn(this.getAttribute("theme")),
|
|
2688
|
-
position: Hn(this.getAttribute("position")),
|
|
2689
|
-
layout: Un(this.getAttribute("layout")),
|
|
2690
|
-
defaultOpen: Bn(this.getAttribute("open")) ?? !1,
|
|
2691
|
-
persistOpen: Bn(this.getAttribute("persist-open")) ?? !0,
|
|
2692
|
-
locale: e("locale"),
|
|
2693
|
-
onEvent: $(f, this),
|
|
2694
|
-
bind: $(p, this)
|
|
2695
|
-
}), $(t, this));
|
|
2696
|
-
}
|
|
2697
|
-
}
|
|
2698
|
-
var Kn;
|
|
2699
|
-
function qn(e = Mn) {
|
|
2700
|
-
typeof window > "u" || typeof HTMLElement > "u" || (Kn ?? (Kn = Gn()), window.customElements.get(e) || window.customElements.define(e, Kn));
|
|
2701
|
-
}
|
|
2702
|
-
//#endregion
|
|
2703
|
-
//#region src/index.ts
|
|
2704
|
-
qn();
|
|
2705
|
-
//#endregion
|
|
2706
|
-
export { Ye as a, je as c, J as i, qn as n, Be as o, Je as r, Ae as s, Mn as t };
|
|
2707
|
-
|
|
2708
|
-
//# sourceMappingURL=src-2GKPJcbZ.js.map
|