@anam-ai/agent-widget 0.1.0 → 0.1.1
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/README.md +205 -0
- package/dist/index.js +1174 -1109
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
var
|
|
2
|
-
function
|
|
1
|
+
var Ue, k, ei, ti, pe, Dt, ii, ni, ri, Et, lt, ct, ke = {}, oi = [], Ki = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, Je = Array.isArray;
|
|
2
|
+
function ee(t, e) {
|
|
3
3
|
for (var n in e) t[n] = e[n];
|
|
4
4
|
return t;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function mt(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 Se(t, e, n) {
|
|
10
|
+
var o, l, a, u = {};
|
|
11
|
+
for (a in e) a == "key" ? o = e[a] : a == "ref" ? l = e[a] : u[a] = e[a];
|
|
12
|
+
if (arguments.length > 2 && (u.children = arguments.length > 3 ? Ue.call(arguments, 2) : n), typeof t == "function" && t.defaultProps != null) for (a in t.defaultProps) u[a] === void 0 && (u[a] = t.defaultProps[a]);
|
|
13
|
+
return Ne(t, u, o, l, 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 Ne(t, e, n, o, l) {
|
|
16
|
+
var a = { type: t, props: e, key: n, ref: o, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: l ?? ++ei, __i: -1, __u: 0 };
|
|
17
|
+
return l == null && k.vnode != null && k.vnode(a), a;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function fe(t) {
|
|
20
20
|
return t.children;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function we(t, e) {
|
|
23
23
|
this.props = t, this.context = e;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
if (e == null) return t.__ ?
|
|
25
|
+
function Ie(t, e) {
|
|
26
|
+
if (e == null) return t.__ ? Ie(t.__, t.__i + 1) : null;
|
|
27
27
|
for (var n; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) return n.__e;
|
|
28
|
-
return typeof t.type == "function" ?
|
|
28
|
+
return typeof t.type == "function" ? Ie(t) : null;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function si(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 si(t);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
(!t.__d && (t.__d = !0) &&
|
|
40
|
+
function Mt(t) {
|
|
41
|
+
(!t.__d && (t.__d = !0) && pe.push(t) && !He.__r++ || Dt != k.debounceRendering) && ((Dt = k.debounceRendering) || ii)(He);
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
for (var t, e, n, o,
|
|
45
|
-
|
|
43
|
+
function He() {
|
|
44
|
+
for (var t, e, n, o, l, a, u, c = 1; pe.length; ) pe.length > c && pe.sort(ni), t = pe.shift(), c = pe.length, t.__d && (n = void 0, o = void 0, l = (o = (e = t).__v).__e, a = [], u = [], e.__P && ((n = ee({}, o)).__v = o.__v + 1, k.vnode && k.vnode(n), gt(e.__P, n, o, e.__n, e.__P.namespaceURI, 32 & o.__u ? [l] : null, a, l ?? Ie(o), !!(32 & o.__u), u), n.__v = o.__v, n.__.__k[n.__i] = n, ci(a, n, u), o.__e = o.__ = null, n.__e != l && si(n)));
|
|
45
|
+
He.__r = 0;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
var d, S, g, y, C, A, I, b = o && o.__k ||
|
|
49
|
-
for (m =
|
|
47
|
+
function ai(t, e, n, o, l, a, u, c, m, p, _) {
|
|
48
|
+
var d, S, g, y, C, A, I, b = o && o.__k || oi, R = e.length;
|
|
49
|
+
for (m = Ji(n, e, b, m, R), d = 0; d < R; d++) (g = n.__k[d]) != null && (S = g.__i == -1 ? ke : b[g.__i] || ke, g.__i = d, A = gt(t, g, S, l, a, u, c, m, p, _), y = g.__e, g.ref && S.ref != g.ref && (S.ref && vt(S.ref, null, g), _.push(g.ref, g.__c || y, g)), C == null && y != null && (C = y), (I = !!(4 & g.__u)) || S.__k === g.__k ? m = li(g, m, t, I) : typeof g.type == "function" && A !== void 0 ? m = A : y && (m = y.nextSibling), g.__u &= -7);
|
|
50
50
|
return n.__e = C, m;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
var a,
|
|
54
|
-
for (t.__k = new Array(
|
|
55
|
-
if (d) for (a = 0; a < _; a++) (
|
|
52
|
+
function Ji(t, e, n, o, l) {
|
|
53
|
+
var a, u, c, m, p, _ = n.length, d = _, S = 0;
|
|
54
|
+
for (t.__k = new Array(l), a = 0; a < l; a++) (u = e[a]) != null && typeof u != "boolean" && typeof u != "function" ? (typeof u == "string" || typeof u == "number" || typeof u == "bigint" || u.constructor == String ? u = t.__k[a] = Ne(null, u, null, null, null) : Je(u) ? u = t.__k[a] = Ne(fe, { children: u }, null, null, null) : u.constructor === void 0 && u.__b > 0 ? u = t.__k[a] = Ne(u.type, u.props, u.key, u.ref ? u.ref : null, u.__v) : t.__k[a] = u, m = a + S, u.__ = t, u.__b = t.__b + 1, c = null, (p = u.__i = Xi(u, n, m, d)) != -1 && (d--, (c = n[p]) && (c.__u |= 2)), c == null || c.__v == null ? (p == -1 && (l > _ ? S-- : l < _ && S++), typeof u.type != "function" && (u.__u |= 4)) : p != m && (p == m - 1 ? S-- : p == m + 1 ? S++ : (p > m ? S-- : S++, u.__u |= 4))) : t.__k[a] = null;
|
|
55
|
+
if (d) for (a = 0; a < _; a++) (c = n[a]) != null && (2 & c.__u) == 0 && (c.__e == o && (o = Ie(c)), di(c, c));
|
|
56
56
|
return o;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
var
|
|
58
|
+
function li(t, e, n, o) {
|
|
59
|
+
var l, a;
|
|
60
60
|
if (typeof t.type == "function") {
|
|
61
|
-
for (
|
|
61
|
+
for (l = t.__k, a = 0; l && a < l.length; a++) l[a] && (l[a].__ = t, e = li(l[a], e, n, o));
|
|
62
62
|
return e;
|
|
63
63
|
}
|
|
64
|
-
t.__e != e && (o && (e && t.type && !e.parentNode && (e =
|
|
64
|
+
t.__e != e && (o && (e && t.type && !e.parentNode && (e = Ie(t)), n.insertBefore(t.__e, e || null)), e = t.__e);
|
|
65
65
|
do
|
|
66
66
|
e = e && e.nextSibling;
|
|
67
67
|
while (e != null && e.nodeType == 8);
|
|
68
68
|
return e;
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
var
|
|
72
|
-
if (p === null &&
|
|
70
|
+
function Xi(t, e, n, o) {
|
|
71
|
+
var l, a, u, c = t.key, m = t.type, p = e[n], _ = p != null && (2 & p.__u) == 0;
|
|
72
|
+
if (p === null && c == null || _ && c == p.key && m == p.type) return n;
|
|
73
73
|
if (o > (_ ? 1 : 0)) {
|
|
74
|
-
for (
|
|
74
|
+
for (l = n - 1, a = n + 1; l >= 0 || a < e.length; ) if ((p = e[u = l >= 0 ? l-- : a++]) != null && (2 & p.__u) == 0 && c == p.key && m == p.type) return u;
|
|
75
75
|
}
|
|
76
76
|
return -1;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" ||
|
|
78
|
+
function Ut(t, e, n) {
|
|
79
|
+
e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" || Ki.test(e) ? n : n + "px";
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
var a,
|
|
81
|
+
function Pe(t, e, n, o, l) {
|
|
82
|
+
var a, u;
|
|
83
83
|
e: if (e == "style") if (typeof n == "string") t.style.cssText = n;
|
|
84
84
|
else {
|
|
85
|
-
if (typeof o == "string" && (t.style.cssText = o = ""), o) for (e in o) n && e in n ||
|
|
86
|
-
if (n) for (e in n) o && n[e] == o[e] ||
|
|
85
|
+
if (typeof o == "string" && (t.style.cssText = o = ""), o) for (e in o) n && e in n || Ut(t.style, e, "");
|
|
86
|
+
if (n) for (e in n) o && n[e] == o[e] || Ut(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(ri, "$1")), u = e.toLowerCase(), e = u in t || e == "onFocusOut" || e == "onFocusIn" ? u.slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + a] = n, n ? o ? n.u = o.u : (n.u = Et, t.addEventListener(e, a ? ct : lt, a)) : t.removeEventListener(e, a ? ct : lt, a);
|
|
89
89
|
else {
|
|
90
|
-
if (
|
|
90
|
+
if (l == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
91
91
|
else if (e != "width" && e != "height" && e != "href" && e != "list" && e != "form" && e != "tabIndex" && e != "download" && e != "rowSpan" && e != "colSpan" && e != "role" && e != "popover" && e in t) try {
|
|
92
92
|
t[e] = n ?? "";
|
|
93
93
|
break e;
|
|
@@ -96,76 +96,76 @@ function Ge(t, e, n, o, u) {
|
|
|
96
96
|
typeof n == "function" || (n == null || n === !1 && e[4] != "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && n == 1 ? "" : n));
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function Lt(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 = Et++;
|
|
104
104
|
else if (e.t < n.u) return;
|
|
105
105
|
return n(k.event ? k.event(e) : e);
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
-
function
|
|
110
|
-
var _, d, S, g, y, C, A, I, b, R, M, x, Y,
|
|
109
|
+
function gt(t, e, n, o, l, a, u, c, m, p) {
|
|
110
|
+
var _, d, S, g, y, C, A, I, b, R, M, x, Y, te, $, ie, ne, Z = e.type;
|
|
111
111
|
if (e.constructor !== void 0) return null;
|
|
112
|
-
128 & n.__u && (m = !!(32 & n.__u), a = [
|
|
113
|
-
e: if (typeof
|
|
114
|
-
if (I = e.props, b = "prototype" in
|
|
112
|
+
128 & n.__u && (m = !!(32 & n.__u), a = [c = e.__e = n.__e]), (_ = k.__b) && _(e);
|
|
113
|
+
e: if (typeof Z == "function") try {
|
|
114
|
+
if (I = e.props, b = "prototype" in Z && Z.prototype.render, R = (_ = Z.contextType) && o[_.__c], M = _ ? R ? R.props.value : _.__ : o, n.__c ? A = (d = e.__c = n.__c).__ = d.__E : (b ? e.__c = d = new Z(I, M) : (e.__c = d = new we(I, M), d.constructor = Z, d.render = Qi), R && R.sub(d), d.state || (d.state = {}), d.__n = o, S = d.__d = !0, d.__h = [], d._sb = []), b && d.__s == null && (d.__s = d.state), b && Z.getDerivedStateFromProps != null && (d.__s == d.state && (d.__s = ee({}, d.__s)), ee(d.__s, Z.getDerivedStateFromProps(I, d.__s))), g = d.props, y = d.state, d.__v = e, S) b && Z.getDerivedStateFromProps == null && d.componentWillMount != null && d.componentWillMount(), b && d.componentDidMount != null && d.__h.push(d.componentDidMount);
|
|
115
115
|
else {
|
|
116
|
-
if (b &&
|
|
117
|
-
for (e.__v != n.__v && (d.props = I, d.state = d.__s, d.__d = !1), e.__e = n.__e, e.__k = n.__k, e.__k.some(function(
|
|
118
|
-
|
|
116
|
+
if (b && Z.getDerivedStateFromProps == null && I !== g && d.componentWillReceiveProps != null && d.componentWillReceiveProps(I, M), e.__v == n.__v || !d.__e && d.shouldComponentUpdate != null && d.shouldComponentUpdate(I, d.__s, M) === !1) {
|
|
117
|
+
for (e.__v != n.__v && (d.props = I, d.state = d.__s, d.__d = !1), e.__e = n.__e, e.__k = n.__k, e.__k.some(function(oe) {
|
|
118
|
+
oe && (oe.__ = e);
|
|
119
119
|
}), x = 0; x < d._sb.length; x++) d.__h.push(d._sb[x]);
|
|
120
|
-
d._sb = [], d.__h.length &&
|
|
120
|
+
d._sb = [], d.__h.length && u.push(d);
|
|
121
121
|
break e;
|
|
122
122
|
}
|
|
123
123
|
d.componentWillUpdate != null && d.componentWillUpdate(I, d.__s, M), b && d.componentDidUpdate != null && d.__h.push(function() {
|
|
124
124
|
d.componentDidUpdate(g, y, C);
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
if (d.context = M, d.props = I, d.__P = t, d.__e = !1, Y = k.__r,
|
|
127
|
+
if (d.context = M, d.props = I, d.__P = t, d.__e = !1, Y = k.__r, te = 0, b) {
|
|
128
128
|
for (d.state = d.__s, d.__d = !1, Y && Y(e), _ = d.render(d.props, d.state, d.context), $ = 0; $ < d._sb.length; $++) d.__h.push(d._sb[$]);
|
|
129
129
|
d._sb = [];
|
|
130
130
|
} else do
|
|
131
131
|
d.__d = !1, Y && Y(e), _ = d.render(d.props, d.state, d.context), d.state = d.__s;
|
|
132
|
-
while (d.__d && ++
|
|
133
|
-
d.state = d.__s, d.getChildContext != null && (o =
|
|
134
|
-
} catch (
|
|
135
|
-
if (e.__v = null, m || a != null) if (
|
|
136
|
-
for (e.__u |= m ? 160 : 128;
|
|
137
|
-
a[a.indexOf(
|
|
132
|
+
while (d.__d && ++te < 25);
|
|
133
|
+
d.state = d.__s, d.getChildContext != null && (o = ee(ee({}, o), d.getChildContext())), b && !S && d.getSnapshotBeforeUpdate != null && (C = d.getSnapshotBeforeUpdate(g, y)), ie = _, _ != null && _.type === fe && _.key == null && (ie = ui(_.props.children)), c = ai(t, Je(ie) ? ie : [ie], e, n, o, l, a, u, c, m, p), d.base = e.__e, e.__u &= -161, d.__h.length && u.push(d), A && (d.__E = d.__ = null);
|
|
134
|
+
} catch (oe) {
|
|
135
|
+
if (e.__v = null, m || a != null) if (oe.then) {
|
|
136
|
+
for (e.__u |= m ? 160 : 128; c && c.nodeType == 8 && c.nextSibling; ) c = c.nextSibling;
|
|
137
|
+
a[a.indexOf(c)] = null, e.__e = c;
|
|
138
138
|
} else {
|
|
139
|
-
for (
|
|
140
|
-
|
|
139
|
+
for (ne = a.length; ne--; ) mt(a[ne]);
|
|
140
|
+
ut(e);
|
|
141
141
|
}
|
|
142
|
-
else e.__e = n.__e, e.__k = n.__k,
|
|
143
|
-
k.__e(
|
|
142
|
+
else e.__e = n.__e, e.__k = n.__k, oe.then || ut(e);
|
|
143
|
+
k.__e(oe, e, n);
|
|
144
144
|
}
|
|
145
|
-
else a == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) :
|
|
146
|
-
return (_ = k.diffed) && _(e), 128 & e.__u ? void 0 :
|
|
145
|
+
else a == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : c = e.__e = Zi(n.__e, e, n, o, l, a, u, m, p);
|
|
146
|
+
return (_ = k.diffed) && _(e), 128 & e.__u ? void 0 : c;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
t && t.__c && (t.__c.__e = !0), t && t.__k && t.__k.forEach(
|
|
148
|
+
function ut(t) {
|
|
149
|
+
t && t.__c && (t.__c.__e = !0), t && t.__k && t.__k.forEach(ut);
|
|
150
150
|
}
|
|
151
|
-
function
|
|
152
|
-
for (var o = 0; o < n.length; o++)
|
|
153
|
-
k.__c && k.__c(e, t), t.some(function(
|
|
151
|
+
function ci(t, e, n) {
|
|
152
|
+
for (var o = 0; o < n.length; o++) vt(n[o], n[++o], n[++o]);
|
|
153
|
+
k.__c && k.__c(e, t), t.some(function(l) {
|
|
154
154
|
try {
|
|
155
|
-
t =
|
|
156
|
-
a.call(
|
|
155
|
+
t = l.__h, l.__h = [], t.some(function(a) {
|
|
156
|
+
a.call(l);
|
|
157
157
|
});
|
|
158
158
|
} catch (a) {
|
|
159
|
-
k.__e(a,
|
|
159
|
+
k.__e(a, l.__v);
|
|
160
160
|
}
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
-
function
|
|
164
|
-
return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t :
|
|
163
|
+
function ui(t) {
|
|
164
|
+
return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : Je(t) ? t.map(ui) : ee({}, t);
|
|
165
165
|
}
|
|
166
|
-
function
|
|
167
|
-
var p, _, d, S, g, y, C, A = n.props ||
|
|
168
|
-
if (b == "svg" ?
|
|
166
|
+
function Zi(t, e, n, o, l, a, u, c, m) {
|
|
167
|
+
var p, _, d, S, g, y, C, A = n.props || ke, I = e.props, b = e.type;
|
|
168
|
+
if (b == "svg" ? l = "http://www.w3.org/2000/svg" : b == "math" ? l = "http://www.w3.org/1998/Math/MathML" : l || (l = "http://www.w3.org/1999/xhtml"), a != null) {
|
|
169
169
|
for (p = 0; p < a.length; p++) if ((g = a[p]) && "setAttribute" in g == !!b && (b ? g.localName == b : g.nodeType == 3)) {
|
|
170
170
|
t = g, a[p] = null;
|
|
171
171
|
break;
|
|
@@ -173,38 +173,38 @@ function hn(t, e, n, o, u, a, c, l, m) {
|
|
|
173
173
|
}
|
|
174
174
|
if (t == null) {
|
|
175
175
|
if (b == null) return document.createTextNode(I);
|
|
176
|
-
t = document.createElementNS(
|
|
176
|
+
t = document.createElementNS(l, b, I.is && I), c && (k.__m && k.__m(e, a), c = !1), a = null;
|
|
177
177
|
}
|
|
178
|
-
if (b == null) A === I ||
|
|
178
|
+
if (b == null) A === I || c && t.data == I || (t.data = I);
|
|
179
179
|
else {
|
|
180
|
-
if (a = a &&
|
|
180
|
+
if (a = a && Ue.call(t.childNodes), !c && a != null) for (A = {}, p = 0; p < t.attributes.length; p++) A[(g = t.attributes[p]).name] = g.value;
|
|
181
181
|
for (p in A) if (g = A[p], p != "children") {
|
|
182
182
|
if (p == "dangerouslySetInnerHTML") d = g;
|
|
183
183
|
else if (!(p in I)) {
|
|
184
184
|
if (p == "value" && "defaultValue" in I || p == "checked" && "defaultChecked" in I) continue;
|
|
185
|
-
|
|
185
|
+
Pe(t, p, null, g, l);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
for (p in I) g = I[p], p == "children" ? S = g : p == "dangerouslySetInnerHTML" ? _ = g : p == "value" ? y = g : p == "checked" ? C = g :
|
|
189
|
-
if (_)
|
|
190
|
-
else if (d && (t.innerHTML = ""),
|
|
191
|
-
|
|
188
|
+
for (p in I) g = I[p], p == "children" ? S = g : p == "dangerouslySetInnerHTML" ? _ = g : p == "value" ? y = g : p == "checked" ? C = g : c && typeof g != "function" || A[p] === g || Pe(t, p, g, A[p], l);
|
|
189
|
+
if (_) c || d && (_.__html == d.__html || _.__html == t.innerHTML) || (t.innerHTML = _.__html), e.__k = [];
|
|
190
|
+
else if (d && (t.innerHTML = ""), ai(e.type == "template" ? t.content : t, Je(S) ? S : [S], e, n, o, b == "foreignObject" ? "http://www.w3.org/1999/xhtml" : l, a, u, a ? a[0] : n.__k && Ie(n, 0), c, m), a != null) for (p = a.length; p--; ) mt(a[p]);
|
|
191
|
+
c || (p = "value", b == "progress" && y == null ? t.removeAttribute("value") : y != null && (y !== t[p] || b == "progress" && !y || b == "option" && y != A[p]) && Pe(t, p, y, A[p], l), p = "checked", C != null && C != t[p] && Pe(t, p, C, A[p], l));
|
|
192
192
|
}
|
|
193
193
|
return t;
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function vt(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
|
-
k.__e(
|
|
201
|
+
} catch (l) {
|
|
202
|
+
k.__e(l, n);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
function
|
|
206
|
-
var o,
|
|
207
|
-
if (k.unmount && k.unmount(t), (o = t.ref) && (o.current && o.current != t.__e ||
|
|
205
|
+
function di(t, e, n) {
|
|
206
|
+
var o, l;
|
|
207
|
+
if (k.unmount && k.unmount(t), (o = t.ref) && (o.current && o.current != t.__e || vt(o, null, e)), (o = t.__c) != null) {
|
|
208
208
|
if (o.componentWillUnmount) try {
|
|
209
209
|
o.componentWillUnmount();
|
|
210
210
|
} catch (a) {
|
|
@@ -212,289 +212,289 @@ function bi(t, e, n) {
|
|
|
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 (l = 0; l < o.length; l++) o[l] && di(o[l], e, n || typeof t.type != "function");
|
|
216
|
+
n || mt(t.__e), t.__c = t.__ = t.__e = void 0;
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function Qi(t, e, n) {
|
|
219
219
|
return this.constructor(t, n);
|
|
220
220
|
}
|
|
221
|
-
function
|
|
222
|
-
var o,
|
|
223
|
-
e == document && (e = document.documentElement), k.__ && k.__(t, e),
|
|
221
|
+
function Xe(t, e, n) {
|
|
222
|
+
var o, l, a, u;
|
|
223
|
+
e == document && (e = document.documentElement), k.__ && k.__(t, e), l = (o = typeof n == "function") ? null : n && n.__k || e.__k, a = [], u = [], gt(e, t = (!o && n || e).__k = Se(fe, null, [t]), l || ke, ke, e.namespaceURI, !o && n ? [n] : l ? null : e.firstChild ? Ue.call(e.childNodes) : null, a, !o && n ? n : l ? l.__e : e.firstChild, o, u), ci(a, t, u);
|
|
224
224
|
}
|
|
225
|
-
function
|
|
226
|
-
|
|
225
|
+
function hi(t, e) {
|
|
226
|
+
Xe(t, e, hi);
|
|
227
227
|
}
|
|
228
|
-
function
|
|
229
|
-
var o,
|
|
230
|
-
for (a in t.type && t.type.defaultProps && (
|
|
231
|
-
return arguments.length > 2 && (
|
|
228
|
+
function fi(t, e, n) {
|
|
229
|
+
var o, l, a, u, c = ee({}, t.props);
|
|
230
|
+
for (a in t.type && t.type.defaultProps && (u = t.type.defaultProps), e) a == "key" ? o = e[a] : a == "ref" ? l = e[a] : c[a] = e[a] === void 0 && u != null ? u[a] : e[a];
|
|
231
|
+
return arguments.length > 2 && (c.children = arguments.length > 3 ? Ue.call(arguments, 2) : n), Ne(t.type, c, o || t.key, l || t.ref, null);
|
|
232
232
|
}
|
|
233
|
-
|
|
234
|
-
for (var
|
|
235
|
-
if ((a =
|
|
236
|
-
} catch (
|
|
237
|
-
t =
|
|
233
|
+
Ue = oi.slice, k = { __e: function(t, e, n, o) {
|
|
234
|
+
for (var l, a, u; e = e.__; ) if ((l = e.__c) && !l.__) try {
|
|
235
|
+
if ((a = l.constructor) && a.getDerivedStateFromError != null && (l.setState(a.getDerivedStateFromError(t)), u = l.__d), l.componentDidCatch != null && (l.componentDidCatch(t, o || {}), u = l.__d), u) return l.__E = l;
|
|
236
|
+
} catch (c) {
|
|
237
|
+
t = c;
|
|
238
238
|
}
|
|
239
239
|
throw t;
|
|
240
|
-
} },
|
|
240
|
+
} }, ei = 0, ti = function(t) {
|
|
241
241
|
return t != null && t.constructor === void 0;
|
|
242
|
-
},
|
|
242
|
+
}, we.prototype.setState = function(t, e) {
|
|
243
243
|
var n;
|
|
244
|
-
n = this.__s != null && this.__s != this.state ? this.__s : this.__s =
|
|
245
|
-
},
|
|
246
|
-
this.__v && (this.__e = !0, t && this.__h.push(t),
|
|
247
|
-
},
|
|
244
|
+
n = this.__s != null && this.__s != this.state ? this.__s : this.__s = ee({}, this.state), typeof t == "function" && (t = t(ee({}, n), this.props)), t && ee(n, t), t != null && this.__v && (e && this._sb.push(e), Mt(this));
|
|
245
|
+
}, we.prototype.forceUpdate = function(t) {
|
|
246
|
+
this.__v && (this.__e = !0, t && this.__h.push(t), Mt(this));
|
|
247
|
+
}, we.prototype.render = fe, pe = [], ii = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, ni = function(t, e) {
|
|
248
248
|
return t.__v.__b - e.__v.__b;
|
|
249
|
-
},
|
|
250
|
-
function
|
|
251
|
-
return
|
|
249
|
+
}, He.__r = 0, ri = /(PointerCapture)$|Capture$/i, Et = 0, lt = Lt(!1), ct = Lt(!0);
|
|
250
|
+
function We() {
|
|
251
|
+
return We = 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
|
+
}, We.apply(this, arguments);
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function pi(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
|
|
264
|
-
}
|
|
265
|
-
var
|
|
266
|
-
function
|
|
267
|
-
function
|
|
268
|
-
var a,
|
|
269
|
-
return
|
|
270
|
-
}
|
|
271
|
-
return (
|
|
272
|
-
|
|
273
|
-
},
|
|
274
|
-
Object.defineProperty(
|
|
261
|
+
var n, o, l = {}, a = Object.keys(t);
|
|
262
|
+
for (o = 0; o < a.length; o++) e.indexOf(n = a[o]) >= 0 || (l[n] = t[n]);
|
|
263
|
+
return l;
|
|
264
|
+
}
|
|
265
|
+
var en = ["context", "children"], tn = ["useFragment"];
|
|
266
|
+
function nn(t, e, n, o) {
|
|
267
|
+
function l() {
|
|
268
|
+
var a, u = Reflect.construct(HTMLElement, [], l);
|
|
269
|
+
return u._vdomComponent = t, o && o.shadow ? (u._root = u.attachShadow({ mode: o.mode || "open", serializable: (a = o.serializable) != null && a }), o.adoptedStyleSheets && (u._root.adoptedStyleSheets = o.adoptedStyleSheets)) : u._root = u, u;
|
|
270
|
+
}
|
|
271
|
+
return (l.prototype = Object.create(HTMLElement.prototype)).constructor = l, l.prototype.connectedCallback = function() {
|
|
272
|
+
on.call(this, o);
|
|
273
|
+
}, l.prototype.attributeChangedCallback = sn, l.prototype.disconnectedCallback = an, n = n || t.observedAttributes || Object.keys(t.propTypes || {}), l.observedAttributes = n, t.formAssociated && (l.formAssociated = !0), n.forEach(function(a) {
|
|
274
|
+
Object.defineProperty(l.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
|
|
279
|
-
|
|
276
|
+
}, set: function(u) {
|
|
277
|
+
this._vdom ? this.attributeChangedCallback(a, null, u) : (this._props || (this._props = {}), this._props[a] = u);
|
|
278
|
+
var c = typeof u;
|
|
279
|
+
u != null && c !== "string" && c !== "boolean" && c !== "number" || this.setAttribute(a, u);
|
|
280
280
|
} });
|
|
281
|
-
}), customElements.define(e || t.tagName || t.displayName || t.name,
|
|
281
|
+
}), customElements.define(e || t.tagName || t.displayName || t.name, l), l;
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function rn(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 = pi(t, en);
|
|
288
|
+
return fi(e, n);
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function on(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 = Se(rn, We({}, this._props, { context: e.detail.context }), Ei(this, this._vdomComponent, t)), (this.hasAttribute("hydrate") ? hi : Xe)(this._vdom, this._root);
|
|
293
293
|
}
|
|
294
|
-
function
|
|
294
|
+
function _i(t) {
|
|
295
295
|
return t.replace(/-(\w)/g, function(e, n) {
|
|
296
296
|
return n ? n.toUpperCase() : "";
|
|
297
297
|
});
|
|
298
298
|
}
|
|
299
|
-
function
|
|
299
|
+
function sn(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[_i(t)] = n, this._vdom = fi(this._vdom, o), Xe(this._vdom, this._root);
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
|
-
function
|
|
306
|
-
|
|
305
|
+
function an() {
|
|
306
|
+
Xe(this._vdom = null, this._root);
|
|
307
307
|
}
|
|
308
|
-
function
|
|
309
|
-
var n = this, o = t.useFragment,
|
|
310
|
-
return
|
|
311
|
-
a ? (n.ref = a, n._listener || (n._listener = function(
|
|
312
|
-
|
|
308
|
+
function Bt(t, e) {
|
|
309
|
+
var n = this, o = t.useFragment, l = pi(t, tn);
|
|
310
|
+
return Se(o ? fe : "slot", We({}, l, { ref: function(a) {
|
|
311
|
+
a ? (n.ref = a, n._listener || (n._listener = function(u) {
|
|
312
|
+
u.stopPropagation(), u.detail.context = e;
|
|
313
313
|
}, a.addEventListener("_preact", n._listener))) : n.ref.removeEventListener("_preact", n._listener);
|
|
314
314
|
} }));
|
|
315
315
|
}
|
|
316
|
-
function
|
|
316
|
+
function Ei(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 =
|
|
321
|
-
for (a =
|
|
322
|
-
var m =
|
|
323
|
-
p ?
|
|
319
|
+
var o = [], l = {}, a = 0, u = t.attributes, c = t.childNodes;
|
|
320
|
+
for (a = u.length; a--; ) u[a].name !== "slot" && (l[u[a].name] = u[a].value, l[_i(u[a].name)] = u[a].value);
|
|
321
|
+
for (a = c.length; a--; ) {
|
|
322
|
+
var m = Ei(c[a], null, n), p = c[a].slot;
|
|
323
|
+
p ? l[p] = Se(Bt, { 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 ? Se(Bt, { useFragment: !_ }, o) : o;
|
|
326
|
+
return !_ && e && (t.innerHTML = ""), Se(e || t.nodeName.toLowerCase(), l, d);
|
|
327
327
|
}
|
|
328
|
-
var
|
|
329
|
-
function w(t, e, n, o,
|
|
328
|
+
var ln = 0;
|
|
329
|
+
function w(t, e, n, o, l, a) {
|
|
330
330
|
e || (e = {});
|
|
331
|
-
var
|
|
332
|
-
if ("ref" in m) for (
|
|
333
|
-
var p = { type: t, props: m, key: n, ref:
|
|
334
|
-
if (typeof t == "function" && (
|
|
331
|
+
var u, c, m = e;
|
|
332
|
+
if ("ref" in m) for (c in m = {}, e) c == "ref" ? u = e[c] : m[c] = e[c];
|
|
333
|
+
var p = { type: t, props: m, key: n, ref: u, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --ln, __i: -1, __u: 0, __source: l, __self: a };
|
|
334
|
+
if (typeof t == "function" && (u = t.defaultProps)) for (c in u) m[c] === void 0 && (m[c] = u[c]);
|
|
335
335
|
return k.vnode && k.vnode(p), p;
|
|
336
336
|
}
|
|
337
|
-
var
|
|
338
|
-
function
|
|
339
|
-
F.__h && F.__h(P, t,
|
|
337
|
+
var De, P, it, Pt, Me = 0, mi = [], F = k, Ft = F.__b, $t = F.__r, Vt = F.diffed, Gt = F.__c, jt = F.unmount, Ht = F.__;
|
|
338
|
+
function yt(t, e) {
|
|
339
|
+
F.__h && F.__h(P, t, Me || e), Me = 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
|
|
343
|
+
function Ve(t) {
|
|
344
|
+
return Me = 1, cn(vi, t);
|
|
345
345
|
}
|
|
346
|
-
function
|
|
347
|
-
var o =
|
|
348
|
-
if (o.t = t, !o.__c && (o.__ = [
|
|
349
|
-
var m = o.__N ? o.__N[0] : o.__[0], p = o.t(m,
|
|
346
|
+
function cn(t, e, n) {
|
|
347
|
+
var o = yt(De++, 2);
|
|
348
|
+
if (o.t = t, !o.__c && (o.__ = [vi(void 0, e), function(c) {
|
|
349
|
+
var m = o.__N ? o.__N[0] : o.__[0], p = o.t(m, c);
|
|
350
350
|
m !== p && (o.__N = [p, o.__[1]], o.__c.setState({}));
|
|
351
351
|
}], o.__c = P, !P.__f)) {
|
|
352
|
-
var
|
|
352
|
+
var l = function(c, 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,
|
|
360
|
-
var d = o.__c.props !==
|
|
359
|
+
})) return !a || a.call(this, c, m, p);
|
|
360
|
+
var d = o.__c.props !== c;
|
|
361
361
|
return _.forEach(function(S) {
|
|
362
362
|
if (S.__N) {
|
|
363
363
|
var g = S.__[0];
|
|
364
364
|
S.__ = S.__N, S.__N = void 0, g !== S.__[0] && (d = !0);
|
|
365
365
|
}
|
|
366
|
-
}), a && a.call(this,
|
|
366
|
+
}), a && a.call(this, c, m, p) || d;
|
|
367
367
|
};
|
|
368
368
|
P.__f = !0;
|
|
369
|
-
var a = P.shouldComponentUpdate,
|
|
370
|
-
P.componentWillUpdate = function(
|
|
369
|
+
var a = P.shouldComponentUpdate, u = P.componentWillUpdate;
|
|
370
|
+
P.componentWillUpdate = function(c, m, p) {
|
|
371
371
|
if (this.__e) {
|
|
372
372
|
var _ = a;
|
|
373
|
-
a = void 0,
|
|
373
|
+
a = void 0, l(c, m, p), a = _;
|
|
374
374
|
}
|
|
375
|
-
|
|
376
|
-
}, P.shouldComponentUpdate =
|
|
375
|
+
u && u.call(this, c, m, p);
|
|
376
|
+
}, P.shouldComponentUpdate = l;
|
|
377
377
|
}
|
|
378
378
|
return o.__N || o.__;
|
|
379
379
|
}
|
|
380
|
-
function
|
|
381
|
-
var n =
|
|
382
|
-
!F.__s &&
|
|
380
|
+
function Ge(t, e) {
|
|
381
|
+
var n = yt(De++, 3);
|
|
382
|
+
!F.__s && gi(n.__H, e) && (n.__ = t, n.u = e, P.__H.__h.push(n));
|
|
383
383
|
}
|
|
384
|
-
function
|
|
385
|
-
return
|
|
384
|
+
function ze(t) {
|
|
385
|
+
return Me = 5, Ce(function() {
|
|
386
386
|
return { current: t };
|
|
387
387
|
}, []);
|
|
388
388
|
}
|
|
389
|
-
function
|
|
390
|
-
var n =
|
|
391
|
-
return
|
|
389
|
+
function Ce(t, e) {
|
|
390
|
+
var n = yt(De++, 7);
|
|
391
|
+
return gi(n.__H, e) && (n.__ = t(), n.__H = e, n.__h = t), n.__;
|
|
392
392
|
}
|
|
393
|
-
function
|
|
394
|
-
return
|
|
393
|
+
function nt(t, e) {
|
|
394
|
+
return Me = 8, Ce(function() {
|
|
395
395
|
return t;
|
|
396
396
|
}, e);
|
|
397
397
|
}
|
|
398
|
-
function
|
|
399
|
-
for (var t; t =
|
|
400
|
-
t.__H.__h.forEach(
|
|
398
|
+
function un() {
|
|
399
|
+
for (var t; t = mi.shift(); ) if (t.__P && t.__H) try {
|
|
400
|
+
t.__H.__h.forEach(je), t.__H.__h.forEach(dt), t.__H.__h = [];
|
|
401
401
|
} catch (e) {
|
|
402
402
|
t.__H.__h = [], F.__e(e, t.__v);
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
405
|
F.__b = function(t) {
|
|
406
|
-
P = null,
|
|
406
|
+
P = null, Ft && Ft(t);
|
|
407
407
|
}, F.__ = function(t, e) {
|
|
408
|
-
t && e.__k && e.__k.__m && (t.__m = e.__k.__m),
|
|
408
|
+
t && e.__k && e.__k.__m && (t.__m = e.__k.__m), Ht && Ht(t, e);
|
|
409
409
|
}, F.__r = function(t) {
|
|
410
|
-
|
|
410
|
+
$t && $t(t), De = 0;
|
|
411
411
|
var e = (P = t.__c).__H;
|
|
412
|
-
e && (
|
|
412
|
+
e && (it === P ? (e.__h = [], P.__h = [], e.__.forEach(function(n) {
|
|
413
413
|
n.__N && (n.__ = n.__N), n.u = n.__N = void 0;
|
|
414
|
-
})) : (e.__h.forEach(
|
|
414
|
+
})) : (e.__h.forEach(je), e.__h.forEach(dt), e.__h = [], De = 0)), it = P;
|
|
415
415
|
}, F.diffed = function(t) {
|
|
416
|
-
|
|
416
|
+
Vt && Vt(t);
|
|
417
417
|
var e = t.__c;
|
|
418
|
-
e && e.__H && (e.__H.__h.length && (
|
|
418
|
+
e && e.__H && (e.__H.__h.length && (mi.push(e) !== 1 && Pt === F.requestAnimationFrame || ((Pt = F.requestAnimationFrame) || dn)(un)), e.__H.__.forEach(function(n) {
|
|
419
419
|
n.u && (n.__H = n.u), n.u = void 0;
|
|
420
|
-
})),
|
|
420
|
+
})), it = P = null;
|
|
421
421
|
}, F.__c = function(t, e) {
|
|
422
422
|
e.some(function(n) {
|
|
423
423
|
try {
|
|
424
|
-
n.__h.forEach(
|
|
425
|
-
return !o.__ ||
|
|
424
|
+
n.__h.forEach(je), n.__h = n.__h.filter(function(o) {
|
|
425
|
+
return !o.__ || dt(o);
|
|
426
426
|
});
|
|
427
427
|
} catch (o) {
|
|
428
|
-
e.some(function(
|
|
429
|
-
|
|
428
|
+
e.some(function(l) {
|
|
429
|
+
l.__h && (l.__h = []);
|
|
430
430
|
}), e = [], F.__e(o, n.__v);
|
|
431
431
|
}
|
|
432
|
-
}),
|
|
432
|
+
}), Gt && Gt(t, e);
|
|
433
433
|
}, F.unmount = function(t) {
|
|
434
|
-
|
|
434
|
+
jt && jt(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
|
+
je(o);
|
|
439
|
+
} catch (l) {
|
|
440
|
+
e = l;
|
|
441
441
|
}
|
|
442
442
|
}), n.__H = void 0, e && F.__e(e, n.__v));
|
|
443
443
|
};
|
|
444
|
-
var
|
|
445
|
-
function
|
|
444
|
+
var Wt = typeof requestAnimationFrame == "function";
|
|
445
|
+
function dn(t) {
|
|
446
446
|
var e, n = function() {
|
|
447
|
-
clearTimeout(o),
|
|
447
|
+
clearTimeout(o), Wt && cancelAnimationFrame(e), setTimeout(t);
|
|
448
448
|
}, o = setTimeout(n, 35);
|
|
449
|
-
|
|
449
|
+
Wt && (e = requestAnimationFrame(n));
|
|
450
450
|
}
|
|
451
|
-
function
|
|
451
|
+
function je(t) {
|
|
452
452
|
var e = P, n = t.__c;
|
|
453
453
|
typeof n == "function" && (t.__c = void 0, n()), P = e;
|
|
454
454
|
}
|
|
455
|
-
function
|
|
455
|
+
function dt(t) {
|
|
456
456
|
var e = P;
|
|
457
457
|
t.__c = t.__(), P = e;
|
|
458
458
|
}
|
|
459
|
-
function
|
|
459
|
+
function gi(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 vi(t, e) {
|
|
465
465
|
return typeof e == "function" ? e(t) : e;
|
|
466
466
|
}
|
|
467
|
-
var
|
|
468
|
-
function
|
|
469
|
-
if (
|
|
470
|
-
|
|
467
|
+
var hn = /* @__PURE__ */ Symbol.for("preact-signals");
|
|
468
|
+
function Ze() {
|
|
469
|
+
if (de > 1)
|
|
470
|
+
de--;
|
|
471
471
|
else {
|
|
472
|
-
for (var t, e = !1;
|
|
473
|
-
var n =
|
|
474
|
-
for (
|
|
472
|
+
for (var t, e = !1; xe !== void 0; ) {
|
|
473
|
+
var n = xe;
|
|
474
|
+
for (xe = void 0, ht++; 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) && wi(n)) try {
|
|
477
477
|
n.c();
|
|
478
|
-
} catch (
|
|
479
|
-
e || (t =
|
|
478
|
+
} catch (l) {
|
|
479
|
+
e || (t = l, e = !0);
|
|
480
480
|
}
|
|
481
481
|
n = o;
|
|
482
482
|
}
|
|
483
483
|
}
|
|
484
|
-
if (
|
|
484
|
+
if (ht = 0, de--, e) throw t;
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
|
-
function
|
|
488
|
-
if (
|
|
489
|
-
|
|
487
|
+
function fn(t) {
|
|
488
|
+
if (de > 0) return t();
|
|
489
|
+
de++;
|
|
490
490
|
try {
|
|
491
491
|
return t();
|
|
492
492
|
} finally {
|
|
493
|
-
|
|
493
|
+
Ze();
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
496
|
var O = void 0;
|
|
497
|
-
function
|
|
497
|
+
function yi(t) {
|
|
498
498
|
var e = O;
|
|
499
499
|
O = void 0;
|
|
500
500
|
try {
|
|
@@ -503,8 +503,8 @@ function Mi(t) {
|
|
|
503
503
|
O = e;
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
|
-
var
|
|
507
|
-
function
|
|
506
|
+
var xe = void 0, de = 0, ht = 0, qe = 0;
|
|
507
|
+
function Si(t) {
|
|
508
508
|
if (O !== void 0) {
|
|
509
509
|
var e = t.n;
|
|
510
510
|
if (e === void 0 || e.t !== O)
|
|
@@ -516,13 +516,13 @@ function Ui(t) {
|
|
|
516
516
|
function H(t, e) {
|
|
517
517
|
this.v = t, this.i = 0, this.n = void 0, this.t = void 0, this.W = e?.watched, this.Z = e?.unwatched, this.name = e?.name;
|
|
518
518
|
}
|
|
519
|
-
H.prototype.brand =
|
|
519
|
+
H.prototype.brand = hn;
|
|
520
520
|
H.prototype.h = function() {
|
|
521
521
|
return !0;
|
|
522
522
|
};
|
|
523
523
|
H.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 : yi(function() {
|
|
526
526
|
var o;
|
|
527
527
|
(o = e.W) == null || o.call(e);
|
|
528
528
|
}));
|
|
@@ -531,15 +531,15 @@ H.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 && yi(function() {
|
|
535
|
+
var l;
|
|
536
|
+
(l = e.Z) == null || l.call(e);
|
|
537
537
|
}));
|
|
538
538
|
}
|
|
539
539
|
};
|
|
540
540
|
H.prototype.subscribe = function(t) {
|
|
541
541
|
var e = this;
|
|
542
|
-
return
|
|
542
|
+
return Le(function() {
|
|
543
543
|
var n = e.value, o = O;
|
|
544
544
|
O = void 0;
|
|
545
545
|
try {
|
|
@@ -568,27 +568,27 @@ H.prototype.peek = function() {
|
|
|
568
568
|
}
|
|
569
569
|
};
|
|
570
570
|
Object.defineProperty(H.prototype, "value", { get: function() {
|
|
571
|
-
var t =
|
|
571
|
+
var t = Si(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 (ht > 100) throw new Error("Cycle detected");
|
|
576
|
+
this.v = t, this.i++, qe++, de++;
|
|
577
577
|
try {
|
|
578
578
|
for (var e = this.t; e !== void 0; e = e.x) e.t.N();
|
|
579
579
|
} finally {
|
|
580
|
-
|
|
580
|
+
Ze();
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
583
|
} });
|
|
584
|
-
function
|
|
584
|
+
function z(t, e) {
|
|
585
585
|
return new H(t, e);
|
|
586
586
|
}
|
|
587
|
-
function
|
|
587
|
+
function wi(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 Ci(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,87 +597,87 @@ function Bi(t) {
|
|
|
597
597
|
}
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
|
-
function
|
|
600
|
+
function Ii(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
|
-
H.call(this, void 0), this.x = t, this.s = void 0, this.g =
|
|
607
|
+
function Ee(t, e) {
|
|
608
|
+
H.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
|
+
Ee.prototype = new H();
|
|
611
|
+
Ee.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 && !wi(this))
|
|
615
615
|
return this.f &= -2, !0;
|
|
616
616
|
var t = O;
|
|
617
617
|
try {
|
|
618
|
-
|
|
618
|
+
Ci(this), O = this;
|
|
619
619
|
var e = this.x();
|
|
620
620
|
(16 & this.f || this.v !== e || this.i === 0) && (this.v = e, this.f &= -17, this.i++);
|
|
621
621
|
} catch (n) {
|
|
622
622
|
this.v = n, this.f |= 16, this.i++;
|
|
623
623
|
}
|
|
624
|
-
return O = t,
|
|
624
|
+
return O = t, Ii(this), this.f &= -2, !0;
|
|
625
625
|
};
|
|
626
|
-
|
|
626
|
+
Ee.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
|
H.prototype.S.call(this, t);
|
|
632
632
|
};
|
|
633
|
-
|
|
633
|
+
Ee.prototype.U = function(t) {
|
|
634
634
|
if (this.t !== void 0 && (H.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
|
+
Ee.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(Ee.prototype, "value", { get: function() {
|
|
646
646
|
if (1 & this.f) throw new Error("Cycle detected");
|
|
647
|
-
var t =
|
|
647
|
+
var t = Si(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
|
-
function
|
|
652
|
-
return new
|
|
651
|
+
function zt(t, e) {
|
|
652
|
+
return new Ee(t, e);
|
|
653
653
|
}
|
|
654
|
-
function
|
|
654
|
+
function bi(t) {
|
|
655
655
|
var e = t.u;
|
|
656
656
|
if (t.u = void 0, typeof e == "function") {
|
|
657
|
-
|
|
657
|
+
de++;
|
|
658
658
|
var n = O;
|
|
659
659
|
O = 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, St(t), o;
|
|
664
664
|
} finally {
|
|
665
|
-
O = n,
|
|
665
|
+
O = n, Ze();
|
|
666
666
|
}
|
|
667
667
|
}
|
|
668
668
|
}
|
|
669
|
-
function
|
|
669
|
+
function St(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, bi(t);
|
|
672
672
|
}
|
|
673
|
-
function
|
|
673
|
+
function pn(t) {
|
|
674
674
|
if (O !== this) throw new Error("Out-of-order effect");
|
|
675
|
-
|
|
675
|
+
Ii(this), O = t, this.f &= -2, 8 & this.f && St(this), Ze();
|
|
676
676
|
}
|
|
677
|
-
function
|
|
677
|
+
function be(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;
|
|
679
679
|
}
|
|
680
|
-
|
|
680
|
+
be.prototype.c = function() {
|
|
681
681
|
var t = this.S();
|
|
682
682
|
try {
|
|
683
683
|
if (8 & this.f || this.x === void 0) return;
|
|
@@ -687,187 +687,187 @@ Ae.prototype.c = function() {
|
|
|
687
687
|
t();
|
|
688
688
|
}
|
|
689
689
|
};
|
|
690
|
-
|
|
690
|
+
be.prototype.S = function() {
|
|
691
691
|
if (1 & this.f) throw new Error("Cycle detected");
|
|
692
|
-
this.f |= 1, this.f &= -9,
|
|
692
|
+
this.f |= 1, this.f &= -9, bi(this), Ci(this), de++;
|
|
693
693
|
var t = O;
|
|
694
|
-
return O = this,
|
|
694
|
+
return O = this, pn.bind(this, t);
|
|
695
695
|
};
|
|
696
|
-
|
|
697
|
-
2 & this.f || (this.f |= 2, this.o =
|
|
696
|
+
be.prototype.N = function() {
|
|
697
|
+
2 & this.f || (this.f |= 2, this.o = xe, xe = this);
|
|
698
698
|
};
|
|
699
|
-
|
|
700
|
-
this.f |= 8, 1 & this.f ||
|
|
699
|
+
be.prototype.d = function() {
|
|
700
|
+
this.f |= 8, 1 & this.f || St(this);
|
|
701
701
|
};
|
|
702
|
-
|
|
702
|
+
be.prototype.dispose = function() {
|
|
703
703
|
this.d();
|
|
704
704
|
};
|
|
705
|
-
function
|
|
706
|
-
var n = new
|
|
705
|
+
function Le(t, e) {
|
|
706
|
+
var n = new be(t, e);
|
|
707
707
|
try {
|
|
708
708
|
n.c();
|
|
709
|
-
} catch (
|
|
710
|
-
throw n.d(),
|
|
709
|
+
} catch (l) {
|
|
710
|
+
throw n.d(), l;
|
|
711
711
|
}
|
|
712
712
|
var o = n.d.bind(n);
|
|
713
713
|
return o[Symbol.dispose] = o, o;
|
|
714
714
|
}
|
|
715
|
-
var
|
|
716
|
-
|
|
717
|
-
|
|
715
|
+
var Ai, rt, _n = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, Ti = [];
|
|
716
|
+
Le(function() {
|
|
717
|
+
Ai = this.N;
|
|
718
718
|
})();
|
|
719
|
-
function
|
|
719
|
+
function Ae(t, e) {
|
|
720
720
|
k[t] = e.bind(null, k[t] || function() {
|
|
721
721
|
});
|
|
722
722
|
}
|
|
723
|
-
function
|
|
724
|
-
|
|
723
|
+
function Ye(t) {
|
|
724
|
+
rt && rt(), rt = t && t.S();
|
|
725
725
|
}
|
|
726
|
-
function
|
|
727
|
-
var e = this, n = t.data, o =
|
|
726
|
+
function Ri(t) {
|
|
727
|
+
var e = this, n = t.data, o = Ni(n);
|
|
728
728
|
o.value = n;
|
|
729
|
-
var
|
|
730
|
-
for (var
|
|
729
|
+
var l = Ce(function() {
|
|
730
|
+
for (var c = e, m = e.__v; m = m.__; ) if (m.__c) {
|
|
731
731
|
m.__c.__$f |= 4;
|
|
732
732
|
break;
|
|
733
733
|
}
|
|
734
|
-
var p =
|
|
734
|
+
var p = zt(function() {
|
|
735
735
|
var g = o.value.value;
|
|
736
736
|
return g === 0 ? 0 : g === !0 ? "" : g || "";
|
|
737
|
-
}), _ =
|
|
738
|
-
return !Array.isArray(p.value) && !
|
|
739
|
-
}), d =
|
|
740
|
-
if (this.N =
|
|
737
|
+
}), _ = zt(function() {
|
|
738
|
+
return !Array.isArray(p.value) && !ti(p.value);
|
|
739
|
+
}), d = Le(function() {
|
|
740
|
+
if (this.N = xi, _.value) {
|
|
741
741
|
var g = p.value;
|
|
742
|
-
|
|
742
|
+
c.__v && c.__v.__e && c.__v.__e.nodeType === 3 && (c.__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 = l[0], u = l[1];
|
|
749
|
+
return a.value ? u.peek() : u.value;
|
|
750
750
|
}
|
|
751
|
-
|
|
752
|
-
Object.defineProperties(H.prototype, { constructor: { configurable: !0, value: void 0 }, type: { configurable: !0, value:
|
|
751
|
+
Ri.displayName = "ReactiveTextNode";
|
|
752
|
+
Object.defineProperties(H.prototype, { constructor: { configurable: !0, value: void 0 }, type: { configurable: !0, value: Ri }, props: { configurable: !0, get: function() {
|
|
753
753
|
return { data: this };
|
|
754
754
|
} }, __b: { configurable: !0, value: 1 } });
|
|
755
|
-
|
|
755
|
+
Ae("__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 H && (n || (e.__np = n = {}), n[
|
|
758
|
+
for (var l in o) if (l !== "children") {
|
|
759
|
+
var a = o[l];
|
|
760
|
+
a instanceof H && (n || (e.__np = n = {}), n[l] = a, o[l] = a.peek());
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
763
|
t(e);
|
|
764
764
|
});
|
|
765
|
-
|
|
766
|
-
if (e.type !==
|
|
767
|
-
|
|
765
|
+
Ae("__r", function(t, e) {
|
|
766
|
+
if (e.type !== fe) {
|
|
767
|
+
Ye();
|
|
768
768
|
var n, o = e.__c;
|
|
769
|
-
o && (o.__$f &= -2, (n = o.__$u) === void 0 && (o.__$u = n = (function(
|
|
770
|
-
var c;
|
|
771
|
-
return $e(function() {
|
|
772
|
-
c = this;
|
|
773
|
-
}, { name: a }), c.c = u, c;
|
|
774
|
-
})(function() {
|
|
769
|
+
o && (o.__$f &= -2, (n = o.__$u) === void 0 && (o.__$u = n = (function(l, a) {
|
|
775
770
|
var u;
|
|
776
|
-
|
|
777
|
-
|
|
771
|
+
return Le(function() {
|
|
772
|
+
u = this;
|
|
773
|
+
}, { name: a }), u.c = l, u;
|
|
774
|
+
})(function() {
|
|
775
|
+
var l;
|
|
776
|
+
_n && ((l = n.y) == null || l.call(n)), o.__$f |= 1, o.setState({});
|
|
777
|
+
}, typeof e.type == "function" ? e.type.displayName || e.type.name : ""))), Ye(n);
|
|
778
778
|
}
|
|
779
779
|
t(e);
|
|
780
780
|
});
|
|
781
|
-
|
|
782
|
-
|
|
781
|
+
Ae("__e", function(t, e, n, o) {
|
|
782
|
+
Ye(), t(e, n, o);
|
|
783
783
|
});
|
|
784
|
-
|
|
785
|
-
|
|
784
|
+
Ae("diffed", function(t, e) {
|
|
785
|
+
Ye();
|
|
786
786
|
var n;
|
|
787
787
|
if (typeof e.type == "string" && (n = e.__e)) {
|
|
788
|
-
var o = e.__np,
|
|
788
|
+
var o = e.__np, l = e.props;
|
|
789
789
|
if (o) {
|
|
790
790
|
var a = n.U;
|
|
791
|
-
if (a) for (var
|
|
792
|
-
var
|
|
793
|
-
|
|
791
|
+
if (a) for (var u in a) {
|
|
792
|
+
var c = a[u];
|
|
793
|
+
c !== void 0 && !(u in o) && (c.d(), a[u] = void 0);
|
|
794
794
|
}
|
|
795
795
|
else
|
|
796
796
|
a = {}, n.U = a;
|
|
797
797
|
for (var m in o) {
|
|
798
798
|
var p = a[m], _ = o[m];
|
|
799
|
-
p === void 0 ? (p =
|
|
799
|
+
p === void 0 ? (p = En(n, m, _, l), a[m] = p) : p.o(_, l);
|
|
800
800
|
}
|
|
801
801
|
}
|
|
802
802
|
}
|
|
803
803
|
t(e);
|
|
804
804
|
});
|
|
805
|
-
function
|
|
806
|
-
var
|
|
807
|
-
return { o: function(
|
|
808
|
-
a.value =
|
|
809
|
-
}, d:
|
|
810
|
-
this.N =
|
|
811
|
-
var
|
|
812
|
-
o[e] !==
|
|
805
|
+
function En(t, e, n, o) {
|
|
806
|
+
var l = e in t && t.ownerSVGElement === void 0, a = z(n);
|
|
807
|
+
return { o: function(u, c) {
|
|
808
|
+
a.value = u, o = c;
|
|
809
|
+
}, d: Le(function() {
|
|
810
|
+
this.N = xi;
|
|
811
|
+
var u = a.value.value;
|
|
812
|
+
o[e] !== u && (o[e] = u, l ? t[e] = u : u != null && (u !== !1 || e[4] === "-") ? t.setAttribute(e, u) : t.removeAttribute(e));
|
|
813
813
|
}) };
|
|
814
814
|
}
|
|
815
|
-
|
|
815
|
+
Ae("unmount", function(t, e) {
|
|
816
816
|
if (typeof e.type == "string") {
|
|
817
817
|
var n = e.__e;
|
|
818
818
|
if (n) {
|
|
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 l in o) {
|
|
823
|
+
var a = o[l];
|
|
824
824
|
a && a.d();
|
|
825
825
|
}
|
|
826
826
|
}
|
|
827
827
|
}
|
|
828
828
|
} else {
|
|
829
|
-
var
|
|
830
|
-
if (
|
|
831
|
-
var
|
|
832
|
-
|
|
829
|
+
var u = e.__c;
|
|
830
|
+
if (u) {
|
|
831
|
+
var c = u.__$u;
|
|
832
|
+
c && (u.__$u = void 0, c.d());
|
|
833
833
|
}
|
|
834
834
|
}
|
|
835
835
|
t(e);
|
|
836
836
|
});
|
|
837
|
-
|
|
837
|
+
Ae("__h", function(t, e, n, o) {
|
|
838
838
|
(o < 3 || o === 9) && (e.__$f |= 2), t(e, n, o);
|
|
839
839
|
});
|
|
840
|
-
|
|
840
|
+
we.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 l 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
|
|
849
|
-
for (var
|
|
848
|
+
for (var u in t) if (u !== "__source" && t[u] !== this.props[u]) return !0;
|
|
849
|
+
for (var c in this.props) if (!(c in t)) return !0;
|
|
850
850
|
return !1;
|
|
851
851
|
};
|
|
852
|
-
function
|
|
853
|
-
return
|
|
854
|
-
return
|
|
852
|
+
function Ni(t, e) {
|
|
853
|
+
return Ve(function() {
|
|
854
|
+
return z(t, e);
|
|
855
855
|
})[0];
|
|
856
856
|
}
|
|
857
|
-
var
|
|
857
|
+
var mn = function(t) {
|
|
858
858
|
queueMicrotask(function() {
|
|
859
859
|
queueMicrotask(t);
|
|
860
860
|
});
|
|
861
861
|
};
|
|
862
|
-
function
|
|
863
|
-
|
|
864
|
-
for (var t; t =
|
|
862
|
+
function gn() {
|
|
863
|
+
fn(function() {
|
|
864
|
+
for (var t; t = Ti.shift(); ) Ai.call(t);
|
|
865
865
|
});
|
|
866
866
|
}
|
|
867
|
-
function
|
|
868
|
-
|
|
867
|
+
function xi() {
|
|
868
|
+
Ti.push(this) === 1 && (k.requestAnimationFrame || mn)(gn);
|
|
869
869
|
}
|
|
870
|
-
const
|
|
870
|
+
const qt = {
|
|
871
871
|
layout: "floating",
|
|
872
872
|
initialState: "expanded",
|
|
873
873
|
position: "bottom-right",
|
|
@@ -876,34 +876,46 @@ const oi = {
|
|
|
876
876
|
showMuteButton: !0,
|
|
877
877
|
removeWatermark: !1,
|
|
878
878
|
callToAction: "Talk to our assistant"
|
|
879
|
-
},
|
|
879
|
+
}, Fe = {
|
|
880
880
|
"bottom-right": { bottom: "24px", right: "24px" },
|
|
881
881
|
"bottom-left": { bottom: "24px", left: "24px" },
|
|
882
882
|
"top-right": { top: "24px", right: "24px" },
|
|
883
883
|
"top-left": { top: "24px", left: "24px" }
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
884
|
+
}, vn = /* @__PURE__ */ new Set([
|
|
885
|
+
"top",
|
|
886
|
+
"right",
|
|
887
|
+
"bottom",
|
|
888
|
+
"left",
|
|
889
|
+
"margin",
|
|
890
|
+
"margin-top",
|
|
891
|
+
"margin-right",
|
|
892
|
+
"margin-bottom",
|
|
893
|
+
"margin-left"
|
|
894
|
+
]);
|
|
895
|
+
function yn(t) {
|
|
896
|
+
if (Fe[t])
|
|
897
|
+
return Fe[t];
|
|
888
898
|
const e = t.match(/^\[(.+)\]$/);
|
|
889
|
-
if (!e) return
|
|
899
|
+
if (!e) return Fe["bottom-right"];
|
|
890
900
|
const n = {};
|
|
891
901
|
for (const o of e[1].split(",")) {
|
|
892
|
-
const
|
|
902
|
+
const l = o.trim(), a = l.lastIndexOf("-");
|
|
893
903
|
if (a <= 0) continue;
|
|
894
|
-
const
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
904
|
+
const u = l.slice(0, a);
|
|
905
|
+
if (!vn.has(u)) continue;
|
|
906
|
+
const c = l.slice(a + 1);
|
|
907
|
+
/^[\w.%-]+$/.test(c) && (n[u] = /^\d+$/.test(c) ? `${c}px` : c);
|
|
908
|
+
}
|
|
909
|
+
return Object.keys(n).length > 0 ? n : Fe["bottom-right"];
|
|
910
|
+
}
|
|
911
|
+
var ot = {}, Re = {}, Yt;
|
|
912
|
+
function Sn() {
|
|
913
|
+
if (Yt) return Re;
|
|
914
|
+
Yt = 1, Re.byteLength = c, Re.toByteArray = p, Re.fromByteArray = S;
|
|
915
|
+
for (var t = [], e = [], n = typeof Uint8Array < "u" ? Uint8Array : Array, o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", l = 0, a = o.length; l < a; ++l)
|
|
916
|
+
t[l] = o[l], e[o.charCodeAt(l)] = l;
|
|
905
917
|
e[45] = 62, e[95] = 63;
|
|
906
|
-
function
|
|
918
|
+
function u(g) {
|
|
907
919
|
var y = g.length;
|
|
908
920
|
if (y % 4 > 0)
|
|
909
921
|
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
@@ -912,15 +924,15 @@ function Dn() {
|
|
|
912
924
|
var A = C === y ? 0 : 4 - C % 4;
|
|
913
925
|
return [C, A];
|
|
914
926
|
}
|
|
915
|
-
function
|
|
916
|
-
var y =
|
|
927
|
+
function c(g) {
|
|
928
|
+
var y = u(g), C = y[0], A = y[1];
|
|
917
929
|
return (C + A) * 3 / 4 - A;
|
|
918
930
|
}
|
|
919
931
|
function m(g, y, C) {
|
|
920
932
|
return (y + C) * 3 / 4 - C;
|
|
921
933
|
}
|
|
922
934
|
function p(g) {
|
|
923
|
-
var y, C =
|
|
935
|
+
var y, C = u(g), A = C[0], I = C[1], b = new n(m(g, A, I)), R = 0, M = I > 0 ? A - 4 : A, x;
|
|
924
936
|
for (x = 0; x < M; x += 4)
|
|
925
937
|
y = e[g.charCodeAt(x)] << 18 | e[g.charCodeAt(x + 1)] << 12 | e[g.charCodeAt(x + 2)] << 6 | e[g.charCodeAt(x + 3)], b[R++] = y >> 16 & 255, b[R++] = y >> 8 & 255, b[R++] = y & 255;
|
|
926
938
|
return I === 2 && (y = e[g.charCodeAt(x)] << 2 | e[g.charCodeAt(x + 1)] >> 4, b[R++] = y & 255), I === 1 && (y = e[g.charCodeAt(x)] << 10 | e[g.charCodeAt(x + 1)] << 4 | e[g.charCodeAt(x + 2)] >> 2, b[R++] = y >> 8 & 255, b[R++] = y & 255), b;
|
|
@@ -942,41 +954,41 @@ function Dn() {
|
|
|
942
954
|
t[y >> 10] + t[y >> 4 & 63] + t[y << 2 & 63] + "="
|
|
943
955
|
)), I.join("");
|
|
944
956
|
}
|
|
945
|
-
return
|
|
957
|
+
return Re;
|
|
946
958
|
}
|
|
947
|
-
var
|
|
948
|
-
var
|
|
949
|
-
function
|
|
950
|
-
return
|
|
951
|
-
var a,
|
|
952
|
-
for (d += S, a = g & (1 << -_) - 1, g >>= -_, _ +=
|
|
959
|
+
var $e = {};
|
|
960
|
+
var Kt;
|
|
961
|
+
function wn() {
|
|
962
|
+
return Kt || (Kt = 1, $e.read = function(t, e, n, o, l) {
|
|
963
|
+
var a, u, c = l * 8 - o - 1, m = (1 << c) - 1, p = m >> 1, _ = -7, d = n ? l - 1 : 0, S = n ? -1 : 1, g = t[e + d];
|
|
964
|
+
for (d += S, a = g & (1 << -_) - 1, g >>= -_, _ += c; _ > 0; a = a * 256 + t[e + d], d += S, _ -= 8)
|
|
953
965
|
;
|
|
954
|
-
for (
|
|
966
|
+
for (u = a & (1 << -_) - 1, a >>= -_, _ += o; _ > 0; u = u * 256 + t[e + d], d += S, _ -= 8)
|
|
955
967
|
;
|
|
956
968
|
if (a === 0)
|
|
957
969
|
a = 1 - p;
|
|
958
970
|
else {
|
|
959
971
|
if (a === m)
|
|
960
|
-
return
|
|
961
|
-
|
|
972
|
+
return u ? NaN : (g ? -1 : 1) * (1 / 0);
|
|
973
|
+
u = u + Math.pow(2, o), a = a - p;
|
|
962
974
|
}
|
|
963
|
-
return (g ? -1 : 1) *
|
|
964
|
-
},
|
|
965
|
-
var
|
|
966
|
-
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (
|
|
975
|
+
return (g ? -1 : 1) * u * Math.pow(2, a - o);
|
|
976
|
+
}, $e.write = function(t, e, n, o, l, a) {
|
|
977
|
+
var u, c, m, p = a * 8 - l - 1, _ = (1 << p) - 1, d = _ >> 1, S = l === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, g = o ? 0 : a - 1, y = o ? 1 : -1, C = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
|
|
978
|
+
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (c = isNaN(e) ? 1 : 0, u = _) : (u = Math.floor(Math.log(e) / Math.LN2), e * (m = Math.pow(2, -u)) < 1 && (u--, m *= 2), u + d >= 1 ? e += S / m : e += S * Math.pow(2, 1 - d), e * m >= 2 && (u++, m /= 2), u + d >= _ ? (c = 0, u = _) : u + d >= 1 ? (c = (e * m - 1) * Math.pow(2, l), u = u + d) : (c = e * Math.pow(2, d - 1) * Math.pow(2, l), u = 0)); l >= 8; t[n + g] = c & 255, g += y, c /= 256, l -= 8)
|
|
967
979
|
;
|
|
968
|
-
for (
|
|
980
|
+
for (u = u << l | c, p += l; p > 0; t[n + g] = u & 255, g += y, u /= 256, p -= 8)
|
|
969
981
|
;
|
|
970
982
|
t[n + g - y] |= C * 128;
|
|
971
|
-
}),
|
|
972
|
-
}
|
|
973
|
-
var
|
|
974
|
-
function
|
|
975
|
-
return
|
|
976
|
-
const e =
|
|
977
|
-
t.Buffer =
|
|
978
|
-
const
|
|
979
|
-
t.kMaxLength =
|
|
983
|
+
}), $e;
|
|
984
|
+
}
|
|
985
|
+
var Jt;
|
|
986
|
+
function Cn() {
|
|
987
|
+
return Jt || (Jt = 1, (function(t) {
|
|
988
|
+
const e = Sn(), n = wn(), o = typeof Symbol == "function" && typeof Symbol.for == "function" ? /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom") : null;
|
|
989
|
+
t.Buffer = c, t.SlowBuffer = b, t.INSPECT_MAX_BYTES = 50;
|
|
990
|
+
const l = 2147483647;
|
|
991
|
+
t.kMaxLength = l, c.TYPED_ARRAY_SUPPORT = a(), !c.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
|
|
980
992
|
"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
|
|
981
993
|
);
|
|
982
994
|
function a() {
|
|
@@ -989,26 +1001,26 @@ function Un() {
|
|
|
989
1001
|
return !1;
|
|
990
1002
|
}
|
|
991
1003
|
}
|
|
992
|
-
Object.defineProperty(
|
|
1004
|
+
Object.defineProperty(c.prototype, "parent", {
|
|
993
1005
|
enumerable: !0,
|
|
994
1006
|
get: function() {
|
|
995
|
-
if (
|
|
1007
|
+
if (c.isBuffer(this))
|
|
996
1008
|
return this.buffer;
|
|
997
1009
|
}
|
|
998
|
-
}), Object.defineProperty(
|
|
1010
|
+
}), Object.defineProperty(c.prototype, "offset", {
|
|
999
1011
|
enumerable: !0,
|
|
1000
1012
|
get: function() {
|
|
1001
|
-
if (
|
|
1013
|
+
if (c.isBuffer(this))
|
|
1002
1014
|
return this.byteOffset;
|
|
1003
1015
|
}
|
|
1004
1016
|
});
|
|
1005
|
-
function
|
|
1006
|
-
if (s >
|
|
1017
|
+
function u(s) {
|
|
1018
|
+
if (s > l)
|
|
1007
1019
|
throw new RangeError('The value "' + s + '" is invalid for option "size"');
|
|
1008
1020
|
const i = new Uint8Array(s);
|
|
1009
|
-
return Object.setPrototypeOf(i,
|
|
1021
|
+
return Object.setPrototypeOf(i, c.prototype), i;
|
|
1010
1022
|
}
|
|
1011
|
-
function
|
|
1023
|
+
function c(s, i, r) {
|
|
1012
1024
|
if (typeof s == "number") {
|
|
1013
1025
|
if (typeof i == "string")
|
|
1014
1026
|
throw new TypeError(
|
|
@@ -1018,7 +1030,7 @@ function Un() {
|
|
|
1018
1030
|
}
|
|
1019
1031
|
return m(s, i, r);
|
|
1020
1032
|
}
|
|
1021
|
-
|
|
1033
|
+
c.poolSize = 8192;
|
|
1022
1034
|
function m(s, i, r) {
|
|
1023
1035
|
if (typeof s == "string")
|
|
1024
1036
|
return S(s, i);
|
|
@@ -1028,7 +1040,7 @@ function Un() {
|
|
|
1028
1040
|
throw new TypeError(
|
|
1029
1041
|
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof s
|
|
1030
1042
|
);
|
|
1031
|
-
if (
|
|
1043
|
+
if (Q(s, ArrayBuffer) || s && Q(s.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (Q(s, SharedArrayBuffer) || s && Q(s.buffer, SharedArrayBuffer)))
|
|
1032
1044
|
return C(s, i, r);
|
|
1033
1045
|
if (typeof s == "number")
|
|
1034
1046
|
throw new TypeError(
|
|
@@ -1036,18 +1048,18 @@ function Un() {
|
|
|
1036
1048
|
);
|
|
1037
1049
|
const h = s.valueOf && s.valueOf();
|
|
1038
1050
|
if (h != null && h !== s)
|
|
1039
|
-
return
|
|
1051
|
+
return c.from(h, i, r);
|
|
1040
1052
|
const f = A(s);
|
|
1041
1053
|
if (f) return f;
|
|
1042
1054
|
if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof s[Symbol.toPrimitive] == "function")
|
|
1043
|
-
return
|
|
1055
|
+
return c.from(s[Symbol.toPrimitive]("string"), i, r);
|
|
1044
1056
|
throw new TypeError(
|
|
1045
1057
|
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof s
|
|
1046
1058
|
);
|
|
1047
1059
|
}
|
|
1048
|
-
|
|
1060
|
+
c.from = function(s, i, r) {
|
|
1049
1061
|
return m(s, i, r);
|
|
1050
|
-
}, Object.setPrototypeOf(
|
|
1062
|
+
}, Object.setPrototypeOf(c.prototype, Uint8Array.prototype), Object.setPrototypeOf(c, Uint8Array);
|
|
1051
1063
|
function p(s) {
|
|
1052
1064
|
if (typeof s != "number")
|
|
1053
1065
|
throw new TypeError('"size" argument must be of type number');
|
|
@@ -1055,35 +1067,35 @@ function Un() {
|
|
|
1055
1067
|
throw new RangeError('The value "' + s + '" is invalid for option "size"');
|
|
1056
1068
|
}
|
|
1057
1069
|
function _(s, i, r) {
|
|
1058
|
-
return p(s), s <= 0 ?
|
|
1070
|
+
return p(s), s <= 0 ? u(s) : i !== void 0 ? typeof r == "string" ? u(s).fill(i, r) : u(s).fill(i) : u(s);
|
|
1059
1071
|
}
|
|
1060
|
-
|
|
1072
|
+
c.alloc = function(s, i, r) {
|
|
1061
1073
|
return _(s, i, r);
|
|
1062
1074
|
};
|
|
1063
1075
|
function d(s) {
|
|
1064
|
-
return p(s),
|
|
1076
|
+
return p(s), u(s < 0 ? 0 : I(s) | 0);
|
|
1065
1077
|
}
|
|
1066
|
-
|
|
1078
|
+
c.allocUnsafe = function(s) {
|
|
1067
1079
|
return d(s);
|
|
1068
|
-
},
|
|
1080
|
+
}, c.allocUnsafeSlow = function(s) {
|
|
1069
1081
|
return d(s);
|
|
1070
1082
|
};
|
|
1071
1083
|
function S(s, i) {
|
|
1072
|
-
if ((typeof i != "string" || i === "") && (i = "utf8"), !
|
|
1084
|
+
if ((typeof i != "string" || i === "") && (i = "utf8"), !c.isEncoding(i))
|
|
1073
1085
|
throw new TypeError("Unknown encoding: " + i);
|
|
1074
1086
|
const r = R(s, i) | 0;
|
|
1075
|
-
let h =
|
|
1087
|
+
let h = u(r);
|
|
1076
1088
|
const f = h.write(s, i);
|
|
1077
1089
|
return f !== r && (h = h.slice(0, f)), h;
|
|
1078
1090
|
}
|
|
1079
1091
|
function g(s) {
|
|
1080
|
-
const i = s.length < 0 ? 0 : I(s.length) | 0, r =
|
|
1092
|
+
const i = s.length < 0 ? 0 : I(s.length) | 0, r = u(i);
|
|
1081
1093
|
for (let h = 0; h < i; h += 1)
|
|
1082
1094
|
r[h] = s[h] & 255;
|
|
1083
1095
|
return r;
|
|
1084
1096
|
}
|
|
1085
1097
|
function y(s) {
|
|
1086
|
-
if (
|
|
1098
|
+
if (Q(s, Uint8Array)) {
|
|
1087
1099
|
const i = new Uint8Array(s);
|
|
1088
1100
|
return C(i.buffer, i.byteOffset, i.byteLength);
|
|
1089
1101
|
}
|
|
@@ -1095,30 +1107,30 @@ function Un() {
|
|
|
1095
1107
|
if (s.byteLength < i + (r || 0))
|
|
1096
1108
|
throw new RangeError('"length" is outside of buffer bounds');
|
|
1097
1109
|
let h;
|
|
1098
|
-
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,
|
|
1110
|
+
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, c.prototype), h;
|
|
1099
1111
|
}
|
|
1100
1112
|
function A(s) {
|
|
1101
|
-
if (
|
|
1102
|
-
const i = I(s.length) | 0, r =
|
|
1113
|
+
if (c.isBuffer(s)) {
|
|
1114
|
+
const i = I(s.length) | 0, r = u(i);
|
|
1103
1115
|
return r.length === 0 || s.copy(r, 0, 0, i), r;
|
|
1104
1116
|
}
|
|
1105
1117
|
if (s.length !== void 0)
|
|
1106
|
-
return typeof s.length != "number" ||
|
|
1118
|
+
return typeof s.length != "number" || tt(s.length) ? u(0) : g(s);
|
|
1107
1119
|
if (s.type === "Buffer" && Array.isArray(s.data))
|
|
1108
1120
|
return g(s.data);
|
|
1109
1121
|
}
|
|
1110
1122
|
function I(s) {
|
|
1111
|
-
if (s >=
|
|
1112
|
-
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" +
|
|
1123
|
+
if (s >= l)
|
|
1124
|
+
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + l.toString(16) + " bytes");
|
|
1113
1125
|
return s | 0;
|
|
1114
1126
|
}
|
|
1115
1127
|
function b(s) {
|
|
1116
|
-
return +s != s && (s = 0),
|
|
1128
|
+
return +s != s && (s = 0), c.alloc(+s);
|
|
1117
1129
|
}
|
|
1118
|
-
|
|
1119
|
-
return i != null && i._isBuffer === !0 && i !==
|
|
1120
|
-
},
|
|
1121
|
-
if (
|
|
1130
|
+
c.isBuffer = function(i) {
|
|
1131
|
+
return i != null && i._isBuffer === !0 && i !== c.prototype;
|
|
1132
|
+
}, c.compare = function(i, r) {
|
|
1133
|
+
if (Q(i, Uint8Array) && (i = c.from(i, i.offset, i.byteLength)), Q(r, Uint8Array) && (r = c.from(r, r.offset, r.byteLength)), !c.isBuffer(i) || !c.isBuffer(r))
|
|
1122
1134
|
throw new TypeError(
|
|
1123
1135
|
'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
|
|
1124
1136
|
);
|
|
@@ -1130,7 +1142,7 @@ function Un() {
|
|
|
1130
1142
|
break;
|
|
1131
1143
|
}
|
|
1132
1144
|
return h < f ? -1 : f < h ? 1 : 0;
|
|
1133
|
-
},
|
|
1145
|
+
}, c.isEncoding = function(i) {
|
|
1134
1146
|
switch (String(i).toLowerCase()) {
|
|
1135
1147
|
case "hex":
|
|
1136
1148
|
case "utf8":
|
|
@@ -1147,26 +1159,26 @@ function Un() {
|
|
|
1147
1159
|
default:
|
|
1148
1160
|
return !1;
|
|
1149
1161
|
}
|
|
1150
|
-
},
|
|
1162
|
+
}, c.concat = function(i, r) {
|
|
1151
1163
|
if (!Array.isArray(i))
|
|
1152
1164
|
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
1153
1165
|
if (i.length === 0)
|
|
1154
|
-
return
|
|
1166
|
+
return c.alloc(0);
|
|
1155
1167
|
let h;
|
|
1156
1168
|
if (r === void 0)
|
|
1157
1169
|
for (r = 0, h = 0; h < i.length; ++h)
|
|
1158
1170
|
r += i[h].length;
|
|
1159
|
-
const f =
|
|
1171
|
+
const f = c.allocUnsafe(r);
|
|
1160
1172
|
let E = 0;
|
|
1161
1173
|
for (h = 0; h < i.length; ++h) {
|
|
1162
1174
|
let v = i[h];
|
|
1163
|
-
if (
|
|
1164
|
-
E + v.length > f.length ? (
|
|
1175
|
+
if (Q(v, Uint8Array))
|
|
1176
|
+
E + v.length > f.length ? (c.isBuffer(v) || (v = c.from(v)), v.copy(f, E)) : Uint8Array.prototype.set.call(
|
|
1165
1177
|
f,
|
|
1166
1178
|
v,
|
|
1167
1179
|
E
|
|
1168
1180
|
);
|
|
1169
|
-
else if (
|
|
1181
|
+
else if (c.isBuffer(v))
|
|
1170
1182
|
v.copy(f, E);
|
|
1171
1183
|
else
|
|
1172
1184
|
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
@@ -1175,9 +1187,9 @@ function Un() {
|
|
|
1175
1187
|
return f;
|
|
1176
1188
|
};
|
|
1177
1189
|
function R(s, i) {
|
|
1178
|
-
if (
|
|
1190
|
+
if (c.isBuffer(s))
|
|
1179
1191
|
return s.length;
|
|
1180
|
-
if (ArrayBuffer.isView(s) ||
|
|
1192
|
+
if (ArrayBuffer.isView(s) || Q(s, ArrayBuffer))
|
|
1181
1193
|
return s.byteLength;
|
|
1182
1194
|
if (typeof s != "string")
|
|
1183
1195
|
throw new TypeError(
|
|
@@ -1194,7 +1206,7 @@ function Un() {
|
|
|
1194
1206
|
return r;
|
|
1195
1207
|
case "utf8":
|
|
1196
1208
|
case "utf-8":
|
|
1197
|
-
return
|
|
1209
|
+
return et(s).length;
|
|
1198
1210
|
case "ucs2":
|
|
1199
1211
|
case "ucs-2":
|
|
1200
1212
|
case "utf16le":
|
|
@@ -1203,14 +1215,14 @@ function Un() {
|
|
|
1203
1215
|
case "hex":
|
|
1204
1216
|
return r >>> 1;
|
|
1205
1217
|
case "base64":
|
|
1206
|
-
return
|
|
1218
|
+
return kt(s).length;
|
|
1207
1219
|
default:
|
|
1208
1220
|
if (f)
|
|
1209
|
-
return h ? -1 :
|
|
1221
|
+
return h ? -1 : et(s).length;
|
|
1210
1222
|
i = ("" + i).toLowerCase(), f = !0;
|
|
1211
1223
|
}
|
|
1212
1224
|
}
|
|
1213
|
-
|
|
1225
|
+
c.byteLength = R;
|
|
1214
1226
|
function M(s, i, r) {
|
|
1215
1227
|
let h = !1;
|
|
1216
1228
|
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))
|
|
@@ -1218,65 +1230,65 @@ function Un() {
|
|
|
1218
1230
|
for (s || (s = "utf8"); ; )
|
|
1219
1231
|
switch (s) {
|
|
1220
1232
|
case "hex":
|
|
1221
|
-
return
|
|
1233
|
+
return $i(this, i, r);
|
|
1222
1234
|
case "utf8":
|
|
1223
1235
|
case "utf-8":
|
|
1224
|
-
return
|
|
1236
|
+
return Ct(this, i, r);
|
|
1225
1237
|
case "ascii":
|
|
1226
|
-
return
|
|
1238
|
+
return Pi(this, i, r);
|
|
1227
1239
|
case "latin1":
|
|
1228
1240
|
case "binary":
|
|
1229
|
-
return
|
|
1241
|
+
return Fi(this, i, r);
|
|
1230
1242
|
case "base64":
|
|
1231
|
-
return
|
|
1243
|
+
return Li(this, i, r);
|
|
1232
1244
|
case "ucs2":
|
|
1233
1245
|
case "ucs-2":
|
|
1234
1246
|
case "utf16le":
|
|
1235
1247
|
case "utf-16le":
|
|
1236
|
-
return
|
|
1248
|
+
return Vi(this, i, r);
|
|
1237
1249
|
default:
|
|
1238
1250
|
if (h) throw new TypeError("Unknown encoding: " + s);
|
|
1239
1251
|
s = (s + "").toLowerCase(), h = !0;
|
|
1240
1252
|
}
|
|
1241
1253
|
}
|
|
1242
|
-
|
|
1254
|
+
c.prototype._isBuffer = !0;
|
|
1243
1255
|
function x(s, i, r) {
|
|
1244
1256
|
const h = s[i];
|
|
1245
1257
|
s[i] = s[r], s[r] = h;
|
|
1246
1258
|
}
|
|
1247
|
-
|
|
1259
|
+
c.prototype.swap16 = function() {
|
|
1248
1260
|
const i = this.length;
|
|
1249
1261
|
if (i % 2 !== 0)
|
|
1250
1262
|
throw new RangeError("Buffer size must be a multiple of 16-bits");
|
|
1251
1263
|
for (let r = 0; r < i; r += 2)
|
|
1252
1264
|
x(this, r, r + 1);
|
|
1253
1265
|
return this;
|
|
1254
|
-
},
|
|
1266
|
+
}, c.prototype.swap32 = function() {
|
|
1255
1267
|
const i = this.length;
|
|
1256
1268
|
if (i % 4 !== 0)
|
|
1257
1269
|
throw new RangeError("Buffer size must be a multiple of 32-bits");
|
|
1258
1270
|
for (let r = 0; r < i; r += 4)
|
|
1259
1271
|
x(this, r, r + 3), x(this, r + 1, r + 2);
|
|
1260
1272
|
return this;
|
|
1261
|
-
},
|
|
1273
|
+
}, c.prototype.swap64 = function() {
|
|
1262
1274
|
const i = this.length;
|
|
1263
1275
|
if (i % 8 !== 0)
|
|
1264
1276
|
throw new RangeError("Buffer size must be a multiple of 64-bits");
|
|
1265
1277
|
for (let r = 0; r < i; r += 8)
|
|
1266
1278
|
x(this, r, r + 7), x(this, r + 1, r + 6), x(this, r + 2, r + 5), x(this, r + 3, r + 4);
|
|
1267
1279
|
return this;
|
|
1268
|
-
},
|
|
1280
|
+
}, c.prototype.toString = function() {
|
|
1269
1281
|
const i = this.length;
|
|
1270
|
-
return i === 0 ? "" : arguments.length === 0 ?
|
|
1271
|
-
},
|
|
1272
|
-
if (!
|
|
1273
|
-
return this === i ? !0 :
|
|
1274
|
-
},
|
|
1282
|
+
return i === 0 ? "" : arguments.length === 0 ? Ct(this, 0, i) : M.apply(this, arguments);
|
|
1283
|
+
}, c.prototype.toLocaleString = c.prototype.toString, c.prototype.equals = function(i) {
|
|
1284
|
+
if (!c.isBuffer(i)) throw new TypeError("Argument must be a Buffer");
|
|
1285
|
+
return this === i ? !0 : c.compare(this, i) === 0;
|
|
1286
|
+
}, c.prototype.inspect = function() {
|
|
1275
1287
|
let i = "";
|
|
1276
1288
|
const r = t.INSPECT_MAX_BYTES;
|
|
1277
1289
|
return i = this.toString("hex", 0, r).replace(/(.{2})/g, "$1 ").trim(), this.length > r && (i += " ... "), "<Buffer " + i + ">";
|
|
1278
|
-
}, o && (
|
|
1279
|
-
if (
|
|
1290
|
+
}, o && (c.prototype[o] = c.prototype.inspect), c.prototype.compare = function(i, r, h, f, E) {
|
|
1291
|
+
if (Q(i, Uint8Array) && (i = c.from(i, i.offset, i.byteLength)), !c.isBuffer(i))
|
|
1280
1292
|
throw new TypeError(
|
|
1281
1293
|
'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof i
|
|
1282
1294
|
);
|
|
@@ -1300,19 +1312,19 @@ function Un() {
|
|
|
1300
1312
|
};
|
|
1301
1313
|
function Y(s, i, r, h, f) {
|
|
1302
1314
|
if (s.length === 0) return -1;
|
|
1303
|
-
if (typeof r == "string" ? (h = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r,
|
|
1315
|
+
if (typeof r == "string" ? (h = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r, tt(r) && (r = f ? 0 : s.length - 1), r < 0 && (r = s.length + r), r >= s.length) {
|
|
1304
1316
|
if (f) return -1;
|
|
1305
1317
|
r = s.length - 1;
|
|
1306
1318
|
} else if (r < 0)
|
|
1307
1319
|
if (f) r = 0;
|
|
1308
1320
|
else return -1;
|
|
1309
|
-
if (typeof i == "string" && (i =
|
|
1310
|
-
return i.length === 0 ? -1 :
|
|
1321
|
+
if (typeof i == "string" && (i = c.from(i, h)), c.isBuffer(i))
|
|
1322
|
+
return i.length === 0 ? -1 : te(s, i, r, h, f);
|
|
1311
1323
|
if (typeof i == "number")
|
|
1312
|
-
return i = i & 255, typeof Uint8Array.prototype.indexOf == "function" ? f ? Uint8Array.prototype.indexOf.call(s, i, r) : Uint8Array.prototype.lastIndexOf.call(s, i, r) :
|
|
1324
|
+
return i = i & 255, typeof Uint8Array.prototype.indexOf == "function" ? f ? Uint8Array.prototype.indexOf.call(s, i, r) : Uint8Array.prototype.lastIndexOf.call(s, i, r) : te(s, [i], r, h, f);
|
|
1313
1325
|
throw new TypeError("val must be string, number or Buffer");
|
|
1314
1326
|
}
|
|
1315
|
-
function
|
|
1327
|
+
function te(s, i, r, h, f) {
|
|
1316
1328
|
let E = 1, v = s.length, T = i.length;
|
|
1317
1329
|
if (h !== void 0 && (h = String(h).toLowerCase(), h === "ucs2" || h === "ucs-2" || h === "utf16le" || h === "utf-16le")) {
|
|
1318
1330
|
if (s.length < 2 || i.length < 2)
|
|
@@ -1342,11 +1354,11 @@ function Un() {
|
|
|
1342
1354
|
}
|
|
1343
1355
|
return -1;
|
|
1344
1356
|
}
|
|
1345
|
-
|
|
1357
|
+
c.prototype.includes = function(i, r, h) {
|
|
1346
1358
|
return this.indexOf(i, r, h) !== -1;
|
|
1347
|
-
},
|
|
1359
|
+
}, c.prototype.indexOf = function(i, r, h) {
|
|
1348
1360
|
return Y(this, i, r, h, !0);
|
|
1349
|
-
},
|
|
1361
|
+
}, c.prototype.lastIndexOf = function(i, r, h) {
|
|
1350
1362
|
return Y(this, i, r, h, !1);
|
|
1351
1363
|
};
|
|
1352
1364
|
function $(s, i, r, h) {
|
|
@@ -1358,24 +1370,24 @@ function Un() {
|
|
|
1358
1370
|
let v;
|
|
1359
1371
|
for (v = 0; v < h; ++v) {
|
|
1360
1372
|
const T = parseInt(i.substr(v * 2, 2), 16);
|
|
1361
|
-
if (
|
|
1373
|
+
if (tt(T)) return v;
|
|
1362
1374
|
s[r + v] = T;
|
|
1363
1375
|
}
|
|
1364
1376
|
return v;
|
|
1365
1377
|
}
|
|
1366
|
-
function
|
|
1367
|
-
return
|
|
1378
|
+
function ie(s, i, r, h) {
|
|
1379
|
+
return Be(et(i, s.length - r), s, r, h);
|
|
1368
1380
|
}
|
|
1369
|
-
function
|
|
1370
|
-
return
|
|
1381
|
+
function ne(s, i, r, h) {
|
|
1382
|
+
return Be(Wi(i), s, r, h);
|
|
1371
1383
|
}
|
|
1372
|
-
function
|
|
1373
|
-
return
|
|
1384
|
+
function Z(s, i, r, h) {
|
|
1385
|
+
return Be(kt(i), s, r, h);
|
|
1374
1386
|
}
|
|
1375
|
-
function
|
|
1376
|
-
return
|
|
1387
|
+
function oe(s, i, r, h) {
|
|
1388
|
+
return Be(zi(i, s.length - r), s, r, h);
|
|
1377
1389
|
}
|
|
1378
|
-
|
|
1390
|
+
c.prototype.write = function(i, r, h, f) {
|
|
1379
1391
|
if (r === void 0)
|
|
1380
1392
|
f = "utf8", h = this.length, r = 0;
|
|
1381
1393
|
else if (h === void 0 && typeof r == "string")
|
|
@@ -1397,32 +1409,32 @@ function Un() {
|
|
|
1397
1409
|
return $(this, i, r, h);
|
|
1398
1410
|
case "utf8":
|
|
1399
1411
|
case "utf-8":
|
|
1400
|
-
return
|
|
1412
|
+
return ie(this, i, r, h);
|
|
1401
1413
|
case "ascii":
|
|
1402
1414
|
case "latin1":
|
|
1403
1415
|
case "binary":
|
|
1404
|
-
return
|
|
1416
|
+
return ne(this, i, r, h);
|
|
1405
1417
|
case "base64":
|
|
1406
|
-
return
|
|
1418
|
+
return Z(this, i, r, h);
|
|
1407
1419
|
case "ucs2":
|
|
1408
1420
|
case "ucs-2":
|
|
1409
1421
|
case "utf16le":
|
|
1410
1422
|
case "utf-16le":
|
|
1411
|
-
return
|
|
1423
|
+
return oe(this, i, r, h);
|
|
1412
1424
|
default:
|
|
1413
1425
|
if (v) throw new TypeError("Unknown encoding: " + f);
|
|
1414
1426
|
f = ("" + f).toLowerCase(), v = !0;
|
|
1415
1427
|
}
|
|
1416
|
-
},
|
|
1428
|
+
}, c.prototype.toJSON = function() {
|
|
1417
1429
|
return {
|
|
1418
1430
|
type: "Buffer",
|
|
1419
1431
|
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
1420
1432
|
};
|
|
1421
1433
|
};
|
|
1422
|
-
function
|
|
1434
|
+
function Li(s, i, r) {
|
|
1423
1435
|
return i === 0 && r === s.length ? e.fromByteArray(s) : e.fromByteArray(s.slice(i, r));
|
|
1424
1436
|
}
|
|
1425
|
-
function
|
|
1437
|
+
function Ct(s, i, r) {
|
|
1426
1438
|
r = Math.min(s.length, r);
|
|
1427
1439
|
const h = [];
|
|
1428
1440
|
let f = i;
|
|
@@ -1447,148 +1459,148 @@ function Un() {
|
|
|
1447
1459
|
}
|
|
1448
1460
|
v === null ? (v = 65533, T = 1) : v > 65535 && (v -= 65536, h.push(v >>> 10 & 1023 | 55296), v = 56320 | v & 1023), h.push(v), f += T;
|
|
1449
1461
|
}
|
|
1450
|
-
return
|
|
1462
|
+
return Bi(h);
|
|
1451
1463
|
}
|
|
1452
|
-
const
|
|
1453
|
-
function
|
|
1464
|
+
const It = 4096;
|
|
1465
|
+
function Bi(s) {
|
|
1454
1466
|
const i = s.length;
|
|
1455
|
-
if (i <=
|
|
1467
|
+
if (i <= It)
|
|
1456
1468
|
return String.fromCharCode.apply(String, s);
|
|
1457
1469
|
let r = "", h = 0;
|
|
1458
1470
|
for (; h < i; )
|
|
1459
1471
|
r += String.fromCharCode.apply(
|
|
1460
1472
|
String,
|
|
1461
|
-
s.slice(h, h +=
|
|
1473
|
+
s.slice(h, h += It)
|
|
1462
1474
|
);
|
|
1463
1475
|
return r;
|
|
1464
1476
|
}
|
|
1465
|
-
function
|
|
1477
|
+
function Pi(s, i, r) {
|
|
1466
1478
|
let h = "";
|
|
1467
1479
|
r = Math.min(s.length, r);
|
|
1468
1480
|
for (let f = i; f < r; ++f)
|
|
1469
1481
|
h += String.fromCharCode(s[f] & 127);
|
|
1470
1482
|
return h;
|
|
1471
1483
|
}
|
|
1472
|
-
function
|
|
1484
|
+
function Fi(s, i, r) {
|
|
1473
1485
|
let h = "";
|
|
1474
1486
|
r = Math.min(s.length, r);
|
|
1475
1487
|
for (let f = i; f < r; ++f)
|
|
1476
1488
|
h += String.fromCharCode(s[f]);
|
|
1477
1489
|
return h;
|
|
1478
1490
|
}
|
|
1479
|
-
function
|
|
1491
|
+
function $i(s, i, r) {
|
|
1480
1492
|
const h = s.length;
|
|
1481
1493
|
(!i || i < 0) && (i = 0), (!r || r < 0 || r > h) && (r = h);
|
|
1482
1494
|
let f = "";
|
|
1483
1495
|
for (let E = i; E < r; ++E)
|
|
1484
|
-
f +=
|
|
1496
|
+
f += qi[s[E]];
|
|
1485
1497
|
return f;
|
|
1486
1498
|
}
|
|
1487
|
-
function
|
|
1499
|
+
function Vi(s, i, r) {
|
|
1488
1500
|
const h = s.slice(i, r);
|
|
1489
1501
|
let f = "";
|
|
1490
1502
|
for (let E = 0; E < h.length - 1; E += 2)
|
|
1491
1503
|
f += String.fromCharCode(h[E] + h[E + 1] * 256);
|
|
1492
1504
|
return f;
|
|
1493
1505
|
}
|
|
1494
|
-
|
|
1506
|
+
c.prototype.slice = function(i, r) {
|
|
1495
1507
|
const h = this.length;
|
|
1496
1508
|
i = ~~i, r = r === void 0 ? h : ~~r, i < 0 ? (i += h, i < 0 && (i = 0)) : i > h && (i = h), r < 0 ? (r += h, r < 0 && (r = 0)) : r > h && (r = h), r < i && (r = i);
|
|
1497
1509
|
const f = this.subarray(i, r);
|
|
1498
|
-
return Object.setPrototypeOf(f,
|
|
1510
|
+
return Object.setPrototypeOf(f, c.prototype), f;
|
|
1499
1511
|
};
|
|
1500
1512
|
function G(s, i, r) {
|
|
1501
1513
|
if (s % 1 !== 0 || s < 0) throw new RangeError("offset is not uint");
|
|
1502
1514
|
if (s + i > r) throw new RangeError("Trying to access beyond buffer length");
|
|
1503
1515
|
}
|
|
1504
|
-
|
|
1516
|
+
c.prototype.readUintLE = c.prototype.readUIntLE = function(i, r, h) {
|
|
1505
1517
|
i = i >>> 0, r = r >>> 0, h || G(i, r, this.length);
|
|
1506
1518
|
let f = this[i], E = 1, v = 0;
|
|
1507
1519
|
for (; ++v < r && (E *= 256); )
|
|
1508
1520
|
f += this[i + v] * E;
|
|
1509
1521
|
return f;
|
|
1510
|
-
},
|
|
1522
|
+
}, c.prototype.readUintBE = c.prototype.readUIntBE = function(i, r, h) {
|
|
1511
1523
|
i = i >>> 0, r = r >>> 0, h || G(i, r, this.length);
|
|
1512
1524
|
let f = this[i + --r], E = 1;
|
|
1513
1525
|
for (; r > 0 && (E *= 256); )
|
|
1514
1526
|
f += this[i + --r] * E;
|
|
1515
1527
|
return f;
|
|
1516
|
-
},
|
|
1528
|
+
}, c.prototype.readUint8 = c.prototype.readUInt8 = function(i, r) {
|
|
1517
1529
|
return i = i >>> 0, r || G(i, 1, this.length), this[i];
|
|
1518
|
-
},
|
|
1530
|
+
}, c.prototype.readUint16LE = c.prototype.readUInt16LE = function(i, r) {
|
|
1519
1531
|
return i = i >>> 0, r || G(i, 2, this.length), this[i] | this[i + 1] << 8;
|
|
1520
|
-
},
|
|
1532
|
+
}, c.prototype.readUint16BE = c.prototype.readUInt16BE = function(i, r) {
|
|
1521
1533
|
return i = i >>> 0, r || G(i, 2, this.length), this[i] << 8 | this[i + 1];
|
|
1522
|
-
},
|
|
1534
|
+
}, c.prototype.readUint32LE = c.prototype.readUInt32LE = function(i, r) {
|
|
1523
1535
|
return i = i >>> 0, r || G(i, 4, this.length), (this[i] | this[i + 1] << 8 | this[i + 2] << 16) + this[i + 3] * 16777216;
|
|
1524
|
-
},
|
|
1536
|
+
}, c.prototype.readUint32BE = c.prototype.readUInt32BE = function(i, r) {
|
|
1525
1537
|
return i = i >>> 0, r || G(i, 4, this.length), this[i] * 16777216 + (this[i + 1] << 16 | this[i + 2] << 8 | this[i + 3]);
|
|
1526
|
-
},
|
|
1527
|
-
i = i >>> 0,
|
|
1538
|
+
}, c.prototype.readBigUInt64LE = se(function(i) {
|
|
1539
|
+
i = i >>> 0, ge(i, "offset");
|
|
1528
1540
|
const r = this[i], h = this[i + 7];
|
|
1529
|
-
(r === void 0 || h === void 0) &&
|
|
1541
|
+
(r === void 0 || h === void 0) && Te(i, this.length - 8);
|
|
1530
1542
|
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;
|
|
1531
1543
|
return BigInt(f) + (BigInt(E) << BigInt(32));
|
|
1532
|
-
}),
|
|
1533
|
-
i = i >>> 0,
|
|
1544
|
+
}), c.prototype.readBigUInt64BE = se(function(i) {
|
|
1545
|
+
i = i >>> 0, ge(i, "offset");
|
|
1534
1546
|
const r = this[i], h = this[i + 7];
|
|
1535
|
-
(r === void 0 || h === void 0) &&
|
|
1547
|
+
(r === void 0 || h === void 0) && Te(i, this.length - 8);
|
|
1536
1548
|
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;
|
|
1537
1549
|
return (BigInt(f) << BigInt(32)) + BigInt(E);
|
|
1538
|
-
}),
|
|
1550
|
+
}), c.prototype.readIntLE = function(i, r, h) {
|
|
1539
1551
|
i = i >>> 0, r = r >>> 0, h || G(i, r, this.length);
|
|
1540
1552
|
let f = this[i], E = 1, v = 0;
|
|
1541
1553
|
for (; ++v < r && (E *= 256); )
|
|
1542
1554
|
f += this[i + v] * E;
|
|
1543
1555
|
return E *= 128, f >= E && (f -= Math.pow(2, 8 * r)), f;
|
|
1544
|
-
},
|
|
1556
|
+
}, c.prototype.readIntBE = function(i, r, h) {
|
|
1545
1557
|
i = i >>> 0, r = r >>> 0, h || G(i, r, this.length);
|
|
1546
1558
|
let f = r, E = 1, v = this[i + --f];
|
|
1547
1559
|
for (; f > 0 && (E *= 256); )
|
|
1548
1560
|
v += this[i + --f] * E;
|
|
1549
1561
|
return E *= 128, v >= E && (v -= Math.pow(2, 8 * r)), v;
|
|
1550
|
-
},
|
|
1562
|
+
}, c.prototype.readInt8 = function(i, r) {
|
|
1551
1563
|
return i = i >>> 0, r || G(i, 1, this.length), this[i] & 128 ? (255 - this[i] + 1) * -1 : this[i];
|
|
1552
|
-
},
|
|
1564
|
+
}, c.prototype.readInt16LE = function(i, r) {
|
|
1553
1565
|
i = i >>> 0, r || G(i, 2, this.length);
|
|
1554
1566
|
const h = this[i] | this[i + 1] << 8;
|
|
1555
1567
|
return h & 32768 ? h | 4294901760 : h;
|
|
1556
|
-
},
|
|
1568
|
+
}, c.prototype.readInt16BE = function(i, r) {
|
|
1557
1569
|
i = i >>> 0, r || G(i, 2, this.length);
|
|
1558
1570
|
const h = this[i + 1] | this[i] << 8;
|
|
1559
1571
|
return h & 32768 ? h | 4294901760 : h;
|
|
1560
|
-
},
|
|
1572
|
+
}, c.prototype.readInt32LE = function(i, r) {
|
|
1561
1573
|
return i = i >>> 0, r || G(i, 4, this.length), this[i] | this[i + 1] << 8 | this[i + 2] << 16 | this[i + 3] << 24;
|
|
1562
|
-
},
|
|
1574
|
+
}, c.prototype.readInt32BE = function(i, r) {
|
|
1563
1575
|
return i = i >>> 0, r || G(i, 4, this.length), this[i] << 24 | this[i + 1] << 16 | this[i + 2] << 8 | this[i + 3];
|
|
1564
|
-
},
|
|
1565
|
-
i = i >>> 0,
|
|
1576
|
+
}, c.prototype.readBigInt64LE = se(function(i) {
|
|
1577
|
+
i = i >>> 0, ge(i, "offset");
|
|
1566
1578
|
const r = this[i], h = this[i + 7];
|
|
1567
|
-
(r === void 0 || h === void 0) &&
|
|
1579
|
+
(r === void 0 || h === void 0) && Te(i, this.length - 8);
|
|
1568
1580
|
const f = this[i + 4] + this[i + 5] * 2 ** 8 + this[i + 6] * 2 ** 16 + (h << 24);
|
|
1569
1581
|
return (BigInt(f) << BigInt(32)) + BigInt(r + this[++i] * 2 ** 8 + this[++i] * 2 ** 16 + this[++i] * 2 ** 24);
|
|
1570
|
-
}),
|
|
1571
|
-
i = i >>> 0,
|
|
1582
|
+
}), c.prototype.readBigInt64BE = se(function(i) {
|
|
1583
|
+
i = i >>> 0, ge(i, "offset");
|
|
1572
1584
|
const r = this[i], h = this[i + 7];
|
|
1573
|
-
(r === void 0 || h === void 0) &&
|
|
1585
|
+
(r === void 0 || h === void 0) && Te(i, this.length - 8);
|
|
1574
1586
|
const f = (r << 24) + // Overflow
|
|
1575
1587
|
this[++i] * 2 ** 16 + this[++i] * 2 ** 8 + this[++i];
|
|
1576
1588
|
return (BigInt(f) << BigInt(32)) + BigInt(this[++i] * 2 ** 24 + this[++i] * 2 ** 16 + this[++i] * 2 ** 8 + h);
|
|
1577
|
-
}),
|
|
1589
|
+
}), c.prototype.readFloatLE = function(i, r) {
|
|
1578
1590
|
return i = i >>> 0, r || G(i, 4, this.length), n.read(this, i, !0, 23, 4);
|
|
1579
|
-
},
|
|
1591
|
+
}, c.prototype.readFloatBE = function(i, r) {
|
|
1580
1592
|
return i = i >>> 0, r || G(i, 4, this.length), n.read(this, i, !1, 23, 4);
|
|
1581
|
-
},
|
|
1593
|
+
}, c.prototype.readDoubleLE = function(i, r) {
|
|
1582
1594
|
return i = i >>> 0, r || G(i, 8, this.length), n.read(this, i, !0, 52, 8);
|
|
1583
|
-
},
|
|
1595
|
+
}, c.prototype.readDoubleBE = function(i, r) {
|
|
1584
1596
|
return i = i >>> 0, r || G(i, 8, this.length), n.read(this, i, !1, 52, 8);
|
|
1585
1597
|
};
|
|
1586
1598
|
function K(s, i, r, h, f, E) {
|
|
1587
|
-
if (!
|
|
1599
|
+
if (!c.isBuffer(s)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
1588
1600
|
if (i > f || i < E) throw new RangeError('"value" argument is out of bounds');
|
|
1589
1601
|
if (r + h > s.length) throw new RangeError("Index out of range");
|
|
1590
1602
|
}
|
|
1591
|
-
|
|
1603
|
+
c.prototype.writeUintLE = c.prototype.writeUIntLE = function(i, r, h, f) {
|
|
1592
1604
|
if (i = +i, r = r >>> 0, h = h >>> 0, !f) {
|
|
1593
1605
|
const T = Math.pow(2, 8 * h) - 1;
|
|
1594
1606
|
K(this, i, r, h, T, 0);
|
|
@@ -1597,7 +1609,7 @@ function Un() {
|
|
|
1597
1609
|
for (this[r] = i & 255; ++v < h && (E *= 256); )
|
|
1598
1610
|
this[r + v] = i / E & 255;
|
|
1599
1611
|
return r + h;
|
|
1600
|
-
},
|
|
1612
|
+
}, c.prototype.writeUintBE = c.prototype.writeUIntBE = function(i, r, h, f) {
|
|
1601
1613
|
if (i = +i, r = r >>> 0, h = h >>> 0, !f) {
|
|
1602
1614
|
const T = Math.pow(2, 8 * h) - 1;
|
|
1603
1615
|
K(this, i, r, h, T, 0);
|
|
@@ -1606,36 +1618,36 @@ function Un() {
|
|
|
1606
1618
|
for (this[r + E] = i & 255; --E >= 0 && (v *= 256); )
|
|
1607
1619
|
this[r + E] = i / v & 255;
|
|
1608
1620
|
return r + h;
|
|
1609
|
-
},
|
|
1621
|
+
}, c.prototype.writeUint8 = c.prototype.writeUInt8 = function(i, r, h) {
|
|
1610
1622
|
return i = +i, r = r >>> 0, h || K(this, i, r, 1, 255, 0), this[r] = i & 255, r + 1;
|
|
1611
|
-
},
|
|
1623
|
+
}, c.prototype.writeUint16LE = c.prototype.writeUInt16LE = function(i, r, h) {
|
|
1612
1624
|
return i = +i, r = r >>> 0, h || K(this, i, r, 2, 65535, 0), this[r] = i & 255, this[r + 1] = i >>> 8, r + 2;
|
|
1613
|
-
},
|
|
1625
|
+
}, c.prototype.writeUint16BE = c.prototype.writeUInt16BE = function(i, r, h) {
|
|
1614
1626
|
return i = +i, r = r >>> 0, h || K(this, i, r, 2, 65535, 0), this[r] = i >>> 8, this[r + 1] = i & 255, r + 2;
|
|
1615
|
-
},
|
|
1627
|
+
}, c.prototype.writeUint32LE = c.prototype.writeUInt32LE = function(i, r, h) {
|
|
1616
1628
|
return i = +i, r = r >>> 0, h || K(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;
|
|
1617
|
-
},
|
|
1629
|
+
}, c.prototype.writeUint32BE = c.prototype.writeUInt32BE = function(i, r, h) {
|
|
1618
1630
|
return i = +i, r = r >>> 0, h || K(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;
|
|
1619
1631
|
};
|
|
1620
|
-
function
|
|
1621
|
-
|
|
1632
|
+
function bt(s, i, r, h, f) {
|
|
1633
|
+
Ot(i, h, f, s, r, 7);
|
|
1622
1634
|
let E = Number(i & BigInt(4294967295));
|
|
1623
1635
|
s[r++] = E, E = E >> 8, s[r++] = E, E = E >> 8, s[r++] = E, E = E >> 8, s[r++] = E;
|
|
1624
1636
|
let v = Number(i >> BigInt(32) & BigInt(4294967295));
|
|
1625
1637
|
return s[r++] = v, v = v >> 8, s[r++] = v, v = v >> 8, s[r++] = v, v = v >> 8, s[r++] = v, r;
|
|
1626
1638
|
}
|
|
1627
|
-
function
|
|
1628
|
-
|
|
1639
|
+
function At(s, i, r, h, f) {
|
|
1640
|
+
Ot(i, h, f, s, r, 7);
|
|
1629
1641
|
let E = Number(i & BigInt(4294967295));
|
|
1630
1642
|
s[r + 7] = E, E = E >> 8, s[r + 6] = E, E = E >> 8, s[r + 5] = E, E = E >> 8, s[r + 4] = E;
|
|
1631
1643
|
let v = Number(i >> BigInt(32) & BigInt(4294967295));
|
|
1632
1644
|
return s[r + 3] = v, v = v >> 8, s[r + 2] = v, v = v >> 8, s[r + 1] = v, v = v >> 8, s[r] = v, r + 8;
|
|
1633
1645
|
}
|
|
1634
|
-
|
|
1635
|
-
return
|
|
1636
|
-
}),
|
|
1637
|
-
return
|
|
1638
|
-
}),
|
|
1646
|
+
c.prototype.writeBigUInt64LE = se(function(i, r = 0) {
|
|
1647
|
+
return bt(this, i, r, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
1648
|
+
}), c.prototype.writeBigUInt64BE = se(function(i, r = 0) {
|
|
1649
|
+
return At(this, i, r, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
1650
|
+
}), c.prototype.writeIntLE = function(i, r, h, f) {
|
|
1639
1651
|
if (i = +i, r = r >>> 0, !f) {
|
|
1640
1652
|
const L = Math.pow(2, 8 * h - 1);
|
|
1641
1653
|
K(this, i, r, h, L - 1, -L);
|
|
@@ -1644,7 +1656,7 @@ function Un() {
|
|
|
1644
1656
|
for (this[r] = i & 255; ++E < h && (v *= 256); )
|
|
1645
1657
|
i < 0 && T === 0 && this[r + E - 1] !== 0 && (T = 1), this[r + E] = (i / v >> 0) - T & 255;
|
|
1646
1658
|
return r + h;
|
|
1647
|
-
},
|
|
1659
|
+
}, c.prototype.writeIntBE = function(i, r, h, f) {
|
|
1648
1660
|
if (i = +i, r = r >>> 0, !f) {
|
|
1649
1661
|
const L = Math.pow(2, 8 * h - 1);
|
|
1650
1662
|
K(this, i, r, h, L - 1, -L);
|
|
@@ -1653,42 +1665,42 @@ function Un() {
|
|
|
1653
1665
|
for (this[r + E] = i & 255; --E >= 0 && (v *= 256); )
|
|
1654
1666
|
i < 0 && T === 0 && this[r + E + 1] !== 0 && (T = 1), this[r + E] = (i / v >> 0) - T & 255;
|
|
1655
1667
|
return r + h;
|
|
1656
|
-
},
|
|
1668
|
+
}, c.prototype.writeInt8 = function(i, r, h) {
|
|
1657
1669
|
return i = +i, r = r >>> 0, h || K(this, i, r, 1, 127, -128), i < 0 && (i = 255 + i + 1), this[r] = i & 255, r + 1;
|
|
1658
|
-
},
|
|
1670
|
+
}, c.prototype.writeInt16LE = function(i, r, h) {
|
|
1659
1671
|
return i = +i, r = r >>> 0, h || K(this, i, r, 2, 32767, -32768), this[r] = i & 255, this[r + 1] = i >>> 8, r + 2;
|
|
1660
|
-
},
|
|
1672
|
+
}, c.prototype.writeInt16BE = function(i, r, h) {
|
|
1661
1673
|
return i = +i, r = r >>> 0, h || K(this, i, r, 2, 32767, -32768), this[r] = i >>> 8, this[r + 1] = i & 255, r + 2;
|
|
1662
|
-
},
|
|
1674
|
+
}, c.prototype.writeInt32LE = function(i, r, h) {
|
|
1663
1675
|
return i = +i, r = r >>> 0, h || K(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;
|
|
1664
|
-
},
|
|
1676
|
+
}, c.prototype.writeInt32BE = function(i, r, h) {
|
|
1665
1677
|
return i = +i, r = r >>> 0, h || K(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;
|
|
1666
|
-
},
|
|
1667
|
-
return
|
|
1668
|
-
}),
|
|
1669
|
-
return
|
|
1678
|
+
}, c.prototype.writeBigInt64LE = se(function(i, r = 0) {
|
|
1679
|
+
return bt(this, i, r, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
1680
|
+
}), c.prototype.writeBigInt64BE = se(function(i, r = 0) {
|
|
1681
|
+
return At(this, i, r, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
1670
1682
|
});
|
|
1671
|
-
function
|
|
1683
|
+
function Tt(s, i, r, h, f, E) {
|
|
1672
1684
|
if (r + h > s.length) throw new RangeError("Index out of range");
|
|
1673
1685
|
if (r < 0) throw new RangeError("Index out of range");
|
|
1674
1686
|
}
|
|
1675
|
-
function
|
|
1676
|
-
return i = +i, r = r >>> 0, f ||
|
|
1687
|
+
function Rt(s, i, r, h, f) {
|
|
1688
|
+
return i = +i, r = r >>> 0, f || Tt(s, i, r, 4), n.write(s, i, r, h, 23, 4), r + 4;
|
|
1677
1689
|
}
|
|
1678
|
-
|
|
1679
|
-
return
|
|
1680
|
-
},
|
|
1681
|
-
return
|
|
1690
|
+
c.prototype.writeFloatLE = function(i, r, h) {
|
|
1691
|
+
return Rt(this, i, r, !0, h);
|
|
1692
|
+
}, c.prototype.writeFloatBE = function(i, r, h) {
|
|
1693
|
+
return Rt(this, i, r, !1, h);
|
|
1682
1694
|
};
|
|
1683
|
-
function
|
|
1684
|
-
return i = +i, r = r >>> 0, f ||
|
|
1685
|
-
}
|
|
1686
|
-
|
|
1687
|
-
return
|
|
1688
|
-
},
|
|
1689
|
-
return
|
|
1690
|
-
},
|
|
1691
|
-
if (!
|
|
1695
|
+
function Nt(s, i, r, h, f) {
|
|
1696
|
+
return i = +i, r = r >>> 0, f || Tt(s, i, r, 8), n.write(s, i, r, h, 52, 8), r + 8;
|
|
1697
|
+
}
|
|
1698
|
+
c.prototype.writeDoubleLE = function(i, r, h) {
|
|
1699
|
+
return Nt(this, i, r, !0, h);
|
|
1700
|
+
}, c.prototype.writeDoubleBE = function(i, r, h) {
|
|
1701
|
+
return Nt(this, i, r, !1, h);
|
|
1702
|
+
}, c.prototype.copy = function(i, r, h, f) {
|
|
1703
|
+
if (!c.isBuffer(i)) throw new TypeError("argument should be a Buffer");
|
|
1692
1704
|
if (h || (h = 0), !f && f !== 0 && (f = this.length), r >= i.length && (r = i.length), r || (r = 0), f > 0 && f < h && (f = h), f === h || i.length === 0 || this.length === 0) return 0;
|
|
1693
1705
|
if (r < 0)
|
|
1694
1706
|
throw new RangeError("targetStart out of bounds");
|
|
@@ -1701,11 +1713,11 @@ function Un() {
|
|
|
1701
1713
|
this.subarray(h, f),
|
|
1702
1714
|
r
|
|
1703
1715
|
), E;
|
|
1704
|
-
},
|
|
1716
|
+
}, c.prototype.fill = function(i, r, h, f) {
|
|
1705
1717
|
if (typeof i == "string") {
|
|
1706
1718
|
if (typeof r == "string" ? (f = r, r = 0, h = this.length) : typeof h == "string" && (f = h, h = this.length), f !== void 0 && typeof f != "string")
|
|
1707
1719
|
throw new TypeError("encoding must be a string");
|
|
1708
|
-
if (typeof f == "string" && !
|
|
1720
|
+
if (typeof f == "string" && !c.isEncoding(f))
|
|
1709
1721
|
throw new TypeError("Unknown encoding: " + f);
|
|
1710
1722
|
if (i.length === 1) {
|
|
1711
1723
|
const v = i.charCodeAt(0);
|
|
@@ -1722,7 +1734,7 @@ function Un() {
|
|
|
1722
1734
|
for (E = r; E < h; ++E)
|
|
1723
1735
|
this[E] = i;
|
|
1724
1736
|
else {
|
|
1725
|
-
const v =
|
|
1737
|
+
const v = c.isBuffer(i) ? i : c.from(i, f), T = v.length;
|
|
1726
1738
|
if (T === 0)
|
|
1727
1739
|
throw new TypeError('The value "' + i + '" is invalid for argument "value"');
|
|
1728
1740
|
for (E = 0; E < h - r; ++E)
|
|
@@ -1730,9 +1742,9 @@ function Un() {
|
|
|
1730
1742
|
}
|
|
1731
1743
|
return this;
|
|
1732
1744
|
};
|
|
1733
|
-
const
|
|
1734
|
-
function
|
|
1735
|
-
|
|
1745
|
+
const me = {};
|
|
1746
|
+
function Qe(s, i, r) {
|
|
1747
|
+
me[s] = class extends r {
|
|
1736
1748
|
constructor() {
|
|
1737
1749
|
super(), Object.defineProperty(this, "message", {
|
|
1738
1750
|
value: i.apply(this, arguments),
|
|
@@ -1756,63 +1768,63 @@ function Un() {
|
|
|
1756
1768
|
}
|
|
1757
1769
|
};
|
|
1758
1770
|
}
|
|
1759
|
-
|
|
1771
|
+
Qe(
|
|
1760
1772
|
"ERR_BUFFER_OUT_OF_BOUNDS",
|
|
1761
1773
|
function(s) {
|
|
1762
1774
|
return s ? `${s} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
|
|
1763
1775
|
},
|
|
1764
1776
|
RangeError
|
|
1765
|
-
),
|
|
1777
|
+
), Qe(
|
|
1766
1778
|
"ERR_INVALID_ARG_TYPE",
|
|
1767
1779
|
function(s, i) {
|
|
1768
1780
|
return `The "${s}" argument must be of type number. Received type ${typeof i}`;
|
|
1769
1781
|
},
|
|
1770
1782
|
TypeError
|
|
1771
|
-
),
|
|
1783
|
+
), Qe(
|
|
1772
1784
|
"ERR_OUT_OF_RANGE",
|
|
1773
1785
|
function(s, i, r) {
|
|
1774
1786
|
let h = `The value of "${s}" is out of range.`, f = r;
|
|
1775
|
-
return Number.isInteger(r) && Math.abs(r) > 2 ** 32 ? f =
|
|
1787
|
+
return Number.isInteger(r) && Math.abs(r) > 2 ** 32 ? f = xt(String(r)) : typeof r == "bigint" && (f = String(r), (r > BigInt(2) ** BigInt(32) || r < -(BigInt(2) ** BigInt(32))) && (f = xt(f)), f += "n"), h += ` It must be ${i}. Received ${f}`, h;
|
|
1776
1788
|
},
|
|
1777
1789
|
RangeError
|
|
1778
1790
|
);
|
|
1779
|
-
function
|
|
1791
|
+
function xt(s) {
|
|
1780
1792
|
let i = "", r = s.length;
|
|
1781
1793
|
const h = s[0] === "-" ? 1 : 0;
|
|
1782
1794
|
for (; r >= h + 4; r -= 3)
|
|
1783
1795
|
i = `_${s.slice(r - 3, r)}${i}`;
|
|
1784
1796
|
return `${s.slice(0, r)}${i}`;
|
|
1785
1797
|
}
|
|
1786
|
-
function
|
|
1787
|
-
|
|
1798
|
+
function Gi(s, i, r) {
|
|
1799
|
+
ge(i, "offset"), (s[i] === void 0 || s[i + r] === void 0) && Te(i, s.length - (r + 1));
|
|
1788
1800
|
}
|
|
1789
|
-
function
|
|
1801
|
+
function Ot(s, i, r, h, f, E) {
|
|
1790
1802
|
if (s > r || s < i) {
|
|
1791
1803
|
const v = typeof i == "bigint" ? "n" : "";
|
|
1792
1804
|
let T;
|
|
1793
|
-
throw i === 0 || i === BigInt(0) ? T = `>= 0${v} and < 2${v} ** ${(E + 1) * 8}${v}` : T = `>= -(2${v} ** ${(E + 1) * 8 - 1}${v}) and < 2 ** ${(E + 1) * 8 - 1}${v}`, new
|
|
1805
|
+
throw i === 0 || i === BigInt(0) ? T = `>= 0${v} and < 2${v} ** ${(E + 1) * 8}${v}` : T = `>= -(2${v} ** ${(E + 1) * 8 - 1}${v}) and < 2 ** ${(E + 1) * 8 - 1}${v}`, new me.ERR_OUT_OF_RANGE("value", T, s);
|
|
1794
1806
|
}
|
|
1795
|
-
|
|
1807
|
+
Gi(h, f, E);
|
|
1796
1808
|
}
|
|
1797
|
-
function
|
|
1809
|
+
function ge(s, i) {
|
|
1798
1810
|
if (typeof s != "number")
|
|
1799
|
-
throw new
|
|
1811
|
+
throw new me.ERR_INVALID_ARG_TYPE(i, "number", s);
|
|
1800
1812
|
}
|
|
1801
|
-
function
|
|
1802
|
-
throw Math.floor(s) !== s ? (
|
|
1813
|
+
function Te(s, i, r) {
|
|
1814
|
+
throw Math.floor(s) !== s ? (ge(s, r), new me.ERR_OUT_OF_RANGE("offset", "an integer", s)) : i < 0 ? new me.ERR_BUFFER_OUT_OF_BOUNDS() : new me.ERR_OUT_OF_RANGE(
|
|
1803
1815
|
"offset",
|
|
1804
1816
|
`>= 0 and <= ${i}`,
|
|
1805
1817
|
s
|
|
1806
1818
|
);
|
|
1807
1819
|
}
|
|
1808
|
-
const
|
|
1809
|
-
function
|
|
1810
|
-
if (s = s.split("=")[0], s = s.trim().replace(
|
|
1820
|
+
const ji = /[^+/0-9A-Za-z-_]/g;
|
|
1821
|
+
function Hi(s) {
|
|
1822
|
+
if (s = s.split("=")[0], s = s.trim().replace(ji, ""), s.length < 2) return "";
|
|
1811
1823
|
for (; s.length % 4 !== 0; )
|
|
1812
1824
|
s = s + "=";
|
|
1813
1825
|
return s;
|
|
1814
1826
|
}
|
|
1815
|
-
function
|
|
1827
|
+
function et(s, i) {
|
|
1816
1828
|
i = i || 1 / 0;
|
|
1817
1829
|
let r;
|
|
1818
1830
|
const h = s.length;
|
|
@@ -1866,35 +1878,35 @@ function Un() {
|
|
|
1866
1878
|
}
|
|
1867
1879
|
return E;
|
|
1868
1880
|
}
|
|
1869
|
-
function
|
|
1881
|
+
function Wi(s) {
|
|
1870
1882
|
const i = [];
|
|
1871
1883
|
for (let r = 0; r < s.length; ++r)
|
|
1872
1884
|
i.push(s.charCodeAt(r) & 255);
|
|
1873
1885
|
return i;
|
|
1874
1886
|
}
|
|
1875
|
-
function
|
|
1887
|
+
function zi(s, i) {
|
|
1876
1888
|
let r, h, f;
|
|
1877
1889
|
const E = [];
|
|
1878
1890
|
for (let v = 0; v < s.length && !((i -= 2) < 0); ++v)
|
|
1879
1891
|
r = s.charCodeAt(v), h = r >> 8, f = r % 256, E.push(f), E.push(h);
|
|
1880
1892
|
return E;
|
|
1881
1893
|
}
|
|
1882
|
-
function
|
|
1883
|
-
return e.toByteArray(
|
|
1894
|
+
function kt(s) {
|
|
1895
|
+
return e.toByteArray(Hi(s));
|
|
1884
1896
|
}
|
|
1885
|
-
function
|
|
1897
|
+
function Be(s, i, r, h) {
|
|
1886
1898
|
let f;
|
|
1887
1899
|
for (f = 0; f < h && !(f + r >= i.length || f >= s.length); ++f)
|
|
1888
1900
|
i[f + r] = s[f];
|
|
1889
1901
|
return f;
|
|
1890
1902
|
}
|
|
1891
|
-
function
|
|
1903
|
+
function Q(s, i) {
|
|
1892
1904
|
return s instanceof i || s != null && s.constructor != null && s.constructor.name != null && s.constructor.name === i.name;
|
|
1893
1905
|
}
|
|
1894
|
-
function
|
|
1906
|
+
function tt(s) {
|
|
1895
1907
|
return s !== s;
|
|
1896
1908
|
}
|
|
1897
|
-
const
|
|
1909
|
+
const qi = (function() {
|
|
1898
1910
|
const s = "0123456789abcdef", i = new Array(256);
|
|
1899
1911
|
for (let r = 0; r < 16; ++r) {
|
|
1900
1912
|
const h = r * 16;
|
|
@@ -1903,78 +1915,78 @@ function Un() {
|
|
|
1903
1915
|
}
|
|
1904
1916
|
return i;
|
|
1905
1917
|
})();
|
|
1906
|
-
function
|
|
1907
|
-
return typeof BigInt > "u" ?
|
|
1918
|
+
function se(s) {
|
|
1919
|
+
return typeof BigInt > "u" ? Yi : s;
|
|
1908
1920
|
}
|
|
1909
|
-
function
|
|
1921
|
+
function Yi() {
|
|
1910
1922
|
throw new Error("BigInt not supported");
|
|
1911
1923
|
}
|
|
1912
|
-
})(
|
|
1924
|
+
})(ot)), ot;
|
|
1913
1925
|
}
|
|
1914
|
-
var
|
|
1915
|
-
const
|
|
1926
|
+
var In = Cn();
|
|
1927
|
+
const bn = "https://api.anam.ai", An = "/v1", Oi = {
|
|
1916
1928
|
client: "js-sdk",
|
|
1917
1929
|
version: "4.8.0"
|
|
1918
1930
|
};
|
|
1919
|
-
var
|
|
1920
|
-
function
|
|
1921
|
-
return a instanceof n ? a : new n(function(
|
|
1922
|
-
|
|
1931
|
+
var Tn = function(t, e, n, o) {
|
|
1932
|
+
function l(a) {
|
|
1933
|
+
return a instanceof n ? a : new n(function(u) {
|
|
1934
|
+
u(a);
|
|
1923
1935
|
});
|
|
1924
1936
|
}
|
|
1925
|
-
return new (n || (n = Promise))(function(a,
|
|
1926
|
-
function
|
|
1937
|
+
return new (n || (n = Promise))(function(a, u) {
|
|
1938
|
+
function c(_) {
|
|
1927
1939
|
try {
|
|
1928
1940
|
p(o.next(_));
|
|
1929
1941
|
} catch (d) {
|
|
1930
|
-
|
|
1942
|
+
u(d);
|
|
1931
1943
|
}
|
|
1932
1944
|
}
|
|
1933
1945
|
function m(_) {
|
|
1934
1946
|
try {
|
|
1935
1947
|
p(o.throw(_));
|
|
1936
1948
|
} catch (d) {
|
|
1937
|
-
|
|
1949
|
+
u(d);
|
|
1938
1950
|
}
|
|
1939
1951
|
}
|
|
1940
1952
|
function p(_) {
|
|
1941
|
-
_.done ? a(_.value) :
|
|
1953
|
+
_.done ? a(_.value) : l(_.value).then(c, m);
|
|
1942
1954
|
}
|
|
1943
1955
|
p((o = o.apply(t, e || [])).next());
|
|
1944
1956
|
});
|
|
1945
1957
|
};
|
|
1946
|
-
const
|
|
1947
|
-
var
|
|
1958
|
+
const ki = "https://api.anam.ai", wt = "/v1";
|
|
1959
|
+
var re;
|
|
1948
1960
|
(function(t) {
|
|
1949
1961
|
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";
|
|
1950
|
-
})(
|
|
1951
|
-
let
|
|
1952
|
-
const
|
|
1953
|
-
|
|
1954
|
-
},
|
|
1955
|
-
|
|
1956
|
-
},
|
|
1957
|
-
|
|
1962
|
+
})(re || (re = {}));
|
|
1963
|
+
let ft = ki, Di = wt, le, Mi = !1;
|
|
1964
|
+
const Rn = (t, e = wt) => {
|
|
1965
|
+
ft = t, Di = e;
|
|
1966
|
+
}, Nn = (t) => {
|
|
1967
|
+
le = t;
|
|
1968
|
+
}, xn = (t) => {
|
|
1969
|
+
Mi = t;
|
|
1958
1970
|
};
|
|
1959
|
-
let
|
|
1971
|
+
let ce = {
|
|
1960
1972
|
sessionId: null,
|
|
1961
1973
|
organizationId: null,
|
|
1962
1974
|
attemptCorrelationId: null
|
|
1963
1975
|
};
|
|
1964
|
-
const
|
|
1965
|
-
|
|
1966
|
-
},
|
|
1967
|
-
if (!
|
|
1976
|
+
const ve = (t) => {
|
|
1977
|
+
ce = Object.assign(Object.assign({}, ce), t);
|
|
1978
|
+
}, _e = (t, e, n) => Tn(void 0, void 0, void 0, function* () {
|
|
1979
|
+
if (!Mi)
|
|
1968
1980
|
try {
|
|
1969
|
-
const o = Object.assign(Object.assign({},
|
|
1970
|
-
|
|
1971
|
-
const
|
|
1972
|
-
let a,
|
|
1981
|
+
const o = Object.assign(Object.assign({}, Oi), n);
|
|
1982
|
+
ce.sessionId && (o.sessionId = ce.sessionId), ce.organizationId && (o.organizationId = ce.organizationId), ce.attemptCorrelationId && (o.attemptCorrelationId = ce.attemptCorrelationId);
|
|
1983
|
+
const l = `${Di}/metrics/client`;
|
|
1984
|
+
let a, u = {
|
|
1973
1985
|
"Content-Type": "application/json"
|
|
1974
1986
|
};
|
|
1975
|
-
|
|
1987
|
+
le?.enabled && le?.baseUrl ? (a = `${le.baseUrl}${l}`, u["X-Anam-Target-Url"] = `${ft}${l}`) : a = `${ft}${l}`, yield fetch(a, {
|
|
1976
1988
|
method: "POST",
|
|
1977
|
-
headers:
|
|
1989
|
+
headers: u,
|
|
1978
1990
|
body: JSON.stringify({
|
|
1979
1991
|
name: t,
|
|
1980
1992
|
value: e,
|
|
@@ -1984,16 +1996,16 @@ const Se = (t) => {
|
|
|
1984
1996
|
} catch (o) {
|
|
1985
1997
|
console.error("Failed to send error metric:", o);
|
|
1986
1998
|
}
|
|
1987
|
-
}),
|
|
1988
|
-
var n, o,
|
|
1999
|
+
}), On = (t, e = "console") => {
|
|
2000
|
+
var n, o, l;
|
|
1989
2001
|
const a = {};
|
|
1990
2002
|
t.forEach((d) => {
|
|
1991
2003
|
a[d.type] || (a[d.type] = []), a[d.type].push(d);
|
|
1992
2004
|
});
|
|
1993
|
-
const
|
|
2005
|
+
const u = {
|
|
1994
2006
|
issues: []
|
|
1995
|
-
},
|
|
1996
|
-
|
|
2007
|
+
}, c = ((n = a["inbound-rtp"]) === null || n === void 0 ? void 0 : n.filter((d) => d.kind === "video")) || [];
|
|
2008
|
+
c.length > 0 && (u.personaVideoStream = [], c.forEach((d) => {
|
|
1997
2009
|
var S, g, y, C, A;
|
|
1998
2010
|
const I = {
|
|
1999
2011
|
framesReceived: (S = d.framesReceived) !== null && S !== void 0 ? S : "unknown",
|
|
@@ -2004,10 +2016,10 @@ const Se = (t) => {
|
|
|
2004
2016
|
resolution: d.frameWidth && d.frameHeight ? `${d.frameWidth}x${d.frameHeight}` : void 0,
|
|
2005
2017
|
jitter: d.jitter !== void 0 ? d.jitter : void 0
|
|
2006
2018
|
};
|
|
2007
|
-
|
|
2019
|
+
u.personaVideoStream.push(I);
|
|
2008
2020
|
}));
|
|
2009
2021
|
const m = ((o = a["inbound-rtp"]) === null || o === void 0 ? void 0 : o.filter((d) => d.kind === "audio")) || [];
|
|
2010
|
-
m.length > 0 && (
|
|
2022
|
+
m.length > 0 && (u.personaAudioStream = [], m.forEach((d) => {
|
|
2011
2023
|
var S, g, y;
|
|
2012
2024
|
const C = {
|
|
2013
2025
|
packetsReceived: (S = d.packetsReceived) !== null && S !== void 0 ? S : "unknown",
|
|
@@ -2016,18 +2028,18 @@ const Se = (t) => {
|
|
|
2016
2028
|
jitter: d.jitter !== void 0 ? d.jitter : void 0,
|
|
2017
2029
|
totalAudioEnergy: d.totalAudioEnergy !== void 0 ? d.totalAudioEnergy : void 0
|
|
2018
2030
|
};
|
|
2019
|
-
|
|
2031
|
+
u.personaAudioStream.push(C);
|
|
2020
2032
|
}));
|
|
2021
|
-
const p = ((
|
|
2022
|
-
p.length > 0 && (
|
|
2033
|
+
const p = ((l = a["outbound-rtp"]) === null || l === void 0 ? void 0 : l.filter((d) => d.kind === "audio")) || [];
|
|
2034
|
+
p.length > 0 && (u.userAudioInput = [], p.forEach((d) => {
|
|
2023
2035
|
var S, g;
|
|
2024
2036
|
const y = {
|
|
2025
2037
|
packetsSent: (S = d.packetsSent) !== null && S !== void 0 ? S : "unknown",
|
|
2026
2038
|
retransmittedPackets: (g = d.retransmittedPacketsSent) !== null && g !== void 0 ? g : void 0,
|
|
2027
2039
|
avgPacketSendDelay: d.totalPacketSendDelay !== void 0 ? d.totalPacketSendDelay / (d.packetsSent || 1) * 1e3 : void 0
|
|
2028
2040
|
};
|
|
2029
|
-
|
|
2030
|
-
})), a.codec && (
|
|
2041
|
+
u.userAudioInput.push(y);
|
|
2042
|
+
})), a.codec && (u.codecs = [], a.codec.forEach((d) => {
|
|
2031
2043
|
const S = {
|
|
2032
2044
|
status: d.payloadType ? "Active" : "Available",
|
|
2033
2045
|
mimeType: d.mimeType || "Unknown",
|
|
@@ -2035,51 +2047,51 @@ const Se = (t) => {
|
|
|
2035
2047
|
clockRate: d.clockRate || void 0,
|
|
2036
2048
|
channels: d.channels || void 0
|
|
2037
2049
|
};
|
|
2038
|
-
|
|
2039
|
-
})), a.transport && (
|
|
2050
|
+
u.codecs.push(S);
|
|
2051
|
+
})), a.transport && (u.transportLayer = [], a.transport.forEach((d) => {
|
|
2040
2052
|
const S = {
|
|
2041
2053
|
dtlsState: d.dtlsState || "unknown",
|
|
2042
2054
|
iceState: d.iceState || "unknown",
|
|
2043
2055
|
bytesSent: d.bytesSent || void 0,
|
|
2044
2056
|
bytesReceived: d.bytesReceived || void 0
|
|
2045
2057
|
};
|
|
2046
|
-
|
|
2058
|
+
u.transportLayer.push(S);
|
|
2047
2059
|
}));
|
|
2048
2060
|
const _ = [];
|
|
2049
|
-
if (
|
|
2061
|
+
if (c.forEach((d) => {
|
|
2050
2062
|
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)`);
|
|
2051
2063
|
}), m.forEach((d) => {
|
|
2052
2064
|
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)`);
|
|
2053
|
-
}),
|
|
2054
|
-
return
|
|
2055
|
-
console.group("📊 WebRTC Session Statistics Report"),
|
|
2065
|
+
}), u.issues = _, e === "json")
|
|
2066
|
+
return u;
|
|
2067
|
+
console.group("📊 WebRTC Session Statistics Report"), u.personaVideoStream && u.personaVideoStream.length > 0 && (console.group("📹 Persona Video Stream (Inbound)"), u.personaVideoStream.forEach((d) => {
|
|
2056
2068
|
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`);
|
|
2057
|
-
}), console.groupEnd()),
|
|
2069
|
+
}), console.groupEnd()), u.personaAudioStream && u.personaAudioStream.length > 0 && (console.group("🔊 Persona Audio Stream (Inbound)"), u.personaAudioStream.forEach((d) => {
|
|
2058
2070
|
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)}`);
|
|
2059
|
-
}), console.groupEnd()),
|
|
2071
|
+
}), console.groupEnd()), u.userAudioInput && u.userAudioInput.length > 0 && (console.group("🎤 User Audio Input (Outbound)"), u.userAudioInput.forEach((d) => {
|
|
2060
2072
|
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`);
|
|
2061
|
-
}), console.groupEnd()),
|
|
2073
|
+
}), console.groupEnd()), u.codecs && u.codecs.length > 0 && (console.group("🔧 Codecs Used"), u.codecs.forEach((d) => {
|
|
2062
2074
|
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}`);
|
|
2063
|
-
}), console.groupEnd()),
|
|
2075
|
+
}), console.groupEnd()), u.transportLayer && u.transportLayer.length > 0 && (console.group("🚚 Transport Layer"), u.transportLayer.forEach((d) => {
|
|
2064
2076
|
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()}`);
|
|
2065
|
-
}), console.groupEnd()),
|
|
2077
|
+
}), console.groupEnd()), u.issues.length > 0 ? (console.group("⚠️ Potential Issues Detected"), u.issues.forEach((d) => console.warn(d)), console.groupEnd()) : console.log("✅ No significant issues detected"), console.groupEnd();
|
|
2066
2078
|
};
|
|
2067
2079
|
var j;
|
|
2068
2080
|
(function(t) {
|
|
2069
2081
|
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";
|
|
2070
2082
|
})(j || (j = {}));
|
|
2071
2083
|
class V extends Error {
|
|
2072
|
-
constructor(e, n, o = 500,
|
|
2073
|
-
super(e), this.name = "ClientError", this.code = n, this.statusCode = o, this.details =
|
|
2074
|
-
details:
|
|
2084
|
+
constructor(e, n, o = 500, l) {
|
|
2085
|
+
super(e), this.name = "ClientError", this.code = n, this.statusCode = o, this.details = l, Object.setPrototypeOf(this, V.prototype), _e(re.CLIENT_METRIC_MEASUREMENT_ERROR, n, {
|
|
2086
|
+
details: l,
|
|
2075
2087
|
statusCode: o
|
|
2076
2088
|
});
|
|
2077
2089
|
}
|
|
2078
2090
|
}
|
|
2079
|
-
function
|
|
2091
|
+
function Xt() {
|
|
2080
2092
|
return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : Date.now().toString(36) + Math.random().toString(36).substr(2, 9);
|
|
2081
2093
|
}
|
|
2082
|
-
function
|
|
2094
|
+
function kn(t) {
|
|
2083
2095
|
if (!(!t || !t.enabled)) {
|
|
2084
2096
|
if (!t.baseUrl)
|
|
2085
2097
|
return "API Gateway baseUrl is required when enabled";
|
|
@@ -2098,18 +2110,18 @@ var W;
|
|
|
2098
2110
|
(function(t) {
|
|
2099
2111
|
t.OFFER = "offer", t.ANSWER = "answer", t.ICE_CANDIDATE = "icecandidate", t.END_SESSION = "endsession", t.HEARTBEAT = "heartbeat", t.WARNING = "warning", t.TALK_STREAM_INTERRUPTED = "talkinputstreaminterrupted", t.TALK_STREAM_INPUT = "talkstream", t.SESSION_READY = "sessionready", t.AGENT_AUDIO_INPUT = "agentaudioinput", t.AGENT_AUDIO_INPUT_END = "agentaudioinputend";
|
|
2100
2112
|
})(W || (W = {}));
|
|
2101
|
-
var
|
|
2113
|
+
var Oe;
|
|
2102
2114
|
(function(t) {
|
|
2103
2115
|
t.SPEECH_TEXT = "speechText", t.CLIENT_TOOL_EVENT = "clientToolEvent", t.REASONING_TEXT = "reasoningText";
|
|
2104
|
-
})(
|
|
2105
|
-
var
|
|
2116
|
+
})(Oe || (Oe = {}));
|
|
2117
|
+
var ue;
|
|
2106
2118
|
(function(t) {
|
|
2107
2119
|
t.PENDING = "pending", t.GRANTED = "granted", t.DENIED = "denied", t.NOT_REQUESTED = "not_requested";
|
|
2108
|
-
})(
|
|
2109
|
-
var
|
|
2120
|
+
})(ue || (ue = {}));
|
|
2121
|
+
var Ke;
|
|
2110
2122
|
(function(t) {
|
|
2111
2123
|
t.USER = "user", t.PERSONA = "persona";
|
|
2112
|
-
})(
|
|
2124
|
+
})(Ke || (Ke = {}));
|
|
2113
2125
|
var N;
|
|
2114
2126
|
(function(t) {
|
|
2115
2127
|
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";
|
|
@@ -2118,11 +2130,11 @@ var X;
|
|
|
2118
2130
|
(function(t) {
|
|
2119
2131
|
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";
|
|
2120
2132
|
})(X || (X = {}));
|
|
2121
|
-
var
|
|
2133
|
+
var he;
|
|
2122
2134
|
(function(t) {
|
|
2123
2135
|
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";
|
|
2124
|
-
})(
|
|
2125
|
-
class
|
|
2136
|
+
})(he || (he = {}));
|
|
2137
|
+
class Dn {
|
|
2126
2138
|
constructor(e, n) {
|
|
2127
2139
|
this.sequenceNumber = 0, this.config = e, this.signallingClient = n;
|
|
2128
2140
|
}
|
|
@@ -2160,48 +2172,48 @@ class Wn {
|
|
|
2160
2172
|
return this.config;
|
|
2161
2173
|
}
|
|
2162
2174
|
arrayBufferToBase64(e) {
|
|
2163
|
-
const n = e instanceof Uint8Array ? e : new Uint8Array(e), o = Array.from(n, (
|
|
2175
|
+
const n = e instanceof Uint8Array ? e : new Uint8Array(e), o = Array.from(n, (l) => String.fromCharCode(l)).join("");
|
|
2164
2176
|
return btoa(o);
|
|
2165
2177
|
}
|
|
2166
2178
|
}
|
|
2167
|
-
var
|
|
2168
|
-
function
|
|
2169
|
-
return a instanceof n ? a : new n(function(
|
|
2170
|
-
|
|
2179
|
+
var ye = function(t, e, n, o) {
|
|
2180
|
+
function l(a) {
|
|
2181
|
+
return a instanceof n ? a : new n(function(u) {
|
|
2182
|
+
u(a);
|
|
2171
2183
|
});
|
|
2172
2184
|
}
|
|
2173
|
-
return new (n || (n = Promise))(function(a,
|
|
2174
|
-
function
|
|
2185
|
+
return new (n || (n = Promise))(function(a, u) {
|
|
2186
|
+
function c(_) {
|
|
2175
2187
|
try {
|
|
2176
2188
|
p(o.next(_));
|
|
2177
2189
|
} catch (d) {
|
|
2178
|
-
|
|
2190
|
+
u(d);
|
|
2179
2191
|
}
|
|
2180
2192
|
}
|
|
2181
2193
|
function m(_) {
|
|
2182
2194
|
try {
|
|
2183
2195
|
p(o.throw(_));
|
|
2184
2196
|
} catch (d) {
|
|
2185
|
-
|
|
2197
|
+
u(d);
|
|
2186
2198
|
}
|
|
2187
2199
|
}
|
|
2188
2200
|
function p(_) {
|
|
2189
|
-
_.done ? a(_.value) :
|
|
2201
|
+
_.done ? a(_.value) : l(_.value).then(c, m);
|
|
2190
2202
|
}
|
|
2191
2203
|
p((o = o.apply(t, e || [])).next());
|
|
2192
2204
|
});
|
|
2193
2205
|
};
|
|
2194
|
-
const
|
|
2195
|
-
class
|
|
2196
|
-
constructor(e, n, o,
|
|
2197
|
-
var
|
|
2198
|
-
if (this.stopSignal = !1, this.sendingBuffer = [], this.wsConnectionAttempts = 0, this.socket = null, this.heartBeatIntervalRef = null, this.publicEventEmitter = o, this.internalEventEmitter =
|
|
2206
|
+
const Mn = 5, Un = 5;
|
|
2207
|
+
class Ln {
|
|
2208
|
+
constructor(e, n, o, l, a) {
|
|
2209
|
+
var u, c, m, p, _;
|
|
2210
|
+
if (this.stopSignal = !1, this.sendingBuffer = [], this.wsConnectionAttempts = 0, this.socket = null, this.heartBeatIntervalRef = null, this.publicEventEmitter = o, this.internalEventEmitter = l, this.apiGatewayConfig = a, !e)
|
|
2199
2211
|
throw new Error("Signalling Client: sessionId is required");
|
|
2200
2212
|
this.sessionId = e;
|
|
2201
2213
|
const { heartbeatIntervalSeconds: d, maxWsReconnectionAttempts: S, url: g } = n;
|
|
2202
|
-
if (this.heartbeatIntervalSeconds = d ||
|
|
2214
|
+
if (this.heartbeatIntervalSeconds = d || Mn, this.maxWsReconnectionAttempts = S || Un, !g.baseUrl)
|
|
2203
2215
|
throw new Error("Signalling Client: baseUrl is required");
|
|
2204
|
-
if (!((
|
|
2216
|
+
if (!((u = this.apiGatewayConfig) === null || u === void 0) && u.enabled && (!((c = this.apiGatewayConfig) === null || c === void 0) && c.baseUrl)) {
|
|
2205
2217
|
const y = new URL(this.apiGatewayConfig.baseUrl), C = (m = this.apiGatewayConfig.wsPath) !== null && m !== void 0 ? m : "/ws";
|
|
2206
2218
|
y.protocol = y.protocol.replace("http", "ws"), y.pathname = C, this.url = y;
|
|
2207
2219
|
const A = g.protocol || "https", I = A === "http" ? "ws" : "wss", b = `${A}://${g.baseUrl}`, R = (p = g.signallingPath) !== null && p !== void 0 ? p : "/ws", M = new URL(b);
|
|
@@ -2218,7 +2230,7 @@ class Yn {
|
|
|
2218
2230
|
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;
|
|
2219
2231
|
}
|
|
2220
2232
|
sendOffer(e) {
|
|
2221
|
-
return
|
|
2233
|
+
return ye(this, void 0, void 0, function* () {
|
|
2222
2234
|
const n = {
|
|
2223
2235
|
connectionDescription: e,
|
|
2224
2236
|
userUid: this.sessionId
|
|
@@ -2232,7 +2244,7 @@ class Yn {
|
|
|
2232
2244
|
});
|
|
2233
2245
|
}
|
|
2234
2246
|
sendIceCandidate(e) {
|
|
2235
|
-
return
|
|
2247
|
+
return ye(this, void 0, void 0, function* () {
|
|
2236
2248
|
const n = {
|
|
2237
2249
|
actionType: W.ICE_CANDIDATE,
|
|
2238
2250
|
sessionId: this.sessionId,
|
|
@@ -2253,7 +2265,7 @@ class Yn {
|
|
|
2253
2265
|
this.sendingBuffer.push(e);
|
|
2254
2266
|
}
|
|
2255
2267
|
sendTalkMessage(e) {
|
|
2256
|
-
return
|
|
2268
|
+
return ye(this, void 0, void 0, function* () {
|
|
2257
2269
|
const n = {
|
|
2258
2270
|
actionType: W.TALK_STREAM_INPUT,
|
|
2259
2271
|
sessionId: this.sessionId,
|
|
@@ -2282,21 +2294,21 @@ class Yn {
|
|
|
2282
2294
|
this.socket && (this.socket.close(), this.socket = null), this.heartBeatIntervalRef && (clearInterval(this.heartBeatIntervalRef), this.heartBeatIntervalRef = null);
|
|
2283
2295
|
}
|
|
2284
2296
|
onOpen() {
|
|
2285
|
-
return
|
|
2297
|
+
return ye(this, void 0, void 0, function* () {
|
|
2286
2298
|
if (!this.socket)
|
|
2287
2299
|
throw new Error("SignallingClient - onOpen: socket is null");
|
|
2288
2300
|
try {
|
|
2289
2301
|
this.wsConnectionAttempts = 0, this.flushSendingBuffer(), this.socket.onmessage = this.onMessage.bind(this), this.startSendingHeartBeats(), this.internalEventEmitter.emit(X.WEB_SOCKET_OPEN);
|
|
2290
2302
|
} catch (e) {
|
|
2291
|
-
console.error("SignallingClient - onOpen: error in onOpen", e), this.publicEventEmitter.emit(N.CONNECTION_CLOSED,
|
|
2303
|
+
console.error("SignallingClient - onOpen: error in onOpen", e), this.publicEventEmitter.emit(N.CONNECTION_CLOSED, he.SIGNALLING_CLIENT_CONNECTION_FAILURE);
|
|
2292
2304
|
}
|
|
2293
2305
|
});
|
|
2294
2306
|
}
|
|
2295
2307
|
onClose() {
|
|
2296
|
-
return
|
|
2308
|
+
return ye(this, void 0, void 0, function* () {
|
|
2297
2309
|
this.wsConnectionAttempts += 1, !this.stopSignal && (this.wsConnectionAttempts <= this.maxWsReconnectionAttempts ? (this.socket = null, setTimeout(() => {
|
|
2298
2310
|
this.connect();
|
|
2299
|
-
}, 100 * this.wsConnectionAttempts)) : (this.heartBeatIntervalRef && (clearInterval(this.heartBeatIntervalRef), this.heartBeatIntervalRef = null), this.publicEventEmitter.emit(N.CONNECTION_CLOSED,
|
|
2311
|
+
}, 100 * this.wsConnectionAttempts)) : (this.heartBeatIntervalRef && (clearInterval(this.heartBeatIntervalRef), this.heartBeatIntervalRef = null), this.publicEventEmitter.emit(N.CONNECTION_CLOSED, he.SIGNALLING_CLIENT_CONNECTION_FAILURE)));
|
|
2300
2312
|
});
|
|
2301
2313
|
}
|
|
2302
2314
|
onError(e) {
|
|
@@ -2310,7 +2322,7 @@ class Yn {
|
|
|
2310
2322
|
}), this.sendingBuffer = e;
|
|
2311
2323
|
}
|
|
2312
2324
|
onMessage(e) {
|
|
2313
|
-
return
|
|
2325
|
+
return ye(this, void 0, void 0, function* () {
|
|
2314
2326
|
const n = JSON.parse(e.data);
|
|
2315
2327
|
this.internalEventEmitter.emit(X.SIGNAL_MESSAGE_RECEIVED, n);
|
|
2316
2328
|
});
|
|
@@ -2325,55 +2337,55 @@ class Yn {
|
|
|
2325
2337
|
payload: ""
|
|
2326
2338
|
}, o = JSON.stringify(n);
|
|
2327
2339
|
this.heartBeatIntervalRef = setInterval(() => {
|
|
2328
|
-
var
|
|
2329
|
-
this.stopSignal || ((
|
|
2340
|
+
var l;
|
|
2341
|
+
this.stopSignal || ((l = this.socket) === null || l === void 0 ? void 0 : l.readyState) === WebSocket.OPEN && this.socket.send(o);
|
|
2330
2342
|
}, e);
|
|
2331
2343
|
}
|
|
2332
2344
|
}
|
|
2333
|
-
function
|
|
2345
|
+
function Bn(t) {
|
|
2334
2346
|
return "brainType" in t || "llmId" in t;
|
|
2335
2347
|
}
|
|
2336
|
-
var
|
|
2337
|
-
function
|
|
2338
|
-
return a instanceof n ? a : new n(function(
|
|
2339
|
-
|
|
2348
|
+
var Zt = function(t, e, n, o) {
|
|
2349
|
+
function l(a) {
|
|
2350
|
+
return a instanceof n ? a : new n(function(u) {
|
|
2351
|
+
u(a);
|
|
2340
2352
|
});
|
|
2341
2353
|
}
|
|
2342
|
-
return new (n || (n = Promise))(function(a,
|
|
2343
|
-
function
|
|
2354
|
+
return new (n || (n = Promise))(function(a, u) {
|
|
2355
|
+
function c(_) {
|
|
2344
2356
|
try {
|
|
2345
2357
|
p(o.next(_));
|
|
2346
2358
|
} catch (d) {
|
|
2347
|
-
|
|
2359
|
+
u(d);
|
|
2348
2360
|
}
|
|
2349
2361
|
}
|
|
2350
2362
|
function m(_) {
|
|
2351
2363
|
try {
|
|
2352
2364
|
p(o.throw(_));
|
|
2353
2365
|
} catch (d) {
|
|
2354
|
-
|
|
2366
|
+
u(d);
|
|
2355
2367
|
}
|
|
2356
2368
|
}
|
|
2357
2369
|
function p(_) {
|
|
2358
|
-
_.done ? a(_.value) :
|
|
2370
|
+
_.done ? a(_.value) : l(_.value).then(c, m);
|
|
2359
2371
|
}
|
|
2360
2372
|
p((o = o.apply(t, e || [])).next());
|
|
2361
2373
|
});
|
|
2362
2374
|
};
|
|
2363
|
-
class
|
|
2375
|
+
class Pn {
|
|
2364
2376
|
constructor(e, n, o) {
|
|
2365
2377
|
if (!e && !n)
|
|
2366
2378
|
throw new Error("Either sessionToken or apiKey must be provided");
|
|
2367
|
-
this.sessionToken = e || null, this.apiKey = n || null, this.baseUrl = o?.baseUrl ||
|
|
2379
|
+
this.sessionToken = e || null, this.apiKey = n || null, this.baseUrl = o?.baseUrl || bn, this.apiVersion = o?.apiVersion || An, this.apiGatewayConfig = o?.apiGateway || void 0;
|
|
2368
2380
|
}
|
|
2369
2381
|
/**
|
|
2370
2382
|
* Builds URL and headers for a request, applying API Gateway configuration if enabled
|
|
2371
2383
|
*/
|
|
2372
2384
|
buildGatewayUrlAndHeaders(e, n) {
|
|
2373
|
-
var o,
|
|
2374
|
-
if (!((o = this.apiGatewayConfig) === null || o === void 0) && o.enabled && (!((
|
|
2375
|
-
const a = `${this.apiGatewayConfig.baseUrl}${e}`,
|
|
2376
|
-
return { url: a, headers:
|
|
2385
|
+
var o, l;
|
|
2386
|
+
if (!((o = this.apiGatewayConfig) === null || o === void 0) && o.enabled && (!((l = this.apiGatewayConfig) === null || l === void 0) && l.baseUrl)) {
|
|
2387
|
+
const a = `${this.apiGatewayConfig.baseUrl}${e}`, u = new URL(`${this.baseUrl}${e}`), c = Object.assign(Object.assign({}, n), { "X-Anam-Target-Url": u.href });
|
|
2388
|
+
return { url: a, headers: c };
|
|
2377
2389
|
} else
|
|
2378
2390
|
return {
|
|
2379
2391
|
url: `${this.baseUrl}${e}`,
|
|
@@ -2381,7 +2393,7 @@ class Jn {
|
|
|
2381
2393
|
};
|
|
2382
2394
|
}
|
|
2383
2395
|
startSession(e, n) {
|
|
2384
|
-
return
|
|
2396
|
+
return Zt(this, void 0, void 0, function* () {
|
|
2385
2397
|
if (!this.sessionToken) {
|
|
2386
2398
|
if (!e)
|
|
2387
2399
|
throw new V("Persona configuration must be provided when using apiKey", j.CLIENT_ERROR_CODE_VALIDATION_ERROR, 400);
|
|
@@ -2389,36 +2401,36 @@ class Jn {
|
|
|
2389
2401
|
}
|
|
2390
2402
|
e && "brainType" in e && console.warn("Warning: brainType is deprecated and will be removed in a future version. Please use llmId instead.");
|
|
2391
2403
|
try {
|
|
2392
|
-
const o = `${this.apiVersion}/engine/session`, { url:
|
|
2404
|
+
const o = `${this.apiVersion}/engine/session`, { url: l, headers: a } = this.buildGatewayUrlAndHeaders(o, {
|
|
2393
2405
|
"Content-Type": "application/json",
|
|
2394
2406
|
Authorization: `Bearer ${this.sessionToken}`
|
|
2395
|
-
}),
|
|
2407
|
+
}), u = yield fetch(l, {
|
|
2396
2408
|
method: "POST",
|
|
2397
2409
|
headers: a,
|
|
2398
2410
|
body: JSON.stringify({
|
|
2399
2411
|
personaConfig: e,
|
|
2400
2412
|
sessionOptions: n,
|
|
2401
|
-
clientMetadata:
|
|
2413
|
+
clientMetadata: Oi
|
|
2402
2414
|
})
|
|
2403
|
-
}),
|
|
2404
|
-
switch (
|
|
2415
|
+
}), c = yield u.json(), m = c.error;
|
|
2416
|
+
switch (u.status) {
|
|
2405
2417
|
case 200:
|
|
2406
2418
|
case 201:
|
|
2407
|
-
return
|
|
2419
|
+
return c;
|
|
2408
2420
|
case 400:
|
|
2409
|
-
throw new V("Invalid request to start session", j.CLIENT_ERROR_CODE_VALIDATION_ERROR, 400, { cause:
|
|
2421
|
+
throw new V("Invalid request to start session", j.CLIENT_ERROR_CODE_VALIDATION_ERROR, 400, { cause: c.message });
|
|
2410
2422
|
case 401:
|
|
2411
|
-
throw new V("Authentication failed when starting session", j.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 401, { cause:
|
|
2423
|
+
throw new V("Authentication failed when starting session", j.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 401, { cause: c.message });
|
|
2412
2424
|
case 402:
|
|
2413
|
-
throw new V("Please sign up for a plan to start a session", j.CLIENT_ERROR_CODE_NO_PLAN_FOUND, 402, { cause:
|
|
2425
|
+
throw new V("Please sign up for a plan to start a session", j.CLIENT_ERROR_CODE_NO_PLAN_FOUND, 402, { cause: c.message });
|
|
2414
2426
|
case 403:
|
|
2415
|
-
throw new V("Authentication failed when starting session", j.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 403, { cause:
|
|
2427
|
+
throw new V("Authentication failed when starting session", j.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 403, { cause: c.message });
|
|
2416
2428
|
case 429:
|
|
2417
|
-
throw m === "Concurrent session limit reached" ? new V("Concurrency limit reached, please upgrade your plan", j.CLIENT_ERROR_CODE_MAX_CONCURRENT_SESSIONS_REACHED, 429, { cause:
|
|
2429
|
+
throw m === "Concurrent session limit reached" ? new V("Concurrency limit reached, please upgrade your plan", j.CLIENT_ERROR_CODE_MAX_CONCURRENT_SESSIONS_REACHED, 429, { cause: c.message }) : m === "Spend cap reached" ? new V("Spend cap reached, please upgrade your plan", j.CLIENT_ERROR_CODE_SPEND_CAP_REACHED, 429, { cause: c.message }) : new V("Usage limit reached, please upgrade your plan", j.CLIENT_ERROR_CODE_USAGE_LIMIT_REACHED, 429, { cause: c.message });
|
|
2418
2430
|
case 503:
|
|
2419
|
-
throw new V("There are no available personas, please try again later", j.CLIENT_ERROR_CODE_SERVICE_BUSY, 503, { cause:
|
|
2431
|
+
throw new V("There are no available personas, please try again later", j.CLIENT_ERROR_CODE_SERVICE_BUSY, 503, { cause: c.message });
|
|
2420
2432
|
default:
|
|
2421
|
-
throw new V("Unknown error when starting session", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, { cause:
|
|
2433
|
+
throw new V("Unknown error when starting session", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, { cause: c.message });
|
|
2422
2434
|
}
|
|
2423
2435
|
} catch (o) {
|
|
2424
2436
|
throw o instanceof V ? o : new V("Failed to start session", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, { cause: o instanceof Error ? o.message : String(o) });
|
|
@@ -2426,20 +2438,20 @@ class Jn {
|
|
|
2426
2438
|
});
|
|
2427
2439
|
}
|
|
2428
2440
|
unsafe_getSessionToken(e) {
|
|
2429
|
-
return
|
|
2441
|
+
return Zt(this, void 0, void 0, function* () {
|
|
2430
2442
|
if (console.warn("Using unsecure method. This method should not be used in production."), !this.apiKey)
|
|
2431
2443
|
throw new Error("No apiKey provided");
|
|
2432
2444
|
e && "brainType" in e && console.warn("Warning: brainType is deprecated and will be removed in a future version. Please use llmId instead.");
|
|
2433
2445
|
let n = {
|
|
2434
2446
|
clientLabel: "js-sdk-api-key"
|
|
2435
2447
|
};
|
|
2436
|
-
|
|
2448
|
+
Bn(e) && (n = Object.assign(Object.assign({}, n), { personaConfig: e }));
|
|
2437
2449
|
try {
|
|
2438
|
-
const o = `${this.apiVersion}/auth/session-token`, { url:
|
|
2450
|
+
const o = `${this.apiVersion}/auth/session-token`, { url: l, headers: a } = this.buildGatewayUrlAndHeaders(o, {
|
|
2439
2451
|
"Content-Type": "application/json",
|
|
2440
2452
|
Authorization: `Bearer ${this.apiKey}`
|
|
2441
2453
|
});
|
|
2442
|
-
return (yield (yield fetch(
|
|
2454
|
+
return (yield (yield fetch(l, {
|
|
2443
2455
|
method: "POST",
|
|
2444
2456
|
headers: a,
|
|
2445
2457
|
body: JSON.stringify(n)
|
|
@@ -2453,52 +2465,52 @@ class Jn {
|
|
|
2453
2465
|
return `${this.baseUrl}${this.apiVersion}`;
|
|
2454
2466
|
}
|
|
2455
2467
|
}
|
|
2456
|
-
var
|
|
2457
|
-
function
|
|
2458
|
-
return a instanceof n ? a : new n(function(
|
|
2459
|
-
|
|
2468
|
+
var Fn = function(t, e, n, o) {
|
|
2469
|
+
function l(a) {
|
|
2470
|
+
return a instanceof n ? a : new n(function(u) {
|
|
2471
|
+
u(a);
|
|
2460
2472
|
});
|
|
2461
2473
|
}
|
|
2462
|
-
return new (n || (n = Promise))(function(a,
|
|
2463
|
-
function
|
|
2474
|
+
return new (n || (n = Promise))(function(a, u) {
|
|
2475
|
+
function c(_) {
|
|
2464
2476
|
try {
|
|
2465
2477
|
p(o.next(_));
|
|
2466
2478
|
} catch (d) {
|
|
2467
|
-
|
|
2479
|
+
u(d);
|
|
2468
2480
|
}
|
|
2469
2481
|
}
|
|
2470
2482
|
function m(_) {
|
|
2471
2483
|
try {
|
|
2472
2484
|
p(o.throw(_));
|
|
2473
2485
|
} catch (d) {
|
|
2474
|
-
|
|
2486
|
+
u(d);
|
|
2475
2487
|
}
|
|
2476
2488
|
}
|
|
2477
2489
|
function p(_) {
|
|
2478
|
-
_.done ? a(_.value) :
|
|
2490
|
+
_.done ? a(_.value) : l(_.value).then(c, m);
|
|
2479
2491
|
}
|
|
2480
2492
|
p((o = o.apply(t, e || [])).next());
|
|
2481
2493
|
});
|
|
2482
2494
|
};
|
|
2483
|
-
class
|
|
2495
|
+
class $n {
|
|
2484
2496
|
constructor(e, n, o) {
|
|
2485
2497
|
this.baseUrl = e, this.sessionId = n, this.apiGatewayConfig = o;
|
|
2486
2498
|
}
|
|
2487
2499
|
sendTalkCommand(e) {
|
|
2488
|
-
return
|
|
2500
|
+
return Fn(this, void 0, void 0, function* () {
|
|
2489
2501
|
var n, o;
|
|
2490
2502
|
try {
|
|
2491
|
-
let
|
|
2503
|
+
let l, a = {
|
|
2492
2504
|
"Content-Type": "application/json"
|
|
2493
2505
|
};
|
|
2494
|
-
const
|
|
2506
|
+
const u = "/talk", c = `?session_id=${this.sessionId}`;
|
|
2495
2507
|
if (!((n = this.apiGatewayConfig) === null || n === void 0) && n.enabled && (!((o = this.apiGatewayConfig) === null || o === void 0) && o.baseUrl)) {
|
|
2496
|
-
|
|
2497
|
-
const p = new URL(`${this.baseUrl}${
|
|
2508
|
+
l = `${this.apiGatewayConfig.baseUrl}${u}${c}`;
|
|
2509
|
+
const p = new URL(`${this.baseUrl}${u}${c}`);
|
|
2498
2510
|
a["X-Anam-Target-Url"] = p.href;
|
|
2499
2511
|
} else
|
|
2500
|
-
|
|
2501
|
-
const m = yield fetch(
|
|
2512
|
+
l = `${this.baseUrl}${u}${c}`;
|
|
2513
|
+
const m = yield fetch(l, {
|
|
2502
2514
|
method: "POST",
|
|
2503
2515
|
headers: a,
|
|
2504
2516
|
body: JSON.stringify({
|
|
@@ -2507,13 +2519,13 @@ class Zn {
|
|
|
2507
2519
|
});
|
|
2508
2520
|
if (!m.ok)
|
|
2509
2521
|
throw new Error(`Failed to send talk command: ${m.status} ${m.statusText}`);
|
|
2510
|
-
} catch (
|
|
2511
|
-
throw console.error(
|
|
2522
|
+
} catch (l) {
|
|
2523
|
+
throw console.error(l), new Error("EngineApiRestClient - sendTalkCommand: Failed to send talk command");
|
|
2512
2524
|
}
|
|
2513
2525
|
});
|
|
2514
2526
|
}
|
|
2515
2527
|
}
|
|
2516
|
-
class
|
|
2528
|
+
class Vn {
|
|
2517
2529
|
constructor() {
|
|
2518
2530
|
this.listeners = {};
|
|
2519
2531
|
}
|
|
@@ -2529,7 +2541,7 @@ class Qn {
|
|
|
2529
2541
|
});
|
|
2530
2542
|
}
|
|
2531
2543
|
}
|
|
2532
|
-
class
|
|
2544
|
+
class Gn {
|
|
2533
2545
|
constructor(e, n) {
|
|
2534
2546
|
this.messages = [], this.publicEventEmitter = e, this.internalEventEmitter = n, this.internalEventEmitter.addListener(X.WEBRTC_CHAT_MESSAGE_RECEIVED, this.processWebRtcTextMessageEvent.bind(this));
|
|
2535
2547
|
}
|
|
@@ -2557,27 +2569,27 @@ class er {
|
|
|
2557
2569
|
content: e.content,
|
|
2558
2570
|
role: e.role,
|
|
2559
2571
|
interrupted: e.interrupted
|
|
2560
|
-
}, o = this.messages.findIndex((
|
|
2572
|
+
}, o = this.messages.findIndex((l) => l.id === n.id);
|
|
2561
2573
|
if (o !== -1) {
|
|
2562
|
-
const
|
|
2563
|
-
this.messages[o] = Object.assign(Object.assign({},
|
|
2574
|
+
const l = this.messages[o];
|
|
2575
|
+
this.messages[o] = Object.assign(Object.assign({}, l), { content: l.content + n.content, interrupted: l.interrupted || n.interrupted });
|
|
2564
2576
|
} else
|
|
2565
2577
|
this.messages.push(n);
|
|
2566
2578
|
}
|
|
2567
2579
|
processWebRtcTextMessageEvent(e) {
|
|
2568
2580
|
const n = this.webRtcTextMessageEventToMessageStreamEvent(e);
|
|
2569
2581
|
switch (this.publicEventEmitter.emit(N.MESSAGE_STREAM_EVENT_RECEIVED, n), n.role) {
|
|
2570
|
-
case
|
|
2582
|
+
case Ke.USER:
|
|
2571
2583
|
this.processUserMessage(n);
|
|
2572
2584
|
break;
|
|
2573
|
-
case
|
|
2585
|
+
case Ke.PERSONA:
|
|
2574
2586
|
this.processPersonaMessage(n);
|
|
2575
2587
|
break;
|
|
2576
2588
|
}
|
|
2577
2589
|
n.endOfSpeech && this.publicEventEmitter.emit(N.MESSAGE_HISTORY_UPDATED, this.messages);
|
|
2578
2590
|
}
|
|
2579
2591
|
}
|
|
2580
|
-
class
|
|
2592
|
+
class jn {
|
|
2581
2593
|
constructor() {
|
|
2582
2594
|
this.listeners = {};
|
|
2583
2595
|
}
|
|
@@ -2588,65 +2600,65 @@ class tr {
|
|
|
2588
2600
|
this.listeners[e] && this.listeners[e].delete(n);
|
|
2589
2601
|
}
|
|
2590
2602
|
emit(e, ...n) {
|
|
2591
|
-
if (e === N.CONNECTION_ESTABLISHED &&
|
|
2592
|
-
const [o,
|
|
2593
|
-
|
|
2603
|
+
if (e === N.CONNECTION_ESTABLISHED && _e(re.CLIENT_METRIC_MEASUREMENT_CONNECTION_ESTABLISHED, "1"), e === N.CONNECTION_CLOSED) {
|
|
2604
|
+
const [o, l] = n;
|
|
2605
|
+
_e(re.CLIENT_METRIC_MEASUREMENT_CONNECTION_CLOSED, o, l ? { details: l } : void 0);
|
|
2594
2606
|
}
|
|
2595
2607
|
this.listeners[e] && this.listeners[e].forEach((o) => {
|
|
2596
2608
|
o(...n);
|
|
2597
2609
|
});
|
|
2598
2610
|
}
|
|
2599
2611
|
}
|
|
2600
|
-
var
|
|
2612
|
+
var q;
|
|
2601
2613
|
(function(t) {
|
|
2602
2614
|
t[t.UNSTARTED = 0] = "UNSTARTED", t[t.STREAMING = 1] = "STREAMING", t[t.INTERRUPTED = 2] = "INTERRUPTED", t[t.ENDED = 3] = "ENDED";
|
|
2603
|
-
})(
|
|
2604
|
-
var
|
|
2605
|
-
function
|
|
2606
|
-
return a instanceof n ? a : new n(function(
|
|
2607
|
-
|
|
2615
|
+
})(q || (q = {}));
|
|
2616
|
+
var st = function(t, e, n, o) {
|
|
2617
|
+
function l(a) {
|
|
2618
|
+
return a instanceof n ? a : new n(function(u) {
|
|
2619
|
+
u(a);
|
|
2608
2620
|
});
|
|
2609
2621
|
}
|
|
2610
|
-
return new (n || (n = Promise))(function(a,
|
|
2611
|
-
function
|
|
2622
|
+
return new (n || (n = Promise))(function(a, u) {
|
|
2623
|
+
function c(_) {
|
|
2612
2624
|
try {
|
|
2613
2625
|
p(o.next(_));
|
|
2614
2626
|
} catch (d) {
|
|
2615
|
-
|
|
2627
|
+
u(d);
|
|
2616
2628
|
}
|
|
2617
2629
|
}
|
|
2618
2630
|
function m(_) {
|
|
2619
2631
|
try {
|
|
2620
2632
|
p(o.throw(_));
|
|
2621
2633
|
} catch (d) {
|
|
2622
|
-
|
|
2634
|
+
u(d);
|
|
2623
2635
|
}
|
|
2624
2636
|
}
|
|
2625
2637
|
function p(_) {
|
|
2626
|
-
_.done ? a(_.value) :
|
|
2638
|
+
_.done ? a(_.value) : l(_.value).then(c, m);
|
|
2627
2639
|
}
|
|
2628
2640
|
p((o = o.apply(t, e || [])).next());
|
|
2629
2641
|
});
|
|
2630
2642
|
};
|
|
2631
|
-
class
|
|
2643
|
+
class Hn {
|
|
2632
2644
|
constructor(e, n, o) {
|
|
2633
|
-
this.state =
|
|
2645
|
+
this.state = q.UNSTARTED, this.correlationId = e, this.internalEventEmitter = n, this.signallingClient = o, this.internalEventEmitter.addListener(X.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this));
|
|
2634
2646
|
}
|
|
2635
2647
|
onDeactivate() {
|
|
2636
2648
|
this.internalEventEmitter.removeListener(X.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this));
|
|
2637
2649
|
}
|
|
2638
2650
|
onSignalMessage(e) {
|
|
2639
|
-
return
|
|
2640
|
-
e.actionType === W.TALK_STREAM_INTERRUPTED && e.payload.correlationId === this.correlationId && (this.state =
|
|
2651
|
+
return st(this, void 0, void 0, function* () {
|
|
2652
|
+
e.actionType === W.TALK_STREAM_INTERRUPTED && e.payload.correlationId === this.correlationId && (this.state = q.INTERRUPTED, this.onDeactivate());
|
|
2641
2653
|
});
|
|
2642
2654
|
}
|
|
2643
2655
|
endMessage() {
|
|
2644
|
-
return
|
|
2645
|
-
if (this.state ===
|
|
2656
|
+
return st(this, void 0, void 0, function* () {
|
|
2657
|
+
if (this.state === q.ENDED) {
|
|
2646
2658
|
console.warn("Talk stream is already ended via end of speech. No need to call endMessage.");
|
|
2647
2659
|
return;
|
|
2648
2660
|
}
|
|
2649
|
-
if (this.state !==
|
|
2661
|
+
if (this.state !== q.STREAMING) {
|
|
2650
2662
|
console.warn("Talk stream is not active state: " + this.state);
|
|
2651
2663
|
return;
|
|
2652
2664
|
}
|
|
@@ -2656,69 +2668,69 @@ class ir {
|
|
|
2656
2668
|
endOfSpeech: !0,
|
|
2657
2669
|
correlationId: this.correlationId
|
|
2658
2670
|
};
|
|
2659
|
-
yield this.signallingClient.sendTalkMessage(e), this.state =
|
|
2671
|
+
yield this.signallingClient.sendTalkMessage(e), this.state = q.ENDED, this.onDeactivate();
|
|
2660
2672
|
});
|
|
2661
2673
|
}
|
|
2662
2674
|
streamMessageChunk(e, n) {
|
|
2663
|
-
return
|
|
2664
|
-
if (this.state !==
|
|
2675
|
+
return st(this, void 0, void 0, function* () {
|
|
2676
|
+
if (this.state !== q.STREAMING && this.state !== q.UNSTARTED)
|
|
2665
2677
|
throw new Error("Talk stream is not in an active state: " + this.state);
|
|
2666
2678
|
const o = {
|
|
2667
2679
|
content: e,
|
|
2668
|
-
startOfSpeech: this.state ===
|
|
2680
|
+
startOfSpeech: this.state === q.UNSTARTED,
|
|
2669
2681
|
endOfSpeech: n,
|
|
2670
2682
|
correlationId: this.correlationId
|
|
2671
2683
|
};
|
|
2672
|
-
this.state = n ?
|
|
2684
|
+
this.state = n ? q.ENDED : q.STREAMING, this.state === q.ENDED && this.onDeactivate(), yield this.signallingClient.sendTalkMessage(o);
|
|
2673
2685
|
});
|
|
2674
2686
|
}
|
|
2675
2687
|
getCorrelationId() {
|
|
2676
2688
|
return this.correlationId;
|
|
2677
2689
|
}
|
|
2678
2690
|
isActive() {
|
|
2679
|
-
return this.state ===
|
|
2691
|
+
return this.state === q.STREAMING || this.state === q.UNSTARTED;
|
|
2680
2692
|
}
|
|
2681
2693
|
getState() {
|
|
2682
2694
|
return this.state;
|
|
2683
2695
|
}
|
|
2684
2696
|
}
|
|
2685
2697
|
var J = function(t, e, n, o) {
|
|
2686
|
-
function
|
|
2687
|
-
return a instanceof n ? a : new n(function(
|
|
2688
|
-
|
|
2698
|
+
function l(a) {
|
|
2699
|
+
return a instanceof n ? a : new n(function(u) {
|
|
2700
|
+
u(a);
|
|
2689
2701
|
});
|
|
2690
2702
|
}
|
|
2691
|
-
return new (n || (n = Promise))(function(a,
|
|
2692
|
-
function
|
|
2703
|
+
return new (n || (n = Promise))(function(a, u) {
|
|
2704
|
+
function c(_) {
|
|
2693
2705
|
try {
|
|
2694
2706
|
p(o.next(_));
|
|
2695
2707
|
} catch (d) {
|
|
2696
|
-
|
|
2708
|
+
u(d);
|
|
2697
2709
|
}
|
|
2698
2710
|
}
|
|
2699
2711
|
function m(_) {
|
|
2700
2712
|
try {
|
|
2701
2713
|
p(o.throw(_));
|
|
2702
2714
|
} catch (d) {
|
|
2703
|
-
|
|
2715
|
+
u(d);
|
|
2704
2716
|
}
|
|
2705
2717
|
}
|
|
2706
2718
|
function p(_) {
|
|
2707
|
-
_.done ? a(_.value) :
|
|
2719
|
+
_.done ? a(_.value) : l(_.value).then(c, m);
|
|
2708
2720
|
}
|
|
2709
2721
|
p((o = o.apply(t, e || [])).next());
|
|
2710
2722
|
});
|
|
2711
2723
|
};
|
|
2712
|
-
const
|
|
2713
|
-
class
|
|
2714
|
-
constructor(e, n, o,
|
|
2715
|
-
var a,
|
|
2724
|
+
const Wn = 15e3, zn = 5e3, qn = 2;
|
|
2725
|
+
class Yn {
|
|
2726
|
+
constructor(e, n, o, l) {
|
|
2727
|
+
var a, u, c, m;
|
|
2716
2728
|
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 = {
|
|
2717
2729
|
isMuted: !1,
|
|
2718
|
-
permissionState:
|
|
2719
|
-
}, this.successMetricPoller = null, this.successMetricFired = !1, this.showPeerConnectionStatsReport = !1, this.peerConnectionStatsReportOutputFormat = "console", this.statsCollectionInterval = null, this.agentAudioInputStream = null, this.publicEventEmitter = o, this.internalEventEmitter =
|
|
2730
|
+
permissionState: ue.NOT_REQUESTED
|
|
2731
|
+
}, this.successMetricPoller = null, this.successMetricFired = !1, this.showPeerConnectionStatsReport = !1, this.peerConnectionStatsReportOutputFormat = "console", this.statsCollectionInterval = null, this.agentAudioInputStream = null, this.publicEventEmitter = o, this.internalEventEmitter = l, this.apiGatewayConfig = n.apiGateway;
|
|
2720
2732
|
const { inputAudio: p } = n;
|
|
2721
|
-
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
|
|
2733
|
+
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 Ln(e, n.signalling, this.publicEventEmitter, this.internalEventEmitter, this.apiGatewayConfig), this.engineApiRestClient = new $n(n.engine.baseUrl, e, this.apiGatewayConfig), this.audioDeviceId = n.inputAudio.audioDeviceId, this.showPeerConnectionStatsReport = (u = (a = n.metrics) === null || a === void 0 ? void 0 : a.showPeerConnectionStatsReport) !== null && u !== void 0 ? u : !1, this.peerConnectionStatsReportOutputFormat = (m = (c = n.metrics) === null || c === void 0 ? void 0 : c.peerConnectionStatsReportOutputFormat) !== null && m !== void 0 ? m : "console";
|
|
2722
2734
|
}
|
|
2723
2735
|
onInputAudioStateChange(e, n) {
|
|
2724
2736
|
e.isMuted !== n.isMuted && (n.isMuted ? this.muteAllAudioTracks() : this.unmuteAllAudioTracks());
|
|
@@ -2744,7 +2756,7 @@ class sr {
|
|
|
2744
2756
|
} catch (e) {
|
|
2745
2757
|
console.error("Failed to collect and send stats:", e);
|
|
2746
2758
|
}
|
|
2747
|
-
}),
|
|
2759
|
+
}), zn));
|
|
2748
2760
|
}
|
|
2749
2761
|
sendClientSideMetrics(e) {
|
|
2750
2762
|
e.forEach((n) => {
|
|
@@ -2762,7 +2774,7 @@ class sr {
|
|
|
2762
2774
|
return;
|
|
2763
2775
|
const e = setTimeout(() => {
|
|
2764
2776
|
this.successMetricPoller && (console.warn("No video frames received, there is a problem with the connection."), clearInterval(this.successMetricPoller), this.successMetricPoller = null);
|
|
2765
|
-
},
|
|
2777
|
+
}, Wn);
|
|
2766
2778
|
this.successMetricPoller = setInterval(() => J(this, void 0, void 0, function* () {
|
|
2767
2779
|
if (!this.peerConnection || this.successMetricFired) {
|
|
2768
2780
|
this.successMetricPoller && clearInterval(this.successMetricPoller), clearTimeout(e);
|
|
@@ -2770,11 +2782,11 @@ class sr {
|
|
|
2770
2782
|
}
|
|
2771
2783
|
try {
|
|
2772
2784
|
const n = yield this.peerConnection.getStats();
|
|
2773
|
-
let o = !1,
|
|
2785
|
+
let o = !1, l = null;
|
|
2774
2786
|
n.forEach((a) => {
|
|
2775
|
-
a.type === "inbound-rtp" && a.kind === "video" && (a.framesDecoded !== void 0 && a.framesDecoded > 0 ? (o = !0,
|
|
2776
|
-
a.bytesReceived > 1e5 && (o = !0,
|
|
2777
|
-
}), o && !this.successMetricFired && (this.successMetricFired = !0,
|
|
2787
|
+
a.type === "inbound-rtp" && a.kind === "video" && (a.framesDecoded !== void 0 && a.framesDecoded > 0 ? (o = !0, l = "framesDecoded") : a.framesReceived !== void 0 && a.framesReceived > 0 ? (o = !0, l = "framesReceived") : a.bytesReceived > 0 && a.packetsReceived > 0 && // Additional check: ensure we've received enough data for actual video
|
|
2788
|
+
a.bytesReceived > 1e5 && (o = !0, l = "bytesReceived"));
|
|
2789
|
+
}), o && !this.successMetricFired && (this.successMetricFired = !0, _e(re.CLIENT_METRIC_MEASUREMENT_SESSION_SUCCESS, "1", l ? { detectionMethod: l } : void 0), this.successMetricPoller && clearInterval(this.successMetricPoller), clearTimeout(e), this.successMetricPoller = null);
|
|
2778
2790
|
} catch {
|
|
2779
2791
|
}
|
|
2780
2792
|
}), 500);
|
|
@@ -2801,8 +2813,8 @@ class sr {
|
|
|
2801
2813
|
throw new Error("StreamingClient - changeAudioInputDevice: deviceId is required");
|
|
2802
2814
|
const n = this.inputAudioState.isMuted;
|
|
2803
2815
|
try {
|
|
2804
|
-
this.inputAudioStream && this.inputAudioStream.getAudioTracks().forEach((
|
|
2805
|
-
|
|
2816
|
+
this.inputAudioStream && this.inputAudioStream.getAudioTracks().forEach((l) => {
|
|
2817
|
+
l.stop();
|
|
2806
2818
|
});
|
|
2807
2819
|
const o = {
|
|
2808
2820
|
echoCancellation: !0,
|
|
@@ -2862,10 +2874,10 @@ class sr {
|
|
|
2862
2874
|
});
|
|
2863
2875
|
}
|
|
2864
2876
|
startTalkMessageStream(e) {
|
|
2865
|
-
return e || (e = Math.random().toString(36).substring(2, 15)), new
|
|
2877
|
+
return e || (e = Math.random().toString(36).substring(2, 15)), new Hn(e, this.internalEventEmitter, this.signallingClient);
|
|
2866
2878
|
}
|
|
2867
2879
|
createAgentAudioInputStream(e) {
|
|
2868
|
-
return this.agentAudioInputStream = new
|
|
2880
|
+
return this.agentAudioInputStream = new Dn(e, this.signallingClient), this.agentAudioInputStream;
|
|
2869
2881
|
}
|
|
2870
2882
|
getAgentAudioInputStream() {
|
|
2871
2883
|
return this.agentAudioInputStream;
|
|
@@ -2874,7 +2886,7 @@ class sr {
|
|
|
2874
2886
|
return J(this, void 0, void 0, function* () {
|
|
2875
2887
|
this.peerConnection = new RTCPeerConnection({
|
|
2876
2888
|
iceServers: this.iceServers,
|
|
2877
|
-
iceCandidatePoolSize:
|
|
2889
|
+
iceCandidatePoolSize: qn
|
|
2878
2890
|
}), 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) => {
|
|
2879
2891
|
console.error("Async microphone permission request failed:", e);
|
|
2880
2892
|
}));
|
|
@@ -2892,20 +2904,20 @@ class sr {
|
|
|
2892
2904
|
yield this.peerConnection.setRemoteDescription(n), this.connectionReceivedAnswer = !0, this.flushRemoteIceCandidateBuffer();
|
|
2893
2905
|
break;
|
|
2894
2906
|
case W.ICE_CANDIDATE:
|
|
2895
|
-
const o = e.payload,
|
|
2896
|
-
this.connectionReceivedAnswer ? yield this.peerConnection.addIceCandidate(
|
|
2907
|
+
const o = e.payload, l = new RTCIceCandidate(o);
|
|
2908
|
+
this.connectionReceivedAnswer ? yield this.peerConnection.addIceCandidate(l) : this.remoteIceCandidateBuffer.push(l);
|
|
2897
2909
|
break;
|
|
2898
2910
|
case W.END_SESSION:
|
|
2899
2911
|
const a = e.payload;
|
|
2900
|
-
this.publicEventEmitter.emit(N.CONNECTION_CLOSED,
|
|
2912
|
+
this.publicEventEmitter.emit(N.CONNECTION_CLOSED, he.SERVER_CLOSED_CONNECTION, a), this.shutdown();
|
|
2901
2913
|
break;
|
|
2902
2914
|
case W.WARNING:
|
|
2903
|
-
const
|
|
2904
|
-
console.warn("Warning received from server: " +
|
|
2915
|
+
const u = e.payload;
|
|
2916
|
+
console.warn("Warning received from server: " + u), this.publicEventEmitter.emit(N.SERVER_WARNING, u);
|
|
2905
2917
|
break;
|
|
2906
2918
|
case W.TALK_STREAM_INTERRUPTED:
|
|
2907
|
-
const
|
|
2908
|
-
this.publicEventEmitter.emit(N.TALK_STREAM_INTERRUPTED,
|
|
2919
|
+
const c = e.payload;
|
|
2920
|
+
this.publicEventEmitter.emit(N.TALK_STREAM_INTERRUPTED, c.correlationId);
|
|
2909
2921
|
break;
|
|
2910
2922
|
case W.SESSION_READY:
|
|
2911
2923
|
const m = e.sessionId;
|
|
@@ -2951,7 +2963,7 @@ class sr {
|
|
|
2951
2963
|
((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."));
|
|
2952
2964
|
}
|
|
2953
2965
|
handleWebrtcFailure(e) {
|
|
2954
|
-
console.error({ message: "StreamingClient - handleWebrtcFailure: ", err: e }), e.name === "NotAllowedError" && e.message === "Permission denied" ? this.publicEventEmitter.emit(N.CONNECTION_CLOSED,
|
|
2966
|
+
console.error({ message: "StreamingClient - handleWebrtcFailure: ", err: e }), e.name === "NotAllowedError" && e.message === "Permission denied" ? this.publicEventEmitter.emit(N.CONNECTION_CLOSED, he.MICROPHONE_PERMISSION_DENIED) : this.publicEventEmitter.emit(N.CONNECTION_CLOSED, he.WEBRTC_FAILURE);
|
|
2955
2967
|
try {
|
|
2956
2968
|
this.stopConnection();
|
|
2957
2969
|
} catch (n) {
|
|
@@ -2964,7 +2976,7 @@ class sr {
|
|
|
2964
2976
|
this.videoElement.srcObject = this.videoStream;
|
|
2965
2977
|
const n = this.videoElement.requestVideoFrameCallback(() => {
|
|
2966
2978
|
var o;
|
|
2967
|
-
(o = this.videoElement) === null || o === void 0 || o.cancelVideoFrameCallback(n), this.publicEventEmitter.emit(N.VIDEO_PLAY_STARTED), this.successMetricFired || (this.successMetricFired = !0,
|
|
2979
|
+
(o = this.videoElement) === null || o === void 0 || o.cancelVideoFrameCallback(n), this.publicEventEmitter.emit(N.VIDEO_PLAY_STARTED), this.successMetricFired || (this.successMetricFired = !0, _e(re.CLIENT_METRIC_MEASUREMENT_SESSION_SUCCESS, "1", { detectionMethod: "videoElement" }));
|
|
2968
2980
|
});
|
|
2969
2981
|
}
|
|
2970
2982
|
} else e.track.kind === "audio" && (this.audioStream = e.streams[0], this.publicEventEmitter.emit(N.AUDIO_STREAM_STARTED, this.audioStream));
|
|
@@ -2990,16 +3002,16 @@ class sr {
|
|
|
2990
3002
|
try {
|
|
2991
3003
|
const o = JSON.parse(n.data);
|
|
2992
3004
|
switch (o.messageType) {
|
|
2993
|
-
case
|
|
3005
|
+
case Oe.SPEECH_TEXT:
|
|
2994
3006
|
this.internalEventEmitter.emit(X.WEBRTC_CHAT_MESSAGE_RECEIVED, o.data);
|
|
2995
3007
|
break;
|
|
2996
|
-
case
|
|
2997
|
-
const
|
|
2998
|
-
this.internalEventEmitter.emit(X.WEBRTC_CLIENT_TOOL_EVENT_RECEIVED,
|
|
2999
|
-
const a =
|
|
3008
|
+
case Oe.CLIENT_TOOL_EVENT:
|
|
3009
|
+
const l = o.data;
|
|
3010
|
+
this.internalEventEmitter.emit(X.WEBRTC_CLIENT_TOOL_EVENT_RECEIVED, l);
|
|
3011
|
+
const a = Kn.WebRTCClientToolEventToClientToolEvent(l);
|
|
3000
3012
|
this.publicEventEmitter.emit(N.CLIENT_TOOL_EVENT_RECEIVED, a);
|
|
3001
3013
|
break;
|
|
3002
|
-
case
|
|
3014
|
+
case Oe.REASONING_TEXT:
|
|
3003
3015
|
this.internalEventEmitter.emit(X.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED, o.data);
|
|
3004
3016
|
break;
|
|
3005
3017
|
// Unknown message types are silently ignored to maintain forward compatibility
|
|
@@ -3017,8 +3029,8 @@ class sr {
|
|
|
3017
3029
|
*/
|
|
3018
3030
|
requestMicrophonePermissionAsync() {
|
|
3019
3031
|
return J(this, void 0, void 0, function* () {
|
|
3020
|
-
if (this.inputAudioState.permissionState !==
|
|
3021
|
-
this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState:
|
|
3032
|
+
if (this.inputAudioState.permissionState !== ue.PENDING) {
|
|
3033
|
+
this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: ue.PENDING }), this.publicEventEmitter.emit(N.MIC_PERMISSION_PENDING);
|
|
3022
3034
|
try {
|
|
3023
3035
|
const e = {
|
|
3024
3036
|
echoCancellation: !0
|
|
@@ -3027,9 +3039,9 @@ class sr {
|
|
|
3027
3039
|
exact: this.audioDeviceId
|
|
3028
3040
|
}), this.inputAudioStream = yield navigator.mediaDevices.getUserMedia({
|
|
3029
3041
|
audio: e
|
|
3030
|
-
}), this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState:
|
|
3042
|
+
}), this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: ue.GRANTED }), this.publicEventEmitter.emit(N.MIC_PERMISSION_GRANTED), yield this.setupAudioTrack();
|
|
3031
3043
|
} catch (e) {
|
|
3032
|
-
console.error("Failed to get microphone permission:", e), this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState:
|
|
3044
|
+
console.error("Failed to get microphone permission:", e), this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: ue.DENIED });
|
|
3033
3045
|
const n = e instanceof Error ? e.message : String(e);
|
|
3034
3046
|
this.publicEventEmitter.emit(N.MIC_PERMISSION_DENIED, n);
|
|
3035
3047
|
}
|
|
@@ -3048,15 +3060,15 @@ class sr {
|
|
|
3048
3060
|
return;
|
|
3049
3061
|
}
|
|
3050
3062
|
this.inputAudioState.isMuted && this.muteAllAudioTracks();
|
|
3051
|
-
const e = this.inputAudioStream.getAudioTracks()[0], o = this.peerConnection.getSenders().find((
|
|
3063
|
+
const e = this.inputAudioStream.getAudioTracks()[0], o = this.peerConnection.getSenders().find((l) => {
|
|
3052
3064
|
var a;
|
|
3053
|
-
return ((a =
|
|
3065
|
+
return ((a = l.track) === null || a === void 0 ? void 0 : a.kind) === "audio" || l.track === null && l.dtmf !== null;
|
|
3054
3066
|
});
|
|
3055
3067
|
if (o)
|
|
3056
3068
|
try {
|
|
3057
3069
|
yield o.replaceTrack(e);
|
|
3058
|
-
} catch (
|
|
3059
|
-
console.error("Failed to replace audio track:",
|
|
3070
|
+
} catch (l) {
|
|
3071
|
+
console.error("Failed to replace audio track:", l), this.peerConnection.addTrack(e, this.inputAudioStream);
|
|
3060
3072
|
}
|
|
3061
3073
|
else
|
|
3062
3074
|
this.peerConnection.addTrack(e, this.inputAudioStream);
|
|
@@ -3086,7 +3098,7 @@ class sr {
|
|
|
3086
3098
|
if (this.showPeerConnectionStatsReport) {
|
|
3087
3099
|
const n = yield (e = this.peerConnection) === null || e === void 0 ? void 0 : e.getStats();
|
|
3088
3100
|
if (n) {
|
|
3089
|
-
const o =
|
|
3101
|
+
const o = On(n, this.peerConnectionStatsReportOutputFormat);
|
|
3090
3102
|
o && console.log(o, void 0, 2);
|
|
3091
3103
|
}
|
|
3092
3104
|
}
|
|
@@ -3111,7 +3123,7 @@ class sr {
|
|
|
3111
3123
|
});
|
|
3112
3124
|
}
|
|
3113
3125
|
}
|
|
3114
|
-
class
|
|
3126
|
+
class Kn {
|
|
3115
3127
|
/**
|
|
3116
3128
|
* Converts a WebRtcClientToolEvent to a ClientToolEvent
|
|
3117
3129
|
*/
|
|
@@ -3127,7 +3139,7 @@ class ar {
|
|
|
3127
3139
|
};
|
|
3128
3140
|
}
|
|
3129
3141
|
}
|
|
3130
|
-
class
|
|
3142
|
+
class Jn {
|
|
3131
3143
|
constructor(e, n) {
|
|
3132
3144
|
this.reasoning_messages = [], this.publicEventEmitter = e, this.internalEventEmitter = n, this.internalEventEmitter.addListener(X.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED, this.processWebRtcReasoningTextMessageEvent.bind(this));
|
|
3133
3145
|
}
|
|
@@ -3146,77 +3158,77 @@ class lr {
|
|
|
3146
3158
|
id: n.id,
|
|
3147
3159
|
content: n.content,
|
|
3148
3160
|
role: n.role
|
|
3149
|
-
},
|
|
3150
|
-
if (
|
|
3151
|
-
const a = this.reasoning_messages[
|
|
3152
|
-
a.content += o.content, this.reasoning_messages[
|
|
3161
|
+
}, l = this.reasoning_messages.findIndex((a) => a.id === o.id);
|
|
3162
|
+
if (l !== -1) {
|
|
3163
|
+
const a = this.reasoning_messages[l];
|
|
3164
|
+
a.content += o.content, this.reasoning_messages[l] = a;
|
|
3153
3165
|
} else
|
|
3154
3166
|
this.reasoning_messages.push(o);
|
|
3155
3167
|
n.endOfThought && this.publicEventEmitter.emit(N.REASONING_HISTORY_UPDATED, this.reasoning_messages);
|
|
3156
3168
|
}
|
|
3157
3169
|
}
|
|
3158
|
-
var
|
|
3159
|
-
function
|
|
3160
|
-
return a instanceof n ? a : new n(function(
|
|
3161
|
-
|
|
3170
|
+
var ae = function(t, e, n, o) {
|
|
3171
|
+
function l(a) {
|
|
3172
|
+
return a instanceof n ? a : new n(function(u) {
|
|
3173
|
+
u(a);
|
|
3162
3174
|
});
|
|
3163
3175
|
}
|
|
3164
|
-
return new (n || (n = Promise))(function(a,
|
|
3165
|
-
function
|
|
3176
|
+
return new (n || (n = Promise))(function(a, u) {
|
|
3177
|
+
function c(_) {
|
|
3166
3178
|
try {
|
|
3167
3179
|
p(o.next(_));
|
|
3168
3180
|
} catch (d) {
|
|
3169
|
-
|
|
3181
|
+
u(d);
|
|
3170
3182
|
}
|
|
3171
3183
|
}
|
|
3172
3184
|
function m(_) {
|
|
3173
3185
|
try {
|
|
3174
3186
|
p(o.throw(_));
|
|
3175
3187
|
} catch (d) {
|
|
3176
|
-
|
|
3188
|
+
u(d);
|
|
3177
3189
|
}
|
|
3178
3190
|
}
|
|
3179
3191
|
function p(_) {
|
|
3180
|
-
_.done ? a(_.value) :
|
|
3192
|
+
_.done ? a(_.value) : l(_.value).then(c, m);
|
|
3181
3193
|
}
|
|
3182
3194
|
p((o = o.apply(t, e || [])).next());
|
|
3183
3195
|
});
|
|
3184
3196
|
};
|
|
3185
|
-
class
|
|
3197
|
+
class Xn {
|
|
3186
3198
|
constructor(e, n, o) {
|
|
3187
|
-
var
|
|
3199
|
+
var l, a, u, c, m;
|
|
3188
3200
|
this.inputAudioState = {
|
|
3189
3201
|
isMuted: !1,
|
|
3190
|
-
permissionState:
|
|
3202
|
+
permissionState: ue.NOT_REQUESTED
|
|
3191
3203
|
}, this.sessionId = null, this.organizationId = null, this.streamingClient = null, this._isStreaming = !1;
|
|
3192
3204
|
const p = this.validateClientConfig(e, n, o);
|
|
3193
3205
|
if (p)
|
|
3194
3206
|
throw new V(p, j.CLIENT_ERROR_CODE_CONFIGURATION_ERROR, 400);
|
|
3195
|
-
this.personaConfig = n, this.clientOptions = o, (!((
|
|
3207
|
+
this.personaConfig = n, this.clientOptions = o, (!((l = o?.api) === null || l === void 0) && l.baseUrl || !((a = o?.api) === null || a === void 0) && a.apiVersion) && Rn(o.api.baseUrl || ki, o.api.apiVersion || wt), !((c = (u = o?.api) === null || u === void 0 ? void 0 : u.apiGateway) === null || c === void 0) && c.enabled && Nn(o.api.apiGateway), !((m = o?.metrics) === null || m === void 0) && m.disableClientMetrics && xn(!0), this.publicEventEmitter = new jn(), this.internalEventEmitter = new Vn(), this.apiClient = new Pn(e, o?.apiKey, o?.api), this.messageHistoryClient = new Gn(this.publicEventEmitter, this.internalEventEmitter), this.reasoningHistoryClient = new Jn(this.publicEventEmitter, this.internalEventEmitter);
|
|
3196
3208
|
}
|
|
3197
3209
|
decodeJwt(e) {
|
|
3198
3210
|
try {
|
|
3199
|
-
const n = e.split(".")[1], o =
|
|
3211
|
+
const n = e.split(".")[1], o = In.Buffer.from(n, "base64").toString("utf8");
|
|
3200
3212
|
return JSON.parse(o);
|
|
3201
3213
|
} catch {
|
|
3202
3214
|
throw new Error("Invalid session token format");
|
|
3203
3215
|
}
|
|
3204
3216
|
}
|
|
3205
3217
|
validateClientConfig(e, n, o) {
|
|
3206
|
-
var
|
|
3218
|
+
var l, a;
|
|
3207
3219
|
if (!e && !o?.apiKey)
|
|
3208
3220
|
return "Either sessionToken or apiKey must be provided";
|
|
3209
3221
|
if (o?.apiKey && e)
|
|
3210
3222
|
return "Only one of sessionToken or apiKey should be used";
|
|
3211
|
-
const
|
|
3212
|
-
if (
|
|
3213
|
-
return
|
|
3223
|
+
const u = kn((l = o?.api) === null || l === void 0 ? void 0 : l.apiGateway);
|
|
3224
|
+
if (u)
|
|
3225
|
+
return u;
|
|
3214
3226
|
if (e) {
|
|
3215
|
-
const
|
|
3216
|
-
this.organizationId =
|
|
3227
|
+
const c = this.decodeJwt(e);
|
|
3228
|
+
this.organizationId = c.accountId, ve({
|
|
3217
3229
|
organizationId: this.organizationId
|
|
3218
3230
|
});
|
|
3219
|
-
const m = (a =
|
|
3231
|
+
const m = (a = c.type) === null || a === void 0 ? void 0 : a.toLowerCase();
|
|
3220
3232
|
if (m === "legacy")
|
|
3221
3233
|
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.";
|
|
3222
3234
|
if ((m === "ephemeral" || m === "stateful") && n)
|
|
@@ -3241,45 +3253,45 @@ class cr {
|
|
|
3241
3253
|
return n;
|
|
3242
3254
|
}
|
|
3243
3255
|
startSession(e) {
|
|
3244
|
-
return
|
|
3245
|
-
var n, o,
|
|
3246
|
-
const y = this.personaConfig, C = this.buildStartSessionOptionsForClient(), A = yield this.apiClient.startSession(y, C), { sessionId: I, clientConfig: b, engineHost: R, engineProtocol: M, signallingEndpoint: x } = A, { heartbeatIntervalSeconds: Y, maxWsReconnectionAttempts:
|
|
3247
|
-
this.sessionId = I,
|
|
3256
|
+
return ae(this, void 0, void 0, function* () {
|
|
3257
|
+
var n, o, l, a, u, c, m, p, _, d, S, g;
|
|
3258
|
+
const y = this.personaConfig, C = this.buildStartSessionOptionsForClient(), A = yield this.apiClient.startSession(y, C), { sessionId: I, clientConfig: b, engineHost: R, engineProtocol: M, signallingEndpoint: x } = A, { heartbeatIntervalSeconds: Y, maxWsReconnectionAttempts: te, iceServers: $ } = b;
|
|
3259
|
+
this.sessionId = I, ve({
|
|
3248
3260
|
sessionId: this.sessionId
|
|
3249
3261
|
});
|
|
3250
|
-
const
|
|
3262
|
+
const ie = !((n = this.clientOptions) === null || n === void 0) && n.iceServers ? this.clientOptions.iceServers : $;
|
|
3251
3263
|
try {
|
|
3252
|
-
this.streamingClient = new
|
|
3264
|
+
this.streamingClient = new Yn(I, {
|
|
3253
3265
|
engine: {
|
|
3254
3266
|
baseUrl: `${M}://${R}`
|
|
3255
3267
|
},
|
|
3256
3268
|
signalling: {
|
|
3257
3269
|
heartbeatIntervalSeconds: Y,
|
|
3258
|
-
maxWsReconnectionAttempts:
|
|
3270
|
+
maxWsReconnectionAttempts: te,
|
|
3259
3271
|
url: {
|
|
3260
3272
|
baseUrl: R,
|
|
3261
3273
|
protocol: M,
|
|
3262
3274
|
signallingPath: x
|
|
3263
3275
|
}
|
|
3264
3276
|
},
|
|
3265
|
-
iceServers:
|
|
3277
|
+
iceServers: ie,
|
|
3266
3278
|
inputAudio: {
|
|
3267
3279
|
inputAudioState: this.inputAudioState,
|
|
3268
3280
|
userProvidedMediaStream: !((o = this.clientOptions) === null || o === void 0) && o.disableInputAudio ? void 0 : e,
|
|
3269
|
-
audioDeviceId: (
|
|
3281
|
+
audioDeviceId: (l = this.clientOptions) === null || l === void 0 ? void 0 : l.audioDeviceId,
|
|
3270
3282
|
disableInputAudio: (a = this.clientOptions) === null || a === void 0 ? void 0 : a.disableInputAudio
|
|
3271
3283
|
},
|
|
3272
|
-
apiGateway: (
|
|
3284
|
+
apiGateway: (c = (u = this.clientOptions) === null || u === void 0 ? void 0 : u.api) === null || c === void 0 ? void 0 : c.apiGateway,
|
|
3273
3285
|
metrics: {
|
|
3274
3286
|
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,
|
|
3275
3287
|
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"
|
|
3276
3288
|
}
|
|
3277
3289
|
}, this.publicEventEmitter, this.internalEventEmitter);
|
|
3278
|
-
} catch (
|
|
3279
|
-
throw
|
|
3290
|
+
} catch (ne) {
|
|
3291
|
+
throw ve({
|
|
3280
3292
|
sessionId: null
|
|
3281
3293
|
}), new V("Failed to initialize streaming client", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
|
|
3282
|
-
cause:
|
|
3294
|
+
cause: ne instanceof Error ? ne.message : String(ne),
|
|
3283
3295
|
sessionId: I
|
|
3284
3296
|
});
|
|
3285
3297
|
}
|
|
@@ -3287,7 +3299,7 @@ class cr {
|
|
|
3287
3299
|
});
|
|
3288
3300
|
}
|
|
3289
3301
|
startSessionIfNeeded(e) {
|
|
3290
|
-
return
|
|
3302
|
+
return ae(this, void 0, void 0, function* () {
|
|
3291
3303
|
if ((!this.sessionId || !this.streamingClient) && (yield this.startSession(e), !this.sessionId || !this.streamingClient))
|
|
3292
3304
|
throw new V("Session ID or streaming client is not available after starting session", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
|
|
3293
3305
|
cause: "Failed to initialize session properly"
|
|
@@ -3295,23 +3307,23 @@ class cr {
|
|
|
3295
3307
|
});
|
|
3296
3308
|
}
|
|
3297
3309
|
stream(e) {
|
|
3298
|
-
return
|
|
3310
|
+
return ae(this, void 0, void 0, function* () {
|
|
3299
3311
|
var n;
|
|
3300
3312
|
if (this._isStreaming)
|
|
3301
3313
|
throw new Error("Already streaming");
|
|
3302
|
-
const o =
|
|
3303
|
-
return
|
|
3314
|
+
const o = Xt();
|
|
3315
|
+
return ve({
|
|
3304
3316
|
attemptCorrelationId: o,
|
|
3305
3317
|
sessionId: null
|
|
3306
3318
|
// reset sessionId
|
|
3307
|
-
}),
|
|
3319
|
+
}), _e(re.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((l) => {
|
|
3308
3320
|
var a;
|
|
3309
|
-
const
|
|
3310
|
-
let
|
|
3321
|
+
const u = [];
|
|
3322
|
+
let c = !1, m = !1;
|
|
3311
3323
|
this.publicEventEmitter.addListener(N.VIDEO_STREAM_STARTED, (p) => {
|
|
3312
|
-
|
|
3324
|
+
u.push(p), c = !0, m && l(u);
|
|
3313
3325
|
}), this.publicEventEmitter.addListener(N.AUDIO_STREAM_STARTED, (p) => {
|
|
3314
|
-
|
|
3326
|
+
u.push(p), m = !0, c && l(u);
|
|
3315
3327
|
}), (a = this.streamingClient) === null || a === void 0 || a.startConnection();
|
|
3316
3328
|
});
|
|
3317
3329
|
});
|
|
@@ -3320,19 +3332,19 @@ class cr {
|
|
|
3320
3332
|
* @deprecated This method is deprecated. Please use streamToVideoElement instead.
|
|
3321
3333
|
*/
|
|
3322
3334
|
streamToVideoAndAudioElements(e, n, o) {
|
|
3323
|
-
return
|
|
3335
|
+
return ae(this, void 0, void 0, function* () {
|
|
3324
3336
|
console.warn("AnamClient: streamToVideoAndAudioElements is deprecated. To avoid possible audio issues, please use streamToVideoElement instead."), yield this.streamToVideoElement(e, o);
|
|
3325
3337
|
});
|
|
3326
3338
|
}
|
|
3327
3339
|
streamToVideoElement(e, n) {
|
|
3328
|
-
return
|
|
3340
|
+
return ae(this, void 0, void 0, function* () {
|
|
3329
3341
|
var o;
|
|
3330
|
-
const
|
|
3331
|
-
|
|
3332
|
-
attemptCorrelationId:
|
|
3342
|
+
const l = Xt();
|
|
3343
|
+
ve({
|
|
3344
|
+
attemptCorrelationId: l,
|
|
3333
3345
|
sessionId: null
|
|
3334
3346
|
// reset sessionId
|
|
3335
|
-
}),
|
|
3347
|
+
}), _e(re.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.");
|
|
3336
3348
|
try {
|
|
3337
3349
|
yield this.startSessionIfNeeded(n);
|
|
3338
3350
|
} catch (a) {
|
|
@@ -3354,7 +3366,7 @@ class cr {
|
|
|
3354
3366
|
* @throws Error if session is not started or not currently streaming
|
|
3355
3367
|
*/
|
|
3356
3368
|
talk(e) {
|
|
3357
|
-
return
|
|
3369
|
+
return ae(this, void 0, void 0, function* () {
|
|
3358
3370
|
if (!this.streamingClient)
|
|
3359
3371
|
throw new Error("Failed to send talk command: session is not started. Have you called startSession?");
|
|
3360
3372
|
if (!this._isStreaming)
|
|
@@ -3384,13 +3396,13 @@ class cr {
|
|
|
3384
3396
|
const n = this.getActiveSessionId();
|
|
3385
3397
|
if (!n)
|
|
3386
3398
|
throw new Error("Failed to send user message: no active session");
|
|
3387
|
-
const o = (/* @__PURE__ */ new Date()).toISOString().replace("Z", ""),
|
|
3399
|
+
const o = (/* @__PURE__ */ new Date()).toISOString().replace("Z", ""), l = JSON.stringify({
|
|
3388
3400
|
content: e,
|
|
3389
3401
|
timestamp: o,
|
|
3390
3402
|
session_id: n,
|
|
3391
3403
|
message_type: "speech"
|
|
3392
3404
|
});
|
|
3393
|
-
this.sendDataMessage(
|
|
3405
|
+
this.sendDataMessage(l);
|
|
3394
3406
|
}
|
|
3395
3407
|
interruptPersona() {
|
|
3396
3408
|
if (!this._isStreaming)
|
|
@@ -3407,8 +3419,8 @@ class cr {
|
|
|
3407
3419
|
this.sendDataMessage(n);
|
|
3408
3420
|
}
|
|
3409
3421
|
stopStreaming() {
|
|
3410
|
-
return
|
|
3411
|
-
this.streamingClient && (this.publicEventEmitter.emit(N.CONNECTION_CLOSED,
|
|
3422
|
+
return ae(this, void 0, void 0, function* () {
|
|
3423
|
+
this.streamingClient && (this.publicEventEmitter.emit(N.CONNECTION_CLOSED, he.NORMAL), yield this.streamingClient.stopConnection(), this.streamingClient = null, this.sessionId = null, ve({
|
|
3412
3424
|
attemptCorrelationId: null,
|
|
3413
3425
|
sessionId: null,
|
|
3414
3426
|
organizationId: this.organizationId
|
|
@@ -3437,7 +3449,7 @@ class cr {
|
|
|
3437
3449
|
return !((e = this.clientOptions) === null || e === void 0) && e.disableInputAudio && console.warn("AnamClient: Input audio is disabled. Unmuting input audio will have no effect."), this.streamingClient && !(!((n = this.clientOptions) === null || n === void 0) && n.disableInputAudio) ? this.inputAudioState = this.streamingClient.unmuteInputAudio() : this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { isMuted: !1 }), this.inputAudioState;
|
|
3438
3450
|
}
|
|
3439
3451
|
changeAudioInputDevice(e) {
|
|
3440
|
-
return
|
|
3452
|
+
return ae(this, void 0, void 0, function* () {
|
|
3441
3453
|
var n;
|
|
3442
3454
|
if (!((n = this.clientOptions) === null || n === void 0) && n.disableInputAudio)
|
|
3443
3455
|
throw new Error("AnamClient: Cannot change audio input device because input audio is disabled.");
|
|
@@ -3473,8 +3485,11 @@ class cr {
|
|
|
3473
3485
|
return this.sessionId;
|
|
3474
3486
|
}
|
|
3475
3487
|
}
|
|
3476
|
-
const
|
|
3477
|
-
function
|
|
3488
|
+
const Zn = (t, e) => new Xn(t, void 0, e), Qn = "https://api.anam.ai";
|
|
3489
|
+
function Ui(t) {
|
|
3490
|
+
return /^[a-zA-Z0-9_-]{1,128}$/.test(t);
|
|
3491
|
+
}
|
|
3492
|
+
function er(t) {
|
|
3478
3493
|
try {
|
|
3479
3494
|
const e = t.split(".")[1];
|
|
3480
3495
|
return JSON.parse(atob(e));
|
|
@@ -3482,178 +3497,221 @@ function hr(t) {
|
|
|
3482
3497
|
return {};
|
|
3483
3498
|
}
|
|
3484
3499
|
}
|
|
3485
|
-
|
|
3486
|
-
function fr(t, e) {
|
|
3500
|
+
function tr(t, e) {
|
|
3487
3501
|
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.";
|
|
3488
3502
|
}
|
|
3489
|
-
|
|
3490
|
-
|
|
3503
|
+
function ir() {
|
|
3504
|
+
return {
|
|
3505
|
+
client: z(null),
|
|
3506
|
+
connectionStatus: z("idle"),
|
|
3507
|
+
isStreaming: z(!1),
|
|
3508
|
+
isMuted: z(!1),
|
|
3509
|
+
messages: z([]),
|
|
3510
|
+
error: z(null),
|
|
3511
|
+
sessionId: z(null),
|
|
3512
|
+
avatarThumbnailUrl: z(null),
|
|
3513
|
+
avatarVideoUrl: z(null),
|
|
3514
|
+
personaName: z(null),
|
|
3515
|
+
serverConfig: z(null),
|
|
3516
|
+
isConfigured: z(!1),
|
|
3517
|
+
isReady: z(!1),
|
|
3518
|
+
generation: 0
|
|
3519
|
+
};
|
|
3520
|
+
}
|
|
3521
|
+
async function nr(t, e, n) {
|
|
3522
|
+
if (t.isReady.value = !1, !Ui(e)) {
|
|
3523
|
+
console.warn("[AnamWidget] Invalid agent ID format:", e), t.isReady.value = !0;
|
|
3524
|
+
return;
|
|
3525
|
+
}
|
|
3491
3526
|
try {
|
|
3492
|
-
const
|
|
3493
|
-
if (!
|
|
3494
|
-
const
|
|
3495
|
-
|
|
3527
|
+
const o = await fetch(`${n}/v1/personas/${e}/widget`);
|
|
3528
|
+
if (!o.ok) return;
|
|
3529
|
+
const l = await o.json();
|
|
3530
|
+
t.avatarThumbnailUrl.value = l.persona?.avatarImageUrl || null, t.avatarVideoUrl.value = l.persona?.avatarVideoUrl || null, t.personaName.value = l.persona?.name || null, t.serverConfig.value = l.widgetConfig || null;
|
|
3496
3531
|
} catch {
|
|
3497
3532
|
} finally {
|
|
3498
|
-
|
|
3533
|
+
t.isReady.value = !0;
|
|
3499
3534
|
}
|
|
3500
3535
|
}
|
|
3501
|
-
async function
|
|
3502
|
-
if (
|
|
3536
|
+
async function rr(t, e, n, o, l) {
|
|
3537
|
+
if (t.connectionStatus.value === "connecting" || t.connectionStatus.value === "connected")
|
|
3503
3538
|
return;
|
|
3504
|
-
|
|
3539
|
+
const a = ++t.generation;
|
|
3540
|
+
t.connectionStatus.value = "connecting", t.error.value = null;
|
|
3505
3541
|
let u;
|
|
3506
3542
|
try {
|
|
3507
|
-
let
|
|
3508
|
-
if (
|
|
3509
|
-
console.log("[AnamWidget] Using pre-created session token"),
|
|
3543
|
+
let c;
|
|
3544
|
+
if (l)
|
|
3545
|
+
console.log("[AnamWidget] Using pre-created session token"), c = l;
|
|
3510
3546
|
else {
|
|
3511
|
-
|
|
3512
|
-
|
|
3547
|
+
if (!Ui(e))
|
|
3548
|
+
throw new Error("Invalid agent ID format");
|
|
3549
|
+
console.log("[AnamWidget] Fetching session for agent:", e);
|
|
3550
|
+
const _ = await fetch(`${n}/v1/auth/widget`, {
|
|
3513
3551
|
method: "POST",
|
|
3514
3552
|
headers: { "Content-Type": "application/json" },
|
|
3515
|
-
body: JSON.stringify({ agentId:
|
|
3553
|
+
body: JSON.stringify({ agentId: e })
|
|
3516
3554
|
});
|
|
3517
|
-
if (
|
|
3518
|
-
|
|
3519
|
-
|
|
3555
|
+
if (a !== t.generation) return;
|
|
3556
|
+
if (u = _.status, !_.ok) {
|
|
3557
|
+
const S = await _.json().catch(() => ({}));
|
|
3558
|
+
throw new Error(S.error || `HTTP ${_.status}`);
|
|
3520
3559
|
}
|
|
3521
|
-
const
|
|
3560
|
+
const d = await _.json();
|
|
3522
3561
|
console.log("[AnamWidget] Got session from agent-id:", {
|
|
3523
|
-
hasToken: !!
|
|
3524
|
-
}),
|
|
3562
|
+
hasToken: !!d.sessionToken
|
|
3563
|
+
}), c = d.sessionToken;
|
|
3525
3564
|
}
|
|
3526
|
-
|
|
3527
|
-
|
|
3565
|
+
if (a !== t.generation) return;
|
|
3566
|
+
const m = Zn(c, {
|
|
3567
|
+
api: n ? { baseUrl: n } : void 0,
|
|
3528
3568
|
metrics: { disableClientMetrics: !0 }
|
|
3529
3569
|
});
|
|
3530
|
-
|
|
3531
|
-
console.log("[AnamWidget] Connection established"),
|
|
3532
|
-
}),
|
|
3533
|
-
console.log("[AnamWidget] Video stream started"),
|
|
3534
|
-
}),
|
|
3570
|
+
m.addListener(N.CONNECTION_ESTABLISHED, () => {
|
|
3571
|
+
a === t.generation && (console.log("[AnamWidget] Connection established"), t.connectionStatus.value = "connected");
|
|
3572
|
+
}), m.addListener(N.VIDEO_STREAM_STARTED, () => {
|
|
3573
|
+
a === t.generation && (console.log("[AnamWidget] Video stream started"), t.isStreaming.value = !0);
|
|
3574
|
+
}), m.addListener(N.AUDIO_STREAM_STARTED, () => {
|
|
3535
3575
|
console.log("[AnamWidget] Audio stream started");
|
|
3536
|
-
}),
|
|
3537
|
-
|
|
3538
|
-
}),
|
|
3539
|
-
console.log("[AnamWidget] Connection closed:",
|
|
3540
|
-
}),
|
|
3541
|
-
console.log("[AnamWidget] Session ready:",
|
|
3542
|
-
})
|
|
3543
|
-
const
|
|
3544
|
-
if (
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3576
|
+
}), m.addListener(N.MESSAGE_HISTORY_UPDATED, (_) => {
|
|
3577
|
+
a === t.generation && (t.messages.value = [..._]);
|
|
3578
|
+
}), m.addListener(N.CONNECTION_CLOSED, (_, d) => {
|
|
3579
|
+
a === t.generation && (console.log("[AnamWidget] Connection closed:", _, d), t.connectionStatus.value = "idle", t.isStreaming.value = !1, t.sessionId.value = null);
|
|
3580
|
+
}), m.addListener(N.SESSION_READY, (_) => {
|
|
3581
|
+
a === t.generation && (console.log("[AnamWidget] Session ready:", _), t.sessionId.value = _);
|
|
3582
|
+
});
|
|
3583
|
+
const p = await m.stream();
|
|
3584
|
+
if (a !== t.generation) {
|
|
3585
|
+
try {
|
|
3586
|
+
await m.stopStreaming();
|
|
3587
|
+
} catch {
|
|
3588
|
+
}
|
|
3589
|
+
return;
|
|
3590
|
+
}
|
|
3591
|
+
if (t.client.value = m, o && p.length > 0) {
|
|
3592
|
+
const _ = p.find((d) => d.getVideoTracks().length > 0);
|
|
3593
|
+
_ && (o.srcObject = _);
|
|
3594
|
+
}
|
|
3595
|
+
} catch (c) {
|
|
3596
|
+
if (a !== t.generation) return;
|
|
3597
|
+
console.error("[AnamWidget] Failed to start session:", c), t.error.value = tr(c, u), t.connectionStatus.value = "error", t.client.value = null;
|
|
3598
|
+
}
|
|
3599
|
+
}
|
|
3600
|
+
async function or(t) {
|
|
3601
|
+
if (t.generation++, t.client.value)
|
|
3554
3602
|
try {
|
|
3555
|
-
await
|
|
3556
|
-
} catch (
|
|
3557
|
-
console.error("[AnamWidget] Failed to stop session:",
|
|
3603
|
+
await t.client.value.stopStreaming();
|
|
3604
|
+
} catch (e) {
|
|
3605
|
+
console.error("[AnamWidget] Failed to stop session:", e);
|
|
3558
3606
|
}
|
|
3559
|
-
|
|
3607
|
+
t.client.value = null, t.connectionStatus.value = "idle", t.isStreaming.value = !1, t.isMuted.value = !1, t.messages.value = [];
|
|
3560
3608
|
}
|
|
3561
|
-
function
|
|
3562
|
-
!
|
|
3609
|
+
function sr(t, e) {
|
|
3610
|
+
!t.client.value || t.connectionStatus.value !== "connected" || t.client.value.sendUserMessage(e);
|
|
3563
3611
|
}
|
|
3564
|
-
function
|
|
3565
|
-
|
|
3612
|
+
function ar(t) {
|
|
3613
|
+
t.client.value && (t.isMuted.value ? (t.client.value.unmuteInputAudio(), t.isMuted.value = !1) : (t.client.value.muteInputAudio(), t.isMuted.value = !0));
|
|
3566
3614
|
}
|
|
3567
|
-
function
|
|
3568
|
-
|
|
3615
|
+
function lr(t) {
|
|
3616
|
+
t.generation++, t.client.value?.isStreaming() && t.client.value.stopStreaming(), t.client.value = null, t.connectionStatus.value = "idle", t.isStreaming.value = !1, t.isMuted.value = !1, t.messages.value = [], t.error.value = null, t.sessionId.value = null, t.avatarThumbnailUrl.value = null, t.avatarVideoUrl.value = null, t.personaName.value = null, t.serverConfig.value = null;
|
|
3569
3617
|
}
|
|
3570
|
-
function
|
|
3571
|
-
const o =
|
|
3572
|
-
|
|
3573
|
-
const u =
|
|
3618
|
+
function cr(t, e, n) {
|
|
3619
|
+
const o = ze();
|
|
3620
|
+
o.current || (o.current = ir());
|
|
3621
|
+
const l = o.current, a = t || (n ? er(n).personaId : void 0), u = !!a || !!n;
|
|
3622
|
+
l.isConfigured.value !== u && (l.isConfigured.value = u);
|
|
3623
|
+
const c = e || Qn;
|
|
3574
3624
|
return {
|
|
3575
|
-
connectionStatus:
|
|
3576
|
-
isStreaming:
|
|
3577
|
-
isMuted:
|
|
3578
|
-
messages:
|
|
3579
|
-
error:
|
|
3580
|
-
sessionId:
|
|
3581
|
-
isConfigured:
|
|
3582
|
-
isReady:
|
|
3583
|
-
avatarThumbnailUrl:
|
|
3584
|
-
avatarVideoUrl:
|
|
3585
|
-
personaName:
|
|
3586
|
-
serverConfig:
|
|
3625
|
+
connectionStatus: l.connectionStatus,
|
|
3626
|
+
isStreaming: l.isStreaming,
|
|
3627
|
+
isMuted: l.isMuted,
|
|
3628
|
+
messages: l.messages,
|
|
3629
|
+
error: l.error,
|
|
3630
|
+
sessionId: l.sessionId,
|
|
3631
|
+
isConfigured: l.isConfigured,
|
|
3632
|
+
isReady: l.isReady,
|
|
3633
|
+
avatarThumbnailUrl: l.avatarThumbnailUrl,
|
|
3634
|
+
avatarVideoUrl: l.avatarVideoUrl,
|
|
3635
|
+
personaName: l.personaName,
|
|
3636
|
+
serverConfig: l.serverConfig,
|
|
3587
3637
|
fetchWidgetConfig: () => {
|
|
3588
|
-
if (!
|
|
3589
|
-
|
|
3638
|
+
if (!a) {
|
|
3639
|
+
l.isReady.value = !0;
|
|
3590
3640
|
return;
|
|
3591
3641
|
}
|
|
3592
|
-
|
|
3642
|
+
nr(l, a, c);
|
|
3593
3643
|
},
|
|
3594
|
-
startSession: (
|
|
3595
|
-
stopSession:
|
|
3596
|
-
sendMessage:
|
|
3597
|
-
toggleMute:
|
|
3598
|
-
cleanup:
|
|
3644
|
+
startSession: (m) => !a && !n ? (l.error.value = "No agent ID or session token configured", Promise.resolve()) : rr(l, a || "", c, m, n),
|
|
3645
|
+
stopSession: () => or(l),
|
|
3646
|
+
sendMessage: (m) => sr(l, m),
|
|
3647
|
+
toggleMute: () => ar(l),
|
|
3648
|
+
cleanup: () => lr(l)
|
|
3599
3649
|
};
|
|
3600
3650
|
}
|
|
3601
|
-
const hi = '@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}.block{display:block}.flex{display:flex}.inline{display:inline}.flex-shrink{flex-shrink:1}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.border{border-style:var(--tw-border-style);border-width:1px}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}}:host{--anam-trigger-size:80px;--anam-sheet-width:400px;--anam-sheet-height:640px;all:initial;color:#18181b;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:DM Sans,system-ui,-apple-system,sans-serif;font-size:15px;line-height:1.5}@media(max-width:640px){:host{--anam-trigger-size:72px;--anam-sheet-width: calc(100vw - 24px) ;--anam-sheet-height: calc(100dvh - 100px) }}.anam-widget{z-index:9999;font-family:inherit}.anam-widget[data-layout=floating]{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: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-layout=inline] .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-preview-video{object-fit:cover;z-index:1;width:100%;height:100%;display:block;position:absolute;inset:0}.anam-preview-fallback{z-index:0;position:absolute;inset:0}.anam-cta-pill{z-index:2;-webkit-backdrop-filter:blur(8px);color:#fff;letter-spacing:-.01em;cursor:pointer;white-space:nowrap;background:#ffffff24;border:1px solid #ffffff38;border-radius:999px;align-items:center;gap:12px;min-width:200px;padding:12px 26px;font-family:inherit;font-size:16px;font-weight:600;transition:all .2s;display:flex;position:absolute;bottom:20px;left:50%;transform:translate(-50%)}.anam-cta-pill:hover{background:#ffffff38;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 #ffffff38;border-radius:50%;justify-content:center;align-items:center;width:44px;height:44px;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);justify-content:center;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 #ffffff38;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-input-wrap{flex:1;align-items:center;min-width:0;margin-right:56px;display:flex;position:relative}.anam-ctl-input{-webkit-backdrop-filter:blur(8px);color:#fff;background:#ffffff1a;border:1px solid #ffffff38;border-radius:999px;outline:none;width:100%;padding:11px 44px 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}.anam-ctl-send{color:#ffffff80;cursor:pointer;background:0 0;border:none;border-radius:50%;justify-content:center;align-items:center;width:32px;height:32px;padding:0;transition:color .15s;display:flex;position:absolute;right:6px}.anam-ctl-send:hover{color:#fff}.anam-ctl-send:disabled{opacity:.35;cursor:not-allowed}.anam-watermark{z-index:11;opacity:.5;line-height:0;text-decoration:none;transition:opacity .15s;position:absolute;top:16px;left:16px}.anam-watermark:hover{opacity:.8}@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}';
|
|
3602
|
-
|
|
3651
|
+
const ur = '@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}.block{display:block}.flex{display:flex}.inline{display:inline}.flex-shrink{flex-shrink:1}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.border{border-style:var(--tw-border-style);border-width:1px}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}}:host{--anam-trigger-size:80px;--anam-sheet-width:400px;--anam-sheet-height:640px;all:initial;color:#18181b;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:DM Sans,system-ui,-apple-system,sans-serif;font-size:15px;line-height:1.5}@media(max-width:640px){:host{--anam-trigger-size:72px;--anam-sheet-width: calc(100vw - 24px) ;--anam-sheet-height: calc(100dvh - 100px) }}.anam-widget{z-index:9999;font-family:inherit}.anam-widget[data-layout=floating]{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: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-layout=inline] .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-preview-video{object-fit:cover;z-index:1;width:100%;height:100%;display:block;position:absolute;inset:0}.anam-preview-fallback{z-index:0;position:absolute;inset:0}.anam-cta-pill{z-index:2;-webkit-backdrop-filter:blur(8px);color:#fff;letter-spacing:-.01em;cursor:pointer;white-space:nowrap;background:#ffffff24;border:1px solid #ffffff38;border-radius:999px;align-items:center;gap:12px;min-width:200px;padding:12px 26px;font-family:inherit;font-size:16px;font-weight:600;transition:all .2s;display:flex;position:absolute;bottom:20px;left:50%;transform:translate(-50%)}.anam-cta-pill:hover{background:#ffffff38;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 #ffffff38;border-radius:50%;justify-content:center;align-items:center;width:44px;height:44px;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);justify-content:center;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 #ffffff38;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-input-wrap{flex:1;align-items:center;min-width:0;margin-right:56px;display:flex;position:relative}.anam-ctl-input{-webkit-backdrop-filter:blur(8px);color:#fff;background:#ffffff1a;border:1px solid #ffffff38;border-radius:999px;outline:none;width:100%;padding:11px 44px 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}.anam-ctl-send{color:#ffffff80;cursor:pointer;background:0 0;border:none;border-radius:50%;justify-content:center;align-items:center;width:32px;height:32px;padding:0;transition:color .15s;display:flex;position:absolute;right:6px}.anam-ctl-send:hover{color:#fff}.anam-ctl-send:disabled{opacity:.35;cursor:not-allowed}.anam-watermark{z-index:11;opacity:.5;line-height:0;text-decoration:none;transition:opacity .15s;position:absolute;top:16px;left:16px}.anam-watermark:hover{opacity:.8}@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}';
|
|
3652
|
+
class dr extends we {
|
|
3653
|
+
state = { hasError: !1 };
|
|
3654
|
+
static getDerivedStateFromError() {
|
|
3655
|
+
return { hasError: !0 };
|
|
3656
|
+
}
|
|
3657
|
+
componentDidCatch(e) {
|
|
3658
|
+
console.error("[AnamWidget] Render error:", e);
|
|
3659
|
+
}
|
|
3660
|
+
render() {
|
|
3661
|
+
return this.state.hasError ? /* @__PURE__ */ w("div", { class: "anam-overlay-error", children: /* @__PURE__ */ w("div", { class: "anam-overlay-error-text", children: "Widget failed to load" }) }) : this.props.children;
|
|
3662
|
+
}
|
|
3663
|
+
}
|
|
3664
|
+
function pt(t, e) {
|
|
3603
3665
|
const n = { ...t };
|
|
3604
3666
|
for (const o of Object.keys(e)) {
|
|
3605
|
-
const
|
|
3606
|
-
|
|
3667
|
+
const l = e[o];
|
|
3668
|
+
l !== void 0 && (l !== null && typeof l == "object" && !Array.isArray(l) && typeof n[o] == "object" && n[o] !== null && !Array.isArray(n[o]) ? n[o] = pt(n[o], l) : n[o] = l);
|
|
3607
3669
|
}
|
|
3608
3670
|
return n;
|
|
3609
3671
|
}
|
|
3610
|
-
function
|
|
3672
|
+
function at(t) {
|
|
3611
3673
|
if (t !== void 0)
|
|
3612
3674
|
return t === "true";
|
|
3613
3675
|
}
|
|
3614
|
-
function
|
|
3676
|
+
function hr(t) {
|
|
3615
3677
|
const e = {};
|
|
3616
3678
|
t.layout && (e.layout = t.layout), t["initial-state"] && (e.initialState = t["initial-state"]), t.position && (e.position = t.position);
|
|
3617
|
-
const n =
|
|
3679
|
+
const n = at(t["ui-mute-button"]);
|
|
3618
3680
|
n !== void 0 && (e.showMuteButton = n);
|
|
3619
|
-
const o =
|
|
3681
|
+
const o = at(t["ui-text-input"]);
|
|
3620
3682
|
o !== void 0 && (e.showTextInput = o);
|
|
3621
|
-
const
|
|
3622
|
-
return
|
|
3683
|
+
const l = at(t["ui-captions"]);
|
|
3684
|
+
return l !== void 0 && (e.showCaptions = l), t["call-to-action"] && (e.callToAction = t["call-to-action"]), e;
|
|
3623
3685
|
}
|
|
3624
|
-
const
|
|
3686
|
+
const fr = () => /* @__PURE__ */ w("svg", { width: "20", height: "20", 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" }) }), pr = () => /* @__PURE__ */ w("svg", { width: "24", height: "24", 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" }) }), _r = () => /* @__PURE__ */ w("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
|
|
3625
3687
|
/* @__PURE__ */ w("path", { d: "M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z" }),
|
|
3626
3688
|
/* @__PURE__ */ w("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
|
|
3627
3689
|
/* @__PURE__ */ w("line", { x1: "12", y1: "19", x2: "12", y2: "22" })
|
|
3628
|
-
] }),
|
|
3690
|
+
] }), Er = () => /* @__PURE__ */ w("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
|
|
3629
3691
|
/* @__PURE__ */ w("line", { x1: "1", y1: "1", x2: "23", y2: "23" }),
|
|
3630
3692
|
/* @__PURE__ */ w("path", { d: "M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V5a3 3 0 0 0-5.94-.6" }),
|
|
3631
3693
|
/* @__PURE__ */ w("path", { d: "M17 16.95A7 7 0 0 1 5 12v-2m14 0v2c0 .87-.16 1.71-.46 2.49" }),
|
|
3632
3694
|
/* @__PURE__ */ w("line", { x1: "12", y1: "19", x2: "12", y2: "22" })
|
|
3633
|
-
] }),
|
|
3695
|
+
] }), mr = () => /* @__PURE__ */ w("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
|
|
3634
3696
|
/* @__PURE__ */ w("line", { x1: "22", y1: "2", x2: "11", y2: "13" }),
|
|
3635
3697
|
/* @__PURE__ */ w("polygon", { points: "22 2 15 22 11 13 2 9 22 2" })
|
|
3636
|
-
] }),
|
|
3698
|
+
] }), _t = () => /* @__PURE__ */ w("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", style: { opacity: 0.3 }, children: [
|
|
3637
3699
|
/* @__PURE__ */ w("circle", { cx: "24", cy: "18", r: "8", stroke: "white", "stroke-width": "2", fill: "none" }),
|
|
3638
3700
|
/* @__PURE__ */ w("path", { d: "M8 42c0-8.837 7.163-16 16-16s16 7.163 16 16", stroke: "white", "stroke-width": "2", fill: "none" })
|
|
3639
3701
|
] });
|
|
3640
|
-
function
|
|
3702
|
+
function gr({
|
|
3641
3703
|
config: t,
|
|
3642
3704
|
session: e,
|
|
3643
3705
|
videoRef: n,
|
|
3644
3706
|
avatarSrc: o,
|
|
3645
|
-
avatarVideoSrc:
|
|
3707
|
+
avatarVideoSrc: l,
|
|
3646
3708
|
displayCta: a,
|
|
3647
|
-
onCollapse:
|
|
3648
|
-
onStop:
|
|
3709
|
+
onCollapse: u,
|
|
3710
|
+
onStop: c
|
|
3649
3711
|
}) {
|
|
3650
|
-
const m =
|
|
3712
|
+
const m = ze(null), [p, _] = Ve(""), [d, S] = Ve(null), [g, y] = Ve(!1), C = ze(null), A = e.connectionStatus.value === "connected", I = e.connectionStatus.value === "connecting", b = e.connectionStatus.value === "error", R = e.isStreaming.value, M = !I && !A && !b, x = nt(async () => {
|
|
3651
3713
|
n.current && await e.startSession(n.current);
|
|
3652
|
-
}, [e.startSession])
|
|
3653
|
-
je(async () => {
|
|
3654
|
-
await e.stopSession();
|
|
3655
|
-
}, [e.stopSession]);
|
|
3656
|
-
const Y = je(() => {
|
|
3714
|
+
}, [e.startSession]), Y = nt(() => {
|
|
3657
3715
|
if (!p.trim()) return;
|
|
3658
3716
|
const $ = p.trim();
|
|
3659
3717
|
e.sendMessage($), _(""), m.current?.focus(), C.current && clearTimeout(C.current), y(!1), S($), C.current = window.setTimeout(() => {
|
|
@@ -3661,10 +3719,10 @@ function Tr({
|
|
|
3661
3719
|
S(null), y(!1);
|
|
3662
3720
|
}, 400);
|
|
3663
3721
|
}, 2600);
|
|
3664
|
-
}, [p]),
|
|
3722
|
+
}, [p]), te = nt(($) => {
|
|
3665
3723
|
$.key === "Enter" && !$.shiftKey && ($.preventDefault(), Y());
|
|
3666
3724
|
}, [Y]);
|
|
3667
|
-
return
|
|
3725
|
+
return Ge(() => () => {
|
|
3668
3726
|
C.current && clearTimeout(C.current);
|
|
3669
3727
|
}, []), /* @__PURE__ */ w("div", { class: "anam-sheet", children: [
|
|
3670
3728
|
/* @__PURE__ */ w(
|
|
@@ -3680,10 +3738,10 @@ function Tr({
|
|
|
3680
3738
|
M && (e.isConfigured.value ? (
|
|
3681
3739
|
/* Has agent-id: show avatar or placeholder + CTA pill */
|
|
3682
3740
|
/* @__PURE__ */ w("div", { class: "anam-overlay-idle", children: [
|
|
3683
|
-
|
|
3741
|
+
l ? /* @__PURE__ */ w(
|
|
3684
3742
|
"video",
|
|
3685
3743
|
{
|
|
3686
|
-
src:
|
|
3744
|
+
src: l,
|
|
3687
3745
|
autoplay: !0,
|
|
3688
3746
|
loop: !0,
|
|
3689
3747
|
muted: !0,
|
|
@@ -3699,18 +3757,18 @@ function Tr({
|
|
|
3699
3757
|
{
|
|
3700
3758
|
src: o,
|
|
3701
3759
|
alt: "Avatar",
|
|
3702
|
-
class:
|
|
3760
|
+
class: l ? "anam-preview-fallback" : void 0
|
|
3703
3761
|
}
|
|
3704
|
-
) : /* @__PURE__ */ w(
|
|
3762
|
+
) : /* @__PURE__ */ w(_t, {}),
|
|
3705
3763
|
/* @__PURE__ */ w("button", { class: "anam-cta-pill", onClick: x, children: [
|
|
3706
|
-
/* @__PURE__ */ w(
|
|
3764
|
+
/* @__PURE__ */ w(pr, {}),
|
|
3707
3765
|
a
|
|
3708
3766
|
] })
|
|
3709
3767
|
] })
|
|
3710
3768
|
) : (
|
|
3711
3769
|
/* No agent-id: unconfigured overlay */
|
|
3712
3770
|
/* @__PURE__ */ w("div", { class: "anam-overlay-unconfigured", children: [
|
|
3713
|
-
/* @__PURE__ */ w(
|
|
3771
|
+
/* @__PURE__ */ w(_t, {}),
|
|
3714
3772
|
/* @__PURE__ */ w("span", { children: "Agent not configured" })
|
|
3715
3773
|
] })
|
|
3716
3774
|
)),
|
|
@@ -3722,16 +3780,16 @@ function Tr({
|
|
|
3722
3780
|
/* @__PURE__ */ w("div", { class: "anam-overlay-error-text", children: e.error.value || "Something went wrong" }),
|
|
3723
3781
|
/* @__PURE__ */ w("button", { class: "anam-retry-btn", onClick: x, children: "Try Again" })
|
|
3724
3782
|
] }),
|
|
3725
|
-
(
|
|
3783
|
+
(u || c && (A || I || R)) && /* @__PURE__ */ w(
|
|
3726
3784
|
"button",
|
|
3727
3785
|
{
|
|
3728
3786
|
class: "anam-close-btn",
|
|
3729
|
-
onClick:
|
|
3730
|
-
"aria-label":
|
|
3731
|
-
children: /* @__PURE__ */ w(
|
|
3787
|
+
onClick: u || c,
|
|
3788
|
+
"aria-label": u ? "Close" : "End call",
|
|
3789
|
+
children: /* @__PURE__ */ w(fr, {})
|
|
3732
3790
|
}
|
|
3733
3791
|
),
|
|
3734
|
-
(A || R) && /* @__PURE__ */ w(
|
|
3792
|
+
(A || R) && /* @__PURE__ */ w(fe, { children: [
|
|
3735
3793
|
d && /* @__PURE__ */ w("div", { class: `anam-toast ${g ? "anam-toast-out" : ""}`, children: d }),
|
|
3736
3794
|
/* @__PURE__ */ w("div", { class: "anam-control-bar", children: [
|
|
3737
3795
|
t.showMuteButton && /* @__PURE__ */ w(
|
|
@@ -3740,7 +3798,7 @@ function Tr({
|
|
|
3740
3798
|
class: `anam-ctl-btn ${e.isMuted.value ? "anam-ctl-btn-muted" : ""}`,
|
|
3741
3799
|
onClick: () => e.toggleMute(),
|
|
3742
3800
|
"aria-label": e.isMuted.value ? "Unmute" : "Mute",
|
|
3743
|
-
children: e.isMuted.value ? /* @__PURE__ */ w(
|
|
3801
|
+
children: e.isMuted.value ? /* @__PURE__ */ w(Er, {}) : /* @__PURE__ */ w(_r, {})
|
|
3744
3802
|
}
|
|
3745
3803
|
),
|
|
3746
3804
|
t.showTextInput && /* @__PURE__ */ w("div", { class: "anam-ctl-input-wrap", children: [
|
|
@@ -3753,7 +3811,7 @@ function Tr({
|
|
|
3753
3811
|
placeholder: "Type a message...",
|
|
3754
3812
|
value: p,
|
|
3755
3813
|
onInput: ($) => _($.target.value),
|
|
3756
|
-
onKeyDown:
|
|
3814
|
+
onKeyDown: te,
|
|
3757
3815
|
disabled: !A
|
|
3758
3816
|
}
|
|
3759
3817
|
),
|
|
@@ -3764,7 +3822,7 @@ function Tr({
|
|
|
3764
3822
|
onClick: Y,
|
|
3765
3823
|
disabled: !A || !p.trim(),
|
|
3766
3824
|
"aria-label": "Send message",
|
|
3767
|
-
children: /* @__PURE__ */ w(
|
|
3825
|
+
children: /* @__PURE__ */ w(mr, {})
|
|
3768
3826
|
}
|
|
3769
3827
|
)
|
|
3770
3828
|
] })
|
|
@@ -3787,70 +3845,77 @@ function Tr({
|
|
|
3787
3845
|
)
|
|
3788
3846
|
] });
|
|
3789
3847
|
}
|
|
3790
|
-
function
|
|
3791
|
-
|
|
3848
|
+
function vr(t) {
|
|
3849
|
+
return /* @__PURE__ */ w(fe, { children: [
|
|
3850
|
+
/* @__PURE__ */ w("style", { children: ur }),
|
|
3851
|
+
/* @__PURE__ */ w(dr, { children: /* @__PURE__ */ w(yr, { ...t }) })
|
|
3852
|
+
] });
|
|
3853
|
+
}
|
|
3854
|
+
function yr(t) {
|
|
3855
|
+
const e = ze(null);
|
|
3792
3856
|
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.");
|
|
3793
|
-
const n = t["session-token"] ? void 0 : t["agent-id"], o =
|
|
3794
|
-
|
|
3857
|
+
const n = t["session-token"] ? void 0 : t["agent-id"], o = cr(n, t["api-base-url"], t["session-token"]);
|
|
3858
|
+
Ge(() => () => {
|
|
3859
|
+
o.cleanup();
|
|
3860
|
+
}, []);
|
|
3861
|
+
const l = Ce(
|
|
3862
|
+
() => hr(t),
|
|
3795
3863
|
[t.layout, t["initial-state"], t.position, t["ui-mute-button"], t["ui-text-input"], t["ui-captions"], t["call-to-action"]]
|
|
3796
|
-
), a =
|
|
3864
|
+
), a = Ce(() => {
|
|
3797
3865
|
const I = o.serverConfig.value;
|
|
3798
|
-
return
|
|
3799
|
-
}, [o.serverConfig.value,
|
|
3866
|
+
return pt(pt({ ...qt }, I ?? {}), l);
|
|
3867
|
+
}, [o.serverConfig.value, l]), u = Ni(
|
|
3800
3868
|
a.layout === "floating" ? a.initialState : "expanded"
|
|
3801
3869
|
);
|
|
3802
|
-
|
|
3803
|
-
a.layout === "inline" ?
|
|
3804
|
-
}, [a.layout, a.initialState]),
|
|
3870
|
+
Ge(() => {
|
|
3871
|
+
a.layout === "inline" ? u.value = "expanded" : u.value = a.initialState;
|
|
3872
|
+
}, [a.layout, a.initialState]), Ge(() => {
|
|
3805
3873
|
o.fetchWidgetConfig();
|
|
3806
3874
|
}, [n, t["api-base-url"], t["session-token"]]);
|
|
3807
|
-
const
|
|
3875
|
+
const c = t["avatar-url"] || o.avatarThumbnailUrl.value || null, m = t["avatar-video-url"] || o.avatarVideoUrl.value || null, _ = t["agent-name"] || o.personaName.value, d = a.callToAction === qt.callToAction && _ ? `Talk to ${_}` : a.callToAction, S = Ce(() => {
|
|
3808
3876
|
if (a.layout === "inline") return "";
|
|
3809
|
-
const I =
|
|
3877
|
+
const I = yn(a.position);
|
|
3810
3878
|
return Object.entries(I).map(([b, R]) => `${b}: ${R}`).join("; ");
|
|
3811
3879
|
}, [a.layout, a.position]), g = a.layout === "floating", y = () => {
|
|
3812
|
-
|
|
3880
|
+
u.value = "expanded";
|
|
3813
3881
|
}, C = async () => {
|
|
3814
|
-
o.connectionStatus.value !== "idle" && await o.stopSession(),
|
|
3815
|
-
}, A = g ?
|
|
3816
|
-
return o.isReady.value ? /* @__PURE__ */ w(
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
"
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
"
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
}
|
|
3850
|
-
)
|
|
3851
|
-
] }) : /* @__PURE__ */ w("style", { children: hi });
|
|
3882
|
+
o.connectionStatus.value !== "idle" && await o.stopSession(), u.value = "minimized";
|
|
3883
|
+
}, A = g ? u.value === "expanded" : !0;
|
|
3884
|
+
return o.isReady.value ? /* @__PURE__ */ w(
|
|
3885
|
+
"div",
|
|
3886
|
+
{
|
|
3887
|
+
class: "anam-widget",
|
|
3888
|
+
"data-layout": a.layout,
|
|
3889
|
+
"data-state": u.value,
|
|
3890
|
+
style: S,
|
|
3891
|
+
children: [
|
|
3892
|
+
g && u.value === "minimized" && /* @__PURE__ */ w(
|
|
3893
|
+
"button",
|
|
3894
|
+
{
|
|
3895
|
+
class: "anam-trigger",
|
|
3896
|
+
onClick: y,
|
|
3897
|
+
"aria-label": d,
|
|
3898
|
+
children: c ? /* @__PURE__ */ w("img", { src: c, alt: "Avatar" }) : /* @__PURE__ */ w(_t, {})
|
|
3899
|
+
}
|
|
3900
|
+
),
|
|
3901
|
+
A && /* @__PURE__ */ w(
|
|
3902
|
+
gr,
|
|
3903
|
+
{
|
|
3904
|
+
config: a,
|
|
3905
|
+
session: o,
|
|
3906
|
+
videoRef: e,
|
|
3907
|
+
avatarSrc: c,
|
|
3908
|
+
avatarVideoSrc: m,
|
|
3909
|
+
displayCta: d,
|
|
3910
|
+
onCollapse: g ? C : null,
|
|
3911
|
+
onStop: g ? null : () => o.stopSession()
|
|
3912
|
+
}
|
|
3913
|
+
)
|
|
3914
|
+
]
|
|
3915
|
+
}
|
|
3916
|
+
) : null;
|
|
3852
3917
|
}
|
|
3853
|
-
const
|
|
3918
|
+
const Sr = [
|
|
3854
3919
|
"agent-id",
|
|
3855
3920
|
// Persona ID -- required for session streaming + server config fetch
|
|
3856
3921
|
"api-base-url",
|
|
@@ -3877,7 +3942,7 @@ const Nr = [
|
|
|
3877
3942
|
// Override avatar preview video (Lab preview)
|
|
3878
3943
|
"agent-name"
|
|
3879
3944
|
// Override persona name for CTA (Lab preview)
|
|
3880
|
-
],
|
|
3945
|
+
], Cr = {
|
|
3881
3946
|
SESSION_STARTED: "anam-agent:session-started",
|
|
3882
3947
|
SESSION_ENDED: "anam-agent:session-ended",
|
|
3883
3948
|
MESSAGE_RECEIVED: "anam-agent:message-received",
|
|
@@ -3888,14 +3953,14 @@ const Nr = [
|
|
|
3888
3953
|
MIC_MUTED: "anam-agent:mic-muted",
|
|
3889
3954
|
MIC_UNMUTED: "anam-agent:mic-unmuted"
|
|
3890
3955
|
};
|
|
3891
|
-
function
|
|
3892
|
-
|
|
3956
|
+
function Qt(t = "anam-agent") {
|
|
3957
|
+
nn(vr, t, [...Sr], {
|
|
3893
3958
|
shadow: !0
|
|
3894
3959
|
});
|
|
3895
3960
|
}
|
|
3896
|
-
typeof window < "u" && typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", () =>
|
|
3961
|
+
typeof window < "u" && typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", () => Qt()) : Qt());
|
|
3897
3962
|
export {
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3963
|
+
qt as DefaultConfig,
|
|
3964
|
+
Cr as WidgetEventNames,
|
|
3965
|
+
Qt as registerWidget
|
|
3901
3966
|
};
|