@anam-ai/agent-widget 0.1.0-alpha.10 → 0.1.0-alpha.12
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 +817 -847
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Fe,
|
|
1
|
+
var Fe, k, fi, pi, Ee, Ht, _i, Ei, mi, It, _t, Et, Ue = {}, gi = [], ln = /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;
|
|
@@ -6,15 +6,15 @@ function ie(t, e) {
|
|
|
6
6
|
function bt(t) {
|
|
7
7
|
t && t.parentNode && t.parentNode.removeChild(t);
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
var o,
|
|
11
|
-
for (a in e) a == "key" ? o = e[a] : a == "ref" ?
|
|
12
|
-
if (arguments.length > 2 && (
|
|
13
|
-
return xe(t,
|
|
9
|
+
function Ce(t, e, n) {
|
|
10
|
+
var o, c, a, u = {};
|
|
11
|
+
for (a in e) a == "key" ? o = e[a] : a == "ref" ? c = e[a] : u[a] = e[a];
|
|
12
|
+
if (arguments.length > 2 && (u.children = arguments.length > 3 ? Fe.call(arguments, 2) : n), typeof t == "function" && t.defaultProps != null) for (a in t.defaultProps) u[a] === void 0 && (u[a] = t.defaultProps[a]);
|
|
13
|
+
return xe(t, u, o, c, null);
|
|
14
14
|
}
|
|
15
|
-
function xe(t, e, n, o,
|
|
16
|
-
var a = { type: t, props: e, key: n, ref: o, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v:
|
|
17
|
-
return
|
|
15
|
+
function xe(t, e, n, o, c) {
|
|
16
|
+
var a = { type: t, props: e, key: n, ref: o, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: c ?? ++fi, __i: -1, __u: 0 };
|
|
17
|
+
return c == null && k.vnode != null && k.vnode(a), a;
|
|
18
18
|
}
|
|
19
19
|
function oe(t) {
|
|
20
20
|
return t.children;
|
|
@@ -38,27 +38,27 @@ function vi(t) {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
function Wt(t) {
|
|
41
|
-
(!t.__d && (t.__d = !0) && Ee.push(t) && !Je.__r++ || Ht !=
|
|
41
|
+
(!t.__d && (t.__d = !0) && Ee.push(t) && !Je.__r++ || Ht != k.debounceRendering) && ((Ht = k.debounceRendering) || _i)(Je);
|
|
42
42
|
}
|
|
43
43
|
function Je() {
|
|
44
|
-
for (var t, e, n, o,
|
|
44
|
+
for (var t, e, n, o, c, a, u, l = 1; Ee.length; ) Ee.length > l && Ee.sort(Ei), 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, wi(a, n, u), o.__e = o.__ = null, n.__e != c && vi(n)));
|
|
45
45
|
Je.__r = 0;
|
|
46
46
|
}
|
|
47
|
-
function yi(t, e, n, o,
|
|
48
|
-
var d,
|
|
49
|
-
for (m = cn(n, e,
|
|
50
|
-
return n.__e =
|
|
47
|
+
function yi(t, e, n, o, c, a, u, l, m, p, _) {
|
|
48
|
+
var d, y, g, S, C, A, I, b = o && o.__k || gi, T = e.length;
|
|
49
|
+
for (m = cn(n, e, b, m, T), d = 0; d < T; d++) (g = n.__k[d]) != null && (y = g.__i == -1 ? Ue : b[g.__i] || Ue, g.__i = d, A = At(t, g, y, c, a, u, l, m, p, _), S = g.__e, g.ref && y.ref != g.ref && (y.ref && Tt(y.ref, null, g), _.push(g.ref, g.__c || S, g)), C == null && S != null && (C = S), (I = !!(4 & g.__u)) || y.__k === g.__k ? m = Si(g, m, t, I) : typeof g.type == "function" && A !== void 0 ? m = A : S && (m = S.nextSibling), g.__u &= -7);
|
|
50
|
+
return n.__e = C, m;
|
|
51
51
|
}
|
|
52
|
-
function cn(t, e, n, o,
|
|
53
|
-
var a,
|
|
54
|
-
for (t.__k = new Array(
|
|
52
|
+
function cn(t, e, n, o, c) {
|
|
53
|
+
var a, u, l, m, p, _ = n.length, d = _, y = 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 + y, u.__ = t, u.__b = t.__b + 1, l = null, (p = u.__i = un(u, n, m, d)) != -1 && (d--, (l = n[p]) && (l.__u |= 2)), l == null || l.__v == null ? (p == -1 && (c > _ ? y-- : c < _ && y++), typeof u.type != "function" && (u.__u |= 4)) : p != m && (p == m - 1 ? y-- : p == m + 1 ? y++ : (p > m ? y-- : y++, 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)), Ii(l, l));
|
|
56
56
|
return o;
|
|
57
57
|
}
|
|
58
58
|
function Si(t, e, n, o) {
|
|
59
|
-
var
|
|
59
|
+
var c, a;
|
|
60
60
|
if (typeof t.type == "function") {
|
|
61
|
-
for (
|
|
61
|
+
for (c = t.__k, a = 0; c && a < c.length; a++) c[a] && (c[a].__ = t, e = Si(c[a], e, n, o));
|
|
62
62
|
return e;
|
|
63
63
|
}
|
|
64
64
|
t.__e != e && (o && (e && t.type && !e.parentNode && (e = be(t)), n.insertBefore(t.__e, e || null)), e = t.__e);
|
|
@@ -68,26 +68,26 @@ function Si(t, e, n, o) {
|
|
|
68
68
|
return e;
|
|
69
69
|
}
|
|
70
70
|
function un(t, e, n, o) {
|
|
71
|
-
var
|
|
71
|
+
var c, a, u, l = t.key, m = t.type, p = e[n], _ = p != null && (2 & p.__u) == 0;
|
|
72
72
|
if (p === null && l == null || _ && l == p.key && m == p.type) return n;
|
|
73
73
|
if (o > (_ ? 1 : 0)) {
|
|
74
|
-
for (
|
|
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
|
}
|
|
78
78
|
function zt(t, e, n) {
|
|
79
79
|
e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" || ln.test(e) ? n : n + "px";
|
|
80
80
|
}
|
|
81
|
-
function Ve(t, e, n, o,
|
|
82
|
-
var a,
|
|
81
|
+
function Ve(t, e, n, o, c) {
|
|
82
|
+
var a, u;
|
|
83
83
|
e: if (e == "style") if (typeof n == "string") t.style.cssText = n;
|
|
84
84
|
else {
|
|
85
85
|
if (typeof o == "string" && (t.style.cssText = o = ""), o) for (e in o) n && e in n || 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(mi, "$1")),
|
|
88
|
+
else if (e[0] == "o" && e[1] == "n") a = e != (e = e.replace(mi, "$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
|
-
if (
|
|
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 {
|
|
92
92
|
t[e] = n ?? "";
|
|
93
93
|
break e;
|
|
@@ -102,35 +102,35 @@ function qt(t) {
|
|
|
102
102
|
var n = this.l[e.type + t];
|
|
103
103
|
if (e.t == null) e.t = It++;
|
|
104
104
|
else if (e.t < n.u) return;
|
|
105
|
-
return n(
|
|
105
|
+
return n(k.event ? k.event(e) : e);
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
-
function At(t, e, n, o,
|
|
110
|
-
var _, d,
|
|
109
|
+
function At(t, e, n, o, c, a, u, l, m, p) {
|
|
110
|
+
var _, d, y, g, S, C, A, I, b, T, D, x, Z, H, ae, ne, re, Q = e.type;
|
|
111
111
|
if (e.constructor !== void 0) return null;
|
|
112
|
-
128 & n.__u && (m = !!(32 & n.__u), a = [l = e.__e = n.__e]), (_ =
|
|
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 (
|
|
114
|
+
if (I = e.props, b = "prototype" in Q && Q.prototype.render, T = (_ = Q.contextType) && o[_.__c], D = _ ? T ? T.props.value : _.__ : o, n.__c ? A = (d = e.__c = n.__c).__ = d.__E : (b ? e.__c = d = new Q(I, D) : (e.__c = d = new Oe(I, D), d.constructor = Q, d.render = hn), T && T.sub(d), d.state || (d.state = {}), d.__n = o, y = d.__d = !0, d.__h = [], d._sb = []), b && d.__s == null && (d.__s = d.state), b && Q.getDerivedStateFromProps != null && (d.__s == d.state && (d.__s = ie({}, d.__s)), ie(d.__s, Q.getDerivedStateFromProps(I, d.__s))), g = d.props, S = d.state, d.__v = e, y) b && Q.getDerivedStateFromProps == null && d.componentWillMount != null && d.componentWillMount(), b && d.componentDidMount != null && d.__h.push(d.componentDidMount);
|
|
115
115
|
else {
|
|
116
|
-
if (
|
|
117
|
-
for (e.__v != n.__v && (d.props =
|
|
116
|
+
if (b && Q.getDerivedStateFromProps == null && I !== g && d.componentWillReceiveProps != null && d.componentWillReceiveProps(I, D), e.__v == n.__v || !d.__e && d.shouldComponentUpdate != null && d.shouldComponentUpdate(I, d.__s, D) === !1) {
|
|
117
|
+
for (e.__v != n.__v && (d.props = I, 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
|
-
}),
|
|
120
|
-
d._sb = [], d.__h.length &&
|
|
119
|
+
}), x = 0; x < d._sb.length; x++) d.__h.push(d._sb[x]);
|
|
120
|
+
d._sb = [], d.__h.length && u.push(d);
|
|
121
121
|
break e;
|
|
122
122
|
}
|
|
123
|
-
d.componentWillUpdate != null && d.componentWillUpdate(
|
|
124
|
-
d.componentDidUpdate(g,
|
|
123
|
+
d.componentWillUpdate != null && d.componentWillUpdate(I, d.__s, D), b && d.componentDidUpdate != null && d.__h.push(function() {
|
|
124
|
+
d.componentDidUpdate(g, S, C);
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
if (d.context =
|
|
128
|
-
for (d.state = d.__s, d.__d = !1,
|
|
127
|
+
if (d.context = D, d.props = I, d.__P = t, d.__e = !1, Z = k.__r, H = 0, b) {
|
|
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
|
-
d.__d = !1,
|
|
132
|
-
while (d.__d && ++
|
|
133
|
-
d.state = d.__s, d.getChildContext != null && (o = ie(ie({}, o), d.getChildContext())),
|
|
131
|
+
d.__d = !1, Z && Z(e), _ = d.render(d.props, d.state, d.context), d.state = d.__s;
|
|
132
|
+
while (d.__d && ++H < 25);
|
|
133
|
+
d.state = d.__s, d.getChildContext != null && (o = ie(ie({}, o), d.getChildContext())), b && !y && d.getSnapshotBeforeUpdate != null && (C = d.getSnapshotBeforeUpdate(g, S)), ne = _, _ != null && _.type === oe && _.key == null && (ne = Ci(_.props.children)), l = yi(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), A && (d.__E = d.__ = null);
|
|
134
134
|
} catch (le) {
|
|
135
135
|
if (e.__v = null, m || a != null) if (le.then) {
|
|
136
136
|
for (e.__u |= m ? 160 : 128; l && l.nodeType == 8 && l.nextSibling; ) l = l.nextSibling;
|
|
@@ -140,55 +140,55 @@ function At(t, e, n, o, u, a, c, l, m, p) {
|
|
|
140
140
|
mt(e);
|
|
141
141
|
}
|
|
142
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 = dn(n.__e, e, n, o,
|
|
146
|
-
return (_ =
|
|
145
|
+
else a == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : l = e.__e = dn(n.__e, e, n, o, c, a, u, m, p);
|
|
146
|
+
return (_ = k.diffed) && _(e), 128 & e.__u ? void 0 : l;
|
|
147
147
|
}
|
|
148
148
|
function mt(t) {
|
|
149
149
|
t && t.__c && (t.__c.__e = !0), t && t.__k && t.__k.forEach(mt);
|
|
150
150
|
}
|
|
151
151
|
function wi(t, e, n) {
|
|
152
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
|
-
t =
|
|
156
|
-
a.call(
|
|
155
|
+
t = c.__h, c.__h = [], t.some(function(a) {
|
|
156
|
+
a.call(c);
|
|
157
157
|
});
|
|
158
158
|
} catch (a) {
|
|
159
|
-
|
|
159
|
+
k.__e(a, c.__v);
|
|
160
160
|
}
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
163
|
function Ci(t) {
|
|
164
164
|
return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : rt(t) ? t.map(Ci) : ie({}, t);
|
|
165
165
|
}
|
|
166
|
-
function dn(t, e, n, o,
|
|
167
|
-
var p, _, d,
|
|
168
|
-
if (
|
|
169
|
-
for (p = 0; p < a.length; p++) if ((g = a[p]) && "setAttribute" in g == !!
|
|
166
|
+
function dn(t, e, n, o, c, a, u, l, m) {
|
|
167
|
+
var p, _, d, y, g, S, C, A = n.props || Ue, I = e.props, b = e.type;
|
|
168
|
+
if (b == "svg" ? c = "http://www.w3.org/2000/svg" : b == "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 ((g = a[p]) && "setAttribute" in g == !!b && (b ? g.localName == b : g.nodeType == 3)) {
|
|
170
170
|
t = g, a[p] = null;
|
|
171
171
|
break;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
if (t == null) {
|
|
175
|
-
if (
|
|
176
|
-
t = document.createElementNS(
|
|
175
|
+
if (b == null) return document.createTextNode(I);
|
|
176
|
+
t = document.createElementNS(c, b, I.is && I), l && (k.__m && k.__m(e, a), l = !1), a = null;
|
|
177
177
|
}
|
|
178
|
-
if (
|
|
178
|
+
if (b == null) A === I || l && t.data == I || (t.data = I);
|
|
179
179
|
else {
|
|
180
180
|
if (a = a && Fe.call(t.childNodes), !l && a != null) for (A = {}, p = 0; p < t.attributes.length; p++) A[(g = t.attributes[p]).name] = g.value;
|
|
181
181
|
for (p in A) if (g = A[p], p != "children") {
|
|
182
182
|
if (p == "dangerouslySetInnerHTML") d = g;
|
|
183
|
-
else if (!(p in
|
|
184
|
-
if (p == "value" && "defaultValue" in
|
|
185
|
-
Ve(t, p, null, g,
|
|
183
|
+
else if (!(p in I)) {
|
|
184
|
+
if (p == "value" && "defaultValue" in I || p == "checked" && "defaultChecked" in I) continue;
|
|
185
|
+
Ve(t, p, null, g, c);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
for (p in
|
|
188
|
+
for (p in I) g = I[p], p == "children" ? y = g : p == "dangerouslySetInnerHTML" ? _ = g : p == "value" ? S = g : p == "checked" ? C = g : l && typeof g != "function" || A[p] === g || Ve(t, p, g, A[p], c);
|
|
189
189
|
if (_) l || d && (_.__html == d.__html || _.__html == t.innerHTML) || (t.innerHTML = _.__html), e.__k = [];
|
|
190
|
-
else if (d && (t.innerHTML = ""), yi(e.type == "template" ? t.content : t, rt(
|
|
191
|
-
l || (p = "value",
|
|
190
|
+
else if (d && (t.innerHTML = ""), yi(e.type == "template" ? t.content : t, rt(y) ? y : [y], e, n, o, b == "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", b == "progress" && S == null ? t.removeAttribute("value") : S != null && (S !== t[p] || b == "progress" && !S || b == "option" && S != A[p]) && Ve(t, p, S, A[p], c), p = "checked", C != null && C != t[p] && Ve(t, p, C, A[p], c));
|
|
192
192
|
}
|
|
193
193
|
return t;
|
|
194
194
|
}
|
|
@@ -198,41 +198,41 @@ function Tt(t, e, n) {
|
|
|
198
198
|
var o = typeof t.__u == "function";
|
|
199
199
|
o && t.__u(), o && e == null || (t.__u = t(e));
|
|
200
200
|
} else t.current = e;
|
|
201
|
-
} catch (
|
|
202
|
-
|
|
201
|
+
} catch (c) {
|
|
202
|
+
k.__e(c, n);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
function Ii(t, e, n) {
|
|
206
|
-
var o,
|
|
207
|
-
if (
|
|
206
|
+
var o, c;
|
|
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) {
|
|
211
|
-
|
|
211
|
+
k.__e(a, e);
|
|
212
212
|
}
|
|
213
213
|
o.base = o.__P = null;
|
|
214
214
|
}
|
|
215
|
-
if (o = t.__k) for (
|
|
215
|
+
if (o = t.__k) for (c = 0; c < o.length; c++) o[c] && Ii(o[c], e, n || typeof t.type != "function");
|
|
216
216
|
n || bt(t.__e), t.__c = t.__ = t.__e = void 0;
|
|
217
217
|
}
|
|
218
218
|
function hn(t, e, n) {
|
|
219
219
|
return this.constructor(t, n);
|
|
220
220
|
}
|
|
221
221
|
function ot(t, e, n) {
|
|
222
|
-
var o,
|
|
223
|
-
e == document && (e = document.documentElement),
|
|
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 = [], At(e, t = (!o && n || e).__k = Ce(oe, null, [t]), c || Ue, Ue, e.namespaceURI, !o && n ? [n] : c ? null : e.firstChild ? Fe.call(e.childNodes) : null, a, !o && n ? n : c ? c.__e : e.firstChild, o, u), wi(a, t, u);
|
|
224
224
|
}
|
|
225
225
|
function bi(t, e) {
|
|
226
226
|
ot(t, e, bi);
|
|
227
227
|
}
|
|
228
228
|
function Ai(t, e, n) {
|
|
229
|
-
var o,
|
|
230
|
-
for (a in t.type && t.type.defaultProps && (
|
|
231
|
-
return arguments.length > 2 && (l.children = arguments.length > 3 ? Fe.call(arguments, 2) : n), xe(t.type, l, o || t.key,
|
|
229
|
+
var o, c, a, u, l = ie({}, t.props);
|
|
230
|
+
for (a in t.type && t.type.defaultProps && (u = t.type.defaultProps), e) a == "key" ? o = e[a] : a == "ref" ? c = e[a] : l[a] = e[a] === void 0 && u != null ? u[a] : e[a];
|
|
231
|
+
return arguments.length > 2 && (l.children = arguments.length > 3 ? Fe.call(arguments, 2) : n), xe(t.type, l, o || t.key, c || t.ref, null);
|
|
232
232
|
}
|
|
233
|
-
Fe = gi.slice,
|
|
234
|
-
for (var
|
|
235
|
-
if ((a =
|
|
233
|
+
Fe = gi.slice, k = { __e: function(t, e, n, o) {
|
|
234
|
+
for (var c, a, u; e = e.__; ) if ((c = e.__c) && !c.__) try {
|
|
235
|
+
if ((a = c.constructor) && a.getDerivedStateFromError != null && (c.setState(a.getDerivedStateFromError(t)), u = c.__d), c.componentDidCatch != null && (c.componentDidCatch(t, o || {}), u = c.__d), u) return c.__E = c;
|
|
236
236
|
} catch (l) {
|
|
237
237
|
t = l;
|
|
238
238
|
}
|
|
@@ -258,27 +258,27 @@ function Xe() {
|
|
|
258
258
|
}
|
|
259
259
|
function Ti(t, e) {
|
|
260
260
|
if (t == null) return {};
|
|
261
|
-
var n, o,
|
|
262
|
-
for (o = 0; o < a.length; o++) e.indexOf(n = a[o]) >= 0 || (
|
|
263
|
-
return
|
|
261
|
+
var n, o, c = {}, a = Object.keys(t);
|
|
262
|
+
for (o = 0; o < a.length; o++) e.indexOf(n = a[o]) >= 0 || (c[n] = t[n]);
|
|
263
|
+
return c;
|
|
264
264
|
}
|
|
265
265
|
var fn = ["context", "children"], pn = ["useFragment"];
|
|
266
266
|
function _n(t, e, n, o) {
|
|
267
|
-
function
|
|
268
|
-
var a,
|
|
269
|
-
return
|
|
267
|
+
function c() {
|
|
268
|
+
var a, u = Reflect.construct(HTMLElement, [], c);
|
|
269
|
+
return u._vdomComponent = t, o && o.shadow ? (u._root = u.attachShadow({ mode: o.mode || "open", serializable: (a = o.serializable) != null && a }), o.adoptedStyleSheets && (u._root.adoptedStyleSheets = o.adoptedStyleSheets)) : u._root = u, u;
|
|
270
270
|
}
|
|
271
|
-
return (
|
|
271
|
+
return (c.prototype = Object.create(HTMLElement.prototype)).constructor = c, c.prototype.connectedCallback = function() {
|
|
272
272
|
mn.call(this, o);
|
|
273
|
-
},
|
|
274
|
-
Object.defineProperty(
|
|
273
|
+
}, c.prototype.attributeChangedCallback = gn, c.prototype.disconnectedCallback = vn, n = n || t.observedAttributes || Object.keys(t.propTypes || {}), c.observedAttributes = n, t.formAssociated && (c.formAssociated = !0), n.forEach(function(a) {
|
|
274
|
+
Object.defineProperty(c.prototype, a, { get: function() {
|
|
275
275
|
return this._vdom ? this._vdom.props[a] : this._props[a];
|
|
276
|
-
}, set: function(
|
|
277
|
-
this._vdom ? this.attributeChangedCallback(a, null,
|
|
278
|
-
var l = typeof
|
|
279
|
-
|
|
276
|
+
}, set: function(u) {
|
|
277
|
+
this._vdom ? this.attributeChangedCallback(a, null, u) : (this._props || (this._props = {}), this._props[a] = u);
|
|
278
|
+
var l = typeof u;
|
|
279
|
+
u != null && l !== "string" && l !== "boolean" && l !== "number" || this.setAttribute(a, u);
|
|
280
280
|
} });
|
|
281
|
-
}), customElements.define(e || t.tagName || t.displayName || t.name,
|
|
281
|
+
}), customElements.define(e || t.tagName || t.displayName || t.name, c), c;
|
|
282
282
|
}
|
|
283
283
|
function En(t) {
|
|
284
284
|
this.getChildContext = function() {
|
|
@@ -289,7 +289,7 @@ function En(t) {
|
|
|
289
289
|
}
|
|
290
290
|
function mn(t) {
|
|
291
291
|
var e = new CustomEvent("_preact", { detail: {}, bubbles: !0, cancelable: !0 });
|
|
292
|
-
this.dispatchEvent(e), this._vdom =
|
|
292
|
+
this.dispatchEvent(e), this._vdom = Ce(En, Xe({}, this._props, { context: e.detail.context }), Ni(this, this._vdomComponent, t)), (this.hasAttribute("hydrate") ? bi : ot)(this._vdom, this._root);
|
|
293
293
|
}
|
|
294
294
|
function Ri(t) {
|
|
295
295
|
return t.replace(/-(\w)/g, function(e, n) {
|
|
@@ -306,35 +306,35 @@ function vn() {
|
|
|
306
306
|
ot(this._vdom = null, this._root);
|
|
307
307
|
}
|
|
308
308
|
function Yt(t, e) {
|
|
309
|
-
var n = this, o = t.useFragment,
|
|
310
|
-
return
|
|
311
|
-
a ? (n.ref = a, n._listener || (n._listener = function(
|
|
312
|
-
|
|
309
|
+
var n = this, o = t.useFragment, c = Ti(t, pn);
|
|
310
|
+
return Ce(o ? oe : "slot", Xe({}, c, { ref: function(a) {
|
|
311
|
+
a ? (n.ref = a, n._listener || (n._listener = function(u) {
|
|
312
|
+
u.stopPropagation(), u.detail.context = e;
|
|
313
313
|
}, a.addEventListener("_preact", n._listener))) : n.ref.removeEventListener("_preact", n._listener);
|
|
314
314
|
} }));
|
|
315
315
|
}
|
|
316
316
|
function Ni(t, e, n) {
|
|
317
317
|
if (t.nodeType === 3) return t.data;
|
|
318
318
|
if (t.nodeType !== 1) return null;
|
|
319
|
-
var o = [],
|
|
320
|
-
for (a =
|
|
319
|
+
var o = [], c = {}, a = 0, u = t.attributes, l = t.childNodes;
|
|
320
|
+
for (a = u.length; a--; ) u[a].name !== "slot" && (c[u[a].name] = u[a].value, c[Ri(u[a].name)] = u[a].value);
|
|
321
321
|
for (a = l.length; a--; ) {
|
|
322
322
|
var m = Ni(l[a], null, n), p = l[a].slot;
|
|
323
|
-
p ?
|
|
323
|
+
p ? c[p] = Ce(Yt, { name: p }, m) : o[a] = m;
|
|
324
324
|
}
|
|
325
|
-
var _ = !(!n || !n.shadow), d = e ?
|
|
326
|
-
return !_ && e && (t.innerHTML = ""),
|
|
325
|
+
var _ = !(!n || !n.shadow), d = e ? Ce(Yt, { useFragment: !_ }, o) : o;
|
|
326
|
+
return !_ && e && (t.innerHTML = ""), Ce(e || t.nodeName.toLowerCase(), c, d);
|
|
327
327
|
}
|
|
328
328
|
var yn = 0;
|
|
329
|
-
function w(t, e, n, o,
|
|
329
|
+
function w(t, e, n, o, c, a) {
|
|
330
330
|
e || (e = {});
|
|
331
|
-
var
|
|
332
|
-
if ("ref" in m) for (l in m = {}, e) l == "ref" ?
|
|
333
|
-
var p = { type: t, props: m, key: n, ref:
|
|
334
|
-
if (typeof t == "function" && (
|
|
335
|
-
return
|
|
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: --yn, __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
|
+
return k.vnode && k.vnode(p), p;
|
|
336
336
|
}
|
|
337
|
-
var
|
|
337
|
+
var Me, P, dt, Kt, Be = 0, xi = [], F = k, Jt = F.__b, Xt = F.__r, Zt = F.diffed, Qt = F.__c, ei = F.unmount, ti = F.__;
|
|
338
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: [] });
|
|
@@ -344,54 +344,54 @@ function qe(t) {
|
|
|
344
344
|
return Be = 1, Sn(ki, t);
|
|
345
345
|
}
|
|
346
346
|
function Sn(t, e, n) {
|
|
347
|
-
var o = Rt(
|
|
347
|
+
var o = Rt(Me++, 2);
|
|
348
348
|
if (o.t = t, !o.__c && (o.__ = [ki(void 0, e), function(l) {
|
|
349
349
|
var m = o.__N ? o.__N[0] : o.__[0], p = o.t(m, l);
|
|
350
350
|
m !== p && (o.__N = [p, o.__[1]], o.__c.setState({}));
|
|
351
351
|
}], o.__c = P, !P.__f)) {
|
|
352
|
-
var
|
|
352
|
+
var c = function(l, m, p) {
|
|
353
353
|
if (!o.__c.__H) return !0;
|
|
354
|
-
var _ = o.__c.__H.__.filter(function(
|
|
355
|
-
return !!
|
|
354
|
+
var _ = o.__c.__H.__.filter(function(y) {
|
|
355
|
+
return !!y.__c;
|
|
356
356
|
});
|
|
357
|
-
if (_.every(function(
|
|
358
|
-
return !
|
|
357
|
+
if (_.every(function(y) {
|
|
358
|
+
return !y.__N;
|
|
359
359
|
})) return !a || a.call(this, l, m, p);
|
|
360
360
|
var d = o.__c.props !== l;
|
|
361
|
-
return _.forEach(function(
|
|
362
|
-
if (
|
|
363
|
-
var g =
|
|
364
|
-
|
|
361
|
+
return _.forEach(function(y) {
|
|
362
|
+
if (y.__N) {
|
|
363
|
+
var g = y.__[0];
|
|
364
|
+
y.__ = y.__N, y.__N = void 0, g !== y.__[0] && (d = !0);
|
|
365
365
|
}
|
|
366
366
|
}), a && a.call(this, l, m, p) || d;
|
|
367
367
|
};
|
|
368
368
|
P.__f = !0;
|
|
369
|
-
var a = P.shouldComponentUpdate,
|
|
369
|
+
var a = P.shouldComponentUpdate, u = P.componentWillUpdate;
|
|
370
370
|
P.componentWillUpdate = function(l, m, p) {
|
|
371
371
|
if (this.__e) {
|
|
372
372
|
var _ = a;
|
|
373
|
-
a = void 0,
|
|
373
|
+
a = void 0, c(l, m, p), a = _;
|
|
374
374
|
}
|
|
375
|
-
|
|
376
|
-
}, P.shouldComponentUpdate =
|
|
375
|
+
u && u.call(this, l, m, p);
|
|
376
|
+
}, P.shouldComponentUpdate = c;
|
|
377
377
|
}
|
|
378
378
|
return o.__N || o.__;
|
|
379
379
|
}
|
|
380
380
|
function gt(t, e) {
|
|
381
|
-
var n = Rt(
|
|
381
|
+
var n = Rt(Me++, 3);
|
|
382
382
|
!F.__s && Oi(n.__H, e) && (n.__ = t, n.u = e, P.__H.__h.push(n));
|
|
383
383
|
}
|
|
384
384
|
function Ze(t) {
|
|
385
|
-
return Be = 5,
|
|
385
|
+
return Be = 5, Ie(function() {
|
|
386
386
|
return { current: t };
|
|
387
387
|
}, []);
|
|
388
388
|
}
|
|
389
|
-
function
|
|
390
|
-
var n = Rt(
|
|
389
|
+
function Ie(t, e) {
|
|
390
|
+
var n = Rt(Me++, 7);
|
|
391
391
|
return Oi(n.__H, e) && (n.__ = t(), n.__H = e, n.__h = t), n.__;
|
|
392
392
|
}
|
|
393
393
|
function je(t, e) {
|
|
394
|
-
return Be = 8,
|
|
394
|
+
return Be = 8, Ie(function() {
|
|
395
395
|
return t;
|
|
396
396
|
}, e);
|
|
397
397
|
}
|
|
@@ -407,11 +407,11 @@ F.__b = function(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
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(Ye), e.__h.forEach(vt), e.__h = [],
|
|
414
|
+
})) : (e.__h.forEach(Ye), 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;
|
|
@@ -425,8 +425,8 @@ F.__b = function(t) {
|
|
|
425
425
|
return !o.__ || vt(o);
|
|
426
426
|
});
|
|
427
427
|
} catch (o) {
|
|
428
|
-
e.some(function(
|
|
429
|
-
|
|
428
|
+
e.some(function(c) {
|
|
429
|
+
c.__h && (c.__h = []);
|
|
430
430
|
}), e = [], F.__e(o, n.__v);
|
|
431
431
|
}
|
|
432
432
|
}), Qt && Qt(t, e);
|
|
@@ -436,8 +436,8 @@ F.__b = function(t) {
|
|
|
436
436
|
n && n.__H && (n.__H.__.forEach(function(o) {
|
|
437
437
|
try {
|
|
438
438
|
Ye(o);
|
|
439
|
-
} catch (
|
|
440
|
-
e =
|
|
439
|
+
} catch (c) {
|
|
440
|
+
e = c;
|
|
441
441
|
}
|
|
442
442
|
}), n.__H = void 0, e && F.__e(e, n.__v));
|
|
443
443
|
};
|
|
@@ -473,10 +473,10 @@ function st() {
|
|
|
473
473
|
var n = ke;
|
|
474
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) && Mi(n)) try {
|
|
477
477
|
n.c();
|
|
478
|
-
} catch (
|
|
479
|
-
e || (t =
|
|
478
|
+
} catch (c) {
|
|
479
|
+
e || (t = c, e = !0);
|
|
480
480
|
}
|
|
481
481
|
n = o;
|
|
482
482
|
}
|
|
@@ -493,82 +493,82 @@ function bn(t) {
|
|
|
493
493
|
st();
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
|
-
var
|
|
496
|
+
var O = void 0;
|
|
497
497
|
function Di(t) {
|
|
498
|
-
var e =
|
|
499
|
-
|
|
498
|
+
var e = O;
|
|
499
|
+
O = void 0;
|
|
500
500
|
try {
|
|
501
501
|
return t();
|
|
502
502
|
} finally {
|
|
503
|
-
|
|
503
|
+
O = e;
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
506
|
var ke = void 0, pe = 0, yt = 0, Qe = 0;
|
|
507
|
-
function
|
|
508
|
-
if (
|
|
507
|
+
function Ui(t) {
|
|
508
|
+
if (O !== void 0) {
|
|
509
509
|
var e = t.n;
|
|
510
|
-
if (e === void 0 || e.t !==
|
|
511
|
-
return e = { i: 0, S: t, p:
|
|
510
|
+
if (e === void 0 || e.t !== O)
|
|
511
|
+
return e = { i: 0, S: t, p: O.s, n: void 0, t: O, e: void 0, x: void 0, r: e }, O.s !== void 0 && (O.s.n = e), O.s = e, t.n = e, 32 & O.f && t.S(e), e;
|
|
512
512
|
if (e.i === -1)
|
|
513
|
-
return e.i = 0, e.n !== void 0 && (e.n.p = e.p, e.p !== void 0 && (e.p.n = e.n), e.p =
|
|
513
|
+
return e.i = 0, e.n !== void 0 && (e.n.p = e.p, e.p !== void 0 && (e.p.n = e.n), e.p = O.s, e.n = void 0, O.s.n = e, O.s = e), e;
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
|
-
function
|
|
516
|
+
function j(t, e) {
|
|
517
517
|
this.v = t, this.i = 0, this.n = void 0, this.t = void 0, this.W = e?.watched, this.Z = e?.unwatched, this.name = e?.name;
|
|
518
518
|
}
|
|
519
|
-
|
|
520
|
-
|
|
519
|
+
j.prototype.brand = In;
|
|
520
|
+
j.prototype.h = function() {
|
|
521
521
|
return !0;
|
|
522
522
|
};
|
|
523
|
-
|
|
523
|
+
j.prototype.S = function(t) {
|
|
524
524
|
var e = this, n = this.t;
|
|
525
525
|
n !== t && t.e === void 0 && (t.x = n, this.t = t, n !== void 0 ? n.e = t : Di(function() {
|
|
526
526
|
var o;
|
|
527
527
|
(o = e.W) == null || o.call(e);
|
|
528
528
|
}));
|
|
529
529
|
};
|
|
530
|
-
|
|
530
|
+
j.prototype.U = function(t) {
|
|
531
531
|
var e = this;
|
|
532
532
|
if (this.t !== void 0) {
|
|
533
533
|
var n = t.e, o = t.x;
|
|
534
534
|
n !== void 0 && (n.x = o, t.e = void 0), o !== void 0 && (o.e = n, t.x = void 0), t === this.t && (this.t = o, o === void 0 && Di(function() {
|
|
535
|
-
var
|
|
536
|
-
(
|
|
535
|
+
var c;
|
|
536
|
+
(c = e.Z) == null || c.call(e);
|
|
537
537
|
}));
|
|
538
538
|
}
|
|
539
539
|
};
|
|
540
|
-
|
|
540
|
+
j.prototype.subscribe = function(t) {
|
|
541
541
|
var e = this;
|
|
542
542
|
return $e(function() {
|
|
543
|
-
var n = e.value, o =
|
|
544
|
-
|
|
543
|
+
var n = e.value, o = O;
|
|
544
|
+
O = void 0;
|
|
545
545
|
try {
|
|
546
546
|
t(n);
|
|
547
547
|
} finally {
|
|
548
|
-
|
|
548
|
+
O = o;
|
|
549
549
|
}
|
|
550
550
|
}, { name: "sub" });
|
|
551
551
|
};
|
|
552
|
-
|
|
552
|
+
j.prototype.valueOf = function() {
|
|
553
553
|
return this.value;
|
|
554
554
|
};
|
|
555
|
-
|
|
555
|
+
j.prototype.toString = function() {
|
|
556
556
|
return this.value + "";
|
|
557
557
|
};
|
|
558
|
-
|
|
558
|
+
j.prototype.toJSON = function() {
|
|
559
559
|
return this.value;
|
|
560
560
|
};
|
|
561
|
-
|
|
562
|
-
var t =
|
|
563
|
-
|
|
561
|
+
j.prototype.peek = function() {
|
|
562
|
+
var t = O;
|
|
563
|
+
O = void 0;
|
|
564
564
|
try {
|
|
565
565
|
return this.value;
|
|
566
566
|
} finally {
|
|
567
|
-
|
|
567
|
+
O = t;
|
|
568
568
|
}
|
|
569
569
|
};
|
|
570
|
-
Object.defineProperty(
|
|
571
|
-
var t =
|
|
570
|
+
Object.defineProperty(j.prototype, "value", { get: function() {
|
|
571
|
+
var t = Ui(this);
|
|
572
572
|
return t !== void 0 && (t.i = this.i), this.v;
|
|
573
573
|
}, set: function(t) {
|
|
574
574
|
if (t !== this.v) {
|
|
@@ -581,10 +581,10 @@ Object.defineProperty(H.prototype, "value", { get: function() {
|
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
583
|
} });
|
|
584
|
-
function
|
|
585
|
-
return new
|
|
584
|
+
function Y(t, e) {
|
|
585
|
+
return new j(t, e);
|
|
586
586
|
}
|
|
587
|
-
function
|
|
587
|
+
function Mi(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
|
}
|
|
@@ -604,65 +604,65 @@ function Li(t) {
|
|
|
604
604
|
}
|
|
605
605
|
t.s = n;
|
|
606
606
|
}
|
|
607
|
-
function
|
|
608
|
-
|
|
607
|
+
function ge(t, e) {
|
|
608
|
+
j.call(this, void 0), this.x = t, this.s = void 0, this.g = Qe - 1, this.f = 4, this.W = e?.watched, this.Z = e?.unwatched, this.name = e?.name;
|
|
609
609
|
}
|
|
610
|
-
|
|
611
|
-
|
|
610
|
+
ge.prototype = new j();
|
|
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 === Qe)) return !0;
|
|
614
|
-
if (this.g = Qe, this.f |= 1, this.i > 0 && !
|
|
614
|
+
if (this.g = Qe, this.f |= 1, this.i > 0 && !Mi(this))
|
|
615
615
|
return this.f &= -2, !0;
|
|
616
|
-
var t =
|
|
616
|
+
var t = O;
|
|
617
617
|
try {
|
|
618
|
-
Bi(this),
|
|
618
|
+
Bi(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) {
|
|
622
622
|
this.v = n, this.f |= 16, this.i++;
|
|
623
623
|
}
|
|
624
|
-
return
|
|
624
|
+
return O = t, Li(this), this.f &= -2, !0;
|
|
625
625
|
};
|
|
626
|
-
|
|
626
|
+
ge.prototype.S = function(t) {
|
|
627
627
|
if (this.t === void 0) {
|
|
628
628
|
this.f |= 36;
|
|
629
629
|
for (var e = this.s; e !== void 0; e = e.n) e.S.S(e);
|
|
630
630
|
}
|
|
631
|
-
|
|
631
|
+
j.prototype.S.call(this, t);
|
|
632
632
|
};
|
|
633
|
-
|
|
634
|
-
if (this.t !== void 0 && (
|
|
633
|
+
ge.prototype.U = function(t) {
|
|
634
|
+
if (this.t !== void 0 && (j.prototype.U.call(this, t), this.t === void 0)) {
|
|
635
635
|
this.f &= -33;
|
|
636
636
|
for (var e = this.s; e !== void 0; e = e.n) e.S.U(e);
|
|
637
637
|
}
|
|
638
638
|
};
|
|
639
|
-
|
|
639
|
+
ge.prototype.N = function() {
|
|
640
640
|
if (!(2 & this.f)) {
|
|
641
641
|
this.f |= 6;
|
|
642
642
|
for (var t = this.t; t !== void 0; t = t.x) t.t.N();
|
|
643
643
|
}
|
|
644
644
|
};
|
|
645
|
-
Object.defineProperty(
|
|
645
|
+
Object.defineProperty(ge.prototype, "value", { get: function() {
|
|
646
646
|
if (1 & this.f) throw new Error("Cycle detected");
|
|
647
|
-
var t =
|
|
647
|
+
var t = Ui(this);
|
|
648
648
|
if (this.h(), t !== void 0 && (t.i = this.i), 16 & this.f) throw this.v;
|
|
649
649
|
return this.v;
|
|
650
650
|
} });
|
|
651
651
|
function ni(t, e) {
|
|
652
|
-
return new
|
|
652
|
+
return new ge(t, e);
|
|
653
653
|
}
|
|
654
654
|
function Pi(t) {
|
|
655
655
|
var e = t.u;
|
|
656
656
|
if (t.u = void 0, typeof e == "function") {
|
|
657
657
|
pe++;
|
|
658
|
-
var n =
|
|
659
|
-
|
|
658
|
+
var n = O;
|
|
659
|
+
O = void 0;
|
|
660
660
|
try {
|
|
661
661
|
e();
|
|
662
662
|
} catch (o) {
|
|
663
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
|
}
|
|
@@ -671,8 +671,8 @@ function Nt(t) {
|
|
|
671
671
|
t.x = void 0, t.s = void 0, Pi(t);
|
|
672
672
|
}
|
|
673
673
|
function An(t) {
|
|
674
|
-
if (
|
|
675
|
-
Li(this),
|
|
674
|
+
if (O !== this) throw new Error("Out-of-order effect");
|
|
675
|
+
Li(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;
|
|
@@ -690,8 +690,8 @@ Ae.prototype.c = function() {
|
|
|
690
690
|
Ae.prototype.S = function() {
|
|
691
691
|
if (1 & this.f) throw new Error("Cycle detected");
|
|
692
692
|
this.f |= 1, this.f &= -9, Pi(this), Bi(this), pe++;
|
|
693
|
-
var t =
|
|
694
|
-
return
|
|
693
|
+
var t = O;
|
|
694
|
+
return O = this, An.bind(this, t);
|
|
695
695
|
};
|
|
696
696
|
Ae.prototype.N = function() {
|
|
697
697
|
2 & this.f || (this.f |= 2, this.o = ke, ke = this);
|
|
@@ -706,8 +706,8 @@ function $e(t, e) {
|
|
|
706
706
|
var n = new Ae(t, e);
|
|
707
707
|
try {
|
|
708
708
|
n.c();
|
|
709
|
-
} catch (
|
|
710
|
-
throw n.d(),
|
|
709
|
+
} catch (c) {
|
|
710
|
+
throw n.d(), c;
|
|
711
711
|
}
|
|
712
712
|
var o = n.d.bind(n);
|
|
713
713
|
return o[Symbol.dispose] = o, o;
|
|
@@ -717,7 +717,7 @@ $e(function() {
|
|
|
717
717
|
Fi = this.N;
|
|
718
718
|
})();
|
|
719
719
|
function Te(t, e) {
|
|
720
|
-
|
|
720
|
+
k[t] = e.bind(null, k[t] || function() {
|
|
721
721
|
});
|
|
722
722
|
}
|
|
723
723
|
function et(t) {
|
|
@@ -726,7 +726,7 @@ function et(t) {
|
|
|
726
726
|
function Gi(t) {
|
|
727
727
|
var e = this, n = t.data, o = Vi(n);
|
|
728
728
|
o.value = n;
|
|
729
|
-
var
|
|
729
|
+
var c = Ie(function() {
|
|
730
730
|
for (var l = e, m = e.__v; m = m.__; ) if (m.__c) {
|
|
731
731
|
m.__c.__$f |= 4;
|
|
732
732
|
break;
|
|
@@ -741,23 +741,23 @@ function Gi(t) {
|
|
|
741
741
|
var g = p.value;
|
|
742
742
|
l.__v && l.__v.__e && l.__v.__e.nodeType === 3 && (l.__v.__e.data = g);
|
|
743
743
|
}
|
|
744
|
-
}),
|
|
744
|
+
}), y = e.__$u.d;
|
|
745
745
|
return e.__$u.d = function() {
|
|
746
|
-
d(),
|
|
746
|
+
d(), y.call(this);
|
|
747
747
|
}, [_, p];
|
|
748
|
-
}, []), a =
|
|
749
|
-
return a.value ?
|
|
748
|
+
}, []), a = c[0], u = c[1];
|
|
749
|
+
return a.value ? u.peek() : u.value;
|
|
750
750
|
}
|
|
751
751
|
Gi.displayName = "ReactiveTextNode";
|
|
752
|
-
Object.defineProperties(
|
|
752
|
+
Object.defineProperties(j.prototype, { constructor: { configurable: !0, value: void 0 }, type: { configurable: !0, value: Gi }, props: { configurable: !0, get: function() {
|
|
753
753
|
return { data: this };
|
|
754
754
|
} }, __b: { configurable: !0, value: 1 } });
|
|
755
755
|
Te("__b", function(t, e) {
|
|
756
756
|
if (typeof e.type == "string") {
|
|
757
757
|
var n, o = e.props;
|
|
758
|
-
for (var
|
|
759
|
-
var a = o[
|
|
760
|
-
a instanceof
|
|
758
|
+
for (var c in o) if (c !== "children") {
|
|
759
|
+
var a = o[c];
|
|
760
|
+
a instanceof j && (n || (e.__np = n = {}), n[c] = a, o[c] = a.peek());
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
763
|
t(e);
|
|
@@ -766,14 +766,14 @@ Te("__r", function(t, e) {
|
|
|
766
766
|
if (e.type !== oe) {
|
|
767
767
|
et();
|
|
768
768
|
var n, o = e.__c;
|
|
769
|
-
o && (o.__$f &= -2, (n = o.__$u) === void 0 && (o.__$u = n = (function(
|
|
770
|
-
var
|
|
769
|
+
o && (o.__$f &= -2, (n = o.__$u) === void 0 && (o.__$u = n = (function(c, a) {
|
|
770
|
+
var u;
|
|
771
771
|
return $e(function() {
|
|
772
|
-
|
|
773
|
-
}, { name: a }),
|
|
772
|
+
u = this;
|
|
773
|
+
}, { name: a }), u.c = c, u;
|
|
774
774
|
})(function() {
|
|
775
|
-
var
|
|
776
|
-
Tn && ((
|
|
775
|
+
var c;
|
|
776
|
+
Tn && ((c = n.y) == null || c.call(n)), o.__$f |= 1, o.setState({});
|
|
777
777
|
}, typeof e.type == "function" ? e.type.displayName || e.type.name : ""))), et(n);
|
|
778
778
|
}
|
|
779
779
|
t(e);
|
|
@@ -785,31 +785,31 @@ Te("diffed", function(t, e) {
|
|
|
785
785
|
et();
|
|
786
786
|
var n;
|
|
787
787
|
if (typeof e.type == "string" && (n = e.__e)) {
|
|
788
|
-
var o = e.__np,
|
|
788
|
+
var o = e.__np, c = e.props;
|
|
789
789
|
if (o) {
|
|
790
790
|
var a = n.U;
|
|
791
|
-
if (a) for (var
|
|
792
|
-
var l = a[
|
|
793
|
-
l !== void 0 && !(
|
|
791
|
+
if (a) for (var u in a) {
|
|
792
|
+
var l = a[u];
|
|
793
|
+
l !== void 0 && !(u in o) && (l.d(), a[u] = void 0);
|
|
794
794
|
}
|
|
795
795
|
else
|
|
796
796
|
a = {}, n.U = a;
|
|
797
797
|
for (var m in o) {
|
|
798
798
|
var p = a[m], _ = o[m];
|
|
799
|
-
p === void 0 ? (p = Rn(n, m, _,
|
|
799
|
+
p === void 0 ? (p = Rn(n, m, _, c), a[m] = p) : p.o(_, c);
|
|
800
800
|
}
|
|
801
801
|
}
|
|
802
802
|
}
|
|
803
803
|
t(e);
|
|
804
804
|
});
|
|
805
805
|
function Rn(t, e, n, o) {
|
|
806
|
-
var
|
|
807
|
-
return { o: function(
|
|
808
|
-
a.value =
|
|
806
|
+
var c = e in t && t.ownerSVGElement === void 0, a = Y(n);
|
|
807
|
+
return { o: function(u, l) {
|
|
808
|
+
a.value = u, o = l;
|
|
809
809
|
}, d: $e(function() {
|
|
810
810
|
this.N = ji;
|
|
811
|
-
var
|
|
812
|
-
o[e] !==
|
|
811
|
+
var u = a.value.value;
|
|
812
|
+
o[e] !== u && (o[e] = u, c ? t[e] = u : u != null && (u !== !1 || e[4] === "-") ? t.setAttribute(e, u) : t.removeAttribute(e));
|
|
813
813
|
}) };
|
|
814
814
|
}
|
|
815
815
|
Te("unmount", function(t, e) {
|
|
@@ -819,17 +819,17 @@ Te("unmount", function(t, e) {
|
|
|
819
819
|
var o = n.U;
|
|
820
820
|
if (o) {
|
|
821
821
|
n.U = void 0;
|
|
822
|
-
for (var
|
|
823
|
-
var a = o[
|
|
822
|
+
for (var c in o) {
|
|
823
|
+
var a = o[c];
|
|
824
824
|
a && a.d();
|
|
825
825
|
}
|
|
826
826
|
}
|
|
827
827
|
}
|
|
828
828
|
} else {
|
|
829
|
-
var
|
|
830
|
-
if (
|
|
831
|
-
var l =
|
|
832
|
-
l && (
|
|
829
|
+
var u = e.__c;
|
|
830
|
+
if (u) {
|
|
831
|
+
var l = u.__$u;
|
|
832
|
+
l && (u.__$u = void 0, l.d());
|
|
833
833
|
}
|
|
834
834
|
}
|
|
835
835
|
t(e);
|
|
@@ -840,18 +840,18 @@ Te("__h", function(t, e, n, o) {
|
|
|
840
840
|
Oe.prototype.shouldComponentUpdate = function(t, e) {
|
|
841
841
|
if (this.__R) return !0;
|
|
842
842
|
var n = this.__$u, o = n && n.s !== void 0;
|
|
843
|
-
for (var
|
|
843
|
+
for (var c in e) return !0;
|
|
844
844
|
if (this.__f || typeof this.u == "boolean" && this.u === !0) {
|
|
845
845
|
var a = 2 & this.__$f;
|
|
846
846
|
if (!(o || a || 4 & this.__$f) || 1 & this.__$f) return !0;
|
|
847
847
|
} else if (!(o || 4 & this.__$f) || 3 & this.__$f) return !0;
|
|
848
|
-
for (var
|
|
848
|
+
for (var u in t) if (u !== "__source" && t[u] !== this.props[u]) return !0;
|
|
849
849
|
for (var l in this.props) if (!(l in t)) return !0;
|
|
850
850
|
return !1;
|
|
851
851
|
};
|
|
852
852
|
function Vi(t, e) {
|
|
853
853
|
return qe(function() {
|
|
854
|
-
return
|
|
854
|
+
return Y(t, e);
|
|
855
855
|
})[0];
|
|
856
856
|
}
|
|
857
857
|
var Nn = function(t) {
|
|
@@ -865,143 +865,117 @@ function xn() {
|
|
|
865
865
|
});
|
|
866
866
|
}
|
|
867
867
|
function ji() {
|
|
868
|
-
$i.push(this) === 1 && (
|
|
868
|
+
$i.push(this) === 1 && (k.requestAnimationFrame || Nn)(xn);
|
|
869
869
|
}
|
|
870
870
|
const ri = {
|
|
871
871
|
inline: !1,
|
|
872
872
|
layout: "expanded",
|
|
873
873
|
position: "bottom-right",
|
|
874
|
-
styles: {
|
|
875
|
-
backgroundColor: "#ffffff",
|
|
876
|
-
textColor: "#1f2937"
|
|
877
|
-
},
|
|
878
874
|
showCaptions: !1,
|
|
879
875
|
showTextInput: !1,
|
|
880
876
|
showMuteButton: !0,
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
textContents: {
|
|
884
|
-
callToAction: "Talk to our assistant",
|
|
885
|
-
connecting: "Connecting...",
|
|
886
|
-
listening: "Listening...",
|
|
887
|
-
speaking: "Speaking...",
|
|
888
|
-
endCall: "End",
|
|
889
|
-
sendMessage: "Send",
|
|
890
|
-
placeholder: "Type a message..."
|
|
891
|
-
}
|
|
892
|
-
};
|
|
893
|
-
function On(t) {
|
|
894
|
-
if (!t) return {};
|
|
895
|
-
const e = { ...t };
|
|
896
|
-
if ("mode" in e && !("layout" in e))
|
|
897
|
-
e.layout = e.mode, delete e.mode;
|
|
898
|
-
else if ("layout" in e) {
|
|
899
|
-
const n = e.layout;
|
|
900
|
-
(n === "inline" || n === "fixed") && (e.inline = n === "inline", "mode" in e ? (e.layout = e.mode, delete e.mode) : delete e.layout);
|
|
901
|
-
}
|
|
902
|
-
return "showTranscript" in e && !("showCaptions" in e) && (e.showCaptions = e.showTranscript, delete e.showTranscript), e;
|
|
903
|
-
}
|
|
904
|
-
const He = {
|
|
877
|
+
callToAction: "Talk to our assistant"
|
|
878
|
+
}, He = {
|
|
905
879
|
"bottom-right": { bottom: "24px", right: "24px" },
|
|
906
880
|
"bottom-left": { bottom: "24px", left: "24px" },
|
|
907
881
|
"top-right": { top: "24px", right: "24px" },
|
|
908
882
|
"top-left": { top: "24px", left: "24px" }
|
|
909
883
|
};
|
|
910
|
-
function
|
|
884
|
+
function On(t) {
|
|
911
885
|
if (He[t])
|
|
912
886
|
return He[t];
|
|
913
887
|
const e = t.match(/^\[(.+)\]$/);
|
|
914
888
|
if (!e) return He["bottom-right"];
|
|
915
889
|
const n = {};
|
|
916
890
|
for (const o of e[1].split(",")) {
|
|
917
|
-
const
|
|
891
|
+
const c = o.trim(), a = c.lastIndexOf("-");
|
|
918
892
|
if (a <= 0) continue;
|
|
919
|
-
const
|
|
920
|
-
n[
|
|
893
|
+
const u = c.slice(0, a), l = c.slice(a + 1);
|
|
894
|
+
n[u] = /^\d+$/.test(l) ? `${l}px` : l;
|
|
921
895
|
}
|
|
922
896
|
return Object.keys(n).length > 0 ? n : He["bottom-right"];
|
|
923
897
|
}
|
|
924
898
|
var ft = {}, Ne = {}, oi;
|
|
925
|
-
function
|
|
899
|
+
function kn() {
|
|
926
900
|
if (oi) return Ne;
|
|
927
|
-
oi = 1, Ne.byteLength = l, Ne.toByteArray = p, Ne.fromByteArray =
|
|
928
|
-
for (var t = [], e = [], n = typeof Uint8Array < "u" ? Uint8Array : Array, o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
|
929
|
-
t[
|
|
901
|
+
oi = 1, Ne.byteLength = l, Ne.toByteArray = p, Ne.fromByteArray = y;
|
|
902
|
+
for (var t = [], e = [], n = typeof Uint8Array < "u" ? Uint8Array : Array, o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", c = 0, a = o.length; c < a; ++c)
|
|
903
|
+
t[c] = o[c], e[o.charCodeAt(c)] = c;
|
|
930
904
|
e[45] = 62, e[95] = 63;
|
|
931
|
-
function
|
|
932
|
-
var
|
|
933
|
-
if (
|
|
905
|
+
function u(g) {
|
|
906
|
+
var S = g.length;
|
|
907
|
+
if (S % 4 > 0)
|
|
934
908
|
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
935
|
-
var
|
|
936
|
-
|
|
937
|
-
var A =
|
|
938
|
-
return [
|
|
909
|
+
var C = g.indexOf("=");
|
|
910
|
+
C === -1 && (C = S);
|
|
911
|
+
var A = C === S ? 0 : 4 - C % 4;
|
|
912
|
+
return [C, A];
|
|
939
913
|
}
|
|
940
914
|
function l(g) {
|
|
941
|
-
var
|
|
942
|
-
return (
|
|
915
|
+
var S = u(g), C = S[0], A = S[1];
|
|
916
|
+
return (C + A) * 3 / 4 - A;
|
|
943
917
|
}
|
|
944
|
-
function m(g,
|
|
945
|
-
return (
|
|
918
|
+
function m(g, S, C) {
|
|
919
|
+
return (S + C) * 3 / 4 - C;
|
|
946
920
|
}
|
|
947
921
|
function p(g) {
|
|
948
|
-
var
|
|
949
|
-
for (
|
|
950
|
-
|
|
951
|
-
return
|
|
922
|
+
var S, C = u(g), A = C[0], I = C[1], b = new n(m(g, A, I)), T = 0, D = I > 0 ? A - 4 : A, x;
|
|
923
|
+
for (x = 0; x < D; x += 4)
|
|
924
|
+
S = e[g.charCodeAt(x)] << 18 | e[g.charCodeAt(x + 1)] << 12 | e[g.charCodeAt(x + 2)] << 6 | e[g.charCodeAt(x + 3)], b[T++] = S >> 16 & 255, b[T++] = S >> 8 & 255, b[T++] = S & 255;
|
|
925
|
+
return I === 2 && (S = e[g.charCodeAt(x)] << 2 | e[g.charCodeAt(x + 1)] >> 4, b[T++] = S & 255), I === 1 && (S = e[g.charCodeAt(x)] << 10 | e[g.charCodeAt(x + 1)] << 4 | e[g.charCodeAt(x + 2)] >> 2, b[T++] = S >> 8 & 255, b[T++] = S & 255), b;
|
|
952
926
|
}
|
|
953
927
|
function _(g) {
|
|
954
928
|
return t[g >> 18 & 63] + t[g >> 12 & 63] + t[g >> 6 & 63] + t[g & 63];
|
|
955
929
|
}
|
|
956
|
-
function d(g,
|
|
957
|
-
for (var A,
|
|
958
|
-
A = (g[
|
|
959
|
-
return
|
|
930
|
+
function d(g, S, C) {
|
|
931
|
+
for (var A, I = [], b = S; b < C; b += 3)
|
|
932
|
+
A = (g[b] << 16 & 16711680) + (g[b + 1] << 8 & 65280) + (g[b + 2] & 255), I.push(_(A));
|
|
933
|
+
return I.join("");
|
|
960
934
|
}
|
|
961
|
-
function
|
|
962
|
-
for (var
|
|
963
|
-
|
|
964
|
-
return A === 1 ? (
|
|
965
|
-
t[
|
|
966
|
-
)) : A === 2 && (
|
|
967
|
-
t[
|
|
968
|
-
)),
|
|
935
|
+
function y(g) {
|
|
936
|
+
for (var S, C = g.length, A = C % 3, I = [], b = 16383, T = 0, D = C - A; T < D; T += b)
|
|
937
|
+
I.push(d(g, T, T + b > D ? D : T + b));
|
|
938
|
+
return A === 1 ? (S = g[C - 1], I.push(
|
|
939
|
+
t[S >> 2] + t[S << 4 & 63] + "=="
|
|
940
|
+
)) : A === 2 && (S = (g[C - 2] << 8) + g[C - 1], I.push(
|
|
941
|
+
t[S >> 10] + t[S >> 4 & 63] + t[S << 2 & 63] + "="
|
|
942
|
+
)), I.join("");
|
|
969
943
|
}
|
|
970
944
|
return Ne;
|
|
971
945
|
}
|
|
972
946
|
var We = {};
|
|
973
947
|
var si;
|
|
974
|
-
function
|
|
975
|
-
return si || (si = 1, We.read = function(t, e, n, o,
|
|
976
|
-
var a,
|
|
977
|
-
for (d +=
|
|
948
|
+
function Dn() {
|
|
949
|
+
return si || (si = 1, We.read = function(t, e, n, o, c) {
|
|
950
|
+
var a, u, l = c * 8 - o - 1, m = (1 << l) - 1, p = m >> 1, _ = -7, d = n ? c - 1 : 0, y = n ? -1 : 1, g = t[e + d];
|
|
951
|
+
for (d += y, a = g & (1 << -_) - 1, g >>= -_, _ += l; _ > 0; a = a * 256 + t[e + d], d += y, _ -= 8)
|
|
978
952
|
;
|
|
979
|
-
for (
|
|
953
|
+
for (u = a & (1 << -_) - 1, a >>= -_, _ += o; _ > 0; u = u * 256 + t[e + d], d += y, _ -= 8)
|
|
980
954
|
;
|
|
981
955
|
if (a === 0)
|
|
982
956
|
a = 1 - p;
|
|
983
957
|
else {
|
|
984
958
|
if (a === m)
|
|
985
|
-
return
|
|
986
|
-
|
|
959
|
+
return u ? NaN : (g ? -1 : 1) * (1 / 0);
|
|
960
|
+
u = u + Math.pow(2, o), a = a - p;
|
|
987
961
|
}
|
|
988
|
-
return (g ? -1 : 1) *
|
|
989
|
-
}, We.write = function(t, e, n, o,
|
|
990
|
-
var
|
|
991
|
-
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (l = isNaN(e) ? 1 : 0,
|
|
962
|
+
return (g ? -1 : 1) * u * Math.pow(2, a - o);
|
|
963
|
+
}, We.write = function(t, e, n, o, c, a) {
|
|
964
|
+
var u, l, m, p = a * 8 - c - 1, _ = (1 << p) - 1, d = _ >> 1, y = c === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, g = o ? 0 : a - 1, S = o ? 1 : -1, C = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
|
|
965
|
+
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 += y / m : e += y * 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 += S, l /= 256, c -= 8)
|
|
992
966
|
;
|
|
993
|
-
for (
|
|
967
|
+
for (u = u << c | l, p += c; p > 0; t[n + g] = u & 255, g += S, u /= 256, p -= 8)
|
|
994
968
|
;
|
|
995
|
-
t[n + g -
|
|
969
|
+
t[n + g - S] |= C * 128;
|
|
996
970
|
}), We;
|
|
997
971
|
}
|
|
998
972
|
var ai;
|
|
999
973
|
function Un() {
|
|
1000
974
|
return ai || (ai = 1, (function(t) {
|
|
1001
|
-
const e =
|
|
1002
|
-
t.Buffer = l, t.SlowBuffer =
|
|
1003
|
-
const
|
|
1004
|
-
t.kMaxLength =
|
|
975
|
+
const e = kn(), n = Dn(), o = typeof Symbol == "function" && typeof Symbol.for == "function" ? /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom") : null;
|
|
976
|
+
t.Buffer = l, t.SlowBuffer = b, t.INSPECT_MAX_BYTES = 50;
|
|
977
|
+
const c = 2147483647;
|
|
978
|
+
t.kMaxLength = c, l.TYPED_ARRAY_SUPPORT = a(), !l.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
|
|
1005
979
|
"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
|
|
1006
980
|
);
|
|
1007
981
|
function a() {
|
|
@@ -1027,8 +1001,8 @@ function Un() {
|
|
|
1027
1001
|
return this.byteOffset;
|
|
1028
1002
|
}
|
|
1029
1003
|
});
|
|
1030
|
-
function
|
|
1031
|
-
if (s >
|
|
1004
|
+
function u(s) {
|
|
1005
|
+
if (s > c)
|
|
1032
1006
|
throw new RangeError('The value "' + s + '" is invalid for option "size"');
|
|
1033
1007
|
const i = new Uint8Array(s);
|
|
1034
1008
|
return Object.setPrototypeOf(i, l.prototype), i;
|
|
@@ -1046,15 +1020,15 @@ function Un() {
|
|
|
1046
1020
|
l.poolSize = 8192;
|
|
1047
1021
|
function m(s, i, r) {
|
|
1048
1022
|
if (typeof s == "string")
|
|
1049
|
-
return
|
|
1023
|
+
return y(s, i);
|
|
1050
1024
|
if (ArrayBuffer.isView(s))
|
|
1051
|
-
return
|
|
1025
|
+
return S(s);
|
|
1052
1026
|
if (s == null)
|
|
1053
1027
|
throw new TypeError(
|
|
1054
1028
|
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof s
|
|
1055
1029
|
);
|
|
1056
1030
|
if (ee(s, ArrayBuffer) || s && ee(s.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (ee(s, SharedArrayBuffer) || s && ee(s.buffer, SharedArrayBuffer)))
|
|
1057
|
-
return
|
|
1031
|
+
return C(s, i, r);
|
|
1058
1032
|
if (typeof s == "number")
|
|
1059
1033
|
throw new TypeError(
|
|
1060
1034
|
'The "value" argument must not be of type number. Received type number'
|
|
@@ -1080,41 +1054,41 @@ function Un() {
|
|
|
1080
1054
|
throw new RangeError('The value "' + s + '" is invalid for option "size"');
|
|
1081
1055
|
}
|
|
1082
1056
|
function _(s, i, r) {
|
|
1083
|
-
return p(s), s <= 0 ?
|
|
1057
|
+
return p(s), s <= 0 ? u(s) : i !== void 0 ? typeof r == "string" ? u(s).fill(i, r) : u(s).fill(i) : u(s);
|
|
1084
1058
|
}
|
|
1085
1059
|
l.alloc = function(s, i, r) {
|
|
1086
1060
|
return _(s, i, r);
|
|
1087
1061
|
};
|
|
1088
1062
|
function d(s) {
|
|
1089
|
-
return p(s),
|
|
1063
|
+
return p(s), u(s < 0 ? 0 : I(s) | 0);
|
|
1090
1064
|
}
|
|
1091
1065
|
l.allocUnsafe = function(s) {
|
|
1092
1066
|
return d(s);
|
|
1093
1067
|
}, l.allocUnsafeSlow = function(s) {
|
|
1094
1068
|
return d(s);
|
|
1095
1069
|
};
|
|
1096
|
-
function
|
|
1070
|
+
function y(s, i) {
|
|
1097
1071
|
if ((typeof i != "string" || i === "") && (i = "utf8"), !l.isEncoding(i))
|
|
1098
1072
|
throw new TypeError("Unknown encoding: " + i);
|
|
1099
|
-
const r =
|
|
1100
|
-
let h =
|
|
1073
|
+
const r = T(s, i) | 0;
|
|
1074
|
+
let h = u(r);
|
|
1101
1075
|
const f = h.write(s, i);
|
|
1102
1076
|
return f !== r && (h = h.slice(0, f)), h;
|
|
1103
1077
|
}
|
|
1104
1078
|
function g(s) {
|
|
1105
|
-
const i = s.length < 0 ? 0 :
|
|
1079
|
+
const i = s.length < 0 ? 0 : I(s.length) | 0, r = u(i);
|
|
1106
1080
|
for (let h = 0; h < i; h += 1)
|
|
1107
1081
|
r[h] = s[h] & 255;
|
|
1108
1082
|
return r;
|
|
1109
1083
|
}
|
|
1110
|
-
function
|
|
1084
|
+
function S(s) {
|
|
1111
1085
|
if (ee(s, Uint8Array)) {
|
|
1112
1086
|
const i = new Uint8Array(s);
|
|
1113
|
-
return
|
|
1087
|
+
return C(i.buffer, i.byteOffset, i.byteLength);
|
|
1114
1088
|
}
|
|
1115
1089
|
return g(s);
|
|
1116
1090
|
}
|
|
1117
|
-
function
|
|
1091
|
+
function C(s, i, r) {
|
|
1118
1092
|
if (i < 0 || s.byteLength < i)
|
|
1119
1093
|
throw new RangeError('"offset" is outside of buffer bounds');
|
|
1120
1094
|
if (s.byteLength < i + (r || 0))
|
|
@@ -1124,20 +1098,20 @@ function Un() {
|
|
|
1124
1098
|
}
|
|
1125
1099
|
function A(s) {
|
|
1126
1100
|
if (l.isBuffer(s)) {
|
|
1127
|
-
const i =
|
|
1101
|
+
const i = I(s.length) | 0, r = u(i);
|
|
1128
1102
|
return r.length === 0 || s.copy(r, 0, 0, i), r;
|
|
1129
1103
|
}
|
|
1130
1104
|
if (s.length !== void 0)
|
|
1131
|
-
return typeof s.length != "number" || ut(s.length) ?
|
|
1105
|
+
return typeof s.length != "number" || ut(s.length) ? u(0) : g(s);
|
|
1132
1106
|
if (s.type === "Buffer" && Array.isArray(s.data))
|
|
1133
1107
|
return g(s.data);
|
|
1134
1108
|
}
|
|
1135
|
-
function
|
|
1136
|
-
if (s >=
|
|
1137
|
-
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" +
|
|
1109
|
+
function I(s) {
|
|
1110
|
+
if (s >= c)
|
|
1111
|
+
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + c.toString(16) + " bytes");
|
|
1138
1112
|
return s | 0;
|
|
1139
1113
|
}
|
|
1140
|
-
function
|
|
1114
|
+
function b(s) {
|
|
1141
1115
|
return +s != s && (s = 0), l.alloc(+s);
|
|
1142
1116
|
}
|
|
1143
1117
|
l.isBuffer = function(i) {
|
|
@@ -1199,7 +1173,7 @@ function Un() {
|
|
|
1199
1173
|
}
|
|
1200
1174
|
return f;
|
|
1201
1175
|
};
|
|
1202
|
-
function
|
|
1176
|
+
function T(s, i) {
|
|
1203
1177
|
if (l.isBuffer(s))
|
|
1204
1178
|
return s.length;
|
|
1205
1179
|
if (ArrayBuffer.isView(s) || ee(s, ArrayBuffer))
|
|
@@ -1235,8 +1209,8 @@ function Un() {
|
|
|
1235
1209
|
i = ("" + i).toLowerCase(), f = !0;
|
|
1236
1210
|
}
|
|
1237
1211
|
}
|
|
1238
|
-
l.byteLength =
|
|
1239
|
-
function
|
|
1212
|
+
l.byteLength = T;
|
|
1213
|
+
function D(s, i, r) {
|
|
1240
1214
|
let h = !1;
|
|
1241
1215
|
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))
|
|
1242
1216
|
return "";
|
|
@@ -1246,7 +1220,7 @@ function Un() {
|
|
|
1246
1220
|
return Zi(this, i, r);
|
|
1247
1221
|
case "utf8":
|
|
1248
1222
|
case "utf-8":
|
|
1249
|
-
return
|
|
1223
|
+
return Ut(this, i, r);
|
|
1250
1224
|
case "ascii":
|
|
1251
1225
|
return Ji(this, i, r);
|
|
1252
1226
|
case "latin1":
|
|
@@ -1265,7 +1239,7 @@ function Un() {
|
|
|
1265
1239
|
}
|
|
1266
1240
|
}
|
|
1267
1241
|
l.prototype._isBuffer = !0;
|
|
1268
|
-
function
|
|
1242
|
+
function x(s, i, r) {
|
|
1269
1243
|
const h = s[i];
|
|
1270
1244
|
s[i] = s[r], s[r] = h;
|
|
1271
1245
|
}
|
|
@@ -1274,25 +1248,25 @@ function Un() {
|
|
|
1274
1248
|
if (i % 2 !== 0)
|
|
1275
1249
|
throw new RangeError("Buffer size must be a multiple of 16-bits");
|
|
1276
1250
|
for (let r = 0; r < i; r += 2)
|
|
1277
|
-
|
|
1251
|
+
x(this, r, r + 1);
|
|
1278
1252
|
return this;
|
|
1279
1253
|
}, l.prototype.swap32 = function() {
|
|
1280
1254
|
const i = this.length;
|
|
1281
1255
|
if (i % 4 !== 0)
|
|
1282
1256
|
throw new RangeError("Buffer size must be a multiple of 32-bits");
|
|
1283
1257
|
for (let r = 0; r < i; r += 4)
|
|
1284
|
-
|
|
1258
|
+
x(this, r, r + 3), x(this, r + 1, r + 2);
|
|
1285
1259
|
return this;
|
|
1286
1260
|
}, l.prototype.swap64 = function() {
|
|
1287
1261
|
const i = this.length;
|
|
1288
1262
|
if (i % 8 !== 0)
|
|
1289
1263
|
throw new RangeError("Buffer size must be a multiple of 64-bits");
|
|
1290
1264
|
for (let r = 0; r < i; r += 8)
|
|
1291
|
-
|
|
1265
|
+
x(this, r, r + 7), x(this, r + 1, r + 6), x(this, r + 2, r + 5), x(this, r + 3, r + 4);
|
|
1292
1266
|
return this;
|
|
1293
1267
|
}, l.prototype.toString = function() {
|
|
1294
1268
|
const i = this.length;
|
|
1295
|
-
return i === 0 ? "" : arguments.length === 0 ?
|
|
1269
|
+
return i === 0 ? "" : arguments.length === 0 ? Ut(this, 0, i) : D.apply(this, arguments);
|
|
1296
1270
|
}, l.prototype.toLocaleString = l.prototype.toString, l.prototype.equals = function(i) {
|
|
1297
1271
|
if (!l.isBuffer(i)) throw new TypeError("Argument must be a Buffer");
|
|
1298
1272
|
return this === i ? !0 : l.compare(this, i) === 0;
|
|
@@ -1314,16 +1288,16 @@ function Un() {
|
|
|
1314
1288
|
if (r >= h)
|
|
1315
1289
|
return 1;
|
|
1316
1290
|
if (r >>>= 0, h >>>= 0, f >>>= 0, E >>>= 0, this === i) return 0;
|
|
1317
|
-
let v = E - f,
|
|
1318
|
-
const B = Math.min(v,
|
|
1319
|
-
for (let
|
|
1320
|
-
if (U
|
|
1321
|
-
v = U
|
|
1291
|
+
let v = E - f, R = h - r;
|
|
1292
|
+
const B = Math.min(v, R), M = this.slice(f, E), L = i.slice(r, h);
|
|
1293
|
+
for (let U = 0; U < B; ++U)
|
|
1294
|
+
if (M[U] !== L[U]) {
|
|
1295
|
+
v = M[U], R = L[U];
|
|
1322
1296
|
break;
|
|
1323
1297
|
}
|
|
1324
|
-
return v <
|
|
1298
|
+
return v < R ? -1 : R < v ? 1 : 0;
|
|
1325
1299
|
};
|
|
1326
|
-
function
|
|
1300
|
+
function Z(s, i, r, h, f) {
|
|
1327
1301
|
if (s.length === 0) return -1;
|
|
1328
1302
|
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) {
|
|
1329
1303
|
if (f) return -1;
|
|
@@ -1332,47 +1306,47 @@ function Un() {
|
|
|
1332
1306
|
if (f) r = 0;
|
|
1333
1307
|
else return -1;
|
|
1334
1308
|
if (typeof i == "string" && (i = l.from(i, h)), l.isBuffer(i))
|
|
1335
|
-
return i.length === 0 ? -1 :
|
|
1309
|
+
return i.length === 0 ? -1 : H(s, i, r, h, f);
|
|
1336
1310
|
if (typeof i == "number")
|
|
1337
|
-
return i = i & 255, typeof Uint8Array.prototype.indexOf == "function" ? f ? Uint8Array.prototype.indexOf.call(s, i, r) : Uint8Array.prototype.lastIndexOf.call(s, i, r) :
|
|
1311
|
+
return i = i & 255, typeof Uint8Array.prototype.indexOf == "function" ? f ? Uint8Array.prototype.indexOf.call(s, i, r) : Uint8Array.prototype.lastIndexOf.call(s, i, r) : H(s, [i], r, h, f);
|
|
1338
1312
|
throw new TypeError("val must be string, number or Buffer");
|
|
1339
1313
|
}
|
|
1340
|
-
function
|
|
1341
|
-
let E = 1, v = s.length,
|
|
1314
|
+
function H(s, i, r, h, f) {
|
|
1315
|
+
let E = 1, v = s.length, R = i.length;
|
|
1342
1316
|
if (h !== void 0 && (h = String(h).toLowerCase(), h === "ucs2" || h === "ucs-2" || h === "utf16le" || h === "utf-16le")) {
|
|
1343
1317
|
if (s.length < 2 || i.length < 2)
|
|
1344
1318
|
return -1;
|
|
1345
|
-
E = 2, v /= 2,
|
|
1319
|
+
E = 2, v /= 2, R /= 2, r /= 2;
|
|
1346
1320
|
}
|
|
1347
|
-
function B(L,
|
|
1348
|
-
return E === 1 ? L[
|
|
1321
|
+
function B(L, U) {
|
|
1322
|
+
return E === 1 ? L[U] : L.readUInt16BE(U * E);
|
|
1349
1323
|
}
|
|
1350
|
-
let
|
|
1324
|
+
let M;
|
|
1351
1325
|
if (f) {
|
|
1352
1326
|
let L = -1;
|
|
1353
|
-
for (
|
|
1354
|
-
if (B(s,
|
|
1355
|
-
if (L === -1 && (L =
|
|
1327
|
+
for (M = r; M < v; M++)
|
|
1328
|
+
if (B(s, M) === B(i, L === -1 ? 0 : M - L)) {
|
|
1329
|
+
if (L === -1 && (L = M), M - L + 1 === R) return L * E;
|
|
1356
1330
|
} else
|
|
1357
|
-
L !== -1 && (
|
|
1331
|
+
L !== -1 && (M -= M - L), L = -1;
|
|
1358
1332
|
} else
|
|
1359
|
-
for (r +
|
|
1333
|
+
for (r + R > v && (r = v - R), M = r; M >= 0; M--) {
|
|
1360
1334
|
let L = !0;
|
|
1361
|
-
for (let
|
|
1362
|
-
if (B(s,
|
|
1335
|
+
for (let U = 0; U < R; U++)
|
|
1336
|
+
if (B(s, M + U) !== B(i, U)) {
|
|
1363
1337
|
L = !1;
|
|
1364
1338
|
break;
|
|
1365
1339
|
}
|
|
1366
|
-
if (L) return
|
|
1340
|
+
if (L) return M;
|
|
1367
1341
|
}
|
|
1368
1342
|
return -1;
|
|
1369
1343
|
}
|
|
1370
1344
|
l.prototype.includes = function(i, r, h) {
|
|
1371
1345
|
return this.indexOf(i, r, h) !== -1;
|
|
1372
1346
|
}, l.prototype.indexOf = function(i, r, h) {
|
|
1373
|
-
return
|
|
1347
|
+
return Z(this, i, r, h, !0);
|
|
1374
1348
|
}, l.prototype.lastIndexOf = function(i, r, h) {
|
|
1375
|
-
return
|
|
1349
|
+
return Z(this, i, r, h, !1);
|
|
1376
1350
|
};
|
|
1377
1351
|
function ae(s, i, r, h) {
|
|
1378
1352
|
r = Number(r) || 0;
|
|
@@ -1382,9 +1356,9 @@ function Un() {
|
|
|
1382
1356
|
h > E / 2 && (h = E / 2);
|
|
1383
1357
|
let v;
|
|
1384
1358
|
for (v = 0; v < h; ++v) {
|
|
1385
|
-
const
|
|
1386
|
-
if (ut(
|
|
1387
|
-
s[r + v] =
|
|
1359
|
+
const R = parseInt(i.substr(v * 2, 2), 16);
|
|
1360
|
+
if (ut(R)) return v;
|
|
1361
|
+
s[r + v] = R;
|
|
1388
1362
|
}
|
|
1389
1363
|
return v;
|
|
1390
1364
|
}
|
|
@@ -1447,43 +1421,43 @@ function Un() {
|
|
|
1447
1421
|
function Yi(s, i, r) {
|
|
1448
1422
|
return i === 0 && r === s.length ? e.fromByteArray(s) : e.fromByteArray(s.slice(i, r));
|
|
1449
1423
|
}
|
|
1450
|
-
function
|
|
1424
|
+
function Ut(s, i, r) {
|
|
1451
1425
|
r = Math.min(s.length, r);
|
|
1452
1426
|
const h = [];
|
|
1453
1427
|
let f = i;
|
|
1454
1428
|
for (; f < r; ) {
|
|
1455
1429
|
const E = s[f];
|
|
1456
|
-
let v = null,
|
|
1457
|
-
if (f +
|
|
1458
|
-
let B,
|
|
1459
|
-
switch (
|
|
1430
|
+
let v = null, R = E > 239 ? 4 : E > 223 ? 3 : E > 191 ? 2 : 1;
|
|
1431
|
+
if (f + R <= r) {
|
|
1432
|
+
let B, M, L, U;
|
|
1433
|
+
switch (R) {
|
|
1460
1434
|
case 1:
|
|
1461
1435
|
E < 128 && (v = E);
|
|
1462
1436
|
break;
|
|
1463
1437
|
case 2:
|
|
1464
|
-
B = s[f + 1], (B & 192) === 128 && (
|
|
1438
|
+
B = s[f + 1], (B & 192) === 128 && (U = (E & 31) << 6 | B & 63, U > 127 && (v = U));
|
|
1465
1439
|
break;
|
|
1466
1440
|
case 3:
|
|
1467
|
-
B = s[f + 1],
|
|
1441
|
+
B = s[f + 1], M = s[f + 2], (B & 192) === 128 && (M & 192) === 128 && (U = (E & 15) << 12 | (B & 63) << 6 | M & 63, U > 2047 && (U < 55296 || U > 57343) && (v = U));
|
|
1468
1442
|
break;
|
|
1469
1443
|
case 4:
|
|
1470
|
-
B = s[f + 1],
|
|
1444
|
+
B = s[f + 1], M = s[f + 2], L = s[f + 3], (B & 192) === 128 && (M & 192) === 128 && (L & 192) === 128 && (U = (E & 15) << 18 | (B & 63) << 12 | (M & 63) << 6 | L & 63, U > 65535 && U < 1114112 && (v = U));
|
|
1471
1445
|
}
|
|
1472
1446
|
}
|
|
1473
|
-
v === null ? (v = 65533,
|
|
1447
|
+
v === null ? (v = 65533, R = 1) : v > 65535 && (v -= 65536, h.push(v >>> 10 & 1023 | 55296), v = 56320 | v & 1023), h.push(v), f += R;
|
|
1474
1448
|
}
|
|
1475
1449
|
return Ki(h);
|
|
1476
1450
|
}
|
|
1477
|
-
const
|
|
1451
|
+
const Mt = 4096;
|
|
1478
1452
|
function Ki(s) {
|
|
1479
1453
|
const i = s.length;
|
|
1480
|
-
if (i <=
|
|
1454
|
+
if (i <= Mt)
|
|
1481
1455
|
return String.fromCharCode.apply(String, s);
|
|
1482
1456
|
let r = "", h = 0;
|
|
1483
1457
|
for (; h < i; )
|
|
1484
1458
|
r += String.fromCharCode.apply(
|
|
1485
1459
|
String,
|
|
1486
|
-
s.slice(h, h +=
|
|
1460
|
+
s.slice(h, h += Mt)
|
|
1487
1461
|
);
|
|
1488
1462
|
return r;
|
|
1489
1463
|
}
|
|
@@ -1522,101 +1496,101 @@ function Un() {
|
|
|
1522
1496
|
const f = this.subarray(i, r);
|
|
1523
1497
|
return Object.setPrototypeOf(f, l.prototype), f;
|
|
1524
1498
|
};
|
|
1525
|
-
function
|
|
1499
|
+
function G(s, i, r) {
|
|
1526
1500
|
if (s % 1 !== 0 || s < 0) throw new RangeError("offset is not uint");
|
|
1527
1501
|
if (s + i > r) throw new RangeError("Trying to access beyond buffer length");
|
|
1528
1502
|
}
|
|
1529
1503
|
l.prototype.readUintLE = l.prototype.readUIntLE = function(i, r, h) {
|
|
1530
|
-
i = i >>> 0, r = r >>> 0, h ||
|
|
1504
|
+
i = i >>> 0, r = r >>> 0, h || G(i, r, this.length);
|
|
1531
1505
|
let f = this[i], E = 1, v = 0;
|
|
1532
1506
|
for (; ++v < r && (E *= 256); )
|
|
1533
1507
|
f += this[i + v] * E;
|
|
1534
1508
|
return f;
|
|
1535
1509
|
}, l.prototype.readUintBE = l.prototype.readUIntBE = function(i, r, h) {
|
|
1536
|
-
i = i >>> 0, r = r >>> 0, h ||
|
|
1510
|
+
i = i >>> 0, r = r >>> 0, h || G(i, r, this.length);
|
|
1537
1511
|
let f = this[i + --r], E = 1;
|
|
1538
1512
|
for (; r > 0 && (E *= 256); )
|
|
1539
1513
|
f += this[i + --r] * E;
|
|
1540
1514
|
return f;
|
|
1541
1515
|
}, l.prototype.readUint8 = l.prototype.readUInt8 = function(i, r) {
|
|
1542
|
-
return i = i >>> 0, r ||
|
|
1516
|
+
return i = i >>> 0, r || G(i, 1, this.length), this[i];
|
|
1543
1517
|
}, l.prototype.readUint16LE = l.prototype.readUInt16LE = function(i, r) {
|
|
1544
|
-
return i = i >>> 0, r ||
|
|
1518
|
+
return i = i >>> 0, r || G(i, 2, this.length), this[i] | this[i + 1] << 8;
|
|
1545
1519
|
}, l.prototype.readUint16BE = l.prototype.readUInt16BE = function(i, r) {
|
|
1546
|
-
return i = i >>> 0, r ||
|
|
1520
|
+
return i = i >>> 0, r || G(i, 2, this.length), this[i] << 8 | this[i + 1];
|
|
1547
1521
|
}, l.prototype.readUint32LE = l.prototype.readUInt32LE = function(i, r) {
|
|
1548
|
-
return i = i >>> 0, r ||
|
|
1522
|
+
return i = i >>> 0, r || G(i, 4, this.length), (this[i] | this[i + 1] << 8 | this[i + 2] << 16) + this[i + 3] * 16777216;
|
|
1549
1523
|
}, l.prototype.readUint32BE = l.prototype.readUInt32BE = function(i, r) {
|
|
1550
|
-
return i = i >>> 0, r ||
|
|
1524
|
+
return i = i >>> 0, r || G(i, 4, this.length), this[i] * 16777216 + (this[i + 1] << 16 | this[i + 2] << 8 | this[i + 3]);
|
|
1551
1525
|
}, l.prototype.readBigUInt64LE = ce(function(i) {
|
|
1552
|
-
i = i >>> 0,
|
|
1526
|
+
i = i >>> 0, ye(i, "offset");
|
|
1553
1527
|
const r = this[i], h = this[i + 7];
|
|
1554
1528
|
(r === void 0 || h === void 0) && Re(i, this.length - 8);
|
|
1555
1529
|
const f = r + this[++i] * 2 ** 8 + this[++i] * 2 ** 16 + this[++i] * 2 ** 24, E = this[++i] + this[++i] * 2 ** 8 + this[++i] * 2 ** 16 + h * 2 ** 24;
|
|
1556
1530
|
return BigInt(f) + (BigInt(E) << BigInt(32));
|
|
1557
1531
|
}), l.prototype.readBigUInt64BE = ce(function(i) {
|
|
1558
|
-
i = i >>> 0,
|
|
1532
|
+
i = i >>> 0, ye(i, "offset");
|
|
1559
1533
|
const r = this[i], h = this[i + 7];
|
|
1560
1534
|
(r === void 0 || h === void 0) && Re(i, this.length - 8);
|
|
1561
1535
|
const f = r * 2 ** 24 + this[++i] * 2 ** 16 + this[++i] * 2 ** 8 + this[++i], E = this[++i] * 2 ** 24 + this[++i] * 2 ** 16 + this[++i] * 2 ** 8 + h;
|
|
1562
1536
|
return (BigInt(f) << BigInt(32)) + BigInt(E);
|
|
1563
1537
|
}), l.prototype.readIntLE = function(i, r, h) {
|
|
1564
|
-
i = i >>> 0, r = r >>> 0, h ||
|
|
1538
|
+
i = i >>> 0, r = r >>> 0, h || G(i, r, this.length);
|
|
1565
1539
|
let f = this[i], E = 1, v = 0;
|
|
1566
1540
|
for (; ++v < r && (E *= 256); )
|
|
1567
1541
|
f += this[i + v] * E;
|
|
1568
1542
|
return E *= 128, f >= E && (f -= Math.pow(2, 8 * r)), f;
|
|
1569
1543
|
}, l.prototype.readIntBE = function(i, r, h) {
|
|
1570
|
-
i = i >>> 0, r = r >>> 0, h ||
|
|
1544
|
+
i = i >>> 0, r = r >>> 0, h || G(i, r, this.length);
|
|
1571
1545
|
let f = r, E = 1, v = this[i + --f];
|
|
1572
1546
|
for (; f > 0 && (E *= 256); )
|
|
1573
1547
|
v += this[i + --f] * E;
|
|
1574
1548
|
return E *= 128, v >= E && (v -= Math.pow(2, 8 * r)), v;
|
|
1575
1549
|
}, l.prototype.readInt8 = function(i, r) {
|
|
1576
|
-
return i = i >>> 0, r ||
|
|
1550
|
+
return i = i >>> 0, r || G(i, 1, this.length), this[i] & 128 ? (255 - this[i] + 1) * -1 : this[i];
|
|
1577
1551
|
}, l.prototype.readInt16LE = function(i, r) {
|
|
1578
|
-
i = i >>> 0, r ||
|
|
1552
|
+
i = i >>> 0, r || G(i, 2, this.length);
|
|
1579
1553
|
const h = this[i] | this[i + 1] << 8;
|
|
1580
1554
|
return h & 32768 ? h | 4294901760 : h;
|
|
1581
1555
|
}, l.prototype.readInt16BE = function(i, r) {
|
|
1582
|
-
i = i >>> 0, r ||
|
|
1556
|
+
i = i >>> 0, r || G(i, 2, this.length);
|
|
1583
1557
|
const h = this[i + 1] | this[i] << 8;
|
|
1584
1558
|
return h & 32768 ? h | 4294901760 : h;
|
|
1585
1559
|
}, l.prototype.readInt32LE = function(i, r) {
|
|
1586
|
-
return i = i >>> 0, r ||
|
|
1560
|
+
return i = i >>> 0, r || G(i, 4, this.length), this[i] | this[i + 1] << 8 | this[i + 2] << 16 | this[i + 3] << 24;
|
|
1587
1561
|
}, l.prototype.readInt32BE = function(i, r) {
|
|
1588
|
-
return i = i >>> 0, r ||
|
|
1562
|
+
return i = i >>> 0, r || G(i, 4, this.length), this[i] << 24 | this[i + 1] << 16 | this[i + 2] << 8 | this[i + 3];
|
|
1589
1563
|
}, l.prototype.readBigInt64LE = ce(function(i) {
|
|
1590
|
-
i = i >>> 0,
|
|
1564
|
+
i = i >>> 0, ye(i, "offset");
|
|
1591
1565
|
const r = this[i], h = this[i + 7];
|
|
1592
1566
|
(r === void 0 || h === void 0) && Re(i, this.length - 8);
|
|
1593
1567
|
const f = this[i + 4] + this[i + 5] * 2 ** 8 + this[i + 6] * 2 ** 16 + (h << 24);
|
|
1594
1568
|
return (BigInt(f) << BigInt(32)) + BigInt(r + this[++i] * 2 ** 8 + this[++i] * 2 ** 16 + this[++i] * 2 ** 24);
|
|
1595
1569
|
}), l.prototype.readBigInt64BE = ce(function(i) {
|
|
1596
|
-
i = i >>> 0,
|
|
1570
|
+
i = i >>> 0, ye(i, "offset");
|
|
1597
1571
|
const r = this[i], h = this[i + 7];
|
|
1598
1572
|
(r === void 0 || h === void 0) && Re(i, this.length - 8);
|
|
1599
1573
|
const f = (r << 24) + // Overflow
|
|
1600
1574
|
this[++i] * 2 ** 16 + this[++i] * 2 ** 8 + this[++i];
|
|
1601
1575
|
return (BigInt(f) << BigInt(32)) + BigInt(this[++i] * 2 ** 24 + this[++i] * 2 ** 16 + this[++i] * 2 ** 8 + h);
|
|
1602
1576
|
}), l.prototype.readFloatLE = function(i, r) {
|
|
1603
|
-
return i = i >>> 0, r ||
|
|
1577
|
+
return i = i >>> 0, r || G(i, 4, this.length), n.read(this, i, !0, 23, 4);
|
|
1604
1578
|
}, l.prototype.readFloatBE = function(i, r) {
|
|
1605
|
-
return i = i >>> 0, r ||
|
|
1579
|
+
return i = i >>> 0, r || G(i, 4, this.length), n.read(this, i, !1, 23, 4);
|
|
1606
1580
|
}, l.prototype.readDoubleLE = function(i, r) {
|
|
1607
|
-
return i = i >>> 0, r ||
|
|
1581
|
+
return i = i >>> 0, r || G(i, 8, this.length), n.read(this, i, !0, 52, 8);
|
|
1608
1582
|
}, l.prototype.readDoubleBE = function(i, r) {
|
|
1609
|
-
return i = i >>> 0, r ||
|
|
1583
|
+
return i = i >>> 0, r || G(i, 8, this.length), n.read(this, i, !1, 52, 8);
|
|
1610
1584
|
};
|
|
1611
|
-
function
|
|
1585
|
+
function q(s, i, r, h, f, E) {
|
|
1612
1586
|
if (!l.isBuffer(s)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
1613
1587
|
if (i > f || i < E) throw new RangeError('"value" argument is out of bounds');
|
|
1614
1588
|
if (r + h > s.length) throw new RangeError("Index out of range");
|
|
1615
1589
|
}
|
|
1616
1590
|
l.prototype.writeUintLE = l.prototype.writeUIntLE = function(i, r, h, f) {
|
|
1617
1591
|
if (i = +i, r = r >>> 0, h = h >>> 0, !f) {
|
|
1618
|
-
const
|
|
1619
|
-
|
|
1592
|
+
const R = Math.pow(2, 8 * h) - 1;
|
|
1593
|
+
q(this, i, r, h, R, 0);
|
|
1620
1594
|
}
|
|
1621
1595
|
let E = 1, v = 0;
|
|
1622
1596
|
for (this[r] = i & 255; ++v < h && (E *= 256); )
|
|
@@ -1624,23 +1598,23 @@ function Un() {
|
|
|
1624
1598
|
return r + h;
|
|
1625
1599
|
}, l.prototype.writeUintBE = l.prototype.writeUIntBE = function(i, r, h, f) {
|
|
1626
1600
|
if (i = +i, r = r >>> 0, h = h >>> 0, !f) {
|
|
1627
|
-
const
|
|
1628
|
-
|
|
1601
|
+
const R = Math.pow(2, 8 * h) - 1;
|
|
1602
|
+
q(this, i, r, h, R, 0);
|
|
1629
1603
|
}
|
|
1630
1604
|
let E = h - 1, v = 1;
|
|
1631
1605
|
for (this[r + E] = i & 255; --E >= 0 && (v *= 256); )
|
|
1632
1606
|
this[r + E] = i / v & 255;
|
|
1633
1607
|
return r + h;
|
|
1634
1608
|
}, l.prototype.writeUint8 = l.prototype.writeUInt8 = function(i, r, h) {
|
|
1635
|
-
return i = +i, r = r >>> 0, h ||
|
|
1609
|
+
return i = +i, r = r >>> 0, h || q(this, i, r, 1, 255, 0), this[r] = i & 255, r + 1;
|
|
1636
1610
|
}, l.prototype.writeUint16LE = l.prototype.writeUInt16LE = function(i, r, h) {
|
|
1637
|
-
return i = +i, r = r >>> 0, h ||
|
|
1611
|
+
return i = +i, r = r >>> 0, h || q(this, i, r, 2, 65535, 0), this[r] = i & 255, this[r + 1] = i >>> 8, r + 2;
|
|
1638
1612
|
}, l.prototype.writeUint16BE = l.prototype.writeUInt16BE = function(i, r, h) {
|
|
1639
|
-
return i = +i, r = r >>> 0, h ||
|
|
1613
|
+
return i = +i, r = r >>> 0, h || q(this, i, r, 2, 65535, 0), this[r] = i >>> 8, this[r + 1] = i & 255, r + 2;
|
|
1640
1614
|
}, l.prototype.writeUint32LE = l.prototype.writeUInt32LE = function(i, r, h) {
|
|
1641
|
-
return i = +i, r = r >>> 0, h ||
|
|
1615
|
+
return i = +i, r = r >>> 0, h || q(this, i, r, 4, 4294967295, 0), this[r + 3] = i >>> 24, this[r + 2] = i >>> 16, this[r + 1] = i >>> 8, this[r] = i & 255, r + 4;
|
|
1642
1616
|
}, l.prototype.writeUint32BE = l.prototype.writeUInt32BE = function(i, r, h) {
|
|
1643
|
-
return i = +i, r = r >>> 0, h ||
|
|
1617
|
+
return i = +i, r = r >>> 0, h || q(this, i, r, 4, 4294967295, 0), this[r] = i >>> 24, this[r + 1] = i >>> 16, this[r + 2] = i >>> 8, this[r + 3] = i & 255, r + 4;
|
|
1644
1618
|
};
|
|
1645
1619
|
function Bt(s, i, r, h, f) {
|
|
1646
1620
|
Vt(i, h, f, s, r, 7);
|
|
@@ -1663,31 +1637,31 @@ function Un() {
|
|
|
1663
1637
|
}), l.prototype.writeIntLE = function(i, r, h, f) {
|
|
1664
1638
|
if (i = +i, r = r >>> 0, !f) {
|
|
1665
1639
|
const B = Math.pow(2, 8 * h - 1);
|
|
1666
|
-
|
|
1640
|
+
q(this, i, r, h, B - 1, -B);
|
|
1667
1641
|
}
|
|
1668
|
-
let E = 0, v = 1,
|
|
1642
|
+
let E = 0, v = 1, R = 0;
|
|
1669
1643
|
for (this[r] = i & 255; ++E < h && (v *= 256); )
|
|
1670
|
-
i < 0 &&
|
|
1644
|
+
i < 0 && R === 0 && this[r + E - 1] !== 0 && (R = 1), this[r + E] = (i / v >> 0) - R & 255;
|
|
1671
1645
|
return r + h;
|
|
1672
1646
|
}, l.prototype.writeIntBE = function(i, r, h, f) {
|
|
1673
1647
|
if (i = +i, r = r >>> 0, !f) {
|
|
1674
1648
|
const B = Math.pow(2, 8 * h - 1);
|
|
1675
|
-
|
|
1649
|
+
q(this, i, r, h, B - 1, -B);
|
|
1676
1650
|
}
|
|
1677
|
-
let E = h - 1, v = 1,
|
|
1651
|
+
let E = h - 1, v = 1, R = 0;
|
|
1678
1652
|
for (this[r + E] = i & 255; --E >= 0 && (v *= 256); )
|
|
1679
|
-
i < 0 &&
|
|
1653
|
+
i < 0 && R === 0 && this[r + E + 1] !== 0 && (R = 1), this[r + E] = (i / v >> 0) - R & 255;
|
|
1680
1654
|
return r + h;
|
|
1681
1655
|
}, l.prototype.writeInt8 = function(i, r, h) {
|
|
1682
|
-
return i = +i, r = r >>> 0, h ||
|
|
1656
|
+
return i = +i, r = r >>> 0, h || q(this, i, r, 1, 127, -128), i < 0 && (i = 255 + i + 1), this[r] = i & 255, r + 1;
|
|
1683
1657
|
}, l.prototype.writeInt16LE = function(i, r, h) {
|
|
1684
|
-
return i = +i, r = r >>> 0, h ||
|
|
1658
|
+
return i = +i, r = r >>> 0, h || q(this, i, r, 2, 32767, -32768), this[r] = i & 255, this[r + 1] = i >>> 8, r + 2;
|
|
1685
1659
|
}, l.prototype.writeInt16BE = function(i, r, h) {
|
|
1686
|
-
return i = +i, r = r >>> 0, h ||
|
|
1660
|
+
return i = +i, r = r >>> 0, h || q(this, i, r, 2, 32767, -32768), this[r] = i >>> 8, this[r + 1] = i & 255, r + 2;
|
|
1687
1661
|
}, l.prototype.writeInt32LE = function(i, r, h) {
|
|
1688
|
-
return i = +i, r = r >>> 0, h ||
|
|
1662
|
+
return i = +i, r = r >>> 0, h || q(this, i, r, 4, 2147483647, -2147483648), this[r] = i & 255, this[r + 1] = i >>> 8, this[r + 2] = i >>> 16, this[r + 3] = i >>> 24, r + 4;
|
|
1689
1663
|
}, l.prototype.writeInt32BE = function(i, r, h) {
|
|
1690
|
-
return i = +i, r = r >>> 0, h ||
|
|
1664
|
+
return i = +i, r = r >>> 0, h || q(this, i, r, 4, 2147483647, -2147483648), i < 0 && (i = 4294967295 + i + 1), this[r] = i >>> 24, this[r + 1] = i >>> 16, this[r + 2] = i >>> 8, this[r + 3] = i & 255, r + 4;
|
|
1691
1665
|
}, l.prototype.writeBigInt64LE = ce(function(i, r = 0) {
|
|
1692
1666
|
return Bt(this, i, r, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
1693
1667
|
}), l.prototype.writeBigInt64BE = ce(function(i, r = 0) {
|
|
@@ -1747,17 +1721,17 @@ function Un() {
|
|
|
1747
1721
|
for (E = r; E < h; ++E)
|
|
1748
1722
|
this[E] = i;
|
|
1749
1723
|
else {
|
|
1750
|
-
const v = l.isBuffer(i) ? i : l.from(i, f),
|
|
1751
|
-
if (
|
|
1724
|
+
const v = l.isBuffer(i) ? i : l.from(i, f), R = v.length;
|
|
1725
|
+
if (R === 0)
|
|
1752
1726
|
throw new TypeError('The value "' + i + '" is invalid for argument "value"');
|
|
1753
1727
|
for (E = 0; E < h - r; ++E)
|
|
1754
|
-
this[E + r] = v[E %
|
|
1728
|
+
this[E + r] = v[E % R];
|
|
1755
1729
|
}
|
|
1756
1730
|
return this;
|
|
1757
1731
|
};
|
|
1758
|
-
const
|
|
1732
|
+
const ve = {};
|
|
1759
1733
|
function lt(s, i, r) {
|
|
1760
|
-
|
|
1734
|
+
ve[s] = class extends r {
|
|
1761
1735
|
constructor() {
|
|
1762
1736
|
super(), Object.defineProperty(this, "message", {
|
|
1763
1737
|
value: i.apply(this, arguments),
|
|
@@ -1809,22 +1783,22 @@ function Un() {
|
|
|
1809
1783
|
return `${s.slice(0, r)}${i}`;
|
|
1810
1784
|
}
|
|
1811
1785
|
function en(s, i, r) {
|
|
1812
|
-
|
|
1786
|
+
ye(i, "offset"), (s[i] === void 0 || s[i + r] === void 0) && Re(i, s.length - (r + 1));
|
|
1813
1787
|
}
|
|
1814
1788
|
function Vt(s, i, r, h, f, E) {
|
|
1815
1789
|
if (s > r || s < i) {
|
|
1816
1790
|
const v = typeof i == "bigint" ? "n" : "";
|
|
1817
|
-
let
|
|
1818
|
-
throw i === 0 || i === BigInt(0) ?
|
|
1791
|
+
let R;
|
|
1792
|
+
throw i === 0 || i === BigInt(0) ? R = `>= 0${v} and < 2${v} ** ${(E + 1) * 8}${v}` : R = `>= -(2${v} ** ${(E + 1) * 8 - 1}${v}) and < 2 ** ${(E + 1) * 8 - 1}${v}`, new ve.ERR_OUT_OF_RANGE("value", R, s);
|
|
1819
1793
|
}
|
|
1820
1794
|
en(h, f, E);
|
|
1821
1795
|
}
|
|
1822
|
-
function
|
|
1796
|
+
function ye(s, i) {
|
|
1823
1797
|
if (typeof s != "number")
|
|
1824
|
-
throw new
|
|
1798
|
+
throw new ve.ERR_INVALID_ARG_TYPE(i, "number", s);
|
|
1825
1799
|
}
|
|
1826
1800
|
function Re(s, i, r) {
|
|
1827
|
-
throw Math.floor(s) !== s ? (
|
|
1801
|
+
throw Math.floor(s) !== s ? (ye(s, r), new ve.ERR_OUT_OF_RANGE("offset", "an integer", s)) : i < 0 ? new ve.ERR_BUFFER_OUT_OF_BOUNDS() : new ve.ERR_OUT_OF_RANGE(
|
|
1828
1802
|
"offset",
|
|
1829
1803
|
`>= 0 and <= ${i}`,
|
|
1830
1804
|
s
|
|
@@ -1936,34 +1910,34 @@ function Un() {
|
|
|
1936
1910
|
}
|
|
1937
1911
|
})(ft)), ft;
|
|
1938
1912
|
}
|
|
1939
|
-
var
|
|
1940
|
-
const
|
|
1913
|
+
var Mn = Un();
|
|
1914
|
+
const Bn = "https://api.anam.ai", Ln = "/v1", Hi = {
|
|
1941
1915
|
client: "js-sdk",
|
|
1942
1916
|
version: "4.8.0"
|
|
1943
1917
|
};
|
|
1944
|
-
var
|
|
1945
|
-
function
|
|
1946
|
-
return a instanceof n ? a : new n(function(
|
|
1947
|
-
|
|
1918
|
+
var Pn = function(t, e, n, o) {
|
|
1919
|
+
function c(a) {
|
|
1920
|
+
return a instanceof n ? a : new n(function(u) {
|
|
1921
|
+
u(a);
|
|
1948
1922
|
});
|
|
1949
1923
|
}
|
|
1950
|
-
return new (n || (n = Promise))(function(a,
|
|
1924
|
+
return new (n || (n = Promise))(function(a, u) {
|
|
1951
1925
|
function l(_) {
|
|
1952
1926
|
try {
|
|
1953
1927
|
p(o.next(_));
|
|
1954
1928
|
} catch (d) {
|
|
1955
|
-
|
|
1929
|
+
u(d);
|
|
1956
1930
|
}
|
|
1957
1931
|
}
|
|
1958
1932
|
function m(_) {
|
|
1959
1933
|
try {
|
|
1960
1934
|
p(o.throw(_));
|
|
1961
1935
|
} catch (d) {
|
|
1962
|
-
|
|
1936
|
+
u(d);
|
|
1963
1937
|
}
|
|
1964
1938
|
}
|
|
1965
1939
|
function p(_) {
|
|
1966
|
-
_.done ? a(_.value) :
|
|
1940
|
+
_.done ? a(_.value) : c(_.value).then(l, m);
|
|
1967
1941
|
}
|
|
1968
1942
|
p((o = o.apply(t, e || [])).next());
|
|
1969
1943
|
});
|
|
@@ -1974,11 +1948,11 @@ var se;
|
|
|
1974
1948
|
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";
|
|
1975
1949
|
})(se || (se = {}));
|
|
1976
1950
|
let St = Wi, zi = xt, de, qi = !1;
|
|
1977
|
-
const
|
|
1951
|
+
const Fn = (t, e = xt) => {
|
|
1978
1952
|
St = t, zi = e;
|
|
1979
|
-
},
|
|
1953
|
+
}, $n = (t) => {
|
|
1980
1954
|
de = t;
|
|
1981
|
-
},
|
|
1955
|
+
}, Gn = (t) => {
|
|
1982
1956
|
qi = t;
|
|
1983
1957
|
};
|
|
1984
1958
|
let he = {
|
|
@@ -1986,20 +1960,20 @@ let he = {
|
|
|
1986
1960
|
organizationId: null,
|
|
1987
1961
|
attemptCorrelationId: null
|
|
1988
1962
|
};
|
|
1989
|
-
const
|
|
1963
|
+
const Se = (t) => {
|
|
1990
1964
|
he = Object.assign(Object.assign({}, he), t);
|
|
1991
|
-
},
|
|
1965
|
+
}, me = (t, e, n) => Pn(void 0, void 0, void 0, function* () {
|
|
1992
1966
|
if (!qi)
|
|
1993
1967
|
try {
|
|
1994
1968
|
const o = Object.assign(Object.assign({}, Hi), n);
|
|
1995
1969
|
he.sessionId && (o.sessionId = he.sessionId), he.organizationId && (o.organizationId = he.organizationId), he.attemptCorrelationId && (o.attemptCorrelationId = he.attemptCorrelationId);
|
|
1996
|
-
const
|
|
1997
|
-
let a,
|
|
1970
|
+
const c = `${zi}/metrics/client`;
|
|
1971
|
+
let a, u = {
|
|
1998
1972
|
"Content-Type": "application/json"
|
|
1999
1973
|
};
|
|
2000
|
-
de?.enabled && de?.baseUrl ? (a = `${de.baseUrl}${
|
|
1974
|
+
de?.enabled && de?.baseUrl ? (a = `${de.baseUrl}${c}`, u["X-Anam-Target-Url"] = `${St}${c}`) : a = `${St}${c}`, yield fetch(a, {
|
|
2001
1975
|
method: "POST",
|
|
2002
|
-
headers:
|
|
1976
|
+
headers: u,
|
|
2003
1977
|
body: JSON.stringify({
|
|
2004
1978
|
name: t,
|
|
2005
1979
|
value: e,
|
|
@@ -2009,94 +1983,94 @@ const we = (t) => {
|
|
|
2009
1983
|
} catch (o) {
|
|
2010
1984
|
console.error("Failed to send error metric:", o);
|
|
2011
1985
|
}
|
|
2012
|
-
}),
|
|
2013
|
-
var n, o,
|
|
1986
|
+
}), Vn = (t, e = "console") => {
|
|
1987
|
+
var n, o, c;
|
|
2014
1988
|
const a = {};
|
|
2015
1989
|
t.forEach((d) => {
|
|
2016
1990
|
a[d.type] || (a[d.type] = []), a[d.type].push(d);
|
|
2017
1991
|
});
|
|
2018
|
-
const
|
|
1992
|
+
const u = {
|
|
2019
1993
|
issues: []
|
|
2020
1994
|
}, l = ((n = a["inbound-rtp"]) === null || n === void 0 ? void 0 : n.filter((d) => d.kind === "video")) || [];
|
|
2021
|
-
l.length > 0 && (
|
|
2022
|
-
var
|
|
2023
|
-
const
|
|
2024
|
-
framesReceived: (
|
|
1995
|
+
l.length > 0 && (u.personaVideoStream = [], l.forEach((d) => {
|
|
1996
|
+
var y, g, S, C, A;
|
|
1997
|
+
const I = {
|
|
1998
|
+
framesReceived: (y = d.framesReceived) !== null && y !== void 0 ? y : "unknown",
|
|
2025
1999
|
framesDropped: (g = d.framesDropped) !== null && g !== void 0 ? g : "unknown",
|
|
2026
|
-
framesPerSecond: (
|
|
2027
|
-
packetsReceived: (
|
|
2000
|
+
framesPerSecond: (S = d.framesPerSecond) !== null && S !== void 0 ? S : "unknown",
|
|
2001
|
+
packetsReceived: (C = d.packetsReceived) !== null && C !== void 0 ? C : "unknown",
|
|
2028
2002
|
packetsLost: (A = d.packetsLost) !== null && A !== void 0 ? A : "unknown",
|
|
2029
2003
|
resolution: d.frameWidth && d.frameHeight ? `${d.frameWidth}x${d.frameHeight}` : void 0,
|
|
2030
2004
|
jitter: d.jitter !== void 0 ? d.jitter : void 0
|
|
2031
2005
|
};
|
|
2032
|
-
|
|
2006
|
+
u.personaVideoStream.push(I);
|
|
2033
2007
|
}));
|
|
2034
2008
|
const m = ((o = a["inbound-rtp"]) === null || o === void 0 ? void 0 : o.filter((d) => d.kind === "audio")) || [];
|
|
2035
|
-
m.length > 0 && (
|
|
2036
|
-
var
|
|
2037
|
-
const
|
|
2038
|
-
packetsReceived: (
|
|
2009
|
+
m.length > 0 && (u.personaAudioStream = [], m.forEach((d) => {
|
|
2010
|
+
var y, g, S;
|
|
2011
|
+
const C = {
|
|
2012
|
+
packetsReceived: (y = d.packetsReceived) !== null && y !== void 0 ? y : "unknown",
|
|
2039
2013
|
packetsLost: (g = d.packetsLost) !== null && g !== void 0 ? g : "unknown",
|
|
2040
|
-
audioLevel: (
|
|
2014
|
+
audioLevel: (S = d.audioLevel) !== null && S !== void 0 ? S : "unknown",
|
|
2041
2015
|
jitter: d.jitter !== void 0 ? d.jitter : void 0,
|
|
2042
2016
|
totalAudioEnergy: d.totalAudioEnergy !== void 0 ? d.totalAudioEnergy : void 0
|
|
2043
2017
|
};
|
|
2044
|
-
|
|
2018
|
+
u.personaAudioStream.push(C);
|
|
2045
2019
|
}));
|
|
2046
|
-
const p = ((
|
|
2047
|
-
p.length > 0 && (
|
|
2048
|
-
var
|
|
2049
|
-
const
|
|
2050
|
-
packetsSent: (
|
|
2020
|
+
const p = ((c = a["outbound-rtp"]) === null || c === void 0 ? void 0 : c.filter((d) => d.kind === "audio")) || [];
|
|
2021
|
+
p.length > 0 && (u.userAudioInput = [], p.forEach((d) => {
|
|
2022
|
+
var y, g;
|
|
2023
|
+
const S = {
|
|
2024
|
+
packetsSent: (y = d.packetsSent) !== null && y !== void 0 ? y : "unknown",
|
|
2051
2025
|
retransmittedPackets: (g = d.retransmittedPacketsSent) !== null && g !== void 0 ? g : void 0,
|
|
2052
2026
|
avgPacketSendDelay: d.totalPacketSendDelay !== void 0 ? d.totalPacketSendDelay / (d.packetsSent || 1) * 1e3 : void 0
|
|
2053
2027
|
};
|
|
2054
|
-
|
|
2055
|
-
})), a.codec && (
|
|
2056
|
-
const
|
|
2028
|
+
u.userAudioInput.push(S);
|
|
2029
|
+
})), a.codec && (u.codecs = [], a.codec.forEach((d) => {
|
|
2030
|
+
const y = {
|
|
2057
2031
|
status: d.payloadType ? "Active" : "Available",
|
|
2058
2032
|
mimeType: d.mimeType || "Unknown",
|
|
2059
2033
|
payloadType: d.payloadType || "N/A",
|
|
2060
2034
|
clockRate: d.clockRate || void 0,
|
|
2061
2035
|
channels: d.channels || void 0
|
|
2062
2036
|
};
|
|
2063
|
-
|
|
2064
|
-
})), a.transport && (
|
|
2065
|
-
const
|
|
2037
|
+
u.codecs.push(y);
|
|
2038
|
+
})), a.transport && (u.transportLayer = [], a.transport.forEach((d) => {
|
|
2039
|
+
const y = {
|
|
2066
2040
|
dtlsState: d.dtlsState || "unknown",
|
|
2067
2041
|
iceState: d.iceState || "unknown",
|
|
2068
2042
|
bytesSent: d.bytesSent || void 0,
|
|
2069
2043
|
bytesReceived: d.bytesReceived || void 0
|
|
2070
2044
|
};
|
|
2071
|
-
|
|
2045
|
+
u.transportLayer.push(y);
|
|
2072
2046
|
}));
|
|
2073
2047
|
const _ = [];
|
|
2074
2048
|
if (l.forEach((d) => {
|
|
2075
2049
|
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)`);
|
|
2076
2050
|
}), m.forEach((d) => {
|
|
2077
2051
|
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)`);
|
|
2078
|
-
}),
|
|
2079
|
-
return
|
|
2080
|
-
console.group("📊 WebRTC Session Statistics Report"),
|
|
2052
|
+
}), u.issues = _, e === "json")
|
|
2053
|
+
return u;
|
|
2054
|
+
console.group("📊 WebRTC Session Statistics Report"), u.personaVideoStream && u.personaVideoStream.length > 0 && (console.group("📹 Persona Video Stream (Inbound)"), u.personaVideoStream.forEach((d) => {
|
|
2081
2055
|
console.log(`Frames Received: ${d.framesReceived}`), console.log(`Frames Dropped: ${d.framesDropped}`), console.log(`Frames Per Second: ${d.framesPerSecond}`), console.log(`Packets Received: ${typeof d.packetsReceived == "number" ? d.packetsReceived.toLocaleString() : d.packetsReceived}`), console.log(`Packets Lost: ${d.packetsLost}`), d.resolution && console.log(`Resolution: ${d.resolution}`), d.jitter !== void 0 && console.log(`Jitter: ${d.jitter.toFixed(5)}ms`);
|
|
2082
|
-
}), console.groupEnd()),
|
|
2056
|
+
}), console.groupEnd()), u.personaAudioStream && u.personaAudioStream.length > 0 && (console.group("🔊 Persona Audio Stream (Inbound)"), u.personaAudioStream.forEach((d) => {
|
|
2083
2057
|
console.log(`Packets Received: ${typeof d.packetsReceived == "number" ? d.packetsReceived.toLocaleString() : d.packetsReceived}`), console.log(`Packets Lost: ${d.packetsLost}`), console.log(`Audio Level: ${d.audioLevel}`), d.jitter !== void 0 && console.log(`Jitter: ${d.jitter.toFixed(5)}ms`), d.totalAudioEnergy !== void 0 && console.log(`Total Audio Energy: ${d.totalAudioEnergy.toFixed(6)}`);
|
|
2084
|
-
}), console.groupEnd()),
|
|
2058
|
+
}), console.groupEnd()), u.userAudioInput && u.userAudioInput.length > 0 && (console.group("🎤 User Audio Input (Outbound)"), u.userAudioInput.forEach((d) => {
|
|
2085
2059
|
console.log(`Packets Sent: ${typeof d.packetsSent == "number" ? d.packetsSent.toLocaleString() : d.packetsSent}`), d.retransmittedPackets && console.log(`Retransmitted Packets: ${d.retransmittedPackets}`), d.avgPacketSendDelay !== void 0 && console.log(`Avg Packet Send Delay: ${d.avgPacketSendDelay.toFixed(5)}ms`);
|
|
2086
|
-
}), console.groupEnd()),
|
|
2060
|
+
}), console.groupEnd()), u.codecs && u.codecs.length > 0 && (console.group("🔧 Codecs Used"), u.codecs.forEach((d) => {
|
|
2087
2061
|
console.log(`${d.status} ${d.mimeType} - Payload Type: ${d.payloadType}`), d.clockRate && console.log(` Clock Rate: ${d.clockRate}Hz`), d.channels && console.log(` Channels: ${d.channels}`);
|
|
2088
|
-
}), console.groupEnd()),
|
|
2062
|
+
}), console.groupEnd()), u.transportLayer && u.transportLayer.length > 0 && (console.group("🚚 Transport Layer"), u.transportLayer.forEach((d) => {
|
|
2089
2063
|
console.log(`DTLS State: ${d.dtlsState}`), console.log(`ICE State: ${d.iceState}`), (d.bytesReceived || d.bytesSent) && console.log(`Data Transfer (bytes) - Sent: ${(d.bytesSent || 0).toLocaleString()}, Received: ${(d.bytesReceived || 0).toLocaleString()}`);
|
|
2090
|
-
}), console.groupEnd()),
|
|
2064
|
+
}), console.groupEnd()), u.issues.length > 0 ? (console.group("⚠️ Potential Issues Detected"), u.issues.forEach((d) => console.warn(d)), console.groupEnd()) : console.log("✅ No significant issues detected"), console.groupEnd();
|
|
2091
2065
|
};
|
|
2092
|
-
var
|
|
2066
|
+
var V;
|
|
2093
2067
|
(function(t) {
|
|
2094
2068
|
t.CLIENT_ERROR_CODE_USAGE_LIMIT_REACHED = "CLIENT_ERROR_CODE_USAGE_LIMIT_REACHED", t.CLIENT_ERROR_CODE_SPEND_CAP_REACHED = "CLIENT_ERROR_CODE_SPEND_CAP_REACHED", t.CLIENT_ERROR_CODE_VALIDATION_ERROR = "CLIENT_ERROR_CODE_VALIDATION_ERROR", t.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR = "CLIENT_ERROR_CODE_AUTHENTICATION_ERROR", t.CLIENT_ERROR_CODE_SERVER_ERROR = "CLIENT_ERROR_CODE_SERVER_ERROR", t.CLIENT_ERROR_CODE_MAX_CONCURRENT_SESSIONS_REACHED = "CLIENT_ERROR_CODE_MAX_CONCURRENT_SESSIONS_REACHED", t.CLIENT_ERROR_CODE_SERVICE_BUSY = "CLIENT_ERROR_CODE_SERVICE_BUSY", t.CLIENT_ERROR_CODE_NO_PLAN_FOUND = "CLIENT_ERROR_CODE_NO_PLAN_FOUND", t.CLIENT_ERROR_CODE_UNKNOWN_ERROR = "CLIENT_ERROR_CODE_UNKNOWN_ERROR", t.CLIENT_ERROR_CODE_CONFIGURATION_ERROR = "CLIENT_ERROR_CODE_CONFIGURATION_ERROR";
|
|
2095
|
-
})(
|
|
2069
|
+
})(V || (V = {}));
|
|
2096
2070
|
class $ extends Error {
|
|
2097
|
-
constructor(e, n, o = 500,
|
|
2098
|
-
super(e), this.name = "ClientError", this.code = n, this.statusCode = o, this.details =
|
|
2099
|
-
details:
|
|
2071
|
+
constructor(e, n, o = 500, c) {
|
|
2072
|
+
super(e), this.name = "ClientError", this.code = n, this.statusCode = o, this.details = c, Object.setPrototypeOf(this, $.prototype), me(se.CLIENT_METRIC_MEASUREMENT_ERROR, n, {
|
|
2073
|
+
details: c,
|
|
2100
2074
|
statusCode: o
|
|
2101
2075
|
});
|
|
2102
2076
|
}
|
|
@@ -2104,7 +2078,7 @@ class $ extends Error {
|
|
|
2104
2078
|
function li() {
|
|
2105
2079
|
return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : Date.now().toString(36) + Math.random().toString(36).substr(2, 9);
|
|
2106
2080
|
}
|
|
2107
|
-
function
|
|
2081
|
+
function jn(t) {
|
|
2108
2082
|
if (!(!t || !t.enabled)) {
|
|
2109
2083
|
if (!t.baseUrl)
|
|
2110
2084
|
return "API Gateway baseUrl is required when enabled";
|
|
@@ -2119,10 +2093,10 @@ function Hn(t) {
|
|
|
2119
2093
|
return "API Gateway wsPath must start with /";
|
|
2120
2094
|
}
|
|
2121
2095
|
}
|
|
2122
|
-
var
|
|
2096
|
+
var W;
|
|
2123
2097
|
(function(t) {
|
|
2124
2098
|
t.OFFER = "offer", t.ANSWER = "answer", t.ICE_CANDIDATE = "icecandidate", t.END_SESSION = "endsession", t.HEARTBEAT = "heartbeat", t.WARNING = "warning", t.TALK_STREAM_INTERRUPTED = "talkinputstreaminterrupted", t.TALK_STREAM_INPUT = "talkstream", t.SESSION_READY = "sessionready", t.AGENT_AUDIO_INPUT = "agentaudioinput", t.AGENT_AUDIO_INPUT_END = "agentaudioinputend";
|
|
2125
|
-
})(
|
|
2099
|
+
})(W || (W = {}));
|
|
2126
2100
|
var De;
|
|
2127
2101
|
(function(t) {
|
|
2128
2102
|
t.SPEECH_TEXT = "speechText", t.CLIENT_TOOL_EVENT = "clientToolEvent", t.REASONING_TEXT = "reasoningText";
|
|
@@ -2139,15 +2113,15 @@ var N;
|
|
|
2139
2113
|
(function(t) {
|
|
2140
2114
|
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";
|
|
2141
2115
|
})(N || (N = {}));
|
|
2142
|
-
var
|
|
2116
|
+
var J;
|
|
2143
2117
|
(function(t) {
|
|
2144
2118
|
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";
|
|
2145
|
-
})(
|
|
2119
|
+
})(J || (J = {}));
|
|
2146
2120
|
var _e;
|
|
2147
2121
|
(function(t) {
|
|
2148
2122
|
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";
|
|
2149
2123
|
})(_e || (_e = {}));
|
|
2150
|
-
class
|
|
2124
|
+
class Hn {
|
|
2151
2125
|
constructor(e, n) {
|
|
2152
2126
|
this.sequenceNumber = 0, this.config = e, this.signallingClient = n;
|
|
2153
2127
|
}
|
|
@@ -2185,55 +2159,55 @@ class Wn {
|
|
|
2185
2159
|
return this.config;
|
|
2186
2160
|
}
|
|
2187
2161
|
arrayBufferToBase64(e) {
|
|
2188
|
-
const n = e instanceof Uint8Array ? e : new Uint8Array(e), o = Array.from(n, (
|
|
2162
|
+
const n = e instanceof Uint8Array ? e : new Uint8Array(e), o = Array.from(n, (c) => String.fromCharCode(c)).join("");
|
|
2189
2163
|
return btoa(o);
|
|
2190
2164
|
}
|
|
2191
2165
|
}
|
|
2192
|
-
var
|
|
2193
|
-
function
|
|
2194
|
-
return a instanceof n ? a : new n(function(
|
|
2195
|
-
|
|
2166
|
+
var we = function(t, e, n, o) {
|
|
2167
|
+
function c(a) {
|
|
2168
|
+
return a instanceof n ? a : new n(function(u) {
|
|
2169
|
+
u(a);
|
|
2196
2170
|
});
|
|
2197
2171
|
}
|
|
2198
|
-
return new (n || (n = Promise))(function(a,
|
|
2172
|
+
return new (n || (n = Promise))(function(a, u) {
|
|
2199
2173
|
function l(_) {
|
|
2200
2174
|
try {
|
|
2201
2175
|
p(o.next(_));
|
|
2202
2176
|
} catch (d) {
|
|
2203
|
-
|
|
2177
|
+
u(d);
|
|
2204
2178
|
}
|
|
2205
2179
|
}
|
|
2206
2180
|
function m(_) {
|
|
2207
2181
|
try {
|
|
2208
2182
|
p(o.throw(_));
|
|
2209
2183
|
} catch (d) {
|
|
2210
|
-
|
|
2184
|
+
u(d);
|
|
2211
2185
|
}
|
|
2212
2186
|
}
|
|
2213
2187
|
function p(_) {
|
|
2214
|
-
_.done ? a(_.value) :
|
|
2188
|
+
_.done ? a(_.value) : c(_.value).then(l, m);
|
|
2215
2189
|
}
|
|
2216
2190
|
p((o = o.apply(t, e || [])).next());
|
|
2217
2191
|
});
|
|
2218
2192
|
};
|
|
2219
|
-
const
|
|
2220
|
-
class
|
|
2221
|
-
constructor(e, n, o,
|
|
2222
|
-
var
|
|
2223
|
-
if (this.stopSignal = !1, this.sendingBuffer = [], this.wsConnectionAttempts = 0, this.socket = null, this.heartBeatIntervalRef = null, this.publicEventEmitter = o, this.internalEventEmitter =
|
|
2193
|
+
const Wn = 5, zn = 5;
|
|
2194
|
+
class qn {
|
|
2195
|
+
constructor(e, n, o, c, a) {
|
|
2196
|
+
var u, l, m, p, _;
|
|
2197
|
+
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)
|
|
2224
2198
|
throw new Error("Signalling Client: sessionId is required");
|
|
2225
2199
|
this.sessionId = e;
|
|
2226
|
-
const { heartbeatIntervalSeconds: d, maxWsReconnectionAttempts:
|
|
2227
|
-
if (this.heartbeatIntervalSeconds = d ||
|
|
2200
|
+
const { heartbeatIntervalSeconds: d, maxWsReconnectionAttempts: y, url: g } = n;
|
|
2201
|
+
if (this.heartbeatIntervalSeconds = d || Wn, this.maxWsReconnectionAttempts = y || zn, !g.baseUrl)
|
|
2228
2202
|
throw new Error("Signalling Client: baseUrl is required");
|
|
2229
|
-
if (!((
|
|
2230
|
-
const
|
|
2231
|
-
|
|
2232
|
-
const A = g.protocol || "https",
|
|
2233
|
-
|
|
2203
|
+
if (!((u = this.apiGatewayConfig) === null || u === void 0) && u.enabled && (!((l = this.apiGatewayConfig) === null || l === void 0) && l.baseUrl)) {
|
|
2204
|
+
const S = new URL(this.apiGatewayConfig.baseUrl), C = (m = this.apiGatewayConfig.wsPath) !== null && m !== void 0 ? m : "/ws";
|
|
2205
|
+
S.protocol = S.protocol.replace("http", "ws"), S.pathname = C, this.url = S;
|
|
2206
|
+
const A = g.protocol || "https", I = A === "http" ? "ws" : "wss", b = `${A}://${g.baseUrl}`, T = (p = g.signallingPath) !== null && p !== void 0 ? p : "/ws", D = new URL(b);
|
|
2207
|
+
D.protocol = I === "ws" ? "ws:" : "wss:", g.port && (D.port = g.port), D.pathname = T, D.searchParams.append("session_id", e), this.url.searchParams.append("target_url", D.href);
|
|
2234
2208
|
} else {
|
|
2235
|
-
const
|
|
2236
|
-
this.url = new URL(
|
|
2209
|
+
const C = `${g.protocol || "https"}://${g.baseUrl}`;
|
|
2210
|
+
this.url = new URL(C), 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);
|
|
2237
2211
|
}
|
|
2238
2212
|
}
|
|
2239
2213
|
stop() {
|
|
@@ -2243,13 +2217,13 @@ class Yn {
|
|
|
2243
2217
|
return this.socket = new WebSocket(this.url.href), this.socket.onopen = this.onOpen.bind(this), this.socket.onclose = this.onClose.bind(this), this.socket.onerror = this.onError.bind(this), this.socket;
|
|
2244
2218
|
}
|
|
2245
2219
|
sendOffer(e) {
|
|
2246
|
-
return
|
|
2220
|
+
return we(this, void 0, void 0, function* () {
|
|
2247
2221
|
const n = {
|
|
2248
2222
|
connectionDescription: e,
|
|
2249
2223
|
userUid: this.sessionId
|
|
2250
2224
|
// TODO: this should be renamed to session Id on the server
|
|
2251
2225
|
}, o = {
|
|
2252
|
-
actionType:
|
|
2226
|
+
actionType: W.OFFER,
|
|
2253
2227
|
sessionId: this.sessionId,
|
|
2254
2228
|
payload: n
|
|
2255
2229
|
};
|
|
@@ -2257,9 +2231,9 @@ class Yn {
|
|
|
2257
2231
|
});
|
|
2258
2232
|
}
|
|
2259
2233
|
sendIceCandidate(e) {
|
|
2260
|
-
return
|
|
2234
|
+
return we(this, void 0, void 0, function* () {
|
|
2261
2235
|
const n = {
|
|
2262
|
-
actionType:
|
|
2236
|
+
actionType: W.ICE_CANDIDATE,
|
|
2263
2237
|
sessionId: this.sessionId,
|
|
2264
2238
|
payload: e.toJSON()
|
|
2265
2239
|
};
|
|
@@ -2278,9 +2252,9 @@ class Yn {
|
|
|
2278
2252
|
this.sendingBuffer.push(e);
|
|
2279
2253
|
}
|
|
2280
2254
|
sendTalkMessage(e) {
|
|
2281
|
-
return
|
|
2255
|
+
return we(this, void 0, void 0, function* () {
|
|
2282
2256
|
const n = {
|
|
2283
|
-
actionType:
|
|
2257
|
+
actionType: W.TALK_STREAM_INPUT,
|
|
2284
2258
|
sessionId: this.sessionId,
|
|
2285
2259
|
payload: e
|
|
2286
2260
|
};
|
|
@@ -2289,7 +2263,7 @@ class Yn {
|
|
|
2289
2263
|
}
|
|
2290
2264
|
sendAgentAudioInput(e) {
|
|
2291
2265
|
const n = {
|
|
2292
|
-
actionType:
|
|
2266
|
+
actionType: W.AGENT_AUDIO_INPUT,
|
|
2293
2267
|
sessionId: this.sessionId,
|
|
2294
2268
|
payload: e
|
|
2295
2269
|
};
|
|
@@ -2297,7 +2271,7 @@ class Yn {
|
|
|
2297
2271
|
}
|
|
2298
2272
|
sendAgentAudioInputEnd() {
|
|
2299
2273
|
const e = {
|
|
2300
|
-
actionType:
|
|
2274
|
+
actionType: W.AGENT_AUDIO_INPUT_END,
|
|
2301
2275
|
sessionId: this.sessionId,
|
|
2302
2276
|
payload: {}
|
|
2303
2277
|
};
|
|
@@ -2307,18 +2281,18 @@ class Yn {
|
|
|
2307
2281
|
this.socket && (this.socket.close(), this.socket = null), this.heartBeatIntervalRef && (clearInterval(this.heartBeatIntervalRef), this.heartBeatIntervalRef = null);
|
|
2308
2282
|
}
|
|
2309
2283
|
onOpen() {
|
|
2310
|
-
return
|
|
2284
|
+
return we(this, void 0, void 0, function* () {
|
|
2311
2285
|
if (!this.socket)
|
|
2312
2286
|
throw new Error("SignallingClient - onOpen: socket is null");
|
|
2313
2287
|
try {
|
|
2314
|
-
this.wsConnectionAttempts = 0, this.flushSendingBuffer(), this.socket.onmessage = this.onMessage.bind(this), this.startSendingHeartBeats(), this.internalEventEmitter.emit(
|
|
2288
|
+
this.wsConnectionAttempts = 0, this.flushSendingBuffer(), this.socket.onmessage = this.onMessage.bind(this), this.startSendingHeartBeats(), this.internalEventEmitter.emit(J.WEB_SOCKET_OPEN);
|
|
2315
2289
|
} catch (e) {
|
|
2316
2290
|
console.error("SignallingClient - onOpen: error in onOpen", e), this.publicEventEmitter.emit(N.CONNECTION_CLOSED, _e.SIGNALLING_CLIENT_CONNECTION_FAILURE);
|
|
2317
2291
|
}
|
|
2318
2292
|
});
|
|
2319
2293
|
}
|
|
2320
2294
|
onClose() {
|
|
2321
|
-
return
|
|
2295
|
+
return we(this, void 0, void 0, function* () {
|
|
2322
2296
|
this.wsConnectionAttempts += 1, !this.stopSignal && (this.wsConnectionAttempts <= this.maxWsReconnectionAttempts ? (this.socket = null, setTimeout(() => {
|
|
2323
2297
|
this.connect();
|
|
2324
2298
|
}, 100 * this.wsConnectionAttempts)) : (this.heartBeatIntervalRef && (clearInterval(this.heartBeatIntervalRef), this.heartBeatIntervalRef = null), this.publicEventEmitter.emit(N.CONNECTION_CLOSED, _e.SIGNALLING_CLIENT_CONNECTION_FAILURE)));
|
|
@@ -2335,9 +2309,9 @@ class Yn {
|
|
|
2335
2309
|
}), this.sendingBuffer = e;
|
|
2336
2310
|
}
|
|
2337
2311
|
onMessage(e) {
|
|
2338
|
-
return
|
|
2312
|
+
return we(this, void 0, void 0, function* () {
|
|
2339
2313
|
const n = JSON.parse(e.data);
|
|
2340
|
-
this.internalEventEmitter.emit(
|
|
2314
|
+
this.internalEventEmitter.emit(J.SIGNAL_MESSAGE_RECEIVED, n);
|
|
2341
2315
|
});
|
|
2342
2316
|
}
|
|
2343
2317
|
startSendingHeartBeats() {
|
|
@@ -2345,59 +2319,59 @@ class Yn {
|
|
|
2345
2319
|
throw new Error("SignallingClient - startSendingHeartBeats: socket is null");
|
|
2346
2320
|
this.heartBeatIntervalRef && console.warn("SignallingClient - startSendingHeartBeats: heartbeat interval already set");
|
|
2347
2321
|
const e = this.heartbeatIntervalSeconds * 1e3, n = {
|
|
2348
|
-
actionType:
|
|
2322
|
+
actionType: W.HEARTBEAT,
|
|
2349
2323
|
sessionId: this.sessionId,
|
|
2350
2324
|
payload: ""
|
|
2351
2325
|
}, o = JSON.stringify(n);
|
|
2352
2326
|
this.heartBeatIntervalRef = setInterval(() => {
|
|
2353
|
-
var
|
|
2354
|
-
this.stopSignal || ((
|
|
2327
|
+
var c;
|
|
2328
|
+
this.stopSignal || ((c = this.socket) === null || c === void 0 ? void 0 : c.readyState) === WebSocket.OPEN && this.socket.send(o);
|
|
2355
2329
|
}, e);
|
|
2356
2330
|
}
|
|
2357
2331
|
}
|
|
2358
|
-
function
|
|
2332
|
+
function Yn(t) {
|
|
2359
2333
|
return "brainType" in t || "llmId" in t;
|
|
2360
2334
|
}
|
|
2361
2335
|
var ci = function(t, e, n, o) {
|
|
2362
|
-
function
|
|
2363
|
-
return a instanceof n ? a : new n(function(
|
|
2364
|
-
|
|
2336
|
+
function c(a) {
|
|
2337
|
+
return a instanceof n ? a : new n(function(u) {
|
|
2338
|
+
u(a);
|
|
2365
2339
|
});
|
|
2366
2340
|
}
|
|
2367
|
-
return new (n || (n = Promise))(function(a,
|
|
2341
|
+
return new (n || (n = Promise))(function(a, u) {
|
|
2368
2342
|
function l(_) {
|
|
2369
2343
|
try {
|
|
2370
2344
|
p(o.next(_));
|
|
2371
2345
|
} catch (d) {
|
|
2372
|
-
|
|
2346
|
+
u(d);
|
|
2373
2347
|
}
|
|
2374
2348
|
}
|
|
2375
2349
|
function m(_) {
|
|
2376
2350
|
try {
|
|
2377
2351
|
p(o.throw(_));
|
|
2378
2352
|
} catch (d) {
|
|
2379
|
-
|
|
2353
|
+
u(d);
|
|
2380
2354
|
}
|
|
2381
2355
|
}
|
|
2382
2356
|
function p(_) {
|
|
2383
|
-
_.done ? a(_.value) :
|
|
2357
|
+
_.done ? a(_.value) : c(_.value).then(l, m);
|
|
2384
2358
|
}
|
|
2385
2359
|
p((o = o.apply(t, e || [])).next());
|
|
2386
2360
|
});
|
|
2387
2361
|
};
|
|
2388
|
-
class
|
|
2362
|
+
class Kn {
|
|
2389
2363
|
constructor(e, n, o) {
|
|
2390
2364
|
if (!e && !n)
|
|
2391
2365
|
throw new Error("Either sessionToken or apiKey must be provided");
|
|
2392
|
-
this.sessionToken = e || null, this.apiKey = n || null, this.baseUrl = o?.baseUrl ||
|
|
2366
|
+
this.sessionToken = e || null, this.apiKey = n || null, this.baseUrl = o?.baseUrl || Bn, this.apiVersion = o?.apiVersion || Ln, this.apiGatewayConfig = o?.apiGateway || void 0;
|
|
2393
2367
|
}
|
|
2394
2368
|
/**
|
|
2395
2369
|
* Builds URL and headers for a request, applying API Gateway configuration if enabled
|
|
2396
2370
|
*/
|
|
2397
2371
|
buildGatewayUrlAndHeaders(e, n) {
|
|
2398
|
-
var o,
|
|
2399
|
-
if (!((o = this.apiGatewayConfig) === null || o === void 0) && o.enabled && (!((
|
|
2400
|
-
const a = `${this.apiGatewayConfig.baseUrl}${e}`,
|
|
2372
|
+
var o, c;
|
|
2373
|
+
if (!((o = this.apiGatewayConfig) === null || o === void 0) && o.enabled && (!((c = this.apiGatewayConfig) === null || c === void 0) && c.baseUrl)) {
|
|
2374
|
+
const a = `${this.apiGatewayConfig.baseUrl}${e}`, u = new URL(`${this.baseUrl}${e}`), l = Object.assign(Object.assign({}, n), { "X-Anam-Target-Url": u.href });
|
|
2401
2375
|
return { url: a, headers: l };
|
|
2402
2376
|
} else
|
|
2403
2377
|
return {
|
|
@@ -2409,15 +2383,15 @@ class Jn {
|
|
|
2409
2383
|
return ci(this, void 0, void 0, function* () {
|
|
2410
2384
|
if (!this.sessionToken) {
|
|
2411
2385
|
if (!e)
|
|
2412
|
-
throw new $("Persona configuration must be provided when using apiKey",
|
|
2386
|
+
throw new $("Persona configuration must be provided when using apiKey", V.CLIENT_ERROR_CODE_VALIDATION_ERROR, 400);
|
|
2413
2387
|
this.sessionToken = yield this.unsafe_getSessionToken(e);
|
|
2414
2388
|
}
|
|
2415
2389
|
e && "brainType" in e && console.warn("Warning: brainType is deprecated and will be removed in a future version. Please use llmId instead.");
|
|
2416
2390
|
try {
|
|
2417
|
-
const o = `${this.apiVersion}/engine/session`, { url:
|
|
2391
|
+
const o = `${this.apiVersion}/engine/session`, { url: c, headers: a } = this.buildGatewayUrlAndHeaders(o, {
|
|
2418
2392
|
"Content-Type": "application/json",
|
|
2419
2393
|
Authorization: `Bearer ${this.sessionToken}`
|
|
2420
|
-
}),
|
|
2394
|
+
}), u = yield fetch(c, {
|
|
2421
2395
|
method: "POST",
|
|
2422
2396
|
headers: a,
|
|
2423
2397
|
body: JSON.stringify({
|
|
@@ -2425,28 +2399,28 @@ class Jn {
|
|
|
2425
2399
|
sessionOptions: n,
|
|
2426
2400
|
clientMetadata: Hi
|
|
2427
2401
|
})
|
|
2428
|
-
}), l = yield
|
|
2429
|
-
switch (
|
|
2402
|
+
}), l = yield u.json(), m = l.error;
|
|
2403
|
+
switch (u.status) {
|
|
2430
2404
|
case 200:
|
|
2431
2405
|
case 201:
|
|
2432
2406
|
return l;
|
|
2433
2407
|
case 400:
|
|
2434
|
-
throw new $("Invalid request to start session",
|
|
2408
|
+
throw new $("Invalid request to start session", V.CLIENT_ERROR_CODE_VALIDATION_ERROR, 400, { cause: l.message });
|
|
2435
2409
|
case 401:
|
|
2436
|
-
throw new $("Authentication failed when starting session",
|
|
2410
|
+
throw new $("Authentication failed when starting session", V.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 401, { cause: l.message });
|
|
2437
2411
|
case 402:
|
|
2438
|
-
throw new $("Please sign up for a plan to start a session",
|
|
2412
|
+
throw new $("Please sign up for a plan to start a session", V.CLIENT_ERROR_CODE_NO_PLAN_FOUND, 402, { cause: l.message });
|
|
2439
2413
|
case 403:
|
|
2440
|
-
throw new $("Authentication failed when starting session",
|
|
2414
|
+
throw new $("Authentication failed when starting session", V.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 403, { cause: l.message });
|
|
2441
2415
|
case 429:
|
|
2442
|
-
throw m === "Concurrent session limit reached" ? new $("Concurrency limit reached, please upgrade your plan",
|
|
2416
|
+
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 });
|
|
2443
2417
|
case 503:
|
|
2444
|
-
throw new $("There are no available personas, please try again later",
|
|
2418
|
+
throw new $("There are no available personas, please try again later", V.CLIENT_ERROR_CODE_SERVICE_BUSY, 503, { cause: l.message });
|
|
2445
2419
|
default:
|
|
2446
|
-
throw new $("Unknown error when starting session",
|
|
2420
|
+
throw new $("Unknown error when starting session", V.CLIENT_ERROR_CODE_SERVER_ERROR, 500, { cause: l.message });
|
|
2447
2421
|
}
|
|
2448
2422
|
} catch (o) {
|
|
2449
|
-
throw o instanceof $ ? o : new $("Failed to start session",
|
|
2423
|
+
throw o instanceof $ ? o : new $("Failed to start session", V.CLIENT_ERROR_CODE_SERVER_ERROR, 500, { cause: o instanceof Error ? o.message : String(o) });
|
|
2450
2424
|
}
|
|
2451
2425
|
});
|
|
2452
2426
|
}
|
|
@@ -2458,13 +2432,13 @@ class Jn {
|
|
|
2458
2432
|
let n = {
|
|
2459
2433
|
clientLabel: "js-sdk-api-key"
|
|
2460
2434
|
};
|
|
2461
|
-
|
|
2435
|
+
Yn(e) && (n = Object.assign(Object.assign({}, n), { personaConfig: e }));
|
|
2462
2436
|
try {
|
|
2463
|
-
const o = `${this.apiVersion}/auth/session-token`, { url:
|
|
2437
|
+
const o = `${this.apiVersion}/auth/session-token`, { url: c, headers: a } = this.buildGatewayUrlAndHeaders(o, {
|
|
2464
2438
|
"Content-Type": "application/json",
|
|
2465
2439
|
Authorization: `Bearer ${this.apiKey}`
|
|
2466
2440
|
});
|
|
2467
|
-
return (yield (yield fetch(
|
|
2441
|
+
return (yield (yield fetch(c, {
|
|
2468
2442
|
method: "POST",
|
|
2469
2443
|
headers: a,
|
|
2470
2444
|
body: JSON.stringify(n)
|
|
@@ -2478,52 +2452,52 @@ class Jn {
|
|
|
2478
2452
|
return `${this.baseUrl}${this.apiVersion}`;
|
|
2479
2453
|
}
|
|
2480
2454
|
}
|
|
2481
|
-
var
|
|
2482
|
-
function
|
|
2483
|
-
return a instanceof n ? a : new n(function(
|
|
2484
|
-
|
|
2455
|
+
var Jn = function(t, e, n, o) {
|
|
2456
|
+
function c(a) {
|
|
2457
|
+
return a instanceof n ? a : new n(function(u) {
|
|
2458
|
+
u(a);
|
|
2485
2459
|
});
|
|
2486
2460
|
}
|
|
2487
|
-
return new (n || (n = Promise))(function(a,
|
|
2461
|
+
return new (n || (n = Promise))(function(a, u) {
|
|
2488
2462
|
function l(_) {
|
|
2489
2463
|
try {
|
|
2490
2464
|
p(o.next(_));
|
|
2491
2465
|
} catch (d) {
|
|
2492
|
-
|
|
2466
|
+
u(d);
|
|
2493
2467
|
}
|
|
2494
2468
|
}
|
|
2495
2469
|
function m(_) {
|
|
2496
2470
|
try {
|
|
2497
2471
|
p(o.throw(_));
|
|
2498
2472
|
} catch (d) {
|
|
2499
|
-
|
|
2473
|
+
u(d);
|
|
2500
2474
|
}
|
|
2501
2475
|
}
|
|
2502
2476
|
function p(_) {
|
|
2503
|
-
_.done ? a(_.value) :
|
|
2477
|
+
_.done ? a(_.value) : c(_.value).then(l, m);
|
|
2504
2478
|
}
|
|
2505
2479
|
p((o = o.apply(t, e || [])).next());
|
|
2506
2480
|
});
|
|
2507
2481
|
};
|
|
2508
|
-
class
|
|
2482
|
+
class Xn {
|
|
2509
2483
|
constructor(e, n, o) {
|
|
2510
2484
|
this.baseUrl = e, this.sessionId = n, this.apiGatewayConfig = o;
|
|
2511
2485
|
}
|
|
2512
2486
|
sendTalkCommand(e) {
|
|
2513
|
-
return
|
|
2487
|
+
return Jn(this, void 0, void 0, function* () {
|
|
2514
2488
|
var n, o;
|
|
2515
2489
|
try {
|
|
2516
|
-
let
|
|
2490
|
+
let c, a = {
|
|
2517
2491
|
"Content-Type": "application/json"
|
|
2518
2492
|
};
|
|
2519
|
-
const
|
|
2493
|
+
const u = "/talk", l = `?session_id=${this.sessionId}`;
|
|
2520
2494
|
if (!((n = this.apiGatewayConfig) === null || n === void 0) && n.enabled && (!((o = this.apiGatewayConfig) === null || o === void 0) && o.baseUrl)) {
|
|
2521
|
-
|
|
2522
|
-
const p = new URL(`${this.baseUrl}${
|
|
2495
|
+
c = `${this.apiGatewayConfig.baseUrl}${u}${l}`;
|
|
2496
|
+
const p = new URL(`${this.baseUrl}${u}${l}`);
|
|
2523
2497
|
a["X-Anam-Target-Url"] = p.href;
|
|
2524
2498
|
} else
|
|
2525
|
-
|
|
2526
|
-
const m = yield fetch(
|
|
2499
|
+
c = `${this.baseUrl}${u}${l}`;
|
|
2500
|
+
const m = yield fetch(c, {
|
|
2527
2501
|
method: "POST",
|
|
2528
2502
|
headers: a,
|
|
2529
2503
|
body: JSON.stringify({
|
|
@@ -2532,13 +2506,13 @@ class Zn {
|
|
|
2532
2506
|
});
|
|
2533
2507
|
if (!m.ok)
|
|
2534
2508
|
throw new Error(`Failed to send talk command: ${m.status} ${m.statusText}`);
|
|
2535
|
-
} catch (
|
|
2536
|
-
throw console.error(
|
|
2509
|
+
} catch (c) {
|
|
2510
|
+
throw console.error(c), new Error("EngineApiRestClient - sendTalkCommand: Failed to send talk command");
|
|
2537
2511
|
}
|
|
2538
2512
|
});
|
|
2539
2513
|
}
|
|
2540
2514
|
}
|
|
2541
|
-
class
|
|
2515
|
+
class Zn {
|
|
2542
2516
|
constructor() {
|
|
2543
2517
|
this.listeners = {};
|
|
2544
2518
|
}
|
|
@@ -2554,9 +2528,9 @@ class Qn {
|
|
|
2554
2528
|
});
|
|
2555
2529
|
}
|
|
2556
2530
|
}
|
|
2557
|
-
class
|
|
2531
|
+
class Qn {
|
|
2558
2532
|
constructor(e, n) {
|
|
2559
|
-
this.messages = [], this.publicEventEmitter = e, this.internalEventEmitter = n, this.internalEventEmitter.addListener(
|
|
2533
|
+
this.messages = [], this.publicEventEmitter = e, this.internalEventEmitter = n, this.internalEventEmitter.addListener(J.WEBRTC_CHAT_MESSAGE_RECEIVED, this.processWebRtcTextMessageEvent.bind(this));
|
|
2560
2534
|
}
|
|
2561
2535
|
webRtcTextMessageEventToMessageStreamEvent(e) {
|
|
2562
2536
|
return {
|
|
@@ -2582,10 +2556,10 @@ class er {
|
|
|
2582
2556
|
content: e.content,
|
|
2583
2557
|
role: e.role,
|
|
2584
2558
|
interrupted: e.interrupted
|
|
2585
|
-
}, o = this.messages.findIndex((
|
|
2559
|
+
}, o = this.messages.findIndex((c) => c.id === n.id);
|
|
2586
2560
|
if (o !== -1) {
|
|
2587
|
-
const
|
|
2588
|
-
this.messages[o] = Object.assign(Object.assign({},
|
|
2561
|
+
const c = this.messages[o];
|
|
2562
|
+
this.messages[o] = Object.assign(Object.assign({}, c), { content: c.content + n.content, interrupted: c.interrupted || n.interrupted });
|
|
2589
2563
|
} else
|
|
2590
2564
|
this.messages.push(n);
|
|
2591
2565
|
}
|
|
@@ -2602,7 +2576,7 @@ class er {
|
|
|
2602
2576
|
n.endOfSpeech && this.publicEventEmitter.emit(N.MESSAGE_HISTORY_UPDATED, this.messages);
|
|
2603
2577
|
}
|
|
2604
2578
|
}
|
|
2605
|
-
class
|
|
2579
|
+
class er {
|
|
2606
2580
|
constructor() {
|
|
2607
2581
|
this.listeners = {};
|
|
2608
2582
|
}
|
|
@@ -2613,65 +2587,65 @@ class tr {
|
|
|
2613
2587
|
this.listeners[e] && this.listeners[e].delete(n);
|
|
2614
2588
|
}
|
|
2615
2589
|
emit(e, ...n) {
|
|
2616
|
-
if (e === N.CONNECTION_ESTABLISHED &&
|
|
2617
|
-
const [o,
|
|
2618
|
-
|
|
2590
|
+
if (e === N.CONNECTION_ESTABLISHED && me(se.CLIENT_METRIC_MEASUREMENT_CONNECTION_ESTABLISHED, "1"), e === N.CONNECTION_CLOSED) {
|
|
2591
|
+
const [o, c] = n;
|
|
2592
|
+
me(se.CLIENT_METRIC_MEASUREMENT_CONNECTION_CLOSED, o, c ? { details: c } : void 0);
|
|
2619
2593
|
}
|
|
2620
2594
|
this.listeners[e] && this.listeners[e].forEach((o) => {
|
|
2621
2595
|
o(...n);
|
|
2622
2596
|
});
|
|
2623
2597
|
}
|
|
2624
2598
|
}
|
|
2625
|
-
var
|
|
2599
|
+
var z;
|
|
2626
2600
|
(function(t) {
|
|
2627
2601
|
t[t.UNSTARTED = 0] = "UNSTARTED", t[t.STREAMING = 1] = "STREAMING", t[t.INTERRUPTED = 2] = "INTERRUPTED", t[t.ENDED = 3] = "ENDED";
|
|
2628
|
-
})(
|
|
2602
|
+
})(z || (z = {}));
|
|
2629
2603
|
var pt = function(t, e, n, o) {
|
|
2630
|
-
function
|
|
2631
|
-
return a instanceof n ? a : new n(function(
|
|
2632
|
-
|
|
2604
|
+
function c(a) {
|
|
2605
|
+
return a instanceof n ? a : new n(function(u) {
|
|
2606
|
+
u(a);
|
|
2633
2607
|
});
|
|
2634
2608
|
}
|
|
2635
|
-
return new (n || (n = Promise))(function(a,
|
|
2609
|
+
return new (n || (n = Promise))(function(a, u) {
|
|
2636
2610
|
function l(_) {
|
|
2637
2611
|
try {
|
|
2638
2612
|
p(o.next(_));
|
|
2639
2613
|
} catch (d) {
|
|
2640
|
-
|
|
2614
|
+
u(d);
|
|
2641
2615
|
}
|
|
2642
2616
|
}
|
|
2643
2617
|
function m(_) {
|
|
2644
2618
|
try {
|
|
2645
2619
|
p(o.throw(_));
|
|
2646
2620
|
} catch (d) {
|
|
2647
|
-
|
|
2621
|
+
u(d);
|
|
2648
2622
|
}
|
|
2649
2623
|
}
|
|
2650
2624
|
function p(_) {
|
|
2651
|
-
_.done ? a(_.value) :
|
|
2625
|
+
_.done ? a(_.value) : c(_.value).then(l, m);
|
|
2652
2626
|
}
|
|
2653
2627
|
p((o = o.apply(t, e || [])).next());
|
|
2654
2628
|
});
|
|
2655
2629
|
};
|
|
2656
|
-
class
|
|
2630
|
+
class tr {
|
|
2657
2631
|
constructor(e, n, o) {
|
|
2658
|
-
this.state =
|
|
2632
|
+
this.state = z.UNSTARTED, this.correlationId = e, this.internalEventEmitter = n, this.signallingClient = o, this.internalEventEmitter.addListener(J.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this));
|
|
2659
2633
|
}
|
|
2660
2634
|
onDeactivate() {
|
|
2661
|
-
this.internalEventEmitter.removeListener(
|
|
2635
|
+
this.internalEventEmitter.removeListener(J.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this));
|
|
2662
2636
|
}
|
|
2663
2637
|
onSignalMessage(e) {
|
|
2664
2638
|
return pt(this, void 0, void 0, function* () {
|
|
2665
|
-
e.actionType ===
|
|
2639
|
+
e.actionType === W.TALK_STREAM_INTERRUPTED && e.payload.correlationId === this.correlationId && (this.state = z.INTERRUPTED, this.onDeactivate());
|
|
2666
2640
|
});
|
|
2667
2641
|
}
|
|
2668
2642
|
endMessage() {
|
|
2669
2643
|
return pt(this, void 0, void 0, function* () {
|
|
2670
|
-
if (this.state ===
|
|
2644
|
+
if (this.state === z.ENDED) {
|
|
2671
2645
|
console.warn("Talk stream is already ended via end of speech. No need to call endMessage.");
|
|
2672
2646
|
return;
|
|
2673
2647
|
}
|
|
2674
|
-
if (this.state !==
|
|
2648
|
+
if (this.state !== z.STREAMING) {
|
|
2675
2649
|
console.warn("Talk stream is not active state: " + this.state);
|
|
2676
2650
|
return;
|
|
2677
2651
|
}
|
|
@@ -2681,69 +2655,69 @@ class ir {
|
|
|
2681
2655
|
endOfSpeech: !0,
|
|
2682
2656
|
correlationId: this.correlationId
|
|
2683
2657
|
};
|
|
2684
|
-
yield this.signallingClient.sendTalkMessage(e), this.state =
|
|
2658
|
+
yield this.signallingClient.sendTalkMessage(e), this.state = z.ENDED, this.onDeactivate();
|
|
2685
2659
|
});
|
|
2686
2660
|
}
|
|
2687
2661
|
streamMessageChunk(e, n) {
|
|
2688
2662
|
return pt(this, void 0, void 0, function* () {
|
|
2689
|
-
if (this.state !==
|
|
2663
|
+
if (this.state !== z.STREAMING && this.state !== z.UNSTARTED)
|
|
2690
2664
|
throw new Error("Talk stream is not in an active state: " + this.state);
|
|
2691
2665
|
const o = {
|
|
2692
2666
|
content: e,
|
|
2693
|
-
startOfSpeech: this.state ===
|
|
2667
|
+
startOfSpeech: this.state === z.UNSTARTED,
|
|
2694
2668
|
endOfSpeech: n,
|
|
2695
2669
|
correlationId: this.correlationId
|
|
2696
2670
|
};
|
|
2697
|
-
this.state = n ?
|
|
2671
|
+
this.state = n ? z.ENDED : z.STREAMING, this.state === z.ENDED && this.onDeactivate(), yield this.signallingClient.sendTalkMessage(o);
|
|
2698
2672
|
});
|
|
2699
2673
|
}
|
|
2700
2674
|
getCorrelationId() {
|
|
2701
2675
|
return this.correlationId;
|
|
2702
2676
|
}
|
|
2703
2677
|
isActive() {
|
|
2704
|
-
return this.state ===
|
|
2678
|
+
return this.state === z.STREAMING || this.state === z.UNSTARTED;
|
|
2705
2679
|
}
|
|
2706
2680
|
getState() {
|
|
2707
2681
|
return this.state;
|
|
2708
2682
|
}
|
|
2709
2683
|
}
|
|
2710
|
-
var
|
|
2711
|
-
function
|
|
2712
|
-
return a instanceof n ? a : new n(function(
|
|
2713
|
-
|
|
2684
|
+
var K = function(t, e, n, o) {
|
|
2685
|
+
function c(a) {
|
|
2686
|
+
return a instanceof n ? a : new n(function(u) {
|
|
2687
|
+
u(a);
|
|
2714
2688
|
});
|
|
2715
2689
|
}
|
|
2716
|
-
return new (n || (n = Promise))(function(a,
|
|
2690
|
+
return new (n || (n = Promise))(function(a, u) {
|
|
2717
2691
|
function l(_) {
|
|
2718
2692
|
try {
|
|
2719
2693
|
p(o.next(_));
|
|
2720
2694
|
} catch (d) {
|
|
2721
|
-
|
|
2695
|
+
u(d);
|
|
2722
2696
|
}
|
|
2723
2697
|
}
|
|
2724
2698
|
function m(_) {
|
|
2725
2699
|
try {
|
|
2726
2700
|
p(o.throw(_));
|
|
2727
2701
|
} catch (d) {
|
|
2728
|
-
|
|
2702
|
+
u(d);
|
|
2729
2703
|
}
|
|
2730
2704
|
}
|
|
2731
2705
|
function p(_) {
|
|
2732
|
-
_.done ? a(_.value) :
|
|
2706
|
+
_.done ? a(_.value) : c(_.value).then(l, m);
|
|
2733
2707
|
}
|
|
2734
2708
|
p((o = o.apply(t, e || [])).next());
|
|
2735
2709
|
});
|
|
2736
2710
|
};
|
|
2737
|
-
const
|
|
2738
|
-
class
|
|
2739
|
-
constructor(e, n, o,
|
|
2740
|
-
var a,
|
|
2711
|
+
const ir = 15e3, nr = 5e3, rr = 2;
|
|
2712
|
+
class or {
|
|
2713
|
+
constructor(e, n, o, c) {
|
|
2714
|
+
var a, u, l, m;
|
|
2741
2715
|
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 = {
|
|
2742
2716
|
isMuted: !1,
|
|
2743
2717
|
permissionState: fe.NOT_REQUESTED
|
|
2744
|
-
}, this.successMetricPoller = null, this.successMetricFired = !1, this.showPeerConnectionStatsReport = !1, this.peerConnectionStatsReportOutputFormat = "console", this.statsCollectionInterval = null, this.agentAudioInputStream = null, this.publicEventEmitter = o, this.internalEventEmitter =
|
|
2718
|
+
}, 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;
|
|
2745
2719
|
const { inputAudio: p } = n;
|
|
2746
|
-
this.inputAudioState = p.inputAudioState, n.inputAudio.userProvidedMediaStream && (this.inputAudioStream = n.inputAudio.userProvidedMediaStream), this.disableInputAudio = n.inputAudio.disableInputAudio === !0, this.internalEventEmitter.addListener(
|
|
2720
|
+
this.inputAudioState = p.inputAudioState, n.inputAudio.userProvidedMediaStream && (this.inputAudioStream = n.inputAudio.userProvidedMediaStream), this.disableInputAudio = n.inputAudio.disableInputAudio === !0, this.internalEventEmitter.addListener(J.WEB_SOCKET_OPEN, this.onSignallingClientConnected.bind(this)), this.internalEventEmitter.addListener(J.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this)), this.iceServers = n.iceServers, this.signallingClient = new qn(e, n.signalling, this.publicEventEmitter, this.internalEventEmitter, this.apiGatewayConfig), this.engineApiRestClient = new Xn(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";
|
|
2747
2721
|
}
|
|
2748
2722
|
onInputAudioStateChange(e, n) {
|
|
2749
2723
|
e.isMuted !== n.isMuted && (n.isMuted ? this.muteAllAudioTracks() : this.unmuteAllAudioTracks());
|
|
@@ -2761,7 +2735,7 @@ class sr {
|
|
|
2761
2735
|
});
|
|
2762
2736
|
}
|
|
2763
2737
|
startStatsCollection() {
|
|
2764
|
-
this.statsCollectionInterval || (this.statsCollectionInterval = setInterval(() =>
|
|
2738
|
+
this.statsCollectionInterval || (this.statsCollectionInterval = setInterval(() => K(this, void 0, void 0, function* () {
|
|
2765
2739
|
if (!(!this.peerConnection || !this.dataChannel || this.dataChannel.readyState !== "open"))
|
|
2766
2740
|
try {
|
|
2767
2741
|
const e = yield this.peerConnection.getStats();
|
|
@@ -2769,7 +2743,7 @@ class sr {
|
|
|
2769
2743
|
} catch (e) {
|
|
2770
2744
|
console.error("Failed to collect and send stats:", e);
|
|
2771
2745
|
}
|
|
2772
|
-
}),
|
|
2746
|
+
}), nr));
|
|
2773
2747
|
}
|
|
2774
2748
|
sendClientSideMetrics(e) {
|
|
2775
2749
|
e.forEach((n) => {
|
|
@@ -2787,19 +2761,19 @@ class sr {
|
|
|
2787
2761
|
return;
|
|
2788
2762
|
const e = setTimeout(() => {
|
|
2789
2763
|
this.successMetricPoller && (console.warn("No video frames received, there is a problem with the connection."), clearInterval(this.successMetricPoller), this.successMetricPoller = null);
|
|
2790
|
-
},
|
|
2791
|
-
this.successMetricPoller = setInterval(() =>
|
|
2764
|
+
}, ir);
|
|
2765
|
+
this.successMetricPoller = setInterval(() => K(this, void 0, void 0, function* () {
|
|
2792
2766
|
if (!this.peerConnection || this.successMetricFired) {
|
|
2793
2767
|
this.successMetricPoller && clearInterval(this.successMetricPoller), clearTimeout(e);
|
|
2794
2768
|
return;
|
|
2795
2769
|
}
|
|
2796
2770
|
try {
|
|
2797
2771
|
const n = yield this.peerConnection.getStats();
|
|
2798
|
-
let o = !1,
|
|
2772
|
+
let o = !1, c = null;
|
|
2799
2773
|
n.forEach((a) => {
|
|
2800
|
-
a.type === "inbound-rtp" && a.kind === "video" && (a.framesDecoded !== void 0 && a.framesDecoded > 0 ? (o = !0,
|
|
2801
|
-
a.bytesReceived > 1e5 && (o = !0,
|
|
2802
|
-
}), o && !this.successMetricFired && (this.successMetricFired = !0,
|
|
2774
|
+
a.type === "inbound-rtp" && a.kind === "video" && (a.framesDecoded !== void 0 && a.framesDecoded > 0 ? (o = !0, c = "framesDecoded") : a.framesReceived !== void 0 && a.framesReceived > 0 ? (o = !0, c = "framesReceived") : a.bytesReceived > 0 && a.packetsReceived > 0 && // Additional check: ensure we've received enough data for actual video
|
|
2775
|
+
a.bytesReceived > 1e5 && (o = !0, c = "bytesReceived"));
|
|
2776
|
+
}), o && !this.successMetricFired && (this.successMetricFired = !0, me(se.CLIENT_METRIC_MEASUREMENT_SESSION_SUCCESS, "1", c ? { detectionMethod: c } : void 0), this.successMetricPoller && clearInterval(this.successMetricPoller), clearTimeout(e), this.successMetricPoller = null);
|
|
2803
2777
|
} catch {
|
|
2804
2778
|
}
|
|
2805
2779
|
}), 500);
|
|
@@ -2819,15 +2793,15 @@ class sr {
|
|
|
2819
2793
|
return this.peerConnection;
|
|
2820
2794
|
}
|
|
2821
2795
|
changeAudioInputDevice(e) {
|
|
2822
|
-
return
|
|
2796
|
+
return K(this, void 0, void 0, function* () {
|
|
2823
2797
|
if (!this.peerConnection)
|
|
2824
2798
|
throw new Error("StreamingClient - changeAudioInputDevice: peer connection is not initialized. Start streaming first.");
|
|
2825
2799
|
if (e == null)
|
|
2826
2800
|
throw new Error("StreamingClient - changeAudioInputDevice: deviceId is required");
|
|
2827
2801
|
const n = this.inputAudioState.isMuted;
|
|
2828
2802
|
try {
|
|
2829
|
-
this.inputAudioStream && this.inputAudioStream.getAudioTracks().forEach((
|
|
2830
|
-
|
|
2803
|
+
this.inputAudioStream && this.inputAudioStream.getAudioTracks().forEach((c) => {
|
|
2804
|
+
c.stop();
|
|
2831
2805
|
});
|
|
2832
2806
|
const o = {
|
|
2833
2807
|
echoCancellation: !0,
|
|
@@ -2875,68 +2849,68 @@ class sr {
|
|
|
2875
2849
|
}
|
|
2876
2850
|
}
|
|
2877
2851
|
stopConnection() {
|
|
2878
|
-
return
|
|
2852
|
+
return K(this, void 0, void 0, function* () {
|
|
2879
2853
|
yield this.shutdown();
|
|
2880
2854
|
});
|
|
2881
2855
|
}
|
|
2882
2856
|
sendTalkCommand(e) {
|
|
2883
|
-
return
|
|
2857
|
+
return K(this, void 0, void 0, function* () {
|
|
2884
2858
|
if (!this.peerConnection)
|
|
2885
2859
|
throw new Error("StreamingClient - sendTalkCommand: peer connection is null");
|
|
2886
2860
|
yield this.engineApiRestClient.sendTalkCommand(e);
|
|
2887
2861
|
});
|
|
2888
2862
|
}
|
|
2889
2863
|
startTalkMessageStream(e) {
|
|
2890
|
-
return e || (e = Math.random().toString(36).substring(2, 15)), new
|
|
2864
|
+
return e || (e = Math.random().toString(36).substring(2, 15)), new tr(e, this.internalEventEmitter, this.signallingClient);
|
|
2891
2865
|
}
|
|
2892
2866
|
createAgentAudioInputStream(e) {
|
|
2893
|
-
return this.agentAudioInputStream = new
|
|
2867
|
+
return this.agentAudioInputStream = new Hn(e, this.signallingClient), this.agentAudioInputStream;
|
|
2894
2868
|
}
|
|
2895
2869
|
getAgentAudioInputStream() {
|
|
2896
2870
|
return this.agentAudioInputStream;
|
|
2897
2871
|
}
|
|
2898
2872
|
initPeerConnection() {
|
|
2899
|
-
return
|
|
2873
|
+
return K(this, void 0, void 0, function* () {
|
|
2900
2874
|
this.peerConnection = new RTCPeerConnection({
|
|
2901
2875
|
iceServers: this.iceServers,
|
|
2902
|
-
iceCandidatePoolSize:
|
|
2876
|
+
iceCandidatePoolSize: rr
|
|
2903
2877
|
}), this.peerConnection.onicecandidate = this.onIceCandidate.bind(this), this.peerConnection.oniceconnectionstatechange = this.onIceConnectionStateChange.bind(this), this.peerConnection.onconnectionstatechange = this.onConnectionStateChange.bind(this), this.peerConnection.addEventListener("track", this.onTrackEventHandler.bind(this)), yield this.setupDataChannels(), this.peerConnection.addTransceiver("video", { direction: "recvonly" }), this.disableInputAudio ? this.peerConnection.addTransceiver("audio", { direction: "recvonly" }) : (this.peerConnection.addTransceiver("audio", { direction: "sendrecv" }), this.inputAudioStream ? yield this.setupAudioTrack() : this.requestMicrophonePermissionAsync().catch((e) => {
|
|
2904
2878
|
console.error("Async microphone permission request failed:", e);
|
|
2905
2879
|
}));
|
|
2906
2880
|
});
|
|
2907
2881
|
}
|
|
2908
2882
|
onSignalMessage(e) {
|
|
2909
|
-
return
|
|
2883
|
+
return K(this, void 0, void 0, function* () {
|
|
2910
2884
|
if (!this.peerConnection) {
|
|
2911
2885
|
console.error("StreamingClient - onSignalMessage: peerConnection is not initialized");
|
|
2912
2886
|
return;
|
|
2913
2887
|
}
|
|
2914
2888
|
switch (e.actionType) {
|
|
2915
|
-
case
|
|
2889
|
+
case W.ANSWER:
|
|
2916
2890
|
const n = e.payload;
|
|
2917
2891
|
yield this.peerConnection.setRemoteDescription(n), this.connectionReceivedAnswer = !0, this.flushRemoteIceCandidateBuffer();
|
|
2918
2892
|
break;
|
|
2919
|
-
case
|
|
2920
|
-
const o = e.payload,
|
|
2921
|
-
this.connectionReceivedAnswer ? yield this.peerConnection.addIceCandidate(
|
|
2893
|
+
case W.ICE_CANDIDATE:
|
|
2894
|
+
const o = e.payload, c = new RTCIceCandidate(o);
|
|
2895
|
+
this.connectionReceivedAnswer ? yield this.peerConnection.addIceCandidate(c) : this.remoteIceCandidateBuffer.push(c);
|
|
2922
2896
|
break;
|
|
2923
|
-
case
|
|
2897
|
+
case W.END_SESSION:
|
|
2924
2898
|
const a = e.payload;
|
|
2925
2899
|
this.publicEventEmitter.emit(N.CONNECTION_CLOSED, _e.SERVER_CLOSED_CONNECTION, a), this.shutdown();
|
|
2926
2900
|
break;
|
|
2927
|
-
case
|
|
2928
|
-
const
|
|
2929
|
-
console.warn("Warning received from server: " +
|
|
2901
|
+
case W.WARNING:
|
|
2902
|
+
const u = e.payload;
|
|
2903
|
+
console.warn("Warning received from server: " + u), this.publicEventEmitter.emit(N.SERVER_WARNING, u);
|
|
2930
2904
|
break;
|
|
2931
|
-
case
|
|
2905
|
+
case W.TALK_STREAM_INTERRUPTED:
|
|
2932
2906
|
const l = e.payload;
|
|
2933
2907
|
this.publicEventEmitter.emit(N.TALK_STREAM_INTERRUPTED, l.correlationId);
|
|
2934
2908
|
break;
|
|
2935
|
-
case
|
|
2909
|
+
case W.SESSION_READY:
|
|
2936
2910
|
const m = e.sessionId;
|
|
2937
2911
|
this.publicEventEmitter.emit(N.SESSION_READY, m);
|
|
2938
2912
|
break;
|
|
2939
|
-
case
|
|
2913
|
+
case W.HEARTBEAT:
|
|
2940
2914
|
break;
|
|
2941
2915
|
default:
|
|
2942
2916
|
console.warn("StreamingClient - onSignalMessage: unknown signal message action type. Is your anam-sdk version up to date?", e);
|
|
@@ -2944,7 +2918,7 @@ class sr {
|
|
|
2944
2918
|
});
|
|
2945
2919
|
}
|
|
2946
2920
|
onSignallingClientConnected() {
|
|
2947
|
-
return
|
|
2921
|
+
return K(this, void 0, void 0, function* () {
|
|
2948
2922
|
if (!this.peerConnection)
|
|
2949
2923
|
try {
|
|
2950
2924
|
yield this.initPeerConnectionAndSendOffer();
|
|
@@ -2989,7 +2963,7 @@ class sr {
|
|
|
2989
2963
|
this.videoElement.srcObject = this.videoStream;
|
|
2990
2964
|
const n = this.videoElement.requestVideoFrameCallback(() => {
|
|
2991
2965
|
var o;
|
|
2992
|
-
(o = this.videoElement) === null || o === void 0 || o.cancelVideoFrameCallback(n), this.publicEventEmitter.emit(N.VIDEO_PLAY_STARTED), this.successMetricFired || (this.successMetricFired = !0,
|
|
2966
|
+
(o = this.videoElement) === null || o === void 0 || o.cancelVideoFrameCallback(n), this.publicEventEmitter.emit(N.VIDEO_PLAY_STARTED), this.successMetricFired || (this.successMetricFired = !0, me(se.CLIENT_METRIC_MEASUREMENT_SESSION_SUCCESS, "1", { detectionMethod: "videoElement" }));
|
|
2993
2967
|
});
|
|
2994
2968
|
}
|
|
2995
2969
|
} else e.track.kind === "audio" && (this.audioStream = e.streams[0], this.publicEventEmitter.emit(N.AUDIO_STREAM_STARTED, this.audioStream));
|
|
@@ -2998,7 +2972,7 @@ class sr {
|
|
|
2998
2972
|
* Set up the data channels for sending and receiving messages
|
|
2999
2973
|
*/
|
|
3000
2974
|
setupDataChannels() {
|
|
3001
|
-
return
|
|
2975
|
+
return K(this, void 0, void 0, function* () {
|
|
3002
2976
|
if (!this.peerConnection) {
|
|
3003
2977
|
console.error("StreamingClient - setupDataChannels: peer connection is not initialized");
|
|
3004
2978
|
return;
|
|
@@ -3016,16 +2990,16 @@ class sr {
|
|
|
3016
2990
|
const o = JSON.parse(n.data);
|
|
3017
2991
|
switch (o.messageType) {
|
|
3018
2992
|
case De.SPEECH_TEXT:
|
|
3019
|
-
this.internalEventEmitter.emit(
|
|
2993
|
+
this.internalEventEmitter.emit(J.WEBRTC_CHAT_MESSAGE_RECEIVED, o.data);
|
|
3020
2994
|
break;
|
|
3021
2995
|
case De.CLIENT_TOOL_EVENT:
|
|
3022
|
-
const
|
|
3023
|
-
this.internalEventEmitter.emit(
|
|
3024
|
-
const a =
|
|
2996
|
+
const c = o.data;
|
|
2997
|
+
this.internalEventEmitter.emit(J.WEBRTC_CLIENT_TOOL_EVENT_RECEIVED, c);
|
|
2998
|
+
const a = sr.WebRTCClientToolEventToClientToolEvent(c);
|
|
3025
2999
|
this.publicEventEmitter.emit(N.CLIENT_TOOL_EVENT_RECEIVED, a);
|
|
3026
3000
|
break;
|
|
3027
3001
|
case De.REASONING_TEXT:
|
|
3028
|
-
this.internalEventEmitter.emit(
|
|
3002
|
+
this.internalEventEmitter.emit(J.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED, o.data);
|
|
3029
3003
|
break;
|
|
3030
3004
|
// Unknown message types are silently ignored to maintain forward compatibility
|
|
3031
3005
|
default:
|
|
@@ -3041,7 +3015,7 @@ class sr {
|
|
|
3041
3015
|
* Request microphone permission asynchronously without blocking connection
|
|
3042
3016
|
*/
|
|
3043
3017
|
requestMicrophonePermissionAsync() {
|
|
3044
|
-
return
|
|
3018
|
+
return K(this, void 0, void 0, function* () {
|
|
3045
3019
|
if (this.inputAudioState.permissionState !== fe.PENDING) {
|
|
3046
3020
|
this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: fe.PENDING }), this.publicEventEmitter.emit(N.MIC_PERMISSION_PENDING);
|
|
3047
3021
|
try {
|
|
@@ -3065,7 +3039,7 @@ class sr {
|
|
|
3065
3039
|
* Set up audio track and add it to the peer connection using replaceTrack
|
|
3066
3040
|
*/
|
|
3067
3041
|
setupAudioTrack() {
|
|
3068
|
-
return
|
|
3042
|
+
return K(this, void 0, void 0, function* () {
|
|
3069
3043
|
if (!this.peerConnection || !this.inputAudioStream)
|
|
3070
3044
|
return;
|
|
3071
3045
|
if (!this.inputAudioStream.getAudioTracks().length) {
|
|
@@ -3073,15 +3047,15 @@ class sr {
|
|
|
3073
3047
|
return;
|
|
3074
3048
|
}
|
|
3075
3049
|
this.inputAudioState.isMuted && this.muteAllAudioTracks();
|
|
3076
|
-
const e = this.inputAudioStream.getAudioTracks()[0], o = this.peerConnection.getSenders().find((
|
|
3050
|
+
const e = this.inputAudioStream.getAudioTracks()[0], o = this.peerConnection.getSenders().find((c) => {
|
|
3077
3051
|
var a;
|
|
3078
|
-
return ((a =
|
|
3052
|
+
return ((a = c.track) === null || a === void 0 ? void 0 : a.kind) === "audio" || c.track === null && c.dtmf !== null;
|
|
3079
3053
|
});
|
|
3080
3054
|
if (o)
|
|
3081
3055
|
try {
|
|
3082
3056
|
yield o.replaceTrack(e);
|
|
3083
|
-
} catch (
|
|
3084
|
-
console.error("Failed to replace audio track:",
|
|
3057
|
+
} catch (c) {
|
|
3058
|
+
console.error("Failed to replace audio track:", c), this.peerConnection.addTrack(e, this.inputAudioStream);
|
|
3085
3059
|
}
|
|
3086
3060
|
else
|
|
3087
3061
|
this.peerConnection.addTrack(e, this.inputAudioStream);
|
|
@@ -3089,7 +3063,7 @@ class sr {
|
|
|
3089
3063
|
});
|
|
3090
3064
|
}
|
|
3091
3065
|
initPeerConnectionAndSendOffer() {
|
|
3092
|
-
return
|
|
3066
|
+
return K(this, void 0, void 0, function* () {
|
|
3093
3067
|
if (yield this.initPeerConnection(), !this.peerConnection) {
|
|
3094
3068
|
console.error("StreamingClient - initPeerConnectionAndSendOffer: peer connection is not initialized");
|
|
3095
3069
|
return;
|
|
@@ -3106,12 +3080,12 @@ class sr {
|
|
|
3106
3080
|
});
|
|
3107
3081
|
}
|
|
3108
3082
|
shutdown() {
|
|
3109
|
-
return
|
|
3083
|
+
return K(this, void 0, void 0, function* () {
|
|
3110
3084
|
var e;
|
|
3111
3085
|
if (this.showPeerConnectionStatsReport) {
|
|
3112
3086
|
const n = yield (e = this.peerConnection) === null || e === void 0 ? void 0 : e.getStats();
|
|
3113
3087
|
if (n) {
|
|
3114
|
-
const o =
|
|
3088
|
+
const o = Vn(n, this.peerConnectionStatsReportOutputFormat);
|
|
3115
3089
|
o && console.log(o, void 0, 2);
|
|
3116
3090
|
}
|
|
3117
3091
|
}
|
|
@@ -3136,7 +3110,7 @@ class sr {
|
|
|
3136
3110
|
});
|
|
3137
3111
|
}
|
|
3138
3112
|
}
|
|
3139
|
-
class
|
|
3113
|
+
class sr {
|
|
3140
3114
|
/**
|
|
3141
3115
|
* Converts a WebRtcClientToolEvent to a ClientToolEvent
|
|
3142
3116
|
*/
|
|
@@ -3152,9 +3126,9 @@ class ar {
|
|
|
3152
3126
|
};
|
|
3153
3127
|
}
|
|
3154
3128
|
}
|
|
3155
|
-
class
|
|
3129
|
+
class ar {
|
|
3156
3130
|
constructor(e, n) {
|
|
3157
|
-
this.reasoning_messages = [], this.publicEventEmitter = e, this.internalEventEmitter = n, this.internalEventEmitter.addListener(
|
|
3131
|
+
this.reasoning_messages = [], this.publicEventEmitter = e, this.internalEventEmitter = n, this.internalEventEmitter.addListener(J.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED, this.processWebRtcReasoningTextMessageEvent.bind(this));
|
|
3158
3132
|
}
|
|
3159
3133
|
webRtcTextMessageEventToReasoningStreamEvent(e) {
|
|
3160
3134
|
return {
|
|
@@ -3171,74 +3145,74 @@ class lr {
|
|
|
3171
3145
|
id: n.id,
|
|
3172
3146
|
content: n.content,
|
|
3173
3147
|
role: n.role
|
|
3174
|
-
},
|
|
3175
|
-
if (
|
|
3176
|
-
const a = this.reasoning_messages[
|
|
3177
|
-
a.content += o.content, this.reasoning_messages[
|
|
3148
|
+
}, c = this.reasoning_messages.findIndex((a) => a.id === o.id);
|
|
3149
|
+
if (c !== -1) {
|
|
3150
|
+
const a = this.reasoning_messages[c];
|
|
3151
|
+
a.content += o.content, this.reasoning_messages[c] = a;
|
|
3178
3152
|
} else
|
|
3179
3153
|
this.reasoning_messages.push(o);
|
|
3180
3154
|
n.endOfThought && this.publicEventEmitter.emit(N.REASONING_HISTORY_UPDATED, this.reasoning_messages);
|
|
3181
3155
|
}
|
|
3182
3156
|
}
|
|
3183
3157
|
var ue = function(t, e, n, o) {
|
|
3184
|
-
function
|
|
3185
|
-
return a instanceof n ? a : new n(function(
|
|
3186
|
-
|
|
3158
|
+
function c(a) {
|
|
3159
|
+
return a instanceof n ? a : new n(function(u) {
|
|
3160
|
+
u(a);
|
|
3187
3161
|
});
|
|
3188
3162
|
}
|
|
3189
|
-
return new (n || (n = Promise))(function(a,
|
|
3163
|
+
return new (n || (n = Promise))(function(a, u) {
|
|
3190
3164
|
function l(_) {
|
|
3191
3165
|
try {
|
|
3192
3166
|
p(o.next(_));
|
|
3193
3167
|
} catch (d) {
|
|
3194
|
-
|
|
3168
|
+
u(d);
|
|
3195
3169
|
}
|
|
3196
3170
|
}
|
|
3197
3171
|
function m(_) {
|
|
3198
3172
|
try {
|
|
3199
3173
|
p(o.throw(_));
|
|
3200
3174
|
} catch (d) {
|
|
3201
|
-
|
|
3175
|
+
u(d);
|
|
3202
3176
|
}
|
|
3203
3177
|
}
|
|
3204
3178
|
function p(_) {
|
|
3205
|
-
_.done ? a(_.value) :
|
|
3179
|
+
_.done ? a(_.value) : c(_.value).then(l, m);
|
|
3206
3180
|
}
|
|
3207
3181
|
p((o = o.apply(t, e || [])).next());
|
|
3208
3182
|
});
|
|
3209
3183
|
};
|
|
3210
|
-
class
|
|
3184
|
+
class lr {
|
|
3211
3185
|
constructor(e, n, o) {
|
|
3212
|
-
var
|
|
3186
|
+
var c, a, u, l, m;
|
|
3213
3187
|
this.inputAudioState = {
|
|
3214
3188
|
isMuted: !1,
|
|
3215
3189
|
permissionState: fe.NOT_REQUESTED
|
|
3216
3190
|
}, this.sessionId = null, this.organizationId = null, this.streamingClient = null, this._isStreaming = !1;
|
|
3217
3191
|
const p = this.validateClientConfig(e, n, o);
|
|
3218
3192
|
if (p)
|
|
3219
|
-
throw new $(p,
|
|
3220
|
-
this.personaConfig = n, this.clientOptions = o, (!((
|
|
3193
|
+
throw new $(p, V.CLIENT_ERROR_CODE_CONFIGURATION_ERROR, 400);
|
|
3194
|
+
this.personaConfig = n, this.clientOptions = o, (!((c = o?.api) === null || c === void 0) && c.baseUrl || !((a = o?.api) === null || a === void 0) && a.apiVersion) && Fn(o.api.baseUrl || Wi, o.api.apiVersion || xt), !((l = (u = o?.api) === null || u === void 0 ? void 0 : u.apiGateway) === null || l === void 0) && l.enabled && $n(o.api.apiGateway), !((m = o?.metrics) === null || m === void 0) && m.disableClientMetrics && Gn(!0), this.publicEventEmitter = new er(), this.internalEventEmitter = new Zn(), this.apiClient = new Kn(e, o?.apiKey, o?.api), this.messageHistoryClient = new Qn(this.publicEventEmitter, this.internalEventEmitter), this.reasoningHistoryClient = new ar(this.publicEventEmitter, this.internalEventEmitter);
|
|
3221
3195
|
}
|
|
3222
3196
|
decodeJwt(e) {
|
|
3223
3197
|
try {
|
|
3224
|
-
const n = e.split(".")[1], o =
|
|
3198
|
+
const n = e.split(".")[1], o = Mn.Buffer.from(n, "base64").toString("utf8");
|
|
3225
3199
|
return JSON.parse(o);
|
|
3226
3200
|
} catch {
|
|
3227
3201
|
throw new Error("Invalid session token format");
|
|
3228
3202
|
}
|
|
3229
3203
|
}
|
|
3230
3204
|
validateClientConfig(e, n, o) {
|
|
3231
|
-
var
|
|
3205
|
+
var c, a;
|
|
3232
3206
|
if (!e && !o?.apiKey)
|
|
3233
3207
|
return "Either sessionToken or apiKey must be provided";
|
|
3234
3208
|
if (o?.apiKey && e)
|
|
3235
3209
|
return "Only one of sessionToken or apiKey should be used";
|
|
3236
|
-
const
|
|
3237
|
-
if (
|
|
3238
|
-
return
|
|
3210
|
+
const u = jn((c = o?.api) === null || c === void 0 ? void 0 : c.apiGateway);
|
|
3211
|
+
if (u)
|
|
3212
|
+
return u;
|
|
3239
3213
|
if (e) {
|
|
3240
3214
|
const l = this.decodeJwt(e);
|
|
3241
|
-
this.organizationId = l.accountId,
|
|
3215
|
+
this.organizationId = l.accountId, Se({
|
|
3242
3216
|
organizationId: this.organizationId
|
|
3243
3217
|
});
|
|
3244
3218
|
const m = (a = l.type) === null || a === void 0 ? void 0 : a.toLowerCase();
|
|
@@ -3267,54 +3241,54 @@ class cr {
|
|
|
3267
3241
|
}
|
|
3268
3242
|
startSession(e) {
|
|
3269
3243
|
return ue(this, void 0, void 0, function* () {
|
|
3270
|
-
var n, o,
|
|
3271
|
-
const
|
|
3272
|
-
this.sessionId =
|
|
3244
|
+
var n, o, c, a, u, l, m, p, _, d, y, g;
|
|
3245
|
+
const S = this.personaConfig, C = this.buildStartSessionOptionsForClient(), A = yield this.apiClient.startSession(S, C), { sessionId: I, clientConfig: b, engineHost: T, engineProtocol: D, signallingEndpoint: x } = A, { heartbeatIntervalSeconds: Z, maxWsReconnectionAttempts: H, iceServers: ae } = b;
|
|
3246
|
+
this.sessionId = I, Se({
|
|
3273
3247
|
sessionId: this.sessionId
|
|
3274
3248
|
});
|
|
3275
3249
|
const ne = !((n = this.clientOptions) === null || n === void 0) && n.iceServers ? this.clientOptions.iceServers : ae;
|
|
3276
3250
|
try {
|
|
3277
|
-
this.streamingClient = new
|
|
3251
|
+
this.streamingClient = new or(I, {
|
|
3278
3252
|
engine: {
|
|
3279
|
-
baseUrl: `${
|
|
3253
|
+
baseUrl: `${D}://${T}`
|
|
3280
3254
|
},
|
|
3281
3255
|
signalling: {
|
|
3282
|
-
heartbeatIntervalSeconds:
|
|
3283
|
-
maxWsReconnectionAttempts:
|
|
3256
|
+
heartbeatIntervalSeconds: Z,
|
|
3257
|
+
maxWsReconnectionAttempts: H,
|
|
3284
3258
|
url: {
|
|
3285
|
-
baseUrl:
|
|
3286
|
-
protocol:
|
|
3287
|
-
signallingPath:
|
|
3259
|
+
baseUrl: T,
|
|
3260
|
+
protocol: D,
|
|
3261
|
+
signallingPath: x
|
|
3288
3262
|
}
|
|
3289
3263
|
},
|
|
3290
3264
|
iceServers: ne,
|
|
3291
3265
|
inputAudio: {
|
|
3292
3266
|
inputAudioState: this.inputAudioState,
|
|
3293
3267
|
userProvidedMediaStream: !((o = this.clientOptions) === null || o === void 0) && o.disableInputAudio ? void 0 : e,
|
|
3294
|
-
audioDeviceId: (
|
|
3268
|
+
audioDeviceId: (c = this.clientOptions) === null || c === void 0 ? void 0 : c.audioDeviceId,
|
|
3295
3269
|
disableInputAudio: (a = this.clientOptions) === null || a === void 0 ? void 0 : a.disableInputAudio
|
|
3296
3270
|
},
|
|
3297
|
-
apiGateway: (l = (
|
|
3271
|
+
apiGateway: (l = (u = this.clientOptions) === null || u === void 0 ? void 0 : u.api) === null || l === void 0 ? void 0 : l.apiGateway,
|
|
3298
3272
|
metrics: {
|
|
3299
3273
|
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,
|
|
3300
|
-
peerConnectionStatsReportOutputFormat: (g = (
|
|
3274
|
+
peerConnectionStatsReportOutputFormat: (g = (y = (d = this.clientOptions) === null || d === void 0 ? void 0 : d.metrics) === null || y === void 0 ? void 0 : y.peerConnectionStatsReportOutputFormat) !== null && g !== void 0 ? g : "console"
|
|
3301
3275
|
}
|
|
3302
3276
|
}, this.publicEventEmitter, this.internalEventEmitter);
|
|
3303
3277
|
} catch (re) {
|
|
3304
|
-
throw
|
|
3278
|
+
throw Se({
|
|
3305
3279
|
sessionId: null
|
|
3306
|
-
}), new $("Failed to initialize streaming client",
|
|
3280
|
+
}), new $("Failed to initialize streaming client", V.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
|
|
3307
3281
|
cause: re instanceof Error ? re.message : String(re),
|
|
3308
|
-
sessionId:
|
|
3282
|
+
sessionId: I
|
|
3309
3283
|
});
|
|
3310
3284
|
}
|
|
3311
|
-
return
|
|
3285
|
+
return I;
|
|
3312
3286
|
});
|
|
3313
3287
|
}
|
|
3314
3288
|
startSessionIfNeeded(e) {
|
|
3315
3289
|
return ue(this, void 0, void 0, function* () {
|
|
3316
3290
|
if ((!this.sessionId || !this.streamingClient) && (yield this.startSession(e), !this.sessionId || !this.streamingClient))
|
|
3317
|
-
throw new $("Session ID or streaming client is not available after starting session",
|
|
3291
|
+
throw new $("Session ID or streaming client is not available after starting session", V.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
|
|
3318
3292
|
cause: "Failed to initialize session properly"
|
|
3319
3293
|
});
|
|
3320
3294
|
});
|
|
@@ -3325,18 +3299,18 @@ class cr {
|
|
|
3325
3299
|
if (this._isStreaming)
|
|
3326
3300
|
throw new Error("Already streaming");
|
|
3327
3301
|
const o = li();
|
|
3328
|
-
return
|
|
3302
|
+
return Se({
|
|
3329
3303
|
attemptCorrelationId: o,
|
|
3330
3304
|
sessionId: null
|
|
3331
3305
|
// reset sessionId
|
|
3332
|
-
}),
|
|
3306
|
+
}), 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) => {
|
|
3333
3307
|
var a;
|
|
3334
|
-
const
|
|
3308
|
+
const u = [];
|
|
3335
3309
|
let l = !1, m = !1;
|
|
3336
3310
|
this.publicEventEmitter.addListener(N.VIDEO_STREAM_STARTED, (p) => {
|
|
3337
|
-
|
|
3311
|
+
u.push(p), l = !0, m && c(u);
|
|
3338
3312
|
}), this.publicEventEmitter.addListener(N.AUDIO_STREAM_STARTED, (p) => {
|
|
3339
|
-
|
|
3313
|
+
u.push(p), m = !0, l && c(u);
|
|
3340
3314
|
}), (a = this.streamingClient) === null || a === void 0 || a.startConnection();
|
|
3341
3315
|
});
|
|
3342
3316
|
});
|
|
@@ -3352,16 +3326,16 @@ class cr {
|
|
|
3352
3326
|
streamToVideoElement(e, n) {
|
|
3353
3327
|
return ue(this, void 0, void 0, function* () {
|
|
3354
3328
|
var o;
|
|
3355
|
-
const
|
|
3356
|
-
|
|
3357
|
-
attemptCorrelationId:
|
|
3329
|
+
const c = li();
|
|
3330
|
+
Se({
|
|
3331
|
+
attemptCorrelationId: c,
|
|
3358
3332
|
sessionId: null
|
|
3359
3333
|
// reset sessionId
|
|
3360
|
-
}),
|
|
3334
|
+
}), me(se.CLIENT_METRIC_MEASUREMENT_SESSION_ATTEMPT, "1"), !((o = this.clientOptions) === null || o === void 0) && o.disableInputAudio && n && console.warn("AnamClient:Input audio is disabled. User provided audio stream will be ignored.");
|
|
3361
3335
|
try {
|
|
3362
3336
|
yield this.startSessionIfNeeded(n);
|
|
3363
3337
|
} catch (a) {
|
|
3364
|
-
throw a instanceof $ ? a : new $("Failed to start session",
|
|
3338
|
+
throw a instanceof $ ? a : new $("Failed to start session", V.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
|
|
3365
3339
|
cause: a instanceof Error ? a.message : String(a),
|
|
3366
3340
|
sessionId: this.sessionId
|
|
3367
3341
|
});
|
|
@@ -3409,13 +3383,13 @@ class cr {
|
|
|
3409
3383
|
const n = this.getActiveSessionId();
|
|
3410
3384
|
if (!n)
|
|
3411
3385
|
throw new Error("Failed to send user message: no active session");
|
|
3412
|
-
const o = (/* @__PURE__ */ new Date()).toISOString().replace("Z", ""),
|
|
3386
|
+
const o = (/* @__PURE__ */ new Date()).toISOString().replace("Z", ""), c = JSON.stringify({
|
|
3413
3387
|
content: e,
|
|
3414
3388
|
timestamp: o,
|
|
3415
3389
|
session_id: n,
|
|
3416
3390
|
message_type: "speech"
|
|
3417
3391
|
});
|
|
3418
|
-
this.sendDataMessage(
|
|
3392
|
+
this.sendDataMessage(c);
|
|
3419
3393
|
}
|
|
3420
3394
|
interruptPersona() {
|
|
3421
3395
|
if (!this._isStreaming)
|
|
@@ -3433,7 +3407,7 @@ class cr {
|
|
|
3433
3407
|
}
|
|
3434
3408
|
stopStreaming() {
|
|
3435
3409
|
return ue(this, void 0, void 0, function* () {
|
|
3436
|
-
this.streamingClient && (this.publicEventEmitter.emit(N.CONNECTION_CLOSED, _e.NORMAL), yield this.streamingClient.stopConnection(), this.streamingClient = null, this.sessionId = null,
|
|
3410
|
+
this.streamingClient && (this.publicEventEmitter.emit(N.CONNECTION_CLOSED, _e.NORMAL), yield this.streamingClient.stopConnection(), this.streamingClient = null, this.sessionId = null, Se({
|
|
3437
3411
|
attemptCorrelationId: null,
|
|
3438
3412
|
sessionId: null,
|
|
3439
3413
|
organizationId: this.organizationId
|
|
@@ -3498,8 +3472,8 @@ class cr {
|
|
|
3498
3472
|
return this.sessionId;
|
|
3499
3473
|
}
|
|
3500
3474
|
}
|
|
3501
|
-
const
|
|
3502
|
-
function
|
|
3475
|
+
const cr = (t, e) => new lr(t, void 0, e), ur = "https://api.anam.ai";
|
|
3476
|
+
function dr(t) {
|
|
3503
3477
|
try {
|
|
3504
3478
|
const e = t.split(".")[1];
|
|
3505
3479
|
return JSON.parse(atob(e));
|
|
@@ -3507,11 +3481,11 @@ function hr(t) {
|
|
|
3507
3481
|
return {};
|
|
3508
3482
|
}
|
|
3509
3483
|
}
|
|
3510
|
-
const
|
|
3511
|
-
function
|
|
3484
|
+
const X = Y(null), te = Y("idle"), Le = Y(!1), Ke = Y(!1), at = Y([]), Pe = Y(null), it = Y(null), Ot = Y(null), kt = Y(null), Dt = Y(null), ui = Y(!1), nt = Y(!1);
|
|
3485
|
+
function hr(t, e) {
|
|
3512
3486
|
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.";
|
|
3513
3487
|
}
|
|
3514
|
-
async function
|
|
3488
|
+
async function fr(t, e) {
|
|
3515
3489
|
nt.value = !1;
|
|
3516
3490
|
try {
|
|
3517
3491
|
const n = await fetch(`${e}/v1/personas/${t}/widget`);
|
|
@@ -3523,11 +3497,11 @@ async function pr(t, e) {
|
|
|
3523
3497
|
nt.value = !0;
|
|
3524
3498
|
}
|
|
3525
3499
|
}
|
|
3526
|
-
async function
|
|
3500
|
+
async function pr(t, e, n, o) {
|
|
3527
3501
|
if (te.value === "connecting" || te.value === "connected")
|
|
3528
3502
|
return;
|
|
3529
3503
|
te.value = "connecting", Pe.value = null;
|
|
3530
|
-
let
|
|
3504
|
+
let c;
|
|
3531
3505
|
try {
|
|
3532
3506
|
let a;
|
|
3533
3507
|
if (o)
|
|
@@ -3539,7 +3513,7 @@ async function _r(t, e, n, o) {
|
|
|
3539
3513
|
headers: { "Content-Type": "application/json" },
|
|
3540
3514
|
body: JSON.stringify({ agentId: t })
|
|
3541
3515
|
});
|
|
3542
|
-
if (
|
|
3516
|
+
if (c = m.status, !m.ok) {
|
|
3543
3517
|
const _ = await m.json().catch(() => ({}));
|
|
3544
3518
|
throw new Error(_.error || `HTTP ${m.status}`);
|
|
3545
3519
|
}
|
|
@@ -3548,54 +3522,54 @@ async function _r(t, e, n, o) {
|
|
|
3548
3522
|
hasToken: !!p.sessionToken
|
|
3549
3523
|
}), a = p.sessionToken;
|
|
3550
3524
|
}
|
|
3551
|
-
const
|
|
3525
|
+
const u = cr(a, {
|
|
3552
3526
|
api: e ? { baseUrl: e } : void 0,
|
|
3553
3527
|
metrics: { disableClientMetrics: !0 }
|
|
3554
3528
|
});
|
|
3555
|
-
|
|
3529
|
+
u.addListener(N.CONNECTION_ESTABLISHED, () => {
|
|
3556
3530
|
console.log("[AnamWidget] Connection established"), te.value = "connected";
|
|
3557
|
-
}),
|
|
3531
|
+
}), u.addListener(N.VIDEO_STREAM_STARTED, () => {
|
|
3558
3532
|
console.log("[AnamWidget] Video stream started"), Le.value = !0;
|
|
3559
|
-
}),
|
|
3533
|
+
}), u.addListener(N.AUDIO_STREAM_STARTED, () => {
|
|
3560
3534
|
console.log("[AnamWidget] Audio stream started");
|
|
3561
|
-
}),
|
|
3535
|
+
}), u.addListener(N.MESSAGE_HISTORY_UPDATED, (m) => {
|
|
3562
3536
|
at.value = [...m];
|
|
3563
|
-
}),
|
|
3537
|
+
}), u.addListener(N.CONNECTION_CLOSED, (m, p) => {
|
|
3564
3538
|
console.log("[AnamWidget] Connection closed:", m, p), te.value = "idle", Le.value = !1, it.value = null;
|
|
3565
|
-
}),
|
|
3539
|
+
}), u.addListener(N.SESSION_READY, (m) => {
|
|
3566
3540
|
console.log("[AnamWidget] Session ready:", m), it.value = m;
|
|
3567
|
-
}),
|
|
3568
|
-
const l = await
|
|
3541
|
+
}), X.value = u;
|
|
3542
|
+
const l = await u.stream();
|
|
3569
3543
|
if (n && l.length > 0) {
|
|
3570
3544
|
const m = l.find((p) => p.getVideoTracks().length > 0);
|
|
3571
3545
|
m && (n.srcObject = m);
|
|
3572
3546
|
}
|
|
3573
3547
|
} catch (a) {
|
|
3574
|
-
console.error("[AnamWidget] Failed to start session:", a), Pe.value =
|
|
3548
|
+
console.error("[AnamWidget] Failed to start session:", a), Pe.value = hr(a, c), te.value = "error", X.value = null;
|
|
3575
3549
|
}
|
|
3576
3550
|
}
|
|
3577
|
-
async function
|
|
3578
|
-
if (
|
|
3551
|
+
async function _r() {
|
|
3552
|
+
if (X.value)
|
|
3579
3553
|
try {
|
|
3580
|
-
await
|
|
3554
|
+
await X.value.stopStreaming();
|
|
3581
3555
|
} catch (t) {
|
|
3582
3556
|
console.error("[AnamWidget] Failed to stop session:", t);
|
|
3583
3557
|
}
|
|
3584
|
-
|
|
3558
|
+
X.value = null, te.value = "idle", Le.value = !1, at.value = [];
|
|
3585
3559
|
}
|
|
3586
|
-
function
|
|
3587
|
-
!
|
|
3560
|
+
function Er(t) {
|
|
3561
|
+
!X.value || te.value !== "connected" || X.value.sendUserMessage(t);
|
|
3588
3562
|
}
|
|
3589
|
-
function
|
|
3590
|
-
|
|
3563
|
+
function mr() {
|
|
3564
|
+
X.value && (Ke.value ? (X.value.unmuteInputAudio(), Ke.value = !1) : (X.value.muteInputAudio(), Ke.value = !0));
|
|
3591
3565
|
}
|
|
3592
|
-
function
|
|
3593
|
-
|
|
3566
|
+
function gr() {
|
|
3567
|
+
X.value?.isStreaming() && X.value.stopStreaming(), X.value = null, te.value = "idle", Le.value = !1, at.value = [], Pe.value = null, it.value = null, Ot.value = null, kt.value = null, Dt.value = null;
|
|
3594
3568
|
}
|
|
3595
|
-
function
|
|
3596
|
-
const o = t || (n ?
|
|
3569
|
+
function vr(t, e, n) {
|
|
3570
|
+
const o = t || (n ? dr(n).personaId : void 0);
|
|
3597
3571
|
ui.value = !!o || !!n;
|
|
3598
|
-
const
|
|
3572
|
+
const c = e || ur;
|
|
3599
3573
|
return {
|
|
3600
3574
|
connectionStatus: te,
|
|
3601
3575
|
isStreaming: Le,
|
|
@@ -3613,21 +3587,21 @@ function yr(t, e, n) {
|
|
|
3613
3587
|
nt.value = !0;
|
|
3614
3588
|
return;
|
|
3615
3589
|
}
|
|
3616
|
-
|
|
3590
|
+
fr(o, c);
|
|
3617
3591
|
},
|
|
3618
|
-
startSession: (l) => !o && !n ? (Pe.value = "No agent ID or session token configured", Promise.resolve()) :
|
|
3619
|
-
stopSession:
|
|
3620
|
-
sendMessage:
|
|
3621
|
-
toggleMute:
|
|
3622
|
-
cleanup:
|
|
3592
|
+
startSession: (l) => !o && !n ? (Pe.value = "No agent ID or session token configured", Promise.resolve()) : pr(o || "", c, l, n),
|
|
3593
|
+
stopSession: _r,
|
|
3594
|
+
sendMessage: Er,
|
|
3595
|
+
toggleMute: mr,
|
|
3596
|
+
cleanup: gr
|
|
3623
3597
|
};
|
|
3624
3598
|
}
|
|
3625
|
-
const di = '@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-inline=false]{position:fixed}.anam-widget[data-inline=true]{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:8px;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-inline=true][data-layout=expanded] .anam-sheet{aspect-ratio:3/2;border-radius:8px;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}';
|
|
3599
|
+
const di = '@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-trigger-size:80px;--anam-sheet-width:400px;--anam-sheet-height:640px;all:initial;color:#18181b;-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-inline=false]{position:fixed}.anam-widget[data-inline=true]{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:8px;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-inline=true][data-layout=expanded] .anam-sheet{aspect-ratio:3/2;border-radius:8px;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}';
|
|
3626
3600
|
function wt(t, e) {
|
|
3627
3601
|
const n = { ...t };
|
|
3628
3602
|
for (const o of Object.keys(e)) {
|
|
3629
|
-
const
|
|
3630
|
-
|
|
3603
|
+
const c = e[o];
|
|
3604
|
+
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);
|
|
3631
3605
|
}
|
|
3632
3606
|
return n;
|
|
3633
3607
|
}
|
|
@@ -3635,58 +3609,58 @@ function ze(t) {
|
|
|
3635
3609
|
if (t !== void 0)
|
|
3636
3610
|
return t === "true";
|
|
3637
3611
|
}
|
|
3638
|
-
function
|
|
3612
|
+
function yr(t) {
|
|
3639
3613
|
const e = {}, n = ze(t.inline);
|
|
3640
3614
|
n !== void 0 && (e.inline = n), t.layout && (e.layout = t.layout), t.position && (e.position = t.position);
|
|
3641
3615
|
const o = ze(t["ui-mute-button"]);
|
|
3642
3616
|
o !== void 0 && (e.showMuteButton = o);
|
|
3643
|
-
const
|
|
3644
|
-
|
|
3617
|
+
const c = ze(t["ui-text-input"]);
|
|
3618
|
+
c !== void 0 && (e.showTextInput = c);
|
|
3645
3619
|
const a = ze(t["ui-captions"]);
|
|
3646
3620
|
return a !== void 0 && (e.showCaptions = a), e;
|
|
3647
3621
|
}
|
|
3648
|
-
const
|
|
3622
|
+
const Sr = () => /* @__PURE__ */ w("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2.5", "stroke-linecap": "round", children: /* @__PURE__ */ w("path", { d: "M18 6L6 18M6 6l12 12" }) }), wr = () => /* @__PURE__ */ w("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ w("path", { d: "M8 5.14v13.72a1 1 0 0 0 1.5.86l11.04-6.86a1 1 0 0 0 0-1.72L9.5 4.28A1 1 0 0 0 8 5.14Z" }) }), Cr = () => /* @__PURE__ */ w("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
|
|
3649
3623
|
/* @__PURE__ */ w("path", { d: "M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z" }),
|
|
3650
3624
|
/* @__PURE__ */ w("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
|
|
3651
3625
|
/* @__PURE__ */ w("line", { x1: "12", y1: "19", x2: "12", y2: "22" })
|
|
3652
|
-
] }),
|
|
3626
|
+
] }), Ir = () => /* @__PURE__ */ w("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
|
|
3653
3627
|
/* @__PURE__ */ w("line", { x1: "1", y1: "1", x2: "23", y2: "23" }),
|
|
3654
3628
|
/* @__PURE__ */ w("path", { d: "M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V5a3 3 0 0 0-5.94-.6" }),
|
|
3655
3629
|
/* @__PURE__ */ w("path", { d: "M17 16.95A7 7 0 0 1 5 12v-2m14 0v2c0 .87-.16 1.71-.46 2.49" }),
|
|
3656
3630
|
/* @__PURE__ */ w("line", { x1: "12", y1: "19", x2: "12", y2: "22" })
|
|
3657
|
-
] }),
|
|
3631
|
+
] }), br = () => /* @__PURE__ */ w("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
|
|
3658
3632
|
/* @__PURE__ */ w("line", { x1: "22", y1: "2", x2: "11", y2: "13" }),
|
|
3659
3633
|
/* @__PURE__ */ w("polygon", { points: "22 2 15 22 11 13 2 9 22 2" })
|
|
3660
|
-
] }),
|
|
3634
|
+
] }), Ar = () => /* @__PURE__ */ w("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
|
|
3661
3635
|
/* @__PURE__ */ w("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" }),
|
|
3662
3636
|
/* @__PURE__ */ w("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
3663
3637
|
] }), Ct = () => /* @__PURE__ */ w("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", style: { opacity: 0.3 }, children: [
|
|
3664
3638
|
/* @__PURE__ */ w("circle", { cx: "24", cy: "18", r: "8", stroke: "white", "stroke-width": "2", fill: "none" }),
|
|
3665
3639
|
/* @__PURE__ */ w("path", { d: "M8 42c0-8.837 7.163-16 16-16s16 7.163 16 16", stroke: "white", "stroke-width": "2", fill: "none" })
|
|
3666
3640
|
] });
|
|
3667
|
-
function
|
|
3641
|
+
function Tr({
|
|
3668
3642
|
config: t,
|
|
3669
3643
|
session: e,
|
|
3670
3644
|
videoRef: n,
|
|
3671
3645
|
avatarSrc: o,
|
|
3672
|
-
displayCta:
|
|
3646
|
+
displayCta: c,
|
|
3673
3647
|
onCollapse: a
|
|
3674
3648
|
}) {
|
|
3675
|
-
const
|
|
3649
|
+
const u = Ze(null), [l, m] = qe(""), [p, _] = qe(null), [d, y] = qe(!1), g = Ze(null), S = e.connectionStatus.value === "connected", C = e.connectionStatus.value === "connecting", A = e.connectionStatus.value === "error", I = e.isStreaming.value, b = !C && !S && !A, T = je(async () => {
|
|
3676
3650
|
n.current && await e.startSession(n.current);
|
|
3677
|
-
}, [e.startSession]),
|
|
3651
|
+
}, [e.startSession]), D = je(async () => {
|
|
3678
3652
|
await e.stopSession();
|
|
3679
|
-
}, [e.stopSession]),
|
|
3653
|
+
}, [e.stopSession]), x = je(() => {
|
|
3680
3654
|
if (!l.trim()) return;
|
|
3681
|
-
const
|
|
3682
|
-
e.sendMessage(
|
|
3683
|
-
|
|
3684
|
-
_(null),
|
|
3655
|
+
const H = l.trim();
|
|
3656
|
+
e.sendMessage(H), m(""), u.current?.focus(), g.current && clearTimeout(g.current), y(!1), _(H), g.current = window.setTimeout(() => {
|
|
3657
|
+
y(!0), g.current = window.setTimeout(() => {
|
|
3658
|
+
_(null), y(!1);
|
|
3685
3659
|
}, 400);
|
|
3686
3660
|
}, 2600);
|
|
3687
|
-
}, [l]),
|
|
3688
|
-
|
|
3689
|
-
}, [
|
|
3661
|
+
}, [l]), Z = je((H) => {
|
|
3662
|
+
H.key === "Enter" && !H.shiftKey && (H.preventDefault(), x());
|
|
3663
|
+
}, [x]);
|
|
3690
3664
|
return gt(() => () => {
|
|
3691
3665
|
g.current && clearTimeout(g.current);
|
|
3692
3666
|
}, []), /* @__PURE__ */ w("div", { class: "anam-sheet", children: [
|
|
@@ -3697,16 +3671,16 @@ function Rr({
|
|
|
3697
3671
|
class: "anam-video",
|
|
3698
3672
|
autoplay: !0,
|
|
3699
3673
|
playsinline: !0,
|
|
3700
|
-
"data-hidden":
|
|
3674
|
+
"data-hidden": I ? void 0 : "true"
|
|
3701
3675
|
}
|
|
3702
3676
|
),
|
|
3703
|
-
|
|
3677
|
+
b && (e.isConfigured.value ? (
|
|
3704
3678
|
/* Has agent-id: show avatar or placeholder + CTA pill */
|
|
3705
3679
|
/* @__PURE__ */ w("div", { class: "anam-overlay-idle", children: [
|
|
3706
3680
|
o ? /* @__PURE__ */ w("img", { src: o, alt: "Avatar" }) : /* @__PURE__ */ w(Ct, {}),
|
|
3707
|
-
/* @__PURE__ */ w("button", { class: "anam-cta-pill", onClick:
|
|
3708
|
-
/* @__PURE__ */ w(
|
|
3709
|
-
|
|
3681
|
+
/* @__PURE__ */ w("button", { class: "anam-cta-pill", onClick: T, children: [
|
|
3682
|
+
/* @__PURE__ */ w(wr, {}),
|
|
3683
|
+
c
|
|
3710
3684
|
] })
|
|
3711
3685
|
] })
|
|
3712
3686
|
) : (
|
|
@@ -3716,16 +3690,16 @@ function Rr({
|
|
|
3716
3690
|
/* @__PURE__ */ w("span", { children: "Agent not configured" })
|
|
3717
3691
|
] })
|
|
3718
3692
|
)),
|
|
3719
|
-
|
|
3693
|
+
C && /* @__PURE__ */ w("div", { class: "anam-overlay-loading", children: [
|
|
3720
3694
|
/* @__PURE__ */ w("span", { class: "anam-spinner" }),
|
|
3721
3695
|
/* @__PURE__ */ w("span", { children: "Starting your conversation..." })
|
|
3722
3696
|
] }),
|
|
3723
3697
|
A && /* @__PURE__ */ w("div", { class: "anam-overlay-error", children: [
|
|
3724
3698
|
/* @__PURE__ */ w("div", { class: "anam-overlay-error-text", children: e.error.value || "Something went wrong" }),
|
|
3725
|
-
/* @__PURE__ */ w("button", { class: "anam-retry-btn", onClick:
|
|
3699
|
+
/* @__PURE__ */ w("button", { class: "anam-retry-btn", onClick: T, children: "Try Again" })
|
|
3726
3700
|
] }),
|
|
3727
|
-
(
|
|
3728
|
-
a && /* @__PURE__ */ w("button", { class: "anam-close-btn", onClick: a, "aria-label": "Close", children: /* @__PURE__ */ w(
|
|
3701
|
+
(S || I) && /* @__PURE__ */ w(oe, { children: [
|
|
3702
|
+
a && /* @__PURE__ */ w("button", { class: "anam-close-btn", onClick: a, "aria-label": "Close", children: /* @__PURE__ */ w(Sr, {}) }),
|
|
3729
3703
|
p && /* @__PURE__ */ w("div", { class: `anam-toast ${d ? "anam-toast-out" : ""}`, children: p }),
|
|
3730
3704
|
/* @__PURE__ */ w("div", { class: "anam-control-bar", children: [
|
|
3731
3705
|
t.showMuteButton && /* @__PURE__ */ w(
|
|
@@ -3734,31 +3708,31 @@ function Rr({
|
|
|
3734
3708
|
class: `anam-ctl-btn ${e.isMuted.value ? "anam-ctl-btn-muted" : ""}`,
|
|
3735
3709
|
onClick: () => e.toggleMute(),
|
|
3736
3710
|
"aria-label": e.isMuted.value ? "Unmute" : "Mute",
|
|
3737
|
-
children: e.isMuted.value ? /* @__PURE__ */ w(
|
|
3711
|
+
children: e.isMuted.value ? /* @__PURE__ */ w(Ir, {}) : /* @__PURE__ */ w(Cr, {})
|
|
3738
3712
|
}
|
|
3739
3713
|
),
|
|
3740
3714
|
t.showTextInput && /* @__PURE__ */ w(oe, { children: [
|
|
3741
3715
|
/* @__PURE__ */ w(
|
|
3742
3716
|
"input",
|
|
3743
3717
|
{
|
|
3744
|
-
ref:
|
|
3718
|
+
ref: u,
|
|
3745
3719
|
type: "text",
|
|
3746
3720
|
class: "anam-ctl-input",
|
|
3747
|
-
placeholder:
|
|
3721
|
+
placeholder: "Type a message...",
|
|
3748
3722
|
value: l,
|
|
3749
|
-
onInput: (
|
|
3750
|
-
onKeyDown:
|
|
3751
|
-
disabled: !
|
|
3723
|
+
onInput: (H) => m(H.target.value),
|
|
3724
|
+
onKeyDown: Z,
|
|
3725
|
+
disabled: !S
|
|
3752
3726
|
}
|
|
3753
3727
|
),
|
|
3754
3728
|
/* @__PURE__ */ w(
|
|
3755
3729
|
"button",
|
|
3756
3730
|
{
|
|
3757
3731
|
class: "anam-ctl-btn",
|
|
3758
|
-
onClick:
|
|
3759
|
-
disabled: !
|
|
3732
|
+
onClick: x,
|
|
3733
|
+
disabled: !S || !l.trim(),
|
|
3760
3734
|
"aria-label": "Send message",
|
|
3761
|
-
children: /* @__PURE__ */ w(
|
|
3735
|
+
children: /* @__PURE__ */ w(br, {})
|
|
3762
3736
|
}
|
|
3763
3737
|
)
|
|
3764
3738
|
] }),
|
|
@@ -3766,74 +3740,71 @@ function Rr({
|
|
|
3766
3740
|
"button",
|
|
3767
3741
|
{
|
|
3768
3742
|
class: "anam-ctl-btn anam-ctl-end",
|
|
3769
|
-
onClick:
|
|
3743
|
+
onClick: D,
|
|
3770
3744
|
"aria-label": "End call",
|
|
3771
|
-
children: /* @__PURE__ */ w(
|
|
3745
|
+
children: /* @__PURE__ */ w(Ar, {})
|
|
3772
3746
|
}
|
|
3773
3747
|
)
|
|
3774
3748
|
] })
|
|
3775
3749
|
] })
|
|
3776
3750
|
] });
|
|
3777
3751
|
}
|
|
3778
|
-
function
|
|
3752
|
+
function Rr(t) {
|
|
3779
3753
|
const e = Ze(null), n = Vi(!1);
|
|
3780
3754
|
t["agent-id"] && t["session-token"] && console.warn("[AnamWidget] Both agent-id and session-token are set. Use one or the other. Ignoring agent-id.");
|
|
3781
|
-
const o = t["session-token"] ? void 0 : t["agent-id"],
|
|
3782
|
-
() =>
|
|
3755
|
+
const o = t["session-token"] ? void 0 : t["agent-id"], c = vr(o, t["api-base-url"], t["session-token"]), a = Ie(
|
|
3756
|
+
() => yr(t),
|
|
3783
3757
|
[t.inline, t.layout, t.position, t["ui-mute-button"], t["ui-text-input"], t["ui-captions"]]
|
|
3784
|
-
),
|
|
3785
|
-
const
|
|
3786
|
-
return
|
|
3787
|
-
}, [
|
|
3758
|
+
), u = Ie(() => {
|
|
3759
|
+
const b = c.serverConfig.value, T = wt(wt({ ...ri }, b ?? {}), a);
|
|
3760
|
+
return T.layout === "orb" && (T.inline = !1), T;
|
|
3761
|
+
}, [c.serverConfig.value, a]);
|
|
3788
3762
|
gt(() => {
|
|
3789
|
-
|
|
3763
|
+
c.fetchWidgetConfig();
|
|
3790
3764
|
}, [o, t["api-base-url"], t["session-token"]]);
|
|
3791
|
-
const l = t["avatar-url"] ||
|
|
3792
|
-
()
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
const O = kn(c.position);
|
|
3797
|
-
return Object.entries(O).map(([R, G]) => `${R}: ${G}`).join("; ");
|
|
3798
|
-
}, [c.inline, c.position]), g = [d, S].filter(Boolean).join("; "), y = Ze(!1), b = () => {
|
|
3765
|
+
const l = t["avatar-url"] || c.avatarThumbnailUrl.value || null, p = t["agent-name"] || c.personaName.value, _ = u.callToAction === ri.callToAction && p ? `Talk to ${p}` : u.callToAction, d = Ie(() => {
|
|
3766
|
+
if (u.inline) return "";
|
|
3767
|
+
const b = On(u.position);
|
|
3768
|
+
return Object.entries(b).map(([T, D]) => `${T}: ${D}`).join("; ");
|
|
3769
|
+
}, [u.inline, u.position]), y = Ze(!1), g = () => {
|
|
3799
3770
|
n.value = !0, y.current = !1, setTimeout(() => {
|
|
3800
|
-
e.current &&
|
|
3771
|
+
e.current && c.startSession(e.current);
|
|
3801
3772
|
}, 50);
|
|
3802
|
-
},
|
|
3803
|
-
|
|
3804
|
-
}, C =
|
|
3805
|
-
(
|
|
3806
|
-
C && n.value &&
|
|
3807
|
-
}, [
|
|
3808
|
-
const
|
|
3809
|
-
return
|
|
3773
|
+
}, S = async () => {
|
|
3774
|
+
c.connectionStatus.value !== "idle" && await c.stopSession(), y.current = !1, n.value = !1;
|
|
3775
|
+
}, C = u.layout === "orb", A = c.connectionStatus.value;
|
|
3776
|
+
(A === "connecting" || A === "connected") && (y.current = !0), gt(() => {
|
|
3777
|
+
C && n.value && A === "idle" && y.current && (y.current = !1, n.value = !1);
|
|
3778
|
+
}, [A]);
|
|
3779
|
+
const I = C ? n.value : !0;
|
|
3780
|
+
return c.isReady.value ? /* @__PURE__ */ w(oe, { children: [
|
|
3810
3781
|
/* @__PURE__ */ w("style", { children: di }),
|
|
3811
3782
|
/* @__PURE__ */ w(
|
|
3812
3783
|
"div",
|
|
3813
3784
|
{
|
|
3814
3785
|
class: "anam-widget",
|
|
3815
|
-
"data-inline":
|
|
3816
|
-
"data-layout":
|
|
3817
|
-
style:
|
|
3786
|
+
"data-inline": u.inline ? "true" : "false",
|
|
3787
|
+
"data-layout": u.layout,
|
|
3788
|
+
style: d,
|
|
3818
3789
|
children: [
|
|
3819
3790
|
C && !n.value && /* @__PURE__ */ w(
|
|
3820
3791
|
"button",
|
|
3821
3792
|
{
|
|
3822
3793
|
class: "anam-trigger",
|
|
3823
|
-
onClick:
|
|
3794
|
+
onClick: g,
|
|
3824
3795
|
"aria-label": _,
|
|
3825
3796
|
children: l ? /* @__PURE__ */ w("img", { src: l, alt: "Avatar" }) : /* @__PURE__ */ w(Ct, {})
|
|
3826
3797
|
}
|
|
3827
3798
|
),
|
|
3828
|
-
|
|
3829
|
-
|
|
3799
|
+
I && /* @__PURE__ */ w(
|
|
3800
|
+
Tr,
|
|
3830
3801
|
{
|
|
3831
|
-
config:
|
|
3832
|
-
session:
|
|
3802
|
+
config: u,
|
|
3803
|
+
session: c,
|
|
3833
3804
|
videoRef: e,
|
|
3834
3805
|
avatarSrc: l,
|
|
3835
3806
|
displayCta: _,
|
|
3836
|
-
onCollapse: C ?
|
|
3807
|
+
onCollapse: C ? S : null
|
|
3837
3808
|
}
|
|
3838
3809
|
)
|
|
3839
3810
|
]
|
|
@@ -3841,7 +3812,7 @@ function Nr(t) {
|
|
|
3841
3812
|
)
|
|
3842
3813
|
] }) : /* @__PURE__ */ w("style", { children: di });
|
|
3843
3814
|
}
|
|
3844
|
-
const
|
|
3815
|
+
const Nr = [
|
|
3845
3816
|
"agent-id",
|
|
3846
3817
|
// Persona ID -- required for session streaming + server config fetch
|
|
3847
3818
|
"api-base-url",
|
|
@@ -3864,7 +3835,7 @@ const xr = [
|
|
|
3864
3835
|
// Override avatar thumbnail (Lab preview)
|
|
3865
3836
|
"agent-name"
|
|
3866
3837
|
// Override persona name for CTA (Lab preview)
|
|
3867
|
-
],
|
|
3838
|
+
], Or = {
|
|
3868
3839
|
SESSION_STARTED: "anam-agent:session-started",
|
|
3869
3840
|
SESSION_ENDED: "anam-agent:session-ended",
|
|
3870
3841
|
MESSAGE_RECEIVED: "anam-agent:message-received",
|
|
@@ -3876,14 +3847,13 @@ const xr = [
|
|
|
3876
3847
|
MIC_UNMUTED: "anam-agent:mic-unmuted"
|
|
3877
3848
|
};
|
|
3878
3849
|
function hi(t = "anam-agent") {
|
|
3879
|
-
_n(
|
|
3850
|
+
_n(Rr, t, [...Nr], {
|
|
3880
3851
|
shadow: !0
|
|
3881
3852
|
});
|
|
3882
3853
|
}
|
|
3883
3854
|
typeof window < "u" && typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", () => hi()) : hi());
|
|
3884
3855
|
export {
|
|
3885
3856
|
ri as DefaultConfig,
|
|
3886
|
-
|
|
3887
|
-
On as normalizeConfig,
|
|
3857
|
+
Or as WidgetEventNames,
|
|
3888
3858
|
hi as registerWidget
|
|
3889
3859
|
};
|