@anam-ai/agent-widget 0.1.0-alpha.3 → 0.1.0-alpha.5
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/index.js +380 -369
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var $e, k, hi, fi, Ee, Ht, pi, _i, Ei,
|
|
1
|
+
var $e, k, hi, fi, Ee, Ht, pi, _i, Ei, It, _t, Et, Ue = {}, mi = [], an = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, rt = Array.isArray;
|
|
2
2
|
function ie(t, e) {
|
|
3
3
|
for (var n in e) t[n] = e[n];
|
|
4
4
|
return t;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function bt(t) {
|
|
7
7
|
t && t.parentNode && t.parentNode.removeChild(t);
|
|
8
8
|
}
|
|
9
9
|
function Ce(t, e, n) {
|
|
@@ -41,17 +41,17 @@ function Wt(t) {
|
|
|
41
41
|
(!t.__d && (t.__d = !0) && Ee.push(t) && !Xe.__r++ || Ht != k.debounceRendering) && ((Ht = k.debounceRendering) || pi)(Xe);
|
|
42
42
|
}
|
|
43
43
|
function Xe() {
|
|
44
|
-
for (var t, e, n, o, c, a, u, l = 1; Ee.length; ) Ee.length > l && Ee.sort(_i), t = Ee.shift(), l = Ee.length, t.__d && (n = void 0, o = void 0, c = (o = (e = t).__v).__e, a = [], u = [], e.__P && ((n = ie({}, o)).__v = o.__v + 1, k.vnode && k.vnode(n),
|
|
44
|
+
for (var t, e, n, o, c, a, u, l = 1; Ee.length; ) Ee.length > l && Ee.sort(_i), t = Ee.shift(), l = Ee.length, t.__d && (n = void 0, o = void 0, c = (o = (e = t).__v).__e, a = [], u = [], e.__P && ((n = ie({}, o)).__v = o.__v + 1, k.vnode && k.vnode(n), At(e.__P, n, o, e.__n, e.__P.namespaceURI, 32 & o.__u ? [c] : null, a, c ?? be(o), !!(32 & o.__u), u), n.__v = o.__v, n.__.__k[n.__i] = n, Si(a, n, u), o.__e = o.__ = null, n.__e != c && gi(n)));
|
|
45
45
|
Xe.__r = 0;
|
|
46
46
|
}
|
|
47
|
-
function vi(t, e, n, o, c, a, u, l,
|
|
48
|
-
var d, S,
|
|
49
|
-
for (
|
|
50
|
-
return n.__e =
|
|
47
|
+
function vi(t, e, n, o, c, a, u, l, m, p, _) {
|
|
48
|
+
var d, S, g, y, A, b, w, I = o && o.__k || mi, R = e.length;
|
|
49
|
+
for (m = ln(n, e, I, m, R), d = 0; d < R; d++) (g = n.__k[d]) != null && (S = g.__i == -1 ? Ue : I[g.__i] || Ue, g.__i = d, b = At(t, g, S, c, a, u, l, m, p, _), y = g.__e, g.ref && S.ref != g.ref && (S.ref && Tt(S.ref, null, g), _.push(g.ref, g.__c || y, g)), A == null && y != null && (A = y), (w = !!(4 & g.__u)) || S.__k === g.__k ? m = yi(g, m, t, w) : typeof g.type == "function" && b !== void 0 ? m = b : y && (m = y.nextSibling), g.__u &= -7);
|
|
50
|
+
return n.__e = A, m;
|
|
51
51
|
}
|
|
52
52
|
function ln(t, e, n, o, c) {
|
|
53
|
-
var a, u, l,
|
|
54
|
-
for (t.__k = new Array(c), a = 0; a < c; a++) (u = e[a]) != null && typeof u != "boolean" && typeof u != "function" ? (typeof u == "string" || typeof u == "number" || typeof u == "bigint" || u.constructor == String ? u = t.__k[a] = xe(null, u, null, null, null) : rt(u) ? u = t.__k[a] = xe(oe, { children: u }, null, null, null) : u.constructor === void 0 && u.__b > 0 ? u = t.__k[a] = xe(u.type, u.props, u.key, u.ref ? u.ref : null, u.__v) : t.__k[a] = u,
|
|
53
|
+
var a, u, l, m, p, _ = n.length, d = _, S = 0;
|
|
54
|
+
for (t.__k = new Array(c), a = 0; a < c; a++) (u = e[a]) != null && typeof u != "boolean" && typeof u != "function" ? (typeof u == "string" || typeof u == "number" || typeof u == "bigint" || u.constructor == String ? u = t.__k[a] = xe(null, u, null, null, null) : rt(u) ? u = t.__k[a] = xe(oe, { children: u }, null, null, null) : u.constructor === void 0 && u.__b > 0 ? u = t.__k[a] = xe(u.type, u.props, u.key, u.ref ? u.ref : null, u.__v) : t.__k[a] = u, m = a + S, u.__ = t, u.__b = t.__b + 1, l = null, (p = u.__i = cn(u, n, m, d)) != -1 && (d--, (l = n[p]) && (l.__u |= 2)), l == null || l.__v == null ? (p == -1 && (c > _ ? S-- : c < _ && S++), typeof u.type != "function" && (u.__u |= 4)) : p != m && (p == m - 1 ? S-- : p == m + 1 ? S++ : (p > m ? S-- : S++, u.__u |= 4))) : t.__k[a] = null;
|
|
55
55
|
if (d) for (a = 0; a < _; a++) (l = n[a]) != null && (2 & l.__u) == 0 && (l.__e == o && (o = be(l)), Ci(l, l));
|
|
56
56
|
return o;
|
|
57
57
|
}
|
|
@@ -68,10 +68,10 @@ function yi(t, e, n, o) {
|
|
|
68
68
|
return e;
|
|
69
69
|
}
|
|
70
70
|
function cn(t, e, n, o) {
|
|
71
|
-
var c, a, u, l = t.key,
|
|
72
|
-
if (p === null && l == null || _ && l == p.key &&
|
|
71
|
+
var c, a, u, l = t.key, m = t.type, p = e[n], _ = p != null && (2 & p.__u) == 0;
|
|
72
|
+
if (p === null && l == null || _ && l == p.key && m == p.type) return n;
|
|
73
73
|
if (o > (_ ? 1 : 0)) {
|
|
74
|
-
for (c = n - 1, a = n + 1; c >= 0 || a < e.length; ) if ((p = e[u = c >= 0 ? c-- : a++]) != null && (2 & p.__u) == 0 && l == p.key &&
|
|
74
|
+
for (c = n - 1, a = n + 1; c >= 0 || a < e.length; ) if ((p = e[u = c >= 0 ? c-- : a++]) != null && (2 & p.__u) == 0 && l == p.key && m == p.type) return u;
|
|
75
75
|
}
|
|
76
76
|
return -1;
|
|
77
77
|
}
|
|
@@ -85,7 +85,7 @@ function je(t, e, n, o, c) {
|
|
|
85
85
|
if (typeof o == "string" && (t.style.cssText = o = ""), o) for (e in o) n && e in n || zt(t.style, e, "");
|
|
86
86
|
if (n) for (e in n) o && n[e] == o[e] || zt(t.style, e, n[e]);
|
|
87
87
|
}
|
|
88
|
-
else if (e[0] == "o" && e[1] == "n") a = e != (e = e.replace(Ei, "$1")), u = e.toLowerCase(), e = u in t || e == "onFocusOut" || e == "onFocusIn" ? u.slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + a] = n, n ? o ? n.u = o.u : (n.u =
|
|
88
|
+
else if (e[0] == "o" && e[1] == "n") a = e != (e = e.replace(Ei, "$1")), u = e.toLowerCase(), e = u in t || e == "onFocusOut" || e == "onFocusIn" ? u.slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + a] = n, n ? o ? n.u = o.u : (n.u = It, t.addEventListener(e, a ? Et : _t, a)) : t.removeEventListener(e, a ? Et : _t, a);
|
|
89
89
|
else {
|
|
90
90
|
if (c == "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 {
|
|
@@ -100,56 +100,56 @@ function qt(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 = It++;
|
|
104
104
|
else if (e.t < n.u) return;
|
|
105
105
|
return n(k.event ? k.event(e) : e);
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
-
function
|
|
110
|
-
var _, d, S,
|
|
109
|
+
function At(t, e, n, o, c, a, u, l, m, p) {
|
|
110
|
+
var _, d, S, g, y, A, b, w, I, R, U, x, Z, H, ae, ne, re, Q = e.type;
|
|
111
111
|
if (e.constructor !== void 0) return null;
|
|
112
|
-
128 & n.__u && (
|
|
112
|
+
128 & n.__u && (m = !!(32 & n.__u), a = [l = e.__e = n.__e]), (_ = k.__b) && _(e);
|
|
113
113
|
e: if (typeof Q == "function") try {
|
|
114
|
-
if (w = e.props, I = "prototype" in Q && Q.prototype.render, R = (_ = Q.contextType) && o[_.__c],
|
|
114
|
+
if (w = e.props, I = "prototype" in Q && Q.prototype.render, R = (_ = Q.contextType) && o[_.__c], U = _ ? R ? R.props.value : _.__ : o, n.__c ? b = (d = e.__c = n.__c).__ = d.__E : (I ? e.__c = d = new Q(w, U) : (e.__c = d = new Oe(w, U), d.constructor = Q, d.render = dn), R && R.sub(d), d.state || (d.state = {}), d.__n = o, S = d.__d = !0, d.__h = [], d._sb = []), I && d.__s == null && (d.__s = d.state), I && Q.getDerivedStateFromProps != null && (d.__s == d.state && (d.__s = ie({}, d.__s)), ie(d.__s, Q.getDerivedStateFromProps(w, d.__s))), g = d.props, y = d.state, d.__v = e, S) I && Q.getDerivedStateFromProps == null && d.componentWillMount != null && d.componentWillMount(), I && d.componentDidMount != null && d.__h.push(d.componentDidMount);
|
|
115
115
|
else {
|
|
116
|
-
if (I && Q.getDerivedStateFromProps == null && w !==
|
|
116
|
+
if (I && Q.getDerivedStateFromProps == null && w !== g && d.componentWillReceiveProps != null && d.componentWillReceiveProps(w, U), e.__v == n.__v || !d.__e && d.shouldComponentUpdate != null && d.shouldComponentUpdate(w, d.__s, U) === !1) {
|
|
117
117
|
for (e.__v != n.__v && (d.props = w, d.state = d.__s, d.__d = !1), e.__e = n.__e, e.__k = n.__k, e.__k.some(function(le) {
|
|
118
118
|
le && (le.__ = e);
|
|
119
119
|
}), x = 0; x < d._sb.length; x++) d.__h.push(d._sb[x]);
|
|
120
120
|
d._sb = [], d.__h.length && u.push(d);
|
|
121
121
|
break e;
|
|
122
122
|
}
|
|
123
|
-
d.componentWillUpdate != null && d.componentWillUpdate(w, d.__s,
|
|
124
|
-
d.componentDidUpdate(
|
|
123
|
+
d.componentWillUpdate != null && d.componentWillUpdate(w, d.__s, U), I && d.componentDidUpdate != null && d.__h.push(function() {
|
|
124
|
+
d.componentDidUpdate(g, y, A);
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
if (d.context =
|
|
127
|
+
if (d.context = U, d.props = w, d.__P = t, d.__e = !1, Z = k.__r, H = 0, I) {
|
|
128
128
|
for (d.state = d.__s, d.__d = !1, Z && Z(e), _ = d.render(d.props, d.state, d.context), ae = 0; ae < d._sb.length; ae++) d.__h.push(d._sb[ae]);
|
|
129
129
|
d._sb = [];
|
|
130
130
|
} else do
|
|
131
131
|
d.__d = !1, Z && Z(e), _ = d.render(d.props, d.state, d.context), d.state = d.__s;
|
|
132
132
|
while (d.__d && ++H < 25);
|
|
133
|
-
d.state = d.__s, d.getChildContext != null && (o = ie(ie({}, o), d.getChildContext())), I && !S && d.getSnapshotBeforeUpdate != null && (
|
|
133
|
+
d.state = d.__s, d.getChildContext != null && (o = ie(ie({}, o), d.getChildContext())), I && !S && d.getSnapshotBeforeUpdate != null && (A = d.getSnapshotBeforeUpdate(g, y)), ne = _, _ != null && _.type === oe && _.key == null && (ne = wi(_.props.children)), l = vi(t, rt(ne) ? ne : [ne], e, n, o, c, a, u, l, m, p), d.base = e.__e, e.__u &= -161, d.__h.length && u.push(d), b && (d.__E = d.__ = null);
|
|
134
134
|
} catch (le) {
|
|
135
|
-
if (e.__v = null,
|
|
136
|
-
for (e.__u |=
|
|
135
|
+
if (e.__v = null, m || a != null) if (le.then) {
|
|
136
|
+
for (e.__u |= m ? 160 : 128; l && l.nodeType == 8 && l.nextSibling; ) l = l.nextSibling;
|
|
137
137
|
a[a.indexOf(l)] = null, e.__e = l;
|
|
138
138
|
} else {
|
|
139
|
-
for (re = a.length; re--; )
|
|
140
|
-
|
|
139
|
+
for (re = a.length; re--; ) bt(a[re]);
|
|
140
|
+
mt(e);
|
|
141
141
|
}
|
|
142
|
-
else e.__e = n.__e, e.__k = n.__k, le.then ||
|
|
142
|
+
else e.__e = n.__e, e.__k = n.__k, le.then || mt(e);
|
|
143
143
|
k.__e(le, e, n);
|
|
144
144
|
}
|
|
145
|
-
else a == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : l = e.__e = un(n.__e, e, n, o, c, a, u,
|
|
145
|
+
else a == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : l = e.__e = un(n.__e, e, n, o, c, a, u, m, p);
|
|
146
146
|
return (_ = k.diffed) && _(e), 128 & e.__u ? void 0 : l;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
t && t.__c && (t.__c.__e = !0), t && t.__k && t.__k.forEach(
|
|
148
|
+
function mt(t) {
|
|
149
|
+
t && t.__c && (t.__c.__e = !0), t && t.__k && t.__k.forEach(mt);
|
|
150
150
|
}
|
|
151
151
|
function Si(t, e, n) {
|
|
152
|
-
for (var o = 0; o < n.length; o++)
|
|
152
|
+
for (var o = 0; o < n.length; o++) Tt(n[o], n[++o], n[++o]);
|
|
153
153
|
k.__c && k.__c(e, t), t.some(function(c) {
|
|
154
154
|
try {
|
|
155
155
|
t = c.__h, c.__h = [], t.some(function(a) {
|
|
@@ -163,11 +163,11 @@ function Si(t, e, n) {
|
|
|
163
163
|
function wi(t) {
|
|
164
164
|
return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : rt(t) ? t.map(wi) : ie({}, t);
|
|
165
165
|
}
|
|
166
|
-
function un(t, e, n, o, c, a, u, l,
|
|
167
|
-
var p, _, d, S,
|
|
166
|
+
function un(t, e, n, o, c, a, u, l, m) {
|
|
167
|
+
var p, _, d, S, g, y, A, b = n.props || Ue, w = e.props, I = e.type;
|
|
168
168
|
if (I == "svg" ? c = "http://www.w3.org/2000/svg" : I == "math" ? c = "http://www.w3.org/1998/Math/MathML" : c || (c = "http://www.w3.org/1999/xhtml"), a != null) {
|
|
169
|
-
for (p = 0; p < a.length; p++) if ((
|
|
170
|
-
t =
|
|
169
|
+
for (p = 0; p < a.length; p++) if ((g = a[p]) && "setAttribute" in g == !!I && (I ? g.localName == I : g.nodeType == 3)) {
|
|
170
|
+
t = g, a[p] = null;
|
|
171
171
|
break;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
@@ -175,24 +175,24 @@ function un(t, e, n, o, c, a, u, l, g) {
|
|
|
175
175
|
if (I == null) return document.createTextNode(w);
|
|
176
176
|
t = document.createElementNS(c, I, w.is && w), l && (k.__m && k.__m(e, a), l = !1), a = null;
|
|
177
177
|
}
|
|
178
|
-
if (I == null)
|
|
178
|
+
if (I == null) b === w || l && t.data == w || (t.data = w);
|
|
179
179
|
else {
|
|
180
|
-
if (a = a && $e.call(t.childNodes), !l && a != null) for (
|
|
181
|
-
for (p in
|
|
182
|
-
if (p == "dangerouslySetInnerHTML") d =
|
|
180
|
+
if (a = a && $e.call(t.childNodes), !l && a != null) for (b = {}, p = 0; p < t.attributes.length; p++) b[(g = t.attributes[p]).name] = g.value;
|
|
181
|
+
for (p in b) if (g = b[p], p != "children") {
|
|
182
|
+
if (p == "dangerouslySetInnerHTML") d = g;
|
|
183
183
|
else if (!(p in w)) {
|
|
184
184
|
if (p == "value" && "defaultValue" in w || p == "checked" && "defaultChecked" in w) continue;
|
|
185
|
-
je(t, p, null,
|
|
185
|
+
je(t, p, null, g, c);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
for (p in w)
|
|
188
|
+
for (p in w) g = w[p], p == "children" ? S = g : p == "dangerouslySetInnerHTML" ? _ = g : p == "value" ? y = g : p == "checked" ? A = g : l && typeof g != "function" || b[p] === g || je(t, p, g, b[p], c);
|
|
189
189
|
if (_) l || d && (_.__html == d.__html || _.__html == t.innerHTML) || (t.innerHTML = _.__html), e.__k = [];
|
|
190
|
-
else if (d && (t.innerHTML = ""), vi(e.type == "template" ? t.content : t, rt(S) ? S : [S], e, n, o, I == "foreignObject" ? "http://www.w3.org/1999/xhtml" : c, a, u, a ? a[0] : n.__k && be(n, 0), l,
|
|
191
|
-
l || (p = "value", I == "progress" && y == null ? t.removeAttribute("value") : y != null && (y !== t[p] || I == "progress" && !y || I == "option" && y !=
|
|
190
|
+
else if (d && (t.innerHTML = ""), vi(e.type == "template" ? t.content : t, rt(S) ? S : [S], e, n, o, I == "foreignObject" ? "http://www.w3.org/1999/xhtml" : c, a, u, a ? a[0] : n.__k && be(n, 0), l, m), a != null) for (p = a.length; p--; ) bt(a[p]);
|
|
191
|
+
l || (p = "value", I == "progress" && y == null ? t.removeAttribute("value") : y != null && (y !== t[p] || I == "progress" && !y || I == "option" && y != b[p]) && je(t, p, y, b[p], c), p = "checked", A != null && A != t[p] && je(t, p, A, b[p], c));
|
|
192
192
|
}
|
|
193
193
|
return t;
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function Tt(t, e, n) {
|
|
196
196
|
try {
|
|
197
197
|
if (typeof t == "function") {
|
|
198
198
|
var o = typeof t.__u == "function";
|
|
@@ -204,7 +204,7 @@ function Nt(t, e, n) {
|
|
|
204
204
|
}
|
|
205
205
|
function Ci(t, e, n) {
|
|
206
206
|
var o, c;
|
|
207
|
-
if (k.unmount && k.unmount(t), (o = t.ref) && (o.current && o.current != t.__e ||
|
|
207
|
+
if (k.unmount && k.unmount(t), (o = t.ref) && (o.current && o.current != t.__e || Tt(o, null, e)), (o = t.__c) != null) {
|
|
208
208
|
if (o.componentWillUnmount) try {
|
|
209
209
|
o.componentWillUnmount();
|
|
210
210
|
} catch (a) {
|
|
@@ -213,14 +213,14 @@ function Ci(t, e, n) {
|
|
|
213
213
|
o.base = o.__P = null;
|
|
214
214
|
}
|
|
215
215
|
if (o = t.__k) for (c = 0; c < o.length; c++) o[c] && Ci(o[c], e, n || typeof t.type != "function");
|
|
216
|
-
n ||
|
|
216
|
+
n || bt(t.__e), t.__c = t.__ = t.__e = void 0;
|
|
217
217
|
}
|
|
218
218
|
function dn(t, e, n) {
|
|
219
219
|
return this.constructor(t, n);
|
|
220
220
|
}
|
|
221
221
|
function ot(t, e, n) {
|
|
222
222
|
var o, c, a, u;
|
|
223
|
-
e == document && (e = document.documentElement), k.__ && k.__(t, e), c = (o = typeof n == "function") ? null : n && n.__k || e.__k, a = [], u = [],
|
|
223
|
+
e == document && (e = document.documentElement), k.__ && k.__(t, e), c = (o = typeof n == "function") ? null : n && n.__k || e.__k, a = [], u = [], At(e, t = (!o && n || e).__k = Ce(oe, null, [t]), c || Ue, Ue, e.namespaceURI, !o && n ? [n] : c ? null : e.firstChild ? $e.call(e.childNodes) : null, a, !o && n ? n : c ? c.__e : e.firstChild, o, u), Si(a, t, u);
|
|
224
224
|
}
|
|
225
225
|
function Ii(t, e) {
|
|
226
226
|
ot(t, e, Ii);
|
|
@@ -246,7 +246,7 @@ $e = mi.slice, k = { __e: function(t, e, n, o) {
|
|
|
246
246
|
this.__v && (this.__e = !0, t && this.__h.push(t), Wt(this));
|
|
247
247
|
}, Oe.prototype.render = oe, Ee = [], pi = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, _i = function(t, e) {
|
|
248
248
|
return t.__v.__b - e.__v.__b;
|
|
249
|
-
}, Xe.__r = 0, Ei = /(PointerCapture)$|Capture$/i,
|
|
249
|
+
}, Xe.__r = 0, Ei = /(PointerCapture)$|Capture$/i, It = 0, _t = qt(!1), Et = qt(!0);
|
|
250
250
|
function Ze() {
|
|
251
251
|
return Ze = Object.assign ? Object.assign.bind() : function(t) {
|
|
252
252
|
for (var e = 1; e < arguments.length; e++) {
|
|
@@ -319,8 +319,8 @@ function Ri(t, e, n) {
|
|
|
319
319
|
var o = [], c = {}, a = 0, u = t.attributes, l = t.childNodes;
|
|
320
320
|
for (a = u.length; a--; ) u[a].name !== "slot" && (c[u[a].name] = u[a].value, c[Ti(u[a].name)] = u[a].value);
|
|
321
321
|
for (a = l.length; a--; ) {
|
|
322
|
-
var
|
|
323
|
-
p ? c[p] = Ce(Yt, { name: p },
|
|
322
|
+
var m = Ri(l[a], null, n), p = l[a].slot;
|
|
323
|
+
p ? c[p] = Ce(Yt, { name: p }, m) : o[a] = m;
|
|
324
324
|
}
|
|
325
325
|
var _ = !(!n || !n.shadow), d = e ? Ce(Yt, { useFragment: !_ }, o) : o;
|
|
326
326
|
return !_ && e && (t.innerHTML = ""), Ce(e || t.nodeName.toLowerCase(), c, d);
|
|
@@ -328,14 +328,14 @@ function Ri(t, e, n) {
|
|
|
328
328
|
var vn = 0;
|
|
329
329
|
function C(t, e, n, o, c, a) {
|
|
330
330
|
e || (e = {});
|
|
331
|
-
var u, l,
|
|
332
|
-
if ("ref" in
|
|
333
|
-
var p = { type: t, props:
|
|
334
|
-
if (typeof t == "function" && (u = t.defaultProps)) for (l in u)
|
|
331
|
+
var u, l, m = e;
|
|
332
|
+
if ("ref" in m) for (l in m = {}, e) l == "ref" ? u = e[l] : m[l] = e[l];
|
|
333
|
+
var p = { type: t, props: m, key: n, ref: u, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --vn, __i: -1, __u: 0, __source: c, __self: a };
|
|
334
|
+
if (typeof t == "function" && (u = t.defaultProps)) for (l in u) m[l] === void 0 && (m[l] = u[l]);
|
|
335
335
|
return k.vnode && k.vnode(p), p;
|
|
336
336
|
}
|
|
337
|
-
var
|
|
338
|
-
function
|
|
337
|
+
var Me, P, dt, Jt, Be = 0, Ni = [], F = k, Kt = F.__b, Xt = F.__r, Zt = F.diffed, Qt = F.__c, ei = F.unmount, ti = F.__;
|
|
338
|
+
function Rt(t, e) {
|
|
339
339
|
F.__h && F.__h(P, t, Be || e), Be = 0;
|
|
340
340
|
var n = P.__H || (P.__H = { __: [], __h: [] });
|
|
341
341
|
return t >= n.__.length && n.__.push({}), n.__[t];
|
|
@@ -344,41 +344,41 @@ function Ye(t) {
|
|
|
344
344
|
return Be = 1, yn(Oi, t);
|
|
345
345
|
}
|
|
346
346
|
function yn(t, e, n) {
|
|
347
|
-
var o =
|
|
347
|
+
var o = Rt(Me++, 2);
|
|
348
348
|
if (o.t = t, !o.__c && (o.__ = [Oi(void 0, e), function(l) {
|
|
349
|
-
var
|
|
350
|
-
|
|
349
|
+
var m = o.__N ? o.__N[0] : o.__[0], p = o.t(m, l);
|
|
350
|
+
m !== p && (o.__N = [p, o.__[1]], o.__c.setState({}));
|
|
351
351
|
}], o.__c = P, !P.__f)) {
|
|
352
|
-
var c = function(l,
|
|
352
|
+
var c = function(l, m, p) {
|
|
353
353
|
if (!o.__c.__H) return !0;
|
|
354
354
|
var _ = o.__c.__H.__.filter(function(S) {
|
|
355
355
|
return !!S.__c;
|
|
356
356
|
});
|
|
357
357
|
if (_.every(function(S) {
|
|
358
358
|
return !S.__N;
|
|
359
|
-
})) return !a || a.call(this, l,
|
|
359
|
+
})) return !a || a.call(this, l, m, p);
|
|
360
360
|
var d = o.__c.props !== l;
|
|
361
361
|
return _.forEach(function(S) {
|
|
362
362
|
if (S.__N) {
|
|
363
|
-
var
|
|
364
|
-
S.__ = S.__N, S.__N = void 0,
|
|
363
|
+
var g = S.__[0];
|
|
364
|
+
S.__ = S.__N, S.__N = void 0, g !== S.__[0] && (d = !0);
|
|
365
365
|
}
|
|
366
|
-
}), a && a.call(this, l,
|
|
366
|
+
}), a && a.call(this, l, m, p) || d;
|
|
367
367
|
};
|
|
368
368
|
P.__f = !0;
|
|
369
369
|
var a = P.shouldComponentUpdate, u = P.componentWillUpdate;
|
|
370
|
-
P.componentWillUpdate = function(l,
|
|
370
|
+
P.componentWillUpdate = function(l, m, p) {
|
|
371
371
|
if (this.__e) {
|
|
372
372
|
var _ = a;
|
|
373
|
-
a = void 0, c(l,
|
|
373
|
+
a = void 0, c(l, m, p), a = _;
|
|
374
374
|
}
|
|
375
|
-
u && u.call(this, l,
|
|
375
|
+
u && u.call(this, l, m, p);
|
|
376
376
|
}, P.shouldComponentUpdate = c;
|
|
377
377
|
}
|
|
378
378
|
return o.__N || o.__;
|
|
379
379
|
}
|
|
380
|
-
function
|
|
381
|
-
var n =
|
|
380
|
+
function gt(t, e) {
|
|
381
|
+
var n = Rt(Me++, 3);
|
|
382
382
|
!F.__s && xi(n.__H, e) && (n.__ = t, n.u = e, P.__H.__h.push(n));
|
|
383
383
|
}
|
|
384
384
|
function Qe(t) {
|
|
@@ -387,7 +387,7 @@ function Qe(t) {
|
|
|
387
387
|
}, []);
|
|
388
388
|
}
|
|
389
389
|
function Ie(t, e) {
|
|
390
|
-
var n =
|
|
390
|
+
var n = Rt(Me++, 7);
|
|
391
391
|
return xi(n.__H, e) && (n.__ = t(), n.__H = e, n.__h = t), n.__;
|
|
392
392
|
}
|
|
393
393
|
function He(t, e) {
|
|
@@ -397,32 +397,32 @@ function He(t, e) {
|
|
|
397
397
|
}
|
|
398
398
|
function Sn() {
|
|
399
399
|
for (var t; t = Ni.shift(); ) if (t.__P && t.__H) try {
|
|
400
|
-
t.__H.__h.forEach(
|
|
400
|
+
t.__H.__h.forEach(Je), t.__H.__h.forEach(vt), t.__H.__h = [];
|
|
401
401
|
} catch (e) {
|
|
402
402
|
t.__H.__h = [], F.__e(e, t.__v);
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
405
|
F.__b = function(t) {
|
|
406
|
-
P = null,
|
|
406
|
+
P = null, Kt && Kt(t);
|
|
407
407
|
}, F.__ = function(t, e) {
|
|
408
408
|
t && e.__k && e.__k.__m && (t.__m = e.__k.__m), ti && ti(t, e);
|
|
409
409
|
}, F.__r = function(t) {
|
|
410
|
-
Xt && Xt(t),
|
|
410
|
+
Xt && Xt(t), Me = 0;
|
|
411
411
|
var e = (P = t.__c).__H;
|
|
412
|
-
e && (
|
|
412
|
+
e && (dt === P ? (e.__h = [], P.__h = [], e.__.forEach(function(n) {
|
|
413
413
|
n.__N && (n.__ = n.__N), n.u = n.__N = void 0;
|
|
414
|
-
})) : (e.__h.forEach(
|
|
414
|
+
})) : (e.__h.forEach(Je), e.__h.forEach(vt), e.__h = [], Me = 0)), dt = P;
|
|
415
415
|
}, F.diffed = function(t) {
|
|
416
416
|
Zt && Zt(t);
|
|
417
417
|
var e = t.__c;
|
|
418
|
-
e && e.__H && (e.__H.__h.length && (Ni.push(e) !== 1 &&
|
|
418
|
+
e && e.__H && (e.__H.__h.length && (Ni.push(e) !== 1 && Jt === F.requestAnimationFrame || ((Jt = F.requestAnimationFrame) || wn)(Sn)), e.__H.__.forEach(function(n) {
|
|
419
419
|
n.u && (n.__H = n.u), n.u = void 0;
|
|
420
|
-
})),
|
|
420
|
+
})), dt = P = null;
|
|
421
421
|
}, F.__c = function(t, e) {
|
|
422
422
|
e.some(function(n) {
|
|
423
423
|
try {
|
|
424
|
-
n.__h.forEach(
|
|
425
|
-
return !o.__ ||
|
|
424
|
+
n.__h.forEach(Je), n.__h = n.__h.filter(function(o) {
|
|
425
|
+
return !o.__ || vt(o);
|
|
426
426
|
});
|
|
427
427
|
} catch (o) {
|
|
428
428
|
e.some(function(c) {
|
|
@@ -435,7 +435,7 @@ F.__b = function(t) {
|
|
|
435
435
|
var e, n = t.__c;
|
|
436
436
|
n && n.__H && (n.__H.__.forEach(function(o) {
|
|
437
437
|
try {
|
|
438
|
-
|
|
438
|
+
Je(o);
|
|
439
439
|
} catch (c) {
|
|
440
440
|
e = c;
|
|
441
441
|
}
|
|
@@ -448,11 +448,11 @@ function wn(t) {
|
|
|
448
448
|
}, o = setTimeout(n, 35);
|
|
449
449
|
ii && (e = requestAnimationFrame(n));
|
|
450
450
|
}
|
|
451
|
-
function
|
|
451
|
+
function Je(t) {
|
|
452
452
|
var e = P, n = t.__c;
|
|
453
453
|
typeof n == "function" && (t.__c = void 0, n()), P = e;
|
|
454
454
|
}
|
|
455
|
-
function
|
|
455
|
+
function vt(t) {
|
|
456
456
|
var e = P;
|
|
457
457
|
t.__c = t.__(), P = e;
|
|
458
458
|
}
|
|
@@ -471,9 +471,9 @@ function st() {
|
|
|
471
471
|
else {
|
|
472
472
|
for (var t, e = !1; ke !== void 0; ) {
|
|
473
473
|
var n = ke;
|
|
474
|
-
for (ke = void 0,
|
|
474
|
+
for (ke = void 0, yt++; n !== void 0; ) {
|
|
475
475
|
var o = n.o;
|
|
476
|
-
if (n.o = void 0, n.f &= -3, !(8 & n.f) &&
|
|
476
|
+
if (n.o = void 0, n.f &= -3, !(8 & n.f) && Ui(n)) try {
|
|
477
477
|
n.c();
|
|
478
478
|
} catch (c) {
|
|
479
479
|
e || (t = c, e = !0);
|
|
@@ -481,7 +481,7 @@ function st() {
|
|
|
481
481
|
n = o;
|
|
482
482
|
}
|
|
483
483
|
}
|
|
484
|
-
if (
|
|
484
|
+
if (yt = 0, pe--, e) throw t;
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
487
|
function In(t) {
|
|
@@ -503,7 +503,7 @@ function ki(t) {
|
|
|
503
503
|
O = e;
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
|
-
var ke = void 0, pe = 0,
|
|
506
|
+
var ke = void 0, pe = 0, yt = 0, et = 0;
|
|
507
507
|
function Di(t) {
|
|
508
508
|
if (O !== void 0) {
|
|
509
509
|
var e = t.n;
|
|
@@ -572,7 +572,7 @@ Object.defineProperty(j.prototype, "value", { get: function() {
|
|
|
572
572
|
return t !== void 0 && (t.i = this.i), this.v;
|
|
573
573
|
}, set: function(t) {
|
|
574
574
|
if (t !== this.v) {
|
|
575
|
-
if (
|
|
575
|
+
if (yt > 100) throw new Error("Cycle detected");
|
|
576
576
|
this.v = t, this.i++, et++, pe++;
|
|
577
577
|
try {
|
|
578
578
|
for (var e = this.t; e !== void 0; e = e.x) e.t.N();
|
|
@@ -584,11 +584,11 @@ Object.defineProperty(j.prototype, "value", { get: function() {
|
|
|
584
584
|
function Y(t, e) {
|
|
585
585
|
return new j(t, e);
|
|
586
586
|
}
|
|
587
|
-
function
|
|
587
|
+
function Ui(t) {
|
|
588
588
|
for (var e = t.s; e !== void 0; e = e.n) if (e.S.i !== e.i || !e.S.h() || e.S.i !== e.i) return !0;
|
|
589
589
|
return !1;
|
|
590
590
|
}
|
|
591
|
-
function
|
|
591
|
+
function Mi(t) {
|
|
592
592
|
for (var e = t.s; e !== void 0; e = e.n) {
|
|
593
593
|
var n = e.S.n;
|
|
594
594
|
if (n !== void 0 && (e.r = n), e.S.n = e, e.i = -1, e.n === void 0) {
|
|
@@ -611,11 +611,11 @@ ge.prototype = new j();
|
|
|
611
611
|
ge.prototype.h = function() {
|
|
612
612
|
if (this.f &= -3, 1 & this.f) return !1;
|
|
613
613
|
if ((36 & this.f) == 32 || (this.f &= -5, this.g === et)) return !0;
|
|
614
|
-
if (this.g = et, this.f |= 1, this.i > 0 && !
|
|
614
|
+
if (this.g = et, this.f |= 1, this.i > 0 && !Ui(this))
|
|
615
615
|
return this.f &= -2, !0;
|
|
616
616
|
var t = O;
|
|
617
617
|
try {
|
|
618
|
-
|
|
618
|
+
Mi(this), O = this;
|
|
619
619
|
var e = this.x();
|
|
620
620
|
(16 & this.f || this.v !== e || this.i === 0) && (this.v = e, this.f &= -17, this.i++);
|
|
621
621
|
} catch (n) {
|
|
@@ -660,19 +660,19 @@ function Li(t) {
|
|
|
660
660
|
try {
|
|
661
661
|
e();
|
|
662
662
|
} catch (o) {
|
|
663
|
-
throw t.f &= -2, t.f |= 8,
|
|
663
|
+
throw t.f &= -2, t.f |= 8, Nt(t), o;
|
|
664
664
|
} finally {
|
|
665
665
|
O = n, st();
|
|
666
666
|
}
|
|
667
667
|
}
|
|
668
668
|
}
|
|
669
|
-
function
|
|
669
|
+
function Nt(t) {
|
|
670
670
|
for (var e = t.s; e !== void 0; e = e.n) e.S.U(e);
|
|
671
671
|
t.x = void 0, t.s = void 0, Li(t);
|
|
672
672
|
}
|
|
673
673
|
function bn(t) {
|
|
674
674
|
if (O !== this) throw new Error("Out-of-order effect");
|
|
675
|
-
Bi(this), O = t, this.f &= -2, 8 & this.f &&
|
|
675
|
+
Bi(this), O = t, this.f &= -2, 8 & this.f && Nt(this), st();
|
|
676
676
|
}
|
|
677
677
|
function Ae(t, e) {
|
|
678
678
|
this.x = t, this.u = void 0, this.s = void 0, this.o = void 0, this.f = 32, this.name = e?.name;
|
|
@@ -689,7 +689,7 @@ Ae.prototype.c = function() {
|
|
|
689
689
|
};
|
|
690
690
|
Ae.prototype.S = function() {
|
|
691
691
|
if (1 & this.f) throw new Error("Cycle detected");
|
|
692
|
-
this.f |= 1, this.f &= -9, Li(this),
|
|
692
|
+
this.f |= 1, this.f &= -9, Li(this), Mi(this), pe++;
|
|
693
693
|
var t = O;
|
|
694
694
|
return O = this, bn.bind(this, t);
|
|
695
695
|
};
|
|
@@ -697,7 +697,7 @@ Ae.prototype.N = function() {
|
|
|
697
697
|
2 & this.f || (this.f |= 2, this.o = ke, ke = this);
|
|
698
698
|
};
|
|
699
699
|
Ae.prototype.d = function() {
|
|
700
|
-
this.f |= 8, 1 & this.f ||
|
|
700
|
+
this.f |= 8, 1 & this.f || Nt(this);
|
|
701
701
|
};
|
|
702
702
|
Ae.prototype.dispose = function() {
|
|
703
703
|
this.d();
|
|
@@ -712,7 +712,7 @@ function Ge(t, e) {
|
|
|
712
712
|
var o = n.d.bind(n);
|
|
713
713
|
return o[Symbol.dispose] = o, o;
|
|
714
714
|
}
|
|
715
|
-
var Pi,
|
|
715
|
+
var Pi, ht, An = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, Fi = [];
|
|
716
716
|
Ge(function() {
|
|
717
717
|
Pi = this.N;
|
|
718
718
|
})();
|
|
@@ -721,25 +721,25 @@ function Te(t, e) {
|
|
|
721
721
|
});
|
|
722
722
|
}
|
|
723
723
|
function tt(t) {
|
|
724
|
-
|
|
724
|
+
ht && ht(), ht = t && t.S();
|
|
725
725
|
}
|
|
726
726
|
function $i(t) {
|
|
727
727
|
var e = this, n = t.data, o = Gi(n);
|
|
728
728
|
o.value = n;
|
|
729
729
|
var c = Ie(function() {
|
|
730
|
-
for (var l = e,
|
|
731
|
-
|
|
730
|
+
for (var l = e, m = e.__v; m = m.__; ) if (m.__c) {
|
|
731
|
+
m.__c.__$f |= 4;
|
|
732
732
|
break;
|
|
733
733
|
}
|
|
734
734
|
var p = ni(function() {
|
|
735
|
-
var
|
|
736
|
-
return
|
|
735
|
+
var g = o.value.value;
|
|
736
|
+
return g === 0 ? 0 : g === !0 ? "" : g || "";
|
|
737
737
|
}), _ = ni(function() {
|
|
738
738
|
return !Array.isArray(p.value) && !fi(p.value);
|
|
739
739
|
}), d = Ge(function() {
|
|
740
740
|
if (this.N = Vi, _.value) {
|
|
741
|
-
var
|
|
742
|
-
l.__v && l.__v.__e && l.__v.__e.nodeType === 3 && (l.__v.__e.data =
|
|
741
|
+
var g = p.value;
|
|
742
|
+
l.__v && l.__v.__e && l.__v.__e.nodeType === 3 && (l.__v.__e.data = g);
|
|
743
743
|
}
|
|
744
744
|
}), S = e.__$u.d;
|
|
745
745
|
return e.__$u.d = function() {
|
|
@@ -794,9 +794,9 @@ Te("diffed", function(t, e) {
|
|
|
794
794
|
}
|
|
795
795
|
else
|
|
796
796
|
a = {}, n.U = a;
|
|
797
|
-
for (var
|
|
798
|
-
var p = a[
|
|
799
|
-
p === void 0 ? (p = Tn(n,
|
|
797
|
+
for (var m in o) {
|
|
798
|
+
var p = a[m], _ = o[m];
|
|
799
|
+
p === void 0 ? (p = Tn(n, m, _, c), a[m] = p) : p.o(_, c);
|
|
800
800
|
}
|
|
801
801
|
}
|
|
802
802
|
}
|
|
@@ -909,49 +909,49 @@ function xn(t) {
|
|
|
909
909
|
}
|
|
910
910
|
return Object.keys(n).length > 0 ? n : ze["bottom-right"];
|
|
911
911
|
}
|
|
912
|
-
var
|
|
912
|
+
var ft = {}, Ne = {}, ri;
|
|
913
913
|
function On() {
|
|
914
914
|
if (ri) return Ne;
|
|
915
915
|
ri = 1, Ne.byteLength = l, Ne.toByteArray = p, Ne.fromByteArray = S;
|
|
916
916
|
for (var t = [], e = [], n = typeof Uint8Array < "u" ? Uint8Array : Array, o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", c = 0, a = o.length; c < a; ++c)
|
|
917
917
|
t[c] = o[c], e[o.charCodeAt(c)] = c;
|
|
918
918
|
e[45] = 62, e[95] = 63;
|
|
919
|
-
function u(
|
|
920
|
-
var y =
|
|
919
|
+
function u(g) {
|
|
920
|
+
var y = g.length;
|
|
921
921
|
if (y % 4 > 0)
|
|
922
922
|
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
923
|
-
var
|
|
924
|
-
|
|
925
|
-
var
|
|
926
|
-
return [
|
|
927
|
-
}
|
|
928
|
-
function l(
|
|
929
|
-
var y = u(
|
|
930
|
-
return (
|
|
931
|
-
}
|
|
932
|
-
function g
|
|
933
|
-
return (y +
|
|
934
|
-
}
|
|
935
|
-
function p(
|
|
936
|
-
var y,
|
|
937
|
-
for (x = 0; x <
|
|
938
|
-
y = e[
|
|
939
|
-
return w === 2 && (y = e[
|
|
940
|
-
}
|
|
941
|
-
function _(
|
|
942
|
-
return t[
|
|
943
|
-
}
|
|
944
|
-
function d(
|
|
945
|
-
for (var
|
|
946
|
-
|
|
923
|
+
var A = g.indexOf("=");
|
|
924
|
+
A === -1 && (A = y);
|
|
925
|
+
var b = A === y ? 0 : 4 - A % 4;
|
|
926
|
+
return [A, b];
|
|
927
|
+
}
|
|
928
|
+
function l(g) {
|
|
929
|
+
var y = u(g), A = y[0], b = y[1];
|
|
930
|
+
return (A + b) * 3 / 4 - b;
|
|
931
|
+
}
|
|
932
|
+
function m(g, y, A) {
|
|
933
|
+
return (y + A) * 3 / 4 - A;
|
|
934
|
+
}
|
|
935
|
+
function p(g) {
|
|
936
|
+
var y, A = u(g), b = A[0], w = A[1], I = new n(m(g, b, w)), R = 0, U = w > 0 ? b - 4 : b, x;
|
|
937
|
+
for (x = 0; x < U; x += 4)
|
|
938
|
+
y = e[g.charCodeAt(x)] << 18 | e[g.charCodeAt(x + 1)] << 12 | e[g.charCodeAt(x + 2)] << 6 | e[g.charCodeAt(x + 3)], I[R++] = y >> 16 & 255, I[R++] = y >> 8 & 255, I[R++] = y & 255;
|
|
939
|
+
return w === 2 && (y = e[g.charCodeAt(x)] << 2 | e[g.charCodeAt(x + 1)] >> 4, I[R++] = y & 255), w === 1 && (y = e[g.charCodeAt(x)] << 10 | e[g.charCodeAt(x + 1)] << 4 | e[g.charCodeAt(x + 2)] >> 2, I[R++] = y >> 8 & 255, I[R++] = y & 255), I;
|
|
940
|
+
}
|
|
941
|
+
function _(g) {
|
|
942
|
+
return t[g >> 18 & 63] + t[g >> 12 & 63] + t[g >> 6 & 63] + t[g & 63];
|
|
943
|
+
}
|
|
944
|
+
function d(g, y, A) {
|
|
945
|
+
for (var b, w = [], I = y; I < A; I += 3)
|
|
946
|
+
b = (g[I] << 16 & 16711680) + (g[I + 1] << 8 & 65280) + (g[I + 2] & 255), w.push(_(b));
|
|
947
947
|
return w.join("");
|
|
948
948
|
}
|
|
949
|
-
function S(
|
|
950
|
-
for (var y,
|
|
951
|
-
w.push(d(
|
|
952
|
-
return
|
|
949
|
+
function S(g) {
|
|
950
|
+
for (var y, A = g.length, b = A % 3, w = [], I = 16383, R = 0, U = A - b; R < U; R += I)
|
|
951
|
+
w.push(d(g, R, R + I > U ? U : R + I));
|
|
952
|
+
return b === 1 ? (y = g[A - 1], w.push(
|
|
953
953
|
t[y >> 2] + t[y << 4 & 63] + "=="
|
|
954
|
-
)) :
|
|
954
|
+
)) : b === 2 && (y = (g[A - 2] << 8) + g[A - 1], w.push(
|
|
955
955
|
t[y >> 10] + t[y >> 4 & 63] + t[y << 2 & 63] + "="
|
|
956
956
|
)), w.join("");
|
|
957
957
|
}
|
|
@@ -961,26 +961,26 @@ var qe = {};
|
|
|
961
961
|
var oi;
|
|
962
962
|
function kn() {
|
|
963
963
|
return oi || (oi = 1, qe.read = function(t, e, n, o, c) {
|
|
964
|
-
var a, u, l = c * 8 - o - 1,
|
|
965
|
-
for (d += S, a =
|
|
964
|
+
var a, u, l = c * 8 - o - 1, m = (1 << l) - 1, p = m >> 1, _ = -7, d = n ? c - 1 : 0, S = n ? -1 : 1, g = t[e + d];
|
|
965
|
+
for (d += S, a = g & (1 << -_) - 1, g >>= -_, _ += l; _ > 0; a = a * 256 + t[e + d], d += S, _ -= 8)
|
|
966
966
|
;
|
|
967
967
|
for (u = a & (1 << -_) - 1, a >>= -_, _ += o; _ > 0; u = u * 256 + t[e + d], d += S, _ -= 8)
|
|
968
968
|
;
|
|
969
969
|
if (a === 0)
|
|
970
970
|
a = 1 - p;
|
|
971
971
|
else {
|
|
972
|
-
if (a ===
|
|
973
|
-
return u ? NaN : (
|
|
972
|
+
if (a === m)
|
|
973
|
+
return u ? NaN : (g ? -1 : 1) * (1 / 0);
|
|
974
974
|
u = u + Math.pow(2, o), a = a - p;
|
|
975
975
|
}
|
|
976
|
-
return (
|
|
976
|
+
return (g ? -1 : 1) * u * Math.pow(2, a - o);
|
|
977
977
|
}, qe.write = function(t, e, n, o, c, a) {
|
|
978
|
-
var u, l,
|
|
979
|
-
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (l = isNaN(e) ? 1 : 0, u = _) : (u = Math.floor(Math.log(e) / Math.LN2), e * (
|
|
978
|
+
var u, l, m, p = a * 8 - c - 1, _ = (1 << p) - 1, d = _ >> 1, S = c === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, g = o ? 0 : a - 1, y = o ? 1 : -1, A = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
|
|
979
|
+
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (l = isNaN(e) ? 1 : 0, u = _) : (u = Math.floor(Math.log(e) / Math.LN2), e * (m = Math.pow(2, -u)) < 1 && (u--, m *= 2), u + d >= 1 ? e += S / m : e += S * Math.pow(2, 1 - d), e * m >= 2 && (u++, m /= 2), u + d >= _ ? (l = 0, u = _) : u + d >= 1 ? (l = (e * m - 1) * Math.pow(2, c), u = u + d) : (l = e * Math.pow(2, d - 1) * Math.pow(2, c), u = 0)); c >= 8; t[n + g] = l & 255, g += y, l /= 256, c -= 8)
|
|
980
980
|
;
|
|
981
|
-
for (u = u << c | l, p += c; p > 0; t[n +
|
|
981
|
+
for (u = u << c | l, p += c; p > 0; t[n + g] = u & 255, g += y, u /= 256, p -= 8)
|
|
982
982
|
;
|
|
983
|
-
t[n +
|
|
983
|
+
t[n + g - y] |= A * 128;
|
|
984
984
|
}), qe;
|
|
985
985
|
}
|
|
986
986
|
var si;
|
|
@@ -1029,10 +1029,10 @@ function Dn() {
|
|
|
1029
1029
|
);
|
|
1030
1030
|
return d(s);
|
|
1031
1031
|
}
|
|
1032
|
-
return
|
|
1032
|
+
return m(s, i, r);
|
|
1033
1033
|
}
|
|
1034
1034
|
l.poolSize = 8192;
|
|
1035
|
-
function
|
|
1035
|
+
function m(s, i, r) {
|
|
1036
1036
|
if (typeof s == "string")
|
|
1037
1037
|
return S(s, i);
|
|
1038
1038
|
if (ArrayBuffer.isView(s))
|
|
@@ -1042,7 +1042,7 @@ function Dn() {
|
|
|
1042
1042
|
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof s
|
|
1043
1043
|
);
|
|
1044
1044
|
if (ee(s, ArrayBuffer) || s && ee(s.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (ee(s, SharedArrayBuffer) || s && ee(s.buffer, SharedArrayBuffer)))
|
|
1045
|
-
return
|
|
1045
|
+
return A(s, i, r);
|
|
1046
1046
|
if (typeof s == "number")
|
|
1047
1047
|
throw new TypeError(
|
|
1048
1048
|
'The "value" argument must not be of type number. Received type number'
|
|
@@ -1050,7 +1050,7 @@ function Dn() {
|
|
|
1050
1050
|
const h = s.valueOf && s.valueOf();
|
|
1051
1051
|
if (h != null && h !== s)
|
|
1052
1052
|
return l.from(h, i, r);
|
|
1053
|
-
const f =
|
|
1053
|
+
const f = b(s);
|
|
1054
1054
|
if (f) return f;
|
|
1055
1055
|
if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof s[Symbol.toPrimitive] == "function")
|
|
1056
1056
|
return l.from(s[Symbol.toPrimitive]("string"), i, r);
|
|
@@ -1059,7 +1059,7 @@ function Dn() {
|
|
|
1059
1059
|
);
|
|
1060
1060
|
}
|
|
1061
1061
|
l.from = function(s, i, r) {
|
|
1062
|
-
return
|
|
1062
|
+
return m(s, i, r);
|
|
1063
1063
|
}, Object.setPrototypeOf(l.prototype, Uint8Array.prototype), Object.setPrototypeOf(l, Uint8Array);
|
|
1064
1064
|
function p(s) {
|
|
1065
1065
|
if (typeof s != "number")
|
|
@@ -1089,7 +1089,7 @@ function Dn() {
|
|
|
1089
1089
|
const f = h.write(s, i);
|
|
1090
1090
|
return f !== r && (h = h.slice(0, f)), h;
|
|
1091
1091
|
}
|
|
1092
|
-
function
|
|
1092
|
+
function g(s) {
|
|
1093
1093
|
const i = s.length < 0 ? 0 : w(s.length) | 0, r = u(i);
|
|
1094
1094
|
for (let h = 0; h < i; h += 1)
|
|
1095
1095
|
r[h] = s[h] & 255;
|
|
@@ -1098,11 +1098,11 @@ function Dn() {
|
|
|
1098
1098
|
function y(s) {
|
|
1099
1099
|
if (ee(s, Uint8Array)) {
|
|
1100
1100
|
const i = new Uint8Array(s);
|
|
1101
|
-
return
|
|
1101
|
+
return A(i.buffer, i.byteOffset, i.byteLength);
|
|
1102
1102
|
}
|
|
1103
|
-
return
|
|
1103
|
+
return g(s);
|
|
1104
1104
|
}
|
|
1105
|
-
function
|
|
1105
|
+
function A(s, i, r) {
|
|
1106
1106
|
if (i < 0 || s.byteLength < i)
|
|
1107
1107
|
throw new RangeError('"offset" is outside of buffer bounds');
|
|
1108
1108
|
if (s.byteLength < i + (r || 0))
|
|
@@ -1110,15 +1110,15 @@ function Dn() {
|
|
|
1110
1110
|
let h;
|
|
1111
1111
|
return i === void 0 && r === void 0 ? h = new Uint8Array(s) : r === void 0 ? h = new Uint8Array(s, i) : h = new Uint8Array(s, i, r), Object.setPrototypeOf(h, l.prototype), h;
|
|
1112
1112
|
}
|
|
1113
|
-
function
|
|
1113
|
+
function b(s) {
|
|
1114
1114
|
if (l.isBuffer(s)) {
|
|
1115
1115
|
const i = w(s.length) | 0, r = u(i);
|
|
1116
1116
|
return r.length === 0 || s.copy(r, 0, 0, i), r;
|
|
1117
1117
|
}
|
|
1118
1118
|
if (s.length !== void 0)
|
|
1119
|
-
return typeof s.length != "number" ||
|
|
1119
|
+
return typeof s.length != "number" || ut(s.length) ? u(0) : g(s);
|
|
1120
1120
|
if (s.type === "Buffer" && Array.isArray(s.data))
|
|
1121
|
-
return
|
|
1121
|
+
return g(s.data);
|
|
1122
1122
|
}
|
|
1123
1123
|
function w(s) {
|
|
1124
1124
|
if (s >= c)
|
|
@@ -1207,7 +1207,7 @@ function Dn() {
|
|
|
1207
1207
|
return r;
|
|
1208
1208
|
case "utf8":
|
|
1209
1209
|
case "utf-8":
|
|
1210
|
-
return
|
|
1210
|
+
return ct(s).length;
|
|
1211
1211
|
case "ucs2":
|
|
1212
1212
|
case "ucs-2":
|
|
1213
1213
|
case "utf16le":
|
|
@@ -1219,12 +1219,12 @@ function Dn() {
|
|
|
1219
1219
|
return jt(s).length;
|
|
1220
1220
|
default:
|
|
1221
1221
|
if (f)
|
|
1222
|
-
return h ? -1 :
|
|
1222
|
+
return h ? -1 : ct(s).length;
|
|
1223
1223
|
i = ("" + i).toLowerCase(), f = !0;
|
|
1224
1224
|
}
|
|
1225
1225
|
}
|
|
1226
1226
|
l.byteLength = R;
|
|
1227
|
-
function
|
|
1227
|
+
function U(s, i, r) {
|
|
1228
1228
|
let h = !1;
|
|
1229
1229
|
if ((i === void 0 || i < 0) && (i = 0), i > this.length || ((r === void 0 || r > this.length) && (r = this.length), r <= 0) || (r >>>= 0, i >>>= 0, r <= i))
|
|
1230
1230
|
return "";
|
|
@@ -1234,12 +1234,12 @@ function Dn() {
|
|
|
1234
1234
|
return Xi(this, i, r);
|
|
1235
1235
|
case "utf8":
|
|
1236
1236
|
case "utf-8":
|
|
1237
|
-
return
|
|
1237
|
+
return Ut(this, i, r);
|
|
1238
1238
|
case "ascii":
|
|
1239
|
-
return
|
|
1239
|
+
return Ji(this, i, r);
|
|
1240
1240
|
case "latin1":
|
|
1241
1241
|
case "binary":
|
|
1242
|
-
return
|
|
1242
|
+
return Ki(this, i, r);
|
|
1243
1243
|
case "base64":
|
|
1244
1244
|
return qi(this, i, r);
|
|
1245
1245
|
case "ucs2":
|
|
@@ -1280,7 +1280,7 @@ function Dn() {
|
|
|
1280
1280
|
return this;
|
|
1281
1281
|
}, l.prototype.toString = function() {
|
|
1282
1282
|
const i = this.length;
|
|
1283
|
-
return i === 0 ? "" : arguments.length === 0 ?
|
|
1283
|
+
return i === 0 ? "" : arguments.length === 0 ? Ut(this, 0, i) : U.apply(this, arguments);
|
|
1284
1284
|
}, l.prototype.toLocaleString = l.prototype.toString, l.prototype.equals = function(i) {
|
|
1285
1285
|
if (!l.isBuffer(i)) throw new TypeError("Argument must be a Buffer");
|
|
1286
1286
|
return this === i ? !0 : l.compare(this, i) === 0;
|
|
@@ -1303,17 +1303,17 @@ function Dn() {
|
|
|
1303
1303
|
return 1;
|
|
1304
1304
|
if (r >>>= 0, h >>>= 0, f >>>= 0, E >>>= 0, this === i) return 0;
|
|
1305
1305
|
let v = E - f, T = h - r;
|
|
1306
|
-
const B = Math.min(v, T),
|
|
1306
|
+
const B = Math.min(v, T), M = this.slice(f, E), L = i.slice(r, h);
|
|
1307
1307
|
for (let D = 0; D < B; ++D)
|
|
1308
|
-
if (
|
|
1309
|
-
v =
|
|
1308
|
+
if (M[D] !== L[D]) {
|
|
1309
|
+
v = M[D], T = L[D];
|
|
1310
1310
|
break;
|
|
1311
1311
|
}
|
|
1312
1312
|
return v < T ? -1 : T < v ? 1 : 0;
|
|
1313
1313
|
};
|
|
1314
1314
|
function Z(s, i, r, h, f) {
|
|
1315
1315
|
if (s.length === 0) return -1;
|
|
1316
|
-
if (typeof r == "string" ? (h = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r,
|
|
1316
|
+
if (typeof r == "string" ? (h = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r, ut(r) && (r = f ? 0 : s.length - 1), r < 0 && (r = s.length + r), r >= s.length) {
|
|
1317
1317
|
if (f) return -1;
|
|
1318
1318
|
r = s.length - 1;
|
|
1319
1319
|
} else if (r < 0)
|
|
@@ -1335,23 +1335,23 @@ function Dn() {
|
|
|
1335
1335
|
function B(L, D) {
|
|
1336
1336
|
return E === 1 ? L[D] : L.readUInt16BE(D * E);
|
|
1337
1337
|
}
|
|
1338
|
-
let
|
|
1338
|
+
let M;
|
|
1339
1339
|
if (f) {
|
|
1340
1340
|
let L = -1;
|
|
1341
|
-
for (
|
|
1342
|
-
if (B(s,
|
|
1343
|
-
if (L === -1 && (L =
|
|
1341
|
+
for (M = r; M < v; M++)
|
|
1342
|
+
if (B(s, M) === B(i, L === -1 ? 0 : M - L)) {
|
|
1343
|
+
if (L === -1 && (L = M), M - L + 1 === T) return L * E;
|
|
1344
1344
|
} else
|
|
1345
|
-
L !== -1 && (
|
|
1345
|
+
L !== -1 && (M -= M - L), L = -1;
|
|
1346
1346
|
} else
|
|
1347
|
-
for (r + T > v && (r = v - T),
|
|
1347
|
+
for (r + T > v && (r = v - T), M = r; M >= 0; M--) {
|
|
1348
1348
|
let L = !0;
|
|
1349
1349
|
for (let D = 0; D < T; D++)
|
|
1350
|
-
if (B(s,
|
|
1350
|
+
if (B(s, M + D) !== B(i, D)) {
|
|
1351
1351
|
L = !1;
|
|
1352
1352
|
break;
|
|
1353
1353
|
}
|
|
1354
|
-
if (L) return
|
|
1354
|
+
if (L) return M;
|
|
1355
1355
|
}
|
|
1356
1356
|
return -1;
|
|
1357
1357
|
}
|
|
@@ -1371,13 +1371,13 @@ function Dn() {
|
|
|
1371
1371
|
let v;
|
|
1372
1372
|
for (v = 0; v < h; ++v) {
|
|
1373
1373
|
const T = parseInt(i.substr(v * 2, 2), 16);
|
|
1374
|
-
if (
|
|
1374
|
+
if (ut(T)) return v;
|
|
1375
1375
|
s[r + v] = T;
|
|
1376
1376
|
}
|
|
1377
1377
|
return v;
|
|
1378
1378
|
}
|
|
1379
1379
|
function ne(s, i, r, h) {
|
|
1380
|
-
return Ve(
|
|
1380
|
+
return Ve(ct(i, s.length - r), s, r, h);
|
|
1381
1381
|
}
|
|
1382
1382
|
function re(s, i, r, h) {
|
|
1383
1383
|
return Ve(nn(i), s, r, h);
|
|
@@ -1435,7 +1435,7 @@ function Dn() {
|
|
|
1435
1435
|
function qi(s, i, r) {
|
|
1436
1436
|
return i === 0 && r === s.length ? e.fromByteArray(s) : e.fromByteArray(s.slice(i, r));
|
|
1437
1437
|
}
|
|
1438
|
-
function
|
|
1438
|
+
function Ut(s, i, r) {
|
|
1439
1439
|
r = Math.min(s.length, r);
|
|
1440
1440
|
const h = [];
|
|
1441
1441
|
let f = i;
|
|
@@ -1443,7 +1443,7 @@ function Dn() {
|
|
|
1443
1443
|
const E = s[f];
|
|
1444
1444
|
let v = null, T = E > 239 ? 4 : E > 223 ? 3 : E > 191 ? 2 : 1;
|
|
1445
1445
|
if (f + T <= r) {
|
|
1446
|
-
let B,
|
|
1446
|
+
let B, M, L, D;
|
|
1447
1447
|
switch (T) {
|
|
1448
1448
|
case 1:
|
|
1449
1449
|
E < 128 && (v = E);
|
|
@@ -1452,37 +1452,37 @@ function Dn() {
|
|
|
1452
1452
|
B = s[f + 1], (B & 192) === 128 && (D = (E & 31) << 6 | B & 63, D > 127 && (v = D));
|
|
1453
1453
|
break;
|
|
1454
1454
|
case 3:
|
|
1455
|
-
B = s[f + 1],
|
|
1455
|
+
B = s[f + 1], M = s[f + 2], (B & 192) === 128 && (M & 192) === 128 && (D = (E & 15) << 12 | (B & 63) << 6 | M & 63, D > 2047 && (D < 55296 || D > 57343) && (v = D));
|
|
1456
1456
|
break;
|
|
1457
1457
|
case 4:
|
|
1458
|
-
B = s[f + 1],
|
|
1458
|
+
B = s[f + 1], M = s[f + 2], L = s[f + 3], (B & 192) === 128 && (M & 192) === 128 && (L & 192) === 128 && (D = (E & 15) << 18 | (B & 63) << 12 | (M & 63) << 6 | L & 63, D > 65535 && D < 1114112 && (v = D));
|
|
1459
1459
|
}
|
|
1460
1460
|
}
|
|
1461
1461
|
v === null ? (v = 65533, T = 1) : v > 65535 && (v -= 65536, h.push(v >>> 10 & 1023 | 55296), v = 56320 | v & 1023), h.push(v), f += T;
|
|
1462
1462
|
}
|
|
1463
1463
|
return Yi(h);
|
|
1464
1464
|
}
|
|
1465
|
-
const
|
|
1465
|
+
const Mt = 4096;
|
|
1466
1466
|
function Yi(s) {
|
|
1467
1467
|
const i = s.length;
|
|
1468
|
-
if (i <=
|
|
1468
|
+
if (i <= Mt)
|
|
1469
1469
|
return String.fromCharCode.apply(String, s);
|
|
1470
1470
|
let r = "", h = 0;
|
|
1471
1471
|
for (; h < i; )
|
|
1472
1472
|
r += String.fromCharCode.apply(
|
|
1473
1473
|
String,
|
|
1474
|
-
s.slice(h, h +=
|
|
1474
|
+
s.slice(h, h += Mt)
|
|
1475
1475
|
);
|
|
1476
1476
|
return r;
|
|
1477
1477
|
}
|
|
1478
|
-
function
|
|
1478
|
+
function Ji(s, i, r) {
|
|
1479
1479
|
let h = "";
|
|
1480
1480
|
r = Math.min(s.length, r);
|
|
1481
1481
|
for (let f = i; f < r; ++f)
|
|
1482
1482
|
h += String.fromCharCode(s[f] & 127);
|
|
1483
1483
|
return h;
|
|
1484
1484
|
}
|
|
1485
|
-
function
|
|
1485
|
+
function Ki(s, i, r) {
|
|
1486
1486
|
let h = "";
|
|
1487
1487
|
r = Math.min(s.length, r);
|
|
1488
1488
|
for (let f = i; f < r; ++f)
|
|
@@ -1744,7 +1744,7 @@ function Dn() {
|
|
|
1744
1744
|
return this;
|
|
1745
1745
|
};
|
|
1746
1746
|
const ve = {};
|
|
1747
|
-
function
|
|
1747
|
+
function lt(s, i, r) {
|
|
1748
1748
|
ve[s] = class extends r {
|
|
1749
1749
|
constructor() {
|
|
1750
1750
|
super(), Object.defineProperty(this, "message", {
|
|
@@ -1769,19 +1769,19 @@ function Dn() {
|
|
|
1769
1769
|
}
|
|
1770
1770
|
};
|
|
1771
1771
|
}
|
|
1772
|
-
|
|
1772
|
+
lt(
|
|
1773
1773
|
"ERR_BUFFER_OUT_OF_BOUNDS",
|
|
1774
1774
|
function(s) {
|
|
1775
1775
|
return s ? `${s} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
|
|
1776
1776
|
},
|
|
1777
1777
|
RangeError
|
|
1778
|
-
),
|
|
1778
|
+
), lt(
|
|
1779
1779
|
"ERR_INVALID_ARG_TYPE",
|
|
1780
1780
|
function(s, i) {
|
|
1781
1781
|
return `The "${s}" argument must be of type number. Received type ${typeof i}`;
|
|
1782
1782
|
},
|
|
1783
1783
|
TypeError
|
|
1784
|
-
),
|
|
1784
|
+
), lt(
|
|
1785
1785
|
"ERR_OUT_OF_RANGE",
|
|
1786
1786
|
function(s, i, r) {
|
|
1787
1787
|
let h = `The value of "${s}" is out of range.`, f = r;
|
|
@@ -1825,7 +1825,7 @@ function Dn() {
|
|
|
1825
1825
|
s = s + "=";
|
|
1826
1826
|
return s;
|
|
1827
1827
|
}
|
|
1828
|
-
function
|
|
1828
|
+
function ct(s, i) {
|
|
1829
1829
|
i = i || 1 / 0;
|
|
1830
1830
|
let r;
|
|
1831
1831
|
const h = s.length;
|
|
@@ -1904,7 +1904,7 @@ function Dn() {
|
|
|
1904
1904
|
function ee(s, i) {
|
|
1905
1905
|
return s instanceof i || s != null && s.constructor != null && s.constructor.name != null && s.constructor.name === i.name;
|
|
1906
1906
|
}
|
|
1907
|
-
function
|
|
1907
|
+
function ut(s) {
|
|
1908
1908
|
return s !== s;
|
|
1909
1909
|
}
|
|
1910
1910
|
const on = (function() {
|
|
@@ -1922,10 +1922,10 @@ function Dn() {
|
|
|
1922
1922
|
function sn() {
|
|
1923
1923
|
throw new Error("BigInt not supported");
|
|
1924
1924
|
}
|
|
1925
|
-
})(
|
|
1925
|
+
})(ft)), ft;
|
|
1926
1926
|
}
|
|
1927
|
-
var
|
|
1928
|
-
const
|
|
1927
|
+
var Un = Dn();
|
|
1928
|
+
const Mn = "https://api.anam.ai", Bn = "/v1", ji = {
|
|
1929
1929
|
client: "js-sdk",
|
|
1930
1930
|
version: "4.8.0"
|
|
1931
1931
|
};
|
|
@@ -1943,7 +1943,7 @@ var Ln = function(t, e, n, o) {
|
|
|
1943
1943
|
u(d);
|
|
1944
1944
|
}
|
|
1945
1945
|
}
|
|
1946
|
-
function
|
|
1946
|
+
function m(_) {
|
|
1947
1947
|
try {
|
|
1948
1948
|
p(o.throw(_));
|
|
1949
1949
|
} catch (d) {
|
|
@@ -1951,19 +1951,19 @@ var Ln = function(t, e, n, o) {
|
|
|
1951
1951
|
}
|
|
1952
1952
|
}
|
|
1953
1953
|
function p(_) {
|
|
1954
|
-
_.done ? a(_.value) : c(_.value).then(l,
|
|
1954
|
+
_.done ? a(_.value) : c(_.value).then(l, m);
|
|
1955
1955
|
}
|
|
1956
1956
|
p((o = o.apply(t, e || [])).next());
|
|
1957
1957
|
});
|
|
1958
1958
|
};
|
|
1959
|
-
const Hi = "https://api.anam.ai",
|
|
1959
|
+
const Hi = "https://api.anam.ai", xt = "/v1";
|
|
1960
1960
|
var se;
|
|
1961
1961
|
(function(t) {
|
|
1962
1962
|
t.CLIENT_METRIC_MEASUREMENT_ERROR = "client_error", t.CLIENT_METRIC_MEASUREMENT_CONNECTION_CLOSED = "client_connection_closed", t.CLIENT_METRIC_MEASUREMENT_CONNECTION_ESTABLISHED = "client_connection_established", t.CLIENT_METRIC_MEASUREMENT_SESSION_ATTEMPT = "client_session_attempt", t.CLIENT_METRIC_MEASUREMENT_SESSION_SUCCESS = "client_session_success";
|
|
1963
1963
|
})(se || (se = {}));
|
|
1964
|
-
let
|
|
1965
|
-
const Pn = (t, e =
|
|
1966
|
-
|
|
1964
|
+
let St = Hi, Wi = xt, de, zi = !1;
|
|
1965
|
+
const Pn = (t, e = xt) => {
|
|
1966
|
+
St = t, Wi = e;
|
|
1967
1967
|
}, Fn = (t) => {
|
|
1968
1968
|
de = t;
|
|
1969
1969
|
}, $n = (t) => {
|
|
@@ -1985,7 +1985,7 @@ const Se = (t) => {
|
|
|
1985
1985
|
let a, u = {
|
|
1986
1986
|
"Content-Type": "application/json"
|
|
1987
1987
|
};
|
|
1988
|
-
de?.enabled && de?.baseUrl ? (a = `${de.baseUrl}${c}`, u["X-Anam-Target-Url"] = `${
|
|
1988
|
+
de?.enabled && de?.baseUrl ? (a = `${de.baseUrl}${c}`, u["X-Anam-Target-Url"] = `${St}${c}`) : a = `${St}${c}`, yield fetch(a, {
|
|
1989
1989
|
method: "POST",
|
|
1990
1990
|
headers: u,
|
|
1991
1991
|
body: JSON.stringify({
|
|
@@ -2007,36 +2007,36 @@ const Se = (t) => {
|
|
|
2007
2007
|
issues: []
|
|
2008
2008
|
}, l = ((n = a["inbound-rtp"]) === null || n === void 0 ? void 0 : n.filter((d) => d.kind === "video")) || [];
|
|
2009
2009
|
l.length > 0 && (u.personaVideoStream = [], l.forEach((d) => {
|
|
2010
|
-
var S,
|
|
2010
|
+
var S, g, y, A, b;
|
|
2011
2011
|
const w = {
|
|
2012
2012
|
framesReceived: (S = d.framesReceived) !== null && S !== void 0 ? S : "unknown",
|
|
2013
|
-
framesDropped: (
|
|
2013
|
+
framesDropped: (g = d.framesDropped) !== null && g !== void 0 ? g : "unknown",
|
|
2014
2014
|
framesPerSecond: (y = d.framesPerSecond) !== null && y !== void 0 ? y : "unknown",
|
|
2015
|
-
packetsReceived: (
|
|
2016
|
-
packetsLost: (
|
|
2015
|
+
packetsReceived: (A = d.packetsReceived) !== null && A !== void 0 ? A : "unknown",
|
|
2016
|
+
packetsLost: (b = d.packetsLost) !== null && b !== void 0 ? b : "unknown",
|
|
2017
2017
|
resolution: d.frameWidth && d.frameHeight ? `${d.frameWidth}x${d.frameHeight}` : void 0,
|
|
2018
2018
|
jitter: d.jitter !== void 0 ? d.jitter : void 0
|
|
2019
2019
|
};
|
|
2020
2020
|
u.personaVideoStream.push(w);
|
|
2021
2021
|
}));
|
|
2022
|
-
const
|
|
2023
|
-
|
|
2024
|
-
var S,
|
|
2025
|
-
const
|
|
2022
|
+
const m = ((o = a["inbound-rtp"]) === null || o === void 0 ? void 0 : o.filter((d) => d.kind === "audio")) || [];
|
|
2023
|
+
m.length > 0 && (u.personaAudioStream = [], m.forEach((d) => {
|
|
2024
|
+
var S, g, y;
|
|
2025
|
+
const A = {
|
|
2026
2026
|
packetsReceived: (S = d.packetsReceived) !== null && S !== void 0 ? S : "unknown",
|
|
2027
|
-
packetsLost: (
|
|
2027
|
+
packetsLost: (g = d.packetsLost) !== null && g !== void 0 ? g : "unknown",
|
|
2028
2028
|
audioLevel: (y = d.audioLevel) !== null && y !== void 0 ? y : "unknown",
|
|
2029
2029
|
jitter: d.jitter !== void 0 ? d.jitter : void 0,
|
|
2030
2030
|
totalAudioEnergy: d.totalAudioEnergy !== void 0 ? d.totalAudioEnergy : void 0
|
|
2031
2031
|
};
|
|
2032
|
-
u.personaAudioStream.push(
|
|
2032
|
+
u.personaAudioStream.push(A);
|
|
2033
2033
|
}));
|
|
2034
2034
|
const p = ((c = a["outbound-rtp"]) === null || c === void 0 ? void 0 : c.filter((d) => d.kind === "audio")) || [];
|
|
2035
2035
|
p.length > 0 && (u.userAudioInput = [], p.forEach((d) => {
|
|
2036
|
-
var S,
|
|
2036
|
+
var S, g;
|
|
2037
2037
|
const y = {
|
|
2038
2038
|
packetsSent: (S = d.packetsSent) !== null && S !== void 0 ? S : "unknown",
|
|
2039
|
-
retransmittedPackets: (
|
|
2039
|
+
retransmittedPackets: (g = d.retransmittedPacketsSent) !== null && g !== void 0 ? g : void 0,
|
|
2040
2040
|
avgPacketSendDelay: d.totalPacketSendDelay !== void 0 ? d.totalPacketSendDelay / (d.packetsSent || 1) * 1e3 : void 0
|
|
2041
2041
|
};
|
|
2042
2042
|
u.userAudioInput.push(y);
|
|
@@ -2061,7 +2061,7 @@ const Se = (t) => {
|
|
|
2061
2061
|
const _ = [];
|
|
2062
2062
|
if (l.forEach((d) => {
|
|
2063
2063
|
typeof d.framesDropped == "number" && d.framesDropped > 0 && _.push(`Video: ${d.framesDropped} frames dropped`), typeof d.packetsLost == "number" && d.packetsLost > 0 && _.push(`Video: ${d.packetsLost} packets lost`), typeof d.framesPerSecond == "number" && d.framesPerSecond < 23 && _.push(`Video: Low frame rate (${d.framesPerSecond} fps)`);
|
|
2064
|
-
}),
|
|
2064
|
+
}), m.forEach((d) => {
|
|
2065
2065
|
typeof d.packetsLost == "number" && d.packetsLost > 0 && _.push(`Audio: ${d.packetsLost} packets lost`), typeof d.jitter == "number" && d.jitter > 0.1 && _.push(`Audio: High jitter (${(d.jitter * 1e3).toFixed(1)}ms)`);
|
|
2066
2066
|
}), u.issues = _, e === "json")
|
|
2067
2067
|
return u;
|
|
@@ -2127,10 +2127,10 @@ var N;
|
|
|
2127
2127
|
(function(t) {
|
|
2128
2128
|
t.MESSAGE_HISTORY_UPDATED = "MESSAGE_HISTORY_UPDATED", t.MESSAGE_STREAM_EVENT_RECEIVED = "MESSAGE_STREAM_EVENT_RECEIVED", t.CONNECTION_ESTABLISHED = "CONNECTION_ESTABLISHED", t.CONNECTION_CLOSED = "CONNECTION_CLOSED", t.INPUT_AUDIO_STREAM_STARTED = "INPUT_AUDIO_STREAM_STARTED", t.VIDEO_STREAM_STARTED = "VIDEO_STREAM_STARTED", t.VIDEO_PLAY_STARTED = "VIDEO_PLAY_STARTED", t.AUDIO_STREAM_STARTED = "AUDIO_STREAM_STARTED", t.TALK_STREAM_INTERRUPTED = "TALK_STREAM_INTERRUPTED", t.SESSION_READY = "SESSION_READY", t.SERVER_WARNING = "SERVER_WARNING", t.MIC_PERMISSION_PENDING = "MIC_PERMISSION_PENDING", t.MIC_PERMISSION_GRANTED = "MIC_PERMISSION_GRANTED", t.MIC_PERMISSION_DENIED = "MIC_PERMISSION_DENIED", t.INPUT_AUDIO_DEVICE_CHANGED = "INPUT_AUDIO_DEVICE_CHANGED", t.CLIENT_TOOL_EVENT_RECEIVED = "CLIENT_TOOL_EVENT_RECEIVED", t.REASONING_HISTORY_UPDATED = "REASONING_HISTORY_UPDATED", t.REASONING_STREAM_EVENT_RECEIVED = "REASONING_STREAM_EVENT_RECEIVED";
|
|
2129
2129
|
})(N || (N = {}));
|
|
2130
|
-
var
|
|
2130
|
+
var K;
|
|
2131
2131
|
(function(t) {
|
|
2132
2132
|
t.WEB_SOCKET_OPEN = "WEB_SOCKET_OPEN", t.SIGNAL_MESSAGE_RECEIVED = "SIGNAL_MESSAGE_RECEIVED", t.WEBRTC_CHAT_MESSAGE_RECEIVED = "WEBRTC_CHAT_MESSAGE_RECEIVED", t.WEBRTC_CLIENT_TOOL_EVENT_RECEIVED = "WEBRTC_CLIENT_TOOL_EVENT_RECEIVED", t.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED = "WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED";
|
|
2133
|
-
})(
|
|
2133
|
+
})(K || (K = {}));
|
|
2134
2134
|
var _e;
|
|
2135
2135
|
(function(t) {
|
|
2136
2136
|
t.NORMAL = "CONNECTION_CLOSED_CODE_NORMAL", t.MICROPHONE_PERMISSION_DENIED = "CONNECTION_CLOSED_CODE_MICROPHONE_PERMISSION_DENIED", t.SIGNALLING_CLIENT_CONNECTION_FAILURE = "CONNECTION_CLOSED_CODE_SIGNALLING_CLIENT_CONNECTION_FAILURE", t.WEBRTC_FAILURE = "CONNECTION_CLOSED_CODE_WEBRTC_FAILURE", t.SERVER_CLOSED_CONNECTION = "CONNECTION_CLOSED_CODE_SERVER_CLOSED_CONNECTION";
|
|
@@ -2191,7 +2191,7 @@ var we = function(t, e, n, o) {
|
|
|
2191
2191
|
u(d);
|
|
2192
2192
|
}
|
|
2193
2193
|
}
|
|
2194
|
-
function
|
|
2194
|
+
function m(_) {
|
|
2195
2195
|
try {
|
|
2196
2196
|
p(o.throw(_));
|
|
2197
2197
|
} catch (d) {
|
|
@@ -2199,7 +2199,7 @@ var we = function(t, e, n, o) {
|
|
|
2199
2199
|
}
|
|
2200
2200
|
}
|
|
2201
2201
|
function p(_) {
|
|
2202
|
-
_.done ? a(_.value) : c(_.value).then(l,
|
|
2202
|
+
_.done ? a(_.value) : c(_.value).then(l, m);
|
|
2203
2203
|
}
|
|
2204
2204
|
p((o = o.apply(t, e || [])).next());
|
|
2205
2205
|
});
|
|
@@ -2207,21 +2207,21 @@ var we = function(t, e, n, o) {
|
|
|
2207
2207
|
const Hn = 5, Wn = 5;
|
|
2208
2208
|
class zn {
|
|
2209
2209
|
constructor(e, n, o, c, a) {
|
|
2210
|
-
var u, l,
|
|
2210
|
+
var u, l, m, p, _;
|
|
2211
2211
|
if (this.stopSignal = !1, this.sendingBuffer = [], this.wsConnectionAttempts = 0, this.socket = null, this.heartBeatIntervalRef = null, this.publicEventEmitter = o, this.internalEventEmitter = c, this.apiGatewayConfig = a, !e)
|
|
2212
2212
|
throw new Error("Signalling Client: sessionId is required");
|
|
2213
2213
|
this.sessionId = e;
|
|
2214
|
-
const { heartbeatIntervalSeconds: d, maxWsReconnectionAttempts: S, url:
|
|
2215
|
-
if (this.heartbeatIntervalSeconds = d || Hn, this.maxWsReconnectionAttempts = S || Wn, !
|
|
2214
|
+
const { heartbeatIntervalSeconds: d, maxWsReconnectionAttempts: S, url: g } = n;
|
|
2215
|
+
if (this.heartbeatIntervalSeconds = d || Hn, this.maxWsReconnectionAttempts = S || Wn, !g.baseUrl)
|
|
2216
2216
|
throw new Error("Signalling Client: baseUrl is required");
|
|
2217
2217
|
if (!((u = this.apiGatewayConfig) === null || u === void 0) && u.enabled && (!((l = this.apiGatewayConfig) === null || l === void 0) && l.baseUrl)) {
|
|
2218
|
-
const y = new URL(this.apiGatewayConfig.baseUrl),
|
|
2219
|
-
y.protocol = y.protocol.replace("http", "ws"), y.pathname =
|
|
2220
|
-
const
|
|
2221
|
-
|
|
2218
|
+
const y = new URL(this.apiGatewayConfig.baseUrl), A = (m = this.apiGatewayConfig.wsPath) !== null && m !== void 0 ? m : "/ws";
|
|
2219
|
+
y.protocol = y.protocol.replace("http", "ws"), y.pathname = A, this.url = y;
|
|
2220
|
+
const b = g.protocol || "https", w = b === "http" ? "ws" : "wss", I = `${b}://${g.baseUrl}`, R = (p = g.signallingPath) !== null && p !== void 0 ? p : "/ws", U = new URL(I);
|
|
2221
|
+
U.protocol = w === "ws" ? "ws:" : "wss:", g.port && (U.port = g.port), U.pathname = R, U.searchParams.append("session_id", e), this.url.searchParams.append("target_url", U.href);
|
|
2222
2222
|
} else {
|
|
2223
|
-
const
|
|
2224
|
-
this.url = new URL(
|
|
2223
|
+
const A = `${g.protocol || "https"}://${g.baseUrl}`;
|
|
2224
|
+
this.url = new URL(A), this.url.protocol = g.protocol === "http" ? "ws:" : "wss:", g.port && (this.url.port = g.port), this.url.pathname = (_ = g.signallingPath) !== null && _ !== void 0 ? _ : "/ws", this.url.searchParams.append("session_id", e);
|
|
2225
2225
|
}
|
|
2226
2226
|
}
|
|
2227
2227
|
stop() {
|
|
@@ -2299,7 +2299,7 @@ class zn {
|
|
|
2299
2299
|
if (!this.socket)
|
|
2300
2300
|
throw new Error("SignallingClient - onOpen: socket is null");
|
|
2301
2301
|
try {
|
|
2302
|
-
this.wsConnectionAttempts = 0, this.flushSendingBuffer(), this.socket.onmessage = this.onMessage.bind(this), this.startSendingHeartBeats(), this.internalEventEmitter.emit(
|
|
2302
|
+
this.wsConnectionAttempts = 0, this.flushSendingBuffer(), this.socket.onmessage = this.onMessage.bind(this), this.startSendingHeartBeats(), this.internalEventEmitter.emit(K.WEB_SOCKET_OPEN);
|
|
2303
2303
|
} catch (e) {
|
|
2304
2304
|
console.error("SignallingClient - onOpen: error in onOpen", e), this.publicEventEmitter.emit(N.CONNECTION_CLOSED, _e.SIGNALLING_CLIENT_CONNECTION_FAILURE);
|
|
2305
2305
|
}
|
|
@@ -2325,7 +2325,7 @@ class zn {
|
|
|
2325
2325
|
onMessage(e) {
|
|
2326
2326
|
return we(this, void 0, void 0, function* () {
|
|
2327
2327
|
const n = JSON.parse(e.data);
|
|
2328
|
-
this.internalEventEmitter.emit(
|
|
2328
|
+
this.internalEventEmitter.emit(K.SIGNAL_MESSAGE_RECEIVED, n);
|
|
2329
2329
|
});
|
|
2330
2330
|
}
|
|
2331
2331
|
startSendingHeartBeats() {
|
|
@@ -2360,7 +2360,7 @@ var li = function(t, e, n, o) {
|
|
|
2360
2360
|
u(d);
|
|
2361
2361
|
}
|
|
2362
2362
|
}
|
|
2363
|
-
function
|
|
2363
|
+
function m(_) {
|
|
2364
2364
|
try {
|
|
2365
2365
|
p(o.throw(_));
|
|
2366
2366
|
} catch (d) {
|
|
@@ -2368,7 +2368,7 @@ var li = function(t, e, n, o) {
|
|
|
2368
2368
|
}
|
|
2369
2369
|
}
|
|
2370
2370
|
function p(_) {
|
|
2371
|
-
_.done ? a(_.value) : c(_.value).then(l,
|
|
2371
|
+
_.done ? a(_.value) : c(_.value).then(l, m);
|
|
2372
2372
|
}
|
|
2373
2373
|
p((o = o.apply(t, e || [])).next());
|
|
2374
2374
|
});
|
|
@@ -2377,7 +2377,7 @@ class Yn {
|
|
|
2377
2377
|
constructor(e, n, o) {
|
|
2378
2378
|
if (!e && !n)
|
|
2379
2379
|
throw new Error("Either sessionToken or apiKey must be provided");
|
|
2380
|
-
this.sessionToken = e || null, this.apiKey = n || null, this.baseUrl = o?.baseUrl ||
|
|
2380
|
+
this.sessionToken = e || null, this.apiKey = n || null, this.baseUrl = o?.baseUrl || Mn, this.apiVersion = o?.apiVersion || Bn, this.apiGatewayConfig = o?.apiGateway || void 0;
|
|
2381
2381
|
}
|
|
2382
2382
|
/**
|
|
2383
2383
|
* Builds URL and headers for a request, applying API Gateway configuration if enabled
|
|
@@ -2413,7 +2413,7 @@ class Yn {
|
|
|
2413
2413
|
sessionOptions: n,
|
|
2414
2414
|
clientMetadata: ji
|
|
2415
2415
|
})
|
|
2416
|
-
}), l = yield u.json(),
|
|
2416
|
+
}), l = yield u.json(), m = l.error;
|
|
2417
2417
|
switch (u.status) {
|
|
2418
2418
|
case 200:
|
|
2419
2419
|
case 201:
|
|
@@ -2427,7 +2427,7 @@ class Yn {
|
|
|
2427
2427
|
case 403:
|
|
2428
2428
|
throw new $("Authentication failed when starting session", V.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 403, { cause: l.message });
|
|
2429
2429
|
case 429:
|
|
2430
|
-
throw
|
|
2430
|
+
throw m === "Concurrent session limit reached" ? new $("Concurrency limit reached, please upgrade your plan", V.CLIENT_ERROR_CODE_MAX_CONCURRENT_SESSIONS_REACHED, 429, { cause: l.message }) : m === "Spend cap reached" ? new $("Spend cap reached, please upgrade your plan", V.CLIENT_ERROR_CODE_SPEND_CAP_REACHED, 429, { cause: l.message }) : new $("Usage limit reached, please upgrade your plan", V.CLIENT_ERROR_CODE_USAGE_LIMIT_REACHED, 429, { cause: l.message });
|
|
2431
2431
|
case 503:
|
|
2432
2432
|
throw new $("There are no available personas, please try again later", V.CLIENT_ERROR_CODE_SERVICE_BUSY, 503, { cause: l.message });
|
|
2433
2433
|
default:
|
|
@@ -2466,7 +2466,7 @@ class Yn {
|
|
|
2466
2466
|
return `${this.baseUrl}${this.apiVersion}`;
|
|
2467
2467
|
}
|
|
2468
2468
|
}
|
|
2469
|
-
var
|
|
2469
|
+
var Jn = function(t, e, n, o) {
|
|
2470
2470
|
function c(a) {
|
|
2471
2471
|
return a instanceof n ? a : new n(function(u) {
|
|
2472
2472
|
u(a);
|
|
@@ -2480,7 +2480,7 @@ var Kn = function(t, e, n, o) {
|
|
|
2480
2480
|
u(d);
|
|
2481
2481
|
}
|
|
2482
2482
|
}
|
|
2483
|
-
function
|
|
2483
|
+
function m(_) {
|
|
2484
2484
|
try {
|
|
2485
2485
|
p(o.throw(_));
|
|
2486
2486
|
} catch (d) {
|
|
@@ -2488,17 +2488,17 @@ var Kn = function(t, e, n, o) {
|
|
|
2488
2488
|
}
|
|
2489
2489
|
}
|
|
2490
2490
|
function p(_) {
|
|
2491
|
-
_.done ? a(_.value) : c(_.value).then(l,
|
|
2491
|
+
_.done ? a(_.value) : c(_.value).then(l, m);
|
|
2492
2492
|
}
|
|
2493
2493
|
p((o = o.apply(t, e || [])).next());
|
|
2494
2494
|
});
|
|
2495
2495
|
};
|
|
2496
|
-
class
|
|
2496
|
+
class Kn {
|
|
2497
2497
|
constructor(e, n, o) {
|
|
2498
2498
|
this.baseUrl = e, this.sessionId = n, this.apiGatewayConfig = o;
|
|
2499
2499
|
}
|
|
2500
2500
|
sendTalkCommand(e) {
|
|
2501
|
-
return
|
|
2501
|
+
return Jn(this, void 0, void 0, function* () {
|
|
2502
2502
|
var n, o;
|
|
2503
2503
|
try {
|
|
2504
2504
|
let c, a = {
|
|
@@ -2511,15 +2511,15 @@ class Jn {
|
|
|
2511
2511
|
a["X-Anam-Target-Url"] = p.href;
|
|
2512
2512
|
} else
|
|
2513
2513
|
c = `${this.baseUrl}${u}${l}`;
|
|
2514
|
-
const
|
|
2514
|
+
const m = yield fetch(c, {
|
|
2515
2515
|
method: "POST",
|
|
2516
2516
|
headers: a,
|
|
2517
2517
|
body: JSON.stringify({
|
|
2518
2518
|
content: e
|
|
2519
2519
|
})
|
|
2520
2520
|
});
|
|
2521
|
-
if (!
|
|
2522
|
-
throw new Error(`Failed to send talk command: ${
|
|
2521
|
+
if (!m.ok)
|
|
2522
|
+
throw new Error(`Failed to send talk command: ${m.status} ${m.statusText}`);
|
|
2523
2523
|
} catch (c) {
|
|
2524
2524
|
throw console.error(c), new Error("EngineApiRestClient - sendTalkCommand: Failed to send talk command");
|
|
2525
2525
|
}
|
|
@@ -2544,7 +2544,7 @@ class Xn {
|
|
|
2544
2544
|
}
|
|
2545
2545
|
class Zn {
|
|
2546
2546
|
constructor(e, n) {
|
|
2547
|
-
this.messages = [], this.publicEventEmitter = e, this.internalEventEmitter = n, this.internalEventEmitter.addListener(
|
|
2547
|
+
this.messages = [], this.publicEventEmitter = e, this.internalEventEmitter = n, this.internalEventEmitter.addListener(K.WEBRTC_CHAT_MESSAGE_RECEIVED, this.processWebRtcTextMessageEvent.bind(this));
|
|
2548
2548
|
}
|
|
2549
2549
|
webRtcTextMessageEventToMessageStreamEvent(e) {
|
|
2550
2550
|
return {
|
|
@@ -2614,7 +2614,7 @@ var z;
|
|
|
2614
2614
|
(function(t) {
|
|
2615
2615
|
t[t.UNSTARTED = 0] = "UNSTARTED", t[t.STREAMING = 1] = "STREAMING", t[t.INTERRUPTED = 2] = "INTERRUPTED", t[t.ENDED = 3] = "ENDED";
|
|
2616
2616
|
})(z || (z = {}));
|
|
2617
|
-
var
|
|
2617
|
+
var pt = function(t, e, n, o) {
|
|
2618
2618
|
function c(a) {
|
|
2619
2619
|
return a instanceof n ? a : new n(function(u) {
|
|
2620
2620
|
u(a);
|
|
@@ -2628,7 +2628,7 @@ var Et = function(t, e, n, o) {
|
|
|
2628
2628
|
u(d);
|
|
2629
2629
|
}
|
|
2630
2630
|
}
|
|
2631
|
-
function
|
|
2631
|
+
function m(_) {
|
|
2632
2632
|
try {
|
|
2633
2633
|
p(o.throw(_));
|
|
2634
2634
|
} catch (d) {
|
|
@@ -2636,25 +2636,25 @@ var Et = function(t, e, n, o) {
|
|
|
2636
2636
|
}
|
|
2637
2637
|
}
|
|
2638
2638
|
function p(_) {
|
|
2639
|
-
_.done ? a(_.value) : c(_.value).then(l,
|
|
2639
|
+
_.done ? a(_.value) : c(_.value).then(l, m);
|
|
2640
2640
|
}
|
|
2641
2641
|
p((o = o.apply(t, e || [])).next());
|
|
2642
2642
|
});
|
|
2643
2643
|
};
|
|
2644
2644
|
class er {
|
|
2645
2645
|
constructor(e, n, o) {
|
|
2646
|
-
this.state = z.UNSTARTED, this.correlationId = e, this.internalEventEmitter = n, this.signallingClient = o, this.internalEventEmitter.addListener(
|
|
2646
|
+
this.state = z.UNSTARTED, this.correlationId = e, this.internalEventEmitter = n, this.signallingClient = o, this.internalEventEmitter.addListener(K.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this));
|
|
2647
2647
|
}
|
|
2648
2648
|
onDeactivate() {
|
|
2649
|
-
this.internalEventEmitter.removeListener(
|
|
2649
|
+
this.internalEventEmitter.removeListener(K.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this));
|
|
2650
2650
|
}
|
|
2651
2651
|
onSignalMessage(e) {
|
|
2652
|
-
return
|
|
2652
|
+
return pt(this, void 0, void 0, function* () {
|
|
2653
2653
|
e.actionType === W.TALK_STREAM_INTERRUPTED && e.payload.correlationId === this.correlationId && (this.state = z.INTERRUPTED, this.onDeactivate());
|
|
2654
2654
|
});
|
|
2655
2655
|
}
|
|
2656
2656
|
endMessage() {
|
|
2657
|
-
return
|
|
2657
|
+
return pt(this, void 0, void 0, function* () {
|
|
2658
2658
|
if (this.state === z.ENDED) {
|
|
2659
2659
|
console.warn("Talk stream is already ended via end of speech. No need to call endMessage.");
|
|
2660
2660
|
return;
|
|
@@ -2673,7 +2673,7 @@ class er {
|
|
|
2673
2673
|
});
|
|
2674
2674
|
}
|
|
2675
2675
|
streamMessageChunk(e, n) {
|
|
2676
|
-
return
|
|
2676
|
+
return pt(this, void 0, void 0, function* () {
|
|
2677
2677
|
if (this.state !== z.STREAMING && this.state !== z.UNSTARTED)
|
|
2678
2678
|
throw new Error("Talk stream is not in an active state: " + this.state);
|
|
2679
2679
|
const o = {
|
|
@@ -2695,7 +2695,7 @@ class er {
|
|
|
2695
2695
|
return this.state;
|
|
2696
2696
|
}
|
|
2697
2697
|
}
|
|
2698
|
-
var
|
|
2698
|
+
var J = function(t, e, n, o) {
|
|
2699
2699
|
function c(a) {
|
|
2700
2700
|
return a instanceof n ? a : new n(function(u) {
|
|
2701
2701
|
u(a);
|
|
@@ -2709,7 +2709,7 @@ var K = function(t, e, n, o) {
|
|
|
2709
2709
|
u(d);
|
|
2710
2710
|
}
|
|
2711
2711
|
}
|
|
2712
|
-
function
|
|
2712
|
+
function m(_) {
|
|
2713
2713
|
try {
|
|
2714
2714
|
p(o.throw(_));
|
|
2715
2715
|
} catch (d) {
|
|
@@ -2717,7 +2717,7 @@ var K = function(t, e, n, o) {
|
|
|
2717
2717
|
}
|
|
2718
2718
|
}
|
|
2719
2719
|
function p(_) {
|
|
2720
|
-
_.done ? a(_.value) : c(_.value).then(l,
|
|
2720
|
+
_.done ? a(_.value) : c(_.value).then(l, m);
|
|
2721
2721
|
}
|
|
2722
2722
|
p((o = o.apply(t, e || [])).next());
|
|
2723
2723
|
});
|
|
@@ -2725,13 +2725,13 @@ var K = function(t, e, n, o) {
|
|
|
2725
2725
|
const tr = 15e3, ir = 5e3, nr = 2;
|
|
2726
2726
|
class rr {
|
|
2727
2727
|
constructor(e, n, o, c) {
|
|
2728
|
-
var a, u, l,
|
|
2728
|
+
var a, u, l, m;
|
|
2729
2729
|
this.peerConnection = null, this.connectionReceivedAnswer = !1, this.remoteIceCandidateBuffer = [], this.inputAudioStream = null, this.dataChannel = null, this.videoElement = null, this.videoStream = null, this.audioStream = null, this.inputAudioState = {
|
|
2730
2730
|
isMuted: !1,
|
|
2731
2731
|
permissionState: fe.NOT_REQUESTED
|
|
2732
2732
|
}, this.successMetricPoller = null, this.successMetricFired = !1, this.showPeerConnectionStatsReport = !1, this.peerConnectionStatsReportOutputFormat = "console", this.statsCollectionInterval = null, this.agentAudioInputStream = null, this.publicEventEmitter = o, this.internalEventEmitter = c, this.apiGatewayConfig = n.apiGateway;
|
|
2733
2733
|
const { inputAudio: p } = n;
|
|
2734
|
-
this.inputAudioState = p.inputAudioState, n.inputAudio.userProvidedMediaStream && (this.inputAudioStream = n.inputAudio.userProvidedMediaStream), this.disableInputAudio = n.inputAudio.disableInputAudio === !0, this.internalEventEmitter.addListener(
|
|
2734
|
+
this.inputAudioState = p.inputAudioState, n.inputAudio.userProvidedMediaStream && (this.inputAudioStream = n.inputAudio.userProvidedMediaStream), this.disableInputAudio = n.inputAudio.disableInputAudio === !0, this.internalEventEmitter.addListener(K.WEB_SOCKET_OPEN, this.onSignallingClientConnected.bind(this)), this.internalEventEmitter.addListener(K.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this)), this.iceServers = n.iceServers, this.signallingClient = new zn(e, n.signalling, this.publicEventEmitter, this.internalEventEmitter, this.apiGatewayConfig), this.engineApiRestClient = new Kn(n.engine.baseUrl, e, this.apiGatewayConfig), this.audioDeviceId = n.inputAudio.audioDeviceId, this.showPeerConnectionStatsReport = (u = (a = n.metrics) === null || a === void 0 ? void 0 : a.showPeerConnectionStatsReport) !== null && u !== void 0 ? u : !1, this.peerConnectionStatsReportOutputFormat = (m = (l = n.metrics) === null || l === void 0 ? void 0 : l.peerConnectionStatsReportOutputFormat) !== null && m !== void 0 ? m : "console";
|
|
2735
2735
|
}
|
|
2736
2736
|
onInputAudioStateChange(e, n) {
|
|
2737
2737
|
e.isMuted !== n.isMuted && (n.isMuted ? this.muteAllAudioTracks() : this.unmuteAllAudioTracks());
|
|
@@ -2749,7 +2749,7 @@ class rr {
|
|
|
2749
2749
|
});
|
|
2750
2750
|
}
|
|
2751
2751
|
startStatsCollection() {
|
|
2752
|
-
this.statsCollectionInterval || (this.statsCollectionInterval = setInterval(() =>
|
|
2752
|
+
this.statsCollectionInterval || (this.statsCollectionInterval = setInterval(() => J(this, void 0, void 0, function* () {
|
|
2753
2753
|
if (!(!this.peerConnection || !this.dataChannel || this.dataChannel.readyState !== "open"))
|
|
2754
2754
|
try {
|
|
2755
2755
|
const e = yield this.peerConnection.getStats();
|
|
@@ -2776,7 +2776,7 @@ class rr {
|
|
|
2776
2776
|
const e = setTimeout(() => {
|
|
2777
2777
|
this.successMetricPoller && (console.warn("No video frames received, there is a problem with the connection."), clearInterval(this.successMetricPoller), this.successMetricPoller = null);
|
|
2778
2778
|
}, tr);
|
|
2779
|
-
this.successMetricPoller = setInterval(() =>
|
|
2779
|
+
this.successMetricPoller = setInterval(() => J(this, void 0, void 0, function* () {
|
|
2780
2780
|
if (!this.peerConnection || this.successMetricFired) {
|
|
2781
2781
|
this.successMetricPoller && clearInterval(this.successMetricPoller), clearTimeout(e);
|
|
2782
2782
|
return;
|
|
@@ -2807,7 +2807,7 @@ class rr {
|
|
|
2807
2807
|
return this.peerConnection;
|
|
2808
2808
|
}
|
|
2809
2809
|
changeAudioInputDevice(e) {
|
|
2810
|
-
return
|
|
2810
|
+
return J(this, void 0, void 0, function* () {
|
|
2811
2811
|
if (!this.peerConnection)
|
|
2812
2812
|
throw new Error("StreamingClient - changeAudioInputDevice: peer connection is not initialized. Start streaming first.");
|
|
2813
2813
|
if (e == null)
|
|
@@ -2863,12 +2863,12 @@ class rr {
|
|
|
2863
2863
|
}
|
|
2864
2864
|
}
|
|
2865
2865
|
stopConnection() {
|
|
2866
|
-
return
|
|
2866
|
+
return J(this, void 0, void 0, function* () {
|
|
2867
2867
|
yield this.shutdown();
|
|
2868
2868
|
});
|
|
2869
2869
|
}
|
|
2870
2870
|
sendTalkCommand(e) {
|
|
2871
|
-
return
|
|
2871
|
+
return J(this, void 0, void 0, function* () {
|
|
2872
2872
|
if (!this.peerConnection)
|
|
2873
2873
|
throw new Error("StreamingClient - sendTalkCommand: peer connection is null");
|
|
2874
2874
|
yield this.engineApiRestClient.sendTalkCommand(e);
|
|
@@ -2884,7 +2884,7 @@ class rr {
|
|
|
2884
2884
|
return this.agentAudioInputStream;
|
|
2885
2885
|
}
|
|
2886
2886
|
initPeerConnection() {
|
|
2887
|
-
return
|
|
2887
|
+
return J(this, void 0, void 0, function* () {
|
|
2888
2888
|
this.peerConnection = new RTCPeerConnection({
|
|
2889
2889
|
iceServers: this.iceServers,
|
|
2890
2890
|
iceCandidatePoolSize: nr
|
|
@@ -2894,7 +2894,7 @@ class rr {
|
|
|
2894
2894
|
});
|
|
2895
2895
|
}
|
|
2896
2896
|
onSignalMessage(e) {
|
|
2897
|
-
return
|
|
2897
|
+
return J(this, void 0, void 0, function* () {
|
|
2898
2898
|
if (!this.peerConnection) {
|
|
2899
2899
|
console.error("StreamingClient - onSignalMessage: peerConnection is not initialized");
|
|
2900
2900
|
return;
|
|
@@ -2921,8 +2921,8 @@ class rr {
|
|
|
2921
2921
|
this.publicEventEmitter.emit(N.TALK_STREAM_INTERRUPTED, l.correlationId);
|
|
2922
2922
|
break;
|
|
2923
2923
|
case W.SESSION_READY:
|
|
2924
|
-
const
|
|
2925
|
-
this.publicEventEmitter.emit(N.SESSION_READY,
|
|
2924
|
+
const m = e.sessionId;
|
|
2925
|
+
this.publicEventEmitter.emit(N.SESSION_READY, m);
|
|
2926
2926
|
break;
|
|
2927
2927
|
case W.HEARTBEAT:
|
|
2928
2928
|
break;
|
|
@@ -2932,7 +2932,7 @@ class rr {
|
|
|
2932
2932
|
});
|
|
2933
2933
|
}
|
|
2934
2934
|
onSignallingClientConnected() {
|
|
2935
|
-
return
|
|
2935
|
+
return J(this, void 0, void 0, function* () {
|
|
2936
2936
|
if (!this.peerConnection)
|
|
2937
2937
|
try {
|
|
2938
2938
|
yield this.initPeerConnectionAndSendOffer();
|
|
@@ -2986,7 +2986,7 @@ class rr {
|
|
|
2986
2986
|
* Set up the data channels for sending and receiving messages
|
|
2987
2987
|
*/
|
|
2988
2988
|
setupDataChannels() {
|
|
2989
|
-
return
|
|
2989
|
+
return J(this, void 0, void 0, function* () {
|
|
2990
2990
|
if (!this.peerConnection) {
|
|
2991
2991
|
console.error("StreamingClient - setupDataChannels: peer connection is not initialized");
|
|
2992
2992
|
return;
|
|
@@ -3004,16 +3004,16 @@ class rr {
|
|
|
3004
3004
|
const o = JSON.parse(n.data);
|
|
3005
3005
|
switch (o.messageType) {
|
|
3006
3006
|
case De.SPEECH_TEXT:
|
|
3007
|
-
this.internalEventEmitter.emit(
|
|
3007
|
+
this.internalEventEmitter.emit(K.WEBRTC_CHAT_MESSAGE_RECEIVED, o.data);
|
|
3008
3008
|
break;
|
|
3009
3009
|
case De.CLIENT_TOOL_EVENT:
|
|
3010
3010
|
const c = o.data;
|
|
3011
|
-
this.internalEventEmitter.emit(
|
|
3011
|
+
this.internalEventEmitter.emit(K.WEBRTC_CLIENT_TOOL_EVENT_RECEIVED, c);
|
|
3012
3012
|
const a = or.WebRTCClientToolEventToClientToolEvent(c);
|
|
3013
3013
|
this.publicEventEmitter.emit(N.CLIENT_TOOL_EVENT_RECEIVED, a);
|
|
3014
3014
|
break;
|
|
3015
3015
|
case De.REASONING_TEXT:
|
|
3016
|
-
this.internalEventEmitter.emit(
|
|
3016
|
+
this.internalEventEmitter.emit(K.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED, o.data);
|
|
3017
3017
|
break;
|
|
3018
3018
|
// Unknown message types are silently ignored to maintain forward compatibility
|
|
3019
3019
|
default:
|
|
@@ -3029,7 +3029,7 @@ class rr {
|
|
|
3029
3029
|
* Request microphone permission asynchronously without blocking connection
|
|
3030
3030
|
*/
|
|
3031
3031
|
requestMicrophonePermissionAsync() {
|
|
3032
|
-
return
|
|
3032
|
+
return J(this, void 0, void 0, function* () {
|
|
3033
3033
|
if (this.inputAudioState.permissionState !== fe.PENDING) {
|
|
3034
3034
|
this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: fe.PENDING }), this.publicEventEmitter.emit(N.MIC_PERMISSION_PENDING);
|
|
3035
3035
|
try {
|
|
@@ -3053,7 +3053,7 @@ class rr {
|
|
|
3053
3053
|
* Set up audio track and add it to the peer connection using replaceTrack
|
|
3054
3054
|
*/
|
|
3055
3055
|
setupAudioTrack() {
|
|
3056
|
-
return
|
|
3056
|
+
return J(this, void 0, void 0, function* () {
|
|
3057
3057
|
if (!this.peerConnection || !this.inputAudioStream)
|
|
3058
3058
|
return;
|
|
3059
3059
|
if (!this.inputAudioStream.getAudioTracks().length) {
|
|
@@ -3077,7 +3077,7 @@ class rr {
|
|
|
3077
3077
|
});
|
|
3078
3078
|
}
|
|
3079
3079
|
initPeerConnectionAndSendOffer() {
|
|
3080
|
-
return
|
|
3080
|
+
return J(this, void 0, void 0, function* () {
|
|
3081
3081
|
if (yield this.initPeerConnection(), !this.peerConnection) {
|
|
3082
3082
|
console.error("StreamingClient - initPeerConnectionAndSendOffer: peer connection is not initialized");
|
|
3083
3083
|
return;
|
|
@@ -3094,7 +3094,7 @@ class rr {
|
|
|
3094
3094
|
});
|
|
3095
3095
|
}
|
|
3096
3096
|
shutdown() {
|
|
3097
|
-
return
|
|
3097
|
+
return J(this, void 0, void 0, function* () {
|
|
3098
3098
|
var e;
|
|
3099
3099
|
if (this.showPeerConnectionStatsReport) {
|
|
3100
3100
|
const n = yield (e = this.peerConnection) === null || e === void 0 ? void 0 : e.getStats();
|
|
@@ -3142,7 +3142,7 @@ class or {
|
|
|
3142
3142
|
}
|
|
3143
3143
|
class sr {
|
|
3144
3144
|
constructor(e, n) {
|
|
3145
|
-
this.reasoning_messages = [], this.publicEventEmitter = e, this.internalEventEmitter = n, this.internalEventEmitter.addListener(
|
|
3145
|
+
this.reasoning_messages = [], this.publicEventEmitter = e, this.internalEventEmitter = n, this.internalEventEmitter.addListener(K.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED, this.processWebRtcReasoningTextMessageEvent.bind(this));
|
|
3146
3146
|
}
|
|
3147
3147
|
webRtcTextMessageEventToReasoningStreamEvent(e) {
|
|
3148
3148
|
return {
|
|
@@ -3182,7 +3182,7 @@ var ue = function(t, e, n, o) {
|
|
|
3182
3182
|
u(d);
|
|
3183
3183
|
}
|
|
3184
3184
|
}
|
|
3185
|
-
function
|
|
3185
|
+
function m(_) {
|
|
3186
3186
|
try {
|
|
3187
3187
|
p(o.throw(_));
|
|
3188
3188
|
} catch (d) {
|
|
@@ -3190,14 +3190,14 @@ var ue = function(t, e, n, o) {
|
|
|
3190
3190
|
}
|
|
3191
3191
|
}
|
|
3192
3192
|
function p(_) {
|
|
3193
|
-
_.done ? a(_.value) : c(_.value).then(l,
|
|
3193
|
+
_.done ? a(_.value) : c(_.value).then(l, m);
|
|
3194
3194
|
}
|
|
3195
3195
|
p((o = o.apply(t, e || [])).next());
|
|
3196
3196
|
});
|
|
3197
3197
|
};
|
|
3198
3198
|
class ar {
|
|
3199
3199
|
constructor(e, n, o) {
|
|
3200
|
-
var c, a, u, l,
|
|
3200
|
+
var c, a, u, l, m;
|
|
3201
3201
|
this.inputAudioState = {
|
|
3202
3202
|
isMuted: !1,
|
|
3203
3203
|
permissionState: fe.NOT_REQUESTED
|
|
@@ -3205,11 +3205,11 @@ class ar {
|
|
|
3205
3205
|
const p = this.validateClientConfig(e, n, o);
|
|
3206
3206
|
if (p)
|
|
3207
3207
|
throw new $(p, V.CLIENT_ERROR_CODE_CONFIGURATION_ERROR, 400);
|
|
3208
|
-
this.personaConfig = n, this.clientOptions = o, (!((c = o?.api) === null || c === void 0) && c.baseUrl || !((a = o?.api) === null || a === void 0) && a.apiVersion) && Pn(o.api.baseUrl || Hi, o.api.apiVersion ||
|
|
3208
|
+
this.personaConfig = n, this.clientOptions = o, (!((c = o?.api) === null || c === void 0) && c.baseUrl || !((a = o?.api) === null || a === void 0) && a.apiVersion) && Pn(o.api.baseUrl || Hi, o.api.apiVersion || xt), !((l = (u = o?.api) === null || u === void 0 ? void 0 : u.apiGateway) === null || l === void 0) && l.enabled && Fn(o.api.apiGateway), !((m = o?.metrics) === null || m === void 0) && m.disableClientMetrics && $n(!0), this.publicEventEmitter = new Qn(), this.internalEventEmitter = new Xn(), this.apiClient = new Yn(e, o?.apiKey, o?.api), this.messageHistoryClient = new Zn(this.publicEventEmitter, this.internalEventEmitter), this.reasoningHistoryClient = new sr(this.publicEventEmitter, this.internalEventEmitter);
|
|
3209
3209
|
}
|
|
3210
3210
|
decodeJwt(e) {
|
|
3211
3211
|
try {
|
|
3212
|
-
const n = e.split(".")[1], o =
|
|
3212
|
+
const n = e.split(".")[1], o = Un.Buffer.from(n, "base64").toString("utf8");
|
|
3213
3213
|
return JSON.parse(o);
|
|
3214
3214
|
} catch {
|
|
3215
3215
|
throw new Error("Invalid session token format");
|
|
@@ -3229,10 +3229,10 @@ class ar {
|
|
|
3229
3229
|
this.organizationId = l.accountId, Se({
|
|
3230
3230
|
organizationId: this.organizationId
|
|
3231
3231
|
});
|
|
3232
|
-
const
|
|
3233
|
-
if (
|
|
3232
|
+
const m = (a = l.type) === null || a === void 0 ? void 0 : a.toLowerCase();
|
|
3233
|
+
if (m === "legacy")
|
|
3234
3234
|
return "Legacy session tokens are no longer supported. Please define your persona when creating your session token. See https://docs.anam.ai/resources/migrating-legacy for more information.";
|
|
3235
|
-
if ((
|
|
3235
|
+
if ((m === "ephemeral" || m === "stateful") && n)
|
|
3236
3236
|
return "This session token already contains a persona configuration. Please remove the personaConfig parameter.";
|
|
3237
3237
|
} else if (!n)
|
|
3238
3238
|
return "Missing persona config. Persona configuration must be provided when using apiKey";
|
|
@@ -3255,8 +3255,8 @@ class ar {
|
|
|
3255
3255
|
}
|
|
3256
3256
|
startSession(e) {
|
|
3257
3257
|
return ue(this, void 0, void 0, function* () {
|
|
3258
|
-
var n, o, c, a, u, l,
|
|
3259
|
-
const y = this.personaConfig,
|
|
3258
|
+
var n, o, c, a, u, l, m, p, _, d, S, g;
|
|
3259
|
+
const y = this.personaConfig, A = this.buildStartSessionOptionsForClient(), b = yield this.apiClient.startSession(y, A), { sessionId: w, clientConfig: I, engineHost: R, engineProtocol: U, signallingEndpoint: x } = b, { heartbeatIntervalSeconds: Z, maxWsReconnectionAttempts: H, iceServers: ae } = I;
|
|
3260
3260
|
this.sessionId = w, Se({
|
|
3261
3261
|
sessionId: this.sessionId
|
|
3262
3262
|
});
|
|
@@ -3264,14 +3264,14 @@ class ar {
|
|
|
3264
3264
|
try {
|
|
3265
3265
|
this.streamingClient = new rr(w, {
|
|
3266
3266
|
engine: {
|
|
3267
|
-
baseUrl: `${
|
|
3267
|
+
baseUrl: `${U}://${R}`
|
|
3268
3268
|
},
|
|
3269
3269
|
signalling: {
|
|
3270
3270
|
heartbeatIntervalSeconds: Z,
|
|
3271
3271
|
maxWsReconnectionAttempts: H,
|
|
3272
3272
|
url: {
|
|
3273
3273
|
baseUrl: R,
|
|
3274
|
-
protocol:
|
|
3274
|
+
protocol: U,
|
|
3275
3275
|
signallingPath: x
|
|
3276
3276
|
}
|
|
3277
3277
|
},
|
|
@@ -3284,8 +3284,8 @@ class ar {
|
|
|
3284
3284
|
},
|
|
3285
3285
|
apiGateway: (l = (u = this.clientOptions) === null || u === void 0 ? void 0 : u.api) === null || l === void 0 ? void 0 : l.apiGateway,
|
|
3286
3286
|
metrics: {
|
|
3287
|
-
showPeerConnectionStatsReport: (_ = (p = (
|
|
3288
|
-
peerConnectionStatsReportOutputFormat: (
|
|
3287
|
+
showPeerConnectionStatsReport: (_ = (p = (m = this.clientOptions) === null || m === void 0 ? void 0 : m.metrics) === null || p === void 0 ? void 0 : p.showPeerConnectionStatsReport) !== null && _ !== void 0 ? _ : !1,
|
|
3288
|
+
peerConnectionStatsReportOutputFormat: (g = (S = (d = this.clientOptions) === null || d === void 0 ? void 0 : d.metrics) === null || S === void 0 ? void 0 : S.peerConnectionStatsReportOutputFormat) !== null && g !== void 0 ? g : "console"
|
|
3289
3289
|
}
|
|
3290
3290
|
}, this.publicEventEmitter, this.internalEventEmitter);
|
|
3291
3291
|
} catch (re) {
|
|
@@ -3320,11 +3320,11 @@ class ar {
|
|
|
3320
3320
|
}), me(se.CLIENT_METRIC_MEASUREMENT_SESSION_ATTEMPT, "1"), !((n = this.clientOptions) === null || n === void 0) && n.disableInputAudio && e && console.warn("AnamClient:Input audio is disabled. User provided audio stream will be ignored."), yield this.startSessionIfNeeded(e), this._isStreaming = !0, new Promise((c) => {
|
|
3321
3321
|
var a;
|
|
3322
3322
|
const u = [];
|
|
3323
|
-
let l = !1,
|
|
3323
|
+
let l = !1, m = !1;
|
|
3324
3324
|
this.publicEventEmitter.addListener(N.VIDEO_STREAM_STARTED, (p) => {
|
|
3325
|
-
u.push(p), l = !0,
|
|
3325
|
+
u.push(p), l = !0, m && c(u);
|
|
3326
3326
|
}), this.publicEventEmitter.addListener(N.AUDIO_STREAM_STARTED, (p) => {
|
|
3327
|
-
u.push(p),
|
|
3327
|
+
u.push(p), m = !0, l && c(u);
|
|
3328
3328
|
}), (a = this.streamingClient) === null || a === void 0 || a.startConnection();
|
|
3329
3329
|
});
|
|
3330
3330
|
});
|
|
@@ -3486,7 +3486,7 @@ class ar {
|
|
|
3486
3486
|
return this.sessionId;
|
|
3487
3487
|
}
|
|
3488
3488
|
}
|
|
3489
|
-
const lr = (t, e) => new ar(t, void 0, e), cr = "https://api.anam.ai", X = Y(null), te = Y("idle"), Le = Y(!1),
|
|
3489
|
+
const lr = (t, e) => new ar(t, void 0, e), cr = "https://api.anam.ai", X = Y(null), te = Y("idle"), Le = Y(!1), Ke = Y(!1), at = Y([]), Pe = Y(null), nt = Y(null), Ot = Y(null), kt = Y(null), Dt = Y(null), ci = Y(!1), Fe = Y(!1);
|
|
3490
3490
|
function ur(t, e) {
|
|
3491
3491
|
return e === 401 || e === 403 ? "This agent is not authorized. Check your agent ID." : e === 404 ? "Agent not found. Check your agent ID." : e === 429 ? "Too many requests. Please wait a moment." : e && e >= 500 ? "Server error. Please try again later." : t instanceof TypeError && t.message === "Failed to fetch" ? "Unable to connect. Check your network connection." : t instanceof Error && t.message.length < 80 ? t.message : "Something went wrong. Please try again.";
|
|
3492
3492
|
}
|
|
@@ -3496,34 +3496,38 @@ async function dr(t, e) {
|
|
|
3496
3496
|
const n = await fetch(`${e}/v1/personas/${t}/widget`);
|
|
3497
3497
|
if (!n.ok) return;
|
|
3498
3498
|
const o = await n.json();
|
|
3499
|
-
|
|
3499
|
+
Ot.value = o.persona?.avatarImageUrl || null, kt.value = o.persona?.name || null, Dt.value = o.widgetConfig || null;
|
|
3500
3500
|
} catch {
|
|
3501
3501
|
} finally {
|
|
3502
3502
|
Fe.value = !0;
|
|
3503
3503
|
}
|
|
3504
3504
|
}
|
|
3505
|
-
async function hr(t, e, n) {
|
|
3505
|
+
async function hr(t, e, n, o) {
|
|
3506
3506
|
if (te.value === "connecting" || te.value === "connected")
|
|
3507
3507
|
return;
|
|
3508
3508
|
te.value = "connecting", Pe.value = null;
|
|
3509
|
-
let
|
|
3509
|
+
let c;
|
|
3510
3510
|
try {
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3511
|
+
let a;
|
|
3512
|
+
if (o)
|
|
3513
|
+
console.log("[AnamWidget] Using pre-created session token"), a = o;
|
|
3514
|
+
else {
|
|
3515
|
+
console.log("[AnamWidget] Fetching session for agent:", t);
|
|
3516
|
+
const m = await fetch(`${e}/v1/auth/widget`, {
|
|
3517
|
+
method: "POST",
|
|
3518
|
+
headers: { "Content-Type": "application/json" },
|
|
3519
|
+
body: JSON.stringify({ agentId: t })
|
|
3520
|
+
});
|
|
3521
|
+
if (c = m.status, !m.ok) {
|
|
3522
|
+
const _ = await m.json().catch(() => ({}));
|
|
3523
|
+
throw new Error(_.error || `HTTP ${m.status}`);
|
|
3524
|
+
}
|
|
3525
|
+
const p = await m.json();
|
|
3526
|
+
console.log("[AnamWidget] Got session from agent-id:", {
|
|
3527
|
+
hasToken: !!p.sessionToken
|
|
3528
|
+
}), a = p.sessionToken;
|
|
3529
|
+
}
|
|
3530
|
+
const u = lr(a, {
|
|
3527
3531
|
api: e ? { baseUrl: e } : void 0,
|
|
3528
3532
|
metrics: { disableClientMetrics: !0 }
|
|
3529
3533
|
});
|
|
@@ -3533,20 +3537,20 @@ async function hr(t, e, n) {
|
|
|
3533
3537
|
console.log("[AnamWidget] Video stream started"), Le.value = !0;
|
|
3534
3538
|
}), u.addListener(N.AUDIO_STREAM_STARTED, () => {
|
|
3535
3539
|
console.log("[AnamWidget] Audio stream started");
|
|
3536
|
-
}), u.addListener(N.MESSAGE_HISTORY_UPDATED, (
|
|
3537
|
-
at.value = [...
|
|
3538
|
-
}), u.addListener(N.CONNECTION_CLOSED, (
|
|
3539
|
-
console.log("[AnamWidget] Connection closed:",
|
|
3540
|
-
}), u.addListener(N.SESSION_READY, (
|
|
3541
|
-
console.log("[AnamWidget] Session ready:",
|
|
3540
|
+
}), u.addListener(N.MESSAGE_HISTORY_UPDATED, (m) => {
|
|
3541
|
+
at.value = [...m];
|
|
3542
|
+
}), u.addListener(N.CONNECTION_CLOSED, (m, p) => {
|
|
3543
|
+
console.log("[AnamWidget] Connection closed:", m, p), te.value = "idle", Le.value = !1, nt.value = null;
|
|
3544
|
+
}), u.addListener(N.SESSION_READY, (m) => {
|
|
3545
|
+
console.log("[AnamWidget] Session ready:", m), nt.value = m;
|
|
3542
3546
|
}), X.value = u;
|
|
3543
3547
|
const l = await u.stream();
|
|
3544
3548
|
if (n && l.length > 0) {
|
|
3545
|
-
const
|
|
3546
|
-
|
|
3549
|
+
const m = l.find((p) => p.getVideoTracks().length > 0);
|
|
3550
|
+
m && (n.srcObject = m);
|
|
3547
3551
|
}
|
|
3548
|
-
} catch (
|
|
3549
|
-
console.error("[AnamWidget] Failed to start session:",
|
|
3552
|
+
} catch (a) {
|
|
3553
|
+
console.error("[AnamWidget] Failed to start session:", a), Pe.value = ur(a, c), te.value = "error", X.value = null;
|
|
3550
3554
|
}
|
|
3551
3555
|
}
|
|
3552
3556
|
async function fr() {
|
|
@@ -3562,38 +3566,38 @@ function pr(t) {
|
|
|
3562
3566
|
!X.value || te.value !== "connected" || X.value.sendUserMessage(t);
|
|
3563
3567
|
}
|
|
3564
3568
|
function _r() {
|
|
3565
|
-
X.value && (
|
|
3569
|
+
X.value && (Ke.value ? (X.value.unmuteInputAudio(), Ke.value = !1) : (X.value.muteInputAudio(), Ke.value = !0));
|
|
3566
3570
|
}
|
|
3567
3571
|
function Er() {
|
|
3568
3572
|
Fe.value = !0;
|
|
3569
3573
|
}
|
|
3570
3574
|
function mr() {
|
|
3571
|
-
X.value?.isStreaming() && X.value.stopStreaming(), X.value = null, te.value = "idle", Le.value = !1, at.value = [], Pe.value = null, nt.value = null,
|
|
3575
|
+
X.value?.isStreaming() && X.value.stopStreaming(), X.value = null, te.value = "idle", Le.value = !1, at.value = [], Pe.value = null, nt.value = null, Ot.value = null, kt.value = null, Dt.value = null;
|
|
3572
3576
|
}
|
|
3573
|
-
function gr(t, e) {
|
|
3577
|
+
function gr(t, e, n) {
|
|
3574
3578
|
ci.value = !!t;
|
|
3575
|
-
const
|
|
3579
|
+
const o = e || cr;
|
|
3576
3580
|
return {
|
|
3577
3581
|
connectionStatus: te,
|
|
3578
3582
|
isStreaming: Le,
|
|
3579
|
-
isMuted:
|
|
3583
|
+
isMuted: Ke,
|
|
3580
3584
|
messages: at,
|
|
3581
3585
|
error: Pe,
|
|
3582
3586
|
sessionId: nt,
|
|
3583
3587
|
hasAgentId: ci,
|
|
3584
3588
|
isReady: Fe,
|
|
3585
|
-
avatarThumbnailUrl:
|
|
3586
|
-
personaName:
|
|
3589
|
+
avatarThumbnailUrl: Ot,
|
|
3590
|
+
personaName: kt,
|
|
3587
3591
|
serverConfig: Dt,
|
|
3588
3592
|
fetchWidgetConfig: () => {
|
|
3589
3593
|
if (!t) {
|
|
3590
3594
|
Fe.value = !0;
|
|
3591
3595
|
return;
|
|
3592
3596
|
}
|
|
3593
|
-
dr(t,
|
|
3597
|
+
dr(t, o);
|
|
3594
3598
|
},
|
|
3595
3599
|
skipFetch: Er,
|
|
3596
|
-
startSession: (
|
|
3600
|
+
startSession: (u) => !t && !n ? (Pe.value = "No agent ID configured", Promise.resolve()) : hr(t || "", o, u, n),
|
|
3597
3601
|
stopSession: fr,
|
|
3598
3602
|
sendMessage: pr,
|
|
3599
3603
|
toggleMute: _r,
|
|
@@ -3601,11 +3605,11 @@ function gr(t, e) {
|
|
|
3601
3605
|
};
|
|
3602
3606
|
}
|
|
3603
3607
|
const ui = '@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-outline-style:solid}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.visible{visibility:visible}.fixed{position:fixed}.block{display:block}.flex{display:flex}.inline{display:inline}.flex-shrink{flex-shrink:1}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.border{border-style:var(--tw-border-style);border-width:1px}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}}:host{--anam-background:#fff;--anam-text:#18181b;--anam-trigger-size:80px;--anam-sheet-width:400px;--anam-sheet-height:640px;all:initial;color:var(--anam-text);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:DM Sans,system-ui,-apple-system,sans-serif;font-size:15px;line-height:1.5}@media(max-width:640px){:host{--anam-trigger-size:72px;--anam-sheet-width: calc(100vw - 24px) ;--anam-sheet-height: calc(100dvh - 100px) }}.anam-widget{z-index:9999;font-family:inherit}.anam-widget[data-layout=fixed]{position:fixed}.anam-widget[data-layout=inline]{position:relative}.anam-trigger{width:var(--anam-trigger-size);height:var(--anam-trigger-size);cursor:pointer;background:0 0;border:none;border-radius:50%;justify-content:center;align-items:center;padding:0;transition:all .25s cubic-bezier(.4,0,.2,1);display:flex;overflow:hidden;box-shadow:0 2px 8px #00000014,0 8px 24px -4px #0000002e}.anam-trigger:hover{transform:scale(1.06);box-shadow:0 4px 12px #0000001a,0 12px 32px -4px #00000040}.anam-trigger:active{transform:scale(.97)}.anam-trigger img{object-fit:cover;width:100%;height:100%;display:block}.anam-sheet{width:var(--anam-sheet-width);aspect-ratio:16/10;max-height:var(--anam-sheet-height);border-radius:16px;animation:.25s cubic-bezier(.16,1,.3,1) sheetIn;position:relative;overflow:hidden;box-shadow:0 32px 64px -16px #00000040,0 0 0 1px #00000014}.anam-widget[data-mode=expanded][data-layout=inline] .anam-sheet{aspect-ratio:3/2;border-radius:16px;width:100%;max-height:none;animation:none}@keyframes sheetIn{0%{opacity:0;transform:translateY(8px)scale(.97)}to{opacity:1;transform:translateY(0)scale(1)}}.anam-video{object-fit:cover;background:#000;width:100%;height:100%;display:block;position:absolute;inset:0}.anam-video[data-hidden=true]{visibility:hidden}.anam-overlay-idle{z-index:2;position:absolute;inset:0}.anam-overlay-idle img{object-fit:cover;width:100%;height:100%;display:block}.anam-cta-pill{-webkit-backdrop-filter:blur(16px);color:#fff;letter-spacing:-.01em;cursor:pointer;white-space:nowrap;background:#00000080;border:1px solid #ffffff1a;border-radius:999px;align-items:center;gap:10px;padding:12px 28px;font-family:inherit;font-size:15px;font-weight:500;transition:all .2s;display:flex;position:absolute;bottom:40px;left:50%;transform:translate(-50%)}.anam-cta-pill:hover{background:#000000a6;transform:translate(-50%)scale(1.03)}.anam-cta-pill:active{transform:translate(-50%)scale(.98)}.anam-cta-pill svg{flex-shrink:0}.anam-overlay-unconfigured{z-index:2;background:#111;flex-direction:column;justify-content:center;align-items:center;gap:16px;display:flex;position:absolute;inset:0}.anam-overlay-unconfigured span{color:#ffffff59;letter-spacing:-.01em;font-size:14px;font-weight:400}.anam-overlay-loading{z-index:3;background:#000;flex-direction:column;justify-content:center;align-items:center;gap:20px;display:flex;position:absolute;inset:0}.anam-overlay-loading span{color:#fffc;letter-spacing:-.01em;font-size:15px;font-weight:400}.anam-overlay-error{z-index:3;background:#000;flex-direction:column;justify-content:center;align-items:center;gap:16px;display:flex;position:absolute;inset:0}.anam-overlay-error-text{color:#fff9;text-align:center;max-width:260px;font-size:14px;line-height:1.5}.anam-overlay-error .anam-retry-btn{-webkit-backdrop-filter:blur(8px);color:#fff;cursor:pointer;background:#ffffff1f;border:1px solid #ffffff1a;border-radius:999px;padding:10px 24px;font-family:inherit;font-size:14px;font-weight:500;transition:background .15s}.anam-overlay-error .anam-retry-btn:hover{background:#fff3}.anam-spinner{border:2.5px solid #ffffff1f;border-top-color:#fff;border-radius:50%;width:32px;height:32px;animation:.75s linear infinite spin}@keyframes spin{to{transform:rotate(360deg)}}.anam-close-btn{z-index:10;-webkit-backdrop-filter:blur(8px);color:#fff;cursor:pointer;background:#00000073;border:1px solid #ffffff14;border-radius:50%;justify-content:center;align-items:center;width:32px;height:32px;padding:0;transition:background .15s;display:flex;position:absolute;top:12px;right:12px}.anam-close-btn:hover{background:#0009}.anam-toast{z-index:10;-webkit-backdrop-filter:blur(16px);color:#fff;letter-spacing:-.01em;white-space:nowrap;text-overflow:ellipsis;pointer-events:none;background:#0009;border:1px solid #ffffff0f;border-radius:999px;max-width:85%;padding:10px 22px;font-size:14px;font-weight:400;animation:.25s cubic-bezier(.16,1,.3,1) toastIn;position:absolute;bottom:80px;left:50%;overflow:hidden;transform:translate(-50%)}.anam-toast-out{animation:.4s forwards toastOut}@keyframes toastIn{0%{opacity:0;transform:translate(-50%)translateY(6px)}to{opacity:1;transform:translate(-50%)translateY(0)}}@keyframes toastOut{0%{opacity:1}to{opacity:0}}.anam-control-bar{z-index:10;background:linear-gradient(#0000,#00000040 40%,#0000008c);align-items:center;gap:8px;padding:48px 16px 16px;display:flex;position:absolute;bottom:0;left:0;right:0}.anam-ctl-btn{-webkit-backdrop-filter:blur(8px);color:#fff;cursor:pointer;background:#ffffff24;border:1px solid #ffffff0f;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;width:44px;height:44px;padding:0;transition:background .15s;display:flex}.anam-ctl-btn:hover{background:#ffffff38}.anam-ctl-btn:disabled{opacity:.35;cursor:not-allowed}.anam-ctl-btn-muted{background:#dc26268c;border-color:#dc262633}.anam-ctl-btn-muted:hover{background:#dc2626b3}.anam-ctl-end{background:#dc262699;border-color:#dc262626}.anam-ctl-end:hover{background:#dc2626cc}.anam-ctl-input{-webkit-backdrop-filter:blur(8px);color:#fff;background:#ffffff1a;border:1px solid #ffffff14;border-radius:999px;outline:none;flex:1;min-width:0;padding:11px 18px;font-family:inherit;font-size:14px;transition:background .15s,border-color .15s}.anam-ctl-input::placeholder{color:#fff6}.anam-ctl-input:focus{background:#ffffff26;border-color:#ffffff2e}.anam-ctl-input:disabled{opacity:.35;cursor:not-allowed}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}';
|
|
3604
|
-
function
|
|
3608
|
+
function wt(t, e) {
|
|
3605
3609
|
const n = { ...t };
|
|
3606
3610
|
for (const o of Object.keys(e)) {
|
|
3607
3611
|
const c = e[o];
|
|
3608
|
-
c !== void 0 && (c !== null && typeof c == "object" && !Array.isArray(c) && typeof n[o] == "object" && n[o] !== null && !Array.isArray(n[o]) ? n[o] =
|
|
3612
|
+
c !== void 0 && (c !== null && typeof c == "object" && !Array.isArray(c) && typeof n[o] == "object" && n[o] !== null && !Array.isArray(n[o]) ? n[o] = wt(n[o], c) : n[o] = c);
|
|
3609
3613
|
}
|
|
3610
3614
|
return n;
|
|
3611
3615
|
}
|
|
@@ -3624,7 +3628,7 @@ const vr = () => /* @__PURE__ */ C("svg", { width: "16", height: "16", viewBox:
|
|
|
3624
3628
|
] }), Ir = () => /* @__PURE__ */ C("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
|
|
3625
3629
|
/* @__PURE__ */ C("path", { d: "M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 2.59 3.4z" }),
|
|
3626
3630
|
/* @__PURE__ */ C("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
3627
|
-
] }),
|
|
3631
|
+
] }), Ct = () => /* @__PURE__ */ C("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", style: { opacity: 0.3 }, children: [
|
|
3628
3632
|
/* @__PURE__ */ C("circle", { cx: "24", cy: "18", r: "8", stroke: "white", "stroke-width": "2", fill: "none" }),
|
|
3629
3633
|
/* @__PURE__ */ C("path", { d: "M8 42c0-8.837 7.163-16 16-16s16 7.163 16 16", stroke: "white", "stroke-width": "2", fill: "none" })
|
|
3630
3634
|
] });
|
|
@@ -3636,23 +3640,23 @@ function br({
|
|
|
3636
3640
|
displayCta: c,
|
|
3637
3641
|
onCollapse: a
|
|
3638
3642
|
}) {
|
|
3639
|
-
const u = Qe(null), [l,
|
|
3643
|
+
const u = Qe(null), [l, m] = Ye(""), [p, _] = Ye(null), [d, S] = Ye(!1), g = Qe(null), y = e.connectionStatus.value === "connected", A = e.connectionStatus.value === "connecting", b = e.connectionStatus.value === "error", w = e.isStreaming.value, I = !A && !y && !b, R = He(async () => {
|
|
3640
3644
|
n.current && await e.startSession(n.current);
|
|
3641
|
-
}, []),
|
|
3645
|
+
}, []), U = He(async () => {
|
|
3642
3646
|
await e.stopSession();
|
|
3643
3647
|
}, []), x = He(() => {
|
|
3644
3648
|
if (!l.trim()) return;
|
|
3645
3649
|
const H = l.trim();
|
|
3646
|
-
e.sendMessage(H),
|
|
3647
|
-
S(!0),
|
|
3650
|
+
e.sendMessage(H), m(""), u.current?.focus(), g.current && clearTimeout(g.current), S(!1), _(H), g.current = window.setTimeout(() => {
|
|
3651
|
+
S(!0), g.current = window.setTimeout(() => {
|
|
3648
3652
|
_(null), S(!1);
|
|
3649
3653
|
}, 400);
|
|
3650
3654
|
}, 2600);
|
|
3651
3655
|
}, [l]), Z = He((H) => {
|
|
3652
3656
|
H.key === "Enter" && !H.shiftKey && (H.preventDefault(), x());
|
|
3653
3657
|
}, [x]);
|
|
3654
|
-
return
|
|
3655
|
-
|
|
3658
|
+
return gt(() => () => {
|
|
3659
|
+
g.current && clearTimeout(g.current);
|
|
3656
3660
|
}, []), /* @__PURE__ */ C("div", { class: "anam-sheet", children: [
|
|
3657
3661
|
/* @__PURE__ */ C(
|
|
3658
3662
|
"video",
|
|
@@ -3667,7 +3671,7 @@ function br({
|
|
|
3667
3671
|
I && (e.hasAgentId.value ? (
|
|
3668
3672
|
/* Has agent-id: show avatar or placeholder + CTA pill */
|
|
3669
3673
|
/* @__PURE__ */ C("div", { class: "anam-overlay-idle", children: [
|
|
3670
|
-
o ? /* @__PURE__ */ C("img", { src: o, alt: "Avatar" }) : /* @__PURE__ */ C(
|
|
3674
|
+
o ? /* @__PURE__ */ C("img", { src: o, alt: "Avatar" }) : /* @__PURE__ */ C(Ct, {}),
|
|
3671
3675
|
/* @__PURE__ */ C("button", { class: "anam-cta-pill", onClick: R, children: [
|
|
3672
3676
|
/* @__PURE__ */ C(yr, {}),
|
|
3673
3677
|
c
|
|
@@ -3676,15 +3680,15 @@ function br({
|
|
|
3676
3680
|
) : (
|
|
3677
3681
|
/* No agent-id: unconfigured overlay */
|
|
3678
3682
|
/* @__PURE__ */ C("div", { class: "anam-overlay-unconfigured", children: [
|
|
3679
|
-
/* @__PURE__ */ C(
|
|
3683
|
+
/* @__PURE__ */ C(Ct, {}),
|
|
3680
3684
|
/* @__PURE__ */ C("span", { children: "Agent not configured" })
|
|
3681
3685
|
] })
|
|
3682
3686
|
)),
|
|
3683
|
-
|
|
3687
|
+
A && /* @__PURE__ */ C("div", { class: "anam-overlay-loading", children: [
|
|
3684
3688
|
/* @__PURE__ */ C("span", { class: "anam-spinner" }),
|
|
3685
3689
|
/* @__PURE__ */ C("span", { children: "Starting your conversation..." })
|
|
3686
3690
|
] }),
|
|
3687
|
-
|
|
3691
|
+
b && /* @__PURE__ */ C("div", { class: "anam-overlay-error", children: [
|
|
3688
3692
|
/* @__PURE__ */ C("div", { class: "anam-overlay-error-text", children: e.error.value || "Something went wrong" }),
|
|
3689
3693
|
/* @__PURE__ */ C("button", { class: "anam-retry-btn", onClick: R, children: "Try Again" })
|
|
3690
3694
|
] }),
|
|
@@ -3710,7 +3714,7 @@ function br({
|
|
|
3710
3714
|
class: "anam-ctl-input",
|
|
3711
3715
|
placeholder: t.textContents.placeholder,
|
|
3712
3716
|
value: l,
|
|
3713
|
-
onInput: (H) =>
|
|
3717
|
+
onInput: (H) => m(H.target.value),
|
|
3714
3718
|
onKeyDown: Z,
|
|
3715
3719
|
disabled: !y
|
|
3716
3720
|
}
|
|
@@ -3730,7 +3734,7 @@ function br({
|
|
|
3730
3734
|
"button",
|
|
3731
3735
|
{
|
|
3732
3736
|
class: "anam-ctl-btn anam-ctl-end",
|
|
3733
|
-
onClick:
|
|
3737
|
+
onClick: U,
|
|
3734
3738
|
"aria-label": "End call",
|
|
3735
3739
|
children: /* @__PURE__ */ C(Ir, {})
|
|
3736
3740
|
}
|
|
@@ -3740,19 +3744,24 @@ function br({
|
|
|
3740
3744
|
] });
|
|
3741
3745
|
}
|
|
3742
3746
|
function Ar(t) {
|
|
3743
|
-
const e = Qe(null), n = Gi(!1), o = gr(t["agent-id"], t["api-base-url"]), c = Ie(() => {
|
|
3747
|
+
const e = Qe(null), n = Gi(!1), o = gr(t["agent-id"], t["api-base-url"], t["session-token"]), c = Ie(() => {
|
|
3744
3748
|
if (t["override-config"])
|
|
3745
3749
|
try {
|
|
3746
|
-
const I = JSON.parse(t["override-config"]), R =
|
|
3750
|
+
const I = JSON.parse(t["override-config"]), R = wt({ ...We }, I);
|
|
3747
3751
|
return R.mode === "orb" && (R.layout = "fixed"), R;
|
|
3748
3752
|
} catch (I) {
|
|
3749
3753
|
console.warn("[AnamWidget] Invalid override-config JSON:", I);
|
|
3750
3754
|
}
|
|
3751
|
-
const
|
|
3755
|
+
const b = o.serverConfig.value, w = b ? wt({ ...We }, b) : { ...We };
|
|
3752
3756
|
return w.mode === "orb" && (w.layout = "fixed"), w;
|
|
3753
3757
|
}, [t["override-config"], o.serverConfig.value]);
|
|
3754
|
-
|
|
3758
|
+
gt(() => {
|
|
3755
3759
|
if (t["override-config"]) {
|
|
3760
|
+
try {
|
|
3761
|
+
const b = JSON.parse(t["override-config"]);
|
|
3762
|
+
b.avatarImageUrl && (o.avatarThumbnailUrl.value = b.avatarImageUrl), b.personaName && (o.personaName.value = b.personaName);
|
|
3763
|
+
} catch {
|
|
3764
|
+
}
|
|
3756
3765
|
o.skipFetch();
|
|
3757
3766
|
return;
|
|
3758
3767
|
}
|
|
@@ -3761,21 +3770,21 @@ function Ar(t) {
|
|
|
3761
3770
|
const a = o.avatarThumbnailUrl.value || null, u = c.textContents.callToAction === We.textContents.callToAction && o.personaName.value ? `Talk to ${o.personaName.value}` : c.textContents.callToAction, l = Ie(
|
|
3762
3771
|
() => `--anam-background: ${c.styles.backgroundColor}; --anam-text: ${c.styles.textColor};`,
|
|
3763
3772
|
[c.styles.backgroundColor, c.styles.textColor]
|
|
3764
|
-
),
|
|
3773
|
+
), m = Ie(() => {
|
|
3765
3774
|
if (c.layout !== "fixed") return "";
|
|
3766
|
-
const
|
|
3767
|
-
return Object.entries(
|
|
3768
|
-
}, [c.layout, c.position]), p = [l,
|
|
3775
|
+
const b = xn(c.position);
|
|
3776
|
+
return Object.entries(b).map(([w, I]) => `${w}: ${I}`).join("; ");
|
|
3777
|
+
}, [c.layout, c.position]), p = [l, m].filter(Boolean).join("; "), _ = Qe(!1), d = () => {
|
|
3769
3778
|
n.value = !0, _.current = !1, setTimeout(() => {
|
|
3770
3779
|
e.current && o.startSession(e.current);
|
|
3771
3780
|
}, 50);
|
|
3772
3781
|
}, S = async () => {
|
|
3773
3782
|
o.connectionStatus.value !== "idle" && await o.stopSession(), _.current = !1, n.value = !1;
|
|
3774
|
-
},
|
|
3775
|
-
(y === "connecting" || y === "connected") && (_.current = !0),
|
|
3776
|
-
|
|
3783
|
+
}, g = c.mode === "orb", y = o.connectionStatus.value;
|
|
3784
|
+
(y === "connecting" || y === "connected") && (_.current = !0), gt(() => {
|
|
3785
|
+
g && n.value && y === "idle" && _.current && (_.current = !1, n.value = !1);
|
|
3777
3786
|
}, [y]);
|
|
3778
|
-
const
|
|
3787
|
+
const A = g ? n.value : !0;
|
|
3779
3788
|
return o.isReady.value ? /* @__PURE__ */ C(oe, { children: [
|
|
3780
3789
|
/* @__PURE__ */ C("style", { children: ui }),
|
|
3781
3790
|
/* @__PURE__ */ C(
|
|
@@ -3786,16 +3795,16 @@ function Ar(t) {
|
|
|
3786
3795
|
"data-layout": c.layout,
|
|
3787
3796
|
style: p,
|
|
3788
3797
|
children: [
|
|
3789
|
-
|
|
3798
|
+
g && !n.value && /* @__PURE__ */ C(
|
|
3790
3799
|
"button",
|
|
3791
3800
|
{
|
|
3792
3801
|
class: "anam-trigger",
|
|
3793
3802
|
onClick: d,
|
|
3794
3803
|
"aria-label": u,
|
|
3795
|
-
children: a ? /* @__PURE__ */ C("img", { src: a, alt: "Avatar" }) : /* @__PURE__ */ C(
|
|
3804
|
+
children: a ? /* @__PURE__ */ C("img", { src: a, alt: "Avatar" }) : /* @__PURE__ */ C(Ct, {})
|
|
3796
3805
|
}
|
|
3797
3806
|
),
|
|
3798
|
-
|
|
3807
|
+
A && /* @__PURE__ */ C(
|
|
3799
3808
|
br,
|
|
3800
3809
|
{
|
|
3801
3810
|
config: c,
|
|
@@ -3803,7 +3812,7 @@ function Ar(t) {
|
|
|
3803
3812
|
videoRef: e,
|
|
3804
3813
|
avatarSrc: a,
|
|
3805
3814
|
displayCta: u,
|
|
3806
|
-
onCollapse:
|
|
3815
|
+
onCollapse: g ? S : null
|
|
3807
3816
|
}
|
|
3808
3817
|
)
|
|
3809
3818
|
]
|
|
@@ -3816,8 +3825,10 @@ const Tr = [
|
|
|
3816
3825
|
// Persona ID — required for session streaming + server config fetch
|
|
3817
3826
|
"api-base-url",
|
|
3818
3827
|
// API URL override (default: https://api.anam.ai)
|
|
3819
|
-
"override-config"
|
|
3828
|
+
"override-config",
|
|
3820
3829
|
// JSON string — bypasses server fetch when set
|
|
3830
|
+
"session-token"
|
|
3831
|
+
// Pre-created session token — skips /v1/auth/widget call when set
|
|
3821
3832
|
], Nr = {
|
|
3822
3833
|
SESSION_STARTED: "anam-agent:session-started",
|
|
3823
3834
|
SESSION_ENDED: "anam-agent:session-ended",
|