@ariaflowagents/widget 0.5.11 → 0.6.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/style.css +1 -1
- package/dist/widget.js +357 -325
- package/dist/widget.umd.cjs +3 -3
- package/package.json +1 -1
package/dist/widget.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
var B, m,
|
|
2
|
-
function
|
|
1
|
+
var B, m, He, R, we, Pe, Ie, Re, ue, le, ae, q = {}, Ue = [], rt = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, te = Array.isArray;
|
|
2
|
+
function M(t, e) {
|
|
3
3
|
for (var n in e) t[n] = e[n];
|
|
4
4
|
return t;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function de(t) {
|
|
7
7
|
t && t.parentNode && t.parentNode.removeChild(t);
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function L(t, e, n) {
|
|
10
10
|
var o, s, i, l = {};
|
|
11
11
|
for (i in e) i == "key" ? o = e[i] : i == "ref" ? s = e[i] : l[i] = e[i];
|
|
12
12
|
if (arguments.length > 2 && (l.children = arguments.length > 3 ? B.call(arguments, 2) : n), typeof t == "function" && t.defaultProps != null) for (i in t.defaultProps) l[i] === void 0 && (l[i] = t.defaultProps[i]);
|
|
13
13
|
return Q(t, l, o, s, null);
|
|
14
14
|
}
|
|
15
15
|
function Q(t, e, n, o, s) {
|
|
16
|
-
var i = { type: t, props: e, key: n, ref: o, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: s ?? ++
|
|
16
|
+
var i = { type: t, props: e, key: n, ref: o, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: s ?? ++He, __i: -1, __u: 0 };
|
|
17
17
|
return s == null && m.vnode != null && m.vnode(i), i;
|
|
18
18
|
}
|
|
19
19
|
function U(t) {
|
|
20
20
|
return t.children;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function G(t, e) {
|
|
23
23
|
this.props = t, this.context = e;
|
|
24
24
|
}
|
|
25
25
|
function O(t, e) {
|
|
@@ -27,32 +27,32 @@ function O(t, e) {
|
|
|
27
27
|
for (var n; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) return n.__e;
|
|
28
28
|
return typeof t.type == "function" ? O(t) : null;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function De(t) {
|
|
31
31
|
var e, n;
|
|
32
32
|
if ((t = t.__) != null && t.__c != null) {
|
|
33
33
|
for (t.__e = t.__c.base = null, e = 0; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) {
|
|
34
34
|
t.__e = t.__c.base = n.__e;
|
|
35
35
|
break;
|
|
36
36
|
}
|
|
37
|
-
return
|
|
37
|
+
return De(t);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
function ye(t) {
|
|
41
|
-
(!t.__d && (t.__d = !0) && R.push(t) && !
|
|
41
|
+
(!t.__d && (t.__d = !0) && R.push(t) && !Y.__r++ || we != m.debounceRendering) && ((we = m.debounceRendering) || Pe)(Y);
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
for (var t, e, n, o, s, i, l,
|
|
45
|
-
|
|
43
|
+
function Y() {
|
|
44
|
+
for (var t, e, n, o, s, i, l, a = 1; R.length; ) R.length > a && R.sort(Ie), t = R.shift(), a = R.length, t.__d && (n = void 0, o = void 0, s = (o = (e = t).__v).__e, i = [], l = [], e.__P && ((n = M({}, o)).__v = o.__v + 1, m.vnode && m.vnode(n), ge(e.__P, n, o, e.__n, e.__P.namespaceURI, 32 & o.__u ? [s] : null, i, s ?? O(o), !!(32 & o.__u), l), n.__v = o.__v, n.__.__k[n.__i] = n, Qe(i, n, l), o.__e = o.__ = null, n.__e != s && De(n)));
|
|
45
|
+
Y.__r = 0;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
var r,
|
|
49
|
-
for (c =
|
|
50
|
-
return n.__e =
|
|
47
|
+
function Le(t, e, n, o, s, i, l, a, c, _, u) {
|
|
48
|
+
var r, h, d, b, S, y, p, f = o && o.__k || Ue, x = e.length;
|
|
49
|
+
for (c = lt(n, e, f, c, x), r = 0; r < x; r++) (d = n.__k[r]) != null && (h = d.__i == -1 ? q : f[d.__i] || q, d.__i = r, y = ge(t, d, h, s, i, l, a, c, _, u), b = d.__e, d.ref && h.ref != d.ref && (h.ref && he(h.ref, null, d), u.push(d.ref, d.__c || b, d)), S == null && b != null && (S = b), (p = !!(4 & d.__u)) || h.__k === d.__k ? c = Oe(d, c, t, p) : typeof d.type == "function" && y !== void 0 ? c = y : b && (c = b.nextSibling), d.__u &= -7);
|
|
50
|
+
return n.__e = S, c;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
var i, l,
|
|
54
|
-
for (t.__k = new Array(s), i = 0; i < s; i++) (l = e[i]) != null && typeof l != "boolean" && typeof l != "function" ? (typeof l == "string" || typeof l == "number" || typeof l == "bigint" || l.constructor == String ? l = t.__k[i] = Q(null, l, null, null, null) :
|
|
55
|
-
if (r) for (i = 0; i <
|
|
52
|
+
function lt(t, e, n, o, s) {
|
|
53
|
+
var i, l, a, c, _, u = n.length, r = u, h = 0;
|
|
54
|
+
for (t.__k = new Array(s), i = 0; i < s; i++) (l = e[i]) != null && typeof l != "boolean" && typeof l != "function" ? (typeof l == "string" || typeof l == "number" || typeof l == "bigint" || l.constructor == String ? l = t.__k[i] = Q(null, l, null, null, null) : te(l) ? l = t.__k[i] = Q(U, { children: l }, null, null, null) : l.constructor === void 0 && l.__b > 0 ? l = t.__k[i] = Q(l.type, l.props, l.key, l.ref ? l.ref : null, l.__v) : t.__k[i] = l, c = i + h, l.__ = t, l.__b = t.__b + 1, a = null, (_ = l.__i = at(l, n, c, r)) != -1 && (r--, (a = n[_]) && (a.__u |= 2)), a == null || a.__v == null ? (_ == -1 && (s > u ? h-- : s < u && h++), typeof l.type != "function" && (l.__u |= 4)) : _ != c && (_ == c - 1 ? h-- : _ == c + 1 ? h++ : (_ > c ? h-- : h++, l.__u |= 4))) : t.__k[i] = null;
|
|
55
|
+
if (r) for (i = 0; i < u; i++) (a = n[i]) != null && !(2 & a.__u) && (a.__e == o && (o = O(a)), je(a, a));
|
|
56
56
|
return o;
|
|
57
57
|
}
|
|
58
58
|
function Oe(t, e, n, o) {
|
|
@@ -67,25 +67,25 @@ function Oe(t, e, n, o) {
|
|
|
67
67
|
while (e != null && e.nodeType == 8);
|
|
68
68
|
return e;
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
var s, i, l,
|
|
72
|
-
if (
|
|
73
|
-
if (o > (
|
|
74
|
-
for (s = n - 1, i = n + 1; s >= 0 || i < e.length; ) if ((
|
|
70
|
+
function at(t, e, n, o) {
|
|
71
|
+
var s, i, l, a = t.key, c = t.type, _ = e[n], u = _ != null && (2 & _.__u) == 0;
|
|
72
|
+
if (_ === null && a == null || u && a == _.key && c == _.type) return n;
|
|
73
|
+
if (o > (u ? 1 : 0)) {
|
|
74
|
+
for (s = n - 1, i = n + 1; s >= 0 || i < e.length; ) if ((_ = e[l = s >= 0 ? s-- : i++]) != null && !(2 & _.__u) && a == _.key && c == _.type) return l;
|
|
75
75
|
}
|
|
76
76
|
return -1;
|
|
77
77
|
}
|
|
78
78
|
function ve(t, e, n) {
|
|
79
|
-
e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" ||
|
|
79
|
+
e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" || rt.test(e) ? n : n + "px";
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function J(t, e, n, o, s) {
|
|
82
82
|
var i, l;
|
|
83
83
|
e: if (e == "style") if (typeof n == "string") t.style.cssText = n;
|
|
84
84
|
else {
|
|
85
85
|
if (typeof o == "string" && (t.style.cssText = o = ""), o) for (e in o) n && e in n || ve(t.style, e, "");
|
|
86
86
|
if (n) for (e in n) o && n[e] == o[e] || ve(t.style, e, n[e]);
|
|
87
87
|
}
|
|
88
|
-
else if (e[0] == "o" && e[1] == "n") i = e != (e = e.replace(
|
|
88
|
+
else if (e[0] == "o" && e[1] == "n") i = e != (e = e.replace(Re, "$1")), l = e.toLowerCase(), e = l in t || e == "onFocusOut" || e == "onFocusIn" ? l.slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + i] = n, n ? o ? n.u = o.u : (n.u = ue, t.addEventListener(e, i ? ae : le, i)) : t.removeEventListener(e, i ? ae : le, i);
|
|
89
89
|
else {
|
|
90
90
|
if (s == "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 {
|
|
@@ -96,59 +96,59 @@ function V(t, e, n, o, s) {
|
|
|
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 = ue++;
|
|
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
|
|
110
|
-
var
|
|
109
|
+
function ge(t, e, n, o, s, i, l, a, c, _) {
|
|
110
|
+
var u, r, h, d, b, S, y, p, f, x, W, H, $, z, k, P, I, N = e.type;
|
|
111
111
|
if (e.constructor !== void 0) return null;
|
|
112
|
-
128 & n.__u && (c = !!(32 & n.__u), i = [
|
|
113
|
-
e: if (typeof
|
|
114
|
-
if (p = e.props, f = "prototype" in
|
|
112
|
+
128 & n.__u && (c = !!(32 & n.__u), i = [a = e.__e = n.__e]), (u = m.__b) && u(e);
|
|
113
|
+
e: if (typeof N == "function") try {
|
|
114
|
+
if (p = e.props, f = "prototype" in N && N.prototype.render, x = (u = N.contextType) && o[u.__c], W = u ? x ? x.props.value : u.__ : o, n.__c ? y = (r = e.__c = n.__c).__ = r.__E : (f ? e.__c = r = new N(p, W) : (e.__c = r = new G(p, W), r.constructor = N, r.render = ct), x && x.sub(r), r.state || (r.state = {}), r.__n = o, h = 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 = M({}, r.__s)), M(r.__s, N.getDerivedStateFromProps(p, r.__s))), d = r.props, b = r.state, r.__v = e, h) f && N.getDerivedStateFromProps == null && r.componentWillMount != null && r.componentWillMount(), f && r.componentDidMount != null && r.__h.push(r.componentDidMount);
|
|
115
115
|
else {
|
|
116
|
-
if (f &&
|
|
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 !== d && r.componentWillReceiveProps != null && r.componentWillReceiveProps(p, W), e.__v == n.__v || !r.__e && r.shouldComponentUpdate != null && r.shouldComponentUpdate(p, r.__s, W) === !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(E) {
|
|
118
|
+
E && (E.__ = e);
|
|
119
119
|
}), H = 0; H < r._sb.length; H++) r.__h.push(r._sb[H]);
|
|
120
120
|
r._sb = [], r.__h.length && l.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, W), f && r.componentDidUpdate != null && r.__h.push(function() {
|
|
124
|
+
r.componentDidUpdate(d, b, S);
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
if (r.context =
|
|
128
|
-
for (r.state = r.__s, r.__d = !1, $ && $(e),
|
|
127
|
+
if (r.context = W, r.props = p, r.__P = t, r.__e = !1, $ = m.__r, z = 0, f) {
|
|
128
|
+
for (r.state = r.__s, r.__d = !1, $ && $(e), u = r.render(r.props, r.state, r.context), k = 0; k < r._sb.length; k++) r.__h.push(r._sb[k]);
|
|
129
129
|
r._sb = [];
|
|
130
130
|
} else do
|
|
131
|
-
r.__d = !1, $ && $(e),
|
|
131
|
+
r.__d = !1, $ && $(e), u = r.render(r.props, r.state, r.context), r.state = r.__s;
|
|
132
132
|
while (r.__d && ++z < 25);
|
|
133
|
-
r.state = r.__s, r.getChildContext != null && (o =
|
|
134
|
-
} catch (
|
|
135
|
-
if (e.__v = null, c || i != null) if (
|
|
136
|
-
for (e.__u |= c ? 160 : 128;
|
|
137
|
-
i[i.indexOf(
|
|
133
|
+
r.state = r.__s, r.getChildContext != null && (o = M(M({}, o), r.getChildContext())), f && !h && r.getSnapshotBeforeUpdate != null && (S = r.getSnapshotBeforeUpdate(d, b)), P = u, u != null && u.type === U && u.key == null && (P = qe(u.props.children)), a = Le(t, te(P) ? P : [P], e, n, o, s, i, l, a, c, _), r.base = e.__e, e.__u &= -161, r.__h.length && l.push(r), y && (r.__E = r.__ = null);
|
|
134
|
+
} catch (E) {
|
|
135
|
+
if (e.__v = null, c || i != null) if (E.then) {
|
|
136
|
+
for (e.__u |= c ? 160 : 128; a && a.nodeType == 8 && a.nextSibling; ) a = a.nextSibling;
|
|
137
|
+
i[i.indexOf(a)] = null, e.__e = a;
|
|
138
138
|
} else {
|
|
139
|
-
for (I = i.length; I--; )
|
|
140
|
-
|
|
139
|
+
for (I = i.length; I--; ) de(i[I]);
|
|
140
|
+
_e(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, E.then || _e(e);
|
|
143
|
+
m.__e(E, e, n);
|
|
144
144
|
}
|
|
145
|
-
else i == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) :
|
|
146
|
-
return (
|
|
145
|
+
else i == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : a = e.__e = _t(n.__e, e, n, o, s, i, l, c, _);
|
|
146
|
+
return (u = m.diffed) && u(e), 128 & e.__u ? void 0 : a;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
t && t.__c && (t.__c.__e = !0), t && t.__k && t.__k.forEach(
|
|
148
|
+
function _e(t) {
|
|
149
|
+
t && t.__c && (t.__c.__e = !0), t && t.__k && t.__k.forEach(_e);
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function Qe(t, e, n) {
|
|
152
152
|
for (var o = 0; o < n.length; o++) he(n[o], n[++o], n[++o]);
|
|
153
153
|
m.__c && m.__c(e, t), t.some(function(s) {
|
|
154
154
|
try {
|
|
@@ -160,35 +160,35 @@ function Le(t, e, n) {
|
|
|
160
160
|
}
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
-
function
|
|
164
|
-
return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t :
|
|
163
|
+
function qe(t) {
|
|
164
|
+
return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : te(t) ? t.map(qe) : M({}, t);
|
|
165
165
|
}
|
|
166
|
-
function
|
|
167
|
-
var
|
|
166
|
+
function _t(t, e, n, o, s, i, l, a, c) {
|
|
167
|
+
var _, u, r, h, d, b, S, y = n.props || q, p = e.props, f = e.type;
|
|
168
168
|
if (f == "svg" ? s = "http://www.w3.org/2000/svg" : f == "math" ? s = "http://www.w3.org/1998/Math/MathML" : s || (s = "http://www.w3.org/1999/xhtml"), i != null) {
|
|
169
|
-
for (
|
|
170
|
-
t =
|
|
169
|
+
for (_ = 0; _ < i.length; _++) if ((d = i[_]) && "setAttribute" in d == !!f && (f ? d.localName == f : d.nodeType == 3)) {
|
|
170
|
+
t = d, i[_] = 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(s, f, p.is && p),
|
|
176
|
+
t = document.createElementNS(s, f, p.is && p), a && (m.__m && m.__m(e, i), a = !1), i = null;
|
|
177
177
|
}
|
|
178
|
-
if (f == null) y === p ||
|
|
178
|
+
if (f == null) y === p || a && t.data == p || (t.data = p);
|
|
179
179
|
else {
|
|
180
|
-
if (i = i && B.call(t.childNodes), !
|
|
181
|
-
for (
|
|
182
|
-
if (
|
|
183
|
-
else if (!(
|
|
184
|
-
if (
|
|
185
|
-
|
|
180
|
+
if (i = i && B.call(t.childNodes), !a && i != null) for (y = {}, _ = 0; _ < t.attributes.length; _++) y[(d = t.attributes[_]).name] = d.value;
|
|
181
|
+
for (_ in y) if (d = y[_], _ != "children") {
|
|
182
|
+
if (_ == "dangerouslySetInnerHTML") r = d;
|
|
183
|
+
else if (!(_ in p)) {
|
|
184
|
+
if (_ == "value" && "defaultValue" in p || _ == "checked" && "defaultChecked" in p) continue;
|
|
185
|
+
J(t, _, null, d, s);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
for (
|
|
189
|
-
if (
|
|
190
|
-
else if (r && (t.innerHTML = ""),
|
|
191
|
-
|
|
188
|
+
for (_ in p) d = p[_], _ == "children" ? h = d : _ == "dangerouslySetInnerHTML" ? u = d : _ == "value" ? b = d : _ == "checked" ? S = d : a && typeof d != "function" || y[_] === d || J(t, _, d, y[_], s);
|
|
189
|
+
if (u) a || r && (u.__html == r.__html || u.__html == t.innerHTML) || (t.innerHTML = u.__html), e.__k = [];
|
|
190
|
+
else if (r && (t.innerHTML = ""), Le(e.type == "template" ? t.content : t, te(h) ? h : [h], e, n, o, f == "foreignObject" ? "http://www.w3.org/1999/xhtml" : s, i, l, i ? i[0] : n.__k && O(n, 0), a, c), i != null) for (_ = i.length; _--; ) de(i[_]);
|
|
191
|
+
a || (_ = "value", f == "progress" && b == null ? t.removeAttribute("value") : b != null && (b !== t[_] || f == "progress" && !b || f == "option" && b != y[_]) && J(t, _, b, y[_], s), _ = "checked", S != null && S != t[_] && J(t, _, S, y[_], s));
|
|
192
192
|
}
|
|
193
193
|
return t;
|
|
194
194
|
}
|
|
@@ -202,7 +202,7 @@ function he(t, e, n) {
|
|
|
202
202
|
m.__e(s, n);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function je(t, e, n) {
|
|
206
206
|
var o, s;
|
|
207
207
|
if (m.unmount && m.unmount(t), (o = t.ref) && (o.current && o.current != t.__e || he(o, null, e)), (o = t.__c) != null) {
|
|
208
208
|
if (o.componentWillUnmount) try {
|
|
@@ -212,259 +212,259 @@ function qe(t, e, n) {
|
|
|
212
212
|
}
|
|
213
213
|
o.base = o.__P = null;
|
|
214
214
|
}
|
|
215
|
-
if (o = t.__k) for (s = 0; s < o.length; s++) o[s] &&
|
|
216
|
-
n ||
|
|
215
|
+
if (o = t.__k) for (s = 0; s < o.length; s++) o[s] && je(o[s], e, n || typeof t.type != "function");
|
|
216
|
+
n || de(t.__e), t.__c = t.__ = t.__e = void 0;
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function ct(t, e, n) {
|
|
219
219
|
return this.constructor(t, n);
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function ne(t, e, n) {
|
|
222
222
|
var o, s, i, l;
|
|
223
|
-
e == document && (e = document.documentElement), m.__ && m.__(t, e), s = (o = typeof n == "function") ? null : n && n.__k || e.__k, i = [], l = [],
|
|
223
|
+
e == document && (e = document.documentElement), m.__ && m.__(t, e), s = (o = typeof n == "function") ? null : n && n.__k || e.__k, i = [], l = [], ge(e, t = (!o && n || e).__k = L(U, null, [t]), s || q, q, e.namespaceURI, !o && n ? [n] : s ? null : e.firstChild ? B.call(e.childNodes) : null, i, !o && n ? n : s ? s.__e : e.firstChild, o, l), Qe(i, t, l);
|
|
224
224
|
}
|
|
225
|
-
function
|
|
226
|
-
|
|
225
|
+
function Be(t, e) {
|
|
226
|
+
ne(t, e, Be);
|
|
227
227
|
}
|
|
228
|
-
function
|
|
229
|
-
var o, s, i, l,
|
|
230
|
-
for (i in t.type && t.type.defaultProps && (l = t.type.defaultProps), e) i == "key" ? o = e[i] : i == "ref" ? s = e[i] :
|
|
231
|
-
return arguments.length > 2 && (
|
|
228
|
+
function ze(t, e, n) {
|
|
229
|
+
var o, s, i, l, a = M({}, t.props);
|
|
230
|
+
for (i in t.type && t.type.defaultProps && (l = t.type.defaultProps), e) i == "key" ? o = e[i] : i == "ref" ? s = e[i] : a[i] = e[i] === void 0 && l != null ? l[i] : e[i];
|
|
231
|
+
return arguments.length > 2 && (a.children = arguments.length > 3 ? B.call(arguments, 2) : n), Q(t.type, a, o || t.key, s || t.ref, null);
|
|
232
232
|
}
|
|
233
|
-
B =
|
|
233
|
+
B = Ue.slice, m = { __e: function(t, e, n, o) {
|
|
234
234
|
for (var s, i, l; e = e.__; ) if ((s = e.__c) && !s.__) try {
|
|
235
235
|
if ((i = s.constructor) && i.getDerivedStateFromError != null && (s.setState(i.getDerivedStateFromError(t)), l = s.__d), s.componentDidCatch != null && (s.componentDidCatch(t, o || {}), l = s.__d), l) return s.__E = s;
|
|
236
|
-
} catch (
|
|
237
|
-
t =
|
|
236
|
+
} catch (a) {
|
|
237
|
+
t = a;
|
|
238
238
|
}
|
|
239
239
|
throw t;
|
|
240
|
-
} },
|
|
240
|
+
} }, He = 0, G.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 = M({}, this.state), typeof t == "function" && (t = t(M({}, n), this.props)), t && M(n, t), t != null && this.__v && (e && this._sb.push(e), ye(this));
|
|
243
|
+
}, G.prototype.forceUpdate = function(t) {
|
|
244
244
|
this.__v && (this.__e = !0, t && this.__h.push(t), ye(this));
|
|
245
|
-
},
|
|
245
|
+
}, G.prototype.render = U, R = [], Pe = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Ie = function(t, e) {
|
|
246
246
|
return t.__v.__b - e.__v.__b;
|
|
247
|
-
},
|
|
248
|
-
function
|
|
249
|
-
return
|
|
247
|
+
}, Y.__r = 0, Re = /(PointerCapture)$|Capture$/i, ue = 0, le = be(!1), ae = be(!0);
|
|
248
|
+
function Z() {
|
|
249
|
+
return Z = Object.assign ? Object.assign.bind() : function(t) {
|
|
250
250
|
for (var e = 1; e < arguments.length; e++) {
|
|
251
251
|
var n = arguments[e];
|
|
252
252
|
for (var o in n) Object.prototype.hasOwnProperty.call(n, o) && (t[o] = n[o]);
|
|
253
253
|
}
|
|
254
254
|
return t;
|
|
255
|
-
},
|
|
255
|
+
}, Z.apply(this, arguments);
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function Ve(t, e) {
|
|
258
258
|
if (t == null) return {};
|
|
259
259
|
var n, o, s = {}, i = Object.keys(t);
|
|
260
260
|
for (o = 0; o < i.length; o++) e.indexOf(n = i[o]) >= 0 || (s[n] = t[n]);
|
|
261
261
|
return s;
|
|
262
262
|
}
|
|
263
|
-
var
|
|
264
|
-
function
|
|
263
|
+
var ut = ["context", "children"], dt = ["useFragment"];
|
|
264
|
+
function gt(t, e, n, o) {
|
|
265
265
|
function s() {
|
|
266
266
|
var i = Reflect.construct(HTMLElement, [], s);
|
|
267
267
|
return i._vdomComponent = t, i._root = i, i;
|
|
268
268
|
}
|
|
269
269
|
return (s.prototype = Object.create(HTMLElement.prototype)).constructor = s, s.prototype.connectedCallback = function() {
|
|
270
|
-
|
|
271
|
-
}, s.prototype.attributeChangedCallback =
|
|
270
|
+
ft.call(this, o);
|
|
271
|
+
}, s.prototype.attributeChangedCallback = pt, s.prototype.disconnectedCallback = mt, n = n || t.observedAttributes || Object.keys(t.propTypes || {}), s.observedAttributes = n, t.formAssociated && (s.formAssociated = !0), n.forEach(function(i) {
|
|
272
272
|
Object.defineProperty(s.prototype, i, { get: function() {
|
|
273
273
|
return this._vdom ? this._vdom.props[i] : this._props[i];
|
|
274
274
|
}, set: function(l) {
|
|
275
275
|
this._vdom ? this.attributeChangedCallback(i, null, l) : (this._props || (this._props = {}), this._props[i] = l);
|
|
276
|
-
var
|
|
277
|
-
l != null &&
|
|
276
|
+
var a = typeof l;
|
|
277
|
+
l != null && a !== "string" && a !== "boolean" && a !== "number" || this.setAttribute(i, l);
|
|
278
278
|
} });
|
|
279
279
|
}), customElements.define(e, s), s;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function ht(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, ut);
|
|
286
|
+
return ze(e, n);
|
|
287
287
|
}
|
|
288
|
-
function
|
|
288
|
+
function ft(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(ht, Z({}, this._props, { context: e.detail.context }), Ke(this, this._vdomComponent, t)), (this.hasAttribute("hydrate") ? Be : ne)(this._vdom, this._root);
|
|
291
291
|
}
|
|
292
|
-
function
|
|
292
|
+
function Je(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 pt(t, e, n) {
|
|
298
298
|
if (this._vdom) {
|
|
299
299
|
var o = {};
|
|
300
|
-
o[t] = n = n ?? void 0, o[
|
|
300
|
+
o[t] = n = n ?? void 0, o[Je(t)] = n, this._vdom = ze(this._vdom, o), ne(this._vdom, this._root);
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
|
-
function
|
|
304
|
-
|
|
303
|
+
function mt() {
|
|
304
|
+
ne(this._vdom = null, this._root);
|
|
305
305
|
}
|
|
306
|
-
function
|
|
307
|
-
var n = this, o = t.useFragment, s =
|
|
308
|
-
return
|
|
306
|
+
function Ce(t, e) {
|
|
307
|
+
var n = this, o = t.useFragment, s = Ve(t, dt);
|
|
308
|
+
return L(o ? U : "slot", Z({}, s, { ref: function(i) {
|
|
309
309
|
i ? (n.ref = i, n._listener || (n._listener = function(l) {
|
|
310
310
|
l.stopPropagation(), l.detail.context = e;
|
|
311
311
|
}, i.addEventListener("_preact", n._listener))) : n.ref.removeEventListener("_preact", n._listener);
|
|
312
312
|
} }));
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function Ke(t, e, n) {
|
|
315
315
|
if (t.nodeType === 3) return t.data;
|
|
316
316
|
if (t.nodeType !== 1) return null;
|
|
317
|
-
var o = [], s = {}, i = 0, l = t.attributes,
|
|
318
|
-
for (i = l.length; i--; ) l[i].name !== "slot" && (s[l[i].name] = l[i].value, s[
|
|
319
|
-
for (i =
|
|
320
|
-
var c =
|
|
321
|
-
|
|
317
|
+
var o = [], s = {}, i = 0, l = t.attributes, a = t.childNodes;
|
|
318
|
+
for (i = l.length; i--; ) l[i].name !== "slot" && (s[l[i].name] = l[i].value, s[Je(l[i].name)] = l[i].value);
|
|
319
|
+
for (i = a.length; i--; ) {
|
|
320
|
+
var c = Ke(a[i], null, n), _ = a[i].slot;
|
|
321
|
+
_ ? s[_] = L(Ce, { name: _ }, c) : o[i] = c;
|
|
322
322
|
}
|
|
323
|
-
var
|
|
324
|
-
return !
|
|
323
|
+
var u = !(!n || !n.shadow), r = e ? L(Ce, { useFragment: !u }, o) : o;
|
|
324
|
+
return !u && e && (t.innerHTML = ""), L(e || t.nodeName.toLowerCase(), s, r);
|
|
325
325
|
}
|
|
326
|
-
var
|
|
327
|
-
function
|
|
326
|
+
var wt = 0;
|
|
327
|
+
function g(t, e, n, o, s, i) {
|
|
328
328
|
e || (e = {});
|
|
329
|
-
var l,
|
|
330
|
-
if ("ref" in c) for (
|
|
331
|
-
var
|
|
332
|
-
if (typeof t == "function" && (l = t.defaultProps)) for (
|
|
333
|
-
return m.vnode && m.vnode(
|
|
334
|
-
}
|
|
335
|
-
var j, v,
|
|
336
|
-
function
|
|
337
|
-
|
|
329
|
+
var l, a, c = e;
|
|
330
|
+
if ("ref" in c) for (a in c = {}, e) a == "ref" ? l = e[a] : c[a] = e[a];
|
|
331
|
+
var _ = { type: t, props: c, key: n, ref: l, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --wt, __i: -1, __u: 0, __source: s, __self: i };
|
|
332
|
+
if (typeof t == "function" && (l = t.defaultProps)) for (a in l) c[a] === void 0 && (c[a] = l[a]);
|
|
333
|
+
return m.vnode && m.vnode(_), _;
|
|
334
|
+
}
|
|
335
|
+
var j, v, se, ke, ee = 0, Ge = [], C = m, Ae = C.__b, Se = C.__r, $e = C.diffed, We = C.__c, Ne = C.unmount, xe = C.__;
|
|
336
|
+
function fe(t, e) {
|
|
337
|
+
C.__h && C.__h(v, t, ee || e), ee = 0;
|
|
338
338
|
var n = v.__H || (v.__H = { __: [], __h: [] });
|
|
339
339
|
return t >= n.__.length && n.__.push({}), n.__[t];
|
|
340
340
|
}
|
|
341
341
|
function T(t) {
|
|
342
|
-
return
|
|
342
|
+
return ee = 1, yt(Ye, t);
|
|
343
343
|
}
|
|
344
|
-
function
|
|
345
|
-
var o =
|
|
346
|
-
if (o.t = t, !o.__c && (o.__ = [
|
|
347
|
-
var c = o.__N ? o.__N[0] : o.__[0],
|
|
348
|
-
c !==
|
|
344
|
+
function yt(t, e, n) {
|
|
345
|
+
var o = fe(j++, 2);
|
|
346
|
+
if (o.t = t, !o.__c && (o.__ = [Ye(void 0, e), function(a) {
|
|
347
|
+
var c = o.__N ? o.__N[0] : o.__[0], _ = o.t(c, a);
|
|
348
|
+
c !== _ && (o.__N = [_, o.__[1]], o.__c.setState({}));
|
|
349
349
|
}], o.__c = v, !v.__f)) {
|
|
350
|
-
var s = function(
|
|
350
|
+
var s = function(a, c, _) {
|
|
351
351
|
if (!o.__c.__H) return !0;
|
|
352
|
-
var
|
|
353
|
-
return !!
|
|
352
|
+
var u = o.__c.__H.__.filter(function(h) {
|
|
353
|
+
return !!h.__c;
|
|
354
354
|
});
|
|
355
|
-
if (
|
|
356
|
-
return !
|
|
357
|
-
})) return !i || i.call(this,
|
|
358
|
-
var r = o.__c.props !==
|
|
359
|
-
return
|
|
360
|
-
if (
|
|
361
|
-
var
|
|
362
|
-
|
|
355
|
+
if (u.every(function(h) {
|
|
356
|
+
return !h.__N;
|
|
357
|
+
})) return !i || i.call(this, a, c, _);
|
|
358
|
+
var r = o.__c.props !== a;
|
|
359
|
+
return u.forEach(function(h) {
|
|
360
|
+
if (h.__N) {
|
|
361
|
+
var d = h.__[0];
|
|
362
|
+
h.__ = h.__N, h.__N = void 0, d !== h.__[0] && (r = !0);
|
|
363
363
|
}
|
|
364
|
-
}), i && i.call(this,
|
|
364
|
+
}), i && i.call(this, a, c, _) || r;
|
|
365
365
|
};
|
|
366
366
|
v.__f = !0;
|
|
367
367
|
var i = v.shouldComponentUpdate, l = v.componentWillUpdate;
|
|
368
|
-
v.componentWillUpdate = function(
|
|
368
|
+
v.componentWillUpdate = function(a, c, _) {
|
|
369
369
|
if (this.__e) {
|
|
370
|
-
var
|
|
371
|
-
i = void 0, s(
|
|
370
|
+
var u = i;
|
|
371
|
+
i = void 0, s(a, c, _), i = u;
|
|
372
372
|
}
|
|
373
|
-
l && l.call(this,
|
|
373
|
+
l && l.call(this, a, c, _);
|
|
374
374
|
}, v.shouldComponentUpdate = s;
|
|
375
375
|
}
|
|
376
376
|
return o.__N || o.__;
|
|
377
377
|
}
|
|
378
|
-
function
|
|
379
|
-
var n =
|
|
380
|
-
!
|
|
378
|
+
function Fe(t, e) {
|
|
379
|
+
var n = fe(j++, 3);
|
|
380
|
+
!C.__s && Xe(n.__H, e) && (n.__ = t, n.u = e, v.__H.__h.push(n));
|
|
381
381
|
}
|
|
382
|
-
function
|
|
383
|
-
return
|
|
382
|
+
function Me(t) {
|
|
383
|
+
return ee = 5, vt(function() {
|
|
384
384
|
return { current: t };
|
|
385
385
|
}, []);
|
|
386
386
|
}
|
|
387
|
-
function
|
|
388
|
-
var n =
|
|
389
|
-
return
|
|
387
|
+
function vt(t, e) {
|
|
388
|
+
var n = fe(j++, 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 bt() {
|
|
392
|
+
for (var t; t = Ge.shift(); ) if (t.__P && t.__H) try {
|
|
393
|
+
t.__H.__h.forEach(X), t.__H.__h.forEach(ce), t.__H.__h = [];
|
|
394
394
|
} catch (e) {
|
|
395
|
-
t.__H.__h = [],
|
|
395
|
+
t.__H.__h = [], C.__e(e, t.__v);
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
|
-
|
|
399
|
-
v = null,
|
|
400
|
-
},
|
|
401
|
-
t && e.__k && e.__k.__m && (t.__m = e.__k.__m),
|
|
402
|
-
},
|
|
403
|
-
|
|
398
|
+
C.__b = function(t) {
|
|
399
|
+
v = null, Ae && Ae(t);
|
|
400
|
+
}, C.__ = function(t, e) {
|
|
401
|
+
t && e.__k && e.__k.__m && (t.__m = e.__k.__m), xe && xe(t, e);
|
|
402
|
+
}, C.__r = function(t) {
|
|
403
|
+
Se && Se(t), j = 0;
|
|
404
404
|
var e = (v = t.__c).__H;
|
|
405
|
-
e && (
|
|
405
|
+
e && (se === v ? (e.__h = [], v.__h = [], e.__.forEach(function(n) {
|
|
406
406
|
n.__N && (n.__ = n.__N), n.u = n.__N = void 0;
|
|
407
|
-
})) : (e.__h.forEach(
|
|
408
|
-
},
|
|
409
|
-
|
|
407
|
+
})) : (e.__h.forEach(X), e.__h.forEach(ce), e.__h = [], j = 0)), se = v;
|
|
408
|
+
}, C.diffed = function(t) {
|
|
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) || Ct)(bt)), e.__H.__.forEach(function(n) {
|
|
412
412
|
n.u && (n.__H = n.u), n.u = void 0;
|
|
413
|
-
})),
|
|
414
|
-
},
|
|
413
|
+
})), se = v = null;
|
|
414
|
+
}, C.__c = function(t, e) {
|
|
415
415
|
e.some(function(n) {
|
|
416
416
|
try {
|
|
417
|
-
n.__h.forEach(
|
|
418
|
-
return !o.__ ||
|
|
417
|
+
n.__h.forEach(X), n.__h = n.__h.filter(function(o) {
|
|
418
|
+
return !o.__ || ce(o);
|
|
419
419
|
});
|
|
420
420
|
} catch (o) {
|
|
421
421
|
e.some(function(s) {
|
|
422
422
|
s.__h && (s.__h = []);
|
|
423
|
-
}), e = [],
|
|
423
|
+
}), e = [], C.__e(o, n.__v);
|
|
424
424
|
}
|
|
425
|
-
}),
|
|
426
|
-
},
|
|
427
|
-
|
|
425
|
+
}), We && We(t, e);
|
|
426
|
+
}, C.unmount = function(t) {
|
|
427
|
+
Ne && Ne(t);
|
|
428
428
|
var e, n = t.__c;
|
|
429
429
|
n && n.__H && (n.__H.__.forEach(function(o) {
|
|
430
430
|
try {
|
|
431
|
-
|
|
431
|
+
X(o);
|
|
432
432
|
} catch (s) {
|
|
433
433
|
e = s;
|
|
434
434
|
}
|
|
435
|
-
}), n.__H = void 0, e &&
|
|
435
|
+
}), n.__H = void 0, e && C.__e(e, n.__v));
|
|
436
436
|
};
|
|
437
|
-
var
|
|
438
|
-
function
|
|
437
|
+
var Ee = typeof requestAnimationFrame == "function";
|
|
438
|
+
function Ct(t) {
|
|
439
439
|
var e, n = function() {
|
|
440
|
-
clearTimeout(o),
|
|
440
|
+
clearTimeout(o), Ee && cancelAnimationFrame(e), setTimeout(t);
|
|
441
441
|
}, o = setTimeout(n, 35);
|
|
442
|
-
|
|
442
|
+
Ee && (e = requestAnimationFrame(n));
|
|
443
443
|
}
|
|
444
|
-
function
|
|
444
|
+
function X(t) {
|
|
445
445
|
var e = v, n = t.__c;
|
|
446
446
|
typeof n == "function" && (t.__c = void 0, n()), v = e;
|
|
447
447
|
}
|
|
448
|
-
function
|
|
448
|
+
function ce(t) {
|
|
449
449
|
var e = v;
|
|
450
450
|
t.__c = t.__(), v = e;
|
|
451
451
|
}
|
|
452
|
-
function
|
|
452
|
+
function Xe(t, e) {
|
|
453
453
|
return !t || t.length !== e.length || e.some(function(n, o) {
|
|
454
454
|
return n !== t[o];
|
|
455
455
|
});
|
|
456
456
|
}
|
|
457
|
-
function
|
|
457
|
+
function Ye(t, e) {
|
|
458
458
|
return typeof e == "function" ? e(t) : e;
|
|
459
459
|
}
|
|
460
|
-
const
|
|
461
|
-
let
|
|
460
|
+
const kt = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
461
|
+
let K = (t = 21) => {
|
|
462
462
|
let e = "", n = crypto.getRandomValues(new Uint8Array(t |= 0));
|
|
463
463
|
for (; t--; )
|
|
464
|
-
e +=
|
|
464
|
+
e += kt[n[t] & 63];
|
|
465
465
|
return e;
|
|
466
466
|
};
|
|
467
|
-
class
|
|
467
|
+
class At {
|
|
468
468
|
constructor(e, n) {
|
|
469
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.queueCallbacks = /* @__PURE__ */ new Set(), this.messages = [], this.reconnectAttempts = 0, this.maxReconnectAttempts = 5, this.reconnectDelay = 1e3, this.isAgentStreaming = !1, this.messageQueue = [];
|
|
470
470
|
}
|
|
@@ -547,7 +547,7 @@ class Ct {
|
|
|
547
547
|
] : [
|
|
548
548
|
...o,
|
|
549
549
|
{
|
|
550
|
-
id:
|
|
550
|
+
id: K(),
|
|
551
551
|
role: "assistant",
|
|
552
552
|
content: n.text,
|
|
553
553
|
timestamp: Date.now(),
|
|
@@ -566,7 +566,7 @@ class Ct {
|
|
|
566
566
|
else if (n.type === "tool-call") {
|
|
567
567
|
console.log("[Widget] Tool call:", n.tool);
|
|
568
568
|
const o = {
|
|
569
|
-
id:
|
|
569
|
+
id: K(),
|
|
570
570
|
role: "tool",
|
|
571
571
|
content: `Calling tool: ${n.tool.name}`,
|
|
572
572
|
timestamp: Date.now(),
|
|
@@ -575,7 +575,12 @@ class Ct {
|
|
|
575
575
|
arguments: n.tool.arguments
|
|
576
576
|
}
|
|
577
577
|
};
|
|
578
|
-
this.setMessages((s) => [...s, o])
|
|
578
|
+
this.setMessages((s) => [...s, o]), n.tool.name === "suggest_options" && n.tool.arguments?.options && this.setMessages((s) => {
|
|
579
|
+
const i = [...s].reverse().find((l) => l.role === "assistant");
|
|
580
|
+
return i ? s.map(
|
|
581
|
+
(l) => l.id === i.id ? { ...l, suggestions: [...l.suggestions || [], ...n.tool.arguments.options] } : l
|
|
582
|
+
) : s;
|
|
583
|
+
});
|
|
579
584
|
} else n.type === "tool-result" ? (console.log("[Widget] Tool result:", n.result), this.setMessages((o) => {
|
|
580
585
|
const s = o[o.length - 1];
|
|
581
586
|
return s && s.role === "tool" && !s.toolResult ? [
|
|
@@ -583,7 +588,14 @@ class Ct {
|
|
|
583
588
|
{ ...s, content: s.content + `
|
|
584
589
|
Result: ${JSON.stringify(n.result)}`, toolResult: n.result }
|
|
585
590
|
] : o;
|
|
586
|
-
})) : 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}`) : console.log("[Widget]
|
|
591
|
+
})) : 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) => {
|
|
592
|
+
const s = [...o].reverse().find((i) => i.role === "assistant");
|
|
593
|
+
if (s) {
|
|
594
|
+
const i = s.suggestions || [], l = Array.from(/* @__PURE__ */ new Set([...i, ...n.suggestions]));
|
|
595
|
+
return o.map((a) => a.id === s.id ? { ...a, suggestions: l } : a);
|
|
596
|
+
}
|
|
597
|
+
return o;
|
|
598
|
+
})) : console.log("[Widget] Unknown message type:", n.type);
|
|
587
599
|
} catch (n) {
|
|
588
600
|
console.error("[Widget] Error parsing message:", e.data, n);
|
|
589
601
|
}
|
|
@@ -595,7 +607,7 @@ Result: ${JSON.stringify(n.result)}`, toolResult: n.result }
|
|
|
595
607
|
if (!this.ws || this.ws.readyState !== WebSocket.OPEN)
|
|
596
608
|
throw new Error("Not connected to agent");
|
|
597
609
|
const n = {
|
|
598
|
-
id:
|
|
610
|
+
id: K(),
|
|
599
611
|
role: "user",
|
|
600
612
|
content: e,
|
|
601
613
|
timestamp: Date.now()
|
|
@@ -635,7 +647,7 @@ Result: ${JSON.stringify(n.result)}`, toolResult: n.result }
|
|
|
635
647
|
*/
|
|
636
648
|
getSessionId() {
|
|
637
649
|
let e = sessionStorage.getItem("ariaflow_session_id");
|
|
638
|
-
return e || (e =
|
|
650
|
+
return e || (e = K(), sessionStorage.setItem("ariaflow_session_id", e)), e;
|
|
639
651
|
}
|
|
640
652
|
/**
|
|
641
653
|
* Update messages state
|
|
@@ -718,13 +730,13 @@ Result: ${JSON.stringify(n.result)}`, toolResult: n.result }
|
|
|
718
730
|
this.ws && (this.ws.close(), this.ws = null), this.messageCallbacks.clear(), this.connectionCallbacks.clear();
|
|
719
731
|
}
|
|
720
732
|
}
|
|
721
|
-
const
|
|
733
|
+
const re = {
|
|
722
734
|
none: "0",
|
|
723
735
|
small: "0.375rem",
|
|
724
736
|
medium: "0.75rem",
|
|
725
737
|
large: "1rem"
|
|
726
738
|
};
|
|
727
|
-
function
|
|
739
|
+
function St({
|
|
728
740
|
agentUrl: t,
|
|
729
741
|
agentId: e,
|
|
730
742
|
// Legacy props for backward compatibility
|
|
@@ -733,73 +745,75 @@ function kt({
|
|
|
733
745
|
mode: s = "chat",
|
|
734
746
|
theme: i = "light",
|
|
735
747
|
position: l = "bottom-right",
|
|
736
|
-
size:
|
|
748
|
+
size: a = "full",
|
|
737
749
|
radius: c = "medium",
|
|
738
|
-
baseColor:
|
|
739
|
-
accentColor:
|
|
750
|
+
baseColor: _,
|
|
751
|
+
accentColor: u = "#14B8A6",
|
|
740
752
|
buttonBaseColor: r = "#000000",
|
|
741
|
-
buttonAccentColor:
|
|
742
|
-
title:
|
|
743
|
-
subtitle:
|
|
744
|
-
emptyChatMessage:
|
|
753
|
+
buttonAccentColor: h = "#FFFFFF",
|
|
754
|
+
title: d,
|
|
755
|
+
subtitle: b,
|
|
756
|
+
emptyChatMessage: S
|
|
745
757
|
}) {
|
|
746
|
-
const [y, p] = T(!1), [f, x] = T([]), [
|
|
747
|
-
|
|
758
|
+
const [y, p] = T(!1), [f, x] = T([]), [W, H] = T(""), [$, z] = T(!1), [k, P] = T(!1), [I, N] = T(null), [E, Ze] = T(!1), [oe, et] = T(0), V = Me(null), pe = Me(null);
|
|
759
|
+
Fe(() => ((async () => {
|
|
748
760
|
if (t && e) {
|
|
749
761
|
console.log("[AriaFlow Widget] Using new agent resolution:", { agentUrl: t, agentId: e });
|
|
750
|
-
const
|
|
751
|
-
|
|
762
|
+
const F = new At(t, e);
|
|
763
|
+
V.current = F;
|
|
752
764
|
try {
|
|
753
|
-
|
|
754
|
-
console.log("[AriaFlow Widget] Messages updated:",
|
|
755
|
-
}),
|
|
756
|
-
console.log("[AriaFlow Widget] Connection state:",
|
|
757
|
-
}),
|
|
758
|
-
console.log("[AriaFlow Widget] Streaming state:",
|
|
759
|
-
}),
|
|
760
|
-
console.log("[AriaFlow Widget] Queue count:",
|
|
765
|
+
F.onMessages((A) => {
|
|
766
|
+
console.log("[AriaFlow Widget] Messages updated:", A.length), x(A);
|
|
767
|
+
}), F.onConnectionChange((A) => {
|
|
768
|
+
console.log("[AriaFlow Widget] Connection state:", A), z(A), A && P(!0);
|
|
769
|
+
}), F.onStreamingChange((A) => {
|
|
770
|
+
console.log("[AriaFlow Widget] Streaming state:", A), Ze(A);
|
|
771
|
+
}), F.onQueueChange((A) => {
|
|
772
|
+
console.log("[AriaFlow Widget] Queue count:", A), et(A);
|
|
761
773
|
});
|
|
762
|
-
const
|
|
763
|
-
console.log("[AriaFlow Widget] Agent config received:",
|
|
764
|
-
} catch (
|
|
765
|
-
console.error("[AriaFlow Widget] Initialization error:",
|
|
774
|
+
const D = await F.initWidget();
|
|
775
|
+
console.log("[AriaFlow Widget] Agent config received:", D), D ? (N(D), console.log("[AriaFlow Widget] Widget initialized successfully")) : console.error("[AriaFlow Widget] Agent config fetch failed");
|
|
776
|
+
} catch (D) {
|
|
777
|
+
console.error("[AriaFlow Widget] Initialization error:", D);
|
|
766
778
|
}
|
|
767
779
|
} 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")) : o && 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.");
|
|
768
780
|
})(), () => {
|
|
769
|
-
|
|
770
|
-
}), [t, e, n, o]),
|
|
771
|
-
|
|
781
|
+
V.current?.dispose();
|
|
782
|
+
}), [t, e, n, o]), Fe(() => {
|
|
783
|
+
pe.current?.scrollIntoView({ behavior: "smooth" });
|
|
772
784
|
}, [f]);
|
|
773
|
-
const
|
|
774
|
-
if (!
|
|
775
|
-
const
|
|
785
|
+
const me = async () => {
|
|
786
|
+
if (!W.trim() || !$) return;
|
|
787
|
+
const w = W.trim();
|
|
776
788
|
H("");
|
|
777
789
|
try {
|
|
778
|
-
await
|
|
779
|
-
} catch (
|
|
780
|
-
console.error("Failed to send message:",
|
|
790
|
+
await V.current?.sendMessage(w);
|
|
791
|
+
} catch (F) {
|
|
792
|
+
console.error("Failed to send message:", F);
|
|
781
793
|
}
|
|
782
|
-
},
|
|
783
|
-
|
|
784
|
-
},
|
|
785
|
-
|
|
794
|
+
}, tt = (w) => {
|
|
795
|
+
w.key === "Enter" && !w.shiftKey && (w.preventDefault(), me());
|
|
796
|
+
}, nt = (w) => {
|
|
797
|
+
!$ || E || V.current?.sendMessage(w);
|
|
798
|
+
}, ot = d || I?.config.title || "Chat with us", it = b || I?.config.subtitle || "We typically reply within minutes", st = S || I?.config.emptyChatMessage || "Start a conversation...";
|
|
799
|
+
return console.log("[AriaFlow Widget] Rendering widget component", { isInitialized: k, isOpen: y, position: l }), /* @__PURE__ */ g(
|
|
786
800
|
"div",
|
|
787
801
|
{
|
|
788
|
-
className: `ariaflow-widget-container ariaflow-widget-${l} ariaflow-widget-${
|
|
802
|
+
className: `ariaflow-widget-container ariaflow-widget-${l} ariaflow-widget-${a} ariaflow-widget-radius-${c}`,
|
|
789
803
|
"data-theme": i,
|
|
790
804
|
style: {
|
|
791
|
-
"--ariaflow-accent-color":
|
|
792
|
-
"--ariaflow-base-color":
|
|
805
|
+
"--ariaflow-accent-color": u,
|
|
806
|
+
"--ariaflow-base-color": _
|
|
793
807
|
},
|
|
794
808
|
children: [
|
|
795
|
-
!y && /* @__PURE__ */
|
|
809
|
+
!y && /* @__PURE__ */ g(
|
|
796
810
|
"button",
|
|
797
811
|
{
|
|
798
812
|
className: "ariaflow-widget-launcher",
|
|
799
813
|
onClick: () => p(!0),
|
|
800
814
|
style: {
|
|
801
815
|
backgroundColor: r,
|
|
802
|
-
color:
|
|
816
|
+
color: h,
|
|
803
817
|
opacity: k ? 1 : 0.8,
|
|
804
818
|
cursor: k ? "pointer" : "wait",
|
|
805
819
|
position: "relative"
|
|
@@ -808,7 +822,7 @@ function kt({
|
|
|
808
822
|
disabled: !k,
|
|
809
823
|
title: k ? "Click to start chat" : "Connecting to agent...",
|
|
810
824
|
children: [
|
|
811
|
-
!k && /* @__PURE__ */
|
|
825
|
+
!k && /* @__PURE__ */ g(
|
|
812
826
|
"div",
|
|
813
827
|
{
|
|
814
828
|
className: "ariaflow-widget-launcher-loading",
|
|
@@ -819,14 +833,14 @@ function kt({
|
|
|
819
833
|
transform: "translate(-50%, -50%)",
|
|
820
834
|
width: "20px",
|
|
821
835
|
height: "20px",
|
|
822
|
-
border: `2px solid ${
|
|
836
|
+
border: `2px solid ${h}`,
|
|
823
837
|
borderTop: "2px solid transparent",
|
|
824
838
|
borderRadius: "50%",
|
|
825
839
|
animation: "spin 1s linear infinite"
|
|
826
840
|
}
|
|
827
841
|
}
|
|
828
842
|
),
|
|
829
|
-
k && /* @__PURE__ */
|
|
843
|
+
k && /* @__PURE__ */ g(
|
|
830
844
|
"svg",
|
|
831
845
|
{
|
|
832
846
|
width: "24",
|
|
@@ -835,41 +849,41 @@ function kt({
|
|
|
835
849
|
fill: "none",
|
|
836
850
|
stroke: "currentColor",
|
|
837
851
|
strokeWidth: "2",
|
|
838
|
-
children: /* @__PURE__ */
|
|
852
|
+
children: /* @__PURE__ */ g("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" })
|
|
839
853
|
}
|
|
840
854
|
)
|
|
841
855
|
]
|
|
842
856
|
}
|
|
843
857
|
),
|
|
844
|
-
y && k && /* @__PURE__ */
|
|
858
|
+
y && k && /* @__PURE__ */ g(
|
|
845
859
|
"div",
|
|
846
860
|
{
|
|
847
861
|
className: "ariaflow-widget-window",
|
|
848
862
|
style: {
|
|
849
|
-
backgroundColor: i === "dark" &&
|
|
850
|
-
borderRadius:
|
|
863
|
+
backgroundColor: i === "dark" && _ ? _ : void 0,
|
|
864
|
+
borderRadius: re[c]
|
|
851
865
|
},
|
|
852
866
|
children: [
|
|
853
|
-
/* @__PURE__ */
|
|
867
|
+
/* @__PURE__ */ g(
|
|
854
868
|
"div",
|
|
855
869
|
{
|
|
856
870
|
className: "ariaflow-widget-header",
|
|
857
871
|
style: {
|
|
858
|
-
backgroundColor:
|
|
859
|
-
borderRadius: c === "none" ? "0" : `${
|
|
872
|
+
backgroundColor: u,
|
|
873
|
+
borderRadius: c === "none" ? "0" : `${re[c]} ${re[c]} 0 0`
|
|
860
874
|
},
|
|
861
875
|
children: [
|
|
862
|
-
/* @__PURE__ */
|
|
863
|
-
/* @__PURE__ */
|
|
864
|
-
/* @__PURE__ */
|
|
876
|
+
/* @__PURE__ */ g("div", { className: "ariaflow-widget-header-content", children: /* @__PURE__ */ g("div", { className: "ariaflow-widget-title-group", children: [
|
|
877
|
+
/* @__PURE__ */ g("h3", { className: "ariaflow-widget-title", children: ot }),
|
|
878
|
+
/* @__PURE__ */ g("p", { className: "ariaflow-widget-subtitle", children: it })
|
|
865
879
|
] }) }),
|
|
866
|
-
/* @__PURE__ */
|
|
880
|
+
/* @__PURE__ */ g(
|
|
867
881
|
"button",
|
|
868
882
|
{
|
|
869
883
|
className: "ariaflow-widget-close",
|
|
870
884
|
onClick: () => p(!1),
|
|
871
885
|
"aria-label": "Close chat",
|
|
872
|
-
children: /* @__PURE__ */
|
|
886
|
+
children: /* @__PURE__ */ g(
|
|
873
887
|
"svg",
|
|
874
888
|
{
|
|
875
889
|
width: "20",
|
|
@@ -879,8 +893,8 @@ function kt({
|
|
|
879
893
|
stroke: "currentColor",
|
|
880
894
|
strokeWidth: "2",
|
|
881
895
|
children: [
|
|
882
|
-
/* @__PURE__ */
|
|
883
|
-
/* @__PURE__ */
|
|
896
|
+
/* @__PURE__ */ g("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
897
|
+
/* @__PURE__ */ g("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
884
898
|
]
|
|
885
899
|
}
|
|
886
900
|
)
|
|
@@ -889,66 +903,84 @@ function kt({
|
|
|
889
903
|
]
|
|
890
904
|
}
|
|
891
905
|
),
|
|
892
|
-
!$ && /* @__PURE__ */
|
|
893
|
-
/* @__PURE__ */
|
|
906
|
+
!$ && /* @__PURE__ */ g("div", { className: "ariaflow-widget-status", children: [
|
|
907
|
+
/* @__PURE__ */ g("span", { className: "ariaflow-widget-status-dot" }),
|
|
894
908
|
"Connecting..."
|
|
895
909
|
] }),
|
|
896
|
-
/* @__PURE__ */
|
|
897
|
-
f.map((
|
|
898
|
-
"
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
" ",
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
/* @__PURE__ */
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
910
|
+
/* @__PURE__ */ g("div", { className: "ariaflow-widget-messages", children: f.length === 0 ? /* @__PURE__ */ g("div", { className: "ariaflow-widget-empty", children: /* @__PURE__ */ g("p", { children: $ ? st : "Connecting to agent..." }) }) : /* @__PURE__ */ g(U, { children: [
|
|
911
|
+
f.map((w, F) => {
|
|
912
|
+
const A = F === f.length - 1 && w.role === "assistant" && !w.isStreaming && w.suggestions && w.suggestions.length > 0;
|
|
913
|
+
return /* @__PURE__ */ g(
|
|
914
|
+
"div",
|
|
915
|
+
{
|
|
916
|
+
className: `ariaflow-widget-message ariaflow-widget-message-${w.role}`,
|
|
917
|
+
children: [
|
|
918
|
+
/* @__PURE__ */ g("div", { className: "ariaflow-widget-message-bubble", children: w.role === "tool" ? /* @__PURE__ */ g("div", { className: "ariaflow-widget-tool-message", children: [
|
|
919
|
+
/* @__PURE__ */ g("div", { className: "ariaflow-widget-tool-header", children: [
|
|
920
|
+
"🔧 ",
|
|
921
|
+
w.toolCall?.name
|
|
922
|
+
] }),
|
|
923
|
+
/* @__PURE__ */ g("div", { className: "ariaflow-widget-tool-content", children: [
|
|
924
|
+
w.toolCall && /* @__PURE__ */ g("div", { className: "ariaflow-widget-tool-args", children: [
|
|
925
|
+
/* @__PURE__ */ g("strong", { children: "Arguments:" }),
|
|
926
|
+
" ",
|
|
927
|
+
JSON.stringify(w.toolCall.arguments, null, 2)
|
|
928
|
+
] }),
|
|
929
|
+
w.toolResult && /* @__PURE__ */ g("div", { className: "ariaflow-widget-tool-result", children: [
|
|
930
|
+
/* @__PURE__ */ g("strong", { children: "Result:" }),
|
|
931
|
+
" ",
|
|
932
|
+
JSON.stringify(w.toolResult, null, 2)
|
|
933
|
+
] })
|
|
934
|
+
] })
|
|
935
|
+
] }) : /* @__PURE__ */ g(U, { children: [
|
|
936
|
+
w.content,
|
|
937
|
+
w.isStreaming && /* @__PURE__ */ g("span", { className: "ariaflow-widget-typing-indicator", children: [
|
|
938
|
+
/* @__PURE__ */ g("span", { children: "•" }),
|
|
939
|
+
/* @__PURE__ */ g("span", { children: "•" }),
|
|
940
|
+
/* @__PURE__ */ g("span", { children: "•" })
|
|
941
|
+
] })
|
|
942
|
+
] }) }),
|
|
943
|
+
A && /* @__PURE__ */ g("div", { className: "ariaflow-widget-chips-container", children: w.suggestions?.map((ie) => /* @__PURE__ */ g(
|
|
944
|
+
"button",
|
|
945
|
+
{
|
|
946
|
+
className: "ariaflow-widget-chip",
|
|
947
|
+
onClick: () => nt(ie),
|
|
948
|
+
style: {
|
|
949
|
+
borderColor: u,
|
|
950
|
+
color: u
|
|
951
|
+
},
|
|
952
|
+
children: ie
|
|
953
|
+
},
|
|
954
|
+
ie
|
|
955
|
+
)) })
|
|
956
|
+
]
|
|
957
|
+
},
|
|
958
|
+
w.id
|
|
959
|
+
);
|
|
960
|
+
}),
|
|
961
|
+
/* @__PURE__ */ g("div", { ref: pe })
|
|
930
962
|
] }) }),
|
|
931
|
-
/* @__PURE__ */
|
|
932
|
-
/* @__PURE__ */
|
|
963
|
+
/* @__PURE__ */ g("div", { className: "ariaflow-widget-input", children: [
|
|
964
|
+
/* @__PURE__ */ g(
|
|
933
965
|
"textarea",
|
|
934
966
|
{
|
|
935
|
-
value:
|
|
936
|
-
onInput: (
|
|
937
|
-
onKeyDown:
|
|
938
|
-
placeholder: $ ?
|
|
967
|
+
value: W,
|
|
968
|
+
onInput: (w) => H(w.target.value),
|
|
969
|
+
onKeyDown: tt,
|
|
970
|
+
placeholder: $ ? E ? oe > 0 ? `Agent is responding... (${oe} message${oe > 1 ? "s" : ""} queued)` : "Agent is responding..." : "Type your message..." : "Connecting...",
|
|
939
971
|
rows: 1,
|
|
940
972
|
disabled: !$
|
|
941
973
|
}
|
|
942
974
|
),
|
|
943
|
-
/* @__PURE__ */
|
|
975
|
+
/* @__PURE__ */ g(
|
|
944
976
|
"button",
|
|
945
977
|
{
|
|
946
978
|
className: "ariaflow-widget-send",
|
|
947
|
-
onClick:
|
|
948
|
-
disabled: !
|
|
949
|
-
style: { backgroundColor:
|
|
979
|
+
onClick: me,
|
|
980
|
+
disabled: !W.trim() || !$,
|
|
981
|
+
style: { backgroundColor: u },
|
|
950
982
|
"aria-label": "Send message",
|
|
951
|
-
children: /* @__PURE__ */
|
|
983
|
+
children: /* @__PURE__ */ g(
|
|
952
984
|
"svg",
|
|
953
985
|
{
|
|
954
986
|
width: "18",
|
|
@@ -958,8 +990,8 @@ function kt({
|
|
|
958
990
|
stroke: "currentColor",
|
|
959
991
|
strokeWidth: "2",
|
|
960
992
|
children: [
|
|
961
|
-
/* @__PURE__ */
|
|
962
|
-
/* @__PURE__ */
|
|
993
|
+
/* @__PURE__ */ g("line", { x1: "22", y1: "2", x2: "11", y2: "13" }),
|
|
994
|
+
/* @__PURE__ */ g("polygon", { points: "22 2 15 22 11 13 2 9 22 2" })
|
|
963
995
|
]
|
|
964
996
|
}
|
|
965
997
|
)
|
|
@@ -973,8 +1005,8 @@ function kt({
|
|
|
973
1005
|
}
|
|
974
1006
|
);
|
|
975
1007
|
}
|
|
976
|
-
|
|
977
|
-
|
|
1008
|
+
gt(
|
|
1009
|
+
St,
|
|
978
1010
|
"ariaflow-widget",
|
|
979
1011
|
// Properties to observe from HTML attributes (mirror Vapi's naming convention)
|
|
980
1012
|
[
|
|
@@ -1000,12 +1032,12 @@ ut(
|
|
|
1000
1032
|
// Shadow DOM (optional, set to false for light DOM)
|
|
1001
1033
|
!1
|
|
1002
1034
|
);
|
|
1003
|
-
typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded",
|
|
1004
|
-
function
|
|
1035
|
+
typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", Te) : Te());
|
|
1036
|
+
function Te() {
|
|
1005
1037
|
const t = document.querySelectorAll("ariaflow-widget");
|
|
1006
1038
|
console.log(`[AriaFlow] Initializing ${t.length} widget(s)`);
|
|
1007
1039
|
}
|
|
1008
1040
|
export {
|
|
1009
|
-
|
|
1010
|
-
|
|
1041
|
+
St as Widget,
|
|
1042
|
+
At as WidgetClient
|
|
1011
1043
|
};
|