@ariaflowagents/widget 0.6.13 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/widget.js +413 -427
- package/dist/widget.umd.cjs +2 -3
- package/package.json +1 -1
package/dist/widget.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
function
|
|
1
|
+
var Q, m, He, I, ye, Fe, Ue, Ie, ce, re, ae, q = {}, De = [], _t = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, ee = Array.isArray;
|
|
2
|
+
function T(t, e) {
|
|
3
3
|
for (var n in e) t[n] = e[n];
|
|
4
4
|
return t;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function ue(t) {
|
|
7
7
|
t && t.parentNode && t.parentNode.removeChild(t);
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
var o, i,
|
|
11
|
-
for (
|
|
12
|
-
if (arguments.length > 2 && (a.children = arguments.length > 3 ?
|
|
13
|
-
return
|
|
9
|
+
function L(t, e, n) {
|
|
10
|
+
var s, o, i, a = {};
|
|
11
|
+
for (i in e) i == "key" ? s = e[i] : i == "ref" ? o = e[i] : a[i] = e[i];
|
|
12
|
+
if (arguments.length > 2 && (a.children = arguments.length > 3 ? Q.call(arguments, 2) : n), typeof t == "function" && t.defaultProps != null) for (i in t.defaultProps) a[i] === void 0 && (a[i] = t.defaultProps[i]);
|
|
13
|
+
return O(t, a, s, o, null);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
var
|
|
17
|
-
return
|
|
15
|
+
function O(t, e, n, s, o) {
|
|
16
|
+
var i = { type: t, props: e, key: n, ref: s, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: o ?? ++He, __i: -1, __u: 0 };
|
|
17
|
+
return o == null && m.vnode != null && m.vnode(i), i;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function D(t) {
|
|
20
20
|
return t.children;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function J(t, e) {
|
|
23
23
|
this.props = t, this.context = e;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
if (e == null) return t.__ ?
|
|
25
|
+
function R(t, e) {
|
|
26
|
+
if (e == null) return t.__ ? R(t.__, t.__i + 1) : null;
|
|
27
27
|
for (var n; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) return n.__e;
|
|
28
|
-
return typeof t.type == "function" ?
|
|
28
|
+
return typeof t.type == "function" ? R(t) : null;
|
|
29
29
|
}
|
|
30
30
|
function Le(t) {
|
|
31
31
|
var e, n;
|
|
@@ -38,56 +38,56 @@ function Le(t) {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
function ve(t) {
|
|
41
|
-
(!t.__d && (t.__d = !0) &&
|
|
41
|
+
(!t.__d && (t.__d = !0) && I.push(t) && !X.__r++ || ye != m.debounceRendering) && ((ye = m.debounceRendering) || Fe)(X);
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
for (var t, e, n, o, i,
|
|
45
|
-
|
|
43
|
+
function X() {
|
|
44
|
+
for (var t, e, n, s, o, i, a, _ = 1; I.length; ) I.length > _ && I.sort(Ue), t = I.shift(), _ = I.length, t.__d && (n = void 0, s = void 0, o = (s = (e = t).__v).__e, i = [], a = [], e.__P && ((n = T({}, s)).__v = s.__v + 1, m.vnode && m.vnode(n), he(e.__P, n, s, e.__n, e.__P.namespaceURI, 32 & s.__u ? [o] : null, i, o ?? R(s), !!(32 & s.__u), a), n.__v = s.__v, n.__.__k[n.__i] = n, qe(i, n, a), s.__e = s.__ = null, n.__e != o && Le(n)));
|
|
45
|
+
X.__r = 0;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
var r,
|
|
49
|
-
for (c = ct(n, e, f, c,
|
|
50
|
-
return n.__e =
|
|
47
|
+
function Re(t, e, n, s, o, i, a, _, c, l, u) {
|
|
48
|
+
var r, g, h, v, k, w, p, f = s && s.__k || De, E = e.length;
|
|
49
|
+
for (c = ct(n, e, f, c, E), r = 0; r < E; r++) (h = n.__k[r]) != null && (g = h.__i == -1 ? q : f[h.__i] || q, h.__i = r, w = he(t, h, g, o, i, a, _, c, l, u), v = h.__e, h.ref && g.ref != h.ref && (g.ref && de(g.ref, null, h), u.push(h.ref, h.__c || v, h)), k == null && v != null && (k = v), (p = !!(4 & h.__u)) || g.__k === h.__k ? c = Oe(h, c, t, p) : typeof h.type == "function" && w !== void 0 ? c = w : v && (c = v.nextSibling), h.__u &= -7);
|
|
50
|
+
return n.__e = k, c;
|
|
51
51
|
}
|
|
52
|
-
function ct(t, e, n,
|
|
53
|
-
var
|
|
54
|
-
for (t.__k = new Array(
|
|
55
|
-
if (r) for (
|
|
56
|
-
return
|
|
52
|
+
function ct(t, e, n, s, o) {
|
|
53
|
+
var i, a, _, c, l, u = n.length, r = u, g = 0;
|
|
54
|
+
for (t.__k = new Array(o), i = 0; i < o; i++) (a = e[i]) != null && typeof a != "boolean" && typeof a != "function" ? (typeof a == "string" || typeof a == "number" || typeof a == "bigint" || a.constructor == String ? a = t.__k[i] = O(null, a, null, null, null) : ee(a) ? a = t.__k[i] = O(D, { children: a }, null, null, null) : a.constructor === void 0 && a.__b > 0 ? a = t.__k[i] = O(a.type, a.props, a.key, a.ref ? a.ref : null, a.__v) : t.__k[i] = a, c = i + g, a.__ = t, a.__b = t.__b + 1, _ = null, (l = a.__i = ut(a, n, c, r)) != -1 && (r--, (_ = n[l]) && (_.__u |= 2)), _ == null || _.__v == null ? (l == -1 && (o > u ? g-- : o < u && g++), typeof a.type != "function" && (a.__u |= 4)) : l != c && (l == c - 1 ? g-- : l == c + 1 ? g++ : (l > c ? g-- : g++, a.__u |= 4))) : t.__k[i] = null;
|
|
55
|
+
if (r) for (i = 0; i < u; i++) (_ = n[i]) != null && !(2 & _.__u) && (_.__e == s && (s = R(_)), Qe(_, _));
|
|
56
|
+
return s;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
var
|
|
58
|
+
function Oe(t, e, n, s) {
|
|
59
|
+
var o, i;
|
|
60
60
|
if (typeof t.type == "function") {
|
|
61
|
-
for (
|
|
61
|
+
for (o = t.__k, i = 0; o && i < o.length; i++) o[i] && (o[i].__ = t, e = Oe(o[i], e, n, s));
|
|
62
62
|
return e;
|
|
63
63
|
}
|
|
64
|
-
t.__e != e && (
|
|
64
|
+
t.__e != e && (s && (e && t.type && !e.parentNode && (e = R(t)), n.insertBefore(t.__e, e || null)), e = t.__e);
|
|
65
65
|
do
|
|
66
66
|
e = e && e.nextSibling;
|
|
67
67
|
while (e != null && e.nodeType == 8);
|
|
68
68
|
return e;
|
|
69
69
|
}
|
|
70
|
-
function ut(t, e, n,
|
|
71
|
-
var
|
|
70
|
+
function ut(t, e, n, s) {
|
|
71
|
+
var o, i, a, _ = t.key, c = t.type, l = e[n], u = l != null && (2 & l.__u) == 0;
|
|
72
72
|
if (l === null && _ == null || u && _ == l.key && c == l.type) return n;
|
|
73
|
-
if (
|
|
74
|
-
for (
|
|
73
|
+
if (s > (u ? 1 : 0)) {
|
|
74
|
+
for (o = n - 1, i = n + 1; o >= 0 || i < e.length; ) if ((l = e[a = o >= 0 ? o-- : i++]) != null && !(2 & l.__u) && _ == l.key && c == l.type) return a;
|
|
75
75
|
}
|
|
76
76
|
return -1;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function we(t, e, n) {
|
|
79
79
|
e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" || _t.test(e) ? n : n + "px";
|
|
80
80
|
}
|
|
81
|
-
function K(t, e, n,
|
|
82
|
-
var
|
|
81
|
+
function K(t, e, n, s, o) {
|
|
82
|
+
var i, a;
|
|
83
83
|
e: if (e == "style") if (typeof n == "string") t.style.cssText = n;
|
|
84
84
|
else {
|
|
85
|
-
if (typeof
|
|
86
|
-
if (n) for (e in n)
|
|
85
|
+
if (typeof s == "string" && (t.style.cssText = s = ""), s) for (e in s) n && e in n || we(t.style, e, "");
|
|
86
|
+
if (n) for (e in n) s && n[e] == s[e] || we(t.style, e, n[e]);
|
|
87
87
|
}
|
|
88
|
-
else if (e[0] == "o" && e[1] == "n")
|
|
88
|
+
else if (e[0] == "o" && e[1] == "n") i = e != (e = e.replace(Ie, "$1")), a = e.toLowerCase(), e = a in t || e == "onFocusOut" || e == "onFocusIn" ? a.slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + i] = n, n ? s ? n.u = s.u : (n.u = ce, t.addEventListener(e, i ? ae : re, i)) : t.removeEventListener(e, i ? ae : re, i);
|
|
89
89
|
else {
|
|
90
|
-
if (
|
|
90
|
+
if (o == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
91
91
|
else if (e != "width" && e != "height" && e != "href" && e != "list" && e != "form" && e != "tabIndex" && e != "download" && e != "rowSpan" && e != "colSpan" && e != "role" && e != "popover" && e in t) try {
|
|
92
92
|
t[e] = n ?? "";
|
|
93
93
|
break e;
|
|
@@ -96,398 +96,396 @@ function K(t, e, n, o, i) {
|
|
|
96
96
|
typeof n == "function" || (n == null || n === !1 && e[4] != "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && n == 1 ? "" : n));
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function be(t) {
|
|
100
100
|
return function(e) {
|
|
101
101
|
if (this.l) {
|
|
102
102
|
var n = this.l[e.type + t];
|
|
103
|
-
if (e.t == null) e.t =
|
|
103
|
+
if (e.t == null) e.t = ce++;
|
|
104
104
|
else if (e.t < n.u) return;
|
|
105
105
|
return n(m.event ? m.event(e) : e);
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
-
function he(t, e, n, o, i,
|
|
110
|
-
var u, r,
|
|
109
|
+
function he(t, e, n, s, o, i, a, _, c, l) {
|
|
110
|
+
var u, r, g, h, v, k, w, p, f, E, $, H, S, z, A, F, U, N = e.type;
|
|
111
111
|
if (e.constructor !== void 0) return null;
|
|
112
|
-
128 & n.__u && (c = !!(32 & n.__u),
|
|
112
|
+
128 & n.__u && (c = !!(32 & n.__u), i = [_ = e.__e = n.__e]), (u = m.__b) && u(e);
|
|
113
113
|
e: if (typeof N == "function") try {
|
|
114
|
-
if (p = e.props, f = "prototype" in N && N.prototype.render,
|
|
114
|
+
if (p = e.props, f = "prototype" in N && N.prototype.render, E = (u = N.contextType) && s[u.__c], $ = u ? E ? E.props.value : u.__ : s, n.__c ? w = (r = e.__c = n.__c).__ = r.__E : (f ? e.__c = r = new N(p, $) : (e.__c = r = new J(p, $), r.constructor = N, r.render = dt), E && E.sub(r), r.state || (r.state = {}), r.__n = s, g = r.__d = !0, r.__h = [], r._sb = []), f && r.__s == null && (r.__s = r.state), f && N.getDerivedStateFromProps != null && (r.__s == r.state && (r.__s = T({}, r.__s)), T(r.__s, N.getDerivedStateFromProps(p, r.__s))), h = r.props, v = r.state, r.__v = e, g) f && N.getDerivedStateFromProps == null && r.componentWillMount != null && r.componentWillMount(), f && r.componentDidMount != null && r.__h.push(r.componentDidMount);
|
|
115
115
|
else {
|
|
116
|
-
if (f && N.getDerivedStateFromProps == null && p !==
|
|
117
|
-
for (e.__v != n.__v && (r.props = p, r.state = r.__s, r.__d = !1), e.__e = n.__e, e.__k = n.__k, e.__k.some(function(
|
|
118
|
-
|
|
116
|
+
if (f && N.getDerivedStateFromProps == null && p !== h && r.componentWillReceiveProps != null && r.componentWillReceiveProps(p, $), e.__v == n.__v || !r.__e && r.shouldComponentUpdate != null && r.shouldComponentUpdate(p, r.__s, $) === !1) {
|
|
117
|
+
for (e.__v != n.__v && (r.props = p, r.state = r.__s, r.__d = !1), e.__e = n.__e, e.__k = n.__k, e.__k.some(function(P) {
|
|
118
|
+
P && (P.__ = e);
|
|
119
119
|
}), H = 0; H < r._sb.length; H++) r.__h.push(r._sb[H]);
|
|
120
120
|
r._sb = [], r.__h.length && a.push(r);
|
|
121
121
|
break e;
|
|
122
122
|
}
|
|
123
|
-
r.componentWillUpdate != null && r.componentWillUpdate(p, r.__s,
|
|
124
|
-
r.componentDidUpdate(
|
|
123
|
+
r.componentWillUpdate != null && r.componentWillUpdate(p, r.__s, $), f && r.componentDidUpdate != null && r.__h.push(function() {
|
|
124
|
+
r.componentDidUpdate(h, v, k);
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
if (r.context =
|
|
128
|
-
for (r.state = r.__s, r.__d = !1,
|
|
127
|
+
if (r.context = $, r.props = p, r.__P = t, r.__e = !1, S = m.__r, z = 0, f) {
|
|
128
|
+
for (r.state = r.__s, r.__d = !1, S && S(e), u = r.render(r.props, r.state, r.context), A = 0; A < r._sb.length; A++) r.__h.push(r._sb[A]);
|
|
129
129
|
r._sb = [];
|
|
130
130
|
} else do
|
|
131
|
-
r.__d = !1,
|
|
132
|
-
while (r.__d && ++
|
|
133
|
-
r.state = r.__s, r.getChildContext != null && (
|
|
134
|
-
} catch (
|
|
135
|
-
if (e.__v = null, c ||
|
|
131
|
+
r.__d = !1, S && S(e), u = r.render(r.props, r.state, r.context), r.state = r.__s;
|
|
132
|
+
while (r.__d && ++z < 25);
|
|
133
|
+
r.state = r.__s, r.getChildContext != null && (s = T(T({}, s), r.getChildContext())), f && !g && r.getSnapshotBeforeUpdate != null && (k = r.getSnapshotBeforeUpdate(h, v)), F = u, u != null && u.type === D && u.key == null && (F = Be(u.props.children)), _ = Re(t, ee(F) ? F : [F], e, n, s, o, i, a, _, c, l), r.base = e.__e, e.__u &= -161, r.__h.length && a.push(r), w && (r.__E = r.__ = null);
|
|
134
|
+
} catch (P) {
|
|
135
|
+
if (e.__v = null, c || i != null) if (P.then) {
|
|
136
136
|
for (e.__u |= c ? 160 : 128; _ && _.nodeType == 8 && _.nextSibling; ) _ = _.nextSibling;
|
|
137
|
-
|
|
137
|
+
i[i.indexOf(_)] = null, e.__e = _;
|
|
138
138
|
} else {
|
|
139
|
-
for (U =
|
|
140
|
-
|
|
139
|
+
for (U = i.length; U--; ) ue(i[U]);
|
|
140
|
+
le(e);
|
|
141
141
|
}
|
|
142
|
-
else e.__e = n.__e, e.__k = n.__k,
|
|
143
|
-
m.__e(
|
|
142
|
+
else e.__e = n.__e, e.__k = n.__k, P.then || le(e);
|
|
143
|
+
m.__e(P, e, n);
|
|
144
144
|
}
|
|
145
|
-
else
|
|
145
|
+
else i == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : _ = e.__e = ht(n.__e, e, n, s, o, i, a, c, l);
|
|
146
146
|
return (u = m.diffed) && u(e), 128 & e.__u ? void 0 : _;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
t && t.__c && (t.__c.__e = !0), t && t.__k && t.__k.forEach(
|
|
148
|
+
function le(t) {
|
|
149
|
+
t && t.__c && (t.__c.__e = !0), t && t.__k && t.__k.forEach(le);
|
|
150
150
|
}
|
|
151
151
|
function qe(t, e, n) {
|
|
152
|
-
for (var
|
|
153
|
-
m.__c && m.__c(e, t), t.some(function(
|
|
152
|
+
for (var s = 0; s < n.length; s++) de(n[s], n[++s], n[++s]);
|
|
153
|
+
m.__c && m.__c(e, t), t.some(function(o) {
|
|
154
154
|
try {
|
|
155
|
-
t =
|
|
156
|
-
|
|
155
|
+
t = o.__h, o.__h = [], t.some(function(i) {
|
|
156
|
+
i.call(o);
|
|
157
157
|
});
|
|
158
|
-
} catch (
|
|
159
|
-
m.__e(
|
|
158
|
+
} catch (i) {
|
|
159
|
+
m.__e(i, o.__v);
|
|
160
160
|
}
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
-
function
|
|
164
|
-
return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t :
|
|
163
|
+
function Be(t) {
|
|
164
|
+
return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : ee(t) ? t.map(Be) : T({}, t);
|
|
165
165
|
}
|
|
166
|
-
function
|
|
167
|
-
var l, u, r,
|
|
168
|
-
if (f == "svg" ?
|
|
169
|
-
for (l = 0; l <
|
|
170
|
-
t =
|
|
166
|
+
function ht(t, e, n, s, o, i, a, _, c) {
|
|
167
|
+
var l, u, r, g, h, v, k, w = n.props || q, p = e.props, f = e.type;
|
|
168
|
+
if (f == "svg" ? o = "http://www.w3.org/2000/svg" : f == "math" ? o = "http://www.w3.org/1998/Math/MathML" : o || (o = "http://www.w3.org/1999/xhtml"), i != null) {
|
|
169
|
+
for (l = 0; l < i.length; l++) if ((h = i[l]) && "setAttribute" in h == !!f && (f ? h.localName == f : h.nodeType == 3)) {
|
|
170
|
+
t = h, i[l] = null;
|
|
171
171
|
break;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
if (t == null) {
|
|
175
175
|
if (f == null) return document.createTextNode(p);
|
|
176
|
-
t = document.createElementNS(
|
|
176
|
+
t = document.createElementNS(o, f, p.is && p), _ && (m.__m && m.__m(e, i), _ = !1), i = null;
|
|
177
177
|
}
|
|
178
|
-
if (f == null)
|
|
178
|
+
if (f == null) w === p || _ && t.data == p || (t.data = p);
|
|
179
179
|
else {
|
|
180
|
-
if (
|
|
181
|
-
for (l in
|
|
182
|
-
if (l == "dangerouslySetInnerHTML") r =
|
|
180
|
+
if (i = i && Q.call(t.childNodes), !_ && i != null) for (w = {}, l = 0; l < t.attributes.length; l++) w[(h = t.attributes[l]).name] = h.value;
|
|
181
|
+
for (l in w) if (h = w[l], l != "children") {
|
|
182
|
+
if (l == "dangerouslySetInnerHTML") r = h;
|
|
183
183
|
else if (!(l in p)) {
|
|
184
184
|
if (l == "value" && "defaultValue" in p || l == "checked" && "defaultChecked" in p) continue;
|
|
185
|
-
K(t, l, null,
|
|
185
|
+
K(t, l, null, h, o);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
for (l in p)
|
|
188
|
+
for (l in p) h = p[l], l == "children" ? g = h : l == "dangerouslySetInnerHTML" ? u = h : l == "value" ? v = h : l == "checked" ? k = h : _ && typeof h != "function" || w[l] === h || K(t, l, h, w[l], o);
|
|
189
189
|
if (u) _ || r && (u.__html == r.__html || u.__html == t.innerHTML) || (t.innerHTML = u.__html), e.__k = [];
|
|
190
|
-
else if (r && (t.innerHTML = ""),
|
|
191
|
-
_ || (l = "value", f == "progress" && v == null ? t.removeAttribute("value") : v != null && (v !== t[l] || f == "progress" && !v || f == "option" && v !=
|
|
190
|
+
else if (r && (t.innerHTML = ""), Re(e.type == "template" ? t.content : t, ee(g) ? g : [g], e, n, s, f == "foreignObject" ? "http://www.w3.org/1999/xhtml" : o, i, a, i ? i[0] : n.__k && R(n, 0), _, c), i != null) for (l = i.length; l--; ) ue(i[l]);
|
|
191
|
+
_ || (l = "value", f == "progress" && v == null ? t.removeAttribute("value") : v != null && (v !== t[l] || f == "progress" && !v || f == "option" && v != w[l]) && K(t, l, v, w[l], o), l = "checked", k != null && k != t[l] && K(t, l, k, w[l], o));
|
|
192
192
|
}
|
|
193
193
|
return t;
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function de(t, e, n) {
|
|
196
196
|
try {
|
|
197
197
|
if (typeof t == "function") {
|
|
198
|
-
var
|
|
199
|
-
|
|
198
|
+
var s = typeof t.__u == "function";
|
|
199
|
+
s && t.__u(), s && e == null || (t.__u = t(e));
|
|
200
200
|
} else t.current = e;
|
|
201
|
-
} catch (
|
|
202
|
-
m.__e(
|
|
201
|
+
} catch (o) {
|
|
202
|
+
m.__e(o, n);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
function
|
|
206
|
-
var
|
|
207
|
-
if (m.unmount && m.unmount(t), (
|
|
208
|
-
if (
|
|
209
|
-
|
|
210
|
-
} catch (
|
|
211
|
-
m.__e(
|
|
205
|
+
function Qe(t, e, n) {
|
|
206
|
+
var s, o;
|
|
207
|
+
if (m.unmount && m.unmount(t), (s = t.ref) && (s.current && s.current != t.__e || de(s, null, e)), (s = t.__c) != null) {
|
|
208
|
+
if (s.componentWillUnmount) try {
|
|
209
|
+
s.componentWillUnmount();
|
|
210
|
+
} catch (i) {
|
|
211
|
+
m.__e(i, e);
|
|
212
212
|
}
|
|
213
|
-
|
|
213
|
+
s.base = s.__P = null;
|
|
214
214
|
}
|
|
215
|
-
if (
|
|
216
|
-
n ||
|
|
215
|
+
if (s = t.__k) for (o = 0; o < s.length; o++) s[o] && Qe(s[o], e, n || typeof t.type != "function");
|
|
216
|
+
n || ue(t.__e), t.__c = t.__ = t.__e = void 0;
|
|
217
217
|
}
|
|
218
218
|
function dt(t, e, n) {
|
|
219
219
|
return this.constructor(t, n);
|
|
220
220
|
}
|
|
221
|
-
function
|
|
222
|
-
var o, i,
|
|
223
|
-
e == document && (e = document.documentElement), m.__ && m.__(t, e),
|
|
221
|
+
function te(t, e, n) {
|
|
222
|
+
var s, o, i, a;
|
|
223
|
+
e == document && (e = document.documentElement), m.__ && m.__(t, e), o = (s = typeof n == "function") ? null : n && n.__k || e.__k, i = [], a = [], he(e, t = (!s && n || e).__k = L(D, null, [t]), o || q, q, e.namespaceURI, !s && n ? [n] : o ? null : e.firstChild ? Q.call(e.childNodes) : null, i, !s && n ? n : o ? o.__e : e.firstChild, s, a), qe(i, t, a);
|
|
224
224
|
}
|
|
225
225
|
function ze(t, e) {
|
|
226
|
-
|
|
226
|
+
te(t, e, ze);
|
|
227
227
|
}
|
|
228
|
-
function
|
|
229
|
-
var o, i,
|
|
230
|
-
for (
|
|
231
|
-
return arguments.length > 2 && (_.children = arguments.length > 3 ?
|
|
228
|
+
function je(t, e, n) {
|
|
229
|
+
var s, o, i, a, _ = T({}, t.props);
|
|
230
|
+
for (i in t.type && t.type.defaultProps && (a = t.type.defaultProps), e) i == "key" ? s = e[i] : i == "ref" ? o = e[i] : _[i] = e[i] === void 0 && a != null ? a[i] : e[i];
|
|
231
|
+
return arguments.length > 2 && (_.children = arguments.length > 3 ? Q.call(arguments, 2) : n), O(t.type, _, s || t.key, o || t.ref, null);
|
|
232
232
|
}
|
|
233
|
-
|
|
234
|
-
for (var
|
|
235
|
-
if ((
|
|
233
|
+
Q = De.slice, m = { __e: function(t, e, n, s) {
|
|
234
|
+
for (var o, i, a; e = e.__; ) if ((o = e.__c) && !o.__) try {
|
|
235
|
+
if ((i = o.constructor) && i.getDerivedStateFromError != null && (o.setState(i.getDerivedStateFromError(t)), a = o.__d), o.componentDidCatch != null && (o.componentDidCatch(t, s || {}), a = o.__d), a) return o.__E = o;
|
|
236
236
|
} catch (_) {
|
|
237
237
|
t = _;
|
|
238
238
|
}
|
|
239
239
|
throw t;
|
|
240
|
-
} }, He = 0,
|
|
240
|
+
} }, He = 0, J.prototype.setState = function(t, e) {
|
|
241
241
|
var n;
|
|
242
|
-
n = this.__s != null && this.__s != this.state ? this.__s : this.__s =
|
|
243
|
-
},
|
|
242
|
+
n = this.__s != null && this.__s != this.state ? this.__s : this.__s = T({}, this.state), typeof t == "function" && (t = t(T({}, n), this.props)), t && T(n, t), t != null && this.__v && (e && this._sb.push(e), ve(this));
|
|
243
|
+
}, J.prototype.forceUpdate = function(t) {
|
|
244
244
|
this.__v && (this.__e = !0, t && this.__h.push(t), ve(this));
|
|
245
|
-
},
|
|
245
|
+
}, J.prototype.render = D, I = [], Fe = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Ue = function(t, e) {
|
|
246
246
|
return t.__v.__b - e.__v.__b;
|
|
247
|
-
},
|
|
248
|
-
function
|
|
249
|
-
return
|
|
247
|
+
}, X.__r = 0, Ie = /(PointerCapture)$|Capture$/i, ce = 0, re = be(!1), ae = be(!0);
|
|
248
|
+
function Y() {
|
|
249
|
+
return Y = Object.assign ? Object.assign.bind() : function(t) {
|
|
250
250
|
for (var e = 1; e < arguments.length; e++) {
|
|
251
251
|
var n = arguments[e];
|
|
252
|
-
for (var
|
|
252
|
+
for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && (t[s] = n[s]);
|
|
253
253
|
}
|
|
254
254
|
return t;
|
|
255
|
-
},
|
|
255
|
+
}, Y.apply(this, arguments);
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function Ve(t, e) {
|
|
258
258
|
if (t == null) return {};
|
|
259
|
-
var n,
|
|
260
|
-
for (
|
|
261
|
-
return
|
|
259
|
+
var n, s, o = {}, i = Object.keys(t);
|
|
260
|
+
for (s = 0; s < i.length; s++) e.indexOf(n = i[s]) >= 0 || (o[n] = t[n]);
|
|
261
|
+
return o;
|
|
262
262
|
}
|
|
263
|
-
var
|
|
264
|
-
function pt(t, e, n,
|
|
265
|
-
function
|
|
266
|
-
var
|
|
267
|
-
return
|
|
263
|
+
var gt = ["context", "children"], ft = ["useFragment"];
|
|
264
|
+
function pt(t, e, n, s) {
|
|
265
|
+
function o() {
|
|
266
|
+
var i, a = Reflect.construct(HTMLElement, [], o);
|
|
267
|
+
return a._vdomComponent = t, s && s.shadow ? (a._root = a.attachShadow({ mode: s.mode || "open", serializable: (i = s.serializable) != null && i }), s.adoptedStyleSheets && (a._root.adoptedStyleSheets = s.adoptedStyleSheets)) : a._root = a, a;
|
|
268
268
|
}
|
|
269
|
-
return (
|
|
270
|
-
yt.call(this,
|
|
271
|
-
},
|
|
272
|
-
Object.defineProperty(
|
|
273
|
-
return this._vdom ? this._vdom.props[
|
|
269
|
+
return (o.prototype = Object.create(HTMLElement.prototype)).constructor = o, o.prototype.connectedCallback = function() {
|
|
270
|
+
yt.call(this, s);
|
|
271
|
+
}, o.prototype.attributeChangedCallback = vt, o.prototype.disconnectedCallback = wt, n = n || t.observedAttributes || Object.keys(t.propTypes || {}), o.observedAttributes = n, t.formAssociated && (o.formAssociated = !0), n.forEach(function(i) {
|
|
272
|
+
Object.defineProperty(o.prototype, i, { get: function() {
|
|
273
|
+
return this._vdom ? this._vdom.props[i] : this._props[i];
|
|
274
274
|
}, set: function(a) {
|
|
275
|
-
this._vdom ? this.attributeChangedCallback(
|
|
275
|
+
this._vdom ? this.attributeChangedCallback(i, null, a) : (this._props || (this._props = {}), this._props[i] = a);
|
|
276
276
|
var _ = typeof a;
|
|
277
|
-
a != null && _ !== "string" && _ !== "boolean" && _ !== "number" || this.setAttribute(
|
|
277
|
+
a != null && _ !== "string" && _ !== "boolean" && _ !== "number" || this.setAttribute(i, a);
|
|
278
278
|
} });
|
|
279
|
-
}), customElements.define(e,
|
|
279
|
+
}), customElements.define(e, o), o;
|
|
280
280
|
}
|
|
281
281
|
function mt(t) {
|
|
282
282
|
this.getChildContext = function() {
|
|
283
283
|
return t.context;
|
|
284
284
|
};
|
|
285
|
-
var e = t.children, n =
|
|
286
|
-
return
|
|
285
|
+
var e = t.children, n = Ve(t, gt);
|
|
286
|
+
return je(e, n);
|
|
287
287
|
}
|
|
288
288
|
function yt(t) {
|
|
289
289
|
var e = new CustomEvent("_preact", { detail: {}, bubbles: !0, cancelable: !0 });
|
|
290
|
-
this.dispatchEvent(e), this._vdom =
|
|
290
|
+
this.dispatchEvent(e), this._vdom = L(mt, Y({}, this._props, { context: e.detail.context }), Je(this, this._vdomComponent, t)), (this.hasAttribute("hydrate") ? ze : te)(this._vdom, this._root);
|
|
291
291
|
}
|
|
292
292
|
function Ke(t) {
|
|
293
293
|
return t.replace(/-(\w)/g, function(e, n) {
|
|
294
294
|
return n ? n.toUpperCase() : "";
|
|
295
295
|
});
|
|
296
296
|
}
|
|
297
|
-
function
|
|
297
|
+
function vt(t, e, n) {
|
|
298
298
|
if (this._vdom) {
|
|
299
|
-
var
|
|
300
|
-
|
|
299
|
+
var s = {};
|
|
300
|
+
s[t] = n = n ?? void 0, s[Ke(t)] = n, this._vdom = je(this._vdom, s), te(this._vdom, this._root);
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
|
-
function
|
|
304
|
-
|
|
303
|
+
function wt() {
|
|
304
|
+
te(this._vdom = null, this._root);
|
|
305
305
|
}
|
|
306
|
-
function
|
|
307
|
-
var n = this,
|
|
308
|
-
return
|
|
309
|
-
|
|
306
|
+
function Ce(t, e) {
|
|
307
|
+
var n = this, s = t.useFragment, o = Ve(t, ft);
|
|
308
|
+
return L(s ? D : "slot", Y({}, o, { ref: function(i) {
|
|
309
|
+
i ? (n.ref = i, n._listener || (n._listener = function(a) {
|
|
310
310
|
a.stopPropagation(), a.detail.context = e;
|
|
311
|
-
},
|
|
311
|
+
}, i.addEventListener("_preact", n._listener))) : n.ref.removeEventListener("_preact", n._listener);
|
|
312
312
|
} }));
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function Je(t, e, n) {
|
|
315
315
|
if (t.nodeType === 3) return t.data;
|
|
316
316
|
if (t.nodeType !== 1) return null;
|
|
317
|
-
var
|
|
318
|
-
for (
|
|
319
|
-
for (
|
|
320
|
-
var c =
|
|
321
|
-
l ?
|
|
317
|
+
var s = [], o = {}, i = 0, a = t.attributes, _ = t.childNodes;
|
|
318
|
+
for (i = a.length; i--; ) a[i].name !== "slot" && (o[a[i].name] = a[i].value, o[Ke(a[i].name)] = a[i].value);
|
|
319
|
+
for (i = _.length; i--; ) {
|
|
320
|
+
var c = Je(_[i], null, n), l = _[i].slot;
|
|
321
|
+
l ? o[l] = L(Ce, { name: l }, c) : s[i] = c;
|
|
322
322
|
}
|
|
323
|
-
var u = !(!n || !n.shadow), r = e ?
|
|
324
|
-
return !u && e && (t.innerHTML = ""),
|
|
323
|
+
var u = !(!n || !n.shadow), r = e ? L(Ce, { useFragment: !u }, s) : s;
|
|
324
|
+
return !u && e && (t.innerHTML = ""), L(e || t.nodeName.toLowerCase(), o, r);
|
|
325
325
|
}
|
|
326
326
|
var bt = 0;
|
|
327
|
-
function d(t, e, n, o, i
|
|
327
|
+
function d(t, e, n, s, o, i) {
|
|
328
328
|
e || (e = {});
|
|
329
329
|
var a, _, c = e;
|
|
330
330
|
if ("ref" in c) for (_ in c = {}, e) _ == "ref" ? a = e[_] : c[_] = e[_];
|
|
331
|
-
var l = { type: t, props: c, key: n, ref: a, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --bt, __i: -1, __u: 0, __source:
|
|
331
|
+
var l = { type: t, props: c, key: n, ref: a, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --bt, __i: -1, __u: 0, __source: o, __self: i };
|
|
332
332
|
if (typeof t == "function" && (a = t.defaultProps)) for (_ in a) c[_] === void 0 && (c[_] = a[_]);
|
|
333
333
|
return m.vnode && m.vnode(l), l;
|
|
334
334
|
}
|
|
335
|
-
var B,
|
|
336
|
-
function
|
|
337
|
-
C.__h && C.__h(
|
|
338
|
-
var n =
|
|
335
|
+
var B, y, se, ke, Z = 0, Ge = [], C = m, Se = C.__b, Ae = C.__r, $e = C.diffed, Ne = C.__c, xe = C.unmount, Pe = C.__;
|
|
336
|
+
function ge(t, e) {
|
|
337
|
+
C.__h && C.__h(y, t, Z || e), Z = 0;
|
|
338
|
+
var n = y.__H || (y.__H = { __: [], __h: [] });
|
|
339
339
|
return t >= n.__.length && n.__.push({}), n.__[t];
|
|
340
340
|
}
|
|
341
|
-
function
|
|
342
|
-
return
|
|
341
|
+
function M(t) {
|
|
342
|
+
return Z = 1, Ct(Ye, t);
|
|
343
343
|
}
|
|
344
344
|
function Ct(t, e, n) {
|
|
345
|
-
var
|
|
346
|
-
if (
|
|
347
|
-
var c =
|
|
348
|
-
c !== l && (
|
|
349
|
-
}],
|
|
350
|
-
var
|
|
351
|
-
if (!
|
|
352
|
-
var u =
|
|
353
|
-
return !!
|
|
345
|
+
var s = ge(B++, 2);
|
|
346
|
+
if (s.t = t, !s.__c && (s.__ = [Ye(void 0, e), function(_) {
|
|
347
|
+
var c = s.__N ? s.__N[0] : s.__[0], l = s.t(c, _);
|
|
348
|
+
c !== l && (s.__N = [l, s.__[1]], s.__c.setState({}));
|
|
349
|
+
}], s.__c = y, !y.__f)) {
|
|
350
|
+
var o = function(_, c, l) {
|
|
351
|
+
if (!s.__c.__H) return !0;
|
|
352
|
+
var u = s.__c.__H.__.filter(function(g) {
|
|
353
|
+
return !!g.__c;
|
|
354
354
|
});
|
|
355
|
-
if (u.every(function(
|
|
356
|
-
return !
|
|
357
|
-
})) return !
|
|
358
|
-
var r =
|
|
359
|
-
return u.forEach(function(
|
|
360
|
-
if (
|
|
361
|
-
var
|
|
362
|
-
|
|
355
|
+
if (u.every(function(g) {
|
|
356
|
+
return !g.__N;
|
|
357
|
+
})) return !i || i.call(this, _, c, l);
|
|
358
|
+
var r = s.__c.props !== _;
|
|
359
|
+
return u.forEach(function(g) {
|
|
360
|
+
if (g.__N) {
|
|
361
|
+
var h = g.__[0];
|
|
362
|
+
g.__ = g.__N, g.__N = void 0, h !== g.__[0] && (r = !0);
|
|
363
363
|
}
|
|
364
|
-
}),
|
|
364
|
+
}), i && i.call(this, _, c, l) || r;
|
|
365
365
|
};
|
|
366
|
-
|
|
367
|
-
var
|
|
368
|
-
|
|
366
|
+
y.__f = !0;
|
|
367
|
+
var i = y.shouldComponentUpdate, a = y.componentWillUpdate;
|
|
368
|
+
y.componentWillUpdate = function(_, c, l) {
|
|
369
369
|
if (this.__e) {
|
|
370
|
-
var u =
|
|
371
|
-
|
|
370
|
+
var u = i;
|
|
371
|
+
i = void 0, o(_, c, l), i = u;
|
|
372
372
|
}
|
|
373
373
|
a && a.call(this, _, c, l);
|
|
374
|
-
},
|
|
374
|
+
}, y.shouldComponentUpdate = o;
|
|
375
375
|
}
|
|
376
|
-
return
|
|
376
|
+
return s.__N || s.__;
|
|
377
377
|
}
|
|
378
|
-
function
|
|
379
|
-
var n =
|
|
380
|
-
!C.__s &&
|
|
378
|
+
function Ee(t, e) {
|
|
379
|
+
var n = ge(B++, 3);
|
|
380
|
+
!C.__s && Xe(n.__H, e) && (n.__ = t, n.u = e, y.__H.__h.push(n));
|
|
381
381
|
}
|
|
382
|
-
function
|
|
383
|
-
return
|
|
382
|
+
function We(t) {
|
|
383
|
+
return Z = 5, kt(function() {
|
|
384
384
|
return { current: t };
|
|
385
385
|
}, []);
|
|
386
386
|
}
|
|
387
387
|
function kt(t, e) {
|
|
388
|
-
var n =
|
|
389
|
-
return
|
|
388
|
+
var n = ge(B++, 7);
|
|
389
|
+
return Xe(n.__H, e) && (n.__ = t(), n.__H = e, n.__h = t), n.__;
|
|
390
390
|
}
|
|
391
|
-
function
|
|
392
|
-
for (var t; t =
|
|
393
|
-
t.__H.__h.forEach(
|
|
391
|
+
function St() {
|
|
392
|
+
for (var t; t = Ge.shift(); ) if (t.__P && t.__H) try {
|
|
393
|
+
t.__H.__h.forEach(G), t.__H.__h.forEach(_e), t.__H.__h = [];
|
|
394
394
|
} catch (e) {
|
|
395
395
|
t.__H.__h = [], C.__e(e, t.__v);
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
398
|
C.__b = function(t) {
|
|
399
|
-
|
|
399
|
+
y = null, Se && Se(t);
|
|
400
400
|
}, C.__ = function(t, e) {
|
|
401
|
-
t && e.__k && e.__k.__m && (t.__m = e.__k.__m),
|
|
401
|
+
t && e.__k && e.__k.__m && (t.__m = e.__k.__m), Pe && Pe(t, e);
|
|
402
402
|
}, C.__r = function(t) {
|
|
403
|
-
|
|
404
|
-
var e = (
|
|
405
|
-
e && (
|
|
403
|
+
Ae && Ae(t), B = 0;
|
|
404
|
+
var e = (y = t.__c).__H;
|
|
405
|
+
e && (se === y ? (e.__h = [], y.__h = [], e.__.forEach(function(n) {
|
|
406
406
|
n.__N && (n.__ = n.__N), n.u = n.__N = void 0;
|
|
407
|
-
})) : (e.__h.forEach(
|
|
407
|
+
})) : (e.__h.forEach(G), e.__h.forEach(_e), e.__h = [], B = 0)), se = y;
|
|
408
408
|
}, C.diffed = function(t) {
|
|
409
|
-
|
|
409
|
+
$e && $e(t);
|
|
410
410
|
var e = t.__c;
|
|
411
|
-
e && e.__H && (e.__H.__h.length && (
|
|
411
|
+
e && e.__H && (e.__H.__h.length && (Ge.push(e) !== 1 && ke === C.requestAnimationFrame || ((ke = C.requestAnimationFrame) || At)(St)), e.__H.__.forEach(function(n) {
|
|
412
412
|
n.u && (n.__H = n.u), n.u = void 0;
|
|
413
|
-
})),
|
|
413
|
+
})), se = y = null;
|
|
414
414
|
}, C.__c = function(t, e) {
|
|
415
415
|
e.some(function(n) {
|
|
416
416
|
try {
|
|
417
|
-
n.__h.forEach(
|
|
418
|
-
return !
|
|
417
|
+
n.__h.forEach(G), n.__h = n.__h.filter(function(s) {
|
|
418
|
+
return !s.__ || _e(s);
|
|
419
419
|
});
|
|
420
|
-
} catch (
|
|
421
|
-
e.some(function(
|
|
422
|
-
|
|
423
|
-
}), e = [], C.__e(
|
|
420
|
+
} catch (s) {
|
|
421
|
+
e.some(function(o) {
|
|
422
|
+
o.__h && (o.__h = []);
|
|
423
|
+
}), e = [], C.__e(s, n.__v);
|
|
424
424
|
}
|
|
425
|
-
}),
|
|
425
|
+
}), Ne && Ne(t, e);
|
|
426
426
|
}, C.unmount = function(t) {
|
|
427
|
-
|
|
427
|
+
xe && xe(t);
|
|
428
428
|
var e, n = t.__c;
|
|
429
|
-
n && n.__H && (n.__H.__.forEach(function(
|
|
429
|
+
n && n.__H && (n.__H.__.forEach(function(s) {
|
|
430
430
|
try {
|
|
431
|
-
|
|
432
|
-
} catch (
|
|
433
|
-
e =
|
|
431
|
+
G(s);
|
|
432
|
+
} catch (o) {
|
|
433
|
+
e = o;
|
|
434
434
|
}
|
|
435
435
|
}), n.__H = void 0, e && C.__e(e, n.__v));
|
|
436
436
|
};
|
|
437
|
-
var
|
|
438
|
-
function
|
|
437
|
+
var Me = typeof requestAnimationFrame == "function";
|
|
438
|
+
function At(t) {
|
|
439
439
|
var e, n = function() {
|
|
440
|
-
clearTimeout(
|
|
441
|
-
},
|
|
442
|
-
|
|
440
|
+
clearTimeout(s), Me && cancelAnimationFrame(e), setTimeout(t);
|
|
441
|
+
}, s = setTimeout(n, 35);
|
|
442
|
+
Me && (e = requestAnimationFrame(n));
|
|
443
443
|
}
|
|
444
|
-
function
|
|
445
|
-
var e =
|
|
446
|
-
typeof n == "function" && (t.__c = void 0, n()),
|
|
444
|
+
function G(t) {
|
|
445
|
+
var e = y, n = t.__c;
|
|
446
|
+
typeof n == "function" && (t.__c = void 0, n()), y = e;
|
|
447
447
|
}
|
|
448
|
-
function
|
|
449
|
-
var e =
|
|
450
|
-
t.__c = t.__(),
|
|
448
|
+
function _e(t) {
|
|
449
|
+
var e = y;
|
|
450
|
+
t.__c = t.__(), y = e;
|
|
451
451
|
}
|
|
452
|
-
function
|
|
453
|
-
return !t || t.length !== e.length || e.some(function(n,
|
|
454
|
-
return n !== t[
|
|
452
|
+
function Xe(t, e) {
|
|
453
|
+
return !t || t.length !== e.length || e.some(function(n, s) {
|
|
454
|
+
return n !== t[s];
|
|
455
455
|
});
|
|
456
456
|
}
|
|
457
|
-
function
|
|
457
|
+
function Ye(t, e) {
|
|
458
458
|
return typeof e == "function" ? e(t) : e;
|
|
459
459
|
}
|
|
460
460
|
const $t = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
461
|
-
let
|
|
461
|
+
let ie = (t = 21) => {
|
|
462
462
|
let e = "", n = crypto.getRandomValues(new Uint8Array(t |= 0));
|
|
463
463
|
for (; t--; )
|
|
464
464
|
e += $t[n[t] & 63];
|
|
465
465
|
return e;
|
|
466
466
|
};
|
|
467
|
-
class
|
|
467
|
+
class Nt {
|
|
468
468
|
constructor(e, n) {
|
|
469
|
-
this.agentUrl = e, this.agentId = n, this.agentConfig = null, this.ws = null, this.messageCallbacks = /* @__PURE__ */ new Set(), this.connectionCallbacks = /* @__PURE__ */ new Set(), this.streamingCallbacks = /* @__PURE__ */ new Set(), this.processingCallbacks = /* @__PURE__ */ new Set(), this.queueCallbacks = /* @__PURE__ */ new Set(), this.messages = [], this.reconnectAttempts = 0, this.maxReconnectAttempts = 5, this.reconnectDelay = 1e3, this.isAgentStreaming = !1, this.isAgentProcessing = !1, this.messageQueue = [];
|
|
469
|
+
this.agentUrl = e, this.agentId = n, this.agentConfig = null, this.ws = null, this.messageCallbacks = /* @__PURE__ */ new Set(), this.suggestionsCallbacks = /* @__PURE__ */ new Set(), this.connectionCallbacks = /* @__PURE__ */ new Set(), this.streamingCallbacks = /* @__PURE__ */ new Set(), this.processingCallbacks = /* @__PURE__ */ new Set(), this.queueCallbacks = /* @__PURE__ */ new Set(), this.messages = [], this.activeSuggestions = [], this.reconnectAttempts = 0, this.maxReconnectAttempts = 5, this.reconnectDelay = 1e3, this.isAgentStreaming = !1, this.isAgentProcessing = !1, this.messageQueue = [], this.disposed = !1;
|
|
470
470
|
}
|
|
471
471
|
/**
|
|
472
472
|
* Initialize the widget by fetching agent configuration
|
|
473
473
|
*/
|
|
474
474
|
async initWidget() {
|
|
475
475
|
try {
|
|
476
|
-
console.log("[AriaFlow Widget] Fetching agent config...", { agentUrl: this.agentUrl, agentId: this.agentId });
|
|
477
476
|
try {
|
|
478
|
-
const
|
|
479
|
-
if (
|
|
480
|
-
const o = await
|
|
481
|
-
return
|
|
477
|
+
const s = await fetch(`${this.normalizeBaseUrl(this.agentUrl)}/api/agent/${this.agentId}`);
|
|
478
|
+
if (s.ok) {
|
|
479
|
+
const o = await s.json();
|
|
480
|
+
return !o || o.status !== "active" ? (console.error("Agent not found or inactive"), null) : (this.agentConfig = o, this.maxReconnectAttempts = o.config.maxRetries || 5, this.reconnectDelay = o.config.reconnectDelay || 1e3, await this.connectToAgent(), o);
|
|
482
481
|
}
|
|
483
482
|
} catch {
|
|
484
483
|
console.warn("[AriaFlow Widget] Agent config endpoint not available, trying fallback");
|
|
485
484
|
}
|
|
486
|
-
|
|
487
|
-
const e = {
|
|
485
|
+
const e = this.toWebSocketBaseUrl(this.normalizeBaseUrl(this.agentUrl)), n = {
|
|
488
486
|
id: this.agentId,
|
|
489
487
|
name: this.agentId === "hospital" ? "Hospital Support" : "Support Agent",
|
|
490
|
-
wsUrl: `${
|
|
488
|
+
wsUrl: `${e}/agents/chat`,
|
|
491
489
|
status: "active",
|
|
492
490
|
capabilities: ["chat", "streaming"],
|
|
493
491
|
config: {
|
|
@@ -500,7 +498,7 @@ class Wt {
|
|
|
500
498
|
reconnectDelay: 1e3
|
|
501
499
|
}
|
|
502
500
|
};
|
|
503
|
-
return this.agentConfig =
|
|
501
|
+
return this.agentConfig = n, await this.connectToAgent(), n;
|
|
504
502
|
} catch (e) {
|
|
505
503
|
return console.error("Failed to initialize widget:", e), null;
|
|
506
504
|
}
|
|
@@ -511,24 +509,26 @@ class Wt {
|
|
|
511
509
|
async connectToAgent() {
|
|
512
510
|
if (!this.agentConfig?.wsUrl)
|
|
513
511
|
throw new Error("No agent WebSocket URL configured");
|
|
514
|
-
|
|
515
|
-
|
|
512
|
+
if (this.disposed)
|
|
513
|
+
return;
|
|
514
|
+
const e = this.getSessionId(), n = `${this.normalizeBaseUrl(this.agentConfig.wsUrl)}/${e}`;
|
|
515
|
+
return new Promise((s, o) => {
|
|
516
516
|
try {
|
|
517
517
|
this.ws = new WebSocket(n), this.ws.onopen = () => {
|
|
518
|
-
console.log("[Widget] Connected to agent"), this.reconnectAttempts = 0, this.notifyConnectionChange(!0),
|
|
519
|
-
}, this.ws.onmessage = (
|
|
520
|
-
this.handleMessage(
|
|
518
|
+
console.log("[Widget] Connected to agent"), this.reconnectAttempts = 0, this.notifyConnectionChange(!0), s();
|
|
519
|
+
}, this.ws.onmessage = (i) => {
|
|
520
|
+
this.handleMessage(i);
|
|
521
521
|
}, this.ws.onclose = () => {
|
|
522
|
-
if (
|
|
522
|
+
if (this.ws = null, this.notifyConnectionChange(!1), !this.disposed && this.reconnectAttempts < this.maxReconnectAttempts) {
|
|
523
523
|
this.reconnectAttempts++;
|
|
524
|
-
const
|
|
525
|
-
console.log(`[Widget] Reconnecting in ${
|
|
524
|
+
const i = this.reconnectDelay * Math.pow(2, this.reconnectAttempts - 1);
|
|
525
|
+
console.log(`[Widget] Reconnecting in ${i}ms... (attempt ${this.reconnectAttempts})`), setTimeout(() => this.connectToAgent(), i);
|
|
526
526
|
}
|
|
527
|
-
}, this.ws.onerror = (
|
|
528
|
-
console.error("[Widget] WebSocket error:",
|
|
527
|
+
}, this.ws.onerror = (i) => {
|
|
528
|
+
console.error("[Widget] WebSocket error:", i), o(i);
|
|
529
529
|
};
|
|
530
|
-
} catch (
|
|
531
|
-
i
|
|
530
|
+
} catch (i) {
|
|
531
|
+
o(i);
|
|
532
532
|
}
|
|
533
533
|
});
|
|
534
534
|
}
|
|
@@ -549,16 +549,18 @@ class Wt {
|
|
|
549
549
|
handleMessage(e) {
|
|
550
550
|
try {
|
|
551
551
|
const n = JSON.parse(e.data);
|
|
552
|
-
if (n.type === "
|
|
553
|
-
this.
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
552
|
+
if (n.type === "connected")
|
|
553
|
+
this.notifyConnectionChange(!0);
|
|
554
|
+
else if (n.type === "text-delta")
|
|
555
|
+
this.isAgentProcessing && this.notifyProcessingChange(!1), this.setMessages((s) => {
|
|
556
|
+
const o = s[s.length - 1];
|
|
557
|
+
return o && o.role === "assistant" && o.isStreaming ? [
|
|
558
|
+
...s.slice(0, -1),
|
|
559
|
+
{ ...o, content: o.content + n.text }
|
|
558
560
|
] : [
|
|
559
|
-
...
|
|
561
|
+
...s,
|
|
560
562
|
{
|
|
561
|
-
id:
|
|
563
|
+
id: ie(),
|
|
562
564
|
role: "assistant",
|
|
563
565
|
content: n.text,
|
|
564
566
|
timestamp: Date.now(),
|
|
@@ -567,46 +569,21 @@ class Wt {
|
|
|
567
569
|
];
|
|
568
570
|
});
|
|
569
571
|
else if (n.type === "done")
|
|
570
|
-
|
|
571
|
-
const
|
|
572
|
-
return
|
|
573
|
-
...
|
|
574
|
-
{ ...
|
|
575
|
-
] :
|
|
572
|
+
this.notifyProcessingChange(!1), this.setMessages((s) => {
|
|
573
|
+
const o = s[s.length - 1];
|
|
574
|
+
return o && o.role === "assistant" && o.isStreaming ? [
|
|
575
|
+
...s.slice(0, -1),
|
|
576
|
+
{ ...o, isStreaming: !1 }
|
|
577
|
+
] : s;
|
|
576
578
|
}), this.isAgentStreaming = !1, this.notifyStreamingChange(!1), this.processMessageQueue();
|
|
577
579
|
else if (n.type === "step-start" || n.type === "agent-start")
|
|
578
|
-
|
|
580
|
+
this.isAgentStreaming = !0, this.notifyStreamingChange(!0), this.notifyProcessingChange(!0);
|
|
579
581
|
else if (n.type === "step-end" || n.type === "agent-end")
|
|
580
|
-
|
|
582
|
+
n.type === "agent-end" && this.notifyProcessingChange(!1);
|
|
581
583
|
else if (n.type === "tool-call") {
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
role: "tool",
|
|
586
|
-
content: `Calling tool: ${n.tool.name}`,
|
|
587
|
-
timestamp: Date.now(),
|
|
588
|
-
toolCall: {
|
|
589
|
-
name: n.tool.name,
|
|
590
|
-
arguments: n.tool.arguments
|
|
591
|
-
}
|
|
592
|
-
};
|
|
593
|
-
this.setMessages((i) => [...i, o]), n.tool.name === "suggest_options" && n.tool.arguments?.options && this.setMessages((i) => {
|
|
594
|
-
const s = [...i].reverse().find((a) => a.role === "assistant");
|
|
595
|
-
return s ? i.map(
|
|
596
|
-
(a) => a.id === s.id ? { ...a, suggestions: n.tool.arguments.options } : a
|
|
597
|
-
) : i;
|
|
598
|
-
});
|
|
599
|
-
} else n.type === "tool-result" ? (console.log("[Widget] Tool result:", n.result), this.setMessages((o) => {
|
|
600
|
-
const i = o[o.length - 1];
|
|
601
|
-
return i && i.role === "tool" && !i.toolResult ? [
|
|
602
|
-
...o.slice(0, -1),
|
|
603
|
-
{ ...i, content: i.content + `
|
|
604
|
-
Result: ${JSON.stringify(n.result)}`, toolResult: n.result }
|
|
605
|
-
] : o;
|
|
606
|
-
})) : n.type === "agent-start" ? (console.log(`[Widget] Agent started: ${n.agentId}`), this.isAgentStreaming = !0, this.notifyStreamingChange(!0)) : n.type === "handoff" ? console.log(`[Widget] Handoff: ${n.from} -> ${n.to}: ${n.reason}`) : n.type === "suggested-questions" ? (console.log("[Widget] Suggestions received:", n.suggestions), this.setMessages((o) => {
|
|
607
|
-
const i = [...o].reverse().find((s) => s.role === "assistant");
|
|
608
|
-
return i ? o.map((s) => s.id === i.id ? { ...s, suggestions: n.suggestions } : s) : o;
|
|
609
|
-
})) : console.log("[Widget] Unknown message type:", n.type);
|
|
584
|
+
const s = n.tool?.name || n.toolName, o = n.tool?.arguments || n.args;
|
|
585
|
+
this.notifyProcessingChange(!0), s === "suggest_options" && o?.options && this.setActiveSuggestions(o.options);
|
|
586
|
+
} else n.type === "tool-result" || n.type === "handoff" || (n.type === "suggested-questions" ? this.setActiveSuggestions(n.suggestions) : n.type === "error" || n.type === "interrupted" ? (this.notifyProcessingChange(!1), this.isAgentStreaming = !1, this.notifyStreamingChange(!1)) : n.type === "cancelled" ? this.notifyProcessingChange(!1) : console.log("[Widget] Unknown message type:", n.type));
|
|
610
587
|
} catch (n) {
|
|
611
588
|
console.error("[Widget] Error parsing message:", e.data, n);
|
|
612
589
|
}
|
|
@@ -617,13 +594,14 @@ Result: ${JSON.stringify(n.result)}`, toolResult: n.result }
|
|
|
617
594
|
async sendMessage(e) {
|
|
618
595
|
if (!this.ws || this.ws.readyState !== WebSocket.OPEN)
|
|
619
596
|
throw new Error("Not connected to agent");
|
|
597
|
+
this.setActiveSuggestions([]);
|
|
620
598
|
const n = {
|
|
621
|
-
id:
|
|
599
|
+
id: ie(),
|
|
622
600
|
role: "user",
|
|
623
601
|
content: e,
|
|
624
602
|
timestamp: Date.now()
|
|
625
603
|
};
|
|
626
|
-
if (this.setMessages((
|
|
604
|
+
if (this.setMessages((s) => [...s, n]), this.isAgentStreaming) {
|
|
627
605
|
console.log("[Widget] Agent is streaming, queuing message"), this.messageQueue.push(e), this.notifyQueueChange(this.messageQueue.length);
|
|
628
606
|
return;
|
|
629
607
|
}
|
|
@@ -658,7 +636,7 @@ Result: ${JSON.stringify(n.result)}`, toolResult: n.result }
|
|
|
658
636
|
*/
|
|
659
637
|
getSessionId() {
|
|
660
638
|
let e = sessionStorage.getItem("ariaflow_session_id");
|
|
661
|
-
return e || (e =
|
|
639
|
+
return e || (e = ie(), sessionStorage.setItem("ariaflow_session_id", e)), e;
|
|
662
640
|
}
|
|
663
641
|
/**
|
|
664
642
|
* Update messages state
|
|
@@ -716,6 +694,32 @@ Result: ${JSON.stringify(n.result)}`, toolResult: n.result }
|
|
|
716
694
|
notifyQueueChange(e) {
|
|
717
695
|
this.queueCallbacks.forEach((n) => n(e));
|
|
718
696
|
}
|
|
697
|
+
/**
|
|
698
|
+
* Register a callback for active suggestion updates
|
|
699
|
+
*/
|
|
700
|
+
onSuggestionsChange(e) {
|
|
701
|
+
return this.suggestionsCallbacks.add(e), e(this.activeSuggestions), () => {
|
|
702
|
+
this.suggestionsCallbacks.delete(e);
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* Normalize and notify suggestion changes
|
|
707
|
+
*/
|
|
708
|
+
setActiveSuggestions(e) {
|
|
709
|
+
const n = Array.isArray(e) ? e.filter((o) => typeof o == "string").map((o) => o.trim()).filter(Boolean) : [], s = [...new Set(n)];
|
|
710
|
+
this.activeSuggestions = s, this.suggestionsCallbacks.forEach((o) => o(s));
|
|
711
|
+
}
|
|
712
|
+
normalizeBaseUrl(e) {
|
|
713
|
+
return e.replace(/\/+$/, "");
|
|
714
|
+
}
|
|
715
|
+
toWebSocketBaseUrl(e) {
|
|
716
|
+
try {
|
|
717
|
+
const n = new URL(e);
|
|
718
|
+
return n.protocol === "https:" ? n.protocol = "wss:" : n.protocol === "http:" && (n.protocol = "ws:"), n.toString().replace(/\/+$/, "");
|
|
719
|
+
} catch {
|
|
720
|
+
return e.replace(/^https:\/\//, "wss://").replace(/^http:\/\//, "ws://").replace(/\/+$/, "");
|
|
721
|
+
}
|
|
722
|
+
}
|
|
719
723
|
/**
|
|
720
724
|
* Get current messages
|
|
721
725
|
*/
|
|
@@ -738,10 +742,10 @@ Result: ${JSON.stringify(n.result)}`, toolResult: n.result }
|
|
|
738
742
|
* Disconnect and cleanup
|
|
739
743
|
*/
|
|
740
744
|
dispose() {
|
|
741
|
-
this.ws && (this.ws.close(), this.ws = null), this.messageCallbacks.clear(), this.connectionCallbacks.clear();
|
|
745
|
+
this.disposed = !0, this.ws && (this.ws.close(), this.ws = null), this.messageCallbacks.clear(), this.suggestionsCallbacks.clear(), this.connectionCallbacks.clear(), this.streamingCallbacks.clear(), this.processingCallbacks.clear(), this.queueCallbacks.clear();
|
|
742
746
|
}
|
|
743
747
|
}
|
|
744
|
-
const
|
|
748
|
+
const oe = {
|
|
745
749
|
none: "0",
|
|
746
750
|
small: "0.375rem",
|
|
747
751
|
medium: "0.75rem",
|
|
@@ -752,81 +756,72 @@ function xt({
|
|
|
752
756
|
agentId: e,
|
|
753
757
|
// Legacy props for backward compatibility
|
|
754
758
|
widgetId: n,
|
|
755
|
-
apiUrl:
|
|
756
|
-
mode:
|
|
757
|
-
theme:
|
|
759
|
+
apiUrl: s,
|
|
760
|
+
mode: o = "chat",
|
|
761
|
+
theme: i = "light",
|
|
758
762
|
position: a = "bottom-right",
|
|
759
763
|
size: _ = "full",
|
|
760
764
|
radius: c = "medium",
|
|
761
765
|
baseColor: l,
|
|
762
766
|
accentColor: u = "#14B8A6",
|
|
763
767
|
buttonBaseColor: r = "#000000",
|
|
764
|
-
buttonAccentColor:
|
|
765
|
-
title:
|
|
768
|
+
buttonAccentColor: g = "#FFFFFF",
|
|
769
|
+
title: h,
|
|
766
770
|
subtitle: v,
|
|
767
|
-
emptyChatMessage:
|
|
771
|
+
emptyChatMessage: k
|
|
768
772
|
}) {
|
|
769
|
-
const [
|
|
770
|
-
|
|
773
|
+
const [w, p] = M(!1), [f, E] = M([]), [$, H] = M(""), [S, z] = M(!1), [A, F] = M(!1), [U, N] = M(null), [P, Ze] = M(!1), [et, tt] = M(!1), [ne, nt] = M(0), [fe, st] = M([]), j = We(null), pe = We(null);
|
|
774
|
+
Ee(() => ((async () => {
|
|
771
775
|
if (t && e) {
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
J.current = S;
|
|
776
|
+
const W = new Nt(t, e);
|
|
777
|
+
j.current = W;
|
|
775
778
|
try {
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
}),
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
console.log("[AriaFlow Widget] Queue count:", k), ot(k);
|
|
784
|
-
}), S.onProcessingChange((k) => {
|
|
785
|
-
console.log("[AriaFlow Widget] Processing state:", k), nt(k);
|
|
786
|
-
});
|
|
787
|
-
const L = await S.initWidget();
|
|
788
|
-
console.log("[AriaFlow Widget] Agent config received:", L), L ? (N(L), console.log("[AriaFlow Widget] Widget initialized successfully (v0.6.11)")) : console.error("[AriaFlow Widget] Agent config fetch failed");
|
|
789
|
-
} catch (L) {
|
|
790
|
-
console.error("[AriaFlow Widget] Initialization error:", L);
|
|
779
|
+
W.onMessages((x) => E(x)), W.onConnectionChange((x) => {
|
|
780
|
+
z(x), x && F(!0);
|
|
781
|
+
}), W.onStreamingChange((x) => Ze(x)), W.onQueueChange((x) => nt(x)), W.onProcessingChange((x) => tt(x)), W.onSuggestionsChange((x) => st(x));
|
|
782
|
+
const V = await W.initWidget();
|
|
783
|
+
V ? N(V) : console.error("[AriaFlow Widget] Agent config fetch failed");
|
|
784
|
+
} catch (V) {
|
|
785
|
+
console.error("[AriaFlow Widget] Initialization error:", V);
|
|
791
786
|
}
|
|
792
|
-
} else t && !e ? (console.warn("[AriaFlow Widget] Direct WebSocket URLs are deprecated. Use agent-url + agent-id instead."), console.error("[AriaFlow Widget] Configuration error: agent-id is required")) :
|
|
787
|
+
} else t && !e ? (console.warn("[AriaFlow Widget] Direct WebSocket URLs are deprecated. Use agent-url + agent-id instead."), console.error("[AriaFlow Widget] Configuration error: agent-id is required")) : s && n ? (console.warn("[AriaFlow Widget] Legacy widget config is deprecated. Use agent-url + agent-id instead."), console.error("[AriaFlow Widget] Configuration error: use agent-url + agent-id instead")) : console.error("[AriaFlow Widget] Invalid configuration. Provide agent-url and agent-id.");
|
|
793
788
|
})(), () => {
|
|
794
|
-
|
|
795
|
-
}), [t, e, n,
|
|
796
|
-
|
|
789
|
+
j.current?.dispose();
|
|
790
|
+
}), [t, e, n, s]), Ee(() => {
|
|
791
|
+
pe.current?.scrollIntoView({ behavior: "smooth" });
|
|
797
792
|
}, [f]);
|
|
798
|
-
const
|
|
799
|
-
if (
|
|
800
|
-
const b =
|
|
793
|
+
const me = async () => {
|
|
794
|
+
if (!$.trim() || !S) return;
|
|
795
|
+
const b = $.trim();
|
|
801
796
|
H("");
|
|
802
797
|
try {
|
|
803
|
-
await
|
|
804
|
-
} catch (
|
|
805
|
-
console.error("Failed to send message:",
|
|
798
|
+
await j.current?.sendMessage(b);
|
|
799
|
+
} catch (W) {
|
|
800
|
+
console.error("Failed to send message:", W);
|
|
806
801
|
}
|
|
807
|
-
}, st = (b) => {
|
|
808
|
-
b.key === "Enter" && !b.shiftKey && (b.preventDefault(), ye());
|
|
809
802
|
}, it = (b) => {
|
|
810
|
-
|
|
811
|
-
},
|
|
812
|
-
|
|
803
|
+
b.key === "Enter" && !b.shiftKey && (b.preventDefault(), me());
|
|
804
|
+
}, ot = (b) => {
|
|
805
|
+
!S || P || j.current?.sendMessage(b);
|
|
806
|
+
}, rt = h || U?.config.title || "Ninewells Hospital", at = v || U?.config.subtitle || "How can we help you today?", lt = k || U?.config.emptyChatMessage || "Start a conversation with Ninewells...";
|
|
807
|
+
return /* @__PURE__ */ d(
|
|
813
808
|
"div",
|
|
814
809
|
{
|
|
815
810
|
className: `ariaflow-widget-container ariaflow-widget-${a} ariaflow-widget-${_} ariaflow-widget-radius-${c}`,
|
|
816
|
-
"data-theme":
|
|
811
|
+
"data-theme": i,
|
|
817
812
|
style: {
|
|
818
813
|
"--ariaflow-accent-color": u,
|
|
819
814
|
"--ariaflow-base-color": l
|
|
820
815
|
},
|
|
821
816
|
children: [
|
|
822
|
-
!
|
|
817
|
+
!w && /* @__PURE__ */ d(
|
|
823
818
|
"button",
|
|
824
819
|
{
|
|
825
820
|
className: "ariaflow-widget-launcher",
|
|
826
821
|
onClick: () => p(!0),
|
|
827
822
|
style: {
|
|
828
823
|
backgroundColor: r,
|
|
829
|
-
color:
|
|
824
|
+
color: g,
|
|
830
825
|
opacity: A ? 1 : 0.8,
|
|
831
826
|
cursor: A ? "pointer" : "wait",
|
|
832
827
|
position: "relative"
|
|
@@ -846,7 +841,7 @@ function xt({
|
|
|
846
841
|
transform: "translate(-50%, -50%)",
|
|
847
842
|
width: "20px",
|
|
848
843
|
height: "20px",
|
|
849
|
-
border: `2px solid ${
|
|
844
|
+
border: `2px solid ${g}`,
|
|
850
845
|
borderTop: "2px solid transparent",
|
|
851
846
|
borderRadius: "50%",
|
|
852
847
|
animation: "spin 1s linear infinite"
|
|
@@ -868,13 +863,13 @@ function xt({
|
|
|
868
863
|
]
|
|
869
864
|
}
|
|
870
865
|
),
|
|
871
|
-
|
|
866
|
+
w && A && /* @__PURE__ */ d(
|
|
872
867
|
"div",
|
|
873
868
|
{
|
|
874
869
|
className: "ariaflow-widget-window",
|
|
875
870
|
style: {
|
|
876
|
-
backgroundColor:
|
|
877
|
-
borderRadius:
|
|
871
|
+
backgroundColor: i === "dark" && l ? l : void 0,
|
|
872
|
+
borderRadius: oe[c]
|
|
878
873
|
},
|
|
879
874
|
children: [
|
|
880
875
|
/* @__PURE__ */ d(
|
|
@@ -883,7 +878,7 @@ function xt({
|
|
|
883
878
|
className: "ariaflow-widget-header",
|
|
884
879
|
style: {
|
|
885
880
|
backgroundColor: u,
|
|
886
|
-
borderRadius: c === "none" ? "0" : `${
|
|
881
|
+
borderRadius: c === "none" ? "0" : `${oe[c]} ${oe[c]} 0 0`
|
|
887
882
|
},
|
|
888
883
|
children: [
|
|
889
884
|
/* @__PURE__ */ d("div", { className: "ariaflow-widget-header-content", children: /* @__PURE__ */ d("div", { className: "ariaflow-widget-title-group", children: [
|
|
@@ -916,16 +911,16 @@ function xt({
|
|
|
916
911
|
]
|
|
917
912
|
}
|
|
918
913
|
),
|
|
919
|
-
!
|
|
914
|
+
!S && /* @__PURE__ */ d("div", { className: "ariaflow-widget-status", children: [
|
|
920
915
|
/* @__PURE__ */ d("span", { className: "ariaflow-widget-status-dot" }),
|
|
921
916
|
"Connecting..."
|
|
922
917
|
] }),
|
|
923
|
-
/* @__PURE__ */ d("div", { className: "ariaflow-widget-messages", children: f.length === 0 ? /* @__PURE__ */ d("div", { className: "ariaflow-widget-empty", children: /* @__PURE__ */ d("p", { children:
|
|
924
|
-
f.map((b
|
|
918
|
+
/* @__PURE__ */ d("div", { className: "ariaflow-widget-messages", children: f.length === 0 ? /* @__PURE__ */ d("div", { className: "ariaflow-widget-empty", children: /* @__PURE__ */ d("p", { children: S ? lt : "Connecting to agent..." }) }) : /* @__PURE__ */ d(D, { children: [
|
|
919
|
+
f.map((b) => b.role === "tool" ? null : /* @__PURE__ */ d(
|
|
925
920
|
"div",
|
|
926
921
|
{
|
|
927
922
|
className: `ariaflow-widget-message ariaflow-widget-message-${b.role}`,
|
|
928
|
-
children: /* @__PURE__ */ d("div", { className: "ariaflow-widget-message-bubble", children: /* @__PURE__ */ d(
|
|
923
|
+
children: /* @__PURE__ */ d("div", { className: "ariaflow-widget-message-bubble", children: /* @__PURE__ */ d(D, { children: [
|
|
929
924
|
b.content,
|
|
930
925
|
b.isStreaming && /* @__PURE__ */ d("span", { className: "ariaflow-widget-typing-indicator", children: [
|
|
931
926
|
/* @__PURE__ */ d("span", { children: "•" }),
|
|
@@ -935,57 +930,47 @@ function xt({
|
|
|
935
930
|
] }) })
|
|
936
931
|
},
|
|
937
932
|
b.id
|
|
938
|
-
))
|
|
939
|
-
/* @__PURE__ */ d("div", { ref:
|
|
940
|
-
|
|
933
|
+
)),
|
|
934
|
+
/* @__PURE__ */ d("div", { ref: pe }),
|
|
935
|
+
et && !P && /* @__PURE__ */ d("div", { className: "ariaflow-widget-message ariaflow-widget-message-assistant", children: /* @__PURE__ */ d("div", { className: "ariaflow-widget-message-bubble", children: /* @__PURE__ */ d("span", { className: "ariaflow-widget-typing-indicator", children: [
|
|
941
936
|
/* @__PURE__ */ d("span", { children: "•" }),
|
|
942
937
|
/* @__PURE__ */ d("span", { children: "•" }),
|
|
943
938
|
/* @__PURE__ */ d("span", { children: "•" })
|
|
944
939
|
] }) }) })
|
|
945
940
|
] }) }),
|
|
946
|
-
!
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
backgroundColor: "rgba(255, 255, 255, 0.95)",
|
|
962
|
-
backdropFilter: "blur(4px)"
|
|
963
|
-
},
|
|
964
|
-
children: ie
|
|
965
|
-
},
|
|
966
|
-
ie
|
|
967
|
-
)) });
|
|
968
|
-
}
|
|
969
|
-
return null;
|
|
970
|
-
})(),
|
|
941
|
+
!P && fe.length > 0 && /* @__PURE__ */ d("div", { className: "ariaflow-widget-suggestions", children: fe.map((b) => /* @__PURE__ */ d(
|
|
942
|
+
"button",
|
|
943
|
+
{
|
|
944
|
+
className: "ariaflow-widget-chip",
|
|
945
|
+
onClick: () => ot(b),
|
|
946
|
+
style: {
|
|
947
|
+
borderColor: u,
|
|
948
|
+
color: u,
|
|
949
|
+
backgroundColor: "rgba(255, 255, 255, 0.95)",
|
|
950
|
+
backdropFilter: "blur(4px)"
|
|
951
|
+
},
|
|
952
|
+
children: b
|
|
953
|
+
},
|
|
954
|
+
b
|
|
955
|
+
)) }),
|
|
971
956
|
/* @__PURE__ */ d("div", { className: "ariaflow-widget-input", children: [
|
|
972
957
|
/* @__PURE__ */ d(
|
|
973
958
|
"textarea",
|
|
974
959
|
{
|
|
975
|
-
value:
|
|
960
|
+
value: $,
|
|
976
961
|
onInput: (b) => H(b.target.value),
|
|
977
|
-
onKeyDown:
|
|
978
|
-
placeholder:
|
|
962
|
+
onKeyDown: it,
|
|
963
|
+
placeholder: S ? P ? ne > 0 ? `Agent is responding... (${ne} message${ne > 1 ? "s" : ""} queued)` : "Agent is responding..." : "Type your message..." : "Connecting...",
|
|
979
964
|
rows: 1,
|
|
980
|
-
disabled: !
|
|
965
|
+
disabled: !S
|
|
981
966
|
}
|
|
982
967
|
),
|
|
983
968
|
/* @__PURE__ */ d(
|
|
984
969
|
"button",
|
|
985
970
|
{
|
|
986
971
|
className: "ariaflow-widget-send",
|
|
987
|
-
onClick:
|
|
988
|
-
disabled:
|
|
972
|
+
onClick: me,
|
|
973
|
+
disabled: !$.trim() || !S,
|
|
989
974
|
style: { backgroundColor: u },
|
|
990
975
|
"aria-label": "Send message",
|
|
991
976
|
children: /* @__PURE__ */ d(
|
|
@@ -1013,32 +998,33 @@ function xt({
|
|
|
1013
998
|
}
|
|
1014
999
|
);
|
|
1015
1000
|
}
|
|
1001
|
+
const Pt = [
|
|
1002
|
+
"agent-url",
|
|
1003
|
+
"agent-id",
|
|
1004
|
+
// Legacy support
|
|
1005
|
+
"widget-id",
|
|
1006
|
+
"api-url",
|
|
1007
|
+
// Other options
|
|
1008
|
+
"mode",
|
|
1009
|
+
"theme",
|
|
1010
|
+
"position",
|
|
1011
|
+
"size",
|
|
1012
|
+
"radius",
|
|
1013
|
+
"base-color",
|
|
1014
|
+
"accent-color",
|
|
1015
|
+
"button-base-color",
|
|
1016
|
+
"button-accent-color",
|
|
1017
|
+
"title",
|
|
1018
|
+
"subtitle",
|
|
1019
|
+
"empty-chat-message"
|
|
1020
|
+
];
|
|
1016
1021
|
pt(
|
|
1017
1022
|
xt,
|
|
1018
1023
|
"ariaflow-widget",
|
|
1019
|
-
//
|
|
1020
|
-
|
|
1021
|
-
"agent-url",
|
|
1022
|
-
"agent-id",
|
|
1023
|
-
// Legacy support
|
|
1024
|
-
"widget-id",
|
|
1025
|
-
"api-url",
|
|
1026
|
-
// Other options
|
|
1027
|
-
"mode",
|
|
1028
|
-
"theme",
|
|
1029
|
-
"position",
|
|
1030
|
-
"size",
|
|
1031
|
-
"radius",
|
|
1032
|
-
"base-color",
|
|
1033
|
-
"accent-color",
|
|
1034
|
-
"button-base-color",
|
|
1035
|
-
"button-accent-color",
|
|
1036
|
-
"title",
|
|
1037
|
-
"subtitle",
|
|
1038
|
-
"empty-chat-message"
|
|
1039
|
-
],
|
|
1024
|
+
// Keep kebab-case attribute names for HTML usage.
|
|
1025
|
+
Pt,
|
|
1040
1026
|
// Shadow DOM (optional, set to false for light DOM)
|
|
1041
|
-
!1
|
|
1027
|
+
{ shadow: !1 }
|
|
1042
1028
|
);
|
|
1043
1029
|
typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", Te) : Te());
|
|
1044
1030
|
function Te() {
|
|
@@ -1047,5 +1033,5 @@ function Te() {
|
|
|
1047
1033
|
}
|
|
1048
1034
|
export {
|
|
1049
1035
|
xt as Widget,
|
|
1050
|
-
|
|
1036
|
+
Nt as WidgetClient
|
|
1051
1037
|
};
|