@anam-ai/agent-widget 0.1.0-alpha.1 → 0.1.0-alpha.11
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 +1046 -1061
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var Fe,
|
|
1
|
+
var Fe, D, fi, pi, Ee, Ht, _i, Ei, mi, It, _t, Et, Me = {}, 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;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
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
|
|
9
|
+
function Ie(t, e, n) {
|
|
10
|
+
var o, u, a, c = {};
|
|
11
|
+
for (a in e) a == "key" ? o = e[a] : a == "ref" ? u = e[a] : c[a] = e[a];
|
|
12
|
+
if (arguments.length > 2 && (c.children = arguments.length > 3 ? Fe.call(arguments, 2) : n), typeof t == "function" && t.defaultProps != null) for (a in t.defaultProps) c[a] === void 0 && (c[a] = t.defaultProps[a]);
|
|
13
|
+
return xe(t, c, o, u, null);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
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, u) {
|
|
16
|
+
var a = { type: t, props: e, key: n, ref: o, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: u ?? ++fi, __i: -1, __u: 0 };
|
|
17
|
+
return u == null && D.vnode != null && D.vnode(a), a;
|
|
18
18
|
}
|
|
19
19
|
function oe(t) {
|
|
20
20
|
return t.children;
|
|
@@ -27,38 +27,38 @@ function be(t, e) {
|
|
|
27
27
|
for (var n; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) return n.__e;
|
|
28
28
|
return typeof t.type == "function" ? be(t) : null;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function vi(t) {
|
|
31
31
|
var e, n;
|
|
32
32
|
if ((t = t.__) != null && t.__c != null) {
|
|
33
33
|
for (t.__e = t.__c.base = null, e = 0; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) {
|
|
34
34
|
t.__e = t.__c.base = n.__e;
|
|
35
35
|
break;
|
|
36
36
|
}
|
|
37
|
-
return
|
|
37
|
+
return vi(t);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
function Wt(t) {
|
|
41
|
-
(!t.__d && (t.__d = !0) && Ee.push(t) && !
|
|
41
|
+
(!t.__d && (t.__d = !0) && Ee.push(t) && !Je.__r++ || Ht != D.debounceRendering) && ((Ht = D.debounceRendering) || _i)(Je);
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
for (var t, e, n, o,
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
function
|
|
48
|
-
var d, S,
|
|
49
|
-
for (
|
|
50
|
-
return n.__e =
|
|
51
|
-
}
|
|
52
|
-
function cn(t, e, n, o,
|
|
53
|
-
var a,
|
|
54
|
-
for (t.__k = new Array(
|
|
55
|
-
if (d) for (a = 0; a < _; a++) (l = n[a]) != null && (2 & l.__u) == 0 && (l.__e == o && (o = be(l)),
|
|
43
|
+
function Je() {
|
|
44
|
+
for (var t, e, n, o, u, a, c, l = 1; Ee.length; ) Ee.length > l && Ee.sort(Ei), t = Ee.shift(), l = Ee.length, t.__d && (n = void 0, o = void 0, u = (o = (e = t).__v).__e, a = [], c = [], e.__P && ((n = ie({}, o)).__v = o.__v + 1, D.vnode && D.vnode(n), At(e.__P, n, o, e.__n, e.__P.namespaceURI, 32 & o.__u ? [u] : null, a, u ?? be(o), !!(32 & o.__u), c), n.__v = o.__v, n.__.__k[n.__i] = n, wi(a, n, c), o.__e = o.__ = null, n.__e != u && vi(n)));
|
|
45
|
+
Je.__r = 0;
|
|
46
|
+
}
|
|
47
|
+
function yi(t, e, n, o, u, a, c, l, m, p, _) {
|
|
48
|
+
var d, S, g, y, b, A, C, I = o && o.__k || gi, x = e.length;
|
|
49
|
+
for (m = cn(n, e, I, m, x), d = 0; d < x; d++) (g = n.__k[d]) != null && (S = g.__i == -1 ? Me : I[g.__i] || Me, g.__i = d, A = At(t, g, S, u, a, c, l, m, p, _), y = g.__e, g.ref && S.ref != g.ref && (S.ref && Tt(S.ref, null, g), _.push(g.ref, g.__c || y, g)), b == null && y != null && (b = y), (C = !!(4 & g.__u)) || S.__k === g.__k ? m = Si(g, m, t, C) : typeof g.type == "function" && A !== void 0 ? m = A : y && (m = y.nextSibling), g.__u &= -7);
|
|
50
|
+
return n.__e = b, m;
|
|
51
|
+
}
|
|
52
|
+
function cn(t, e, n, o, u) {
|
|
53
|
+
var a, c, l, m, p, _ = n.length, d = _, S = 0;
|
|
54
|
+
for (t.__k = new Array(u), a = 0; a < u; a++) (c = e[a]) != null && typeof c != "boolean" && typeof c != "function" ? (typeof c == "string" || typeof c == "number" || typeof c == "bigint" || c.constructor == String ? c = t.__k[a] = xe(null, c, null, null, null) : rt(c) ? c = t.__k[a] = xe(oe, { children: c }, null, null, null) : c.constructor === void 0 && c.__b > 0 ? c = t.__k[a] = xe(c.type, c.props, c.key, c.ref ? c.ref : null, c.__v) : t.__k[a] = c, m = a + S, c.__ = t, c.__b = t.__b + 1, l = null, (p = c.__i = un(c, n, m, d)) != -1 && (d--, (l = n[p]) && (l.__u |= 2)), l == null || l.__v == null ? (p == -1 && (u > _ ? S-- : u < _ && S++), typeof c.type != "function" && (c.__u |= 4)) : p != m && (p == m - 1 ? S-- : p == m + 1 ? S++ : (p > m ? S-- : S++, c.__u |= 4))) : t.__k[a] = null;
|
|
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
|
-
function
|
|
59
|
-
var
|
|
58
|
+
function Si(t, e, n, o) {
|
|
59
|
+
var u, a;
|
|
60
60
|
if (typeof t.type == "function") {
|
|
61
|
-
for (
|
|
61
|
+
for (u = t.__k, a = 0; u && a < u.length; a++) u[a] && (u[a].__ = t, e = Si(u[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 yi(t, e, n, o) {
|
|
|
68
68
|
return e;
|
|
69
69
|
}
|
|
70
70
|
function un(t, e, n, o) {
|
|
71
|
-
var
|
|
72
|
-
if (p === null && l == null || _ && l == p.key &&
|
|
71
|
+
var u, a, c, l = t.key, m = t.type, p = e[n], _ = p != null && (2 & p.__u) == 0;
|
|
72
|
+
if (p === null && l == null || _ && l == p.key && m == p.type) return n;
|
|
73
73
|
if (o > (_ ? 1 : 0)) {
|
|
74
|
-
for (
|
|
74
|
+
for (u = n - 1, a = n + 1; u >= 0 || a < e.length; ) if ((p = e[c = u >= 0 ? u-- : a++]) != null && (2 & p.__u) == 0 && l == p.key && m == p.type) return c;
|
|
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, u) {
|
|
82
|
+
var a, c;
|
|
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(
|
|
88
|
+
else if (e[0] == "o" && e[1] == "n") a = e != (e = e.replace(mi, "$1")), c = e.toLowerCase(), e = c in t || e == "onFocusOut" || e == "onFocusIn" ? c.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 (u == "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;
|
|
@@ -100,198 +100,198 @@ function qt(t) {
|
|
|
100
100
|
return function(e) {
|
|
101
101
|
if (this.l) {
|
|
102
102
|
var n = this.l[e.type + t];
|
|
103
|
-
if (e.t == null) e.t =
|
|
103
|
+
if (e.t == null) e.t = It++;
|
|
104
104
|
else if (e.t < n.u) return;
|
|
105
|
-
return n(
|
|
105
|
+
return n(D.event ? D.event(e) : e);
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
-
function
|
|
110
|
-
var _, d, S,
|
|
109
|
+
function At(t, e, n, o, u, a, c, l, m, p) {
|
|
110
|
+
var _, d, S, g, y, b, A, C, I, x, O, T, q, H, ae, ne, re, Q = e.type;
|
|
111
111
|
if (e.constructor !== void 0) return null;
|
|
112
|
-
128 & n.__u && (
|
|
112
|
+
128 & n.__u && (m = !!(32 & n.__u), a = [l = e.__e = n.__e]), (_ = D.__b) && _(e);
|
|
113
113
|
e: if (typeof Q == "function") try {
|
|
114
|
-
if (
|
|
114
|
+
if (C = e.props, I = "prototype" in Q && Q.prototype.render, x = (_ = Q.contextType) && o[_.__c], O = _ ? x ? x.props.value : _.__ : o, n.__c ? A = (d = e.__c = n.__c).__ = d.__E : (I ? e.__c = d = new Q(C, O) : (e.__c = d = new Oe(C, O), d.constructor = Q, d.render = hn), x && x.sub(d), d.state || (d.state = {}), d.__n = o, S = d.__d = !0, d.__h = [], d._sb = []), I && d.__s == null && (d.__s = d.state), I && Q.getDerivedStateFromProps != null && (d.__s == d.state && (d.__s = ie({}, d.__s)), ie(d.__s, Q.getDerivedStateFromProps(C, d.__s))), g = d.props, y = d.state, d.__v = e, S) I && Q.getDerivedStateFromProps == null && d.componentWillMount != null && d.componentWillMount(), I && d.componentDidMount != null && d.__h.push(d.componentDidMount);
|
|
115
115
|
else {
|
|
116
|
-
if (
|
|
117
|
-
for (e.__v != n.__v && (d.props =
|
|
116
|
+
if (I && Q.getDerivedStateFromProps == null && C !== g && d.componentWillReceiveProps != null && d.componentWillReceiveProps(C, O), e.__v == n.__v || !d.__e && d.shouldComponentUpdate != null && d.shouldComponentUpdate(C, d.__s, O) === !1) {
|
|
117
|
+
for (e.__v != n.__v && (d.props = C, 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
|
+
}), T = 0; T < d._sb.length; T++) d.__h.push(d._sb[T]);
|
|
120
|
+
d._sb = [], d.__h.length && c.push(d);
|
|
121
121
|
break e;
|
|
122
122
|
}
|
|
123
|
-
d.componentWillUpdate != null && d.componentWillUpdate(
|
|
124
|
-
d.componentDidUpdate(
|
|
123
|
+
d.componentWillUpdate != null && d.componentWillUpdate(C, d.__s, O), I && d.componentDidUpdate != null && d.__h.push(function() {
|
|
124
|
+
d.componentDidUpdate(g, y, b);
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
if (d.context =
|
|
128
|
-
for (d.state = d.__s, d.__d = !1,
|
|
127
|
+
if (d.context = O, d.props = C, d.__P = t, d.__e = !1, q = D.__r, H = 0, I) {
|
|
128
|
+
for (d.state = d.__s, d.__d = !1, q && q(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,
|
|
131
|
+
d.__d = !1, q && q(e), _ = d.render(d.props, d.state, d.context), d.state = d.__s;
|
|
132
132
|
while (d.__d && ++H < 25);
|
|
133
|
-
d.state = d.__s, d.getChildContext != null && (o = ie(ie({}, o), d.getChildContext())),
|
|
133
|
+
d.state = d.__s, d.getChildContext != null && (o = ie(ie({}, o), d.getChildContext())), I && !S && d.getSnapshotBeforeUpdate != null && (b = d.getSnapshotBeforeUpdate(g, y)), ne = _, _ != null && _.type === oe && _.key == null && (ne = Ci(_.props.children)), l = yi(t, rt(ne) ? ne : [ne], e, n, o, u, a, c, l, m, p), d.base = e.__e, e.__u &= -161, d.__h.length && c.push(d), A && (d.__E = d.__ = null);
|
|
134
134
|
} catch (le) {
|
|
135
|
-
if (e.__v = null,
|
|
136
|
-
for (e.__u |=
|
|
135
|
+
if (e.__v = null, m || a != null) if (le.then) {
|
|
136
|
+
for (e.__u |= m ? 160 : 128; l && l.nodeType == 8 && l.nextSibling; ) l = l.nextSibling;
|
|
137
137
|
a[a.indexOf(l)] = null, e.__e = l;
|
|
138
138
|
} else {
|
|
139
|
-
for (re = a.length; re--; )
|
|
140
|
-
|
|
139
|
+
for (re = a.length; re--; ) bt(a[re]);
|
|
140
|
+
mt(e);
|
|
141
141
|
}
|
|
142
|
-
else e.__e = n.__e, e.__k = n.__k, le.then ||
|
|
143
|
-
|
|
142
|
+
else e.__e = n.__e, e.__k = n.__k, le.then || mt(e);
|
|
143
|
+
D.__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, u, a, c, m, p);
|
|
146
|
+
return (_ = D.diffed) && _(e), 128 & e.__u ? void 0 : l;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
t && t.__c && (t.__c.__e = !0), t && t.__k && t.__k.forEach(
|
|
148
|
+
function mt(t) {
|
|
149
|
+
t && t.__c && (t.__c.__e = !0), t && t.__k && t.__k.forEach(mt);
|
|
150
150
|
}
|
|
151
|
-
function
|
|
152
|
-
for (var o = 0; o < n.length; o++)
|
|
153
|
-
|
|
151
|
+
function wi(t, e, n) {
|
|
152
|
+
for (var o = 0; o < n.length; o++) Tt(n[o], n[++o], n[++o]);
|
|
153
|
+
D.__c && D.__c(e, t), t.some(function(u) {
|
|
154
154
|
try {
|
|
155
|
-
t =
|
|
156
|
-
a.call(
|
|
155
|
+
t = u.__h, u.__h = [], t.some(function(a) {
|
|
156
|
+
a.call(u);
|
|
157
157
|
});
|
|
158
158
|
} catch (a) {
|
|
159
|
-
|
|
159
|
+
D.__e(a, u.__v);
|
|
160
160
|
}
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
-
function
|
|
164
|
-
return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t :
|
|
163
|
+
function Ci(t) {
|
|
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, S,
|
|
168
|
-
if (
|
|
169
|
-
for (p = 0; p < a.length; p++) if ((
|
|
170
|
-
t =
|
|
166
|
+
function dn(t, e, n, o, u, a, c, l, m) {
|
|
167
|
+
var p, _, d, S, g, y, b, A = n.props || Me, C = e.props, I = e.type;
|
|
168
|
+
if (I == "svg" ? u = "http://www.w3.org/2000/svg" : I == "math" ? u = "http://www.w3.org/1998/Math/MathML" : u || (u = "http://www.w3.org/1999/xhtml"), a != null) {
|
|
169
|
+
for (p = 0; p < a.length; p++) if ((g = a[p]) && "setAttribute" in g == !!I && (I ? g.localName == I : g.nodeType == 3)) {
|
|
170
|
+
t = g, a[p] = null;
|
|
171
171
|
break;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
if (t == null) {
|
|
175
|
-
if (
|
|
176
|
-
t = document.createElementNS(
|
|
175
|
+
if (I == null) return document.createTextNode(C);
|
|
176
|
+
t = document.createElementNS(u, I, C.is && C), l && (D.__m && D.__m(e, a), l = !1), a = null;
|
|
177
177
|
}
|
|
178
|
-
if (
|
|
178
|
+
if (I == null) A === C || l && t.data == C || (t.data = C);
|
|
179
179
|
else {
|
|
180
|
-
if (a = a && Fe.call(t.childNodes), !l && a != null) for (
|
|
181
|
-
for (p in
|
|
182
|
-
if (p == "dangerouslySetInnerHTML") d =
|
|
183
|
-
else if (!(p in
|
|
184
|
-
if (p == "value" && "defaultValue" in
|
|
185
|
-
Ve(t, p, null,
|
|
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
|
+
for (p in A) if (g = A[p], p != "children") {
|
|
182
|
+
if (p == "dangerouslySetInnerHTML") d = g;
|
|
183
|
+
else if (!(p in C)) {
|
|
184
|
+
if (p == "value" && "defaultValue" in C || p == "checked" && "defaultChecked" in C) continue;
|
|
185
|
+
Ve(t, p, null, g, u);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
for (p in
|
|
188
|
+
for (p in C) g = C[p], p == "children" ? S = g : p == "dangerouslySetInnerHTML" ? _ = g : p == "value" ? y = g : p == "checked" ? b = g : l && typeof g != "function" || A[p] === g || Ve(t, p, g, A[p], u);
|
|
189
189
|
if (_) l || d && (_.__html == d.__html || _.__html == t.innerHTML) || (t.innerHTML = _.__html), e.__k = [];
|
|
190
|
-
else if (d && (t.innerHTML = ""),
|
|
191
|
-
l || (p = "value",
|
|
190
|
+
else if (d && (t.innerHTML = ""), yi(e.type == "template" ? t.content : t, rt(S) ? S : [S], e, n, o, I == "foreignObject" ? "http://www.w3.org/1999/xhtml" : u, a, c, a ? a[0] : n.__k && be(n, 0), l, m), a != null) for (p = a.length; p--; ) bt(a[p]);
|
|
191
|
+
l || (p = "value", I == "progress" && y == null ? t.removeAttribute("value") : y != null && (y !== t[p] || I == "progress" && !y || I == "option" && y != A[p]) && Ve(t, p, y, A[p], u), p = "checked", b != null && b != t[p] && Ve(t, p, b, A[p], u));
|
|
192
192
|
}
|
|
193
193
|
return t;
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function Tt(t, e, n) {
|
|
196
196
|
try {
|
|
197
197
|
if (typeof t == "function") {
|
|
198
198
|
var o = typeof t.__u == "function";
|
|
199
199
|
o && t.__u(), o && e == null || (t.__u = t(e));
|
|
200
200
|
} else t.current = e;
|
|
201
|
-
} catch (
|
|
202
|
-
|
|
201
|
+
} catch (u) {
|
|
202
|
+
D.__e(u, n);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
function
|
|
206
|
-
var o,
|
|
207
|
-
if (
|
|
205
|
+
function Ii(t, e, n) {
|
|
206
|
+
var o, u;
|
|
207
|
+
if (D.unmount && D.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
|
+
D.__e(a, e);
|
|
212
212
|
}
|
|
213
213
|
o.base = o.__P = null;
|
|
214
214
|
}
|
|
215
|
-
if (o = t.__k) for (
|
|
216
|
-
n ||
|
|
215
|
+
if (o = t.__k) for (u = 0; u < o.length; u++) o[u] && Ii(o[u], e, n || typeof t.type != "function");
|
|
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
|
-
function
|
|
222
|
-
var o,
|
|
223
|
-
e == document && (e = document.documentElement),
|
|
221
|
+
function ot(t, e, n) {
|
|
222
|
+
var o, u, a, c;
|
|
223
|
+
e == document && (e = document.documentElement), D.__ && D.__(t, e), u = (o = typeof n == "function") ? null : n && n.__k || e.__k, a = [], c = [], At(e, t = (!o && n || e).__k = Ie(oe, null, [t]), u || Me, Me, e.namespaceURI, !o && n ? [n] : u ? null : e.firstChild ? Fe.call(e.childNodes) : null, a, !o && n ? n : u ? u.__e : e.firstChild, o, c), wi(a, t, c);
|
|
224
224
|
}
|
|
225
|
-
function
|
|
226
|
-
|
|
225
|
+
function bi(t, e) {
|
|
226
|
+
ot(t, e, bi);
|
|
227
227
|
}
|
|
228
|
-
function
|
|
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),
|
|
228
|
+
function Ai(t, e, n) {
|
|
229
|
+
var o, u, a, c, l = ie({}, t.props);
|
|
230
|
+
for (a in t.type && t.type.defaultProps && (c = t.type.defaultProps), e) a == "key" ? o = e[a] : a == "ref" ? u = e[a] : l[a] = e[a] === void 0 && c != null ? c[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, u || t.ref, null);
|
|
232
232
|
}
|
|
233
|
-
Fe =
|
|
234
|
-
for (var
|
|
235
|
-
if ((a =
|
|
233
|
+
Fe = gi.slice, D = { __e: function(t, e, n, o) {
|
|
234
|
+
for (var u, a, c; e = e.__; ) if ((u = e.__c) && !u.__) try {
|
|
235
|
+
if ((a = u.constructor) && a.getDerivedStateFromError != null && (u.setState(a.getDerivedStateFromError(t)), c = u.__d), u.componentDidCatch != null && (u.componentDidCatch(t, o || {}), c = u.__d), c) return u.__E = u;
|
|
236
236
|
} catch (l) {
|
|
237
237
|
t = l;
|
|
238
238
|
}
|
|
239
239
|
throw t;
|
|
240
|
-
} },
|
|
240
|
+
} }, fi = 0, pi = function(t) {
|
|
241
241
|
return t != null && t.constructor === void 0;
|
|
242
242
|
}, Oe.prototype.setState = function(t, e) {
|
|
243
243
|
var n;
|
|
244
244
|
n = this.__s != null && this.__s != this.state ? this.__s : this.__s = ie({}, this.state), typeof t == "function" && (t = t(ie({}, n), this.props)), t && ie(n, t), t != null && this.__v && (e && this._sb.push(e), Wt(this));
|
|
245
245
|
}, Oe.prototype.forceUpdate = function(t) {
|
|
246
246
|
this.__v && (this.__e = !0, t && this.__h.push(t), Wt(this));
|
|
247
|
-
}, Oe.prototype.render = oe, Ee = [],
|
|
247
|
+
}, Oe.prototype.render = oe, Ee = [], _i = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Ei = function(t, e) {
|
|
248
248
|
return t.__v.__b - e.__v.__b;
|
|
249
|
-
},
|
|
250
|
-
function
|
|
251
|
-
return
|
|
249
|
+
}, Je.__r = 0, mi = /(PointerCapture)$|Capture$/i, It = 0, _t = qt(!1), Et = qt(!0);
|
|
250
|
+
function Xe() {
|
|
251
|
+
return Xe = Object.assign ? Object.assign.bind() : function(t) {
|
|
252
252
|
for (var e = 1; e < arguments.length; e++) {
|
|
253
253
|
var n = arguments[e];
|
|
254
254
|
for (var o in n) Object.prototype.hasOwnProperty.call(n, o) && (t[o] = n[o]);
|
|
255
255
|
}
|
|
256
256
|
return t;
|
|
257
|
-
},
|
|
257
|
+
}, Xe.apply(this, arguments);
|
|
258
258
|
}
|
|
259
|
-
function
|
|
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, u = {}, a = Object.keys(t);
|
|
262
|
+
for (o = 0; o < a.length; o++) e.indexOf(n = a[o]) >= 0 || (u[n] = t[n]);
|
|
263
|
+
return u;
|
|
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 u() {
|
|
268
|
+
var a, c = Reflect.construct(HTMLElement, [], u);
|
|
269
|
+
return c._vdomComponent = t, o && o.shadow ? (c._root = c.attachShadow({ mode: o.mode || "open", serializable: (a = o.serializable) != null && a }), o.adoptedStyleSheets && (c._root.adoptedStyleSheets = o.adoptedStyleSheets)) : c._root = c, c;
|
|
270
270
|
}
|
|
271
|
-
return (
|
|
271
|
+
return (u.prototype = Object.create(HTMLElement.prototype)).constructor = u, u.prototype.connectedCallback = function() {
|
|
272
272
|
mn.call(this, o);
|
|
273
|
-
},
|
|
274
|
-
Object.defineProperty(
|
|
273
|
+
}, u.prototype.attributeChangedCallback = gn, u.prototype.disconnectedCallback = vn, n = n || t.observedAttributes || Object.keys(t.propTypes || {}), u.observedAttributes = n, t.formAssociated && (u.formAssociated = !0), n.forEach(function(a) {
|
|
274
|
+
Object.defineProperty(u.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(c) {
|
|
277
|
+
this._vdom ? this.attributeChangedCallback(a, null, c) : (this._props || (this._props = {}), this._props[a] = c);
|
|
278
|
+
var l = typeof c;
|
|
279
|
+
c != null && l !== "string" && l !== "boolean" && l !== "number" || this.setAttribute(a, c);
|
|
280
280
|
} });
|
|
281
|
-
}), customElements.define(e || t.tagName || t.displayName || t.name,
|
|
281
|
+
}), customElements.define(e || t.tagName || t.displayName || t.name, u), u;
|
|
282
282
|
}
|
|
283
283
|
function En(t) {
|
|
284
284
|
this.getChildContext = function() {
|
|
285
285
|
return t.context;
|
|
286
286
|
};
|
|
287
|
-
var e = t.children, n =
|
|
288
|
-
return
|
|
287
|
+
var e = t.children, n = Ti(t, fn);
|
|
288
|
+
return Ai(e, n);
|
|
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 = Ie(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
|
-
function
|
|
294
|
+
function Ri(t) {
|
|
295
295
|
return t.replace(/-(\w)/g, function(e, n) {
|
|
296
296
|
return n ? n.toUpperCase() : "";
|
|
297
297
|
});
|
|
@@ -299,105 +299,105 @@ function Ti(t) {
|
|
|
299
299
|
function gn(t, e, n) {
|
|
300
300
|
if (this._vdom) {
|
|
301
301
|
var o = {};
|
|
302
|
-
o[t] = n = n ?? void 0, o[
|
|
302
|
+
o[t] = n = n ?? void 0, o[Ri(t)] = n, this._vdom = Ai(this._vdom, o), ot(this._vdom, this._root);
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
305
|
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, u = Ti(t, pn);
|
|
310
|
+
return Ie(o ? oe : "slot", Xe({}, u, { ref: function(a) {
|
|
311
|
+
a ? (n.ref = a, n._listener || (n._listener = function(c) {
|
|
312
|
+
c.stopPropagation(), c.detail.context = e;
|
|
313
313
|
}, a.addEventListener("_preact", n._listener))) : n.ref.removeEventListener("_preact", n._listener);
|
|
314
314
|
} }));
|
|
315
315
|
}
|
|
316
|
-
function
|
|
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 = [], u = {}, a = 0, c = t.attributes, l = t.childNodes;
|
|
320
|
+
for (a = c.length; a--; ) c[a].name !== "slot" && (u[c[a].name] = c[a].value, u[Ri(c[a].name)] = c[a].value);
|
|
321
321
|
for (a = l.length; a--; ) {
|
|
322
|
-
var
|
|
323
|
-
p ?
|
|
322
|
+
var m = Ni(l[a], null, n), p = l[a].slot;
|
|
323
|
+
p ? u[p] = Ie(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 ? Ie(Yt, { useFragment: !_ }, o) : o;
|
|
326
|
+
return !_ && e && (t.innerHTML = ""), Ie(e || t.nodeName.toLowerCase(), u, d);
|
|
327
327
|
}
|
|
328
328
|
var yn = 0;
|
|
329
|
-
function
|
|
329
|
+
function w(t, e, n, o, u, a) {
|
|
330
330
|
e || (e = {});
|
|
331
|
-
var
|
|
332
|
-
if ("ref" in
|
|
333
|
-
var p = { type: t, props:
|
|
334
|
-
if (typeof t == "function" && (
|
|
335
|
-
return
|
|
336
|
-
}
|
|
337
|
-
var Ue, P,
|
|
338
|
-
function
|
|
331
|
+
var c, l, m = e;
|
|
332
|
+
if ("ref" in m) for (l in m = {}, e) l == "ref" ? c = e[l] : m[l] = e[l];
|
|
333
|
+
var p = { type: t, props: m, key: n, ref: c, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --yn, __i: -1, __u: 0, __source: u, __self: a };
|
|
334
|
+
if (typeof t == "function" && (c = t.defaultProps)) for (l in c) m[l] === void 0 && (m[l] = c[l]);
|
|
335
|
+
return D.vnode && D.vnode(p), p;
|
|
336
|
+
}
|
|
337
|
+
var Ue, P, dt, Kt, Be = 0, xi = [], F = D, Jt = F.__b, Xt = F.__r, Zt = F.diffed, Qt = F.__c, ei = F.unmount, ti = F.__;
|
|
338
|
+
function Rt(t, e) {
|
|
339
339
|
F.__h && F.__h(P, t, Be || e), Be = 0;
|
|
340
340
|
var n = P.__H || (P.__H = { __: [], __h: [] });
|
|
341
341
|
return t >= n.__.length && n.__.push({}), n.__[t];
|
|
342
342
|
}
|
|
343
|
-
function
|
|
344
|
-
return Be = 1, Sn(
|
|
343
|
+
function qe(t) {
|
|
344
|
+
return Be = 1, Sn(ki, t);
|
|
345
345
|
}
|
|
346
346
|
function Sn(t, e, n) {
|
|
347
|
-
var o =
|
|
348
|
-
if (o.t = t, !o.__c && (o.__ = [
|
|
349
|
-
var
|
|
350
|
-
|
|
347
|
+
var o = Rt(Ue++, 2);
|
|
348
|
+
if (o.t = t, !o.__c && (o.__ = [ki(void 0, e), function(l) {
|
|
349
|
+
var m = o.__N ? o.__N[0] : o.__[0], p = o.t(m, l);
|
|
350
|
+
m !== p && (o.__N = [p, o.__[1]], o.__c.setState({}));
|
|
351
351
|
}], o.__c = P, !P.__f)) {
|
|
352
|
-
var
|
|
352
|
+
var u = function(l, m, p) {
|
|
353
353
|
if (!o.__c.__H) return !0;
|
|
354
354
|
var _ = o.__c.__H.__.filter(function(S) {
|
|
355
355
|
return !!S.__c;
|
|
356
356
|
});
|
|
357
357
|
if (_.every(function(S) {
|
|
358
358
|
return !S.__N;
|
|
359
|
-
})) return !a || a.call(this, l,
|
|
359
|
+
})) return !a || a.call(this, l, m, p);
|
|
360
360
|
var d = o.__c.props !== l;
|
|
361
361
|
return _.forEach(function(S) {
|
|
362
362
|
if (S.__N) {
|
|
363
|
-
var
|
|
364
|
-
S.__ = S.__N, S.__N = void 0,
|
|
363
|
+
var g = S.__[0];
|
|
364
|
+
S.__ = S.__N, S.__N = void 0, g !== S.__[0] && (d = !0);
|
|
365
365
|
}
|
|
366
|
-
}), a && a.call(this, l,
|
|
366
|
+
}), a && a.call(this, l, m, p) || d;
|
|
367
367
|
};
|
|
368
368
|
P.__f = !0;
|
|
369
|
-
var a = P.shouldComponentUpdate,
|
|
370
|
-
P.componentWillUpdate = function(l,
|
|
369
|
+
var a = P.shouldComponentUpdate, c = P.componentWillUpdate;
|
|
370
|
+
P.componentWillUpdate = function(l, m, p) {
|
|
371
371
|
if (this.__e) {
|
|
372
372
|
var _ = a;
|
|
373
|
-
a = void 0,
|
|
373
|
+
a = void 0, u(l, m, p), a = _;
|
|
374
374
|
}
|
|
375
|
-
|
|
376
|
-
}, P.shouldComponentUpdate =
|
|
375
|
+
c && c.call(this, l, m, p);
|
|
376
|
+
}, P.shouldComponentUpdate = u;
|
|
377
377
|
}
|
|
378
378
|
return o.__N || o.__;
|
|
379
379
|
}
|
|
380
|
-
function
|
|
381
|
-
var n =
|
|
382
|
-
!F.__s &&
|
|
380
|
+
function gt(t, e) {
|
|
381
|
+
var n = Rt(Ue++, 3);
|
|
382
|
+
!F.__s && Oi(n.__H, e) && (n.__ = t, n.u = e, P.__H.__h.push(n));
|
|
383
383
|
}
|
|
384
|
-
function
|
|
385
|
-
return Be = 5,
|
|
384
|
+
function Ze(t) {
|
|
385
|
+
return Be = 5, me(function() {
|
|
386
386
|
return { current: t };
|
|
387
387
|
}, []);
|
|
388
388
|
}
|
|
389
|
-
function
|
|
390
|
-
var n =
|
|
391
|
-
return
|
|
389
|
+
function me(t, e) {
|
|
390
|
+
var n = Rt(Ue++, 7);
|
|
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, me(function() {
|
|
395
395
|
return t;
|
|
396
396
|
}, e);
|
|
397
397
|
}
|
|
398
398
|
function wn() {
|
|
399
399
|
for (var t; t = xi.shift(); ) if (t.__P && t.__H) try {
|
|
400
|
-
t.__H.__h.forEach(
|
|
400
|
+
t.__H.__h.forEach(Ye), t.__H.__h.forEach(vt), t.__H.__h = [];
|
|
401
401
|
} catch (e) {
|
|
402
402
|
t.__H.__h = [], F.__e(e, t.__v);
|
|
403
403
|
}
|
|
@@ -409,24 +409,24 @@ F.__b = function(t) {
|
|
|
409
409
|
}, F.__r = function(t) {
|
|
410
410
|
Xt && Xt(t), Ue = 0;
|
|
411
411
|
var e = (P = t.__c).__H;
|
|
412
|
-
e && (
|
|
412
|
+
e && (dt === P ? (e.__h = [], P.__h = [], e.__.forEach(function(n) {
|
|
413
413
|
n.__N && (n.__ = n.__N), n.u = n.__N = void 0;
|
|
414
|
-
})) : (e.__h.forEach(
|
|
414
|
+
})) : (e.__h.forEach(Ye), e.__h.forEach(vt), e.__h = [], Ue = 0)), dt = P;
|
|
415
415
|
}, F.diffed = function(t) {
|
|
416
416
|
Zt && Zt(t);
|
|
417
417
|
var e = t.__c;
|
|
418
418
|
e && e.__H && (e.__H.__h.length && (xi.push(e) !== 1 && Kt === F.requestAnimationFrame || ((Kt = F.requestAnimationFrame) || Cn)(wn)), e.__H.__.forEach(function(n) {
|
|
419
419
|
n.u && (n.__H = n.u), n.u = void 0;
|
|
420
|
-
})),
|
|
420
|
+
})), dt = P = null;
|
|
421
421
|
}, F.__c = function(t, e) {
|
|
422
422
|
e.some(function(n) {
|
|
423
423
|
try {
|
|
424
|
-
n.__h.forEach(
|
|
425
|
-
return !o.__ ||
|
|
424
|
+
n.__h.forEach(Ye), n.__h = n.__h.filter(function(o) {
|
|
425
|
+
return !o.__ || vt(o);
|
|
426
426
|
});
|
|
427
427
|
} catch (o) {
|
|
428
|
-
e.some(function(
|
|
429
|
-
|
|
428
|
+
e.some(function(u) {
|
|
429
|
+
u.__h && (u.__h = []);
|
|
430
430
|
}), e = [], F.__e(o, n.__v);
|
|
431
431
|
}
|
|
432
432
|
}), Qt && Qt(t, e);
|
|
@@ -435,9 +435,9 @@ F.__b = function(t) {
|
|
|
435
435
|
var e, n = t.__c;
|
|
436
436
|
n && n.__H && (n.__H.__.forEach(function(o) {
|
|
437
437
|
try {
|
|
438
|
-
|
|
439
|
-
} catch (
|
|
440
|
-
e =
|
|
438
|
+
Ye(o);
|
|
439
|
+
} catch (u) {
|
|
440
|
+
e = u;
|
|
441
441
|
}
|
|
442
442
|
}), n.__H = void 0, e && F.__e(e, n.__v));
|
|
443
443
|
};
|
|
@@ -448,40 +448,40 @@ function Cn(t) {
|
|
|
448
448
|
}, o = setTimeout(n, 35);
|
|
449
449
|
ii && (e = requestAnimationFrame(n));
|
|
450
450
|
}
|
|
451
|
-
function
|
|
451
|
+
function Ye(t) {
|
|
452
452
|
var e = P, n = t.__c;
|
|
453
453
|
typeof n == "function" && (t.__c = void 0, n()), P = e;
|
|
454
454
|
}
|
|
455
|
-
function
|
|
455
|
+
function vt(t) {
|
|
456
456
|
var e = P;
|
|
457
457
|
t.__c = t.__(), P = e;
|
|
458
458
|
}
|
|
459
|
-
function
|
|
459
|
+
function Oi(t, e) {
|
|
460
460
|
return !t || t.length !== e.length || e.some(function(n, o) {
|
|
461
461
|
return n !== t[o];
|
|
462
462
|
});
|
|
463
463
|
}
|
|
464
|
-
function
|
|
464
|
+
function ki(t, e) {
|
|
465
465
|
return typeof e == "function" ? e(t) : e;
|
|
466
466
|
}
|
|
467
467
|
var In = /* @__PURE__ */ Symbol.for("preact-signals");
|
|
468
|
-
function
|
|
468
|
+
function st() {
|
|
469
469
|
if (pe > 1)
|
|
470
470
|
pe--;
|
|
471
471
|
else {
|
|
472
472
|
for (var t, e = !1; ke !== void 0; ) {
|
|
473
473
|
var n = ke;
|
|
474
|
-
for (ke = void 0,
|
|
474
|
+
for (ke = void 0, yt++; n !== void 0; ) {
|
|
475
475
|
var o = n.o;
|
|
476
|
-
if (n.o = void 0, n.f &= -3, !(8 & n.f) &&
|
|
476
|
+
if (n.o = void 0, n.f &= -3, !(8 & n.f) && Ui(n)) try {
|
|
477
477
|
n.c();
|
|
478
|
-
} catch (
|
|
479
|
-
e || (t =
|
|
478
|
+
} catch (u) {
|
|
479
|
+
e || (t = u, e = !0);
|
|
480
480
|
}
|
|
481
481
|
n = o;
|
|
482
482
|
}
|
|
483
483
|
}
|
|
484
|
-
if (
|
|
484
|
+
if (yt = 0, pe--, e) throw t;
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
487
|
function bn(t) {
|
|
@@ -490,27 +490,27 @@ function bn(t) {
|
|
|
490
490
|
try {
|
|
491
491
|
return t();
|
|
492
492
|
} finally {
|
|
493
|
-
|
|
493
|
+
st();
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
|
-
var
|
|
497
|
-
function
|
|
498
|
-
var e =
|
|
499
|
-
|
|
496
|
+
var k = void 0;
|
|
497
|
+
function Di(t) {
|
|
498
|
+
var e = k;
|
|
499
|
+
k = void 0;
|
|
500
500
|
try {
|
|
501
501
|
return t();
|
|
502
502
|
} finally {
|
|
503
|
-
|
|
503
|
+
k = e;
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
|
-
var ke = void 0, pe = 0,
|
|
507
|
-
function
|
|
508
|
-
if (
|
|
506
|
+
var ke = void 0, pe = 0, yt = 0, Qe = 0;
|
|
507
|
+
function Mi(t) {
|
|
508
|
+
if (k !== 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 !== k)
|
|
511
|
+
return e = { i: 0, S: t, p: k.s, n: void 0, t: k, e: void 0, x: void 0, r: e }, k.s !== void 0 && (k.s.n = e), k.s = e, t.n = e, 32 & k.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 = k.s, e.n = void 0, k.s.n = e, k.s = e), e;
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
516
|
function j(t, e) {
|
|
@@ -522,7 +522,7 @@ j.prototype.h = function() {
|
|
|
522
522
|
};
|
|
523
523
|
j.prototype.S = function(t) {
|
|
524
524
|
var e = this, n = this.t;
|
|
525
|
-
n !== t && t.e === void 0 && (t.x = n, this.t = t, n !== void 0 ? n.e = t :
|
|
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
|
}));
|
|
@@ -531,21 +531,21 @@ 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
|
-
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 &&
|
|
535
|
-
var
|
|
536
|
-
(
|
|
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 u;
|
|
536
|
+
(u = e.Z) == null || u.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 = k;
|
|
544
|
+
k = void 0;
|
|
545
545
|
try {
|
|
546
546
|
t(n);
|
|
547
547
|
} finally {
|
|
548
|
-
|
|
548
|
+
k = o;
|
|
549
549
|
}
|
|
550
550
|
}, { name: "sub" });
|
|
551
551
|
};
|
|
@@ -559,36 +559,36 @@ j.prototype.toJSON = function() {
|
|
|
559
559
|
return this.value;
|
|
560
560
|
};
|
|
561
561
|
j.prototype.peek = function() {
|
|
562
|
-
var t =
|
|
563
|
-
|
|
562
|
+
var t = k;
|
|
563
|
+
k = void 0;
|
|
564
564
|
try {
|
|
565
565
|
return this.value;
|
|
566
566
|
} finally {
|
|
567
|
-
|
|
567
|
+
k = t;
|
|
568
568
|
}
|
|
569
569
|
};
|
|
570
570
|
Object.defineProperty(j.prototype, "value", { get: function() {
|
|
571
|
-
var t =
|
|
571
|
+
var t = Mi(this);
|
|
572
572
|
return t !== void 0 && (t.i = this.i), this.v;
|
|
573
573
|
}, set: function(t) {
|
|
574
574
|
if (t !== this.v) {
|
|
575
|
-
if (
|
|
576
|
-
this.v = t, this.i++,
|
|
575
|
+
if (yt > 100) throw new Error("Cycle detected");
|
|
576
|
+
this.v = t, this.i++, Qe++, pe++;
|
|
577
577
|
try {
|
|
578
578
|
for (var e = this.t; e !== void 0; e = e.x) e.t.N();
|
|
579
579
|
} finally {
|
|
580
|
-
|
|
580
|
+
st();
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
583
|
} });
|
|
584
|
-
function
|
|
584
|
+
function K(t, e) {
|
|
585
585
|
return new j(t, e);
|
|
586
586
|
}
|
|
587
|
-
function
|
|
587
|
+
function Ui(t) {
|
|
588
588
|
for (var e = t.s; e !== void 0; e = e.n) if (e.S.i !== e.i || !e.S.h() || e.S.i !== e.i) return !0;
|
|
589
589
|
return !1;
|
|
590
590
|
}
|
|
591
|
-
function
|
|
591
|
+
function Bi(t) {
|
|
592
592
|
for (var e = t.s; e !== void 0; e = e.n) {
|
|
593
593
|
var n = e.S.n;
|
|
594
594
|
if (n !== void 0 && (e.r = n), e.S.n = e, e.i = -1, e.n === void 0) {
|
|
@@ -597,82 +597,82 @@ function Ui(t) {
|
|
|
597
597
|
}
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
|
-
function
|
|
600
|
+
function Li(t) {
|
|
601
601
|
for (var e = t.s, n = void 0; e !== void 0; ) {
|
|
602
602
|
var o = e.p;
|
|
603
603
|
e.i === -1 ? (e.S.U(e), o !== void 0 && (o.n = e.n), e.n !== void 0 && (e.n.p = o)) : n = e, e.S.n = e.r, e.r !== void 0 && (e.r = void 0), e = o;
|
|
604
604
|
}
|
|
605
605
|
t.s = n;
|
|
606
606
|
}
|
|
607
|
-
function
|
|
608
|
-
j.call(this, void 0), this.x = t, this.s = void 0, this.g =
|
|
607
|
+
function ve(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
|
+
ve.prototype = new j();
|
|
611
|
+
ve.prototype.h = function() {
|
|
612
612
|
if (this.f &= -3, 1 & this.f) return !1;
|
|
613
|
-
if ((36 & this.f) == 32 || (this.f &= -5, this.g ===
|
|
614
|
-
if (this.g =
|
|
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 && !Ui(this))
|
|
615
615
|
return this.f &= -2, !0;
|
|
616
|
-
var t =
|
|
616
|
+
var t = k;
|
|
617
617
|
try {
|
|
618
|
-
|
|
618
|
+
Bi(this), k = 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 k = t, Li(this), this.f &= -2, !0;
|
|
625
625
|
};
|
|
626
|
-
|
|
626
|
+
ve.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
|
-
|
|
633
|
+
ve.prototype.U = function(t) {
|
|
634
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
|
+
ve.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(ve.prototype, "value", { get: function() {
|
|
646
646
|
if (1 & this.f) throw new Error("Cycle detected");
|
|
647
|
-
var t =
|
|
647
|
+
var t = Mi(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 ve(t, e);
|
|
653
653
|
}
|
|
654
|
-
function
|
|
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 = k;
|
|
659
|
+
k = void 0;
|
|
660
660
|
try {
|
|
661
661
|
e();
|
|
662
662
|
} catch (o) {
|
|
663
|
-
throw t.f &= -2, t.f |= 8,
|
|
663
|
+
throw t.f &= -2, t.f |= 8, Nt(t), o;
|
|
664
664
|
} finally {
|
|
665
|
-
|
|
665
|
+
k = n, st();
|
|
666
666
|
}
|
|
667
667
|
}
|
|
668
668
|
}
|
|
669
|
-
function
|
|
669
|
+
function Nt(t) {
|
|
670
670
|
for (var e = t.s; e !== void 0; e = e.n) e.S.U(e);
|
|
671
|
-
t.x = void 0, t.s = void 0,
|
|
671
|
+
t.x = void 0, t.s = void 0, Pi(t);
|
|
672
672
|
}
|
|
673
673
|
function An(t) {
|
|
674
|
-
if (
|
|
675
|
-
|
|
674
|
+
if (k !== this) throw new Error("Out-of-order effect");
|
|
675
|
+
Li(this), k = t, this.f &= -2, 8 & this.f && Nt(this), st();
|
|
676
676
|
}
|
|
677
677
|
function Ae(t, e) {
|
|
678
678
|
this.x = t, this.u = void 0, this.s = void 0, this.o = void 0, this.f = 32, this.name = e?.name;
|
|
@@ -689,15 +689,15 @@ Ae.prototype.c = function() {
|
|
|
689
689
|
};
|
|
690
690
|
Ae.prototype.S = function() {
|
|
691
691
|
if (1 & this.f) throw new Error("Cycle detected");
|
|
692
|
-
this.f |= 1, this.f &= -9,
|
|
693
|
-
var t =
|
|
694
|
-
return
|
|
692
|
+
this.f |= 1, this.f &= -9, Pi(this), Bi(this), pe++;
|
|
693
|
+
var t = k;
|
|
694
|
+
return k = 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);
|
|
698
698
|
};
|
|
699
699
|
Ae.prototype.d = function() {
|
|
700
|
-
this.f |= 8, 1 & this.f ||
|
|
700
|
+
this.f |= 8, 1 & this.f || Nt(this);
|
|
701
701
|
};
|
|
702
702
|
Ae.prototype.dispose = function() {
|
|
703
703
|
this.d();
|
|
@@ -706,110 +706,110 @@ 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 (u) {
|
|
710
|
+
throw n.d(), u;
|
|
711
711
|
}
|
|
712
712
|
var o = n.d.bind(n);
|
|
713
713
|
return o[Symbol.dispose] = o, o;
|
|
714
714
|
}
|
|
715
|
-
var
|
|
715
|
+
var Fi, ht, Tn = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, $i = [];
|
|
716
716
|
$e(function() {
|
|
717
|
-
|
|
717
|
+
Fi = this.N;
|
|
718
718
|
})();
|
|
719
719
|
function Te(t, e) {
|
|
720
|
-
|
|
720
|
+
D[t] = e.bind(null, D[t] || function() {
|
|
721
721
|
});
|
|
722
722
|
}
|
|
723
|
-
function
|
|
724
|
-
|
|
723
|
+
function et(t) {
|
|
724
|
+
ht && ht(), ht = t && t.S();
|
|
725
725
|
}
|
|
726
|
-
function
|
|
727
|
-
var e = this, n = t.data, o =
|
|
726
|
+
function Gi(t) {
|
|
727
|
+
var e = this, n = t.data, o = Vi(n);
|
|
728
728
|
o.value = n;
|
|
729
|
-
var
|
|
730
|
-
for (var l = e,
|
|
731
|
-
|
|
729
|
+
var u = me(function() {
|
|
730
|
+
for (var l = e, m = e.__v; m = m.__; ) if (m.__c) {
|
|
731
|
+
m.__c.__$f |= 4;
|
|
732
732
|
break;
|
|
733
733
|
}
|
|
734
734
|
var p = ni(function() {
|
|
735
|
-
var
|
|
736
|
-
return
|
|
735
|
+
var g = o.value.value;
|
|
736
|
+
return g === 0 ? 0 : g === !0 ? "" : g || "";
|
|
737
737
|
}), _ = ni(function() {
|
|
738
|
-
return !Array.isArray(p.value) && !
|
|
738
|
+
return !Array.isArray(p.value) && !pi(p.value);
|
|
739
739
|
}), d = $e(function() {
|
|
740
|
-
if (this.N =
|
|
741
|
-
var
|
|
742
|
-
l.__v && l.__v.__e && l.__v.__e.nodeType === 3 && (l.__v.__e.data =
|
|
740
|
+
if (this.N = ji, _.value) {
|
|
741
|
+
var g = p.value;
|
|
742
|
+
l.__v && l.__v.__e && l.__v.__e.nodeType === 3 && (l.__v.__e.data = g);
|
|
743
743
|
}
|
|
744
744
|
}), S = e.__$u.d;
|
|
745
745
|
return e.__$u.d = function() {
|
|
746
746
|
d(), S.call(this);
|
|
747
747
|
}, [_, p];
|
|
748
|
-
}, []), a =
|
|
749
|
-
return a.value ?
|
|
748
|
+
}, []), a = u[0], c = u[1];
|
|
749
|
+
return a.value ? c.peek() : c.value;
|
|
750
750
|
}
|
|
751
|
-
|
|
752
|
-
Object.defineProperties(j.prototype, { constructor: { configurable: !0, value: void 0 }, type: { configurable: !0, value:
|
|
751
|
+
Gi.displayName = "ReactiveTextNode";
|
|
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 j && (n || (e.__np = n = {}), n[
|
|
758
|
+
for (var u in o) if (u !== "children") {
|
|
759
|
+
var a = o[u];
|
|
760
|
+
a instanceof j && (n || (e.__np = n = {}), n[u] = a, o[u] = a.peek());
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
763
|
t(e);
|
|
764
764
|
});
|
|
765
765
|
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(u, a) {
|
|
770
|
+
var c;
|
|
771
771
|
return $e(function() {
|
|
772
|
-
|
|
773
|
-
}, { name: a }),
|
|
772
|
+
c = this;
|
|
773
|
+
}, { name: a }), c.c = u, c;
|
|
774
774
|
})(function() {
|
|
775
|
-
var
|
|
776
|
-
Tn && ((
|
|
777
|
-
}, typeof e.type == "function" ? e.type.displayName || e.type.name : ""))),
|
|
775
|
+
var u;
|
|
776
|
+
Tn && ((u = n.y) == null || u.call(n)), o.__$f |= 1, o.setState({});
|
|
777
|
+
}, typeof e.type == "function" ? e.type.displayName || e.type.name : ""))), et(n);
|
|
778
778
|
}
|
|
779
779
|
t(e);
|
|
780
780
|
});
|
|
781
781
|
Te("__e", function(t, e, n, o) {
|
|
782
|
-
|
|
782
|
+
et(), t(e, n, o);
|
|
783
783
|
});
|
|
784
784
|
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, u = 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 c in a) {
|
|
792
|
+
var l = a[c];
|
|
793
|
+
l !== void 0 && !(c in o) && (l.d(), a[c] = void 0);
|
|
794
794
|
}
|
|
795
795
|
else
|
|
796
796
|
a = {}, n.U = a;
|
|
797
|
-
for (var
|
|
798
|
-
var p = a[
|
|
799
|
-
p === void 0 ? (p = Rn(n,
|
|
797
|
+
for (var m in o) {
|
|
798
|
+
var p = a[m], _ = o[m];
|
|
799
|
+
p === void 0 ? (p = Rn(n, m, _, u), a[m] = p) : p.o(_, u);
|
|
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 u = e in t && t.ownerSVGElement === void 0, a = K(n);
|
|
807
|
+
return { o: function(c, l) {
|
|
808
|
+
a.value = c, o = l;
|
|
809
809
|
}, d: $e(function() {
|
|
810
|
-
this.N =
|
|
811
|
-
var
|
|
812
|
-
o[e] !==
|
|
810
|
+
this.N = ji;
|
|
811
|
+
var c = a.value.value;
|
|
812
|
+
o[e] !== c && (o[e] = c, u ? t[e] = c : c != null && (c !== !1 || e[4] === "-") ? t.setAttribute(e, c) : 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 u in o) {
|
|
823
|
+
var a = o[u];
|
|
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 c = e.__c;
|
|
830
|
+
if (c) {
|
|
831
|
+
var l = c.__$u;
|
|
832
|
+
l && (c.__$u = void 0, l.d());
|
|
833
833
|
}
|
|
834
834
|
}
|
|
835
835
|
t(e);
|
|
@@ -840,43 +840,43 @@ 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 u 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 c in t) if (c !== "__source" && t[c] !== this.props[c]) return !0;
|
|
849
849
|
for (var l in this.props) if (!(l in t)) return !0;
|
|
850
850
|
return !1;
|
|
851
851
|
};
|
|
852
|
-
function
|
|
853
|
-
return
|
|
854
|
-
return
|
|
852
|
+
function Vi(t, e) {
|
|
853
|
+
return qe(function() {
|
|
854
|
+
return K(t, e);
|
|
855
855
|
})[0];
|
|
856
856
|
}
|
|
857
|
-
var
|
|
857
|
+
var Nn = function(t) {
|
|
858
858
|
queueMicrotask(function() {
|
|
859
859
|
queueMicrotask(t);
|
|
860
860
|
});
|
|
861
861
|
};
|
|
862
|
-
function
|
|
862
|
+
function xn() {
|
|
863
863
|
bn(function() {
|
|
864
|
-
for (var t; t =
|
|
864
|
+
for (var t; t = $i.shift(); ) Fi.call(t);
|
|
865
865
|
});
|
|
866
866
|
}
|
|
867
|
-
function
|
|
868
|
-
|
|
867
|
+
function ji() {
|
|
868
|
+
$i.push(this) === 1 && (D.requestAnimationFrame || Nn)(xn);
|
|
869
869
|
}
|
|
870
|
-
const
|
|
871
|
-
|
|
872
|
-
layout: "
|
|
870
|
+
const ri = {
|
|
871
|
+
inline: !1,
|
|
872
|
+
layout: "expanded",
|
|
873
873
|
position: "bottom-right",
|
|
874
874
|
styles: {
|
|
875
875
|
backgroundColor: "#ffffff",
|
|
876
876
|
textColor: "#1f2937"
|
|
877
877
|
},
|
|
878
|
-
|
|
879
|
-
showTextInput: !
|
|
878
|
+
showCaptions: !1,
|
|
879
|
+
showTextInput: !1,
|
|
880
880
|
showMuteButton: !0,
|
|
881
881
|
interactionMode: "both",
|
|
882
882
|
startExpanded: !1,
|
|
@@ -889,151 +889,107 @@ const He = {
|
|
|
889
889
|
sendMessage: "Send",
|
|
890
890
|
placeholder: "Type a message..."
|
|
891
891
|
}
|
|
892
|
-
},
|
|
892
|
+
}, He = {
|
|
893
893
|
"bottom-right": { bottom: "24px", right: "24px" },
|
|
894
894
|
"bottom-left": { bottom: "24px", left: "24px" },
|
|
895
895
|
"top-right": { top: "24px", right: "24px" },
|
|
896
896
|
"top-left": { top: "24px", left: "24px" }
|
|
897
897
|
};
|
|
898
898
|
function On(t) {
|
|
899
|
-
if (
|
|
900
|
-
return
|
|
899
|
+
if (He[t])
|
|
900
|
+
return He[t];
|
|
901
901
|
const e = t.match(/^\[(.+)\]$/);
|
|
902
|
-
if (!e) return
|
|
902
|
+
if (!e) return He["bottom-right"];
|
|
903
903
|
const n = {};
|
|
904
904
|
for (const o of e[1].split(",")) {
|
|
905
|
-
const
|
|
905
|
+
const u = o.trim(), a = u.lastIndexOf("-");
|
|
906
906
|
if (a <= 0) continue;
|
|
907
|
-
const
|
|
908
|
-
n[
|
|
907
|
+
const c = u.slice(0, a), l = u.slice(a + 1);
|
|
908
|
+
n[c] = /^\d+$/.test(l) ? `${l}px` : l;
|
|
909
909
|
}
|
|
910
|
-
return Object.keys(n).length > 0 ? n :
|
|
911
|
-
}
|
|
912
|
-
const kn = [
|
|
913
|
-
// Authentication
|
|
914
|
-
"agent-id",
|
|
915
|
-
"api-base-url",
|
|
916
|
-
// Default: https://api.anam.ai
|
|
917
|
-
// Layout
|
|
918
|
-
"mode",
|
|
919
|
-
// 'orb' | 'expanded'
|
|
920
|
-
"layout",
|
|
921
|
-
// 'inline' | 'fixed'
|
|
922
|
-
"position",
|
|
923
|
-
// 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' | '[top-20,right-0]'
|
|
924
|
-
// Backward compat (mapped to mode/layout)
|
|
925
|
-
"variant",
|
|
926
|
-
// deprecated → maps to mode
|
|
927
|
-
"placement",
|
|
928
|
-
// deprecated → maps to position
|
|
929
|
-
// Theming
|
|
930
|
-
"background-color",
|
|
931
|
-
"text-color",
|
|
932
|
-
// Features
|
|
933
|
-
"show-transcript",
|
|
934
|
-
// 'true' | 'false'
|
|
935
|
-
"show-text-input",
|
|
936
|
-
// 'true' | 'false'
|
|
937
|
-
"show-mute-button",
|
|
938
|
-
// 'true' | 'false'
|
|
939
|
-
"interaction-mode",
|
|
940
|
-
// 'voice' | 'text' | 'both'
|
|
941
|
-
"start-expanded",
|
|
942
|
-
// 'true' | 'false'
|
|
943
|
-
// Text customization
|
|
944
|
-
"text-call-to-action",
|
|
945
|
-
"text-connecting",
|
|
946
|
-
"text-listening",
|
|
947
|
-
"text-speaking",
|
|
948
|
-
"text-end-call",
|
|
949
|
-
// Advanced
|
|
950
|
-
"override-config"
|
|
951
|
-
// JSON string for full config override
|
|
952
|
-
];
|
|
953
|
-
function ze(t) {
|
|
954
|
-
return t === void 0 ? !1 : t === "true" || t === "";
|
|
910
|
+
return Object.keys(n).length > 0 ? n : He["bottom-right"];
|
|
955
911
|
}
|
|
956
|
-
var
|
|
957
|
-
function
|
|
958
|
-
if (
|
|
959
|
-
|
|
960
|
-
for (var t = [], e = [], n = typeof Uint8Array < "u" ? Uint8Array : Array, o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
|
961
|
-
t[
|
|
912
|
+
var ft = {}, Ne = {}, oi;
|
|
913
|
+
function kn() {
|
|
914
|
+
if (oi) return Ne;
|
|
915
|
+
oi = 1, Ne.byteLength = l, Ne.toByteArray = p, Ne.fromByteArray = S;
|
|
916
|
+
for (var t = [], e = [], n = typeof Uint8Array < "u" ? Uint8Array : Array, o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", u = 0, a = o.length; u < a; ++u)
|
|
917
|
+
t[u] = o[u], e[o.charCodeAt(u)] = u;
|
|
962
918
|
e[45] = 62, e[95] = 63;
|
|
963
|
-
function
|
|
964
|
-
var y =
|
|
919
|
+
function c(g) {
|
|
920
|
+
var y = g.length;
|
|
965
921
|
if (y % 4 > 0)
|
|
966
922
|
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
967
|
-
var
|
|
968
|
-
|
|
969
|
-
var
|
|
970
|
-
return [
|
|
971
|
-
}
|
|
972
|
-
function l(
|
|
973
|
-
var y =
|
|
974
|
-
return (
|
|
975
|
-
}
|
|
976
|
-
function g
|
|
977
|
-
return (y +
|
|
978
|
-
}
|
|
979
|
-
function p(
|
|
980
|
-
var y,
|
|
981
|
-
for (
|
|
982
|
-
y = e[
|
|
983
|
-
return
|
|
984
|
-
}
|
|
985
|
-
function _(
|
|
986
|
-
return t[
|
|
987
|
-
}
|
|
988
|
-
function d(
|
|
989
|
-
for (var
|
|
990
|
-
|
|
991
|
-
return
|
|
992
|
-
}
|
|
993
|
-
function S(
|
|
994
|
-
for (var y,
|
|
995
|
-
|
|
996
|
-
return
|
|
923
|
+
var b = g.indexOf("=");
|
|
924
|
+
b === -1 && (b = y);
|
|
925
|
+
var A = b === y ? 0 : 4 - b % 4;
|
|
926
|
+
return [b, A];
|
|
927
|
+
}
|
|
928
|
+
function l(g) {
|
|
929
|
+
var y = c(g), b = y[0], A = y[1];
|
|
930
|
+
return (b + A) * 3 / 4 - A;
|
|
931
|
+
}
|
|
932
|
+
function m(g, y, b) {
|
|
933
|
+
return (y + b) * 3 / 4 - b;
|
|
934
|
+
}
|
|
935
|
+
function p(g) {
|
|
936
|
+
var y, b = c(g), A = b[0], C = b[1], I = new n(m(g, A, C)), x = 0, O = C > 0 ? A - 4 : A, T;
|
|
937
|
+
for (T = 0; T < O; T += 4)
|
|
938
|
+
y = e[g.charCodeAt(T)] << 18 | e[g.charCodeAt(T + 1)] << 12 | e[g.charCodeAt(T + 2)] << 6 | e[g.charCodeAt(T + 3)], I[x++] = y >> 16 & 255, I[x++] = y >> 8 & 255, I[x++] = y & 255;
|
|
939
|
+
return C === 2 && (y = e[g.charCodeAt(T)] << 2 | e[g.charCodeAt(T + 1)] >> 4, I[x++] = y & 255), C === 1 && (y = e[g.charCodeAt(T)] << 10 | e[g.charCodeAt(T + 1)] << 4 | e[g.charCodeAt(T + 2)] >> 2, I[x++] = y >> 8 & 255, I[x++] = y & 255), I;
|
|
940
|
+
}
|
|
941
|
+
function _(g) {
|
|
942
|
+
return t[g >> 18 & 63] + t[g >> 12 & 63] + t[g >> 6 & 63] + t[g & 63];
|
|
943
|
+
}
|
|
944
|
+
function d(g, y, b) {
|
|
945
|
+
for (var A, C = [], I = y; I < b; I += 3)
|
|
946
|
+
A = (g[I] << 16 & 16711680) + (g[I + 1] << 8 & 65280) + (g[I + 2] & 255), C.push(_(A));
|
|
947
|
+
return C.join("");
|
|
948
|
+
}
|
|
949
|
+
function S(g) {
|
|
950
|
+
for (var y, b = g.length, A = b % 3, C = [], I = 16383, x = 0, O = b - A; x < O; x += I)
|
|
951
|
+
C.push(d(g, x, x + I > O ? O : x + I));
|
|
952
|
+
return A === 1 ? (y = g[b - 1], C.push(
|
|
997
953
|
t[y >> 2] + t[y << 4 & 63] + "=="
|
|
998
|
-
)) :
|
|
954
|
+
)) : A === 2 && (y = (g[b - 2] << 8) + g[b - 1], C.push(
|
|
999
955
|
t[y >> 10] + t[y >> 4 & 63] + t[y << 2 & 63] + "="
|
|
1000
|
-
)),
|
|
956
|
+
)), C.join("");
|
|
1001
957
|
}
|
|
1002
|
-
return
|
|
958
|
+
return Ne;
|
|
1003
959
|
}
|
|
1004
|
-
var
|
|
1005
|
-
var
|
|
1006
|
-
function
|
|
1007
|
-
return
|
|
1008
|
-
var a,
|
|
1009
|
-
for (d += S, a =
|
|
960
|
+
var We = {};
|
|
961
|
+
var si;
|
|
962
|
+
function Dn() {
|
|
963
|
+
return si || (si = 1, We.read = function(t, e, n, o, u) {
|
|
964
|
+
var a, c, l = u * 8 - o - 1, m = (1 << l) - 1, p = m >> 1, _ = -7, d = n ? u - 1 : 0, S = n ? -1 : 1, g = t[e + d];
|
|
965
|
+
for (d += S, a = g & (1 << -_) - 1, g >>= -_, _ += l; _ > 0; a = a * 256 + t[e + d], d += S, _ -= 8)
|
|
1010
966
|
;
|
|
1011
|
-
for (
|
|
967
|
+
for (c = a & (1 << -_) - 1, a >>= -_, _ += o; _ > 0; c = c * 256 + t[e + d], d += S, _ -= 8)
|
|
1012
968
|
;
|
|
1013
969
|
if (a === 0)
|
|
1014
970
|
a = 1 - p;
|
|
1015
971
|
else {
|
|
1016
|
-
if (a ===
|
|
1017
|
-
return
|
|
1018
|
-
|
|
1019
|
-
}
|
|
1020
|
-
return (
|
|
1021
|
-
},
|
|
1022
|
-
var
|
|
1023
|
-
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (l = isNaN(e) ? 1 : 0,
|
|
972
|
+
if (a === m)
|
|
973
|
+
return c ? NaN : (g ? -1 : 1) * (1 / 0);
|
|
974
|
+
c = c + Math.pow(2, o), a = a - p;
|
|
975
|
+
}
|
|
976
|
+
return (g ? -1 : 1) * c * Math.pow(2, a - o);
|
|
977
|
+
}, We.write = function(t, e, n, o, u, a) {
|
|
978
|
+
var c, l, m, p = a * 8 - u - 1, _ = (1 << p) - 1, d = _ >> 1, S = u === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, g = o ? 0 : a - 1, y = o ? 1 : -1, b = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
|
|
979
|
+
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (l = isNaN(e) ? 1 : 0, c = _) : (c = Math.floor(Math.log(e) / Math.LN2), e * (m = Math.pow(2, -c)) < 1 && (c--, m *= 2), c + d >= 1 ? e += S / m : e += S * Math.pow(2, 1 - d), e * m >= 2 && (c++, m /= 2), c + d >= _ ? (l = 0, c = _) : c + d >= 1 ? (l = (e * m - 1) * Math.pow(2, u), c = c + d) : (l = e * Math.pow(2, d - 1) * Math.pow(2, u), c = 0)); u >= 8; t[n + g] = l & 255, g += y, l /= 256, u -= 8)
|
|
1024
980
|
;
|
|
1025
|
-
for (
|
|
981
|
+
for (c = c << u | l, p += u; p > 0; t[n + g] = c & 255, g += y, c /= 256, p -= 8)
|
|
1026
982
|
;
|
|
1027
|
-
t[n +
|
|
1028
|
-
}),
|
|
983
|
+
t[n + g - y] |= b * 128;
|
|
984
|
+
}), We;
|
|
1029
985
|
}
|
|
1030
|
-
var
|
|
1031
|
-
function
|
|
1032
|
-
return
|
|
1033
|
-
const e =
|
|
1034
|
-
t.Buffer = l, t.SlowBuffer =
|
|
1035
|
-
const
|
|
1036
|
-
t.kMaxLength =
|
|
986
|
+
var ai;
|
|
987
|
+
function Mn() {
|
|
988
|
+
return ai || (ai = 1, (function(t) {
|
|
989
|
+
const e = kn(), n = Dn(), o = typeof Symbol == "function" && typeof Symbol.for == "function" ? /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom") : null;
|
|
990
|
+
t.Buffer = l, t.SlowBuffer = I, t.INSPECT_MAX_BYTES = 50;
|
|
991
|
+
const u = 2147483647;
|
|
992
|
+
t.kMaxLength = u, l.TYPED_ARRAY_SUPPORT = a(), !l.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
|
|
1037
993
|
"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
|
|
1038
994
|
);
|
|
1039
995
|
function a() {
|
|
@@ -1059,8 +1015,8 @@ function Un() {
|
|
|
1059
1015
|
return this.byteOffset;
|
|
1060
1016
|
}
|
|
1061
1017
|
});
|
|
1062
|
-
function
|
|
1063
|
-
if (s >
|
|
1018
|
+
function c(s) {
|
|
1019
|
+
if (s > u)
|
|
1064
1020
|
throw new RangeError('The value "' + s + '" is invalid for option "size"');
|
|
1065
1021
|
const i = new Uint8Array(s);
|
|
1066
1022
|
return Object.setPrototypeOf(i, l.prototype), i;
|
|
@@ -1073,10 +1029,10 @@ function Un() {
|
|
|
1073
1029
|
);
|
|
1074
1030
|
return d(s);
|
|
1075
1031
|
}
|
|
1076
|
-
return
|
|
1032
|
+
return m(s, i, r);
|
|
1077
1033
|
}
|
|
1078
1034
|
l.poolSize = 8192;
|
|
1079
|
-
function
|
|
1035
|
+
function m(s, i, r) {
|
|
1080
1036
|
if (typeof s == "string")
|
|
1081
1037
|
return S(s, i);
|
|
1082
1038
|
if (ArrayBuffer.isView(s))
|
|
@@ -1086,7 +1042,7 @@ function Un() {
|
|
|
1086
1042
|
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof s
|
|
1087
1043
|
);
|
|
1088
1044
|
if (ee(s, ArrayBuffer) || s && ee(s.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (ee(s, SharedArrayBuffer) || s && ee(s.buffer, SharedArrayBuffer)))
|
|
1089
|
-
return
|
|
1045
|
+
return b(s, i, r);
|
|
1090
1046
|
if (typeof s == "number")
|
|
1091
1047
|
throw new TypeError(
|
|
1092
1048
|
'The "value" argument must not be of type number. Received type number'
|
|
@@ -1094,7 +1050,7 @@ function Un() {
|
|
|
1094
1050
|
const h = s.valueOf && s.valueOf();
|
|
1095
1051
|
if (h != null && h !== s)
|
|
1096
1052
|
return l.from(h, i, r);
|
|
1097
|
-
const f =
|
|
1053
|
+
const f = A(s);
|
|
1098
1054
|
if (f) return f;
|
|
1099
1055
|
if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof s[Symbol.toPrimitive] == "function")
|
|
1100
1056
|
return l.from(s[Symbol.toPrimitive]("string"), i, r);
|
|
@@ -1103,7 +1059,7 @@ function Un() {
|
|
|
1103
1059
|
);
|
|
1104
1060
|
}
|
|
1105
1061
|
l.from = function(s, i, r) {
|
|
1106
|
-
return
|
|
1062
|
+
return m(s, i, r);
|
|
1107
1063
|
}, Object.setPrototypeOf(l.prototype, Uint8Array.prototype), Object.setPrototypeOf(l, Uint8Array);
|
|
1108
1064
|
function p(s) {
|
|
1109
1065
|
if (typeof s != "number")
|
|
@@ -1112,13 +1068,13 @@ function Un() {
|
|
|
1112
1068
|
throw new RangeError('The value "' + s + '" is invalid for option "size"');
|
|
1113
1069
|
}
|
|
1114
1070
|
function _(s, i, r) {
|
|
1115
|
-
return p(s), s <= 0 ?
|
|
1071
|
+
return p(s), s <= 0 ? c(s) : i !== void 0 ? typeof r == "string" ? c(s).fill(i, r) : c(s).fill(i) : c(s);
|
|
1116
1072
|
}
|
|
1117
1073
|
l.alloc = function(s, i, r) {
|
|
1118
1074
|
return _(s, i, r);
|
|
1119
1075
|
};
|
|
1120
1076
|
function d(s) {
|
|
1121
|
-
return p(s),
|
|
1077
|
+
return p(s), c(s < 0 ? 0 : C(s) | 0);
|
|
1122
1078
|
}
|
|
1123
1079
|
l.allocUnsafe = function(s) {
|
|
1124
1080
|
return d(s);
|
|
@@ -1129,12 +1085,12 @@ function Un() {
|
|
|
1129
1085
|
if ((typeof i != "string" || i === "") && (i = "utf8"), !l.isEncoding(i))
|
|
1130
1086
|
throw new TypeError("Unknown encoding: " + i);
|
|
1131
1087
|
const r = x(s, i) | 0;
|
|
1132
|
-
let h =
|
|
1088
|
+
let h = c(r);
|
|
1133
1089
|
const f = h.write(s, i);
|
|
1134
1090
|
return f !== r && (h = h.slice(0, f)), h;
|
|
1135
1091
|
}
|
|
1136
|
-
function
|
|
1137
|
-
const i = s.length < 0 ? 0 :
|
|
1092
|
+
function g(s) {
|
|
1093
|
+
const i = s.length < 0 ? 0 : C(s.length) | 0, r = c(i);
|
|
1138
1094
|
for (let h = 0; h < i; h += 1)
|
|
1139
1095
|
r[h] = s[h] & 255;
|
|
1140
1096
|
return r;
|
|
@@ -1142,11 +1098,11 @@ function Un() {
|
|
|
1142
1098
|
function y(s) {
|
|
1143
1099
|
if (ee(s, Uint8Array)) {
|
|
1144
1100
|
const i = new Uint8Array(s);
|
|
1145
|
-
return
|
|
1101
|
+
return b(i.buffer, i.byteOffset, i.byteLength);
|
|
1146
1102
|
}
|
|
1147
|
-
return
|
|
1103
|
+
return g(s);
|
|
1148
1104
|
}
|
|
1149
|
-
function
|
|
1105
|
+
function b(s, i, r) {
|
|
1150
1106
|
if (i < 0 || s.byteLength < i)
|
|
1151
1107
|
throw new RangeError('"offset" is outside of buffer bounds');
|
|
1152
1108
|
if (s.byteLength < i + (r || 0))
|
|
@@ -1154,22 +1110,22 @@ function Un() {
|
|
|
1154
1110
|
let h;
|
|
1155
1111
|
return i === void 0 && r === void 0 ? h = new Uint8Array(s) : r === void 0 ? h = new Uint8Array(s, i) : h = new Uint8Array(s, i, r), Object.setPrototypeOf(h, l.prototype), h;
|
|
1156
1112
|
}
|
|
1157
|
-
function
|
|
1113
|
+
function A(s) {
|
|
1158
1114
|
if (l.isBuffer(s)) {
|
|
1159
|
-
const i =
|
|
1115
|
+
const i = C(s.length) | 0, r = c(i);
|
|
1160
1116
|
return r.length === 0 || s.copy(r, 0, 0, i), r;
|
|
1161
1117
|
}
|
|
1162
1118
|
if (s.length !== void 0)
|
|
1163
|
-
return typeof s.length != "number" ||
|
|
1119
|
+
return typeof s.length != "number" || ut(s.length) ? c(0) : g(s);
|
|
1164
1120
|
if (s.type === "Buffer" && Array.isArray(s.data))
|
|
1165
|
-
return
|
|
1121
|
+
return g(s.data);
|
|
1166
1122
|
}
|
|
1167
|
-
function
|
|
1168
|
-
if (s >=
|
|
1169
|
-
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" +
|
|
1123
|
+
function C(s) {
|
|
1124
|
+
if (s >= u)
|
|
1125
|
+
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + u.toString(16) + " bytes");
|
|
1170
1126
|
return s | 0;
|
|
1171
1127
|
}
|
|
1172
|
-
function
|
|
1128
|
+
function I(s) {
|
|
1173
1129
|
return +s != s && (s = 0), l.alloc(+s);
|
|
1174
1130
|
}
|
|
1175
1131
|
l.isBuffer = function(i) {
|
|
@@ -1251,7 +1207,7 @@ function Un() {
|
|
|
1251
1207
|
return r;
|
|
1252
1208
|
case "utf8":
|
|
1253
1209
|
case "utf-8":
|
|
1254
|
-
return
|
|
1210
|
+
return ct(s).length;
|
|
1255
1211
|
case "ucs2":
|
|
1256
1212
|
case "ucs-2":
|
|
1257
1213
|
case "utf16le":
|
|
@@ -1263,12 +1219,12 @@ function Un() {
|
|
|
1263
1219
|
return jt(s).length;
|
|
1264
1220
|
default:
|
|
1265
1221
|
if (f)
|
|
1266
|
-
return h ? -1 :
|
|
1222
|
+
return h ? -1 : ct(s).length;
|
|
1267
1223
|
i = ("" + i).toLowerCase(), f = !0;
|
|
1268
1224
|
}
|
|
1269
1225
|
}
|
|
1270
1226
|
l.byteLength = x;
|
|
1271
|
-
function
|
|
1227
|
+
function O(s, i, r) {
|
|
1272
1228
|
let h = !1;
|
|
1273
1229
|
if ((i === void 0 || i < 0) && (i = 0), i > this.length || ((r === void 0 || r > this.length) && (r = this.length), r <= 0) || (r >>>= 0, i >>>= 0, r <= i))
|
|
1274
1230
|
return "";
|
|
@@ -1297,7 +1253,7 @@ function Un() {
|
|
|
1297
1253
|
}
|
|
1298
1254
|
}
|
|
1299
1255
|
l.prototype._isBuffer = !0;
|
|
1300
|
-
function
|
|
1256
|
+
function T(s, i, r) {
|
|
1301
1257
|
const h = s[i];
|
|
1302
1258
|
s[i] = s[r], s[r] = h;
|
|
1303
1259
|
}
|
|
@@ -1306,25 +1262,25 @@ function Un() {
|
|
|
1306
1262
|
if (i % 2 !== 0)
|
|
1307
1263
|
throw new RangeError("Buffer size must be a multiple of 16-bits");
|
|
1308
1264
|
for (let r = 0; r < i; r += 2)
|
|
1309
|
-
|
|
1265
|
+
T(this, r, r + 1);
|
|
1310
1266
|
return this;
|
|
1311
1267
|
}, l.prototype.swap32 = function() {
|
|
1312
1268
|
const i = this.length;
|
|
1313
1269
|
if (i % 4 !== 0)
|
|
1314
1270
|
throw new RangeError("Buffer size must be a multiple of 32-bits");
|
|
1315
1271
|
for (let r = 0; r < i; r += 4)
|
|
1316
|
-
|
|
1272
|
+
T(this, r, r + 3), T(this, r + 1, r + 2);
|
|
1317
1273
|
return this;
|
|
1318
1274
|
}, l.prototype.swap64 = function() {
|
|
1319
1275
|
const i = this.length;
|
|
1320
1276
|
if (i % 8 !== 0)
|
|
1321
1277
|
throw new RangeError("Buffer size must be a multiple of 64-bits");
|
|
1322
1278
|
for (let r = 0; r < i; r += 8)
|
|
1323
|
-
|
|
1279
|
+
T(this, r, r + 7), T(this, r + 1, r + 6), T(this, r + 2, r + 5), T(this, r + 3, r + 4);
|
|
1324
1280
|
return this;
|
|
1325
1281
|
}, l.prototype.toString = function() {
|
|
1326
1282
|
const i = this.length;
|
|
1327
|
-
return i === 0 ? "" : arguments.length === 0 ? Mt(this, 0, i) :
|
|
1283
|
+
return i === 0 ? "" : arguments.length === 0 ? Mt(this, 0, i) : O.apply(this, arguments);
|
|
1328
1284
|
}, l.prototype.toLocaleString = l.prototype.toString, l.prototype.equals = function(i) {
|
|
1329
1285
|
if (!l.isBuffer(i)) throw new TypeError("Argument must be a Buffer");
|
|
1330
1286
|
return this === i ? !0 : l.compare(this, i) === 0;
|
|
@@ -1346,18 +1302,18 @@ function Un() {
|
|
|
1346
1302
|
if (r >= h)
|
|
1347
1303
|
return 1;
|
|
1348
1304
|
if (r >>>= 0, h >>>= 0, f >>>= 0, E >>>= 0, this === i) return 0;
|
|
1349
|
-
let v = E - f,
|
|
1350
|
-
const B = Math.min(v,
|
|
1351
|
-
for (let
|
|
1352
|
-
if (U[
|
|
1353
|
-
v = U[
|
|
1305
|
+
let v = E - f, R = h - r;
|
|
1306
|
+
const B = Math.min(v, R), U = this.slice(f, E), L = i.slice(r, h);
|
|
1307
|
+
for (let M = 0; M < B; ++M)
|
|
1308
|
+
if (U[M] !== L[M]) {
|
|
1309
|
+
v = U[M], R = L[M];
|
|
1354
1310
|
break;
|
|
1355
1311
|
}
|
|
1356
|
-
return v <
|
|
1312
|
+
return v < R ? -1 : R < v ? 1 : 0;
|
|
1357
1313
|
};
|
|
1358
|
-
function
|
|
1314
|
+
function q(s, i, r, h, f) {
|
|
1359
1315
|
if (s.length === 0) return -1;
|
|
1360
|
-
if (typeof r == "string" ? (h = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r,
|
|
1316
|
+
if (typeof r == "string" ? (h = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r, ut(r) && (r = f ? 0 : s.length - 1), r < 0 && (r = s.length + r), r >= s.length) {
|
|
1361
1317
|
if (f) return -1;
|
|
1362
1318
|
r = s.length - 1;
|
|
1363
1319
|
} else if (r < 0)
|
|
@@ -1370,28 +1326,28 @@ function Un() {
|
|
|
1370
1326
|
throw new TypeError("val must be string, number or Buffer");
|
|
1371
1327
|
}
|
|
1372
1328
|
function H(s, i, r, h, f) {
|
|
1373
|
-
let E = 1, v = s.length,
|
|
1329
|
+
let E = 1, v = s.length, R = i.length;
|
|
1374
1330
|
if (h !== void 0 && (h = String(h).toLowerCase(), h === "ucs2" || h === "ucs-2" || h === "utf16le" || h === "utf-16le")) {
|
|
1375
1331
|
if (s.length < 2 || i.length < 2)
|
|
1376
1332
|
return -1;
|
|
1377
|
-
E = 2, v /= 2,
|
|
1333
|
+
E = 2, v /= 2, R /= 2, r /= 2;
|
|
1378
1334
|
}
|
|
1379
|
-
function B(L,
|
|
1380
|
-
return E === 1 ? L[
|
|
1335
|
+
function B(L, M) {
|
|
1336
|
+
return E === 1 ? L[M] : L.readUInt16BE(M * E);
|
|
1381
1337
|
}
|
|
1382
1338
|
let U;
|
|
1383
1339
|
if (f) {
|
|
1384
1340
|
let L = -1;
|
|
1385
1341
|
for (U = r; U < v; U++)
|
|
1386
1342
|
if (B(s, U) === B(i, L === -1 ? 0 : U - L)) {
|
|
1387
|
-
if (L === -1 && (L = U), U - L + 1 ===
|
|
1343
|
+
if (L === -1 && (L = U), U - L + 1 === R) return L * E;
|
|
1388
1344
|
} else
|
|
1389
1345
|
L !== -1 && (U -= U - L), L = -1;
|
|
1390
1346
|
} else
|
|
1391
|
-
for (r +
|
|
1347
|
+
for (r + R > v && (r = v - R), U = r; U >= 0; U--) {
|
|
1392
1348
|
let L = !0;
|
|
1393
|
-
for (let
|
|
1394
|
-
if (B(s, U +
|
|
1349
|
+
for (let M = 0; M < R; M++)
|
|
1350
|
+
if (B(s, U + M) !== B(i, M)) {
|
|
1395
1351
|
L = !1;
|
|
1396
1352
|
break;
|
|
1397
1353
|
}
|
|
@@ -1402,9 +1358,9 @@ function Un() {
|
|
|
1402
1358
|
l.prototype.includes = function(i, r, h) {
|
|
1403
1359
|
return this.indexOf(i, r, h) !== -1;
|
|
1404
1360
|
}, l.prototype.indexOf = function(i, r, h) {
|
|
1405
|
-
return
|
|
1361
|
+
return q(this, i, r, h, !0);
|
|
1406
1362
|
}, l.prototype.lastIndexOf = function(i, r, h) {
|
|
1407
|
-
return
|
|
1363
|
+
return q(this, i, r, h, !1);
|
|
1408
1364
|
};
|
|
1409
1365
|
function ae(s, i, r, h) {
|
|
1410
1366
|
r = Number(r) || 0;
|
|
@@ -1414,14 +1370,14 @@ function Un() {
|
|
|
1414
1370
|
h > E / 2 && (h = E / 2);
|
|
1415
1371
|
let v;
|
|
1416
1372
|
for (v = 0; v < h; ++v) {
|
|
1417
|
-
const
|
|
1418
|
-
if (
|
|
1419
|
-
s[r + v] =
|
|
1373
|
+
const R = parseInt(i.substr(v * 2, 2), 16);
|
|
1374
|
+
if (ut(R)) return v;
|
|
1375
|
+
s[r + v] = R;
|
|
1420
1376
|
}
|
|
1421
1377
|
return v;
|
|
1422
1378
|
}
|
|
1423
1379
|
function ne(s, i, r, h) {
|
|
1424
|
-
return Ge(
|
|
1380
|
+
return Ge(ct(i, s.length - r), s, r, h);
|
|
1425
1381
|
}
|
|
1426
1382
|
function re(s, i, r, h) {
|
|
1427
1383
|
return Ge(rn(i), s, r, h);
|
|
@@ -1485,24 +1441,24 @@ function Un() {
|
|
|
1485
1441
|
let f = i;
|
|
1486
1442
|
for (; f < r; ) {
|
|
1487
1443
|
const E = s[f];
|
|
1488
|
-
let v = null,
|
|
1489
|
-
if (f +
|
|
1490
|
-
let B, U, L,
|
|
1491
|
-
switch (
|
|
1444
|
+
let v = null, R = E > 239 ? 4 : E > 223 ? 3 : E > 191 ? 2 : 1;
|
|
1445
|
+
if (f + R <= r) {
|
|
1446
|
+
let B, U, L, M;
|
|
1447
|
+
switch (R) {
|
|
1492
1448
|
case 1:
|
|
1493
1449
|
E < 128 && (v = E);
|
|
1494
1450
|
break;
|
|
1495
1451
|
case 2:
|
|
1496
|
-
B = s[f + 1], (B & 192) === 128 && (
|
|
1452
|
+
B = s[f + 1], (B & 192) === 128 && (M = (E & 31) << 6 | B & 63, M > 127 && (v = M));
|
|
1497
1453
|
break;
|
|
1498
1454
|
case 3:
|
|
1499
|
-
B = s[f + 1], U = s[f + 2], (B & 192) === 128 && (U & 192) === 128 && (
|
|
1455
|
+
B = s[f + 1], U = s[f + 2], (B & 192) === 128 && (U & 192) === 128 && (M = (E & 15) << 12 | (B & 63) << 6 | U & 63, M > 2047 && (M < 55296 || M > 57343) && (v = M));
|
|
1500
1456
|
break;
|
|
1501
1457
|
case 4:
|
|
1502
|
-
B = s[f + 1], U = s[f + 2], L = s[f + 3], (B & 192) === 128 && (U & 192) === 128 && (L & 192) === 128 && (
|
|
1458
|
+
B = s[f + 1], U = s[f + 2], L = s[f + 3], (B & 192) === 128 && (U & 192) === 128 && (L & 192) === 128 && (M = (E & 15) << 18 | (B & 63) << 12 | (U & 63) << 6 | L & 63, M > 65535 && M < 1114112 && (v = M));
|
|
1503
1459
|
}
|
|
1504
1460
|
}
|
|
1505
|
-
v === null ? (v = 65533,
|
|
1461
|
+
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;
|
|
1506
1462
|
}
|
|
1507
1463
|
return Ki(h);
|
|
1508
1464
|
}
|
|
@@ -1581,13 +1537,13 @@ function Un() {
|
|
|
1581
1537
|
}, l.prototype.readUint32BE = l.prototype.readUInt32BE = function(i, r) {
|
|
1582
1538
|
return i = i >>> 0, r || G(i, 4, this.length), this[i] * 16777216 + (this[i + 1] << 16 | this[i + 2] << 8 | this[i + 3]);
|
|
1583
1539
|
}, l.prototype.readBigUInt64LE = ce(function(i) {
|
|
1584
|
-
i = i >>> 0,
|
|
1540
|
+
i = i >>> 0, Se(i, "offset");
|
|
1585
1541
|
const r = this[i], h = this[i + 7];
|
|
1586
1542
|
(r === void 0 || h === void 0) && Re(i, this.length - 8);
|
|
1587
1543
|
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;
|
|
1588
1544
|
return BigInt(f) + (BigInt(E) << BigInt(32));
|
|
1589
1545
|
}), l.prototype.readBigUInt64BE = ce(function(i) {
|
|
1590
|
-
i = i >>> 0,
|
|
1546
|
+
i = i >>> 0, Se(i, "offset");
|
|
1591
1547
|
const r = this[i], h = this[i + 7];
|
|
1592
1548
|
(r === void 0 || h === void 0) && Re(i, this.length - 8);
|
|
1593
1549
|
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;
|
|
@@ -1619,13 +1575,13 @@ function Un() {
|
|
|
1619
1575
|
}, l.prototype.readInt32BE = function(i, r) {
|
|
1620
1576
|
return i = i >>> 0, r || G(i, 4, this.length), this[i] << 24 | this[i + 1] << 16 | this[i + 2] << 8 | this[i + 3];
|
|
1621
1577
|
}, l.prototype.readBigInt64LE = ce(function(i) {
|
|
1622
|
-
i = i >>> 0,
|
|
1578
|
+
i = i >>> 0, Se(i, "offset");
|
|
1623
1579
|
const r = this[i], h = this[i + 7];
|
|
1624
1580
|
(r === void 0 || h === void 0) && Re(i, this.length - 8);
|
|
1625
1581
|
const f = this[i + 4] + this[i + 5] * 2 ** 8 + this[i + 6] * 2 ** 16 + (h << 24);
|
|
1626
1582
|
return (BigInt(f) << BigInt(32)) + BigInt(r + this[++i] * 2 ** 8 + this[++i] * 2 ** 16 + this[++i] * 2 ** 24);
|
|
1627
1583
|
}), l.prototype.readBigInt64BE = ce(function(i) {
|
|
1628
|
-
i = i >>> 0,
|
|
1584
|
+
i = i >>> 0, Se(i, "offset");
|
|
1629
1585
|
const r = this[i], h = this[i + 7];
|
|
1630
1586
|
(r === void 0 || h === void 0) && Re(i, this.length - 8);
|
|
1631
1587
|
const f = (r << 24) + // Overflow
|
|
@@ -1640,15 +1596,15 @@ function Un() {
|
|
|
1640
1596
|
}, l.prototype.readDoubleBE = function(i, r) {
|
|
1641
1597
|
return i = i >>> 0, r || G(i, 8, this.length), n.read(this, i, !1, 52, 8);
|
|
1642
1598
|
};
|
|
1643
|
-
function
|
|
1599
|
+
function Y(s, i, r, h, f, E) {
|
|
1644
1600
|
if (!l.isBuffer(s)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
1645
1601
|
if (i > f || i < E) throw new RangeError('"value" argument is out of bounds');
|
|
1646
1602
|
if (r + h > s.length) throw new RangeError("Index out of range");
|
|
1647
1603
|
}
|
|
1648
1604
|
l.prototype.writeUintLE = l.prototype.writeUIntLE = function(i, r, h, f) {
|
|
1649
1605
|
if (i = +i, r = r >>> 0, h = h >>> 0, !f) {
|
|
1650
|
-
const
|
|
1651
|
-
|
|
1606
|
+
const R = Math.pow(2, 8 * h) - 1;
|
|
1607
|
+
Y(this, i, r, h, R, 0);
|
|
1652
1608
|
}
|
|
1653
1609
|
let E = 1, v = 0;
|
|
1654
1610
|
for (this[r] = i & 255; ++v < h && (E *= 256); )
|
|
@@ -1656,23 +1612,23 @@ function Un() {
|
|
|
1656
1612
|
return r + h;
|
|
1657
1613
|
}, l.prototype.writeUintBE = l.prototype.writeUIntBE = function(i, r, h, f) {
|
|
1658
1614
|
if (i = +i, r = r >>> 0, h = h >>> 0, !f) {
|
|
1659
|
-
const
|
|
1660
|
-
|
|
1615
|
+
const R = Math.pow(2, 8 * h) - 1;
|
|
1616
|
+
Y(this, i, r, h, R, 0);
|
|
1661
1617
|
}
|
|
1662
1618
|
let E = h - 1, v = 1;
|
|
1663
1619
|
for (this[r + E] = i & 255; --E >= 0 && (v *= 256); )
|
|
1664
1620
|
this[r + E] = i / v & 255;
|
|
1665
1621
|
return r + h;
|
|
1666
1622
|
}, l.prototype.writeUint8 = l.prototype.writeUInt8 = function(i, r, h) {
|
|
1667
|
-
return i = +i, r = r >>> 0, h ||
|
|
1623
|
+
return i = +i, r = r >>> 0, h || Y(this, i, r, 1, 255, 0), this[r] = i & 255, r + 1;
|
|
1668
1624
|
}, l.prototype.writeUint16LE = l.prototype.writeUInt16LE = function(i, r, h) {
|
|
1669
|
-
return i = +i, r = r >>> 0, h ||
|
|
1625
|
+
return i = +i, r = r >>> 0, h || Y(this, i, r, 2, 65535, 0), this[r] = i & 255, this[r + 1] = i >>> 8, r + 2;
|
|
1670
1626
|
}, l.prototype.writeUint16BE = l.prototype.writeUInt16BE = function(i, r, h) {
|
|
1671
|
-
return i = +i, r = r >>> 0, h ||
|
|
1627
|
+
return i = +i, r = r >>> 0, h || Y(this, i, r, 2, 65535, 0), this[r] = i >>> 8, this[r + 1] = i & 255, r + 2;
|
|
1672
1628
|
}, l.prototype.writeUint32LE = l.prototype.writeUInt32LE = function(i, r, h) {
|
|
1673
|
-
return i = +i, r = r >>> 0, h ||
|
|
1629
|
+
return i = +i, r = r >>> 0, h || Y(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;
|
|
1674
1630
|
}, l.prototype.writeUint32BE = l.prototype.writeUInt32BE = function(i, r, h) {
|
|
1675
|
-
return i = +i, r = r >>> 0, h ||
|
|
1631
|
+
return i = +i, r = r >>> 0, h || Y(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;
|
|
1676
1632
|
};
|
|
1677
1633
|
function Bt(s, i, r, h, f) {
|
|
1678
1634
|
Vt(i, h, f, s, r, 7);
|
|
@@ -1695,31 +1651,31 @@ function Un() {
|
|
|
1695
1651
|
}), l.prototype.writeIntLE = function(i, r, h, f) {
|
|
1696
1652
|
if (i = +i, r = r >>> 0, !f) {
|
|
1697
1653
|
const B = Math.pow(2, 8 * h - 1);
|
|
1698
|
-
|
|
1654
|
+
Y(this, i, r, h, B - 1, -B);
|
|
1699
1655
|
}
|
|
1700
|
-
let E = 0, v = 1,
|
|
1656
|
+
let E = 0, v = 1, R = 0;
|
|
1701
1657
|
for (this[r] = i & 255; ++E < h && (v *= 256); )
|
|
1702
|
-
i < 0 &&
|
|
1658
|
+
i < 0 && R === 0 && this[r + E - 1] !== 0 && (R = 1), this[r + E] = (i / v >> 0) - R & 255;
|
|
1703
1659
|
return r + h;
|
|
1704
1660
|
}, l.prototype.writeIntBE = function(i, r, h, f) {
|
|
1705
1661
|
if (i = +i, r = r >>> 0, !f) {
|
|
1706
1662
|
const B = Math.pow(2, 8 * h - 1);
|
|
1707
|
-
|
|
1663
|
+
Y(this, i, r, h, B - 1, -B);
|
|
1708
1664
|
}
|
|
1709
|
-
let E = h - 1, v = 1,
|
|
1665
|
+
let E = h - 1, v = 1, R = 0;
|
|
1710
1666
|
for (this[r + E] = i & 255; --E >= 0 && (v *= 256); )
|
|
1711
|
-
i < 0 &&
|
|
1667
|
+
i < 0 && R === 0 && this[r + E + 1] !== 0 && (R = 1), this[r + E] = (i / v >> 0) - R & 255;
|
|
1712
1668
|
return r + h;
|
|
1713
1669
|
}, l.prototype.writeInt8 = function(i, r, h) {
|
|
1714
|
-
return i = +i, r = r >>> 0, h ||
|
|
1670
|
+
return i = +i, r = r >>> 0, h || Y(this, i, r, 1, 127, -128), i < 0 && (i = 255 + i + 1), this[r] = i & 255, r + 1;
|
|
1715
1671
|
}, l.prototype.writeInt16LE = function(i, r, h) {
|
|
1716
|
-
return i = +i, r = r >>> 0, h ||
|
|
1672
|
+
return i = +i, r = r >>> 0, h || Y(this, i, r, 2, 32767, -32768), this[r] = i & 255, this[r + 1] = i >>> 8, r + 2;
|
|
1717
1673
|
}, l.prototype.writeInt16BE = function(i, r, h) {
|
|
1718
|
-
return i = +i, r = r >>> 0, h ||
|
|
1674
|
+
return i = +i, r = r >>> 0, h || Y(this, i, r, 2, 32767, -32768), this[r] = i >>> 8, this[r + 1] = i & 255, r + 2;
|
|
1719
1675
|
}, l.prototype.writeInt32LE = function(i, r, h) {
|
|
1720
|
-
return i = +i, r = r >>> 0, h ||
|
|
1676
|
+
return i = +i, r = r >>> 0, h || Y(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;
|
|
1721
1677
|
}, l.prototype.writeInt32BE = function(i, r, h) {
|
|
1722
|
-
return i = +i, r = r >>> 0, h ||
|
|
1678
|
+
return i = +i, r = r >>> 0, h || Y(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;
|
|
1723
1679
|
}, l.prototype.writeBigInt64LE = ce(function(i, r = 0) {
|
|
1724
1680
|
return Bt(this, i, r, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
1725
1681
|
}), l.prototype.writeBigInt64BE = ce(function(i, r = 0) {
|
|
@@ -1779,17 +1735,17 @@ function Un() {
|
|
|
1779
1735
|
for (E = r; E < h; ++E)
|
|
1780
1736
|
this[E] = i;
|
|
1781
1737
|
else {
|
|
1782
|
-
const v = l.isBuffer(i) ? i : l.from(i, f),
|
|
1783
|
-
if (
|
|
1738
|
+
const v = l.isBuffer(i) ? i : l.from(i, f), R = v.length;
|
|
1739
|
+
if (R === 0)
|
|
1784
1740
|
throw new TypeError('The value "' + i + '" is invalid for argument "value"');
|
|
1785
1741
|
for (E = 0; E < h - r; ++E)
|
|
1786
|
-
this[E + r] = v[E %
|
|
1742
|
+
this[E + r] = v[E % R];
|
|
1787
1743
|
}
|
|
1788
1744
|
return this;
|
|
1789
1745
|
};
|
|
1790
|
-
const
|
|
1791
|
-
function
|
|
1792
|
-
|
|
1746
|
+
const ye = {};
|
|
1747
|
+
function lt(s, i, r) {
|
|
1748
|
+
ye[s] = class extends r {
|
|
1793
1749
|
constructor() {
|
|
1794
1750
|
super(), Object.defineProperty(this, "message", {
|
|
1795
1751
|
value: i.apply(this, arguments),
|
|
@@ -1813,19 +1769,19 @@ function Un() {
|
|
|
1813
1769
|
}
|
|
1814
1770
|
};
|
|
1815
1771
|
}
|
|
1816
|
-
|
|
1772
|
+
lt(
|
|
1817
1773
|
"ERR_BUFFER_OUT_OF_BOUNDS",
|
|
1818
1774
|
function(s) {
|
|
1819
1775
|
return s ? `${s} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
|
|
1820
1776
|
},
|
|
1821
1777
|
RangeError
|
|
1822
|
-
),
|
|
1778
|
+
), lt(
|
|
1823
1779
|
"ERR_INVALID_ARG_TYPE",
|
|
1824
1780
|
function(s, i) {
|
|
1825
1781
|
return `The "${s}" argument must be of type number. Received type ${typeof i}`;
|
|
1826
1782
|
},
|
|
1827
1783
|
TypeError
|
|
1828
|
-
),
|
|
1784
|
+
), lt(
|
|
1829
1785
|
"ERR_OUT_OF_RANGE",
|
|
1830
1786
|
function(s, i, r) {
|
|
1831
1787
|
let h = `The value of "${s}" is out of range.`, f = r;
|
|
@@ -1841,22 +1797,22 @@ function Un() {
|
|
|
1841
1797
|
return `${s.slice(0, r)}${i}`;
|
|
1842
1798
|
}
|
|
1843
1799
|
function en(s, i, r) {
|
|
1844
|
-
|
|
1800
|
+
Se(i, "offset"), (s[i] === void 0 || s[i + r] === void 0) && Re(i, s.length - (r + 1));
|
|
1845
1801
|
}
|
|
1846
1802
|
function Vt(s, i, r, h, f, E) {
|
|
1847
1803
|
if (s > r || s < i) {
|
|
1848
1804
|
const v = typeof i == "bigint" ? "n" : "";
|
|
1849
|
-
let
|
|
1850
|
-
throw i === 0 || i === BigInt(0) ?
|
|
1805
|
+
let R;
|
|
1806
|
+
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 ye.ERR_OUT_OF_RANGE("value", R, s);
|
|
1851
1807
|
}
|
|
1852
1808
|
en(h, f, E);
|
|
1853
1809
|
}
|
|
1854
|
-
function
|
|
1810
|
+
function Se(s, i) {
|
|
1855
1811
|
if (typeof s != "number")
|
|
1856
|
-
throw new
|
|
1812
|
+
throw new ye.ERR_INVALID_ARG_TYPE(i, "number", s);
|
|
1857
1813
|
}
|
|
1858
1814
|
function Re(s, i, r) {
|
|
1859
|
-
throw Math.floor(s) !== s ? (
|
|
1815
|
+
throw Math.floor(s) !== s ? (Se(s, r), new ye.ERR_OUT_OF_RANGE("offset", "an integer", s)) : i < 0 ? new ye.ERR_BUFFER_OUT_OF_BOUNDS() : new ye.ERR_OUT_OF_RANGE(
|
|
1860
1816
|
"offset",
|
|
1861
1817
|
`>= 0 and <= ${i}`,
|
|
1862
1818
|
s
|
|
@@ -1869,7 +1825,7 @@ function Un() {
|
|
|
1869
1825
|
s = s + "=";
|
|
1870
1826
|
return s;
|
|
1871
1827
|
}
|
|
1872
|
-
function
|
|
1828
|
+
function ct(s, i) {
|
|
1873
1829
|
i = i || 1 / 0;
|
|
1874
1830
|
let r;
|
|
1875
1831
|
const h = s.length;
|
|
@@ -1948,7 +1904,7 @@ function Un() {
|
|
|
1948
1904
|
function ee(s, i) {
|
|
1949
1905
|
return s instanceof i || s != null && s.constructor != null && s.constructor.name != null && s.constructor.name === i.name;
|
|
1950
1906
|
}
|
|
1951
|
-
function
|
|
1907
|
+
function ut(s) {
|
|
1952
1908
|
return s !== s;
|
|
1953
1909
|
}
|
|
1954
1910
|
const sn = (function() {
|
|
@@ -1966,72 +1922,72 @@ function Un() {
|
|
|
1966
1922
|
function an() {
|
|
1967
1923
|
throw new Error("BigInt not supported");
|
|
1968
1924
|
}
|
|
1969
|
-
})(
|
|
1925
|
+
})(ft)), ft;
|
|
1970
1926
|
}
|
|
1971
|
-
var
|
|
1972
|
-
const
|
|
1927
|
+
var Un = Mn();
|
|
1928
|
+
const Bn = "https://api.anam.ai", Ln = "/v1", Hi = {
|
|
1973
1929
|
client: "js-sdk",
|
|
1974
1930
|
version: "4.8.0"
|
|
1975
1931
|
};
|
|
1976
|
-
var
|
|
1977
|
-
function
|
|
1978
|
-
return a instanceof n ? a : new n(function(
|
|
1979
|
-
|
|
1932
|
+
var Pn = function(t, e, n, o) {
|
|
1933
|
+
function u(a) {
|
|
1934
|
+
return a instanceof n ? a : new n(function(c) {
|
|
1935
|
+
c(a);
|
|
1980
1936
|
});
|
|
1981
1937
|
}
|
|
1982
|
-
return new (n || (n = Promise))(function(a,
|
|
1938
|
+
return new (n || (n = Promise))(function(a, c) {
|
|
1983
1939
|
function l(_) {
|
|
1984
1940
|
try {
|
|
1985
1941
|
p(o.next(_));
|
|
1986
1942
|
} catch (d) {
|
|
1987
|
-
|
|
1943
|
+
c(d);
|
|
1988
1944
|
}
|
|
1989
1945
|
}
|
|
1990
|
-
function
|
|
1946
|
+
function m(_) {
|
|
1991
1947
|
try {
|
|
1992
1948
|
p(o.throw(_));
|
|
1993
1949
|
} catch (d) {
|
|
1994
|
-
|
|
1950
|
+
c(d);
|
|
1995
1951
|
}
|
|
1996
1952
|
}
|
|
1997
1953
|
function p(_) {
|
|
1998
|
-
_.done ? a(_.value) :
|
|
1954
|
+
_.done ? a(_.value) : u(_.value).then(l, m);
|
|
1999
1955
|
}
|
|
2000
1956
|
p((o = o.apply(t, e || [])).next());
|
|
2001
1957
|
});
|
|
2002
1958
|
};
|
|
2003
|
-
const
|
|
1959
|
+
const Wi = "https://api.anam.ai", xt = "/v1";
|
|
2004
1960
|
var se;
|
|
2005
1961
|
(function(t) {
|
|
2006
1962
|
t.CLIENT_METRIC_MEASUREMENT_ERROR = "client_error", t.CLIENT_METRIC_MEASUREMENT_CONNECTION_CLOSED = "client_connection_closed", t.CLIENT_METRIC_MEASUREMENT_CONNECTION_ESTABLISHED = "client_connection_established", t.CLIENT_METRIC_MEASUREMENT_SESSION_ATTEMPT = "client_session_attempt", t.CLIENT_METRIC_MEASUREMENT_SESSION_SUCCESS = "client_session_success";
|
|
2007
1963
|
})(se || (se = {}));
|
|
2008
|
-
let
|
|
2009
|
-
const
|
|
2010
|
-
|
|
2011
|
-
},
|
|
1964
|
+
let St = Wi, zi = xt, de, qi = !1;
|
|
1965
|
+
const Fn = (t, e = xt) => {
|
|
1966
|
+
St = t, zi = e;
|
|
1967
|
+
}, $n = (t) => {
|
|
2012
1968
|
de = t;
|
|
2013
|
-
},
|
|
2014
|
-
|
|
1969
|
+
}, Gn = (t) => {
|
|
1970
|
+
qi = t;
|
|
2015
1971
|
};
|
|
2016
1972
|
let he = {
|
|
2017
1973
|
sessionId: null,
|
|
2018
1974
|
organizationId: null,
|
|
2019
1975
|
attemptCorrelationId: null
|
|
2020
1976
|
};
|
|
2021
|
-
const
|
|
1977
|
+
const we = (t) => {
|
|
2022
1978
|
he = Object.assign(Object.assign({}, he), t);
|
|
2023
|
-
},
|
|
2024
|
-
if (!
|
|
1979
|
+
}, ge = (t, e, n) => Pn(void 0, void 0, void 0, function* () {
|
|
1980
|
+
if (!qi)
|
|
2025
1981
|
try {
|
|
2026
|
-
const o = Object.assign(Object.assign({},
|
|
1982
|
+
const o = Object.assign(Object.assign({}, Hi), n);
|
|
2027
1983
|
he.sessionId && (o.sessionId = he.sessionId), he.organizationId && (o.organizationId = he.organizationId), he.attemptCorrelationId && (o.attemptCorrelationId = he.attemptCorrelationId);
|
|
2028
|
-
const
|
|
2029
|
-
let a,
|
|
1984
|
+
const u = `${zi}/metrics/client`;
|
|
1985
|
+
let a, c = {
|
|
2030
1986
|
"Content-Type": "application/json"
|
|
2031
1987
|
};
|
|
2032
|
-
de?.enabled && de?.baseUrl ? (a = `${de.baseUrl}${
|
|
1988
|
+
de?.enabled && de?.baseUrl ? (a = `${de.baseUrl}${u}`, c["X-Anam-Target-Url"] = `${St}${u}`) : a = `${St}${u}`, yield fetch(a, {
|
|
2033
1989
|
method: "POST",
|
|
2034
|
-
headers:
|
|
1990
|
+
headers: c,
|
|
2035
1991
|
body: JSON.stringify({
|
|
2036
1992
|
name: t,
|
|
2037
1993
|
value: e,
|
|
@@ -2041,50 +1997,50 @@ const Se = (t) => {
|
|
|
2041
1997
|
} catch (o) {
|
|
2042
1998
|
console.error("Failed to send error metric:", o);
|
|
2043
1999
|
}
|
|
2044
|
-
}),
|
|
2045
|
-
var n, o,
|
|
2000
|
+
}), Vn = (t, e = "console") => {
|
|
2001
|
+
var n, o, u;
|
|
2046
2002
|
const a = {};
|
|
2047
2003
|
t.forEach((d) => {
|
|
2048
2004
|
a[d.type] || (a[d.type] = []), a[d.type].push(d);
|
|
2049
2005
|
});
|
|
2050
|
-
const
|
|
2006
|
+
const c = {
|
|
2051
2007
|
issues: []
|
|
2052
2008
|
}, l = ((n = a["inbound-rtp"]) === null || n === void 0 ? void 0 : n.filter((d) => d.kind === "video")) || [];
|
|
2053
|
-
l.length > 0 && (
|
|
2054
|
-
var S,
|
|
2055
|
-
const
|
|
2009
|
+
l.length > 0 && (c.personaVideoStream = [], l.forEach((d) => {
|
|
2010
|
+
var S, g, y, b, A;
|
|
2011
|
+
const C = {
|
|
2056
2012
|
framesReceived: (S = d.framesReceived) !== null && S !== void 0 ? S : "unknown",
|
|
2057
|
-
framesDropped: (
|
|
2013
|
+
framesDropped: (g = d.framesDropped) !== null && g !== void 0 ? g : "unknown",
|
|
2058
2014
|
framesPerSecond: (y = d.framesPerSecond) !== null && y !== void 0 ? y : "unknown",
|
|
2059
|
-
packetsReceived: (
|
|
2060
|
-
packetsLost: (
|
|
2015
|
+
packetsReceived: (b = d.packetsReceived) !== null && b !== void 0 ? b : "unknown",
|
|
2016
|
+
packetsLost: (A = d.packetsLost) !== null && A !== void 0 ? A : "unknown",
|
|
2061
2017
|
resolution: d.frameWidth && d.frameHeight ? `${d.frameWidth}x${d.frameHeight}` : void 0,
|
|
2062
2018
|
jitter: d.jitter !== void 0 ? d.jitter : void 0
|
|
2063
2019
|
};
|
|
2064
|
-
|
|
2020
|
+
c.personaVideoStream.push(C);
|
|
2065
2021
|
}));
|
|
2066
|
-
const
|
|
2067
|
-
|
|
2068
|
-
var S,
|
|
2069
|
-
const
|
|
2022
|
+
const m = ((o = a["inbound-rtp"]) === null || o === void 0 ? void 0 : o.filter((d) => d.kind === "audio")) || [];
|
|
2023
|
+
m.length > 0 && (c.personaAudioStream = [], m.forEach((d) => {
|
|
2024
|
+
var S, g, y;
|
|
2025
|
+
const b = {
|
|
2070
2026
|
packetsReceived: (S = d.packetsReceived) !== null && S !== void 0 ? S : "unknown",
|
|
2071
|
-
packetsLost: (
|
|
2027
|
+
packetsLost: (g = d.packetsLost) !== null && g !== void 0 ? g : "unknown",
|
|
2072
2028
|
audioLevel: (y = d.audioLevel) !== null && y !== void 0 ? y : "unknown",
|
|
2073
2029
|
jitter: d.jitter !== void 0 ? d.jitter : void 0,
|
|
2074
2030
|
totalAudioEnergy: d.totalAudioEnergy !== void 0 ? d.totalAudioEnergy : void 0
|
|
2075
2031
|
};
|
|
2076
|
-
|
|
2032
|
+
c.personaAudioStream.push(b);
|
|
2077
2033
|
}));
|
|
2078
|
-
const p = ((
|
|
2079
|
-
p.length > 0 && (
|
|
2080
|
-
var S,
|
|
2034
|
+
const p = ((u = a["outbound-rtp"]) === null || u === void 0 ? void 0 : u.filter((d) => d.kind === "audio")) || [];
|
|
2035
|
+
p.length > 0 && (c.userAudioInput = [], p.forEach((d) => {
|
|
2036
|
+
var S, g;
|
|
2081
2037
|
const y = {
|
|
2082
2038
|
packetsSent: (S = d.packetsSent) !== null && S !== void 0 ? S : "unknown",
|
|
2083
|
-
retransmittedPackets: (
|
|
2039
|
+
retransmittedPackets: (g = d.retransmittedPacketsSent) !== null && g !== void 0 ? g : void 0,
|
|
2084
2040
|
avgPacketSendDelay: d.totalPacketSendDelay !== void 0 ? d.totalPacketSendDelay / (d.packetsSent || 1) * 1e3 : void 0
|
|
2085
2041
|
};
|
|
2086
|
-
|
|
2087
|
-
})), a.codec && (
|
|
2042
|
+
c.userAudioInput.push(y);
|
|
2043
|
+
})), a.codec && (c.codecs = [], a.codec.forEach((d) => {
|
|
2088
2044
|
const S = {
|
|
2089
2045
|
status: d.payloadType ? "Active" : "Available",
|
|
2090
2046
|
mimeType: d.mimeType || "Unknown",
|
|
@@ -2092,51 +2048,51 @@ const Se = (t) => {
|
|
|
2092
2048
|
clockRate: d.clockRate || void 0,
|
|
2093
2049
|
channels: d.channels || void 0
|
|
2094
2050
|
};
|
|
2095
|
-
|
|
2096
|
-
})), a.transport && (
|
|
2051
|
+
c.codecs.push(S);
|
|
2052
|
+
})), a.transport && (c.transportLayer = [], a.transport.forEach((d) => {
|
|
2097
2053
|
const S = {
|
|
2098
2054
|
dtlsState: d.dtlsState || "unknown",
|
|
2099
2055
|
iceState: d.iceState || "unknown",
|
|
2100
2056
|
bytesSent: d.bytesSent || void 0,
|
|
2101
2057
|
bytesReceived: d.bytesReceived || void 0
|
|
2102
2058
|
};
|
|
2103
|
-
|
|
2059
|
+
c.transportLayer.push(S);
|
|
2104
2060
|
}));
|
|
2105
2061
|
const _ = [];
|
|
2106
2062
|
if (l.forEach((d) => {
|
|
2107
2063
|
typeof d.framesDropped == "number" && d.framesDropped > 0 && _.push(`Video: ${d.framesDropped} frames dropped`), typeof d.packetsLost == "number" && d.packetsLost > 0 && _.push(`Video: ${d.packetsLost} packets lost`), typeof d.framesPerSecond == "number" && d.framesPerSecond < 23 && _.push(`Video: Low frame rate (${d.framesPerSecond} fps)`);
|
|
2108
|
-
}),
|
|
2064
|
+
}), m.forEach((d) => {
|
|
2109
2065
|
typeof d.packetsLost == "number" && d.packetsLost > 0 && _.push(`Audio: ${d.packetsLost} packets lost`), typeof d.jitter == "number" && d.jitter > 0.1 && _.push(`Audio: High jitter (${(d.jitter * 1e3).toFixed(1)}ms)`);
|
|
2110
|
-
}),
|
|
2111
|
-
return
|
|
2112
|
-
console.group("📊 WebRTC Session Statistics Report"),
|
|
2066
|
+
}), c.issues = _, e === "json")
|
|
2067
|
+
return c;
|
|
2068
|
+
console.group("📊 WebRTC Session Statistics Report"), c.personaVideoStream && c.personaVideoStream.length > 0 && (console.group("📹 Persona Video Stream (Inbound)"), c.personaVideoStream.forEach((d) => {
|
|
2113
2069
|
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`);
|
|
2114
|
-
}), console.groupEnd()),
|
|
2070
|
+
}), console.groupEnd()), c.personaAudioStream && c.personaAudioStream.length > 0 && (console.group("🔊 Persona Audio Stream (Inbound)"), c.personaAudioStream.forEach((d) => {
|
|
2115
2071
|
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)}`);
|
|
2116
|
-
}), console.groupEnd()),
|
|
2072
|
+
}), console.groupEnd()), c.userAudioInput && c.userAudioInput.length > 0 && (console.group("🎤 User Audio Input (Outbound)"), c.userAudioInput.forEach((d) => {
|
|
2117
2073
|
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`);
|
|
2118
|
-
}), console.groupEnd()),
|
|
2074
|
+
}), console.groupEnd()), c.codecs && c.codecs.length > 0 && (console.group("🔧 Codecs Used"), c.codecs.forEach((d) => {
|
|
2119
2075
|
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}`);
|
|
2120
|
-
}), console.groupEnd()),
|
|
2076
|
+
}), console.groupEnd()), c.transportLayer && c.transportLayer.length > 0 && (console.group("🚚 Transport Layer"), c.transportLayer.forEach((d) => {
|
|
2121
2077
|
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()}`);
|
|
2122
|
-
}), console.groupEnd()),
|
|
2078
|
+
}), console.groupEnd()), c.issues.length > 0 ? (console.group("⚠️ Potential Issues Detected"), c.issues.forEach((d) => console.warn(d)), console.groupEnd()) : console.log("✅ No significant issues detected"), console.groupEnd();
|
|
2123
2079
|
};
|
|
2124
2080
|
var V;
|
|
2125
2081
|
(function(t) {
|
|
2126
2082
|
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";
|
|
2127
2083
|
})(V || (V = {}));
|
|
2128
2084
|
class $ extends Error {
|
|
2129
|
-
constructor(e, n, o = 500,
|
|
2130
|
-
super(e), this.name = "ClientError", this.code = n, this.statusCode = o, this.details =
|
|
2131
|
-
details:
|
|
2085
|
+
constructor(e, n, o = 500, u) {
|
|
2086
|
+
super(e), this.name = "ClientError", this.code = n, this.statusCode = o, this.details = u, Object.setPrototypeOf(this, $.prototype), ge(se.CLIENT_METRIC_MEASUREMENT_ERROR, n, {
|
|
2087
|
+
details: u,
|
|
2132
2088
|
statusCode: o
|
|
2133
2089
|
});
|
|
2134
2090
|
}
|
|
2135
2091
|
}
|
|
2136
|
-
function
|
|
2092
|
+
function li() {
|
|
2137
2093
|
return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : Date.now().toString(36) + Math.random().toString(36).substr(2, 9);
|
|
2138
2094
|
}
|
|
2139
|
-
function
|
|
2095
|
+
function jn(t) {
|
|
2140
2096
|
if (!(!t || !t.enabled)) {
|
|
2141
2097
|
if (!t.baseUrl)
|
|
2142
2098
|
return "API Gateway baseUrl is required when enabled";
|
|
@@ -2163,23 +2119,23 @@ var fe;
|
|
|
2163
2119
|
(function(t) {
|
|
2164
2120
|
t.PENDING = "pending", t.GRANTED = "granted", t.DENIED = "denied", t.NOT_REQUESTED = "not_requested";
|
|
2165
2121
|
})(fe || (fe = {}));
|
|
2166
|
-
var
|
|
2122
|
+
var tt;
|
|
2167
2123
|
(function(t) {
|
|
2168
2124
|
t.USER = "user", t.PERSONA = "persona";
|
|
2169
|
-
})(
|
|
2170
|
-
var
|
|
2125
|
+
})(tt || (tt = {}));
|
|
2126
|
+
var N;
|
|
2171
2127
|
(function(t) {
|
|
2172
2128
|
t.MESSAGE_HISTORY_UPDATED = "MESSAGE_HISTORY_UPDATED", t.MESSAGE_STREAM_EVENT_RECEIVED = "MESSAGE_STREAM_EVENT_RECEIVED", t.CONNECTION_ESTABLISHED = "CONNECTION_ESTABLISHED", t.CONNECTION_CLOSED = "CONNECTION_CLOSED", t.INPUT_AUDIO_STREAM_STARTED = "INPUT_AUDIO_STREAM_STARTED", t.VIDEO_STREAM_STARTED = "VIDEO_STREAM_STARTED", t.VIDEO_PLAY_STARTED = "VIDEO_PLAY_STARTED", t.AUDIO_STREAM_STARTED = "AUDIO_STREAM_STARTED", t.TALK_STREAM_INTERRUPTED = "TALK_STREAM_INTERRUPTED", t.SESSION_READY = "SESSION_READY", t.SERVER_WARNING = "SERVER_WARNING", t.MIC_PERMISSION_PENDING = "MIC_PERMISSION_PENDING", t.MIC_PERMISSION_GRANTED = "MIC_PERMISSION_GRANTED", t.MIC_PERMISSION_DENIED = "MIC_PERMISSION_DENIED", t.INPUT_AUDIO_DEVICE_CHANGED = "INPUT_AUDIO_DEVICE_CHANGED", t.CLIENT_TOOL_EVENT_RECEIVED = "CLIENT_TOOL_EVENT_RECEIVED", t.REASONING_HISTORY_UPDATED = "REASONING_HISTORY_UPDATED", t.REASONING_STREAM_EVENT_RECEIVED = "REASONING_STREAM_EVENT_RECEIVED";
|
|
2173
|
-
})(
|
|
2174
|
-
var
|
|
2129
|
+
})(N || (N = {}));
|
|
2130
|
+
var X;
|
|
2175
2131
|
(function(t) {
|
|
2176
2132
|
t.WEB_SOCKET_OPEN = "WEB_SOCKET_OPEN", t.SIGNAL_MESSAGE_RECEIVED = "SIGNAL_MESSAGE_RECEIVED", t.WEBRTC_CHAT_MESSAGE_RECEIVED = "WEBRTC_CHAT_MESSAGE_RECEIVED", t.WEBRTC_CLIENT_TOOL_EVENT_RECEIVED = "WEBRTC_CLIENT_TOOL_EVENT_RECEIVED", t.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED = "WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED";
|
|
2177
|
-
})(
|
|
2133
|
+
})(X || (X = {}));
|
|
2178
2134
|
var _e;
|
|
2179
2135
|
(function(t) {
|
|
2180
2136
|
t.NORMAL = "CONNECTION_CLOSED_CODE_NORMAL", t.MICROPHONE_PERMISSION_DENIED = "CONNECTION_CLOSED_CODE_MICROPHONE_PERMISSION_DENIED", t.SIGNALLING_CLIENT_CONNECTION_FAILURE = "CONNECTION_CLOSED_CODE_SIGNALLING_CLIENT_CONNECTION_FAILURE", t.WEBRTC_FAILURE = "CONNECTION_CLOSED_CODE_WEBRTC_FAILURE", t.SERVER_CLOSED_CONNECTION = "CONNECTION_CLOSED_CODE_SERVER_CLOSED_CONNECTION";
|
|
2181
2137
|
})(_e || (_e = {}));
|
|
2182
|
-
class
|
|
2138
|
+
class Hn {
|
|
2183
2139
|
constructor(e, n) {
|
|
2184
2140
|
this.sequenceNumber = 0, this.config = e, this.signallingClient = n;
|
|
2185
2141
|
}
|
|
@@ -2217,55 +2173,55 @@ class Wn {
|
|
|
2217
2173
|
return this.config;
|
|
2218
2174
|
}
|
|
2219
2175
|
arrayBufferToBase64(e) {
|
|
2220
|
-
const n = e instanceof Uint8Array ? e : new Uint8Array(e), o = Array.from(n, (
|
|
2176
|
+
const n = e instanceof Uint8Array ? e : new Uint8Array(e), o = Array.from(n, (u) => String.fromCharCode(u)).join("");
|
|
2221
2177
|
return btoa(o);
|
|
2222
2178
|
}
|
|
2223
2179
|
}
|
|
2224
|
-
var
|
|
2225
|
-
function
|
|
2226
|
-
return a instanceof n ? a : new n(function(
|
|
2227
|
-
|
|
2180
|
+
var Ce = function(t, e, n, o) {
|
|
2181
|
+
function u(a) {
|
|
2182
|
+
return a instanceof n ? a : new n(function(c) {
|
|
2183
|
+
c(a);
|
|
2228
2184
|
});
|
|
2229
2185
|
}
|
|
2230
|
-
return new (n || (n = Promise))(function(a,
|
|
2186
|
+
return new (n || (n = Promise))(function(a, c) {
|
|
2231
2187
|
function l(_) {
|
|
2232
2188
|
try {
|
|
2233
2189
|
p(o.next(_));
|
|
2234
2190
|
} catch (d) {
|
|
2235
|
-
|
|
2191
|
+
c(d);
|
|
2236
2192
|
}
|
|
2237
2193
|
}
|
|
2238
|
-
function
|
|
2194
|
+
function m(_) {
|
|
2239
2195
|
try {
|
|
2240
2196
|
p(o.throw(_));
|
|
2241
2197
|
} catch (d) {
|
|
2242
|
-
|
|
2198
|
+
c(d);
|
|
2243
2199
|
}
|
|
2244
2200
|
}
|
|
2245
2201
|
function p(_) {
|
|
2246
|
-
_.done ? a(_.value) :
|
|
2202
|
+
_.done ? a(_.value) : u(_.value).then(l, m);
|
|
2247
2203
|
}
|
|
2248
2204
|
p((o = o.apply(t, e || [])).next());
|
|
2249
2205
|
});
|
|
2250
2206
|
};
|
|
2251
|
-
const
|
|
2252
|
-
class
|
|
2253
|
-
constructor(e, n, o,
|
|
2254
|
-
var
|
|
2255
|
-
if (this.stopSignal = !1, this.sendingBuffer = [], this.wsConnectionAttempts = 0, this.socket = null, this.heartBeatIntervalRef = null, this.publicEventEmitter = o, this.internalEventEmitter =
|
|
2207
|
+
const Wn = 5, zn = 5;
|
|
2208
|
+
class qn {
|
|
2209
|
+
constructor(e, n, o, u, a) {
|
|
2210
|
+
var c, l, m, p, _;
|
|
2211
|
+
if (this.stopSignal = !1, this.sendingBuffer = [], this.wsConnectionAttempts = 0, this.socket = null, this.heartBeatIntervalRef = null, this.publicEventEmitter = o, this.internalEventEmitter = u, this.apiGatewayConfig = a, !e)
|
|
2256
2212
|
throw new Error("Signalling Client: sessionId is required");
|
|
2257
2213
|
this.sessionId = e;
|
|
2258
|
-
const { heartbeatIntervalSeconds: d, maxWsReconnectionAttempts: S, url:
|
|
2259
|
-
if (this.heartbeatIntervalSeconds = d ||
|
|
2214
|
+
const { heartbeatIntervalSeconds: d, maxWsReconnectionAttempts: S, url: g } = n;
|
|
2215
|
+
if (this.heartbeatIntervalSeconds = d || Wn, this.maxWsReconnectionAttempts = S || zn, !g.baseUrl)
|
|
2260
2216
|
throw new Error("Signalling Client: baseUrl is required");
|
|
2261
|
-
if (!((
|
|
2262
|
-
const y = new URL(this.apiGatewayConfig.baseUrl),
|
|
2263
|
-
y.protocol = y.protocol.replace("http", "ws"), y.pathname =
|
|
2264
|
-
const
|
|
2265
|
-
|
|
2217
|
+
if (!((c = this.apiGatewayConfig) === null || c === void 0) && c.enabled && (!((l = this.apiGatewayConfig) === null || l === void 0) && l.baseUrl)) {
|
|
2218
|
+
const y = new URL(this.apiGatewayConfig.baseUrl), b = (m = this.apiGatewayConfig.wsPath) !== null && m !== void 0 ? m : "/ws";
|
|
2219
|
+
y.protocol = y.protocol.replace("http", "ws"), y.pathname = b, this.url = y;
|
|
2220
|
+
const A = g.protocol || "https", C = A === "http" ? "ws" : "wss", I = `${A}://${g.baseUrl}`, x = (p = g.signallingPath) !== null && p !== void 0 ? p : "/ws", O = new URL(I);
|
|
2221
|
+
O.protocol = C === "ws" ? "ws:" : "wss:", g.port && (O.port = g.port), O.pathname = x, O.searchParams.append("session_id", e), this.url.searchParams.append("target_url", O.href);
|
|
2266
2222
|
} else {
|
|
2267
|
-
const
|
|
2268
|
-
this.url = new URL(
|
|
2223
|
+
const b = `${g.protocol || "https"}://${g.baseUrl}`;
|
|
2224
|
+
this.url = new URL(b), 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);
|
|
2269
2225
|
}
|
|
2270
2226
|
}
|
|
2271
2227
|
stop() {
|
|
@@ -2275,7 +2231,7 @@ class Yn {
|
|
|
2275
2231
|
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;
|
|
2276
2232
|
}
|
|
2277
2233
|
sendOffer(e) {
|
|
2278
|
-
return
|
|
2234
|
+
return Ce(this, void 0, void 0, function* () {
|
|
2279
2235
|
const n = {
|
|
2280
2236
|
connectionDescription: e,
|
|
2281
2237
|
userUid: this.sessionId
|
|
@@ -2289,7 +2245,7 @@ class Yn {
|
|
|
2289
2245
|
});
|
|
2290
2246
|
}
|
|
2291
2247
|
sendIceCandidate(e) {
|
|
2292
|
-
return
|
|
2248
|
+
return Ce(this, void 0, void 0, function* () {
|
|
2293
2249
|
const n = {
|
|
2294
2250
|
actionType: W.ICE_CANDIDATE,
|
|
2295
2251
|
sessionId: this.sessionId,
|
|
@@ -2310,7 +2266,7 @@ class Yn {
|
|
|
2310
2266
|
this.sendingBuffer.push(e);
|
|
2311
2267
|
}
|
|
2312
2268
|
sendTalkMessage(e) {
|
|
2313
|
-
return
|
|
2269
|
+
return Ce(this, void 0, void 0, function* () {
|
|
2314
2270
|
const n = {
|
|
2315
2271
|
actionType: W.TALK_STREAM_INPUT,
|
|
2316
2272
|
sessionId: this.sessionId,
|
|
@@ -2339,21 +2295,21 @@ class Yn {
|
|
|
2339
2295
|
this.socket && (this.socket.close(), this.socket = null), this.heartBeatIntervalRef && (clearInterval(this.heartBeatIntervalRef), this.heartBeatIntervalRef = null);
|
|
2340
2296
|
}
|
|
2341
2297
|
onOpen() {
|
|
2342
|
-
return
|
|
2298
|
+
return Ce(this, void 0, void 0, function* () {
|
|
2343
2299
|
if (!this.socket)
|
|
2344
2300
|
throw new Error("SignallingClient - onOpen: socket is null");
|
|
2345
2301
|
try {
|
|
2346
|
-
this.wsConnectionAttempts = 0, this.flushSendingBuffer(), this.socket.onmessage = this.onMessage.bind(this), this.startSendingHeartBeats(), this.internalEventEmitter.emit(
|
|
2302
|
+
this.wsConnectionAttempts = 0, this.flushSendingBuffer(), this.socket.onmessage = this.onMessage.bind(this), this.startSendingHeartBeats(), this.internalEventEmitter.emit(X.WEB_SOCKET_OPEN);
|
|
2347
2303
|
} catch (e) {
|
|
2348
|
-
console.error("SignallingClient - onOpen: error in onOpen", e), this.publicEventEmitter.emit(
|
|
2304
|
+
console.error("SignallingClient - onOpen: error in onOpen", e), this.publicEventEmitter.emit(N.CONNECTION_CLOSED, _e.SIGNALLING_CLIENT_CONNECTION_FAILURE);
|
|
2349
2305
|
}
|
|
2350
2306
|
});
|
|
2351
2307
|
}
|
|
2352
2308
|
onClose() {
|
|
2353
|
-
return
|
|
2309
|
+
return Ce(this, void 0, void 0, function* () {
|
|
2354
2310
|
this.wsConnectionAttempts += 1, !this.stopSignal && (this.wsConnectionAttempts <= this.maxWsReconnectionAttempts ? (this.socket = null, setTimeout(() => {
|
|
2355
2311
|
this.connect();
|
|
2356
|
-
}, 100 * this.wsConnectionAttempts)) : (this.heartBeatIntervalRef && (clearInterval(this.heartBeatIntervalRef), this.heartBeatIntervalRef = null), this.publicEventEmitter.emit(
|
|
2312
|
+
}, 100 * this.wsConnectionAttempts)) : (this.heartBeatIntervalRef && (clearInterval(this.heartBeatIntervalRef), this.heartBeatIntervalRef = null), this.publicEventEmitter.emit(N.CONNECTION_CLOSED, _e.SIGNALLING_CLIENT_CONNECTION_FAILURE)));
|
|
2357
2313
|
});
|
|
2358
2314
|
}
|
|
2359
2315
|
onError(e) {
|
|
@@ -2367,9 +2323,9 @@ class Yn {
|
|
|
2367
2323
|
}), this.sendingBuffer = e;
|
|
2368
2324
|
}
|
|
2369
2325
|
onMessage(e) {
|
|
2370
|
-
return
|
|
2326
|
+
return Ce(this, void 0, void 0, function* () {
|
|
2371
2327
|
const n = JSON.parse(e.data);
|
|
2372
|
-
this.internalEventEmitter.emit(
|
|
2328
|
+
this.internalEventEmitter.emit(X.SIGNAL_MESSAGE_RECEIVED, n);
|
|
2373
2329
|
});
|
|
2374
2330
|
}
|
|
2375
2331
|
startSendingHeartBeats() {
|
|
@@ -2382,54 +2338,54 @@ class Yn {
|
|
|
2382
2338
|
payload: ""
|
|
2383
2339
|
}, o = JSON.stringify(n);
|
|
2384
2340
|
this.heartBeatIntervalRef = setInterval(() => {
|
|
2385
|
-
var
|
|
2386
|
-
this.stopSignal || ((
|
|
2341
|
+
var u;
|
|
2342
|
+
this.stopSignal || ((u = this.socket) === null || u === void 0 ? void 0 : u.readyState) === WebSocket.OPEN && this.socket.send(o);
|
|
2387
2343
|
}, e);
|
|
2388
2344
|
}
|
|
2389
2345
|
}
|
|
2390
|
-
function
|
|
2346
|
+
function Yn(t) {
|
|
2391
2347
|
return "brainType" in t || "llmId" in t;
|
|
2392
2348
|
}
|
|
2393
|
-
var
|
|
2394
|
-
function
|
|
2395
|
-
return a instanceof n ? a : new n(function(
|
|
2396
|
-
|
|
2349
|
+
var ci = function(t, e, n, o) {
|
|
2350
|
+
function u(a) {
|
|
2351
|
+
return a instanceof n ? a : new n(function(c) {
|
|
2352
|
+
c(a);
|
|
2397
2353
|
});
|
|
2398
2354
|
}
|
|
2399
|
-
return new (n || (n = Promise))(function(a,
|
|
2355
|
+
return new (n || (n = Promise))(function(a, c) {
|
|
2400
2356
|
function l(_) {
|
|
2401
2357
|
try {
|
|
2402
2358
|
p(o.next(_));
|
|
2403
2359
|
} catch (d) {
|
|
2404
|
-
|
|
2360
|
+
c(d);
|
|
2405
2361
|
}
|
|
2406
2362
|
}
|
|
2407
|
-
function
|
|
2363
|
+
function m(_) {
|
|
2408
2364
|
try {
|
|
2409
2365
|
p(o.throw(_));
|
|
2410
2366
|
} catch (d) {
|
|
2411
|
-
|
|
2367
|
+
c(d);
|
|
2412
2368
|
}
|
|
2413
2369
|
}
|
|
2414
2370
|
function p(_) {
|
|
2415
|
-
_.done ? a(_.value) :
|
|
2371
|
+
_.done ? a(_.value) : u(_.value).then(l, m);
|
|
2416
2372
|
}
|
|
2417
2373
|
p((o = o.apply(t, e || [])).next());
|
|
2418
2374
|
});
|
|
2419
2375
|
};
|
|
2420
|
-
class
|
|
2376
|
+
class Kn {
|
|
2421
2377
|
constructor(e, n, o) {
|
|
2422
2378
|
if (!e && !n)
|
|
2423
2379
|
throw new Error("Either sessionToken or apiKey must be provided");
|
|
2424
|
-
this.sessionToken = e || null, this.apiKey = n || null, this.baseUrl = o?.baseUrl ||
|
|
2380
|
+
this.sessionToken = e || null, this.apiKey = n || null, this.baseUrl = o?.baseUrl || Bn, this.apiVersion = o?.apiVersion || Ln, this.apiGatewayConfig = o?.apiGateway || void 0;
|
|
2425
2381
|
}
|
|
2426
2382
|
/**
|
|
2427
2383
|
* Builds URL and headers for a request, applying API Gateway configuration if enabled
|
|
2428
2384
|
*/
|
|
2429
2385
|
buildGatewayUrlAndHeaders(e, n) {
|
|
2430
|
-
var o,
|
|
2431
|
-
if (!((o = this.apiGatewayConfig) === null || o === void 0) && o.enabled && (!((
|
|
2432
|
-
const a = `${this.apiGatewayConfig.baseUrl}${e}`,
|
|
2386
|
+
var o, u;
|
|
2387
|
+
if (!((o = this.apiGatewayConfig) === null || o === void 0) && o.enabled && (!((u = this.apiGatewayConfig) === null || u === void 0) && u.baseUrl)) {
|
|
2388
|
+
const a = `${this.apiGatewayConfig.baseUrl}${e}`, c = new URL(`${this.baseUrl}${e}`), l = Object.assign(Object.assign({}, n), { "X-Anam-Target-Url": c.href });
|
|
2433
2389
|
return { url: a, headers: l };
|
|
2434
2390
|
} else
|
|
2435
2391
|
return {
|
|
@@ -2438,7 +2394,7 @@ class Jn {
|
|
|
2438
2394
|
};
|
|
2439
2395
|
}
|
|
2440
2396
|
startSession(e, n) {
|
|
2441
|
-
return
|
|
2397
|
+
return ci(this, void 0, void 0, function* () {
|
|
2442
2398
|
if (!this.sessionToken) {
|
|
2443
2399
|
if (!e)
|
|
2444
2400
|
throw new $("Persona configuration must be provided when using apiKey", V.CLIENT_ERROR_CODE_VALIDATION_ERROR, 400);
|
|
@@ -2446,19 +2402,19 @@ class Jn {
|
|
|
2446
2402
|
}
|
|
2447
2403
|
e && "brainType" in e && console.warn("Warning: brainType is deprecated and will be removed in a future version. Please use llmId instead.");
|
|
2448
2404
|
try {
|
|
2449
|
-
const o = `${this.apiVersion}/engine/session`, { url:
|
|
2405
|
+
const o = `${this.apiVersion}/engine/session`, { url: u, headers: a } = this.buildGatewayUrlAndHeaders(o, {
|
|
2450
2406
|
"Content-Type": "application/json",
|
|
2451
2407
|
Authorization: `Bearer ${this.sessionToken}`
|
|
2452
|
-
}),
|
|
2408
|
+
}), c = yield fetch(u, {
|
|
2453
2409
|
method: "POST",
|
|
2454
2410
|
headers: a,
|
|
2455
2411
|
body: JSON.stringify({
|
|
2456
2412
|
personaConfig: e,
|
|
2457
2413
|
sessionOptions: n,
|
|
2458
|
-
clientMetadata:
|
|
2414
|
+
clientMetadata: Hi
|
|
2459
2415
|
})
|
|
2460
|
-
}), l = yield
|
|
2461
|
-
switch (
|
|
2416
|
+
}), l = yield c.json(), m = l.error;
|
|
2417
|
+
switch (c.status) {
|
|
2462
2418
|
case 200:
|
|
2463
2419
|
case 201:
|
|
2464
2420
|
return l;
|
|
@@ -2471,7 +2427,7 @@ class Jn {
|
|
|
2471
2427
|
case 403:
|
|
2472
2428
|
throw new $("Authentication failed when starting session", V.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 403, { cause: l.message });
|
|
2473
2429
|
case 429:
|
|
2474
|
-
throw
|
|
2430
|
+
throw m === "Concurrent session limit reached" ? new $("Concurrency limit reached, please upgrade your plan", V.CLIENT_ERROR_CODE_MAX_CONCURRENT_SESSIONS_REACHED, 429, { cause: l.message }) : m === "Spend cap reached" ? new $("Spend cap reached, please upgrade your plan", V.CLIENT_ERROR_CODE_SPEND_CAP_REACHED, 429, { cause: l.message }) : new $("Usage limit reached, please upgrade your plan", V.CLIENT_ERROR_CODE_USAGE_LIMIT_REACHED, 429, { cause: l.message });
|
|
2475
2431
|
case 503:
|
|
2476
2432
|
throw new $("There are no available personas, please try again later", V.CLIENT_ERROR_CODE_SERVICE_BUSY, 503, { cause: l.message });
|
|
2477
2433
|
default:
|
|
@@ -2483,20 +2439,20 @@ class Jn {
|
|
|
2483
2439
|
});
|
|
2484
2440
|
}
|
|
2485
2441
|
unsafe_getSessionToken(e) {
|
|
2486
|
-
return
|
|
2442
|
+
return ci(this, void 0, void 0, function* () {
|
|
2487
2443
|
if (console.warn("Using unsecure method. This method should not be used in production."), !this.apiKey)
|
|
2488
2444
|
throw new Error("No apiKey provided");
|
|
2489
2445
|
e && "brainType" in e && console.warn("Warning: brainType is deprecated and will be removed in a future version. Please use llmId instead.");
|
|
2490
2446
|
let n = {
|
|
2491
2447
|
clientLabel: "js-sdk-api-key"
|
|
2492
2448
|
};
|
|
2493
|
-
|
|
2449
|
+
Yn(e) && (n = Object.assign(Object.assign({}, n), { personaConfig: e }));
|
|
2494
2450
|
try {
|
|
2495
|
-
const o = `${this.apiVersion}/auth/session-token`, { url:
|
|
2451
|
+
const o = `${this.apiVersion}/auth/session-token`, { url: u, headers: a } = this.buildGatewayUrlAndHeaders(o, {
|
|
2496
2452
|
"Content-Type": "application/json",
|
|
2497
2453
|
Authorization: `Bearer ${this.apiKey}`
|
|
2498
2454
|
});
|
|
2499
|
-
return (yield (yield fetch(
|
|
2455
|
+
return (yield (yield fetch(u, {
|
|
2500
2456
|
method: "POST",
|
|
2501
2457
|
headers: a,
|
|
2502
2458
|
body: JSON.stringify(n)
|
|
@@ -2510,67 +2466,67 @@ class Jn {
|
|
|
2510
2466
|
return `${this.baseUrl}${this.apiVersion}`;
|
|
2511
2467
|
}
|
|
2512
2468
|
}
|
|
2513
|
-
var
|
|
2514
|
-
function
|
|
2515
|
-
return a instanceof n ? a : new n(function(
|
|
2516
|
-
|
|
2469
|
+
var Jn = function(t, e, n, o) {
|
|
2470
|
+
function u(a) {
|
|
2471
|
+
return a instanceof n ? a : new n(function(c) {
|
|
2472
|
+
c(a);
|
|
2517
2473
|
});
|
|
2518
2474
|
}
|
|
2519
|
-
return new (n || (n = Promise))(function(a,
|
|
2475
|
+
return new (n || (n = Promise))(function(a, c) {
|
|
2520
2476
|
function l(_) {
|
|
2521
2477
|
try {
|
|
2522
2478
|
p(o.next(_));
|
|
2523
2479
|
} catch (d) {
|
|
2524
|
-
|
|
2480
|
+
c(d);
|
|
2525
2481
|
}
|
|
2526
2482
|
}
|
|
2527
|
-
function
|
|
2483
|
+
function m(_) {
|
|
2528
2484
|
try {
|
|
2529
2485
|
p(o.throw(_));
|
|
2530
2486
|
} catch (d) {
|
|
2531
|
-
|
|
2487
|
+
c(d);
|
|
2532
2488
|
}
|
|
2533
2489
|
}
|
|
2534
2490
|
function p(_) {
|
|
2535
|
-
_.done ? a(_.value) :
|
|
2491
|
+
_.done ? a(_.value) : u(_.value).then(l, m);
|
|
2536
2492
|
}
|
|
2537
2493
|
p((o = o.apply(t, e || [])).next());
|
|
2538
2494
|
});
|
|
2539
2495
|
};
|
|
2540
|
-
class
|
|
2496
|
+
class Xn {
|
|
2541
2497
|
constructor(e, n, o) {
|
|
2542
2498
|
this.baseUrl = e, this.sessionId = n, this.apiGatewayConfig = o;
|
|
2543
2499
|
}
|
|
2544
2500
|
sendTalkCommand(e) {
|
|
2545
|
-
return
|
|
2501
|
+
return Jn(this, void 0, void 0, function* () {
|
|
2546
2502
|
var n, o;
|
|
2547
2503
|
try {
|
|
2548
|
-
let
|
|
2504
|
+
let u, a = {
|
|
2549
2505
|
"Content-Type": "application/json"
|
|
2550
2506
|
};
|
|
2551
|
-
const
|
|
2507
|
+
const c = "/talk", l = `?session_id=${this.sessionId}`;
|
|
2552
2508
|
if (!((n = this.apiGatewayConfig) === null || n === void 0) && n.enabled && (!((o = this.apiGatewayConfig) === null || o === void 0) && o.baseUrl)) {
|
|
2553
|
-
|
|
2554
|
-
const p = new URL(`${this.baseUrl}${
|
|
2509
|
+
u = `${this.apiGatewayConfig.baseUrl}${c}${l}`;
|
|
2510
|
+
const p = new URL(`${this.baseUrl}${c}${l}`);
|
|
2555
2511
|
a["X-Anam-Target-Url"] = p.href;
|
|
2556
2512
|
} else
|
|
2557
|
-
|
|
2558
|
-
const
|
|
2513
|
+
u = `${this.baseUrl}${c}${l}`;
|
|
2514
|
+
const m = yield fetch(u, {
|
|
2559
2515
|
method: "POST",
|
|
2560
2516
|
headers: a,
|
|
2561
2517
|
body: JSON.stringify({
|
|
2562
2518
|
content: e
|
|
2563
2519
|
})
|
|
2564
2520
|
});
|
|
2565
|
-
if (!
|
|
2566
|
-
throw new Error(`Failed to send talk command: ${
|
|
2567
|
-
} catch (
|
|
2568
|
-
throw console.error(
|
|
2521
|
+
if (!m.ok)
|
|
2522
|
+
throw new Error(`Failed to send talk command: ${m.status} ${m.statusText}`);
|
|
2523
|
+
} catch (u) {
|
|
2524
|
+
throw console.error(u), new Error("EngineApiRestClient - sendTalkCommand: Failed to send talk command");
|
|
2569
2525
|
}
|
|
2570
2526
|
});
|
|
2571
2527
|
}
|
|
2572
2528
|
}
|
|
2573
|
-
class
|
|
2529
|
+
class Zn {
|
|
2574
2530
|
constructor() {
|
|
2575
2531
|
this.listeners = {};
|
|
2576
2532
|
}
|
|
@@ -2586,9 +2542,9 @@ class Qn {
|
|
|
2586
2542
|
});
|
|
2587
2543
|
}
|
|
2588
2544
|
}
|
|
2589
|
-
class
|
|
2545
|
+
class Qn {
|
|
2590
2546
|
constructor(e, n) {
|
|
2591
|
-
this.messages = [], this.publicEventEmitter = e, this.internalEventEmitter = n, this.internalEventEmitter.addListener(
|
|
2547
|
+
this.messages = [], this.publicEventEmitter = e, this.internalEventEmitter = n, this.internalEventEmitter.addListener(X.WEBRTC_CHAT_MESSAGE_RECEIVED, this.processWebRtcTextMessageEvent.bind(this));
|
|
2592
2548
|
}
|
|
2593
2549
|
webRtcTextMessageEventToMessageStreamEvent(e) {
|
|
2594
2550
|
return {
|
|
@@ -2614,27 +2570,27 @@ class er {
|
|
|
2614
2570
|
content: e.content,
|
|
2615
2571
|
role: e.role,
|
|
2616
2572
|
interrupted: e.interrupted
|
|
2617
|
-
}, o = this.messages.findIndex((
|
|
2573
|
+
}, o = this.messages.findIndex((u) => u.id === n.id);
|
|
2618
2574
|
if (o !== -1) {
|
|
2619
|
-
const
|
|
2620
|
-
this.messages[o] = Object.assign(Object.assign({},
|
|
2575
|
+
const u = this.messages[o];
|
|
2576
|
+
this.messages[o] = Object.assign(Object.assign({}, u), { content: u.content + n.content, interrupted: u.interrupted || n.interrupted });
|
|
2621
2577
|
} else
|
|
2622
2578
|
this.messages.push(n);
|
|
2623
2579
|
}
|
|
2624
2580
|
processWebRtcTextMessageEvent(e) {
|
|
2625
2581
|
const n = this.webRtcTextMessageEventToMessageStreamEvent(e);
|
|
2626
|
-
switch (this.publicEventEmitter.emit(
|
|
2627
|
-
case
|
|
2582
|
+
switch (this.publicEventEmitter.emit(N.MESSAGE_STREAM_EVENT_RECEIVED, n), n.role) {
|
|
2583
|
+
case tt.USER:
|
|
2628
2584
|
this.processUserMessage(n);
|
|
2629
2585
|
break;
|
|
2630
|
-
case
|
|
2586
|
+
case tt.PERSONA:
|
|
2631
2587
|
this.processPersonaMessage(n);
|
|
2632
2588
|
break;
|
|
2633
2589
|
}
|
|
2634
|
-
n.endOfSpeech && this.publicEventEmitter.emit(
|
|
2590
|
+
n.endOfSpeech && this.publicEventEmitter.emit(N.MESSAGE_HISTORY_UPDATED, this.messages);
|
|
2635
2591
|
}
|
|
2636
2592
|
}
|
|
2637
|
-
class
|
|
2593
|
+
class er {
|
|
2638
2594
|
constructor() {
|
|
2639
2595
|
this.listeners = {};
|
|
2640
2596
|
}
|
|
@@ -2645,9 +2601,9 @@ class tr {
|
|
|
2645
2601
|
this.listeners[e] && this.listeners[e].delete(n);
|
|
2646
2602
|
}
|
|
2647
2603
|
emit(e, ...n) {
|
|
2648
|
-
if (e ===
|
|
2649
|
-
const [o,
|
|
2650
|
-
|
|
2604
|
+
if (e === N.CONNECTION_ESTABLISHED && ge(se.CLIENT_METRIC_MEASUREMENT_CONNECTION_ESTABLISHED, "1"), e === N.CONNECTION_CLOSED) {
|
|
2605
|
+
const [o, u] = n;
|
|
2606
|
+
ge(se.CLIENT_METRIC_MEASUREMENT_CONNECTION_CLOSED, o, u ? { details: u } : void 0);
|
|
2651
2607
|
}
|
|
2652
2608
|
this.listeners[e] && this.listeners[e].forEach((o) => {
|
|
2653
2609
|
o(...n);
|
|
@@ -2658,47 +2614,47 @@ var z;
|
|
|
2658
2614
|
(function(t) {
|
|
2659
2615
|
t[t.UNSTARTED = 0] = "UNSTARTED", t[t.STREAMING = 1] = "STREAMING", t[t.INTERRUPTED = 2] = "INTERRUPTED", t[t.ENDED = 3] = "ENDED";
|
|
2660
2616
|
})(z || (z = {}));
|
|
2661
|
-
var
|
|
2662
|
-
function
|
|
2663
|
-
return a instanceof n ? a : new n(function(
|
|
2664
|
-
|
|
2617
|
+
var pt = function(t, e, n, o) {
|
|
2618
|
+
function u(a) {
|
|
2619
|
+
return a instanceof n ? a : new n(function(c) {
|
|
2620
|
+
c(a);
|
|
2665
2621
|
});
|
|
2666
2622
|
}
|
|
2667
|
-
return new (n || (n = Promise))(function(a,
|
|
2623
|
+
return new (n || (n = Promise))(function(a, c) {
|
|
2668
2624
|
function l(_) {
|
|
2669
2625
|
try {
|
|
2670
2626
|
p(o.next(_));
|
|
2671
2627
|
} catch (d) {
|
|
2672
|
-
|
|
2628
|
+
c(d);
|
|
2673
2629
|
}
|
|
2674
2630
|
}
|
|
2675
|
-
function
|
|
2631
|
+
function m(_) {
|
|
2676
2632
|
try {
|
|
2677
2633
|
p(o.throw(_));
|
|
2678
2634
|
} catch (d) {
|
|
2679
|
-
|
|
2635
|
+
c(d);
|
|
2680
2636
|
}
|
|
2681
2637
|
}
|
|
2682
2638
|
function p(_) {
|
|
2683
|
-
_.done ? a(_.value) :
|
|
2639
|
+
_.done ? a(_.value) : u(_.value).then(l, m);
|
|
2684
2640
|
}
|
|
2685
2641
|
p((o = o.apply(t, e || [])).next());
|
|
2686
2642
|
});
|
|
2687
2643
|
};
|
|
2688
|
-
class
|
|
2644
|
+
class tr {
|
|
2689
2645
|
constructor(e, n, o) {
|
|
2690
|
-
this.state = z.UNSTARTED, this.correlationId = e, this.internalEventEmitter = n, this.signallingClient = o, this.internalEventEmitter.addListener(
|
|
2646
|
+
this.state = z.UNSTARTED, this.correlationId = e, this.internalEventEmitter = n, this.signallingClient = o, this.internalEventEmitter.addListener(X.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this));
|
|
2691
2647
|
}
|
|
2692
2648
|
onDeactivate() {
|
|
2693
|
-
this.internalEventEmitter.removeListener(
|
|
2649
|
+
this.internalEventEmitter.removeListener(X.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this));
|
|
2694
2650
|
}
|
|
2695
2651
|
onSignalMessage(e) {
|
|
2696
|
-
return
|
|
2652
|
+
return pt(this, void 0, void 0, function* () {
|
|
2697
2653
|
e.actionType === W.TALK_STREAM_INTERRUPTED && e.payload.correlationId === this.correlationId && (this.state = z.INTERRUPTED, this.onDeactivate());
|
|
2698
2654
|
});
|
|
2699
2655
|
}
|
|
2700
2656
|
endMessage() {
|
|
2701
|
-
return
|
|
2657
|
+
return pt(this, void 0, void 0, function* () {
|
|
2702
2658
|
if (this.state === z.ENDED) {
|
|
2703
2659
|
console.warn("Talk stream is already ended via end of speech. No need to call endMessage.");
|
|
2704
2660
|
return;
|
|
@@ -2717,7 +2673,7 @@ class ir {
|
|
|
2717
2673
|
});
|
|
2718
2674
|
}
|
|
2719
2675
|
streamMessageChunk(e, n) {
|
|
2720
|
-
return
|
|
2676
|
+
return pt(this, void 0, void 0, function* () {
|
|
2721
2677
|
if (this.state !== z.STREAMING && this.state !== z.UNSTARTED)
|
|
2722
2678
|
throw new Error("Talk stream is not in an active state: " + this.state);
|
|
2723
2679
|
const o = {
|
|
@@ -2739,43 +2695,43 @@ class ir {
|
|
|
2739
2695
|
return this.state;
|
|
2740
2696
|
}
|
|
2741
2697
|
}
|
|
2742
|
-
var
|
|
2743
|
-
function
|
|
2744
|
-
return a instanceof n ? a : new n(function(
|
|
2745
|
-
|
|
2698
|
+
var J = function(t, e, n, o) {
|
|
2699
|
+
function u(a) {
|
|
2700
|
+
return a instanceof n ? a : new n(function(c) {
|
|
2701
|
+
c(a);
|
|
2746
2702
|
});
|
|
2747
2703
|
}
|
|
2748
|
-
return new (n || (n = Promise))(function(a,
|
|
2704
|
+
return new (n || (n = Promise))(function(a, c) {
|
|
2749
2705
|
function l(_) {
|
|
2750
2706
|
try {
|
|
2751
2707
|
p(o.next(_));
|
|
2752
2708
|
} catch (d) {
|
|
2753
|
-
|
|
2709
|
+
c(d);
|
|
2754
2710
|
}
|
|
2755
2711
|
}
|
|
2756
|
-
function
|
|
2712
|
+
function m(_) {
|
|
2757
2713
|
try {
|
|
2758
2714
|
p(o.throw(_));
|
|
2759
2715
|
} catch (d) {
|
|
2760
|
-
|
|
2716
|
+
c(d);
|
|
2761
2717
|
}
|
|
2762
2718
|
}
|
|
2763
2719
|
function p(_) {
|
|
2764
|
-
_.done ? a(_.value) :
|
|
2720
|
+
_.done ? a(_.value) : u(_.value).then(l, m);
|
|
2765
2721
|
}
|
|
2766
2722
|
p((o = o.apply(t, e || [])).next());
|
|
2767
2723
|
});
|
|
2768
2724
|
};
|
|
2769
|
-
const
|
|
2770
|
-
class
|
|
2771
|
-
constructor(e, n, o,
|
|
2772
|
-
var a,
|
|
2725
|
+
const ir = 15e3, nr = 5e3, rr = 2;
|
|
2726
|
+
class or {
|
|
2727
|
+
constructor(e, n, o, u) {
|
|
2728
|
+
var a, c, l, m;
|
|
2773
2729
|
this.peerConnection = null, this.connectionReceivedAnswer = !1, this.remoteIceCandidateBuffer = [], this.inputAudioStream = null, this.dataChannel = null, this.videoElement = null, this.videoStream = null, this.audioStream = null, this.inputAudioState = {
|
|
2774
2730
|
isMuted: !1,
|
|
2775
2731
|
permissionState: fe.NOT_REQUESTED
|
|
2776
|
-
}, this.successMetricPoller = null, this.successMetricFired = !1, this.showPeerConnectionStatsReport = !1, this.peerConnectionStatsReportOutputFormat = "console", this.statsCollectionInterval = null, this.agentAudioInputStream = null, this.publicEventEmitter = o, this.internalEventEmitter =
|
|
2732
|
+
}, this.successMetricPoller = null, this.successMetricFired = !1, this.showPeerConnectionStatsReport = !1, this.peerConnectionStatsReportOutputFormat = "console", this.statsCollectionInterval = null, this.agentAudioInputStream = null, this.publicEventEmitter = o, this.internalEventEmitter = u, this.apiGatewayConfig = n.apiGateway;
|
|
2777
2733
|
const { inputAudio: p } = n;
|
|
2778
|
-
this.inputAudioState = p.inputAudioState, n.inputAudio.userProvidedMediaStream && (this.inputAudioStream = n.inputAudio.userProvidedMediaStream), this.disableInputAudio = n.inputAudio.disableInputAudio === !0, this.internalEventEmitter.addListener(
|
|
2734
|
+
this.inputAudioState = p.inputAudioState, n.inputAudio.userProvidedMediaStream && (this.inputAudioStream = n.inputAudio.userProvidedMediaStream), this.disableInputAudio = n.inputAudio.disableInputAudio === !0, this.internalEventEmitter.addListener(X.WEB_SOCKET_OPEN, this.onSignallingClientConnected.bind(this)), this.internalEventEmitter.addListener(X.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 = (c = (a = n.metrics) === null || a === void 0 ? void 0 : a.showPeerConnectionStatsReport) !== null && c !== void 0 ? c : !1, this.peerConnectionStatsReportOutputFormat = (m = (l = n.metrics) === null || l === void 0 ? void 0 : l.peerConnectionStatsReportOutputFormat) !== null && m !== void 0 ? m : "console";
|
|
2779
2735
|
}
|
|
2780
2736
|
onInputAudioStateChange(e, n) {
|
|
2781
2737
|
e.isMuted !== n.isMuted && (n.isMuted ? this.muteAllAudioTracks() : this.unmuteAllAudioTracks());
|
|
@@ -2793,7 +2749,7 @@ class sr {
|
|
|
2793
2749
|
});
|
|
2794
2750
|
}
|
|
2795
2751
|
startStatsCollection() {
|
|
2796
|
-
this.statsCollectionInterval || (this.statsCollectionInterval = setInterval(() =>
|
|
2752
|
+
this.statsCollectionInterval || (this.statsCollectionInterval = setInterval(() => J(this, void 0, void 0, function* () {
|
|
2797
2753
|
if (!(!this.peerConnection || !this.dataChannel || this.dataChannel.readyState !== "open"))
|
|
2798
2754
|
try {
|
|
2799
2755
|
const e = yield this.peerConnection.getStats();
|
|
@@ -2801,7 +2757,7 @@ class sr {
|
|
|
2801
2757
|
} catch (e) {
|
|
2802
2758
|
console.error("Failed to collect and send stats:", e);
|
|
2803
2759
|
}
|
|
2804
|
-
}),
|
|
2760
|
+
}), nr));
|
|
2805
2761
|
}
|
|
2806
2762
|
sendClientSideMetrics(e) {
|
|
2807
2763
|
e.forEach((n) => {
|
|
@@ -2819,19 +2775,19 @@ class sr {
|
|
|
2819
2775
|
return;
|
|
2820
2776
|
const e = setTimeout(() => {
|
|
2821
2777
|
this.successMetricPoller && (console.warn("No video frames received, there is a problem with the connection."), clearInterval(this.successMetricPoller), this.successMetricPoller = null);
|
|
2822
|
-
},
|
|
2823
|
-
this.successMetricPoller = setInterval(() =>
|
|
2778
|
+
}, ir);
|
|
2779
|
+
this.successMetricPoller = setInterval(() => J(this, void 0, void 0, function* () {
|
|
2824
2780
|
if (!this.peerConnection || this.successMetricFired) {
|
|
2825
2781
|
this.successMetricPoller && clearInterval(this.successMetricPoller), clearTimeout(e);
|
|
2826
2782
|
return;
|
|
2827
2783
|
}
|
|
2828
2784
|
try {
|
|
2829
2785
|
const n = yield this.peerConnection.getStats();
|
|
2830
|
-
let o = !1,
|
|
2786
|
+
let o = !1, u = null;
|
|
2831
2787
|
n.forEach((a) => {
|
|
2832
|
-
a.type === "inbound-rtp" && a.kind === "video" && (a.framesDecoded !== void 0 && a.framesDecoded > 0 ? (o = !0,
|
|
2833
|
-
a.bytesReceived > 1e5 && (o = !0,
|
|
2834
|
-
}), o && !this.successMetricFired && (this.successMetricFired = !0,
|
|
2788
|
+
a.type === "inbound-rtp" && a.kind === "video" && (a.framesDecoded !== void 0 && a.framesDecoded > 0 ? (o = !0, u = "framesDecoded") : a.framesReceived !== void 0 && a.framesReceived > 0 ? (o = !0, u = "framesReceived") : a.bytesReceived > 0 && a.packetsReceived > 0 && // Additional check: ensure we've received enough data for actual video
|
|
2789
|
+
a.bytesReceived > 1e5 && (o = !0, u = "bytesReceived"));
|
|
2790
|
+
}), o && !this.successMetricFired && (this.successMetricFired = !0, ge(se.CLIENT_METRIC_MEASUREMENT_SESSION_SUCCESS, "1", u ? { detectionMethod: u } : void 0), this.successMetricPoller && clearInterval(this.successMetricPoller), clearTimeout(e), this.successMetricPoller = null);
|
|
2835
2791
|
} catch {
|
|
2836
2792
|
}
|
|
2837
2793
|
}), 500);
|
|
@@ -2851,15 +2807,15 @@ class sr {
|
|
|
2851
2807
|
return this.peerConnection;
|
|
2852
2808
|
}
|
|
2853
2809
|
changeAudioInputDevice(e) {
|
|
2854
|
-
return
|
|
2810
|
+
return J(this, void 0, void 0, function* () {
|
|
2855
2811
|
if (!this.peerConnection)
|
|
2856
2812
|
throw new Error("StreamingClient - changeAudioInputDevice: peer connection is not initialized. Start streaming first.");
|
|
2857
2813
|
if (e == null)
|
|
2858
2814
|
throw new Error("StreamingClient - changeAudioInputDevice: deviceId is required");
|
|
2859
2815
|
const n = this.inputAudioState.isMuted;
|
|
2860
2816
|
try {
|
|
2861
|
-
this.inputAudioStream && this.inputAudioStream.getAudioTracks().forEach((
|
|
2862
|
-
|
|
2817
|
+
this.inputAudioStream && this.inputAudioStream.getAudioTracks().forEach((u) => {
|
|
2818
|
+
u.stop();
|
|
2863
2819
|
});
|
|
2864
2820
|
const o = {
|
|
2865
2821
|
echoCancellation: !0,
|
|
@@ -2869,7 +2825,7 @@ class sr {
|
|
|
2869
2825
|
};
|
|
2870
2826
|
this.inputAudioStream = yield navigator.mediaDevices.getUserMedia({
|
|
2871
2827
|
audio: o
|
|
2872
|
-
}), this.audioDeviceId = e, yield this.setupAudioTrack(), n && this.muteAllAudioTracks(), this.publicEventEmitter.emit(
|
|
2828
|
+
}), this.audioDeviceId = e, yield this.setupAudioTrack(), n && this.muteAllAudioTracks(), this.publicEventEmitter.emit(N.INPUT_AUDIO_DEVICE_CHANGED, e);
|
|
2873
2829
|
} catch (o) {
|
|
2874
2830
|
throw console.error("Failed to change audio input device:", o), new Error(`StreamingClient - changeAudioInputDevice: ${o instanceof Error ? o.message : String(o)}`);
|
|
2875
2831
|
}
|
|
@@ -2907,38 +2863,38 @@ class sr {
|
|
|
2907
2863
|
}
|
|
2908
2864
|
}
|
|
2909
2865
|
stopConnection() {
|
|
2910
|
-
return
|
|
2866
|
+
return J(this, void 0, void 0, function* () {
|
|
2911
2867
|
yield this.shutdown();
|
|
2912
2868
|
});
|
|
2913
2869
|
}
|
|
2914
2870
|
sendTalkCommand(e) {
|
|
2915
|
-
return
|
|
2871
|
+
return J(this, void 0, void 0, function* () {
|
|
2916
2872
|
if (!this.peerConnection)
|
|
2917
2873
|
throw new Error("StreamingClient - sendTalkCommand: peer connection is null");
|
|
2918
2874
|
yield this.engineApiRestClient.sendTalkCommand(e);
|
|
2919
2875
|
});
|
|
2920
2876
|
}
|
|
2921
2877
|
startTalkMessageStream(e) {
|
|
2922
|
-
return e || (e = Math.random().toString(36).substring(2, 15)), new
|
|
2878
|
+
return e || (e = Math.random().toString(36).substring(2, 15)), new tr(e, this.internalEventEmitter, this.signallingClient);
|
|
2923
2879
|
}
|
|
2924
2880
|
createAgentAudioInputStream(e) {
|
|
2925
|
-
return this.agentAudioInputStream = new
|
|
2881
|
+
return this.agentAudioInputStream = new Hn(e, this.signallingClient), this.agentAudioInputStream;
|
|
2926
2882
|
}
|
|
2927
2883
|
getAgentAudioInputStream() {
|
|
2928
2884
|
return this.agentAudioInputStream;
|
|
2929
2885
|
}
|
|
2930
2886
|
initPeerConnection() {
|
|
2931
|
-
return
|
|
2887
|
+
return J(this, void 0, void 0, function* () {
|
|
2932
2888
|
this.peerConnection = new RTCPeerConnection({
|
|
2933
2889
|
iceServers: this.iceServers,
|
|
2934
|
-
iceCandidatePoolSize:
|
|
2890
|
+
iceCandidatePoolSize: rr
|
|
2935
2891
|
}), 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) => {
|
|
2936
2892
|
console.error("Async microphone permission request failed:", e);
|
|
2937
2893
|
}));
|
|
2938
2894
|
});
|
|
2939
2895
|
}
|
|
2940
2896
|
onSignalMessage(e) {
|
|
2941
|
-
return
|
|
2897
|
+
return J(this, void 0, void 0, function* () {
|
|
2942
2898
|
if (!this.peerConnection) {
|
|
2943
2899
|
console.error("StreamingClient - onSignalMessage: peerConnection is not initialized");
|
|
2944
2900
|
return;
|
|
@@ -2949,24 +2905,24 @@ class sr {
|
|
|
2949
2905
|
yield this.peerConnection.setRemoteDescription(n), this.connectionReceivedAnswer = !0, this.flushRemoteIceCandidateBuffer();
|
|
2950
2906
|
break;
|
|
2951
2907
|
case W.ICE_CANDIDATE:
|
|
2952
|
-
const o = e.payload,
|
|
2953
|
-
this.connectionReceivedAnswer ? yield this.peerConnection.addIceCandidate(
|
|
2908
|
+
const o = e.payload, u = new RTCIceCandidate(o);
|
|
2909
|
+
this.connectionReceivedAnswer ? yield this.peerConnection.addIceCandidate(u) : this.remoteIceCandidateBuffer.push(u);
|
|
2954
2910
|
break;
|
|
2955
2911
|
case W.END_SESSION:
|
|
2956
2912
|
const a = e.payload;
|
|
2957
|
-
this.publicEventEmitter.emit(
|
|
2913
|
+
this.publicEventEmitter.emit(N.CONNECTION_CLOSED, _e.SERVER_CLOSED_CONNECTION, a), this.shutdown();
|
|
2958
2914
|
break;
|
|
2959
2915
|
case W.WARNING:
|
|
2960
|
-
const
|
|
2961
|
-
console.warn("Warning received from server: " +
|
|
2916
|
+
const c = e.payload;
|
|
2917
|
+
console.warn("Warning received from server: " + c), this.publicEventEmitter.emit(N.SERVER_WARNING, c);
|
|
2962
2918
|
break;
|
|
2963
2919
|
case W.TALK_STREAM_INTERRUPTED:
|
|
2964
2920
|
const l = e.payload;
|
|
2965
|
-
this.publicEventEmitter.emit(
|
|
2921
|
+
this.publicEventEmitter.emit(N.TALK_STREAM_INTERRUPTED, l.correlationId);
|
|
2966
2922
|
break;
|
|
2967
2923
|
case W.SESSION_READY:
|
|
2968
|
-
const
|
|
2969
|
-
this.publicEventEmitter.emit(
|
|
2924
|
+
const m = e.sessionId;
|
|
2925
|
+
this.publicEventEmitter.emit(N.SESSION_READY, m);
|
|
2970
2926
|
break;
|
|
2971
2927
|
case W.HEARTBEAT:
|
|
2972
2928
|
break;
|
|
@@ -2976,7 +2932,7 @@ class sr {
|
|
|
2976
2932
|
});
|
|
2977
2933
|
}
|
|
2978
2934
|
onSignallingClientConnected() {
|
|
2979
|
-
return
|
|
2935
|
+
return J(this, void 0, void 0, function* () {
|
|
2980
2936
|
if (!this.peerConnection)
|
|
2981
2937
|
try {
|
|
2982
2938
|
yield this.initPeerConnectionAndSendOffer();
|
|
@@ -3001,14 +2957,14 @@ class sr {
|
|
|
3001
2957
|
}
|
|
3002
2958
|
onIceConnectionStateChange() {
|
|
3003
2959
|
var e, n;
|
|
3004
|
-
(((e = this.peerConnection) === null || e === void 0 ? void 0 : e.iceConnectionState) === "connected" || ((n = this.peerConnection) === null || n === void 0 ? void 0 : n.iceConnectionState) === "completed") && (this.publicEventEmitter.emit(
|
|
2960
|
+
(((e = this.peerConnection) === null || e === void 0 ? void 0 : e.iceConnectionState) === "connected" || ((n = this.peerConnection) === null || n === void 0 ? void 0 : n.iceConnectionState) === "completed") && (this.publicEventEmitter.emit(N.CONNECTION_ESTABLISHED), this.startStatsCollection());
|
|
3005
2961
|
}
|
|
3006
2962
|
onConnectionStateChange() {
|
|
3007
2963
|
var e;
|
|
3008
2964
|
((e = this.peerConnection) === null || e === void 0 ? void 0 : e.connectionState) === "closed" && (console.error("StreamingClient - onConnectionStateChange: Connection closed"), this.handleWebrtcFailure("The connection to our servers was lost. Please try again."));
|
|
3009
2965
|
}
|
|
3010
2966
|
handleWebrtcFailure(e) {
|
|
3011
|
-
console.error({ message: "StreamingClient - handleWebrtcFailure: ", err: e }), e.name === "NotAllowedError" && e.message === "Permission denied" ? this.publicEventEmitter.emit(
|
|
2967
|
+
console.error({ message: "StreamingClient - handleWebrtcFailure: ", err: e }), e.name === "NotAllowedError" && e.message === "Permission denied" ? this.publicEventEmitter.emit(N.CONNECTION_CLOSED, _e.MICROPHONE_PERMISSION_DENIED) : this.publicEventEmitter.emit(N.CONNECTION_CLOSED, _e.WEBRTC_FAILURE);
|
|
3012
2968
|
try {
|
|
3013
2969
|
this.stopConnection();
|
|
3014
2970
|
} catch (n) {
|
|
@@ -3017,20 +2973,20 @@ class sr {
|
|
|
3017
2973
|
}
|
|
3018
2974
|
onTrackEventHandler(e) {
|
|
3019
2975
|
if (e.track.kind === "video") {
|
|
3020
|
-
if (this.startSuccessMetricPolling(), this.videoStream = e.streams[0], this.publicEventEmitter.emit(
|
|
2976
|
+
if (this.startSuccessMetricPolling(), this.videoStream = e.streams[0], this.publicEventEmitter.emit(N.VIDEO_STREAM_STARTED, this.videoStream), this.videoElement) {
|
|
3021
2977
|
this.videoElement.srcObject = this.videoStream;
|
|
3022
2978
|
const n = this.videoElement.requestVideoFrameCallback(() => {
|
|
3023
2979
|
var o;
|
|
3024
|
-
(o = this.videoElement) === null || o === void 0 || o.cancelVideoFrameCallback(n), this.publicEventEmitter.emit(
|
|
2980
|
+
(o = this.videoElement) === null || o === void 0 || o.cancelVideoFrameCallback(n), this.publicEventEmitter.emit(N.VIDEO_PLAY_STARTED), this.successMetricFired || (this.successMetricFired = !0, ge(se.CLIENT_METRIC_MEASUREMENT_SESSION_SUCCESS, "1", { detectionMethod: "videoElement" }));
|
|
3025
2981
|
});
|
|
3026
2982
|
}
|
|
3027
|
-
} else e.track.kind === "audio" && (this.audioStream = e.streams[0], this.publicEventEmitter.emit(
|
|
2983
|
+
} else e.track.kind === "audio" && (this.audioStream = e.streams[0], this.publicEventEmitter.emit(N.AUDIO_STREAM_STARTED, this.audioStream));
|
|
3028
2984
|
}
|
|
3029
2985
|
/**
|
|
3030
2986
|
* Set up the data channels for sending and receiving messages
|
|
3031
2987
|
*/
|
|
3032
2988
|
setupDataChannels() {
|
|
3033
|
-
return
|
|
2989
|
+
return J(this, void 0, void 0, function* () {
|
|
3034
2990
|
if (!this.peerConnection) {
|
|
3035
2991
|
console.error("StreamingClient - setupDataChannels: peer connection is not initialized");
|
|
3036
2992
|
return;
|
|
@@ -3048,16 +3004,16 @@ class sr {
|
|
|
3048
3004
|
const o = JSON.parse(n.data);
|
|
3049
3005
|
switch (o.messageType) {
|
|
3050
3006
|
case De.SPEECH_TEXT:
|
|
3051
|
-
this.internalEventEmitter.emit(
|
|
3007
|
+
this.internalEventEmitter.emit(X.WEBRTC_CHAT_MESSAGE_RECEIVED, o.data);
|
|
3052
3008
|
break;
|
|
3053
3009
|
case De.CLIENT_TOOL_EVENT:
|
|
3054
|
-
const
|
|
3055
|
-
this.internalEventEmitter.emit(
|
|
3056
|
-
const a =
|
|
3057
|
-
this.publicEventEmitter.emit(
|
|
3010
|
+
const u = o.data;
|
|
3011
|
+
this.internalEventEmitter.emit(X.WEBRTC_CLIENT_TOOL_EVENT_RECEIVED, u);
|
|
3012
|
+
const a = sr.WebRTCClientToolEventToClientToolEvent(u);
|
|
3013
|
+
this.publicEventEmitter.emit(N.CLIENT_TOOL_EVENT_RECEIVED, a);
|
|
3058
3014
|
break;
|
|
3059
3015
|
case De.REASONING_TEXT:
|
|
3060
|
-
this.internalEventEmitter.emit(
|
|
3016
|
+
this.internalEventEmitter.emit(X.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED, o.data);
|
|
3061
3017
|
break;
|
|
3062
3018
|
// Unknown message types are silently ignored to maintain forward compatibility
|
|
3063
3019
|
default:
|
|
@@ -3073,9 +3029,9 @@ class sr {
|
|
|
3073
3029
|
* Request microphone permission asynchronously without blocking connection
|
|
3074
3030
|
*/
|
|
3075
3031
|
requestMicrophonePermissionAsync() {
|
|
3076
|
-
return
|
|
3032
|
+
return J(this, void 0, void 0, function* () {
|
|
3077
3033
|
if (this.inputAudioState.permissionState !== fe.PENDING) {
|
|
3078
|
-
this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: fe.PENDING }), this.publicEventEmitter.emit(
|
|
3034
|
+
this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: fe.PENDING }), this.publicEventEmitter.emit(N.MIC_PERMISSION_PENDING);
|
|
3079
3035
|
try {
|
|
3080
3036
|
const e = {
|
|
3081
3037
|
echoCancellation: !0
|
|
@@ -3084,11 +3040,11 @@ class sr {
|
|
|
3084
3040
|
exact: this.audioDeviceId
|
|
3085
3041
|
}), this.inputAudioStream = yield navigator.mediaDevices.getUserMedia({
|
|
3086
3042
|
audio: e
|
|
3087
|
-
}), this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: fe.GRANTED }), this.publicEventEmitter.emit(
|
|
3043
|
+
}), this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: fe.GRANTED }), this.publicEventEmitter.emit(N.MIC_PERMISSION_GRANTED), yield this.setupAudioTrack();
|
|
3088
3044
|
} catch (e) {
|
|
3089
3045
|
console.error("Failed to get microphone permission:", e), this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: fe.DENIED });
|
|
3090
3046
|
const n = e instanceof Error ? e.message : String(e);
|
|
3091
|
-
this.publicEventEmitter.emit(
|
|
3047
|
+
this.publicEventEmitter.emit(N.MIC_PERMISSION_DENIED, n);
|
|
3092
3048
|
}
|
|
3093
3049
|
}
|
|
3094
3050
|
});
|
|
@@ -3097,7 +3053,7 @@ class sr {
|
|
|
3097
3053
|
* Set up audio track and add it to the peer connection using replaceTrack
|
|
3098
3054
|
*/
|
|
3099
3055
|
setupAudioTrack() {
|
|
3100
|
-
return
|
|
3056
|
+
return J(this, void 0, void 0, function* () {
|
|
3101
3057
|
if (!this.peerConnection || !this.inputAudioStream)
|
|
3102
3058
|
return;
|
|
3103
3059
|
if (!this.inputAudioStream.getAudioTracks().length) {
|
|
@@ -3105,23 +3061,23 @@ class sr {
|
|
|
3105
3061
|
return;
|
|
3106
3062
|
}
|
|
3107
3063
|
this.inputAudioState.isMuted && this.muteAllAudioTracks();
|
|
3108
|
-
const e = this.inputAudioStream.getAudioTracks()[0], o = this.peerConnection.getSenders().find((
|
|
3064
|
+
const e = this.inputAudioStream.getAudioTracks()[0], o = this.peerConnection.getSenders().find((u) => {
|
|
3109
3065
|
var a;
|
|
3110
|
-
return ((a =
|
|
3066
|
+
return ((a = u.track) === null || a === void 0 ? void 0 : a.kind) === "audio" || u.track === null && u.dtmf !== null;
|
|
3111
3067
|
});
|
|
3112
3068
|
if (o)
|
|
3113
3069
|
try {
|
|
3114
3070
|
yield o.replaceTrack(e);
|
|
3115
|
-
} catch (
|
|
3116
|
-
console.error("Failed to replace audio track:",
|
|
3071
|
+
} catch (u) {
|
|
3072
|
+
console.error("Failed to replace audio track:", u), this.peerConnection.addTrack(e, this.inputAudioStream);
|
|
3117
3073
|
}
|
|
3118
3074
|
else
|
|
3119
3075
|
this.peerConnection.addTrack(e, this.inputAudioStream);
|
|
3120
|
-
this.publicEventEmitter.emit(
|
|
3076
|
+
this.publicEventEmitter.emit(N.INPUT_AUDIO_STREAM_STARTED, this.inputAudioStream);
|
|
3121
3077
|
});
|
|
3122
3078
|
}
|
|
3123
3079
|
initPeerConnectionAndSendOffer() {
|
|
3124
|
-
return
|
|
3080
|
+
return J(this, void 0, void 0, function* () {
|
|
3125
3081
|
if (yield this.initPeerConnection(), !this.peerConnection) {
|
|
3126
3082
|
console.error("StreamingClient - initPeerConnectionAndSendOffer: peer connection is not initialized");
|
|
3127
3083
|
return;
|
|
@@ -3138,12 +3094,12 @@ class sr {
|
|
|
3138
3094
|
});
|
|
3139
3095
|
}
|
|
3140
3096
|
shutdown() {
|
|
3141
|
-
return
|
|
3097
|
+
return J(this, void 0, void 0, function* () {
|
|
3142
3098
|
var e;
|
|
3143
3099
|
if (this.showPeerConnectionStatsReport) {
|
|
3144
3100
|
const n = yield (e = this.peerConnection) === null || e === void 0 ? void 0 : e.getStats();
|
|
3145
3101
|
if (n) {
|
|
3146
|
-
const o =
|
|
3102
|
+
const o = Vn(n, this.peerConnectionStatsReportOutputFormat);
|
|
3147
3103
|
o && console.log(o, void 0, 2);
|
|
3148
3104
|
}
|
|
3149
3105
|
}
|
|
@@ -3168,7 +3124,7 @@ class sr {
|
|
|
3168
3124
|
});
|
|
3169
3125
|
}
|
|
3170
3126
|
}
|
|
3171
|
-
class
|
|
3127
|
+
class sr {
|
|
3172
3128
|
/**
|
|
3173
3129
|
* Converts a WebRtcClientToolEvent to a ClientToolEvent
|
|
3174
3130
|
*/
|
|
@@ -3184,9 +3140,9 @@ class ar {
|
|
|
3184
3140
|
};
|
|
3185
3141
|
}
|
|
3186
3142
|
}
|
|
3187
|
-
class
|
|
3143
|
+
class ar {
|
|
3188
3144
|
constructor(e, n) {
|
|
3189
|
-
this.reasoning_messages = [], this.publicEventEmitter = e, this.internalEventEmitter = n, this.internalEventEmitter.addListener(
|
|
3145
|
+
this.reasoning_messages = [], this.publicEventEmitter = e, this.internalEventEmitter = n, this.internalEventEmitter.addListener(X.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED, this.processWebRtcReasoningTextMessageEvent.bind(this));
|
|
3190
3146
|
}
|
|
3191
3147
|
webRtcTextMessageEventToReasoningStreamEvent(e) {
|
|
3192
3148
|
return {
|
|
@@ -3198,50 +3154,50 @@ class lr {
|
|
|
3198
3154
|
}
|
|
3199
3155
|
processWebRtcReasoningTextMessageEvent(e) {
|
|
3200
3156
|
const n = this.webRtcTextMessageEventToReasoningStreamEvent(e);
|
|
3201
|
-
this.publicEventEmitter.emit(
|
|
3157
|
+
this.publicEventEmitter.emit(N.REASONING_STREAM_EVENT_RECEIVED, n);
|
|
3202
3158
|
const o = {
|
|
3203
3159
|
id: n.id,
|
|
3204
3160
|
content: n.content,
|
|
3205
3161
|
role: n.role
|
|
3206
|
-
},
|
|
3207
|
-
if (
|
|
3208
|
-
const a = this.reasoning_messages[
|
|
3209
|
-
a.content += o.content, this.reasoning_messages[
|
|
3162
|
+
}, u = this.reasoning_messages.findIndex((a) => a.id === o.id);
|
|
3163
|
+
if (u !== -1) {
|
|
3164
|
+
const a = this.reasoning_messages[u];
|
|
3165
|
+
a.content += o.content, this.reasoning_messages[u] = a;
|
|
3210
3166
|
} else
|
|
3211
3167
|
this.reasoning_messages.push(o);
|
|
3212
|
-
n.endOfThought && this.publicEventEmitter.emit(
|
|
3168
|
+
n.endOfThought && this.publicEventEmitter.emit(N.REASONING_HISTORY_UPDATED, this.reasoning_messages);
|
|
3213
3169
|
}
|
|
3214
3170
|
}
|
|
3215
3171
|
var ue = function(t, e, n, o) {
|
|
3216
|
-
function
|
|
3217
|
-
return a instanceof n ? a : new n(function(
|
|
3218
|
-
|
|
3172
|
+
function u(a) {
|
|
3173
|
+
return a instanceof n ? a : new n(function(c) {
|
|
3174
|
+
c(a);
|
|
3219
3175
|
});
|
|
3220
3176
|
}
|
|
3221
|
-
return new (n || (n = Promise))(function(a,
|
|
3177
|
+
return new (n || (n = Promise))(function(a, c) {
|
|
3222
3178
|
function l(_) {
|
|
3223
3179
|
try {
|
|
3224
3180
|
p(o.next(_));
|
|
3225
3181
|
} catch (d) {
|
|
3226
|
-
|
|
3182
|
+
c(d);
|
|
3227
3183
|
}
|
|
3228
3184
|
}
|
|
3229
|
-
function
|
|
3185
|
+
function m(_) {
|
|
3230
3186
|
try {
|
|
3231
3187
|
p(o.throw(_));
|
|
3232
3188
|
} catch (d) {
|
|
3233
|
-
|
|
3189
|
+
c(d);
|
|
3234
3190
|
}
|
|
3235
3191
|
}
|
|
3236
3192
|
function p(_) {
|
|
3237
|
-
_.done ? a(_.value) :
|
|
3193
|
+
_.done ? a(_.value) : u(_.value).then(l, m);
|
|
3238
3194
|
}
|
|
3239
3195
|
p((o = o.apply(t, e || [])).next());
|
|
3240
3196
|
});
|
|
3241
3197
|
};
|
|
3242
|
-
class
|
|
3198
|
+
class lr {
|
|
3243
3199
|
constructor(e, n, o) {
|
|
3244
|
-
var
|
|
3200
|
+
var u, a, c, l, m;
|
|
3245
3201
|
this.inputAudioState = {
|
|
3246
3202
|
isMuted: !1,
|
|
3247
3203
|
permissionState: fe.NOT_REQUESTED
|
|
@@ -3249,34 +3205,34 @@ class cr {
|
|
|
3249
3205
|
const p = this.validateClientConfig(e, n, o);
|
|
3250
3206
|
if (p)
|
|
3251
3207
|
throw new $(p, V.CLIENT_ERROR_CODE_CONFIGURATION_ERROR, 400);
|
|
3252
|
-
this.personaConfig = n, this.clientOptions = o, (!((
|
|
3208
|
+
this.personaConfig = n, this.clientOptions = o, (!((u = o?.api) === null || u === void 0) && u.baseUrl || !((a = o?.api) === null || a === void 0) && a.apiVersion) && Fn(o.api.baseUrl || Wi, o.api.apiVersion || xt), !((l = (c = o?.api) === null || c === void 0 ? void 0 : c.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);
|
|
3253
3209
|
}
|
|
3254
3210
|
decodeJwt(e) {
|
|
3255
3211
|
try {
|
|
3256
|
-
const n = e.split(".")[1], o =
|
|
3212
|
+
const n = e.split(".")[1], o = Un.Buffer.from(n, "base64").toString("utf8");
|
|
3257
3213
|
return JSON.parse(o);
|
|
3258
3214
|
} catch {
|
|
3259
3215
|
throw new Error("Invalid session token format");
|
|
3260
3216
|
}
|
|
3261
3217
|
}
|
|
3262
3218
|
validateClientConfig(e, n, o) {
|
|
3263
|
-
var
|
|
3219
|
+
var u, a;
|
|
3264
3220
|
if (!e && !o?.apiKey)
|
|
3265
3221
|
return "Either sessionToken or apiKey must be provided";
|
|
3266
3222
|
if (o?.apiKey && e)
|
|
3267
3223
|
return "Only one of sessionToken or apiKey should be used";
|
|
3268
|
-
const
|
|
3269
|
-
if (
|
|
3270
|
-
return
|
|
3224
|
+
const c = jn((u = o?.api) === null || u === void 0 ? void 0 : u.apiGateway);
|
|
3225
|
+
if (c)
|
|
3226
|
+
return c;
|
|
3271
3227
|
if (e) {
|
|
3272
3228
|
const l = this.decodeJwt(e);
|
|
3273
|
-
this.organizationId = l.accountId,
|
|
3229
|
+
this.organizationId = l.accountId, we({
|
|
3274
3230
|
organizationId: this.organizationId
|
|
3275
3231
|
});
|
|
3276
|
-
const
|
|
3277
|
-
if (
|
|
3232
|
+
const m = (a = l.type) === null || a === void 0 ? void 0 : a.toLowerCase();
|
|
3233
|
+
if (m === "legacy")
|
|
3278
3234
|
return "Legacy session tokens are no longer supported. Please define your persona when creating your session token. See https://docs.anam.ai/resources/migrating-legacy for more information.";
|
|
3279
|
-
if ((
|
|
3235
|
+
if ((m === "ephemeral" || m === "stateful") && n)
|
|
3280
3236
|
return "This session token already contains a persona configuration. Please remove the personaConfig parameter.";
|
|
3281
3237
|
} else if (!n)
|
|
3282
3238
|
return "Missing persona config. Persona configuration must be provided when using apiKey";
|
|
@@ -3299,48 +3255,48 @@ class cr {
|
|
|
3299
3255
|
}
|
|
3300
3256
|
startSession(e) {
|
|
3301
3257
|
return ue(this, void 0, void 0, function* () {
|
|
3302
|
-
var n, o,
|
|
3303
|
-
const y = this.personaConfig,
|
|
3304
|
-
this.sessionId =
|
|
3258
|
+
var n, o, u, a, c, l, m, p, _, d, S, g;
|
|
3259
|
+
const y = this.personaConfig, b = this.buildStartSessionOptionsForClient(), A = yield this.apiClient.startSession(y, b), { sessionId: C, clientConfig: I, engineHost: x, engineProtocol: O, signallingEndpoint: T } = A, { heartbeatIntervalSeconds: q, maxWsReconnectionAttempts: H, iceServers: ae } = I;
|
|
3260
|
+
this.sessionId = C, we({
|
|
3305
3261
|
sessionId: this.sessionId
|
|
3306
3262
|
});
|
|
3307
3263
|
const ne = !((n = this.clientOptions) === null || n === void 0) && n.iceServers ? this.clientOptions.iceServers : ae;
|
|
3308
3264
|
try {
|
|
3309
|
-
this.streamingClient = new
|
|
3265
|
+
this.streamingClient = new or(C, {
|
|
3310
3266
|
engine: {
|
|
3311
|
-
baseUrl: `${
|
|
3267
|
+
baseUrl: `${O}://${x}`
|
|
3312
3268
|
},
|
|
3313
3269
|
signalling: {
|
|
3314
|
-
heartbeatIntervalSeconds:
|
|
3270
|
+
heartbeatIntervalSeconds: q,
|
|
3315
3271
|
maxWsReconnectionAttempts: H,
|
|
3316
3272
|
url: {
|
|
3317
3273
|
baseUrl: x,
|
|
3318
|
-
protocol:
|
|
3319
|
-
signallingPath:
|
|
3274
|
+
protocol: O,
|
|
3275
|
+
signallingPath: T
|
|
3320
3276
|
}
|
|
3321
3277
|
},
|
|
3322
3278
|
iceServers: ne,
|
|
3323
3279
|
inputAudio: {
|
|
3324
3280
|
inputAudioState: this.inputAudioState,
|
|
3325
3281
|
userProvidedMediaStream: !((o = this.clientOptions) === null || o === void 0) && o.disableInputAudio ? void 0 : e,
|
|
3326
|
-
audioDeviceId: (
|
|
3282
|
+
audioDeviceId: (u = this.clientOptions) === null || u === void 0 ? void 0 : u.audioDeviceId,
|
|
3327
3283
|
disableInputAudio: (a = this.clientOptions) === null || a === void 0 ? void 0 : a.disableInputAudio
|
|
3328
3284
|
},
|
|
3329
|
-
apiGateway: (l = (
|
|
3285
|
+
apiGateway: (l = (c = this.clientOptions) === null || c === void 0 ? void 0 : c.api) === null || l === void 0 ? void 0 : l.apiGateway,
|
|
3330
3286
|
metrics: {
|
|
3331
|
-
showPeerConnectionStatsReport: (_ = (p = (
|
|
3332
|
-
peerConnectionStatsReportOutputFormat: (
|
|
3287
|
+
showPeerConnectionStatsReport: (_ = (p = (m = this.clientOptions) === null || m === void 0 ? void 0 : m.metrics) === null || p === void 0 ? void 0 : p.showPeerConnectionStatsReport) !== null && _ !== void 0 ? _ : !1,
|
|
3288
|
+
peerConnectionStatsReportOutputFormat: (g = (S = (d = this.clientOptions) === null || d === void 0 ? void 0 : d.metrics) === null || S === void 0 ? void 0 : S.peerConnectionStatsReportOutputFormat) !== null && g !== void 0 ? g : "console"
|
|
3333
3289
|
}
|
|
3334
3290
|
}, this.publicEventEmitter, this.internalEventEmitter);
|
|
3335
3291
|
} catch (re) {
|
|
3336
|
-
throw
|
|
3292
|
+
throw we({
|
|
3337
3293
|
sessionId: null
|
|
3338
3294
|
}), new $("Failed to initialize streaming client", V.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
|
|
3339
3295
|
cause: re instanceof Error ? re.message : String(re),
|
|
3340
|
-
sessionId:
|
|
3296
|
+
sessionId: C
|
|
3341
3297
|
});
|
|
3342
3298
|
}
|
|
3343
|
-
return
|
|
3299
|
+
return C;
|
|
3344
3300
|
});
|
|
3345
3301
|
}
|
|
3346
3302
|
startSessionIfNeeded(e) {
|
|
@@ -3356,19 +3312,19 @@ class cr {
|
|
|
3356
3312
|
var n;
|
|
3357
3313
|
if (this._isStreaming)
|
|
3358
3314
|
throw new Error("Already streaming");
|
|
3359
|
-
const o =
|
|
3360
|
-
return
|
|
3315
|
+
const o = li();
|
|
3316
|
+
return we({
|
|
3361
3317
|
attemptCorrelationId: o,
|
|
3362
3318
|
sessionId: null
|
|
3363
3319
|
// reset sessionId
|
|
3364
|
-
}),
|
|
3320
|
+
}), ge(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((u) => {
|
|
3365
3321
|
var a;
|
|
3366
|
-
const
|
|
3367
|
-
let l = !1,
|
|
3368
|
-
this.publicEventEmitter.addListener(
|
|
3369
|
-
|
|
3370
|
-
}), this.publicEventEmitter.addListener(
|
|
3371
|
-
|
|
3322
|
+
const c = [];
|
|
3323
|
+
let l = !1, m = !1;
|
|
3324
|
+
this.publicEventEmitter.addListener(N.VIDEO_STREAM_STARTED, (p) => {
|
|
3325
|
+
c.push(p), l = !0, m && u(c);
|
|
3326
|
+
}), this.publicEventEmitter.addListener(N.AUDIO_STREAM_STARTED, (p) => {
|
|
3327
|
+
c.push(p), m = !0, l && u(c);
|
|
3372
3328
|
}), (a = this.streamingClient) === null || a === void 0 || a.startConnection();
|
|
3373
3329
|
});
|
|
3374
3330
|
});
|
|
@@ -3384,12 +3340,12 @@ class cr {
|
|
|
3384
3340
|
streamToVideoElement(e, n) {
|
|
3385
3341
|
return ue(this, void 0, void 0, function* () {
|
|
3386
3342
|
var o;
|
|
3387
|
-
const
|
|
3388
|
-
|
|
3389
|
-
attemptCorrelationId:
|
|
3343
|
+
const u = li();
|
|
3344
|
+
we({
|
|
3345
|
+
attemptCorrelationId: u,
|
|
3390
3346
|
sessionId: null
|
|
3391
3347
|
// reset sessionId
|
|
3392
|
-
}),
|
|
3348
|
+
}), ge(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.");
|
|
3393
3349
|
try {
|
|
3394
3350
|
yield this.startSessionIfNeeded(n);
|
|
3395
3351
|
} catch (a) {
|
|
@@ -3441,13 +3397,13 @@ class cr {
|
|
|
3441
3397
|
const n = this.getActiveSessionId();
|
|
3442
3398
|
if (!n)
|
|
3443
3399
|
throw new Error("Failed to send user message: no active session");
|
|
3444
|
-
const o = (/* @__PURE__ */ new Date()).toISOString().replace("Z", ""),
|
|
3400
|
+
const o = (/* @__PURE__ */ new Date()).toISOString().replace("Z", ""), u = JSON.stringify({
|
|
3445
3401
|
content: e,
|
|
3446
3402
|
timestamp: o,
|
|
3447
3403
|
session_id: n,
|
|
3448
3404
|
message_type: "speech"
|
|
3449
3405
|
});
|
|
3450
|
-
this.sendDataMessage(
|
|
3406
|
+
this.sendDataMessage(u);
|
|
3451
3407
|
}
|
|
3452
3408
|
interruptPersona() {
|
|
3453
3409
|
if (!this._isStreaming)
|
|
@@ -3465,7 +3421,7 @@ class cr {
|
|
|
3465
3421
|
}
|
|
3466
3422
|
stopStreaming() {
|
|
3467
3423
|
return ue(this, void 0, void 0, function* () {
|
|
3468
|
-
this.streamingClient && (this.publicEventEmitter.emit(
|
|
3424
|
+
this.streamingClient && (this.publicEventEmitter.emit(N.CONNECTION_CLOSED, _e.NORMAL), yield this.streamingClient.stopConnection(), this.streamingClient = null, this.sessionId = null, we({
|
|
3469
3425
|
attemptCorrelationId: null,
|
|
3470
3426
|
sessionId: null,
|
|
3471
3427
|
organizationId: this.organizationId
|
|
@@ -3530,344 +3486,373 @@ class cr {
|
|
|
3530
3486
|
return this.sessionId;
|
|
3531
3487
|
}
|
|
3532
3488
|
}
|
|
3533
|
-
const
|
|
3489
|
+
const cr = (t, e) => new lr(t, void 0, e), ur = "https://api.anam.ai";
|
|
3490
|
+
function dr(t) {
|
|
3491
|
+
try {
|
|
3492
|
+
const e = t.split(".")[1];
|
|
3493
|
+
return JSON.parse(atob(e));
|
|
3494
|
+
} catch {
|
|
3495
|
+
return {};
|
|
3496
|
+
}
|
|
3497
|
+
}
|
|
3498
|
+
const Z = K(null), te = K("idle"), Le = K(!1), Ke = K(!1), at = K([]), Pe = K(null), it = K(null), Ot = K(null), kt = K(null), Dt = K(null), ui = K(!1), nt = K(!1);
|
|
3534
3499
|
function hr(t, e) {
|
|
3535
3500
|
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.";
|
|
3536
3501
|
}
|
|
3537
3502
|
async function fr(t, e) {
|
|
3538
|
-
|
|
3503
|
+
nt.value = !1;
|
|
3539
3504
|
try {
|
|
3540
3505
|
const n = await fetch(`${e}/v1/personas/${t}/widget`);
|
|
3541
3506
|
if (!n.ok) return;
|
|
3542
3507
|
const o = await n.json();
|
|
3543
|
-
|
|
3508
|
+
Ot.value = o.persona?.avatarImageUrl || null, kt.value = o.persona?.name || null, Dt.value = o.widgetConfig || null;
|
|
3544
3509
|
} catch {
|
|
3545
3510
|
} finally {
|
|
3546
|
-
|
|
3511
|
+
nt.value = !0;
|
|
3547
3512
|
}
|
|
3548
3513
|
}
|
|
3549
|
-
async function pr(t, e, n) {
|
|
3514
|
+
async function pr(t, e, n, o) {
|
|
3550
3515
|
if (te.value === "connecting" || te.value === "connected")
|
|
3551
3516
|
return;
|
|
3552
3517
|
te.value = "connecting", Pe.value = null;
|
|
3553
|
-
let
|
|
3518
|
+
let u;
|
|
3554
3519
|
try {
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3520
|
+
let a;
|
|
3521
|
+
if (o)
|
|
3522
|
+
console.log("[AnamWidget] Using pre-created session token"), a = o;
|
|
3523
|
+
else {
|
|
3524
|
+
console.log("[AnamWidget] Fetching session for agent:", t);
|
|
3525
|
+
const m = await fetch(`${e}/v1/auth/widget`, {
|
|
3526
|
+
method: "POST",
|
|
3527
|
+
headers: { "Content-Type": "application/json" },
|
|
3528
|
+
body: JSON.stringify({ agentId: t })
|
|
3529
|
+
});
|
|
3530
|
+
if (u = m.status, !m.ok) {
|
|
3531
|
+
const _ = await m.json().catch(() => ({}));
|
|
3532
|
+
throw new Error(_.error || `HTTP ${m.status}`);
|
|
3533
|
+
}
|
|
3534
|
+
const p = await m.json();
|
|
3535
|
+
console.log("[AnamWidget] Got session from agent-id:", {
|
|
3536
|
+
hasToken: !!p.sessionToken
|
|
3537
|
+
}), a = p.sessionToken;
|
|
3538
|
+
}
|
|
3539
|
+
const c = cr(a, {
|
|
3571
3540
|
api: e ? { baseUrl: e } : void 0,
|
|
3572
3541
|
metrics: { disableClientMetrics: !0 }
|
|
3573
3542
|
});
|
|
3574
|
-
|
|
3543
|
+
c.addListener(N.CONNECTION_ESTABLISHED, () => {
|
|
3575
3544
|
console.log("[AnamWidget] Connection established"), te.value = "connected";
|
|
3576
|
-
}),
|
|
3545
|
+
}), c.addListener(N.VIDEO_STREAM_STARTED, () => {
|
|
3577
3546
|
console.log("[AnamWidget] Video stream started"), Le.value = !0;
|
|
3578
|
-
}),
|
|
3547
|
+
}), c.addListener(N.AUDIO_STREAM_STARTED, () => {
|
|
3579
3548
|
console.log("[AnamWidget] Audio stream started");
|
|
3580
|
-
}),
|
|
3581
|
-
|
|
3582
|
-
}),
|
|
3583
|
-
console.log("[AnamWidget] Connection closed:",
|
|
3584
|
-
}),
|
|
3585
|
-
console.log("[AnamWidget] Session ready:",
|
|
3586
|
-
}),
|
|
3587
|
-
const l = await
|
|
3549
|
+
}), c.addListener(N.MESSAGE_HISTORY_UPDATED, (m) => {
|
|
3550
|
+
at.value = [...m];
|
|
3551
|
+
}), c.addListener(N.CONNECTION_CLOSED, (m, p) => {
|
|
3552
|
+
console.log("[AnamWidget] Connection closed:", m, p), te.value = "idle", Le.value = !1, it.value = null;
|
|
3553
|
+
}), c.addListener(N.SESSION_READY, (m) => {
|
|
3554
|
+
console.log("[AnamWidget] Session ready:", m), it.value = m;
|
|
3555
|
+
}), Z.value = c;
|
|
3556
|
+
const l = await c.stream();
|
|
3588
3557
|
if (n && l.length > 0) {
|
|
3589
|
-
const
|
|
3590
|
-
|
|
3558
|
+
const m = l.find((p) => p.getVideoTracks().length > 0);
|
|
3559
|
+
m && (n.srcObject = m);
|
|
3591
3560
|
}
|
|
3592
|
-
} catch (
|
|
3593
|
-
console.error("[AnamWidget] Failed to start session:",
|
|
3561
|
+
} catch (a) {
|
|
3562
|
+
console.error("[AnamWidget] Failed to start session:", a), Pe.value = hr(a, u), te.value = "error", Z.value = null;
|
|
3594
3563
|
}
|
|
3595
3564
|
}
|
|
3596
3565
|
async function _r() {
|
|
3597
|
-
if (
|
|
3566
|
+
if (Z.value)
|
|
3598
3567
|
try {
|
|
3599
|
-
await
|
|
3568
|
+
await Z.value.stopStreaming();
|
|
3600
3569
|
} catch (t) {
|
|
3601
3570
|
console.error("[AnamWidget] Failed to stop session:", t);
|
|
3602
3571
|
}
|
|
3603
|
-
|
|
3572
|
+
Z.value = null, te.value = "idle", Le.value = !1, at.value = [];
|
|
3604
3573
|
}
|
|
3605
3574
|
function Er(t) {
|
|
3606
|
-
!
|
|
3575
|
+
!Z.value || te.value !== "connected" || Z.value.sendUserMessage(t);
|
|
3607
3576
|
}
|
|
3608
3577
|
function mr() {
|
|
3609
|
-
|
|
3578
|
+
Z.value && (Ke.value ? (Z.value.unmuteInputAudio(), Ke.value = !1) : (Z.value.muteInputAudio(), Ke.value = !0));
|
|
3610
3579
|
}
|
|
3611
3580
|
function gr() {
|
|
3612
|
-
|
|
3581
|
+
Z.value?.isStreaming() && Z.value.stopStreaming(), Z.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;
|
|
3613
3582
|
}
|
|
3614
|
-
function vr(t, e) {
|
|
3615
|
-
|
|
3616
|
-
|
|
3583
|
+
function vr(t, e, n) {
|
|
3584
|
+
const o = t || (n ? dr(n).personaId : void 0);
|
|
3585
|
+
ui.value = !!o || !!n;
|
|
3586
|
+
const u = e || ur;
|
|
3617
3587
|
return {
|
|
3618
3588
|
connectionStatus: te,
|
|
3619
3589
|
isStreaming: Le,
|
|
3620
|
-
isMuted:
|
|
3621
|
-
messages:
|
|
3590
|
+
isMuted: Ke,
|
|
3591
|
+
messages: at,
|
|
3622
3592
|
error: Pe,
|
|
3623
|
-
sessionId:
|
|
3624
|
-
|
|
3625
|
-
isReady:
|
|
3626
|
-
avatarThumbnailUrl:
|
|
3627
|
-
personaName:
|
|
3593
|
+
sessionId: it,
|
|
3594
|
+
isConfigured: ui,
|
|
3595
|
+
isReady: nt,
|
|
3596
|
+
avatarThumbnailUrl: Ot,
|
|
3597
|
+
personaName: kt,
|
|
3628
3598
|
serverConfig: Dt,
|
|
3629
3599
|
fetchWidgetConfig: () => {
|
|
3630
|
-
if (!
|
|
3631
|
-
|
|
3600
|
+
if (!o) {
|
|
3601
|
+
nt.value = !0;
|
|
3632
3602
|
return;
|
|
3633
3603
|
}
|
|
3634
|
-
fr(
|
|
3604
|
+
fr(o, u);
|
|
3635
3605
|
},
|
|
3636
|
-
startSession: (
|
|
3606
|
+
startSession: (l) => !o && !n ? (Pe.value = "No agent ID or session token configured", Promise.resolve()) : pr(o || "", u, l, n),
|
|
3637
3607
|
stopSession: _r,
|
|
3638
3608
|
sendMessage: Er,
|
|
3639
3609
|
toggleMute: mr,
|
|
3640
3610
|
cleanup: gr
|
|
3641
3611
|
};
|
|
3642
3612
|
}
|
|
3643
|
-
const ui = '@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-outline-style:solid}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.visible{visibility:visible}.fixed{position:fixed}.block{display:block}.flex{display:flex}.inline{display:inline}.flex-shrink{flex-shrink:1}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.border{border-style:var(--tw-border-style);border-width:1px}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}}:host{--anam-background:#fff;--anam-text:#18181b;--anam-trigger-size:80px;--anam-sheet-width:400px;--anam-sheet-height:640px;all:initial;color:var(--anam-text);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:DM Sans,system-ui,-apple-system,sans-serif;font-size:15px;line-height:1.5}@media(max-width:640px){:host{--anam-trigger-size:72px;--anam-sheet-width: calc(100vw - 24px) ;--anam-sheet-height: calc(100dvh - 100px) }}.anam-widget{z-index:9999;font-family:inherit}.anam-widget[data-layout=fixed]{position:fixed}.anam-widget[data-layout=inline]{position:relative}.anam-trigger{width:var(--anam-trigger-size);height:var(--anam-trigger-size);cursor:pointer;background:0 0;border:none;border-radius:50%;justify-content:center;align-items:center;padding:0;transition:all .25s cubic-bezier(.4,0,.2,1);display:flex;overflow:hidden;box-shadow:0 2px 8px #00000014,0 8px 24px -4px #0000002e}.anam-trigger:hover{transform:scale(1.06);box-shadow:0 4px 12px #0000001a,0 12px 32px -4px #00000040}.anam-trigger:active{transform:scale(.97)}.anam-trigger img{object-fit:cover;width:100%;height:100%;display:block}.anam-sheet{width:var(--anam-sheet-width);aspect-ratio:16/10;max-height:var(--anam-sheet-height);border-radius:16px;animation:.25s cubic-bezier(.16,1,.3,1) sheetIn;position:relative;overflow:hidden;box-shadow:0 32px 64px -16px #00000040,0 0 0 1px #00000014}.anam-widget[data-mode=expanded][data-layout=inline] .anam-sheet{border-radius:16px;width:100%;max-height:none;animation:none}@keyframes sheetIn{0%{opacity:0;transform:translateY(8px)scale(.97)}to{opacity:1;transform:translateY(0)scale(1)}}.anam-video{object-fit:cover;background:#000;width:100%;height:100%;display:block;position:absolute;inset:0}.anam-video[data-hidden=true]{visibility:hidden}.anam-overlay-idle{z-index:2;position:absolute;inset:0}.anam-overlay-idle img{object-fit:cover;width:100%;height:100%;display:block}.anam-cta-pill{-webkit-backdrop-filter:blur(16px);color:#fff;letter-spacing:-.01em;cursor:pointer;white-space:nowrap;background:#00000080;border:1px solid #ffffff1a;border-radius:999px;align-items:center;gap:10px;padding:12px 28px;font-family:inherit;font-size:15px;font-weight:500;transition:all .2s;display:flex;position:absolute;bottom:40px;left:50%;transform:translate(-50%)}.anam-cta-pill:hover{background:#000000a6;transform:translate(-50%)scale(1.03)}.anam-cta-pill:active{transform:translate(-50%)scale(.98)}.anam-cta-pill svg{flex-shrink:0}.anam-overlay-unconfigured{z-index:2;background:#111;flex-direction:column;justify-content:center;align-items:center;gap:16px;display:flex;position:absolute;inset:0}.anam-overlay-unconfigured span{color:#ffffff59;letter-spacing:-.01em;font-size:14px;font-weight:400}.anam-overlay-loading{z-index:3;background:#000;flex-direction:column;justify-content:center;align-items:center;gap:20px;display:flex;position:absolute;inset:0}.anam-overlay-loading span{color:#fffc;letter-spacing:-.01em;font-size:15px;font-weight:400}.anam-overlay-error{z-index:3;background:#000;flex-direction:column;justify-content:center;align-items:center;gap:16px;display:flex;position:absolute;inset:0}.anam-overlay-error-text{color:#fff9;text-align:center;max-width:260px;font-size:14px;line-height:1.5}.anam-overlay-error .anam-retry-btn{-webkit-backdrop-filter:blur(8px);color:#fff;cursor:pointer;background:#ffffff1f;border:1px solid #ffffff1a;border-radius:999px;padding:10px 24px;font-family:inherit;font-size:14px;font-weight:500;transition:background .15s}.anam-overlay-error .anam-retry-btn:hover{background:#fff3}.anam-spinner{border:2.5px solid #ffffff1f;border-top-color:#fff;border-radius:50%;width:32px;height:32px;animation:.75s linear infinite spin}@keyframes spin{to{transform:rotate(360deg)}}.anam-close-btn{z-index:10;-webkit-backdrop-filter:blur(8px);color:#fff;cursor:pointer;background:#00000073;border:1px solid #ffffff14;border-radius:50%;justify-content:center;align-items:center;width:32px;height:32px;padding:0;transition:background .15s;display:flex;position:absolute;top:12px;right:12px}.anam-close-btn:hover{background:#0009}.anam-toast{z-index:10;-webkit-backdrop-filter:blur(16px);color:#fff;letter-spacing:-.01em;white-space:nowrap;text-overflow:ellipsis;pointer-events:none;background:#0009;border:1px solid #ffffff0f;border-radius:999px;max-width:85%;padding:10px 22px;font-size:14px;font-weight:400;animation:.25s cubic-bezier(.16,1,.3,1) toastIn;position:absolute;bottom:80px;left:50%;overflow:hidden;transform:translate(-50%)}.anam-toast-out{animation:.4s forwards toastOut}@keyframes toastIn{0%{opacity:0;transform:translate(-50%)translateY(6px)}to{opacity:1;transform:translate(-50%)translateY(0)}}@keyframes toastOut{0%{opacity:1}to{opacity:0}}.anam-control-bar{z-index:10;background:linear-gradient(#0000,#00000040 40%,#0000008c);align-items:center;gap:8px;padding:48px 16px 16px;display:flex;position:absolute;bottom:0;left:0;right:0}.anam-ctl-btn{-webkit-backdrop-filter:blur(8px);color:#fff;cursor:pointer;background:#ffffff24;border:1px solid #ffffff0f;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;width:44px;height:44px;padding:0;transition:background .15s;display:flex}.anam-ctl-btn:hover{background:#ffffff38}.anam-ctl-btn:disabled{opacity:.35;cursor:not-allowed}.anam-ctl-btn-muted{background:#dc26268c;border-color:#dc262633}.anam-ctl-btn-muted:hover{background:#dc2626b3}.anam-ctl-end{background:#dc262699;border-color:#dc262626}.anam-ctl-end:hover{background:#dc2626cc}.anam-ctl-input{-webkit-backdrop-filter:blur(8px);color:#fff;background:#ffffff1a;border:1px solid #ffffff14;border-radius:999px;outline:none;flex:1;min-width:0;padding:11px 18px;font-family:inherit;font-size:14px;transition:background .15s,border-color .15s}.anam-ctl-input::placeholder{color:#fff6}.anam-ctl-input:focus{background:#ffffff26;border-color:#ffffff2e}.anam-ctl-input:disabled{opacity:.35;cursor:not-allowed}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}';
|
|
3644
|
-
function
|
|
3613
|
+
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}';
|
|
3614
|
+
function wt(t, e) {
|
|
3645
3615
|
const n = { ...t };
|
|
3646
3616
|
for (const o of Object.keys(e)) {
|
|
3647
|
-
const
|
|
3648
|
-
|
|
3617
|
+
const u = e[o];
|
|
3618
|
+
u !== void 0 && (u !== null && typeof u == "object" && !Array.isArray(u) && typeof n[o] == "object" && n[o] !== null && !Array.isArray(n[o]) ? n[o] = wt(n[o], u) : n[o] = u);
|
|
3649
3619
|
}
|
|
3650
3620
|
return n;
|
|
3651
3621
|
}
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
/* @__PURE__ */
|
|
3669
|
-
/* @__PURE__ */
|
|
3622
|
+
function ze(t) {
|
|
3623
|
+
if (t !== void 0)
|
|
3624
|
+
return t === "true";
|
|
3625
|
+
}
|
|
3626
|
+
function yr(t) {
|
|
3627
|
+
const e = {}, n = ze(t.inline);
|
|
3628
|
+
n !== void 0 && (e.inline = n), t.layout && (e.layout = t.layout), t.position && (e.position = t.position);
|
|
3629
|
+
const o = ze(t["ui-mute-button"]);
|
|
3630
|
+
o !== void 0 && (e.showMuteButton = o);
|
|
3631
|
+
const u = ze(t["ui-text-input"]);
|
|
3632
|
+
u !== void 0 && (e.showTextInput = u);
|
|
3633
|
+
const a = ze(t["ui-captions"]);
|
|
3634
|
+
return a !== void 0 && (e.showCaptions = a), e;
|
|
3635
|
+
}
|
|
3636
|
+
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: [
|
|
3637
|
+
/* @__PURE__ */ w("path", { d: "M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z" }),
|
|
3638
|
+
/* @__PURE__ */ w("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
|
|
3639
|
+
/* @__PURE__ */ w("line", { x1: "12", y1: "19", x2: "12", y2: "22" })
|
|
3640
|
+
] }), Ir = () => /* @__PURE__ */ w("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
|
|
3641
|
+
/* @__PURE__ */ w("line", { x1: "1", y1: "1", x2: "23", y2: "23" }),
|
|
3642
|
+
/* @__PURE__ */ w("path", { d: "M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V5a3 3 0 0 0-5.94-.6" }),
|
|
3643
|
+
/* @__PURE__ */ w("path", { d: "M17 16.95A7 7 0 0 1 5 12v-2m14 0v2c0 .87-.16 1.71-.46 2.49" }),
|
|
3644
|
+
/* @__PURE__ */ w("line", { x1: "12", y1: "19", x2: "12", y2: "22" })
|
|
3645
|
+
] }), br = () => /* @__PURE__ */ w("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
|
|
3646
|
+
/* @__PURE__ */ w("line", { x1: "22", y1: "2", x2: "11", y2: "13" }),
|
|
3647
|
+
/* @__PURE__ */ w("polygon", { points: "22 2 15 22 11 13 2 9 22 2" })
|
|
3648
|
+
] }), Ar = () => /* @__PURE__ */ w("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
|
|
3649
|
+
/* @__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" }),
|
|
3650
|
+
/* @__PURE__ */ w("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
3651
|
+
] }), Ct = () => /* @__PURE__ */ w("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", style: { opacity: 0.3 }, children: [
|
|
3652
|
+
/* @__PURE__ */ w("circle", { cx: "24", cy: "18", r: "8", stroke: "white", "stroke-width": "2", fill: "none" }),
|
|
3653
|
+
/* @__PURE__ */ w("path", { d: "M8 42c0-8.837 7.163-16 16-16s16 7.163 16 16", stroke: "white", "stroke-width": "2", fill: "none" })
|
|
3670
3654
|
] });
|
|
3671
|
-
function
|
|
3655
|
+
function Tr({
|
|
3672
3656
|
config: t,
|
|
3673
3657
|
session: e,
|
|
3674
3658
|
videoRef: n,
|
|
3675
3659
|
avatarSrc: o,
|
|
3676
|
-
displayCta:
|
|
3660
|
+
displayCta: u,
|
|
3677
3661
|
onCollapse: a
|
|
3678
3662
|
}) {
|
|
3679
|
-
const
|
|
3663
|
+
const c = Ze(null), [l, m] = qe(""), [p, _] = qe(null), [d, S] = qe(!1), g = Ze(null), y = e.connectionStatus.value === "connected", b = e.connectionStatus.value === "connecting", A = e.connectionStatus.value === "error", C = e.isStreaming.value, I = !b && !y && !A, x = je(async () => {
|
|
3680
3664
|
n.current && await e.startSession(n.current);
|
|
3681
|
-
}, []),
|
|
3665
|
+
}, [e.startSession]), O = je(async () => {
|
|
3682
3666
|
await e.stopSession();
|
|
3683
|
-
}, []),
|
|
3667
|
+
}, [e.stopSession]), T = je(() => {
|
|
3684
3668
|
if (!l.trim()) return;
|
|
3685
3669
|
const H = l.trim();
|
|
3686
|
-
e.sendMessage(H),
|
|
3687
|
-
S(!0),
|
|
3670
|
+
e.sendMessage(H), m(""), c.current?.focus(), g.current && clearTimeout(g.current), S(!1), _(H), g.current = window.setTimeout(() => {
|
|
3671
|
+
S(!0), g.current = window.setTimeout(() => {
|
|
3688
3672
|
_(null), S(!1);
|
|
3689
3673
|
}, 400);
|
|
3690
3674
|
}, 2600);
|
|
3691
|
-
}, [l]),
|
|
3692
|
-
H.key === "Enter" && !H.shiftKey && (H.preventDefault(),
|
|
3693
|
-
}, [
|
|
3694
|
-
return
|
|
3695
|
-
|
|
3696
|
-
}, []), /* @__PURE__ */
|
|
3697
|
-
/* @__PURE__ */
|
|
3675
|
+
}, [l]), q = je((H) => {
|
|
3676
|
+
H.key === "Enter" && !H.shiftKey && (H.preventDefault(), T());
|
|
3677
|
+
}, [T]);
|
|
3678
|
+
return gt(() => () => {
|
|
3679
|
+
g.current && clearTimeout(g.current);
|
|
3680
|
+
}, []), /* @__PURE__ */ w("div", { class: "anam-sheet", children: [
|
|
3681
|
+
/* @__PURE__ */ w(
|
|
3698
3682
|
"video",
|
|
3699
3683
|
{
|
|
3700
3684
|
ref: n,
|
|
3701
3685
|
class: "anam-video",
|
|
3702
3686
|
autoplay: !0,
|
|
3703
3687
|
playsinline: !0,
|
|
3704
|
-
"data-hidden":
|
|
3688
|
+
"data-hidden": C ? void 0 : "true"
|
|
3705
3689
|
}
|
|
3706
3690
|
),
|
|
3707
|
-
|
|
3691
|
+
I && (e.isConfigured.value ? (
|
|
3708
3692
|
/* Has agent-id: show avatar or placeholder + CTA pill */
|
|
3709
|
-
/* @__PURE__ */
|
|
3710
|
-
o ? /* @__PURE__ */
|
|
3711
|
-
/* @__PURE__ */
|
|
3712
|
-
/* @__PURE__ */
|
|
3713
|
-
|
|
3693
|
+
/* @__PURE__ */ w("div", { class: "anam-overlay-idle", children: [
|
|
3694
|
+
o ? /* @__PURE__ */ w("img", { src: o, alt: "Avatar" }) : /* @__PURE__ */ w(Ct, {}),
|
|
3695
|
+
/* @__PURE__ */ w("button", { class: "anam-cta-pill", onClick: x, children: [
|
|
3696
|
+
/* @__PURE__ */ w(wr, {}),
|
|
3697
|
+
u
|
|
3714
3698
|
] })
|
|
3715
3699
|
] })
|
|
3716
3700
|
) : (
|
|
3717
3701
|
/* No agent-id: unconfigured overlay */
|
|
3718
|
-
/* @__PURE__ */
|
|
3719
|
-
/* @__PURE__ */
|
|
3720
|
-
/* @__PURE__ */
|
|
3702
|
+
/* @__PURE__ */ w("div", { class: "anam-overlay-unconfigured", children: [
|
|
3703
|
+
/* @__PURE__ */ w(Ct, {}),
|
|
3704
|
+
/* @__PURE__ */ w("span", { children: "Agent not configured" })
|
|
3721
3705
|
] })
|
|
3722
3706
|
)),
|
|
3723
|
-
|
|
3724
|
-
/* @__PURE__ */
|
|
3725
|
-
/* @__PURE__ */
|
|
3707
|
+
b && /* @__PURE__ */ w("div", { class: "anam-overlay-loading", children: [
|
|
3708
|
+
/* @__PURE__ */ w("span", { class: "anam-spinner" }),
|
|
3709
|
+
/* @__PURE__ */ w("span", { children: "Starting your conversation..." })
|
|
3726
3710
|
] }),
|
|
3727
|
-
|
|
3728
|
-
/* @__PURE__ */
|
|
3729
|
-
/* @__PURE__ */
|
|
3711
|
+
A && /* @__PURE__ */ w("div", { class: "anam-overlay-error", children: [
|
|
3712
|
+
/* @__PURE__ */ w("div", { class: "anam-overlay-error-text", children: e.error.value || "Something went wrong" }),
|
|
3713
|
+
/* @__PURE__ */ w("button", { class: "anam-retry-btn", onClick: x, children: "Try Again" })
|
|
3730
3714
|
] }),
|
|
3731
|
-
(y ||
|
|
3732
|
-
a && /* @__PURE__ */
|
|
3733
|
-
p && /* @__PURE__ */
|
|
3734
|
-
/* @__PURE__ */
|
|
3735
|
-
t.showMuteButton && /* @__PURE__ */
|
|
3715
|
+
(y || C) && /* @__PURE__ */ w(oe, { children: [
|
|
3716
|
+
a && /* @__PURE__ */ w("button", { class: "anam-close-btn", onClick: a, "aria-label": "Close", children: /* @__PURE__ */ w(Sr, {}) }),
|
|
3717
|
+
p && /* @__PURE__ */ w("div", { class: `anam-toast ${d ? "anam-toast-out" : ""}`, children: p }),
|
|
3718
|
+
/* @__PURE__ */ w("div", { class: "anam-control-bar", children: [
|
|
3719
|
+
t.showMuteButton && /* @__PURE__ */ w(
|
|
3736
3720
|
"button",
|
|
3737
3721
|
{
|
|
3738
3722
|
class: `anam-ctl-btn ${e.isMuted.value ? "anam-ctl-btn-muted" : ""}`,
|
|
3739
3723
|
onClick: () => e.toggleMute(),
|
|
3740
3724
|
"aria-label": e.isMuted.value ? "Unmute" : "Mute",
|
|
3741
|
-
children: e.isMuted.value ? /* @__PURE__ */
|
|
3725
|
+
children: e.isMuted.value ? /* @__PURE__ */ w(Ir, {}) : /* @__PURE__ */ w(Cr, {})
|
|
3742
3726
|
}
|
|
3743
3727
|
),
|
|
3744
|
-
t.showTextInput && /* @__PURE__ */
|
|
3745
|
-
/* @__PURE__ */
|
|
3728
|
+
t.showTextInput && /* @__PURE__ */ w(oe, { children: [
|
|
3729
|
+
/* @__PURE__ */ w(
|
|
3746
3730
|
"input",
|
|
3747
3731
|
{
|
|
3748
|
-
ref:
|
|
3732
|
+
ref: c,
|
|
3749
3733
|
type: "text",
|
|
3750
3734
|
class: "anam-ctl-input",
|
|
3751
3735
|
placeholder: t.textContents.placeholder,
|
|
3752
3736
|
value: l,
|
|
3753
|
-
onInput: (H) =>
|
|
3754
|
-
onKeyDown:
|
|
3737
|
+
onInput: (H) => m(H.target.value),
|
|
3738
|
+
onKeyDown: q,
|
|
3755
3739
|
disabled: !y
|
|
3756
3740
|
}
|
|
3757
3741
|
),
|
|
3758
|
-
/* @__PURE__ */
|
|
3742
|
+
/* @__PURE__ */ w(
|
|
3759
3743
|
"button",
|
|
3760
3744
|
{
|
|
3761
3745
|
class: "anam-ctl-btn",
|
|
3762
|
-
onClick:
|
|
3746
|
+
onClick: T,
|
|
3763
3747
|
disabled: !y || !l.trim(),
|
|
3764
3748
|
"aria-label": "Send message",
|
|
3765
|
-
children: /* @__PURE__ */
|
|
3749
|
+
children: /* @__PURE__ */ w(br, {})
|
|
3766
3750
|
}
|
|
3767
3751
|
)
|
|
3768
3752
|
] }),
|
|
3769
|
-
/* @__PURE__ */
|
|
3753
|
+
/* @__PURE__ */ w(
|
|
3770
3754
|
"button",
|
|
3771
3755
|
{
|
|
3772
3756
|
class: "anam-ctl-btn anam-ctl-end",
|
|
3773
|
-
onClick:
|
|
3757
|
+
onClick: O,
|
|
3774
3758
|
"aria-label": "End call",
|
|
3775
|
-
children: /* @__PURE__ */
|
|
3759
|
+
children: /* @__PURE__ */ w(Ar, {})
|
|
3776
3760
|
}
|
|
3777
3761
|
)
|
|
3778
3762
|
] })
|
|
3779
3763
|
] })
|
|
3780
3764
|
] });
|
|
3781
3765
|
}
|
|
3782
|
-
function
|
|
3783
|
-
const e =
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
return b.mode === "orb" && (b.layout = "fixed"), b;
|
|
3797
|
-
}, [
|
|
3798
|
-
t.mode,
|
|
3799
|
-
t.variant,
|
|
3800
|
-
t.layout,
|
|
3801
|
-
t.position,
|
|
3802
|
-
t.placement,
|
|
3803
|
-
t["background-color"],
|
|
3804
|
-
t["text-color"],
|
|
3805
|
-
t["show-transcript"],
|
|
3806
|
-
t["show-text-input"],
|
|
3807
|
-
t["show-mute-button"],
|
|
3808
|
-
t["interaction-mode"],
|
|
3809
|
-
t["start-expanded"],
|
|
3810
|
-
t["text-call-to-action"],
|
|
3811
|
-
t["override-config"],
|
|
3812
|
-
o.serverConfig.value
|
|
3813
|
-
]);
|
|
3814
|
-
St(() => {
|
|
3815
|
-
o.fetchWidgetConfig();
|
|
3816
|
-
}, [t["agent-id"], t["api-base-url"]]);
|
|
3817
|
-
const a = o.avatarThumbnailUrl.value || null, u = c.textContents.callToAction === He.textContents.callToAction && o.personaName.value ? `Talk to ${o.personaName.value}` : c.textContents.callToAction, l = Ie(
|
|
3766
|
+
function Rr(t) {
|
|
3767
|
+
const e = Ze(null), n = Vi(!1);
|
|
3768
|
+
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.");
|
|
3769
|
+
const o = t["session-token"] ? void 0 : t["agent-id"], u = vr(o, t["api-base-url"], t["session-token"]), a = me(
|
|
3770
|
+
() => yr(t),
|
|
3771
|
+
[t.inline, t.layout, t.position, t["ui-mute-button"], t["ui-text-input"], t["ui-captions"]]
|
|
3772
|
+
), c = me(() => {
|
|
3773
|
+
const O = u.serverConfig.value, T = wt(wt({ ...ri }, O ?? {}), a);
|
|
3774
|
+
return T.layout === "orb" && (T.inline = !1), T;
|
|
3775
|
+
}, [u.serverConfig.value, a]);
|
|
3776
|
+
gt(() => {
|
|
3777
|
+
u.fetchWidgetConfig();
|
|
3778
|
+
}, [o, t["api-base-url"], t["session-token"]]);
|
|
3779
|
+
const l = t["avatar-url"] || u.avatarThumbnailUrl.value || null, p = t["agent-name"] || u.personaName.value, _ = c.textContents.callToAction === ri.textContents.callToAction && p ? `Talk to ${p}` : c.textContents.callToAction, d = me(
|
|
3818
3780
|
() => `--anam-background: ${c.styles.backgroundColor}; --anam-text: ${c.styles.textColor};`,
|
|
3819
3781
|
[c.styles.backgroundColor, c.styles.textColor]
|
|
3820
|
-
),
|
|
3821
|
-
if (c.
|
|
3822
|
-
const
|
|
3823
|
-
return Object.entries(
|
|
3824
|
-
}, [c.
|
|
3825
|
-
n.value = !0,
|
|
3826
|
-
e.current &&
|
|
3782
|
+
), S = me(() => {
|
|
3783
|
+
if (c.inline) return "";
|
|
3784
|
+
const O = On(c.position);
|
|
3785
|
+
return Object.entries(O).map(([T, q]) => `${T}: ${q}`).join("; ");
|
|
3786
|
+
}, [c.inline, c.position]), g = [d, S].filter(Boolean).join("; "), y = Ze(!1), b = () => {
|
|
3787
|
+
n.value = !0, y.current = !1, setTimeout(() => {
|
|
3788
|
+
e.current && u.startSession(e.current);
|
|
3827
3789
|
}, 50);
|
|
3828
|
-
},
|
|
3829
|
-
|
|
3830
|
-
},
|
|
3831
|
-
(
|
|
3832
|
-
|
|
3833
|
-
}, [
|
|
3834
|
-
const
|
|
3835
|
-
return
|
|
3836
|
-
/* @__PURE__ */
|
|
3837
|
-
/* @__PURE__ */
|
|
3790
|
+
}, A = async () => {
|
|
3791
|
+
u.connectionStatus.value !== "idle" && await u.stopSession(), y.current = !1, n.value = !1;
|
|
3792
|
+
}, C = c.layout === "orb", I = u.connectionStatus.value;
|
|
3793
|
+
(I === "connecting" || I === "connected") && (y.current = !0), gt(() => {
|
|
3794
|
+
C && n.value && I === "idle" && y.current && (y.current = !1, n.value = !1);
|
|
3795
|
+
}, [I]);
|
|
3796
|
+
const x = C ? n.value : !0;
|
|
3797
|
+
return u.isReady.value ? /* @__PURE__ */ w(oe, { children: [
|
|
3798
|
+
/* @__PURE__ */ w("style", { children: di }),
|
|
3799
|
+
/* @__PURE__ */ w(
|
|
3838
3800
|
"div",
|
|
3839
3801
|
{
|
|
3840
3802
|
class: "anam-widget",
|
|
3841
|
-
"data-
|
|
3803
|
+
"data-inline": c.inline ? "true" : "false",
|
|
3842
3804
|
"data-layout": c.layout,
|
|
3843
|
-
style:
|
|
3805
|
+
style: g,
|
|
3844
3806
|
children: [
|
|
3845
|
-
|
|
3807
|
+
C && !n.value && /* @__PURE__ */ w(
|
|
3846
3808
|
"button",
|
|
3847
3809
|
{
|
|
3848
3810
|
class: "anam-trigger",
|
|
3849
|
-
onClick:
|
|
3850
|
-
"aria-label":
|
|
3851
|
-
children:
|
|
3811
|
+
onClick: b,
|
|
3812
|
+
"aria-label": _,
|
|
3813
|
+
children: l ? /* @__PURE__ */ w("img", { src: l, alt: "Avatar" }) : /* @__PURE__ */ w(Ct, {})
|
|
3852
3814
|
}
|
|
3853
3815
|
),
|
|
3854
|
-
|
|
3855
|
-
|
|
3816
|
+
x && /* @__PURE__ */ w(
|
|
3817
|
+
Tr,
|
|
3856
3818
|
{
|
|
3857
3819
|
config: c,
|
|
3858
|
-
session:
|
|
3820
|
+
session: u,
|
|
3859
3821
|
videoRef: e,
|
|
3860
|
-
avatarSrc:
|
|
3861
|
-
displayCta:
|
|
3862
|
-
onCollapse:
|
|
3822
|
+
avatarSrc: l,
|
|
3823
|
+
displayCta: _,
|
|
3824
|
+
onCollapse: C ? A : null
|
|
3863
3825
|
}
|
|
3864
3826
|
)
|
|
3865
3827
|
]
|
|
3866
3828
|
}
|
|
3867
3829
|
)
|
|
3868
|
-
] }) : /* @__PURE__ */
|
|
3830
|
+
] }) : /* @__PURE__ */ w("style", { children: di });
|
|
3869
3831
|
}
|
|
3870
|
-
const
|
|
3832
|
+
const Nr = [
|
|
3833
|
+
"agent-id",
|
|
3834
|
+
// Persona ID -- required for session streaming + server config fetch
|
|
3835
|
+
"api-base-url",
|
|
3836
|
+
// API URL override (default: https://api.anam.ai)
|
|
3837
|
+
"session-token",
|
|
3838
|
+
// Pre-created session token -- skips /v1/auth/widget call when set
|
|
3839
|
+
"inline",
|
|
3840
|
+
// "true" | "false" -- render inline vs fixed position
|
|
3841
|
+
"layout",
|
|
3842
|
+
// "orb" | "expanded"
|
|
3843
|
+
"position",
|
|
3844
|
+
// "bottom-right" | "bottom-left" | "top-right" | "top-left" | custom
|
|
3845
|
+
"ui-mute-button",
|
|
3846
|
+
// "true" | "false" -- show mute button
|
|
3847
|
+
"ui-text-input",
|
|
3848
|
+
// "true" | "false" -- show text input
|
|
3849
|
+
"ui-captions",
|
|
3850
|
+
// "true" | "false" -- show captions
|
|
3851
|
+
"avatar-url",
|
|
3852
|
+
// Override avatar thumbnail (Lab preview)
|
|
3853
|
+
"agent-name"
|
|
3854
|
+
// Override persona name for CTA (Lab preview)
|
|
3855
|
+
], Or = {
|
|
3871
3856
|
SESSION_STARTED: "anam-agent:session-started",
|
|
3872
3857
|
SESSION_ENDED: "anam-agent:session-ended",
|
|
3873
3858
|
MESSAGE_RECEIVED: "anam-agent:message-received",
|
|
@@ -3878,14 +3863,14 @@ const xr = {
|
|
|
3878
3863
|
MIC_MUTED: "anam-agent:mic-muted",
|
|
3879
3864
|
MIC_UNMUTED: "anam-agent:mic-unmuted"
|
|
3880
3865
|
};
|
|
3881
|
-
function
|
|
3882
|
-
_n(
|
|
3866
|
+
function hi(t = "anam-agent") {
|
|
3867
|
+
_n(Rr, t, [...Nr], {
|
|
3883
3868
|
shadow: !0
|
|
3884
3869
|
});
|
|
3885
3870
|
}
|
|
3886
|
-
typeof window < "u" && typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", () =>
|
|
3871
|
+
typeof window < "u" && typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", () => hi()) : hi());
|
|
3887
3872
|
export {
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3873
|
+
ri as DefaultConfig,
|
|
3874
|
+
Or as WidgetEventNames,
|
|
3875
|
+
hi as registerWidget
|
|
3891
3876
|
};
|