@anam-ai/agent-widget 0.8.0-alpha.1 → 0.8.1-alpha.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/dist/index.js +583 -583
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -45,13 +45,13 @@ function rt() {
|
|
|
45
45
|
rt.__r = 0;
|
|
46
46
|
}
|
|
47
47
|
function ki(t, e, i, n, a, s, c, l, m, f, p) {
|
|
48
|
-
var u,
|
|
49
|
-
for (m = Tn(i, e,
|
|
50
|
-
return i.__e =
|
|
48
|
+
var u, T, E, S, b, R, A, w = n && n.__k || xi, O = e.length;
|
|
49
|
+
for (m = Tn(i, e, w, m, O), u = 0; u < O; u++) (E = i.__k[u]) != null && (T = E.__i == -1 ? He : w[E.__i] || He, E.__i = u, R = Ut(t, E, T, a, s, c, l, m, f, p), S = E.__e, E.ref && T.ref != E.ref && (T.ref && Pt(T.ref, null, E), p.push(E.ref, E.__c || S, E)), b == null && S != null && (b = S), (A = !!(4 & E.__u)) || T.__k === E.__k ? m = Li(E, m, t, A) : typeof E.type == "function" && R !== void 0 ? m = R : S && (m = S.nextSibling), E.__u &= -7);
|
|
50
|
+
return i.__e = b, m;
|
|
51
51
|
}
|
|
52
52
|
function Tn(t, e, i, n, a) {
|
|
53
|
-
var s, c, l, m, f, p = i.length, u = p,
|
|
54
|
-
for (t.__k = new Array(a), s = 0; s < a; s++) (c = e[s]) != null && typeof c != "boolean" && typeof c != "function" ? (typeof c == "string" || typeof c == "number" || typeof c == "bigint" || c.constructor == String ? c = t.__k[s] = je(null, c, null, null, null) : lt(c) ? c = t.__k[s] = je(Ce, { children: c }, null, null, null) : c.constructor === void 0 && c.__b > 0 ? c = t.__k[s] = je(c.type, c.props, c.key, c.ref ? c.ref : null, c.__v) : t.__k[s] = c, m = s +
|
|
53
|
+
var s, c, l, m, f, p = i.length, u = p, T = 0;
|
|
54
|
+
for (t.__k = new Array(a), s = 0; s < a; s++) (c = e[s]) != null && typeof c != "boolean" && typeof c != "function" ? (typeof c == "string" || typeof c == "number" || typeof c == "bigint" || c.constructor == String ? c = t.__k[s] = je(null, c, null, null, null) : lt(c) ? c = t.__k[s] = je(Ce, { children: c }, null, null, null) : c.constructor === void 0 && c.__b > 0 ? c = t.__k[s] = je(c.type, c.props, c.key, c.ref ? c.ref : null, c.__v) : t.__k[s] = c, m = s + T, c.__ = t, c.__b = t.__b + 1, l = null, (f = c.__i = yn(c, i, m, u)) != -1 && (u--, (l = i[f]) && (l.__u |= 2)), l == null || l.__v == null ? (f == -1 && (a > p ? T-- : a < p && T++), typeof c.type != "function" && (c.__u |= 4)) : f != m && (f == m - 1 ? T-- : f == m + 1 ? T++ : (f > m ? T-- : T++, c.__u |= 4))) : t.__k[s] = null;
|
|
55
55
|
if (u) for (s = 0; s < p; s++) (l = i[s]) != null && (2 & l.__u) == 0 && (l.__e == n && (n = Le(l)), Ui(l, l));
|
|
56
56
|
return n;
|
|
57
57
|
}
|
|
@@ -107,40 +107,40 @@ function Qt(t) {
|
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
function Ut(t, e, i, n, a, s, c, l, m, f) {
|
|
110
|
-
var p, u,
|
|
110
|
+
var p, u, T, E, S, b, R, A, w, O, k, y, G, I, D, U, J, H = e.type;
|
|
111
111
|
if (e.constructor !== void 0) return null;
|
|
112
112
|
128 & i.__u && (m = !!(32 & i.__u), s = [l = e.__e = i.__e]), (p = M.__b) && p(e);
|
|
113
|
-
e: if (typeof
|
|
114
|
-
if (A = e.props,
|
|
113
|
+
e: if (typeof H == "function") try {
|
|
114
|
+
if (A = e.props, w = "prototype" in H && H.prototype.render, O = (p = H.contextType) && n[p.__c], k = p ? O ? O.props.value : p.__ : n, i.__c ? R = (u = e.__c = i.__c).__ = u.__E : (w ? e.__c = u = new H(A, k) : (e.__c = u = new Ne(A, k), u.constructor = H, u.render = bn), O && O.sub(u), u.state || (u.state = {}), u.__n = n, T = u.__d = !0, u.__h = [], u._sb = []), w && u.__s == null && (u.__s = u.state), w && H.getDerivedStateFromProps != null && (u.__s == u.state && (u.__s = le({}, u.__s)), le(u.__s, H.getDerivedStateFromProps(A, u.__s))), E = u.props, S = u.state, u.__v = e, T) w && H.getDerivedStateFromProps == null && u.componentWillMount != null && u.componentWillMount(), w && u.componentDidMount != null && u.__h.push(u.componentDidMount);
|
|
115
115
|
else {
|
|
116
|
-
if (
|
|
117
|
-
for (e.__v != i.__v && (u.props = A, u.state = u.__s, u.__d = !1), e.__e = i.__e, e.__k = i.__k, e.__k.some(function(
|
|
118
|
-
|
|
119
|
-
}),
|
|
116
|
+
if (w && H.getDerivedStateFromProps == null && A !== E && u.componentWillReceiveProps != null && u.componentWillReceiveProps(A, k), e.__v == i.__v || !u.__e && u.shouldComponentUpdate != null && u.shouldComponentUpdate(A, u.__s, k) === !1) {
|
|
117
|
+
for (e.__v != i.__v && (u.props = A, u.state = u.__s, u.__d = !1), e.__e = i.__e, e.__k = i.__k, e.__k.some(function(ie) {
|
|
118
|
+
ie && (ie.__ = e);
|
|
119
|
+
}), y = 0; y < u._sb.length; y++) u.__h.push(u._sb[y]);
|
|
120
120
|
u._sb = [], u.__h.length && c.push(u);
|
|
121
121
|
break e;
|
|
122
122
|
}
|
|
123
|
-
u.componentWillUpdate != null && u.componentWillUpdate(A, u.__s,
|
|
124
|
-
u.componentDidUpdate(E,
|
|
123
|
+
u.componentWillUpdate != null && u.componentWillUpdate(A, u.__s, k), w && u.componentDidUpdate != null && u.__h.push(function() {
|
|
124
|
+
u.componentDidUpdate(E, S, b);
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
if (u.context =
|
|
128
|
-
for (u.state = u.__s, u.__d = !1,
|
|
127
|
+
if (u.context = k, u.props = A, u.__P = t, u.__e = !1, G = M.__r, I = 0, w) {
|
|
128
|
+
for (u.state = u.__s, u.__d = !1, G && G(e), p = u.render(u.props, u.state, u.context), D = 0; D < u._sb.length; D++) u.__h.push(u._sb[D]);
|
|
129
129
|
u._sb = [];
|
|
130
130
|
} else do
|
|
131
|
-
u.__d = !1,
|
|
132
|
-
while (u.__d && ++
|
|
133
|
-
u.state = u.__s, u.getChildContext != null && (n = le(le({}, n), u.getChildContext())),
|
|
134
|
-
} catch (
|
|
135
|
-
if (e.__v = null, m || s != null) if (
|
|
131
|
+
u.__d = !1, G && G(e), p = u.render(u.props, u.state, u.context), u.state = u.__s;
|
|
132
|
+
while (u.__d && ++I < 25);
|
|
133
|
+
u.state = u.__s, u.getChildContext != null && (n = le(le({}, n), u.getChildContext())), w && !T && u.getSnapshotBeforeUpdate != null && (b = u.getSnapshotBeforeUpdate(E, S)), U = p, p != null && p.type === Ce && p.key == null && (U = Di(p.props.children)), l = ki(t, lt(U) ? U : [U], e, i, n, a, s, c, l, m, f), u.base = e.__e, e.__u &= -161, u.__h.length && c.push(u), R && (u.__E = u.__ = null);
|
|
134
|
+
} catch (ie) {
|
|
135
|
+
if (e.__v = null, m || s != null) if (ie.then) {
|
|
136
136
|
for (e.__u |= m ? 160 : 128; l && l.nodeType == 8 && l.nextSibling; ) l = l.nextSibling;
|
|
137
137
|
s[s.indexOf(l)] = null, e.__e = l;
|
|
138
138
|
} else {
|
|
139
|
-
for (
|
|
139
|
+
for (J = s.length; J--; ) Dt(s[J]);
|
|
140
140
|
wt(e);
|
|
141
141
|
}
|
|
142
|
-
else e.__e = i.__e, e.__k = i.__k,
|
|
143
|
-
M.__e(
|
|
142
|
+
else e.__e = i.__e, e.__k = i.__k, ie.then || wt(e);
|
|
143
|
+
M.__e(ie, e, i);
|
|
144
144
|
}
|
|
145
145
|
else s == null && e.__v == i.__v ? (e.__k = i.__k, e.__e = i.__e) : l = e.__e = In(i.__e, e, i, n, a, s, c, m, f);
|
|
146
146
|
return (p = M.diffed) && p(e), 128 & e.__u ? void 0 : l;
|
|
@@ -164,31 +164,31 @@ function Di(t) {
|
|
|
164
164
|
return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : lt(t) ? t.map(Di) : le({}, t);
|
|
165
165
|
}
|
|
166
166
|
function In(t, e, i, n, a, s, c, l, m) {
|
|
167
|
-
var f, p, u,
|
|
168
|
-
if (
|
|
169
|
-
for (f = 0; f < s.length; f++) if ((E = s[f]) && "setAttribute" in E == !!
|
|
167
|
+
var f, p, u, T, E, S, b, R = i.props || He, A = e.props, w = e.type;
|
|
168
|
+
if (w == "svg" ? a = "http://www.w3.org/2000/svg" : w == "math" ? a = "http://www.w3.org/1998/Math/MathML" : a || (a = "http://www.w3.org/1999/xhtml"), s != null) {
|
|
169
|
+
for (f = 0; f < s.length; f++) if ((E = s[f]) && "setAttribute" in E == !!w && (w ? E.localName == w : E.nodeType == 3)) {
|
|
170
170
|
t = E, s[f] = null;
|
|
171
171
|
break;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
if (t == null) {
|
|
175
|
-
if (
|
|
176
|
-
t = document.createElementNS(a,
|
|
175
|
+
if (w == null) return document.createTextNode(A);
|
|
176
|
+
t = document.createElementNS(a, w, A.is && A), l && (M.__m && M.__m(e, s), l = !1), s = null;
|
|
177
177
|
}
|
|
178
|
-
if (
|
|
178
|
+
if (w == null) R === A || l && t.data == A || (t.data = A);
|
|
179
179
|
else {
|
|
180
|
-
if (s = s && Ke.call(t.childNodes), !l && s != null) for (
|
|
181
|
-
for (f in
|
|
180
|
+
if (s = s && Ke.call(t.childNodes), !l && s != null) for (R = {}, f = 0; f < t.attributes.length; f++) R[(E = t.attributes[f]).name] = E.value;
|
|
181
|
+
for (f in R) if (E = R[f], f != "children") {
|
|
182
182
|
if (f == "dangerouslySetInnerHTML") u = E;
|
|
183
183
|
else if (!(f in A)) {
|
|
184
184
|
if (f == "value" && "defaultValue" in A || f == "checked" && "defaultChecked" in A) continue;
|
|
185
185
|
Qe(t, f, null, E, a);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
for (f in A) E = A[f], f == "children" ?
|
|
188
|
+
for (f in A) E = A[f], f == "children" ? T = E : f == "dangerouslySetInnerHTML" ? p = E : f == "value" ? S = E : f == "checked" ? b = E : l && typeof E != "function" || R[f] === E || Qe(t, f, E, R[f], a);
|
|
189
189
|
if (p) l || u && (p.__html == u.__html || p.__html == t.innerHTML) || (t.innerHTML = p.__html), e.__k = [];
|
|
190
|
-
else if (u && (t.innerHTML = ""), ki(e.type == "template" ? t.content : t, lt(
|
|
191
|
-
l || (f = "value",
|
|
190
|
+
else if (u && (t.innerHTML = ""), ki(e.type == "template" ? t.content : t, lt(T) ? T : [T], e, i, n, w == "foreignObject" ? "http://www.w3.org/1999/xhtml" : a, s, c, s ? s[0] : i.__k && Le(i, 0), l, m), s != null) for (f = s.length; f--; ) Dt(s[f]);
|
|
191
|
+
l || (f = "value", w == "progress" && S == null ? t.removeAttribute("value") : S != null && (S !== t[f] || w == "progress" && !S || w == "option" && S != R[f]) && Qe(t, f, S, R[f], a), f = "checked", b != null && b != t[f] && Qe(t, f, b, R[f], a));
|
|
192
192
|
}
|
|
193
193
|
return t;
|
|
194
194
|
}
|
|
@@ -334,10 +334,10 @@ function C(t, e, i, n, a, s) {
|
|
|
334
334
|
if (typeof t == "function" && (c = t.defaultProps)) for (l in c) m[l] === void 0 && (m[l] = c[l]);
|
|
335
335
|
return M.vnode && M.vnode(f), f;
|
|
336
336
|
}
|
|
337
|
-
var ze,
|
|
337
|
+
var ze, j, _t, ti, qe = 0, Wi = [], z = M, ii = z.__b, ni = z.__r, ri = z.diffed, oi = z.__c, si = z.unmount, ai = z.__;
|
|
338
338
|
function Bt(t, e) {
|
|
339
|
-
|
|
340
|
-
var i =
|
|
339
|
+
z.__h && z.__h(j, t, qe || e), qe = 0;
|
|
340
|
+
var i = j.__H || (j.__H = { __: [], __h: [] });
|
|
341
341
|
return t >= i.__.length && i.__.push({}), i.__[t];
|
|
342
342
|
}
|
|
343
343
|
function Rt(t) {
|
|
@@ -348,38 +348,38 @@ function Mn(t, e, i) {
|
|
|
348
348
|
if (n.t = t, !n.__c && (n.__ = [Gi(void 0, e), function(l) {
|
|
349
349
|
var m = n.__N ? n.__N[0] : n.__[0], f = n.t(m, l);
|
|
350
350
|
m !== f && (n.__N = [f, n.__[1]], n.__c.setState({}));
|
|
351
|
-
}], n.__c =
|
|
351
|
+
}], n.__c = j, !j.__f)) {
|
|
352
352
|
var a = function(l, m, f) {
|
|
353
353
|
if (!n.__c.__H) return !0;
|
|
354
|
-
var p = n.__c.__H.__.filter(function(
|
|
355
|
-
return !!
|
|
354
|
+
var p = n.__c.__H.__.filter(function(T) {
|
|
355
|
+
return !!T.__c;
|
|
356
356
|
});
|
|
357
|
-
if (p.every(function(
|
|
358
|
-
return !
|
|
357
|
+
if (p.every(function(T) {
|
|
358
|
+
return !T.__N;
|
|
359
359
|
})) return !s || s.call(this, l, m, f);
|
|
360
360
|
var u = n.__c.props !== l;
|
|
361
|
-
return p.forEach(function(
|
|
362
|
-
if (
|
|
363
|
-
var E =
|
|
364
|
-
|
|
361
|
+
return p.forEach(function(T) {
|
|
362
|
+
if (T.__N) {
|
|
363
|
+
var E = T.__[0];
|
|
364
|
+
T.__ = T.__N, T.__N = void 0, E !== T.__[0] && (u = !0);
|
|
365
365
|
}
|
|
366
366
|
}), s && s.call(this, l, m, f) || u;
|
|
367
367
|
};
|
|
368
|
-
|
|
369
|
-
var s =
|
|
370
|
-
|
|
368
|
+
j.__f = !0;
|
|
369
|
+
var s = j.shouldComponentUpdate, c = j.componentWillUpdate;
|
|
370
|
+
j.componentWillUpdate = function(l, m, f) {
|
|
371
371
|
if (this.__e) {
|
|
372
372
|
var p = s;
|
|
373
373
|
s = void 0, a(l, m, f), s = p;
|
|
374
374
|
}
|
|
375
375
|
c && c.call(this, l, m, f);
|
|
376
|
-
},
|
|
376
|
+
}, j.shouldComponentUpdate = a;
|
|
377
377
|
}
|
|
378
378
|
return n.__N || n.__;
|
|
379
379
|
}
|
|
380
380
|
function Ie(t, e) {
|
|
381
381
|
var i = Bt(ze++, 3);
|
|
382
|
-
!
|
|
382
|
+
!z.__s && ji(i.__H, e) && (i.__ = t, i.u = e, j.__H.__h.push(i));
|
|
383
383
|
}
|
|
384
384
|
function Ye(t) {
|
|
385
385
|
return qe = 5, ke(function() {
|
|
@@ -399,26 +399,26 @@ function Dn() {
|
|
|
399
399
|
for (var t; t = Wi.shift(); ) if (t.__P && t.__H) try {
|
|
400
400
|
t.__H.__h.forEach(it), t.__H.__h.forEach(At), t.__H.__h = [];
|
|
401
401
|
} catch (e) {
|
|
402
|
-
t.__H.__h = [],
|
|
402
|
+
t.__H.__h = [], z.__e(e, t.__v);
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
},
|
|
405
|
+
z.__b = function(t) {
|
|
406
|
+
j = null, ii && ii(t);
|
|
407
|
+
}, z.__ = function(t, e) {
|
|
408
408
|
t && e.__k && e.__k.__m && (t.__m = e.__k.__m), ai && ai(t, e);
|
|
409
|
-
},
|
|
409
|
+
}, z.__r = function(t) {
|
|
410
410
|
ni && ni(t), ze = 0;
|
|
411
|
-
var e = (
|
|
412
|
-
e && (_t ===
|
|
411
|
+
var e = (j = t.__c).__H;
|
|
412
|
+
e && (_t === j ? (e.__h = [], j.__h = [], e.__.forEach(function(i) {
|
|
413
413
|
i.__N && (i.__ = i.__N), i.u = i.__N = void 0;
|
|
414
|
-
})) : (e.__h.forEach(it), e.__h.forEach(At), e.__h = [], ze = 0)), _t =
|
|
415
|
-
},
|
|
414
|
+
})) : (e.__h.forEach(it), e.__h.forEach(At), e.__h = [], ze = 0)), _t = j;
|
|
415
|
+
}, z.diffed = function(t) {
|
|
416
416
|
ri && ri(t);
|
|
417
417
|
var e = t.__c;
|
|
418
|
-
e && e.__H && (e.__H.__h.length && (Wi.push(e) !== 1 && ti ===
|
|
418
|
+
e && e.__H && (e.__H.__h.length && (Wi.push(e) !== 1 && ti === z.requestAnimationFrame || ((ti = z.requestAnimationFrame) || Un)(Dn)), e.__H.__.forEach(function(i) {
|
|
419
419
|
i.u && (i.__H = i.u), i.u = void 0;
|
|
420
|
-
})), _t =
|
|
421
|
-
},
|
|
420
|
+
})), _t = j = null;
|
|
421
|
+
}, z.__c = function(t, e) {
|
|
422
422
|
e.some(function(i) {
|
|
423
423
|
try {
|
|
424
424
|
i.__h.forEach(it), i.__h = i.__h.filter(function(n) {
|
|
@@ -427,10 +427,10 @@ j.__b = function(t) {
|
|
|
427
427
|
} catch (n) {
|
|
428
428
|
e.some(function(a) {
|
|
429
429
|
a.__h && (a.__h = []);
|
|
430
|
-
}), e = [],
|
|
430
|
+
}), e = [], z.__e(n, i.__v);
|
|
431
431
|
}
|
|
432
432
|
}), oi && oi(t, e);
|
|
433
|
-
},
|
|
433
|
+
}, z.unmount = function(t) {
|
|
434
434
|
si && si(t);
|
|
435
435
|
var e, i = t.__c;
|
|
436
436
|
i && i.__H && (i.__H.__.forEach(function(n) {
|
|
@@ -439,7 +439,7 @@ j.__b = function(t) {
|
|
|
439
439
|
} catch (a) {
|
|
440
440
|
e = a;
|
|
441
441
|
}
|
|
442
|
-
}), i.__H = void 0, e &&
|
|
442
|
+
}), i.__H = void 0, e && z.__e(e, i.__v));
|
|
443
443
|
};
|
|
444
444
|
var li = typeof requestAnimationFrame == "function";
|
|
445
445
|
function Un(t) {
|
|
@@ -449,12 +449,12 @@ function Un(t) {
|
|
|
449
449
|
li && (e = requestAnimationFrame(i));
|
|
450
450
|
}
|
|
451
451
|
function it(t) {
|
|
452
|
-
var e =
|
|
453
|
-
typeof i == "function" && (t.__c = void 0, i()),
|
|
452
|
+
var e = j, i = t.__c;
|
|
453
|
+
typeof i == "function" && (t.__c = void 0, i()), j = e;
|
|
454
454
|
}
|
|
455
455
|
function At(t) {
|
|
456
|
-
var e =
|
|
457
|
-
t.__c = t.__(),
|
|
456
|
+
var e = j;
|
|
457
|
+
t.__c = t.__(), j = e;
|
|
458
458
|
}
|
|
459
459
|
function ji(t, e) {
|
|
460
460
|
return !t || t.length !== e.length || e.some(function(i, n) {
|
|
@@ -513,21 +513,21 @@ function zi(t) {
|
|
|
513
513
|
return e.i = 0, e.n !== void 0 && (e.n.p = e.p, e.p !== void 0 && (e.p.n = e.n), e.p = L.s, e.n = void 0, L.s.n = e, L.s = e), e;
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
|
-
function
|
|
516
|
+
function Z(t, e) {
|
|
517
517
|
this.v = t, this.i = 0, this.n = void 0, this.t = void 0, this.W = e?.watched, this.Z = e?.unwatched, this.name = e?.name;
|
|
518
518
|
}
|
|
519
|
-
|
|
520
|
-
|
|
519
|
+
Z.prototype.brand = Pn;
|
|
520
|
+
Z.prototype.h = function() {
|
|
521
521
|
return !0;
|
|
522
522
|
};
|
|
523
|
-
|
|
523
|
+
Z.prototype.S = function(t) {
|
|
524
524
|
var e = this, i = this.t;
|
|
525
525
|
i !== t && t.e === void 0 && (t.x = i, this.t = t, i !== void 0 ? i.e = t : Hi(function() {
|
|
526
526
|
var n;
|
|
527
527
|
(n = e.W) == null || n.call(e);
|
|
528
528
|
}));
|
|
529
529
|
};
|
|
530
|
-
|
|
530
|
+
Z.prototype.U = function(t) {
|
|
531
531
|
var e = this;
|
|
532
532
|
if (this.t !== void 0) {
|
|
533
533
|
var i = t.e, n = t.x;
|
|
@@ -537,7 +537,7 @@ X.prototype.U = function(t) {
|
|
|
537
537
|
}));
|
|
538
538
|
}
|
|
539
539
|
};
|
|
540
|
-
|
|
540
|
+
Z.prototype.subscribe = function(t) {
|
|
541
541
|
var e = this;
|
|
542
542
|
return Je(function() {
|
|
543
543
|
var i = e.value, n = L;
|
|
@@ -549,16 +549,16 @@ X.prototype.subscribe = function(t) {
|
|
|
549
549
|
}
|
|
550
550
|
}, { name: "sub" });
|
|
551
551
|
};
|
|
552
|
-
|
|
552
|
+
Z.prototype.valueOf = function() {
|
|
553
553
|
return this.value;
|
|
554
554
|
};
|
|
555
|
-
|
|
555
|
+
Z.prototype.toString = function() {
|
|
556
556
|
return this.value + "";
|
|
557
557
|
};
|
|
558
|
-
|
|
558
|
+
Z.prototype.toJSON = function() {
|
|
559
559
|
return this.value;
|
|
560
560
|
};
|
|
561
|
-
|
|
561
|
+
Z.prototype.peek = function() {
|
|
562
562
|
var t = L;
|
|
563
563
|
L = void 0;
|
|
564
564
|
try {
|
|
@@ -567,7 +567,7 @@ X.prototype.peek = function() {
|
|
|
567
567
|
L = t;
|
|
568
568
|
}
|
|
569
569
|
};
|
|
570
|
-
Object.defineProperty(
|
|
570
|
+
Object.defineProperty(Z.prototype, "value", { get: function() {
|
|
571
571
|
var t = zi(this);
|
|
572
572
|
return t !== void 0 && (t.i = this.i), this.v;
|
|
573
573
|
}, set: function(t) {
|
|
@@ -581,8 +581,8 @@ Object.defineProperty(X.prototype, "value", { get: function() {
|
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
583
|
} });
|
|
584
|
-
function
|
|
585
|
-
return new
|
|
584
|
+
function K(t, e) {
|
|
585
|
+
return new Z(t, e);
|
|
586
586
|
}
|
|
587
587
|
function qi(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;
|
|
@@ -605,9 +605,9 @@ function Ki(t) {
|
|
|
605
605
|
t.s = i;
|
|
606
606
|
}
|
|
607
607
|
function be(t, e) {
|
|
608
|
-
|
|
608
|
+
Z.call(this, void 0), this.x = t, this.s = void 0, this.g = st - 1, this.f = 4, this.W = e?.watched, this.Z = e?.unwatched, this.name = e?.name;
|
|
609
609
|
}
|
|
610
|
-
be.prototype = new
|
|
610
|
+
be.prototype = new Z();
|
|
611
611
|
be.prototype.h = function() {
|
|
612
612
|
if (this.f &= -3, 1 & this.f) return !1;
|
|
613
613
|
if ((36 & this.f) == 32 || (this.f &= -5, this.g === st)) return !0;
|
|
@@ -628,10 +628,10 @@ be.prototype.S = function(t) {
|
|
|
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
|
+
Z.prototype.S.call(this, t);
|
|
632
632
|
};
|
|
633
633
|
be.prototype.U = function(t) {
|
|
634
|
-
if (this.t !== void 0 && (
|
|
634
|
+
if (this.t !== void 0 && (Z.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
|
}
|
|
@@ -741,15 +741,15 @@ function Qi(t) {
|
|
|
741
741
|
var E = f.value;
|
|
742
742
|
l.__v && l.__v.__e && l.__v.__e.nodeType === 3 && (l.__v.__e.data = E);
|
|
743
743
|
}
|
|
744
|
-
}),
|
|
744
|
+
}), T = e.__$u.d;
|
|
745
745
|
return e.__$u.d = function() {
|
|
746
|
-
u(),
|
|
746
|
+
u(), T.call(this);
|
|
747
747
|
}, [p, f];
|
|
748
748
|
}, []), s = a[0], c = a[1];
|
|
749
749
|
return s.value ? c.peek() : c.value;
|
|
750
750
|
}
|
|
751
751
|
Qi.displayName = "ReactiveTextNode";
|
|
752
|
-
Object.defineProperties(
|
|
752
|
+
Object.defineProperties(Z.prototype, { constructor: { configurable: !0, value: void 0 }, type: { configurable: !0, value: Qi }, props: { configurable: !0, get: function() {
|
|
753
753
|
return { data: this };
|
|
754
754
|
} }, __b: { configurable: !0, value: 1 } });
|
|
755
755
|
Ue("__b", function(t, e) {
|
|
@@ -757,7 +757,7 @@ Ue("__b", function(t, e) {
|
|
|
757
757
|
var i, n = e.props;
|
|
758
758
|
for (var a in n) if (a !== "children") {
|
|
759
759
|
var s = n[a];
|
|
760
|
-
s instanceof
|
|
760
|
+
s instanceof Z && (i || (e.__np = i = {}), i[a] = s, n[a] = s.peek());
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
763
|
t(e);
|
|
@@ -803,7 +803,7 @@ Ue("diffed", function(t, e) {
|
|
|
803
803
|
t(e);
|
|
804
804
|
});
|
|
805
805
|
function Vn(t, e, i, n) {
|
|
806
|
-
var a = e in t && t.ownerSVGElement === void 0, s =
|
|
806
|
+
var a = e in t && t.ownerSVGElement === void 0, s = K(i);
|
|
807
807
|
return { o: function(c, l) {
|
|
808
808
|
s.value = c, n = l;
|
|
809
809
|
}, d: Je(function() {
|
|
@@ -851,7 +851,7 @@ Ne.prototype.shouldComponentUpdate = function(t, e) {
|
|
|
851
851
|
};
|
|
852
852
|
function en(t, e) {
|
|
853
853
|
return Rt(function() {
|
|
854
|
-
return
|
|
854
|
+
return K(t, e);
|
|
855
855
|
})[0];
|
|
856
856
|
}
|
|
857
857
|
var Wn = function(t) {
|
|
@@ -913,47 +913,47 @@ function Hn(t) {
|
|
|
913
913
|
var gt = {}, Be = {}, ui;
|
|
914
914
|
function zn() {
|
|
915
915
|
if (ui) return Be;
|
|
916
|
-
ui = 1, Be.byteLength = l, Be.toByteArray = f, Be.fromByteArray =
|
|
916
|
+
ui = 1, Be.byteLength = l, Be.toByteArray = f, Be.fromByteArray = T;
|
|
917
917
|
for (var t = [], e = [], i = typeof Uint8Array < "u" ? Uint8Array : Array, n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", a = 0, s = n.length; a < s; ++a)
|
|
918
918
|
t[a] = n[a], e[n.charCodeAt(a)] = a;
|
|
919
919
|
e[45] = 62, e[95] = 63;
|
|
920
920
|
function c(E) {
|
|
921
|
-
var
|
|
922
|
-
if (
|
|
921
|
+
var S = E.length;
|
|
922
|
+
if (S % 4 > 0)
|
|
923
923
|
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
924
|
-
var
|
|
925
|
-
|
|
926
|
-
var
|
|
927
|
-
return [
|
|
924
|
+
var b = E.indexOf("=");
|
|
925
|
+
b === -1 && (b = S);
|
|
926
|
+
var R = b === S ? 0 : 4 - b % 4;
|
|
927
|
+
return [b, R];
|
|
928
928
|
}
|
|
929
929
|
function l(E) {
|
|
930
|
-
var
|
|
931
|
-
return (
|
|
930
|
+
var S = c(E), b = S[0], R = S[1];
|
|
931
|
+
return (b + R) * 3 / 4 - R;
|
|
932
932
|
}
|
|
933
|
-
function m(E,
|
|
934
|
-
return (
|
|
933
|
+
function m(E, S, b) {
|
|
934
|
+
return (S + b) * 3 / 4 - b;
|
|
935
935
|
}
|
|
936
936
|
function f(E) {
|
|
937
|
-
var
|
|
938
|
-
for (
|
|
939
|
-
|
|
940
|
-
return A === 2 && (
|
|
937
|
+
var S, b = c(E), R = b[0], A = b[1], w = new i(m(E, R, A)), O = 0, k = A > 0 ? R - 4 : R, y;
|
|
938
|
+
for (y = 0; y < k; y += 4)
|
|
939
|
+
S = e[E.charCodeAt(y)] << 18 | e[E.charCodeAt(y + 1)] << 12 | e[E.charCodeAt(y + 2)] << 6 | e[E.charCodeAt(y + 3)], w[O++] = S >> 16 & 255, w[O++] = S >> 8 & 255, w[O++] = S & 255;
|
|
940
|
+
return A === 2 && (S = e[E.charCodeAt(y)] << 2 | e[E.charCodeAt(y + 1)] >> 4, w[O++] = S & 255), A === 1 && (S = e[E.charCodeAt(y)] << 10 | e[E.charCodeAt(y + 1)] << 4 | e[E.charCodeAt(y + 2)] >> 2, w[O++] = S >> 8 & 255, w[O++] = S & 255), w;
|
|
941
941
|
}
|
|
942
942
|
function p(E) {
|
|
943
943
|
return t[E >> 18 & 63] + t[E >> 12 & 63] + t[E >> 6 & 63] + t[E & 63];
|
|
944
944
|
}
|
|
945
|
-
function u(E,
|
|
946
|
-
for (var
|
|
947
|
-
|
|
945
|
+
function u(E, S, b) {
|
|
946
|
+
for (var R, A = [], w = S; w < b; w += 3)
|
|
947
|
+
R = (E[w] << 16 & 16711680) + (E[w + 1] << 8 & 65280) + (E[w + 2] & 255), A.push(p(R));
|
|
948
948
|
return A.join("");
|
|
949
949
|
}
|
|
950
|
-
function
|
|
951
|
-
for (var
|
|
952
|
-
A.push(u(E,
|
|
953
|
-
return
|
|
954
|
-
t[
|
|
955
|
-
)) :
|
|
956
|
-
t[
|
|
950
|
+
function T(E) {
|
|
951
|
+
for (var S, b = E.length, R = b % 3, A = [], w = 16383, O = 0, k = b - R; O < k; O += w)
|
|
952
|
+
A.push(u(E, O, O + w > k ? k : O + w));
|
|
953
|
+
return R === 1 ? (S = E[b - 1], A.push(
|
|
954
|
+
t[S >> 2] + t[S << 4 & 63] + "=="
|
|
955
|
+
)) : R === 2 && (S = (E[b - 2] << 8) + E[b - 1], A.push(
|
|
956
|
+
t[S >> 10] + t[S >> 4 & 63] + t[S << 2 & 63] + "="
|
|
957
957
|
)), A.join("");
|
|
958
958
|
}
|
|
959
959
|
return Be;
|
|
@@ -962,10 +962,10 @@ var tt = {};
|
|
|
962
962
|
var hi;
|
|
963
963
|
function qn() {
|
|
964
964
|
return hi || (hi = 1, tt.read = function(t, e, i, n, a) {
|
|
965
|
-
var s, c, l = a * 8 - n - 1, m = (1 << l) - 1, f = m >> 1, p = -7, u = i ? a - 1 : 0,
|
|
966
|
-
for (u +=
|
|
965
|
+
var s, c, l = a * 8 - n - 1, m = (1 << l) - 1, f = m >> 1, p = -7, u = i ? a - 1 : 0, T = i ? -1 : 1, E = t[e + u];
|
|
966
|
+
for (u += T, s = E & (1 << -p) - 1, E >>= -p, p += l; p > 0; s = s * 256 + t[e + u], u += T, p -= 8)
|
|
967
967
|
;
|
|
968
|
-
for (c = s & (1 << -p) - 1, s >>= -p, p += n; p > 0; c = c * 256 + t[e + u], u +=
|
|
968
|
+
for (c = s & (1 << -p) - 1, s >>= -p, p += n; p > 0; c = c * 256 + t[e + u], u += T, p -= 8)
|
|
969
969
|
;
|
|
970
970
|
if (s === 0)
|
|
971
971
|
s = 1 - f;
|
|
@@ -976,19 +976,19 @@ function qn() {
|
|
|
976
976
|
}
|
|
977
977
|
return (E ? -1 : 1) * c * Math.pow(2, s - n);
|
|
978
978
|
}, tt.write = function(t, e, i, n, a, s) {
|
|
979
|
-
var c, l, m, f = s * 8 - a - 1, p = (1 << f) - 1, u = p >> 1,
|
|
980
|
-
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (l = isNaN(e) ? 1 : 0, c = p) : (c = Math.floor(Math.log(e) / Math.LN2), e * (m = Math.pow(2, -c)) < 1 && (c--, m *= 2), c + u >= 1 ? e +=
|
|
979
|
+
var c, l, m, f = s * 8 - a - 1, p = (1 << f) - 1, u = p >> 1, T = a === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, E = n ? 0 : s - 1, S = n ? 1 : -1, b = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
|
|
980
|
+
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (l = isNaN(e) ? 1 : 0, c = p) : (c = Math.floor(Math.log(e) / Math.LN2), e * (m = Math.pow(2, -c)) < 1 && (c--, m *= 2), c + u >= 1 ? e += T / m : e += T * Math.pow(2, 1 - u), e * m >= 2 && (c++, m /= 2), c + u >= p ? (l = 0, c = p) : c + u >= 1 ? (l = (e * m - 1) * Math.pow(2, a), c = c + u) : (l = e * Math.pow(2, u - 1) * Math.pow(2, a), c = 0)); a >= 8; t[i + E] = l & 255, E += S, l /= 256, a -= 8)
|
|
981
981
|
;
|
|
982
|
-
for (c = c << a | l, f += a; f > 0; t[i + E] = c & 255, E +=
|
|
982
|
+
for (c = c << a | l, f += a; f > 0; t[i + E] = c & 255, E += S, c /= 256, f -= 8)
|
|
983
983
|
;
|
|
984
|
-
t[i + E -
|
|
984
|
+
t[i + E - S] |= b * 128;
|
|
985
985
|
}), tt;
|
|
986
986
|
}
|
|
987
987
|
var fi;
|
|
988
988
|
function Yn() {
|
|
989
989
|
return fi || (fi = 1, (function(t) {
|
|
990
990
|
const e = zn(), i = qn(), n = typeof Symbol == "function" && typeof Symbol.for == "function" ? /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom") : null;
|
|
991
|
-
t.Buffer = l, t.SlowBuffer =
|
|
991
|
+
t.Buffer = l, t.SlowBuffer = w, t.INSPECT_MAX_BYTES = 50;
|
|
992
992
|
const a = 2147483647;
|
|
993
993
|
t.kMaxLength = a, l.TYPED_ARRAY_SUPPORT = s(), !l.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
|
|
994
994
|
"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
|
|
@@ -1035,15 +1035,15 @@ function Yn() {
|
|
|
1035
1035
|
l.poolSize = 8192;
|
|
1036
1036
|
function m(d, r, o) {
|
|
1037
1037
|
if (typeof d == "string")
|
|
1038
|
-
return
|
|
1038
|
+
return T(d, r);
|
|
1039
1039
|
if (ArrayBuffer.isView(d))
|
|
1040
|
-
return
|
|
1040
|
+
return S(d);
|
|
1041
1041
|
if (d == null)
|
|
1042
1042
|
throw new TypeError(
|
|
1043
1043
|
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof d
|
|
1044
1044
|
);
|
|
1045
1045
|
if (ae(d, ArrayBuffer) || d && ae(d.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (ae(d, SharedArrayBuffer) || d && ae(d.buffer, SharedArrayBuffer)))
|
|
1046
|
-
return
|
|
1046
|
+
return b(d, r, o);
|
|
1047
1047
|
if (typeof d == "number")
|
|
1048
1048
|
throw new TypeError(
|
|
1049
1049
|
'The "value" argument must not be of type number. Received type number'
|
|
@@ -1051,7 +1051,7 @@ function Yn() {
|
|
|
1051
1051
|
const h = d.valueOf && d.valueOf();
|
|
1052
1052
|
if (h != null && h !== d)
|
|
1053
1053
|
return l.from(h, r, o);
|
|
1054
|
-
const _ =
|
|
1054
|
+
const _ = R(d);
|
|
1055
1055
|
if (_) return _;
|
|
1056
1056
|
if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof d[Symbol.toPrimitive] == "function")
|
|
1057
1057
|
return l.from(d[Symbol.toPrimitive]("string"), r, o);
|
|
@@ -1082,10 +1082,10 @@ function Yn() {
|
|
|
1082
1082
|
}, l.allocUnsafeSlow = function(d) {
|
|
1083
1083
|
return u(d);
|
|
1084
1084
|
};
|
|
1085
|
-
function
|
|
1085
|
+
function T(d, r) {
|
|
1086
1086
|
if ((typeof r != "string" || r === "") && (r = "utf8"), !l.isEncoding(r))
|
|
1087
1087
|
throw new TypeError("Unknown encoding: " + r);
|
|
1088
|
-
const o =
|
|
1088
|
+
const o = O(d, r) | 0;
|
|
1089
1089
|
let h = c(o);
|
|
1090
1090
|
const _ = h.write(d, r);
|
|
1091
1091
|
return _ !== o && (h = h.slice(0, _)), h;
|
|
@@ -1096,14 +1096,14 @@ function Yn() {
|
|
|
1096
1096
|
o[h] = d[h] & 255;
|
|
1097
1097
|
return o;
|
|
1098
1098
|
}
|
|
1099
|
-
function
|
|
1099
|
+
function S(d) {
|
|
1100
1100
|
if (ae(d, Uint8Array)) {
|
|
1101
1101
|
const r = new Uint8Array(d);
|
|
1102
|
-
return
|
|
1102
|
+
return b(r.buffer, r.byteOffset, r.byteLength);
|
|
1103
1103
|
}
|
|
1104
1104
|
return E(d);
|
|
1105
1105
|
}
|
|
1106
|
-
function
|
|
1106
|
+
function b(d, r, o) {
|
|
1107
1107
|
if (r < 0 || d.byteLength < r)
|
|
1108
1108
|
throw new RangeError('"offset" is outside of buffer bounds');
|
|
1109
1109
|
if (d.byteLength < r + (o || 0))
|
|
@@ -1111,7 +1111,7 @@ function Yn() {
|
|
|
1111
1111
|
let h;
|
|
1112
1112
|
return r === void 0 && o === void 0 ? h = new Uint8Array(d) : o === void 0 ? h = new Uint8Array(d, r) : h = new Uint8Array(d, r, o), Object.setPrototypeOf(h, l.prototype), h;
|
|
1113
1113
|
}
|
|
1114
|
-
function
|
|
1114
|
+
function R(d) {
|
|
1115
1115
|
if (l.isBuffer(d)) {
|
|
1116
1116
|
const r = A(d.length) | 0, o = c(r);
|
|
1117
1117
|
return o.length === 0 || d.copy(o, 0, 0, r), o;
|
|
@@ -1126,7 +1126,7 @@ function Yn() {
|
|
|
1126
1126
|
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + a.toString(16) + " bytes");
|
|
1127
1127
|
return d | 0;
|
|
1128
1128
|
}
|
|
1129
|
-
function
|
|
1129
|
+
function w(d) {
|
|
1130
1130
|
return +d != d && (d = 0), l.alloc(+d);
|
|
1131
1131
|
}
|
|
1132
1132
|
l.isBuffer = function(r) {
|
|
@@ -1188,7 +1188,7 @@ function Yn() {
|
|
|
1188
1188
|
}
|
|
1189
1189
|
return _;
|
|
1190
1190
|
};
|
|
1191
|
-
function
|
|
1191
|
+
function O(d, r) {
|
|
1192
1192
|
if (l.isBuffer(d))
|
|
1193
1193
|
return d.length;
|
|
1194
1194
|
if (ArrayBuffer.isView(d) || ae(d, ArrayBuffer))
|
|
@@ -1224,8 +1224,8 @@ function Yn() {
|
|
|
1224
1224
|
r = ("" + r).toLowerCase(), _ = !0;
|
|
1225
1225
|
}
|
|
1226
1226
|
}
|
|
1227
|
-
l.byteLength =
|
|
1228
|
-
function
|
|
1227
|
+
l.byteLength = O;
|
|
1228
|
+
function k(d, r, o) {
|
|
1229
1229
|
let h = !1;
|
|
1230
1230
|
if ((r === void 0 || r < 0) && (r = 0), r > this.length || ((o === void 0 || o > this.length) && (o = this.length), o <= 0) || (o >>>= 0, r >>>= 0, o <= r))
|
|
1231
1231
|
return "";
|
|
@@ -1237,7 +1237,7 @@ function Yn() {
|
|
|
1237
1237
|
case "utf-8":
|
|
1238
1238
|
return he(this, r, o);
|
|
1239
1239
|
case "ascii":
|
|
1240
|
-
return
|
|
1240
|
+
return oe(this, r, o);
|
|
1241
1241
|
case "latin1":
|
|
1242
1242
|
case "binary":
|
|
1243
1243
|
return ut(this, r, o);
|
|
@@ -1247,14 +1247,14 @@ function Yn() {
|
|
|
1247
1247
|
case "ucs-2":
|
|
1248
1248
|
case "utf16le":
|
|
1249
1249
|
case "utf-16le":
|
|
1250
|
-
return
|
|
1250
|
+
return q(this, r, o);
|
|
1251
1251
|
default:
|
|
1252
1252
|
if (h) throw new TypeError("Unknown encoding: " + d);
|
|
1253
1253
|
d = (d + "").toLowerCase(), h = !0;
|
|
1254
1254
|
}
|
|
1255
1255
|
}
|
|
1256
1256
|
l.prototype._isBuffer = !0;
|
|
1257
|
-
function
|
|
1257
|
+
function y(d, r, o) {
|
|
1258
1258
|
const h = d[r];
|
|
1259
1259
|
d[r] = d[o], d[o] = h;
|
|
1260
1260
|
}
|
|
@@ -1263,25 +1263,25 @@ function Yn() {
|
|
|
1263
1263
|
if (r % 2 !== 0)
|
|
1264
1264
|
throw new RangeError("Buffer size must be a multiple of 16-bits");
|
|
1265
1265
|
for (let o = 0; o < r; o += 2)
|
|
1266
|
-
|
|
1266
|
+
y(this, o, o + 1);
|
|
1267
1267
|
return this;
|
|
1268
1268
|
}, l.prototype.swap32 = function() {
|
|
1269
1269
|
const r = this.length;
|
|
1270
1270
|
if (r % 4 !== 0)
|
|
1271
1271
|
throw new RangeError("Buffer size must be a multiple of 32-bits");
|
|
1272
1272
|
for (let o = 0; o < r; o += 4)
|
|
1273
|
-
|
|
1273
|
+
y(this, o, o + 3), y(this, o + 1, o + 2);
|
|
1274
1274
|
return this;
|
|
1275
1275
|
}, l.prototype.swap64 = function() {
|
|
1276
1276
|
const r = this.length;
|
|
1277
1277
|
if (r % 8 !== 0)
|
|
1278
1278
|
throw new RangeError("Buffer size must be a multiple of 64-bits");
|
|
1279
1279
|
for (let o = 0; o < r; o += 8)
|
|
1280
|
-
|
|
1280
|
+
y(this, o, o + 7), y(this, o + 1, o + 6), y(this, o + 2, o + 5), y(this, o + 3, o + 4);
|
|
1281
1281
|
return this;
|
|
1282
1282
|
}, l.prototype.toString = function() {
|
|
1283
1283
|
const r = this.length;
|
|
1284
|
-
return r === 0 ? "" : arguments.length === 0 ? he(this, 0, r) :
|
|
1284
|
+
return r === 0 ? "" : arguments.length === 0 ? he(this, 0, r) : k.apply(this, arguments);
|
|
1285
1285
|
}, l.prototype.toLocaleString = l.prototype.toString, l.prototype.equals = function(r) {
|
|
1286
1286
|
if (!l.isBuffer(r)) throw new TypeError("Argument must be a Buffer");
|
|
1287
1287
|
return this === r ? !0 : l.compare(this, r) === 0;
|
|
@@ -1303,16 +1303,16 @@ function Yn() {
|
|
|
1303
1303
|
if (o >= h)
|
|
1304
1304
|
return 1;
|
|
1305
1305
|
if (o >>>= 0, h >>>= 0, _ >>>= 0, g >>>= 0, this === r) return 0;
|
|
1306
|
-
let v = g - _,
|
|
1307
|
-
const
|
|
1308
|
-
for (let
|
|
1309
|
-
if (P
|
|
1310
|
-
v = P
|
|
1306
|
+
let v = g - _, N = h - o;
|
|
1307
|
+
const $ = Math.min(v, N), B = this.slice(_, g), V = r.slice(o, h);
|
|
1308
|
+
for (let P = 0; P < $; ++P)
|
|
1309
|
+
if (B[P] !== V[P]) {
|
|
1310
|
+
v = B[P], N = V[P];
|
|
1311
1311
|
break;
|
|
1312
1312
|
}
|
|
1313
|
-
return v <
|
|
1313
|
+
return v < N ? -1 : N < v ? 1 : 0;
|
|
1314
1314
|
};
|
|
1315
|
-
function
|
|
1315
|
+
function G(d, r, o, h, _) {
|
|
1316
1316
|
if (d.length === 0) return -1;
|
|
1317
1317
|
if (typeof o == "string" ? (h = o, o = 0) : o > 2147483647 ? o = 2147483647 : o < -2147483648 && (o = -2147483648), o = +o, pt(o) && (o = _ ? 0 : d.length - 1), o < 0 && (o = d.length + o), o >= d.length) {
|
|
1318
1318
|
if (_) return -1;
|
|
@@ -1321,49 +1321,49 @@ function Yn() {
|
|
|
1321
1321
|
if (_) o = 0;
|
|
1322
1322
|
else return -1;
|
|
1323
1323
|
if (typeof r == "string" && (r = l.from(r, h)), l.isBuffer(r))
|
|
1324
|
-
return r.length === 0 ? -1 :
|
|
1324
|
+
return r.length === 0 ? -1 : I(d, r, o, h, _);
|
|
1325
1325
|
if (typeof r == "number")
|
|
1326
|
-
return r = r & 255, typeof Uint8Array.prototype.indexOf == "function" ? _ ? Uint8Array.prototype.indexOf.call(d, r, o) : Uint8Array.prototype.lastIndexOf.call(d, r, o) :
|
|
1326
|
+
return r = r & 255, typeof Uint8Array.prototype.indexOf == "function" ? _ ? Uint8Array.prototype.indexOf.call(d, r, o) : Uint8Array.prototype.lastIndexOf.call(d, r, o) : I(d, [r], o, h, _);
|
|
1327
1327
|
throw new TypeError("val must be string, number or Buffer");
|
|
1328
1328
|
}
|
|
1329
|
-
function
|
|
1330
|
-
let g = 1, v = d.length,
|
|
1329
|
+
function I(d, r, o, h, _) {
|
|
1330
|
+
let g = 1, v = d.length, N = r.length;
|
|
1331
1331
|
if (h !== void 0 && (h = String(h).toLowerCase(), h === "ucs2" || h === "ucs-2" || h === "utf16le" || h === "utf-16le")) {
|
|
1332
1332
|
if (d.length < 2 || r.length < 2)
|
|
1333
1333
|
return -1;
|
|
1334
|
-
g = 2, v /= 2,
|
|
1334
|
+
g = 2, v /= 2, N /= 2, o /= 2;
|
|
1335
1335
|
}
|
|
1336
|
-
function
|
|
1337
|
-
return g === 1 ?
|
|
1336
|
+
function $(V, P) {
|
|
1337
|
+
return g === 1 ? V[P] : V.readUInt16BE(P * g);
|
|
1338
1338
|
}
|
|
1339
|
-
let
|
|
1339
|
+
let B;
|
|
1340
1340
|
if (_) {
|
|
1341
|
-
let
|
|
1342
|
-
for (
|
|
1343
|
-
if (
|
|
1344
|
-
if (
|
|
1341
|
+
let V = -1;
|
|
1342
|
+
for (B = o; B < v; B++)
|
|
1343
|
+
if ($(d, B) === $(r, V === -1 ? 0 : B - V)) {
|
|
1344
|
+
if (V === -1 && (V = B), B - V + 1 === N) return V * g;
|
|
1345
1345
|
} else
|
|
1346
|
-
|
|
1346
|
+
V !== -1 && (B -= B - V), V = -1;
|
|
1347
1347
|
} else
|
|
1348
|
-
for (o +
|
|
1349
|
-
let
|
|
1350
|
-
for (let
|
|
1351
|
-
if (
|
|
1352
|
-
|
|
1348
|
+
for (o + N > v && (o = v - N), B = o; B >= 0; B--) {
|
|
1349
|
+
let V = !0;
|
|
1350
|
+
for (let P = 0; P < N; P++)
|
|
1351
|
+
if ($(d, B + P) !== $(r, P)) {
|
|
1352
|
+
V = !1;
|
|
1353
1353
|
break;
|
|
1354
1354
|
}
|
|
1355
|
-
if (
|
|
1355
|
+
if (V) return B;
|
|
1356
1356
|
}
|
|
1357
1357
|
return -1;
|
|
1358
1358
|
}
|
|
1359
1359
|
l.prototype.includes = function(r, o, h) {
|
|
1360
1360
|
return this.indexOf(r, o, h) !== -1;
|
|
1361
1361
|
}, l.prototype.indexOf = function(r, o, h) {
|
|
1362
|
-
return
|
|
1362
|
+
return G(this, r, o, h, !0);
|
|
1363
1363
|
}, l.prototype.lastIndexOf = function(r, o, h) {
|
|
1364
|
-
return
|
|
1364
|
+
return G(this, r, o, h, !1);
|
|
1365
1365
|
};
|
|
1366
|
-
function
|
|
1366
|
+
function D(d, r, o, h) {
|
|
1367
1367
|
o = Number(o) || 0;
|
|
1368
1368
|
const _ = d.length - o;
|
|
1369
1369
|
h ? (h = Number(h), h > _ && (h = _)) : h = _;
|
|
@@ -1371,22 +1371,22 @@ function Yn() {
|
|
|
1371
1371
|
h > g / 2 && (h = g / 2);
|
|
1372
1372
|
let v;
|
|
1373
1373
|
for (v = 0; v < h; ++v) {
|
|
1374
|
-
const
|
|
1375
|
-
if (pt(
|
|
1376
|
-
d[o + v] =
|
|
1374
|
+
const N = parseInt(r.substr(v * 2, 2), 16);
|
|
1375
|
+
if (pt(N)) return v;
|
|
1376
|
+
d[o + v] = N;
|
|
1377
1377
|
}
|
|
1378
1378
|
return v;
|
|
1379
1379
|
}
|
|
1380
|
-
function
|
|
1380
|
+
function U(d, r, o, h) {
|
|
1381
1381
|
return Ze(ft(r, d.length - o), d, o, h);
|
|
1382
1382
|
}
|
|
1383
|
-
function
|
|
1383
|
+
function J(d, r, o, h) {
|
|
1384
1384
|
return Ze(gn(r), d, o, h);
|
|
1385
1385
|
}
|
|
1386
|
-
function
|
|
1386
|
+
function H(d, r, o, h) {
|
|
1387
1387
|
return Ze(Kt(r), d, o, h);
|
|
1388
1388
|
}
|
|
1389
|
-
function
|
|
1389
|
+
function ie(d, r, o, h) {
|
|
1390
1390
|
return Ze(En(r, d.length - o), d, o, h);
|
|
1391
1391
|
}
|
|
1392
1392
|
l.prototype.write = function(r, o, h, _) {
|
|
@@ -1408,21 +1408,21 @@ function Yn() {
|
|
|
1408
1408
|
for (; ; )
|
|
1409
1409
|
switch (_) {
|
|
1410
1410
|
case "hex":
|
|
1411
|
-
return
|
|
1411
|
+
return D(this, r, o, h);
|
|
1412
1412
|
case "utf8":
|
|
1413
1413
|
case "utf-8":
|
|
1414
|
-
return
|
|
1414
|
+
return U(this, r, o, h);
|
|
1415
1415
|
case "ascii":
|
|
1416
1416
|
case "latin1":
|
|
1417
1417
|
case "binary":
|
|
1418
|
-
return
|
|
1418
|
+
return J(this, r, o, h);
|
|
1419
1419
|
case "base64":
|
|
1420
|
-
return
|
|
1420
|
+
return H(this, r, o, h);
|
|
1421
1421
|
case "ucs2":
|
|
1422
1422
|
case "ucs-2":
|
|
1423
1423
|
case "utf16le":
|
|
1424
1424
|
case "utf-16le":
|
|
1425
|
-
return
|
|
1425
|
+
return ie(this, r, o, h);
|
|
1426
1426
|
default:
|
|
1427
1427
|
if (v) throw new TypeError("Unknown encoding: " + _);
|
|
1428
1428
|
_ = ("" + _).toLowerCase(), v = !0;
|
|
@@ -1442,24 +1442,24 @@ function Yn() {
|
|
|
1442
1442
|
let _ = r;
|
|
1443
1443
|
for (; _ < o; ) {
|
|
1444
1444
|
const g = d[_];
|
|
1445
|
-
let v = null,
|
|
1446
|
-
if (_ +
|
|
1447
|
-
let
|
|
1448
|
-
switch (
|
|
1445
|
+
let v = null, N = g > 239 ? 4 : g > 223 ? 3 : g > 191 ? 2 : 1;
|
|
1446
|
+
if (_ + N <= o) {
|
|
1447
|
+
let $, B, V, P;
|
|
1448
|
+
switch (N) {
|
|
1449
1449
|
case 1:
|
|
1450
1450
|
g < 128 && (v = g);
|
|
1451
1451
|
break;
|
|
1452
1452
|
case 2:
|
|
1453
|
-
|
|
1453
|
+
$ = d[_ + 1], ($ & 192) === 128 && (P = (g & 31) << 6 | $ & 63, P > 127 && (v = P));
|
|
1454
1454
|
break;
|
|
1455
1455
|
case 3:
|
|
1456
|
-
|
|
1456
|
+
$ = d[_ + 1], B = d[_ + 2], ($ & 192) === 128 && (B & 192) === 128 && (P = (g & 15) << 12 | ($ & 63) << 6 | B & 63, P > 2047 && (P < 55296 || P > 57343) && (v = P));
|
|
1457
1457
|
break;
|
|
1458
1458
|
case 4:
|
|
1459
|
-
|
|
1459
|
+
$ = d[_ + 1], B = d[_ + 2], V = d[_ + 3], ($ & 192) === 128 && (B & 192) === 128 && (V & 192) === 128 && (P = (g & 15) << 18 | ($ & 63) << 12 | (B & 63) << 6 | V & 63, P > 65535 && P < 1114112 && (v = P));
|
|
1460
1460
|
}
|
|
1461
1461
|
}
|
|
1462
|
-
v === null ? (v = 65533,
|
|
1462
|
+
v === null ? (v = 65533, N = 1) : v > 65535 && (v -= 65536, h.push(v >>> 10 & 1023 | 55296), v = 56320 | v & 1023), h.push(v), _ += N;
|
|
1463
1463
|
}
|
|
1464
1464
|
return Te(h);
|
|
1465
1465
|
}
|
|
@@ -1476,7 +1476,7 @@ function Yn() {
|
|
|
1476
1476
|
);
|
|
1477
1477
|
return o;
|
|
1478
1478
|
}
|
|
1479
|
-
function
|
|
1479
|
+
function oe(d, r, o) {
|
|
1480
1480
|
let h = "";
|
|
1481
1481
|
o = Math.min(d.length, o);
|
|
1482
1482
|
for (let _ = r; _ < o; ++_)
|
|
@@ -1498,7 +1498,7 @@ function Yn() {
|
|
|
1498
1498
|
_ += vn[d[g]];
|
|
1499
1499
|
return _;
|
|
1500
1500
|
}
|
|
1501
|
-
function
|
|
1501
|
+
function q(d, r, o) {
|
|
1502
1502
|
const h = d.slice(r, o);
|
|
1503
1503
|
let _ = "";
|
|
1504
1504
|
for (let g = 0; g < h.length - 1; g += 2)
|
|
@@ -1511,32 +1511,32 @@ function Yn() {
|
|
|
1511
1511
|
const _ = this.subarray(r, o);
|
|
1512
1512
|
return Object.setPrototypeOf(_, l.prototype), _;
|
|
1513
1513
|
};
|
|
1514
|
-
function
|
|
1514
|
+
function Y(d, r, o) {
|
|
1515
1515
|
if (d % 1 !== 0 || d < 0) throw new RangeError("offset is not uint");
|
|
1516
1516
|
if (d + r > o) throw new RangeError("Trying to access beyond buffer length");
|
|
1517
1517
|
}
|
|
1518
1518
|
l.prototype.readUintLE = l.prototype.readUIntLE = function(r, o, h) {
|
|
1519
|
-
r = r >>> 0, o = o >>> 0, h ||
|
|
1519
|
+
r = r >>> 0, o = o >>> 0, h || Y(r, o, this.length);
|
|
1520
1520
|
let _ = this[r], g = 1, v = 0;
|
|
1521
1521
|
for (; ++v < o && (g *= 256); )
|
|
1522
1522
|
_ += this[r + v] * g;
|
|
1523
1523
|
return _;
|
|
1524
1524
|
}, l.prototype.readUintBE = l.prototype.readUIntBE = function(r, o, h) {
|
|
1525
|
-
r = r >>> 0, o = o >>> 0, h ||
|
|
1525
|
+
r = r >>> 0, o = o >>> 0, h || Y(r, o, this.length);
|
|
1526
1526
|
let _ = this[r + --o], g = 1;
|
|
1527
1527
|
for (; o > 0 && (g *= 256); )
|
|
1528
1528
|
_ += this[r + --o] * g;
|
|
1529
1529
|
return _;
|
|
1530
1530
|
}, l.prototype.readUint8 = l.prototype.readUInt8 = function(r, o) {
|
|
1531
|
-
return r = r >>> 0, o ||
|
|
1531
|
+
return r = r >>> 0, o || Y(r, 1, this.length), this[r];
|
|
1532
1532
|
}, l.prototype.readUint16LE = l.prototype.readUInt16LE = function(r, o) {
|
|
1533
|
-
return r = r >>> 0, o ||
|
|
1533
|
+
return r = r >>> 0, o || Y(r, 2, this.length), this[r] | this[r + 1] << 8;
|
|
1534
1534
|
}, l.prototype.readUint16BE = l.prototype.readUInt16BE = function(r, o) {
|
|
1535
|
-
return r = r >>> 0, o ||
|
|
1535
|
+
return r = r >>> 0, o || Y(r, 2, this.length), this[r] << 8 | this[r + 1];
|
|
1536
1536
|
}, l.prototype.readUint32LE = l.prototype.readUInt32LE = function(r, o) {
|
|
1537
|
-
return r = r >>> 0, o ||
|
|
1537
|
+
return r = r >>> 0, o || Y(r, 4, this.length), (this[r] | this[r + 1] << 8 | this[r + 2] << 16) + this[r + 3] * 16777216;
|
|
1538
1538
|
}, l.prototype.readUint32BE = l.prototype.readUInt32BE = function(r, o) {
|
|
1539
|
-
return r = r >>> 0, o ||
|
|
1539
|
+
return r = r >>> 0, o || Y(r, 4, this.length), this[r] * 16777216 + (this[r + 1] << 16 | this[r + 2] << 8 | this[r + 3]);
|
|
1540
1540
|
}, l.prototype.readBigUInt64LE = fe(function(r) {
|
|
1541
1541
|
r = r >>> 0, Re(r, "offset");
|
|
1542
1542
|
const o = this[r], h = this[r + 7];
|
|
@@ -1550,31 +1550,31 @@ function Yn() {
|
|
|
1550
1550
|
const _ = o * 2 ** 24 + this[++r] * 2 ** 16 + this[++r] * 2 ** 8 + this[++r], g = this[++r] * 2 ** 24 + this[++r] * 2 ** 16 + this[++r] * 2 ** 8 + h;
|
|
1551
1551
|
return (BigInt(_) << BigInt(32)) + BigInt(g);
|
|
1552
1552
|
}), l.prototype.readIntLE = function(r, o, h) {
|
|
1553
|
-
r = r >>> 0, o = o >>> 0, h ||
|
|
1553
|
+
r = r >>> 0, o = o >>> 0, h || Y(r, o, this.length);
|
|
1554
1554
|
let _ = this[r], g = 1, v = 0;
|
|
1555
1555
|
for (; ++v < o && (g *= 256); )
|
|
1556
1556
|
_ += this[r + v] * g;
|
|
1557
1557
|
return g *= 128, _ >= g && (_ -= Math.pow(2, 8 * o)), _;
|
|
1558
1558
|
}, l.prototype.readIntBE = function(r, o, h) {
|
|
1559
|
-
r = r >>> 0, o = o >>> 0, h ||
|
|
1559
|
+
r = r >>> 0, o = o >>> 0, h || Y(r, o, this.length);
|
|
1560
1560
|
let _ = o, g = 1, v = this[r + --_];
|
|
1561
1561
|
for (; _ > 0 && (g *= 256); )
|
|
1562
1562
|
v += this[r + --_] * g;
|
|
1563
1563
|
return g *= 128, v >= g && (v -= Math.pow(2, 8 * o)), v;
|
|
1564
1564
|
}, l.prototype.readInt8 = function(r, o) {
|
|
1565
|
-
return r = r >>> 0, o ||
|
|
1565
|
+
return r = r >>> 0, o || Y(r, 1, this.length), this[r] & 128 ? (255 - this[r] + 1) * -1 : this[r];
|
|
1566
1566
|
}, l.prototype.readInt16LE = function(r, o) {
|
|
1567
|
-
r = r >>> 0, o ||
|
|
1567
|
+
r = r >>> 0, o || Y(r, 2, this.length);
|
|
1568
1568
|
const h = this[r] | this[r + 1] << 8;
|
|
1569
1569
|
return h & 32768 ? h | 4294901760 : h;
|
|
1570
1570
|
}, l.prototype.readInt16BE = function(r, o) {
|
|
1571
|
-
r = r >>> 0, o ||
|
|
1571
|
+
r = r >>> 0, o || Y(r, 2, this.length);
|
|
1572
1572
|
const h = this[r + 1] | this[r] << 8;
|
|
1573
1573
|
return h & 32768 ? h | 4294901760 : h;
|
|
1574
1574
|
}, l.prototype.readInt32LE = function(r, o) {
|
|
1575
|
-
return r = r >>> 0, o ||
|
|
1575
|
+
return r = r >>> 0, o || Y(r, 4, this.length), this[r] | this[r + 1] << 8 | this[r + 2] << 16 | this[r + 3] << 24;
|
|
1576
1576
|
}, l.prototype.readInt32BE = function(r, o) {
|
|
1577
|
-
return r = r >>> 0, o ||
|
|
1577
|
+
return r = r >>> 0, o || Y(r, 4, this.length), this[r] << 24 | this[r + 1] << 16 | this[r + 2] << 8 | this[r + 3];
|
|
1578
1578
|
}, l.prototype.readBigInt64LE = fe(function(r) {
|
|
1579
1579
|
r = r >>> 0, Re(r, "offset");
|
|
1580
1580
|
const o = this[r], h = this[r + 7];
|
|
@@ -1589,23 +1589,23 @@ function Yn() {
|
|
|
1589
1589
|
this[++r] * 2 ** 16 + this[++r] * 2 ** 8 + this[++r];
|
|
1590
1590
|
return (BigInt(_) << BigInt(32)) + BigInt(this[++r] * 2 ** 24 + this[++r] * 2 ** 16 + this[++r] * 2 ** 8 + h);
|
|
1591
1591
|
}), l.prototype.readFloatLE = function(r, o) {
|
|
1592
|
-
return r = r >>> 0, o ||
|
|
1592
|
+
return r = r >>> 0, o || Y(r, 4, this.length), i.read(this, r, !0, 23, 4);
|
|
1593
1593
|
}, l.prototype.readFloatBE = function(r, o) {
|
|
1594
|
-
return r = r >>> 0, o ||
|
|
1594
|
+
return r = r >>> 0, o || Y(r, 4, this.length), i.read(this, r, !1, 23, 4);
|
|
1595
1595
|
}, l.prototype.readDoubleLE = function(r, o) {
|
|
1596
|
-
return r = r >>> 0, o ||
|
|
1596
|
+
return r = r >>> 0, o || Y(r, 8, this.length), i.read(this, r, !0, 52, 8);
|
|
1597
1597
|
}, l.prototype.readDoubleBE = function(r, o) {
|
|
1598
|
-
return r = r >>> 0, o ||
|
|
1598
|
+
return r = r >>> 0, o || Y(r, 8, this.length), i.read(this, r, !1, 52, 8);
|
|
1599
1599
|
};
|
|
1600
|
-
function
|
|
1600
|
+
function re(d, r, o, h, _, g) {
|
|
1601
1601
|
if (!l.isBuffer(d)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
1602
1602
|
if (r > _ || r < g) throw new RangeError('"value" argument is out of bounds');
|
|
1603
1603
|
if (o + h > d.length) throw new RangeError("Index out of range");
|
|
1604
1604
|
}
|
|
1605
1605
|
l.prototype.writeUintLE = l.prototype.writeUIntLE = function(r, o, h, _) {
|
|
1606
1606
|
if (r = +r, o = o >>> 0, h = h >>> 0, !_) {
|
|
1607
|
-
const
|
|
1608
|
-
|
|
1607
|
+
const N = Math.pow(2, 8 * h) - 1;
|
|
1608
|
+
re(this, r, o, h, N, 0);
|
|
1609
1609
|
}
|
|
1610
1610
|
let g = 1, v = 0;
|
|
1611
1611
|
for (this[o] = r & 255; ++v < h && (g *= 256); )
|
|
@@ -1613,23 +1613,23 @@ function Yn() {
|
|
|
1613
1613
|
return o + h;
|
|
1614
1614
|
}, l.prototype.writeUintBE = l.prototype.writeUIntBE = function(r, o, h, _) {
|
|
1615
1615
|
if (r = +r, o = o >>> 0, h = h >>> 0, !_) {
|
|
1616
|
-
const
|
|
1617
|
-
|
|
1616
|
+
const N = Math.pow(2, 8 * h) - 1;
|
|
1617
|
+
re(this, r, o, h, N, 0);
|
|
1618
1618
|
}
|
|
1619
1619
|
let g = h - 1, v = 1;
|
|
1620
1620
|
for (this[o + g] = r & 255; --g >= 0 && (v *= 256); )
|
|
1621
1621
|
this[o + g] = r / v & 255;
|
|
1622
1622
|
return o + h;
|
|
1623
1623
|
}, l.prototype.writeUint8 = l.prototype.writeUInt8 = function(r, o, h) {
|
|
1624
|
-
return r = +r, o = o >>> 0, h ||
|
|
1624
|
+
return r = +r, o = o >>> 0, h || re(this, r, o, 1, 255, 0), this[o] = r & 255, o + 1;
|
|
1625
1625
|
}, l.prototype.writeUint16LE = l.prototype.writeUInt16LE = function(r, o, h) {
|
|
1626
|
-
return r = +r, o = o >>> 0, h ||
|
|
1626
|
+
return r = +r, o = o >>> 0, h || re(this, r, o, 2, 65535, 0), this[o] = r & 255, this[o + 1] = r >>> 8, o + 2;
|
|
1627
1627
|
}, l.prototype.writeUint16BE = l.prototype.writeUInt16BE = function(r, o, h) {
|
|
1628
|
-
return r = +r, o = o >>> 0, h ||
|
|
1628
|
+
return r = +r, o = o >>> 0, h || re(this, r, o, 2, 65535, 0), this[o] = r >>> 8, this[o + 1] = r & 255, o + 2;
|
|
1629
1629
|
}, l.prototype.writeUint32LE = l.prototype.writeUInt32LE = function(r, o, h) {
|
|
1630
|
-
return r = +r, o = o >>> 0, h ||
|
|
1630
|
+
return r = +r, o = o >>> 0, h || re(this, r, o, 4, 4294967295, 0), this[o + 3] = r >>> 24, this[o + 2] = r >>> 16, this[o + 1] = r >>> 8, this[o] = r & 255, o + 4;
|
|
1631
1631
|
}, l.prototype.writeUint32BE = l.prototype.writeUInt32BE = function(r, o, h) {
|
|
1632
|
-
return r = +r, o = o >>> 0, h ||
|
|
1632
|
+
return r = +r, o = o >>> 0, h || re(this, r, o, 4, 4294967295, 0), this[o] = r >>> 24, this[o + 1] = r >>> 16, this[o + 2] = r >>> 8, this[o + 3] = r & 255, o + 4;
|
|
1633
1633
|
};
|
|
1634
1634
|
function Wt(d, r, o, h, _) {
|
|
1635
1635
|
Yt(r, h, _, d, o, 7);
|
|
@@ -1651,32 +1651,32 @@ function Yn() {
|
|
|
1651
1651
|
return jt(this, r, o, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
1652
1652
|
}), l.prototype.writeIntLE = function(r, o, h, _) {
|
|
1653
1653
|
if (r = +r, o = o >>> 0, !_) {
|
|
1654
|
-
const
|
|
1655
|
-
|
|
1654
|
+
const $ = Math.pow(2, 8 * h - 1);
|
|
1655
|
+
re(this, r, o, h, $ - 1, -$);
|
|
1656
1656
|
}
|
|
1657
|
-
let g = 0, v = 1,
|
|
1657
|
+
let g = 0, v = 1, N = 0;
|
|
1658
1658
|
for (this[o] = r & 255; ++g < h && (v *= 256); )
|
|
1659
|
-
r < 0 &&
|
|
1659
|
+
r < 0 && N === 0 && this[o + g - 1] !== 0 && (N = 1), this[o + g] = (r / v >> 0) - N & 255;
|
|
1660
1660
|
return o + h;
|
|
1661
1661
|
}, l.prototype.writeIntBE = function(r, o, h, _) {
|
|
1662
1662
|
if (r = +r, o = o >>> 0, !_) {
|
|
1663
|
-
const
|
|
1664
|
-
|
|
1663
|
+
const $ = Math.pow(2, 8 * h - 1);
|
|
1664
|
+
re(this, r, o, h, $ - 1, -$);
|
|
1665
1665
|
}
|
|
1666
|
-
let g = h - 1, v = 1,
|
|
1666
|
+
let g = h - 1, v = 1, N = 0;
|
|
1667
1667
|
for (this[o + g] = r & 255; --g >= 0 && (v *= 256); )
|
|
1668
|
-
r < 0 &&
|
|
1668
|
+
r < 0 && N === 0 && this[o + g + 1] !== 0 && (N = 1), this[o + g] = (r / v >> 0) - N & 255;
|
|
1669
1669
|
return o + h;
|
|
1670
1670
|
}, l.prototype.writeInt8 = function(r, o, h) {
|
|
1671
|
-
return r = +r, o = o >>> 0, h ||
|
|
1671
|
+
return r = +r, o = o >>> 0, h || re(this, r, o, 1, 127, -128), r < 0 && (r = 255 + r + 1), this[o] = r & 255, o + 1;
|
|
1672
1672
|
}, l.prototype.writeInt16LE = function(r, o, h) {
|
|
1673
|
-
return r = +r, o = o >>> 0, h ||
|
|
1673
|
+
return r = +r, o = o >>> 0, h || re(this, r, o, 2, 32767, -32768), this[o] = r & 255, this[o + 1] = r >>> 8, o + 2;
|
|
1674
1674
|
}, l.prototype.writeInt16BE = function(r, o, h) {
|
|
1675
|
-
return r = +r, o = o >>> 0, h ||
|
|
1675
|
+
return r = +r, o = o >>> 0, h || re(this, r, o, 2, 32767, -32768), this[o] = r >>> 8, this[o + 1] = r & 255, o + 2;
|
|
1676
1676
|
}, l.prototype.writeInt32LE = function(r, o, h) {
|
|
1677
|
-
return r = +r, o = o >>> 0, h ||
|
|
1677
|
+
return r = +r, o = o >>> 0, h || re(this, r, o, 4, 2147483647, -2147483648), this[o] = r & 255, this[o + 1] = r >>> 8, this[o + 2] = r >>> 16, this[o + 3] = r >>> 24, o + 4;
|
|
1678
1678
|
}, l.prototype.writeInt32BE = function(r, o, h) {
|
|
1679
|
-
return r = +r, o = o >>> 0, h ||
|
|
1679
|
+
return r = +r, o = o >>> 0, h || re(this, r, o, 4, 2147483647, -2147483648), r < 0 && (r = 4294967295 + r + 1), this[o] = r >>> 24, this[o + 1] = r >>> 16, this[o + 2] = r >>> 8, this[o + 3] = r & 255, o + 4;
|
|
1680
1680
|
}, l.prototype.writeBigInt64LE = fe(function(r, o = 0) {
|
|
1681
1681
|
return Wt(this, r, o, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
1682
1682
|
}), l.prototype.writeBigInt64BE = fe(function(r, o = 0) {
|
|
@@ -1736,11 +1736,11 @@ function Yn() {
|
|
|
1736
1736
|
for (g = o; g < h; ++g)
|
|
1737
1737
|
this[g] = r;
|
|
1738
1738
|
else {
|
|
1739
|
-
const v = l.isBuffer(r) ? r : l.from(r, _),
|
|
1740
|
-
if (
|
|
1739
|
+
const v = l.isBuffer(r) ? r : l.from(r, _), N = v.length;
|
|
1740
|
+
if (N === 0)
|
|
1741
1741
|
throw new TypeError('The value "' + r + '" is invalid for argument "value"');
|
|
1742
1742
|
for (g = 0; g < h - o; ++g)
|
|
1743
|
-
this[g + o] = v[g %
|
|
1743
|
+
this[g + o] = v[g % N];
|
|
1744
1744
|
}
|
|
1745
1745
|
return this;
|
|
1746
1746
|
};
|
|
@@ -1803,8 +1803,8 @@ function Yn() {
|
|
|
1803
1803
|
function Yt(d, r, o, h, _, g) {
|
|
1804
1804
|
if (d > o || d < r) {
|
|
1805
1805
|
const v = typeof r == "bigint" ? "n" : "";
|
|
1806
|
-
let
|
|
1807
|
-
throw r === 0 || r === BigInt(0) ?
|
|
1806
|
+
let N;
|
|
1807
|
+
throw r === 0 || r === BigInt(0) ? N = `>= 0${v} and < 2${v} ** ${(g + 1) * 8}${v}` : N = `>= -(2${v} ** ${(g + 1) * 8 - 1}${v}) and < 2 ** ${(g + 1) * 8 - 1}${v}`, new we.ERR_OUT_OF_RANGE("value", N, d);
|
|
1808
1808
|
}
|
|
1809
1809
|
pn(h, _, g);
|
|
1810
1810
|
}
|
|
@@ -2019,13 +2019,13 @@ const Fe = (t) => {
|
|
|
2019
2019
|
issues: []
|
|
2020
2020
|
}, l = ((i = s["inbound-rtp"]) === null || i === void 0 ? void 0 : i.filter((u) => u.kind === "video")) || [];
|
|
2021
2021
|
l.length > 0 && (c.personaVideoStream = [], l.forEach((u) => {
|
|
2022
|
-
var
|
|
2022
|
+
var T, E, S, b, R;
|
|
2023
2023
|
const A = {
|
|
2024
|
-
framesReceived: (
|
|
2024
|
+
framesReceived: (T = u.framesReceived) !== null && T !== void 0 ? T : "unknown",
|
|
2025
2025
|
framesDropped: (E = u.framesDropped) !== null && E !== void 0 ? E : "unknown",
|
|
2026
|
-
framesPerSecond: (
|
|
2027
|
-
packetsReceived: (
|
|
2028
|
-
packetsLost: (
|
|
2026
|
+
framesPerSecond: (S = u.framesPerSecond) !== null && S !== void 0 ? S : "unknown",
|
|
2027
|
+
packetsReceived: (b = u.packetsReceived) !== null && b !== void 0 ? b : "unknown",
|
|
2028
|
+
packetsLost: (R = u.packetsLost) !== null && R !== void 0 ? R : "unknown",
|
|
2029
2029
|
resolution: u.frameWidth && u.frameHeight ? `${u.frameWidth}x${u.frameHeight}` : void 0,
|
|
2030
2030
|
jitter: u.jitter !== void 0 ? u.jitter : void 0
|
|
2031
2031
|
};
|
|
@@ -2033,42 +2033,42 @@ const Fe = (t) => {
|
|
|
2033
2033
|
}));
|
|
2034
2034
|
const m = ((n = s["inbound-rtp"]) === null || n === void 0 ? void 0 : n.filter((u) => u.kind === "audio")) || [];
|
|
2035
2035
|
m.length > 0 && (c.personaAudioStream = [], m.forEach((u) => {
|
|
2036
|
-
var
|
|
2037
|
-
const
|
|
2038
|
-
packetsReceived: (
|
|
2036
|
+
var T, E, S;
|
|
2037
|
+
const b = {
|
|
2038
|
+
packetsReceived: (T = u.packetsReceived) !== null && T !== void 0 ? T : "unknown",
|
|
2039
2039
|
packetsLost: (E = u.packetsLost) !== null && E !== void 0 ? E : "unknown",
|
|
2040
|
-
audioLevel: (
|
|
2040
|
+
audioLevel: (S = u.audioLevel) !== null && S !== void 0 ? S : "unknown",
|
|
2041
2041
|
jitter: u.jitter !== void 0 ? u.jitter : void 0,
|
|
2042
2042
|
totalAudioEnergy: u.totalAudioEnergy !== void 0 ? u.totalAudioEnergy : void 0
|
|
2043
2043
|
};
|
|
2044
|
-
c.personaAudioStream.push(
|
|
2044
|
+
c.personaAudioStream.push(b);
|
|
2045
2045
|
}));
|
|
2046
2046
|
const f = ((a = s["outbound-rtp"]) === null || a === void 0 ? void 0 : a.filter((u) => u.kind === "audio")) || [];
|
|
2047
2047
|
f.length > 0 && (c.userAudioInput = [], f.forEach((u) => {
|
|
2048
|
-
var
|
|
2049
|
-
const
|
|
2050
|
-
packetsSent: (
|
|
2048
|
+
var T, E;
|
|
2049
|
+
const S = {
|
|
2050
|
+
packetsSent: (T = u.packetsSent) !== null && T !== void 0 ? T : "unknown",
|
|
2051
2051
|
retransmittedPackets: (E = u.retransmittedPacketsSent) !== null && E !== void 0 ? E : void 0,
|
|
2052
2052
|
avgPacketSendDelay: u.totalPacketSendDelay !== void 0 ? u.totalPacketSendDelay / (u.packetsSent || 1) * 1e3 : void 0
|
|
2053
2053
|
};
|
|
2054
|
-
c.userAudioInput.push(
|
|
2054
|
+
c.userAudioInput.push(S);
|
|
2055
2055
|
})), s.codec && (c.codecs = [], s.codec.forEach((u) => {
|
|
2056
|
-
const
|
|
2056
|
+
const T = {
|
|
2057
2057
|
status: u.payloadType ? "Active" : "Available",
|
|
2058
2058
|
mimeType: u.mimeType || "Unknown",
|
|
2059
2059
|
payloadType: u.payloadType || "N/A",
|
|
2060
2060
|
clockRate: u.clockRate || void 0,
|
|
2061
2061
|
channels: u.channels || void 0
|
|
2062
2062
|
};
|
|
2063
|
-
c.codecs.push(
|
|
2063
|
+
c.codecs.push(T);
|
|
2064
2064
|
})), s.transport && (c.transportLayer = [], s.transport.forEach((u) => {
|
|
2065
|
-
const
|
|
2065
|
+
const T = {
|
|
2066
2066
|
dtlsState: u.dtlsState || "unknown",
|
|
2067
2067
|
iceState: u.iceState || "unknown",
|
|
2068
2068
|
bytesSent: u.bytesSent || void 0,
|
|
2069
2069
|
bytesReceived: u.bytesReceived || void 0
|
|
2070
2070
|
};
|
|
2071
|
-
c.transportLayer.push(
|
|
2071
|
+
c.transportLayer.push(T);
|
|
2072
2072
|
}));
|
|
2073
2073
|
const p = [];
|
|
2074
2074
|
if (l.forEach((u) => {
|
|
@@ -2089,13 +2089,13 @@ const Fe = (t) => {
|
|
|
2089
2089
|
console.log(`DTLS State: ${u.dtlsState}`), console.log(`ICE State: ${u.iceState}`), (u.bytesReceived || u.bytesSent) && console.log(`Data Transfer (bytes) - Sent: ${(u.bytesSent || 0).toLocaleString()}, Received: ${(u.bytesReceived || 0).toLocaleString()}`);
|
|
2090
2090
|
}), console.groupEnd()), c.issues.length > 0 ? (console.group("⚠️ Potential Issues Detected"), c.issues.forEach((u) => console.warn(u)), console.groupEnd()) : console.log("✅ No significant issues detected"), console.groupEnd();
|
|
2091
2091
|
};
|
|
2092
|
-
var
|
|
2092
|
+
var X;
|
|
2093
2093
|
(function(t) {
|
|
2094
2094
|
t.CLIENT_ERROR_CODE_USAGE_LIMIT_REACHED = "CLIENT_ERROR_CODE_USAGE_LIMIT_REACHED", t.CLIENT_ERROR_CODE_SPEND_CAP_REACHED = "CLIENT_ERROR_CODE_SPEND_CAP_REACHED", t.CLIENT_ERROR_CODE_VALIDATION_ERROR = "CLIENT_ERROR_CODE_VALIDATION_ERROR", t.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR = "CLIENT_ERROR_CODE_AUTHENTICATION_ERROR", t.CLIENT_ERROR_CODE_SERVER_ERROR = "CLIENT_ERROR_CODE_SERVER_ERROR", t.CLIENT_ERROR_CODE_MAX_CONCURRENT_SESSIONS_REACHED = "CLIENT_ERROR_CODE_MAX_CONCURRENT_SESSIONS_REACHED", t.CLIENT_ERROR_CODE_SERVICE_BUSY = "CLIENT_ERROR_CODE_SERVICE_BUSY", t.CLIENT_ERROR_CODE_NO_PLAN_FOUND = "CLIENT_ERROR_CODE_NO_PLAN_FOUND", t.CLIENT_ERROR_CODE_UNKNOWN_ERROR = "CLIENT_ERROR_CODE_UNKNOWN_ERROR", t.CLIENT_ERROR_CODE_CONFIGURATION_ERROR = "CLIENT_ERROR_CODE_CONFIGURATION_ERROR";
|
|
2095
|
-
})(
|
|
2096
|
-
class
|
|
2095
|
+
})(X || (X = {}));
|
|
2096
|
+
class W extends Error {
|
|
2097
2097
|
constructor(e, i, n = 500, a) {
|
|
2098
|
-
super(e), this.name = "ClientError", this.code = i, this.statusCode = n, this.details = a, Object.setPrototypeOf(this,
|
|
2098
|
+
super(e), this.name = "ClientError", this.code = i, this.statusCode = n, this.details = a, Object.setPrototypeOf(this, W.prototype), Me(ce.CLIENT_METRIC_MEASUREMENT_ERROR, i, {
|
|
2099
2099
|
details: a,
|
|
2100
2100
|
statusCode: n
|
|
2101
2101
|
});
|
|
@@ -2205,10 +2205,10 @@ function hr(t) {
|
|
|
2205
2205
|
return "API Gateway wsPath must start with /";
|
|
2206
2206
|
}
|
|
2207
2207
|
}
|
|
2208
|
-
var
|
|
2208
|
+
var ee;
|
|
2209
2209
|
(function(t) {
|
|
2210
2210
|
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";
|
|
2211
|
-
})(
|
|
2211
|
+
})(ee || (ee = {}));
|
|
2212
2212
|
var se;
|
|
2213
2213
|
(function(t) {
|
|
2214
2214
|
t.SPEECH_TEXT = "speechText", t.CLIENT_TOOL_EVENT = "clientToolEvent", t.TOOL_CALL_STARTED_EVENT = "toolCallStarted", t.TOOL_CALL_COMPLETED_EVENT = "toolCallCompleted", t.TOOL_CALL_FAILED_EVENT = "toolCallFailed", t.REASONING_TEXT = "reasoningText", t.USER_SPEECH_STARTED = "userSpeechStarted", t.USER_SPEECH_ENDED = "userSpeechEnded", t.DIRECTOR_NOTE_CUE_APPLIED = "directorNoteCueApplied";
|
|
@@ -2221,14 +2221,14 @@ var ve;
|
|
|
2221
2221
|
(function(t) {
|
|
2222
2222
|
t.USER = "user", t.PERSONA = "persona";
|
|
2223
2223
|
})(ve || (ve = {}));
|
|
2224
|
-
var
|
|
2224
|
+
var x;
|
|
2225
2225
|
(function(t) {
|
|
2226
2226
|
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.TOOL_CALL_STARTED = "TOOL_CALL_STARTED", t.TOOL_CALL_COMPLETED = "TOOL_CALL_COMPLETED", t.TOOL_CALL_FAILED = "TOOL_CALL_FAILED", t.REASONING_HISTORY_UPDATED = "REASONING_HISTORY_UPDATED", t.REASONING_STREAM_EVENT_RECEIVED = "REASONING_STREAM_EVENT_RECEIVED", t.USER_SPEECH_STARTED = "USER_SPEECH_STARTED", t.USER_SPEECH_ENDED = "USER_SPEECH_ENDED", t.DIRECTOR_NOTE_CUE_APPLIED = "DIRECTOR_NOTE_CUE_APPLIED";
|
|
2227
|
-
})(
|
|
2228
|
-
var
|
|
2227
|
+
})(x || (x = {}));
|
|
2228
|
+
var F;
|
|
2229
2229
|
(function(t) {
|
|
2230
2230
|
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_TOOL_CALL_STARTED_EVENT_RECEIVED = "WEBRTC_TOOL_CALL_STARTED_EVENT_RECEIVED", t.WEBRTC_TOOL_CALL_COMPLETED_EVENT_RECEIVED = "WEBRTC_TOOL_CALL_COMPLETED_EVENT_RECEIVED", t.WEBRTC_TOOL_CALL_FAILED_EVENT_RECEIVED = "WEBRTC_TOOL_CALL_FAILED_EVENT_RECEIVED", t.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED = "WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED", t.TOOL_CALL_RESULT_READY = "TOOL_CALL_RESULT_READY";
|
|
2231
|
-
})(
|
|
2231
|
+
})(F || (F = {}));
|
|
2232
2232
|
var de;
|
|
2233
2233
|
(function(t) {
|
|
2234
2234
|
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";
|
|
@@ -2309,17 +2309,17 @@ class gr {
|
|
|
2309
2309
|
if (this.stopSignal = !1, this.sendingBuffer = [], this.wsConnectionAttempts = 0, this.socket = null, this.permanentlyClosed = !1, this.iceRestartReconnectInProgress = !1, this.heartBeatIntervalRef = null, this.reconnectTimer = null, this.publicEventEmitter = n, this.internalEventEmitter = a, this.apiGatewayConfig = s, this.connectionMilestones = c, !e)
|
|
2310
2310
|
throw new Error("Signalling Client: sessionId is required");
|
|
2311
2311
|
this.sessionId = e;
|
|
2312
|
-
const { heartbeatIntervalSeconds:
|
|
2313
|
-
if (this.heartbeatIntervalSeconds =
|
|
2312
|
+
const { heartbeatIntervalSeconds: T, maxWsReconnectionAttempts: E, url: S } = i;
|
|
2313
|
+
if (this.heartbeatIntervalSeconds = T || pr, this.maxWsReconnectionAttempts = E || _r, !S.baseUrl)
|
|
2314
2314
|
throw new Error("Signalling Client: baseUrl is required");
|
|
2315
2315
|
if (!((l = this.apiGatewayConfig) === null || l === void 0) && l.enabled && (!((m = this.apiGatewayConfig) === null || m === void 0) && m.baseUrl)) {
|
|
2316
|
-
const
|
|
2317
|
-
|
|
2318
|
-
const A =
|
|
2319
|
-
|
|
2316
|
+
const b = new URL(this.apiGatewayConfig.baseUrl), R = (f = this.apiGatewayConfig.wsPath) !== null && f !== void 0 ? f : "/ws";
|
|
2317
|
+
b.protocol = b.protocol.replace("http", "ws"), b.pathname = R, this.url = b;
|
|
2318
|
+
const A = S.protocol || "https", w = A === "http" ? "ws" : "wss", O = `${A}://${S.baseUrl}`, k = (p = S.signallingPath) !== null && p !== void 0 ? p : "/ws", y = new URL(O);
|
|
2319
|
+
y.protocol = w === "ws" ? "ws:" : "wss:", S.port && (y.port = S.port), y.pathname = k, y.searchParams.append("session_id", e), this.url.searchParams.append("target_url", y.href);
|
|
2320
2320
|
} else {
|
|
2321
|
-
const
|
|
2322
|
-
this.url = new URL(
|
|
2321
|
+
const R = `${S.protocol || "https"}://${S.baseUrl}`;
|
|
2322
|
+
this.url = new URL(R), this.url.protocol = S.protocol === "http" ? "ws:" : "wss:", S.port && (this.url.port = S.port), this.url.pathname = (u = S.signallingPath) !== null && u !== void 0 ? u : "/ws", this.url.searchParams.append("session_id", e);
|
|
2323
2323
|
}
|
|
2324
2324
|
}
|
|
2325
2325
|
stop() {
|
|
@@ -2384,7 +2384,7 @@ class gr {
|
|
|
2384
2384
|
userUid: this.sessionId
|
|
2385
2385
|
// TODO: this should be renamed to session ID on the server
|
|
2386
2386
|
}, n = {
|
|
2387
|
-
actionType:
|
|
2387
|
+
actionType: ee.OFFER,
|
|
2388
2388
|
sessionId: this.sessionId,
|
|
2389
2389
|
payload: i
|
|
2390
2390
|
};
|
|
@@ -2394,7 +2394,7 @@ class gr {
|
|
|
2394
2394
|
sendIceCandidate(e) {
|
|
2395
2395
|
return Ae(this, void 0, void 0, function* () {
|
|
2396
2396
|
const i = {
|
|
2397
|
-
actionType:
|
|
2397
|
+
actionType: ee.ICE_CANDIDATE,
|
|
2398
2398
|
sessionId: this.sessionId,
|
|
2399
2399
|
payload: e.toJSON()
|
|
2400
2400
|
};
|
|
@@ -2415,7 +2415,7 @@ class gr {
|
|
|
2415
2415
|
sendTalkMessage(e) {
|
|
2416
2416
|
return Ae(this, void 0, void 0, function* () {
|
|
2417
2417
|
const i = {
|
|
2418
|
-
actionType:
|
|
2418
|
+
actionType: ee.TALK_STREAM_INPUT,
|
|
2419
2419
|
sessionId: this.sessionId,
|
|
2420
2420
|
payload: e
|
|
2421
2421
|
};
|
|
@@ -2424,7 +2424,7 @@ class gr {
|
|
|
2424
2424
|
}
|
|
2425
2425
|
sendAgentAudioInput(e) {
|
|
2426
2426
|
const i = {
|
|
2427
|
-
actionType:
|
|
2427
|
+
actionType: ee.AGENT_AUDIO_INPUT,
|
|
2428
2428
|
sessionId: this.sessionId,
|
|
2429
2429
|
payload: e
|
|
2430
2430
|
};
|
|
@@ -2432,7 +2432,7 @@ class gr {
|
|
|
2432
2432
|
}
|
|
2433
2433
|
sendAgentAudioInputEnd() {
|
|
2434
2434
|
const e = {
|
|
2435
|
-
actionType:
|
|
2435
|
+
actionType: ee.AGENT_AUDIO_INPUT_END,
|
|
2436
2436
|
sessionId: this.sessionId,
|
|
2437
2437
|
payload: {}
|
|
2438
2438
|
};
|
|
@@ -2448,9 +2448,9 @@ class gr {
|
|
|
2448
2448
|
try {
|
|
2449
2449
|
(i = this.connectionMilestones) === null || i === void 0 || i.record("websocket_open", {
|
|
2450
2450
|
attemptNumber: this.wsConnectionAttempts + 1
|
|
2451
|
-
}), this.wsConnectionAttempts = 0, this.flushSendingBuffer(), e.onmessage = this.onMessage.bind(this), this.startSendingHeartBeats(), this.internalEventEmitter.emit(
|
|
2451
|
+
}), this.wsConnectionAttempts = 0, this.flushSendingBuffer(), e.onmessage = this.onMessage.bind(this), this.startSendingHeartBeats(), this.internalEventEmitter.emit(F.WEB_SOCKET_OPEN);
|
|
2452
2452
|
} catch (n) {
|
|
2453
|
-
console.error("SignallingClient - onOpen: error in onOpen", n), this.publicEventEmitter.emit(
|
|
2453
|
+
console.error("SignallingClient - onOpen: error in onOpen", n), this.publicEventEmitter.emit(x.CONNECTION_CLOSED, de.SIGNALLING_CLIENT_CONNECTION_FAILURE), this.permanentlyClosed = !0;
|
|
2454
2454
|
}
|
|
2455
2455
|
});
|
|
2456
2456
|
}
|
|
@@ -2479,7 +2479,7 @@ class gr {
|
|
|
2479
2479
|
this.clearReconnectTimer(), this.heartBeatIntervalRef && (clearInterval(this.heartBeatIntervalRef), this.heartBeatIntervalRef = null), (s = this.connectionMilestones) === null || s === void 0 || s.publishFailure({
|
|
2480
2480
|
failureStage: "websocket",
|
|
2481
2481
|
closeCode: i?.code
|
|
2482
|
-
}), this.publicEventEmitter.emit(
|
|
2482
|
+
}), this.publicEventEmitter.emit(x.CONNECTION_CLOSED, de.SIGNALLING_CLIENT_CONNECTION_FAILURE), this.iceRestartReconnectInProgress = !1, this.permanentlyClosed = !0;
|
|
2483
2483
|
});
|
|
2484
2484
|
}
|
|
2485
2485
|
getMaxReconnectionAttempts() {
|
|
@@ -2501,7 +2501,7 @@ class gr {
|
|
|
2501
2501
|
onMessage(e) {
|
|
2502
2502
|
return Ae(this, void 0, void 0, function* () {
|
|
2503
2503
|
const i = JSON.parse(e.data);
|
|
2504
|
-
this.internalEventEmitter.emit(
|
|
2504
|
+
this.internalEventEmitter.emit(F.SIGNAL_MESSAGE_RECEIVED, i);
|
|
2505
2505
|
});
|
|
2506
2506
|
}
|
|
2507
2507
|
startSendingHeartBeats() {
|
|
@@ -2509,7 +2509,7 @@ class gr {
|
|
|
2509
2509
|
throw new Error("SignallingClient - startSendingHeartBeats: socket is null");
|
|
2510
2510
|
this.heartBeatIntervalRef && console.warn("SignallingClient - startSendingHeartBeats: heartbeat interval already set");
|
|
2511
2511
|
const e = this.heartbeatIntervalSeconds * 1e3, i = {
|
|
2512
|
-
actionType:
|
|
2512
|
+
actionType: ee.HEARTBEAT,
|
|
2513
2513
|
sessionId: this.sessionId,
|
|
2514
2514
|
payload: ""
|
|
2515
2515
|
}, n = JSON.stringify(i);
|
|
@@ -2573,7 +2573,7 @@ class vr {
|
|
|
2573
2573
|
return Et(this, void 0, void 0, function* () {
|
|
2574
2574
|
if (!this.sessionToken) {
|
|
2575
2575
|
if (!e)
|
|
2576
|
-
throw new
|
|
2576
|
+
throw new W("Persona configuration must be provided when using apiKey", X.CLIENT_ERROR_CODE_VALIDATION_ERROR, 400);
|
|
2577
2577
|
this.sessionToken = yield this.unsafe_getSessionToken(e);
|
|
2578
2578
|
}
|
|
2579
2579
|
e && "brainType" in e && console.warn("Warning: brainType is deprecated and will be removed in a future version. Please use llmId instead.");
|
|
@@ -2612,22 +2612,22 @@ class vr {
|
|
|
2612
2612
|
case 201:
|
|
2613
2613
|
return f;
|
|
2614
2614
|
case 400:
|
|
2615
|
-
throw new
|
|
2615
|
+
throw new W("Invalid request to start session", X.CLIENT_ERROR_CODE_VALIDATION_ERROR, 400, { cause: f.message });
|
|
2616
2616
|
case 401:
|
|
2617
|
-
throw new
|
|
2617
|
+
throw new W("Authentication failed when starting session", X.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 401, { cause: f.message });
|
|
2618
2618
|
case 402:
|
|
2619
|
-
throw new
|
|
2619
|
+
throw new W("Please sign up for a plan to start a session", X.CLIENT_ERROR_CODE_NO_PLAN_FOUND, 402, { cause: f.message });
|
|
2620
2620
|
case 403:
|
|
2621
|
-
throw new
|
|
2621
|
+
throw new W("Authentication failed when starting session", X.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 403, { cause: f.message });
|
|
2622
2622
|
case 429:
|
|
2623
|
-
throw p === "Concurrent session limit reached" ? new
|
|
2623
|
+
throw p === "Concurrent session limit reached" ? new W("Concurrency limit reached, please upgrade your plan", X.CLIENT_ERROR_CODE_MAX_CONCURRENT_SESSIONS_REACHED, 429, { cause: f.message }) : p === "Spend cap reached" ? new W("Spend cap reached, please upgrade your plan", X.CLIENT_ERROR_CODE_SPEND_CAP_REACHED, 429, { cause: f.message }) : new W("Usage limit reached, please upgrade your plan", X.CLIENT_ERROR_CODE_USAGE_LIMIT_REACHED, 429, { cause: f.message });
|
|
2624
2624
|
case 503:
|
|
2625
|
-
throw new
|
|
2625
|
+
throw new W("There are no available personas, please try again later", X.CLIENT_ERROR_CODE_SERVICE_BUSY, 503, { cause: f.message });
|
|
2626
2626
|
default:
|
|
2627
|
-
throw new
|
|
2627
|
+
throw new W("Unknown error when starting session", X.CLIENT_ERROR_CODE_SERVER_ERROR, m.status, { cause: f.message });
|
|
2628
2628
|
}
|
|
2629
2629
|
} catch (s) {
|
|
2630
|
-
throw s instanceof
|
|
2630
|
+
throw s instanceof W ? s : new W("Failed to start session", X.CLIENT_ERROR_CODE_SERVER_ERROR, 500, { cause: s instanceof Error ? s.message : String(s) });
|
|
2631
2631
|
} finally {
|
|
2632
2632
|
a !== void 0 && clearTimeout(a);
|
|
2633
2633
|
}
|
|
@@ -2673,7 +2673,7 @@ function nt(t, e) {
|
|
|
2673
2673
|
return typeof t == "number" && Number.isFinite(t) ? t : e;
|
|
2674
2674
|
}
|
|
2675
2675
|
function Sr(t) {
|
|
2676
|
-
return t instanceof
|
|
2676
|
+
return t instanceof W ? t.statusCode >= 500 && t.statusCode < 600 : !0;
|
|
2677
2677
|
}
|
|
2678
2678
|
function Tr(t) {
|
|
2679
2679
|
return new Promise((e) => setTimeout(e, t));
|
|
@@ -2756,7 +2756,7 @@ class br {
|
|
|
2756
2756
|
}
|
|
2757
2757
|
class wr {
|
|
2758
2758
|
constructor(e, i) {
|
|
2759
|
-
this.messages = [], this.publicEventEmitter = e, this.internalEventEmitter = i, this.internalEventEmitter.addListener(
|
|
2759
|
+
this.messages = [], this.publicEventEmitter = e, this.internalEventEmitter = i, this.internalEventEmitter.addListener(F.WEBRTC_CHAT_MESSAGE_RECEIVED, this.processWebRtcTextMessageEvent.bind(this));
|
|
2760
2760
|
}
|
|
2761
2761
|
webRtcTextMessageEventToMessageStreamEvent(e) {
|
|
2762
2762
|
return Object.assign({ id: `${e.role}::${e.message_id}`, content: e.content, role: e.role, endOfSpeech: e.end_of_speech, interrupted: e.interrupted }, e.cue_tag ? { cueTag: e.cue_tag } : {});
|
|
@@ -2784,7 +2784,7 @@ class wr {
|
|
|
2784
2784
|
}
|
|
2785
2785
|
processWebRtcTextMessageEvent(e) {
|
|
2786
2786
|
const i = this.webRtcTextMessageEventToMessageStreamEvent(e);
|
|
2787
|
-
switch (this.publicEventEmitter.emit(
|
|
2787
|
+
switch (this.publicEventEmitter.emit(x.MESSAGE_STREAM_EVENT_RECEIVED, i), i.role) {
|
|
2788
2788
|
case ve.USER:
|
|
2789
2789
|
this.processUserMessage(i);
|
|
2790
2790
|
break;
|
|
@@ -2792,7 +2792,7 @@ class wr {
|
|
|
2792
2792
|
this.processPersonaMessage(i);
|
|
2793
2793
|
break;
|
|
2794
2794
|
}
|
|
2795
|
-
i.endOfSpeech && this.publicEventEmitter.emit(
|
|
2795
|
+
i.endOfSpeech && this.publicEventEmitter.emit(x.MESSAGE_HISTORY_UPDATED, this.messages);
|
|
2796
2796
|
}
|
|
2797
2797
|
}
|
|
2798
2798
|
class Rr {
|
|
@@ -2806,7 +2806,7 @@ class Rr {
|
|
|
2806
2806
|
this.listeners[e] && this.listeners[e].delete(i);
|
|
2807
2807
|
}
|
|
2808
2808
|
emit(e, ...i) {
|
|
2809
|
-
if (e ===
|
|
2809
|
+
if (e === x.CONNECTION_ESTABLISHED && Me(ce.CLIENT_METRIC_MEASUREMENT_CONNECTION_ESTABLISHED, "1"), e === x.CONNECTION_CLOSED) {
|
|
2810
2810
|
const [n, a] = i;
|
|
2811
2811
|
Me(ce.CLIENT_METRIC_MEASUREMENT_CONNECTION_CLOSED, n, a ? { details: a } : void 0);
|
|
2812
2812
|
}
|
|
@@ -2815,10 +2815,10 @@ class Rr {
|
|
|
2815
2815
|
});
|
|
2816
2816
|
}
|
|
2817
2817
|
}
|
|
2818
|
-
var
|
|
2818
|
+
var ne;
|
|
2819
2819
|
(function(t) {
|
|
2820
2820
|
t[t.UNSTARTED = 0] = "UNSTARTED", t[t.STREAMING = 1] = "STREAMING", t[t.INTERRUPTED = 2] = "INTERRUPTED", t[t.ENDED = 3] = "ENDED";
|
|
2821
|
-
})(
|
|
2821
|
+
})(ne || (ne = {}));
|
|
2822
2822
|
var vt = function(t, e, i, n) {
|
|
2823
2823
|
function a(s) {
|
|
2824
2824
|
return s instanceof i ? s : new i(function(c) {
|
|
@@ -2848,23 +2848,23 @@ var vt = function(t, e, i, n) {
|
|
|
2848
2848
|
};
|
|
2849
2849
|
class Ar {
|
|
2850
2850
|
constructor(e, i, n) {
|
|
2851
|
-
this.state =
|
|
2851
|
+
this.state = ne.UNSTARTED, this.correlationId = e, this.internalEventEmitter = i, this.signallingClient = n, this.internalEventEmitter.addListener(F.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this));
|
|
2852
2852
|
}
|
|
2853
2853
|
onDeactivate() {
|
|
2854
|
-
this.internalEventEmitter.removeListener(
|
|
2854
|
+
this.internalEventEmitter.removeListener(F.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this));
|
|
2855
2855
|
}
|
|
2856
2856
|
onSignalMessage(e) {
|
|
2857
2857
|
return vt(this, void 0, void 0, function* () {
|
|
2858
|
-
e.actionType ===
|
|
2858
|
+
e.actionType === ee.TALK_STREAM_INTERRUPTED && e.payload.correlationId === this.correlationId && (this.state = ne.INTERRUPTED, this.onDeactivate());
|
|
2859
2859
|
});
|
|
2860
2860
|
}
|
|
2861
2861
|
endMessage() {
|
|
2862
2862
|
return vt(this, void 0, void 0, function* () {
|
|
2863
|
-
if (this.state ===
|
|
2863
|
+
if (this.state === ne.ENDED) {
|
|
2864
2864
|
console.warn("Talk stream is already ended via end of speech. No need to call endMessage.");
|
|
2865
2865
|
return;
|
|
2866
2866
|
}
|
|
2867
|
-
if (this.state !==
|
|
2867
|
+
if (this.state !== ne.STREAMING) {
|
|
2868
2868
|
console.warn("Talk stream is not in an active state: " + this.state);
|
|
2869
2869
|
return;
|
|
2870
2870
|
}
|
|
@@ -2874,27 +2874,27 @@ class Ar {
|
|
|
2874
2874
|
endOfSpeech: !0,
|
|
2875
2875
|
correlationId: this.correlationId
|
|
2876
2876
|
};
|
|
2877
|
-
yield this.signallingClient.sendTalkMessage(e), this.state =
|
|
2877
|
+
yield this.signallingClient.sendTalkMessage(e), this.state = ne.ENDED, this.onDeactivate();
|
|
2878
2878
|
});
|
|
2879
2879
|
}
|
|
2880
2880
|
streamMessageChunk(e, i) {
|
|
2881
2881
|
return vt(this, void 0, void 0, function* () {
|
|
2882
|
-
if (this.state !==
|
|
2882
|
+
if (this.state !== ne.STREAMING && this.state !== ne.UNSTARTED)
|
|
2883
2883
|
throw new Error("Talk stream is not in an active state: " + this.state);
|
|
2884
2884
|
const n = {
|
|
2885
2885
|
content: e,
|
|
2886
|
-
startOfSpeech: this.state ===
|
|
2886
|
+
startOfSpeech: this.state === ne.UNSTARTED,
|
|
2887
2887
|
endOfSpeech: i,
|
|
2888
2888
|
correlationId: this.correlationId
|
|
2889
2889
|
};
|
|
2890
|
-
this.state = i ?
|
|
2890
|
+
this.state = i ? ne.ENDED : ne.STREAMING, this.state === ne.ENDED && this.onDeactivate(), yield this.signallingClient.sendTalkMessage(n);
|
|
2891
2891
|
});
|
|
2892
2892
|
}
|
|
2893
2893
|
getCorrelationId() {
|
|
2894
2894
|
return this.correlationId;
|
|
2895
2895
|
}
|
|
2896
2896
|
isActive() {
|
|
2897
|
-
return this.state ===
|
|
2897
|
+
return this.state === ne.STREAMING || this.state === ne.UNSTARTED;
|
|
2898
2898
|
}
|
|
2899
2899
|
getState() {
|
|
2900
2900
|
return this.state;
|
|
@@ -3007,7 +3007,7 @@ class hn {
|
|
|
3007
3007
|
return;
|
|
3008
3008
|
const c = this.handlers[i];
|
|
3009
3009
|
if (c.onComplete) {
|
|
3010
|
-
e.tool_type === "client" && this.publicEventEmitter.emit(
|
|
3010
|
+
e.tool_type === "client" && this.publicEventEmitter.emit(x.TOOL_CALL_COMPLETED, s);
|
|
3011
3011
|
try {
|
|
3012
3012
|
yield c.onComplete(s);
|
|
3013
3013
|
} catch (l) {
|
|
@@ -3027,7 +3027,7 @@ class hn {
|
|
|
3027
3027
|
return;
|
|
3028
3028
|
const c = this.handlers[i];
|
|
3029
3029
|
if (c.onFail) {
|
|
3030
|
-
e.tool_type === "client" && this.publicEventEmitter.emit(
|
|
3030
|
+
e.tool_type === "client" && this.publicEventEmitter.emit(x.TOOL_CALL_FAILED, s);
|
|
3031
3031
|
try {
|
|
3032
3032
|
yield c.onFail(s);
|
|
3033
3033
|
} catch (l) {
|
|
@@ -3050,7 +3050,7 @@ class hn {
|
|
|
3050
3050
|
userActionCorrelationId: e.userActionCorrelationId,
|
|
3051
3051
|
timestampUserAction: e.timestampUserAction
|
|
3052
3052
|
};
|
|
3053
|
-
this.internalEventEmitter.emit(
|
|
3053
|
+
this.internalEventEmitter.emit(F.TOOL_CALL_RESULT_READY, i);
|
|
3054
3054
|
}
|
|
3055
3055
|
/**
|
|
3056
3056
|
* Converts a WebRtcClientToolEvent to a ClientToolEvent
|
|
@@ -3126,7 +3126,7 @@ class hn {
|
|
|
3126
3126
|
};
|
|
3127
3127
|
}
|
|
3128
3128
|
}
|
|
3129
|
-
var
|
|
3129
|
+
var Q = function(t, e, i, n) {
|
|
3130
3130
|
function a(s) {
|
|
3131
3131
|
return s instanceof i ? s : new i(function(c) {
|
|
3132
3132
|
c(s);
|
|
@@ -3162,7 +3162,7 @@ class Lr {
|
|
|
3162
3162
|
permissionState: ge.NOT_REQUESTED
|
|
3163
3163
|
}, this.successMetricPoller = null, this.successMetricFired = !1, this.showPeerConnectionStatsReport = !1, this.peerConnectionStatsReportOutputFormat = "console", this.statsCollectionInterval = null, this.agentAudioInputStream = null, this.firstLocalIceCandidateSent = !1, this.firstRemoteIceCandidateReceived = !1, this.firstRemoteIceCandidateApplied = !1, this.connectionEstablishedMilestoneRecorded = !1, this.publicEventEmitter = n, this.internalEventEmitter = a, this.toolCallManager = s, this.connectionMilestones = c, this.apiGatewayConfig = i.apiGateway;
|
|
3164
3164
|
const { inputAudio: u } = i;
|
|
3165
|
-
this.inputAudioState = u.inputAudioState, i.inputAudio.userProvidedMediaStream && (this.inputAudioStream = i.inputAudio.userProvidedMediaStream), this.disableInputAudio = i.inputAudio.disableInputAudio === !0, this.internalEventEmitter.addListener(
|
|
3165
|
+
this.inputAudioState = u.inputAudioState, i.inputAudio.userProvidedMediaStream && (this.inputAudioStream = i.inputAudio.userProvidedMediaStream), this.disableInputAudio = i.inputAudio.disableInputAudio === !0, this.internalEventEmitter.addListener(F.WEB_SOCKET_OPEN, this.onSignallingClientConnected.bind(this)), this.internalEventEmitter.addListener(F.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this)), this.internalEventEmitter.addListener(F.WEBRTC_TOOL_CALL_STARTED_EVENT_RECEIVED, this.toolCallManager.processToolCallStartedEvent.bind(this.toolCallManager)), this.internalEventEmitter.addListener(F.WEBRTC_TOOL_CALL_COMPLETED_EVENT_RECEIVED, this.toolCallManager.processToolCallCompletedEvent.bind(this.toolCallManager)), this.internalEventEmitter.addListener(F.WEBRTC_TOOL_CALL_FAILED_EVENT_RECEIVED, this.toolCallManager.processToolCallFailedEvent.bind(this.toolCallManager)), this.internalEventEmitter.addListener(F.TOOL_CALL_RESULT_READY, this.onToolCallResultReceived.bind(this)), this.iceServers = i.iceServers, this.iceTransportPolicy = i.iceTransportPolicy, this.rtcConfiguration = i.rtcConfiguration, this.signallingClient = new gr(e, i.signalling, this.publicEventEmitter, this.internalEventEmitter, this.apiGatewayConfig, this.connectionMilestones), this.engineApiRestClient = new Ir(i.engine.baseUrl, e, this.apiGatewayConfig), this.audioDeviceId = i.inputAudio.audioDeviceId, this.showPeerConnectionStatsReport = (m = (l = i.metrics) === null || l === void 0 ? void 0 : l.showPeerConnectionStatsReport) !== null && m !== void 0 ? m : !1, this.peerConnectionStatsReportOutputFormat = (p = (f = i.metrics) === null || f === void 0 ? void 0 : f.peerConnectionStatsReportOutputFormat) !== null && p !== void 0 ? p : "console";
|
|
3166
3166
|
}
|
|
3167
3167
|
onInputAudioStateChange(e, i) {
|
|
3168
3168
|
e.isMuted !== i.isMuted && (i.isMuted ? this.muteAllAudioTracks() : this.unmuteAllAudioTracks());
|
|
@@ -3180,7 +3180,7 @@ class Lr {
|
|
|
3180
3180
|
});
|
|
3181
3181
|
}
|
|
3182
3182
|
startStatsCollection() {
|
|
3183
|
-
this.statsCollectionInterval || (this.statsCollectionInterval = setInterval(() =>
|
|
3183
|
+
this.statsCollectionInterval || (this.statsCollectionInterval = setInterval(() => Q(this, void 0, void 0, function* () {
|
|
3184
3184
|
if (!(!this.peerConnection || !this.dataChannel || this.dataChannel.readyState !== "open"))
|
|
3185
3185
|
try {
|
|
3186
3186
|
const e = yield this.peerConnection.getStats();
|
|
@@ -3219,7 +3219,7 @@ class Lr {
|
|
|
3219
3219
|
timeoutMs: St
|
|
3220
3220
|
}), console.warn("No video frames received, there is a problem with the connection."), clearInterval(this.successMetricPoller), this.successMetricPoller = null);
|
|
3221
3221
|
}, St);
|
|
3222
|
-
this.successMetricPoller = setInterval(() =>
|
|
3222
|
+
this.successMetricPoller = setInterval(() => Q(this, void 0, void 0, function* () {
|
|
3223
3223
|
if (!this.peerConnection || this.successMetricFired) {
|
|
3224
3224
|
this.successMetricPoller && clearInterval(this.successMetricPoller), clearTimeout(e);
|
|
3225
3225
|
return;
|
|
@@ -3250,7 +3250,7 @@ class Lr {
|
|
|
3250
3250
|
return this.peerConnection;
|
|
3251
3251
|
}
|
|
3252
3252
|
changeAudioInputDevice(e) {
|
|
3253
|
-
return
|
|
3253
|
+
return Q(this, void 0, void 0, function* () {
|
|
3254
3254
|
if (!this.peerConnection)
|
|
3255
3255
|
throw new Error("StreamingClient - changeAudioInputDevice: peer connection is not initialized. Start streaming first.");
|
|
3256
3256
|
if (e == null)
|
|
@@ -3268,7 +3268,7 @@ class Lr {
|
|
|
3268
3268
|
};
|
|
3269
3269
|
this.inputAudioStream = yield navigator.mediaDevices.getUserMedia({
|
|
3270
3270
|
audio: n
|
|
3271
|
-
}), this.audioDeviceId = e, yield this.setupAudioTrack(), i && this.muteAllAudioTracks(), this.publicEventEmitter.emit(
|
|
3271
|
+
}), this.audioDeviceId = e, yield this.setupAudioTrack(), i && this.muteAllAudioTracks(), this.publicEventEmitter.emit(x.INPUT_AUDIO_DEVICE_CHANGED, e);
|
|
3272
3272
|
} catch (n) {
|
|
3273
3273
|
throw console.error("Failed to change audio input device:", n), new Error(`StreamingClient - changeAudioInputDevice: ${n instanceof Error ? n.message : String(n)}`);
|
|
3274
3274
|
}
|
|
@@ -3320,12 +3320,12 @@ class Lr {
|
|
|
3320
3320
|
this.firstLocalIceCandidateSent = !1, this.firstRemoteIceCandidateReceived = !1, this.firstRemoteIceCandidateApplied = !1, this.connectionEstablishedMilestoneRecorded = !1;
|
|
3321
3321
|
}
|
|
3322
3322
|
stopConnection() {
|
|
3323
|
-
return
|
|
3323
|
+
return Q(this, void 0, void 0, function* () {
|
|
3324
3324
|
yield this.shutdown();
|
|
3325
3325
|
});
|
|
3326
3326
|
}
|
|
3327
3327
|
sendTalkCommand(e) {
|
|
3328
|
-
return
|
|
3328
|
+
return Q(this, void 0, void 0, function* () {
|
|
3329
3329
|
if (!this.peerConnection)
|
|
3330
3330
|
throw new Error("StreamingClient - sendTalkCommand: peer connection is null");
|
|
3331
3331
|
yield this.engineApiRestClient.sendTalkCommand(e);
|
|
@@ -3341,7 +3341,7 @@ class Lr {
|
|
|
3341
3341
|
return this.agentAudioInputStream;
|
|
3342
3342
|
}
|
|
3343
3343
|
initPeerConnection() {
|
|
3344
|
-
return
|
|
3344
|
+
return Q(this, void 0, void 0, function* () {
|
|
3345
3345
|
var e, i, n, a, s, c, l, m, f, p;
|
|
3346
3346
|
(e = this.connectionMilestones) === null || e === void 0 || e.record("peer_connection_creating"), this.peerConnection = new RTCPeerConnection(Object.assign(Object.assign({
|
|
3347
3347
|
// SDK default first (caller's rtcConfiguration may override it)
|
|
@@ -3364,14 +3364,14 @@ class Lr {
|
|
|
3364
3364
|
});
|
|
3365
3365
|
}
|
|
3366
3366
|
onSignalMessage(e) {
|
|
3367
|
-
return
|
|
3367
|
+
return Q(this, void 0, void 0, function* () {
|
|
3368
3368
|
var i, n, a, s;
|
|
3369
3369
|
if (!this.peerConnection) {
|
|
3370
3370
|
console.error("StreamingClient - onSignalMessage: peerConnection is not initialized");
|
|
3371
3371
|
return;
|
|
3372
3372
|
}
|
|
3373
3373
|
switch (e.actionType) {
|
|
3374
|
-
case
|
|
3374
|
+
case ee.ANSWER: {
|
|
3375
3375
|
(i = this.connectionMilestones) === null || i === void 0 || i.record("answer_received");
|
|
3376
3376
|
const p = e.payload;
|
|
3377
3377
|
if (this.peerConnection.signalingState !== "have-local-offer")
|
|
@@ -3385,30 +3385,30 @@ class Lr {
|
|
|
3385
3385
|
(n = this.connectionMilestones) === null || n === void 0 || n.record("remote_description_set"), this.connectionReceivedAnswer = !0, this.onAnswerAccepted(), yield this.flushRemoteIceCandidateBuffer();
|
|
3386
3386
|
break;
|
|
3387
3387
|
}
|
|
3388
|
-
case
|
|
3388
|
+
case ee.ICE_CANDIDATE: {
|
|
3389
3389
|
const p = e.payload, u = new RTCIceCandidate(p);
|
|
3390
3390
|
this.firstRemoteIceCandidateReceived || (this.firstRemoteIceCandidateReceived = !0, (a = this.connectionMilestones) === null || a === void 0 || a.record("first_remote_ice_candidate_received", yt(u))), this.connectionReceivedAnswer ? yield this.addRemoteIceCandidate(u) : this.remoteIceCandidateBuffer.push(u);
|
|
3391
3391
|
break;
|
|
3392
3392
|
}
|
|
3393
|
-
case
|
|
3393
|
+
case ee.END_SESSION:
|
|
3394
3394
|
const c = e.payload;
|
|
3395
3395
|
this.sendIceRestartMetric("aborted"), (s = this.connectionMilestones) === null || s === void 0 || s.publishFailure({
|
|
3396
3396
|
failureStage: "server_closed_connection"
|
|
3397
|
-
}), this.publicEventEmitter.emit(
|
|
3397
|
+
}), this.publicEventEmitter.emit(x.CONNECTION_CLOSED, de.SERVER_CLOSED_CONNECTION, c), this.shutdown();
|
|
3398
3398
|
break;
|
|
3399
|
-
case
|
|
3399
|
+
case ee.WARNING:
|
|
3400
3400
|
const l = e.payload;
|
|
3401
|
-
console.warn("Warning received from server: " + l), this.publicEventEmitter.emit(
|
|
3401
|
+
console.warn("Warning received from server: " + l), this.publicEventEmitter.emit(x.SERVER_WARNING, l);
|
|
3402
3402
|
break;
|
|
3403
|
-
case
|
|
3403
|
+
case ee.TALK_STREAM_INTERRUPTED:
|
|
3404
3404
|
const m = e.payload;
|
|
3405
|
-
this.publicEventEmitter.emit(
|
|
3405
|
+
this.publicEventEmitter.emit(x.TALK_STREAM_INTERRUPTED, m.correlationId);
|
|
3406
3406
|
break;
|
|
3407
|
-
case
|
|
3407
|
+
case ee.SESSION_READY:
|
|
3408
3408
|
const f = e.sessionId;
|
|
3409
|
-
this.publicEventEmitter.emit(
|
|
3409
|
+
this.publicEventEmitter.emit(x.SESSION_READY, f);
|
|
3410
3410
|
break;
|
|
3411
|
-
case
|
|
3411
|
+
case ee.HEARTBEAT:
|
|
3412
3412
|
break;
|
|
3413
3413
|
default:
|
|
3414
3414
|
console.warn("StreamingClient - onSignalMessage: unknown signal message action type. Is your @anam-ai/js-sdk version up to date?", e);
|
|
@@ -3416,7 +3416,7 @@ class Lr {
|
|
|
3416
3416
|
});
|
|
3417
3417
|
}
|
|
3418
3418
|
onSignallingClientConnected() {
|
|
3419
|
-
return
|
|
3419
|
+
return Q(this, void 0, void 0, function* () {
|
|
3420
3420
|
if (!this.peerConnection)
|
|
3421
3421
|
try {
|
|
3422
3422
|
yield this.initPeerConnectionAndSendOffer();
|
|
@@ -3426,7 +3426,7 @@ class Lr {
|
|
|
3426
3426
|
});
|
|
3427
3427
|
}
|
|
3428
3428
|
flushRemoteIceCandidateBuffer() {
|
|
3429
|
-
return
|
|
3429
|
+
return Q(this, void 0, void 0, function* () {
|
|
3430
3430
|
const e = [...this.remoteIceCandidateBuffer];
|
|
3431
3431
|
this.remoteIceCandidateBuffer = [];
|
|
3432
3432
|
for (const i of e)
|
|
@@ -3442,7 +3442,7 @@ class Lr {
|
|
|
3442
3442
|
* genuine, successful add.
|
|
3443
3443
|
*/
|
|
3444
3444
|
addRemoteIceCandidate(e) {
|
|
3445
|
-
return
|
|
3445
|
+
return Q(this, void 0, void 0, function* () {
|
|
3446
3446
|
if (this.peerConnection)
|
|
3447
3447
|
try {
|
|
3448
3448
|
yield this.peerConnection.addIceCandidate(e), this.recordFirstRemoteIceCandidateApplied(e);
|
|
@@ -3481,7 +3481,7 @@ class Lr {
|
|
|
3481
3481
|
case "completed":
|
|
3482
3482
|
this.clearIceDisconnectedGraceTimer(), this.clearIceRestartWatchdog(), this.iceRestartInProgress = !1, this.sendIceRestartMetric("recovered"), this.iceRestartAttempts = 0, this.signallingClient.endIceRestartReconnect(), this.connectionEstablishedMilestoneRecorded || (this.connectionEstablishedMilestoneRecorded = !0, (n = this.connectionMilestones) === null || n === void 0 || n.record("client_connection_established", {
|
|
3483
3483
|
iceConnectionState: a
|
|
3484
|
-
})), this.connectionEstablishedEmitted || (this.connectionEstablishedEmitted = !0, this.publicEventEmitter.emit(
|
|
3484
|
+
})), this.connectionEstablishedEmitted || (this.connectionEstablishedEmitted = !0, this.publicEventEmitter.emit(x.CONNECTION_ESTABLISHED)), this.startStatsCollection();
|
|
3485
3485
|
break;
|
|
3486
3486
|
case "disconnected":
|
|
3487
3487
|
this.scheduleIceRestartAfterGrace();
|
|
@@ -3527,7 +3527,7 @@ class Lr {
|
|
|
3527
3527
|
}
|
|
3528
3528
|
// Clears the pending ensureSignallingConnected wait (timeout + listener).
|
|
3529
3529
|
clearPendingWsOpenWait() {
|
|
3530
|
-
this.pendingWsOpenTimeout && (clearTimeout(this.pendingWsOpenTimeout), this.pendingWsOpenTimeout = null), this.pendingWsOpenListener && (this.internalEventEmitter.removeListener(
|
|
3530
|
+
this.pendingWsOpenTimeout && (clearTimeout(this.pendingWsOpenTimeout), this.pendingWsOpenTimeout = null), this.pendingWsOpenListener && (this.internalEventEmitter.removeListener(F.WEB_SOCKET_OPEN, this.pendingWsOpenListener), this.pendingWsOpenListener = null), this.pendingWsOpenReject = null;
|
|
3531
3531
|
}
|
|
3532
3532
|
// Stops all restart activity: timers, pending WS wait, and the in-progress gate.
|
|
3533
3533
|
cancelIceRestart() {
|
|
@@ -3566,7 +3566,7 @@ class Lr {
|
|
|
3566
3566
|
const n = () => {
|
|
3567
3567
|
this.clearPendingWsOpenWait(), e();
|
|
3568
3568
|
};
|
|
3569
|
-
this.pendingWsOpenListener = n, this.internalEventEmitter.addListener(
|
|
3569
|
+
this.pendingWsOpenListener = n, this.internalEventEmitter.addListener(F.WEB_SOCKET_OPEN, n);
|
|
3570
3570
|
});
|
|
3571
3571
|
}
|
|
3572
3572
|
/**
|
|
@@ -3575,7 +3575,7 @@ class Lr {
|
|
|
3575
3575
|
* exhaustion or terminal signalling, falls back to the WebRTC-failure path.
|
|
3576
3576
|
*/
|
|
3577
3577
|
restartIce() {
|
|
3578
|
-
return
|
|
3578
|
+
return Q(this, void 0, void 0, function* () {
|
|
3579
3579
|
var e, i;
|
|
3580
3580
|
if (!(!this.peerConnection || this.iceRestartInProgress || this.iceRestartStopped)) {
|
|
3581
3581
|
if (this.signallingClient.isPermanentlyClosed()) {
|
|
@@ -3652,7 +3652,7 @@ class Lr {
|
|
|
3652
3652
|
}
|
|
3653
3653
|
handleWebrtcFailure(e) {
|
|
3654
3654
|
var i, n;
|
|
3655
|
-
(i = this.connectionMilestones) === null || i === void 0 || i.record("webrtc_failure", $e(e)), (n = this.connectionMilestones) === null || n === void 0 || n.publishFailure(Object.assign({ failureStage: "webrtc" }, $e(e))), console.error({ message: "StreamingClient - handleWebrtcFailure: ", err: e }), e.name === "NotAllowedError" && e.message === "Permission denied" ? this.publicEventEmitter.emit(
|
|
3655
|
+
(i = this.connectionMilestones) === null || i === void 0 || i.record("webrtc_failure", $e(e)), (n = this.connectionMilestones) === null || n === void 0 || n.publishFailure(Object.assign({ failureStage: "webrtc" }, $e(e))), console.error({ message: "StreamingClient - handleWebrtcFailure: ", err: e }), e.name === "NotAllowedError" && e.message === "Permission denied" ? this.publicEventEmitter.emit(x.CONNECTION_CLOSED, de.MICROPHONE_PERMISSION_DENIED) : this.publicEventEmitter.emit(x.CONNECTION_CLOSED, de.WEBRTC_FAILURE);
|
|
3656
3656
|
try {
|
|
3657
3657
|
this.stopConnection();
|
|
3658
3658
|
} catch (a) {
|
|
@@ -3662,20 +3662,20 @@ class Lr {
|
|
|
3662
3662
|
onTrackEventHandler(e) {
|
|
3663
3663
|
var i, n;
|
|
3664
3664
|
if (e.track.kind === "video") {
|
|
3665
|
-
if ((i = this.connectionMilestones) === null || i === void 0 || i.record("video_track_received"), this.startSuccessMetricPolling(), this.videoStream = e.streams[0], this.publicEventEmitter.emit(
|
|
3665
|
+
if ((i = this.connectionMilestones) === null || i === void 0 || i.record("video_track_received"), this.startSuccessMetricPolling(), this.videoStream = e.streams[0], this.publicEventEmitter.emit(x.VIDEO_STREAM_STARTED, this.videoStream), this.videoElement) {
|
|
3666
3666
|
this.videoElement.srcObject = this.videoStream;
|
|
3667
3667
|
const a = this.videoElement.requestVideoFrameCallback(() => {
|
|
3668
3668
|
var s;
|
|
3669
|
-
(s = this.videoElement) === null || s === void 0 || s.cancelVideoFrameCallback(a), this.publicEventEmitter.emit(
|
|
3669
|
+
(s = this.videoElement) === null || s === void 0 || s.cancelVideoFrameCallback(a), this.publicEventEmitter.emit(x.VIDEO_PLAY_STARTED), this.recordSessionSuccess("videoElement");
|
|
3670
3670
|
});
|
|
3671
3671
|
}
|
|
3672
|
-
} else e.track.kind === "audio" && ((n = this.connectionMilestones) === null || n === void 0 || n.record("audio_track_received"), this.audioStream = e.streams[0], this.publicEventEmitter.emit(
|
|
3672
|
+
} else e.track.kind === "audio" && ((n = this.connectionMilestones) === null || n === void 0 || n.record("audio_track_received"), this.audioStream = e.streams[0], this.publicEventEmitter.emit(x.AUDIO_STREAM_STARTED, this.audioStream));
|
|
3673
3673
|
}
|
|
3674
3674
|
/**
|
|
3675
3675
|
* Set up the data channels for sending and receiving messages
|
|
3676
3676
|
*/
|
|
3677
3677
|
setupDataChannels() {
|
|
3678
|
-
return
|
|
3678
|
+
return Q(this, void 0, void 0, function* () {
|
|
3679
3679
|
var e;
|
|
3680
3680
|
if (!this.peerConnection) {
|
|
3681
3681
|
console.error("StreamingClient - setupDataChannels: peer connection is not initialized");
|
|
@@ -3698,40 +3698,40 @@ class Lr {
|
|
|
3698
3698
|
const p = JSON.parse(n.data);
|
|
3699
3699
|
switch (p.messageType) {
|
|
3700
3700
|
case se.SPEECH_TEXT:
|
|
3701
|
-
this.internalEventEmitter.emit(
|
|
3701
|
+
this.internalEventEmitter.emit(F.WEBRTC_CHAT_MESSAGE_RECEIVED, p.data);
|
|
3702
3702
|
break;
|
|
3703
3703
|
case se.CLIENT_TOOL_EVENT:
|
|
3704
3704
|
const u = p.data;
|
|
3705
|
-
this.internalEventEmitter.emit(
|
|
3706
|
-
const
|
|
3707
|
-
this.publicEventEmitter.emit(
|
|
3705
|
+
this.internalEventEmitter.emit(F.WEBRTC_CLIENT_TOOL_EVENT_RECEIVED, u);
|
|
3706
|
+
const T = hn.WebRTCClientToolEventToClientToolEvent(u);
|
|
3707
|
+
this.publicEventEmitter.emit(x.CLIENT_TOOL_EVENT_RECEIVED, T);
|
|
3708
3708
|
break;
|
|
3709
3709
|
case se.TOOL_CALL_STARTED_EVENT:
|
|
3710
3710
|
const E = p.data;
|
|
3711
|
-
this.publicEventEmitter.emit(
|
|
3711
|
+
this.publicEventEmitter.emit(x.TOOL_CALL_STARTED, this.toolCallManager.WebRTCToolCallStartedEventToToolCallStartedPayload(E)), this.internalEventEmitter.emit(F.WEBRTC_TOOL_CALL_STARTED_EVENT_RECEIVED, E);
|
|
3712
3712
|
break;
|
|
3713
3713
|
case se.TOOL_CALL_COMPLETED_EVENT:
|
|
3714
|
-
const
|
|
3715
|
-
this.publicEventEmitter.emit(
|
|
3714
|
+
const S = p.data;
|
|
3715
|
+
this.publicEventEmitter.emit(x.TOOL_CALL_COMPLETED, this.toolCallManager.webRTCToolCallCompletedEventToToolCallCompletedPayload(S)), this.internalEventEmitter.emit(F.WEBRTC_TOOL_CALL_COMPLETED_EVENT_RECEIVED, S);
|
|
3716
3716
|
break;
|
|
3717
3717
|
case se.TOOL_CALL_FAILED_EVENT:
|
|
3718
|
-
const
|
|
3719
|
-
this.publicEventEmitter.emit(
|
|
3718
|
+
const b = p.data;
|
|
3719
|
+
this.publicEventEmitter.emit(x.TOOL_CALL_FAILED, this.toolCallManager.webRTCToolCallFailedEventToToolCallFailedPayload(b)), this.internalEventEmitter.emit(F.WEBRTC_TOOL_CALL_FAILED_EVENT_RECEIVED, b);
|
|
3720
3720
|
break;
|
|
3721
3721
|
case se.REASONING_TEXT:
|
|
3722
|
-
this.internalEventEmitter.emit(
|
|
3722
|
+
this.internalEventEmitter.emit(F.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED, p.data);
|
|
3723
3723
|
break;
|
|
3724
3724
|
case se.USER_SPEECH_STARTED:
|
|
3725
|
-
this.publicEventEmitter.emit(
|
|
3725
|
+
this.publicEventEmitter.emit(x.USER_SPEECH_STARTED, (s = (a = p.data) === null || a === void 0 ? void 0 : a.user_action_correlation_id) !== null && s !== void 0 ? s : "unknown");
|
|
3726
3726
|
break;
|
|
3727
3727
|
case se.USER_SPEECH_ENDED:
|
|
3728
|
-
this.publicEventEmitter.emit(
|
|
3728
|
+
this.publicEventEmitter.emit(x.USER_SPEECH_ENDED, (l = (c = p.data) === null || c === void 0 ? void 0 : c.user_action_correlation_id) !== null && l !== void 0 ? l : "unknown");
|
|
3729
3729
|
break;
|
|
3730
3730
|
case se.DIRECTOR_NOTE_CUE_APPLIED:
|
|
3731
|
-
const
|
|
3732
|
-
this.publicEventEmitter.emit(
|
|
3733
|
-
cueTag: (m =
|
|
3734
|
-
correlationId: (f =
|
|
3731
|
+
const R = p.data;
|
|
3732
|
+
this.publicEventEmitter.emit(x.DIRECTOR_NOTE_CUE_APPLIED, {
|
|
3733
|
+
cueTag: (m = R?.cue_tag) !== null && m !== void 0 ? m : "unknown",
|
|
3734
|
+
correlationId: (f = R?.user_action_correlation_id) !== null && f !== void 0 ? f : "unknown"
|
|
3735
3735
|
});
|
|
3736
3736
|
break;
|
|
3737
3737
|
// Unknown message types are silently ignored to maintain forward compatibility
|
|
@@ -3748,10 +3748,10 @@ class Lr {
|
|
|
3748
3748
|
* Request microphone permission asynchronously without blocking connection
|
|
3749
3749
|
*/
|
|
3750
3750
|
requestMicrophonePermissionAsync() {
|
|
3751
|
-
return
|
|
3751
|
+
return Q(this, void 0, void 0, function* () {
|
|
3752
3752
|
var e, i, n;
|
|
3753
3753
|
if (this.inputAudioState.permissionState !== ge.PENDING) {
|
|
3754
|
-
this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: ge.PENDING }), (e = this.connectionMilestones) === null || e === void 0 || e.record("microphone_permission_pending"), this.publicEventEmitter.emit(
|
|
3754
|
+
this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: ge.PENDING }), (e = this.connectionMilestones) === null || e === void 0 || e.record("microphone_permission_pending"), this.publicEventEmitter.emit(x.MIC_PERMISSION_PENDING);
|
|
3755
3755
|
try {
|
|
3756
3756
|
const a = {
|
|
3757
3757
|
echoCancellation: !0
|
|
@@ -3766,11 +3766,11 @@ class Lr {
|
|
|
3766
3766
|
s.getTracks().forEach((c) => c.stop());
|
|
3767
3767
|
return;
|
|
3768
3768
|
}
|
|
3769
|
-
this.inputAudioStream = s, this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: ge.GRANTED }), (i = this.connectionMilestones) === null || i === void 0 || i.record("microphone_permission_granted"), this.publicEventEmitter.emit(
|
|
3769
|
+
this.inputAudioStream = s, this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: ge.GRANTED }), (i = this.connectionMilestones) === null || i === void 0 || i.record("microphone_permission_granted"), this.publicEventEmitter.emit(x.MIC_PERMISSION_GRANTED), yield this.setupAudioTrack();
|
|
3770
3770
|
} catch (a) {
|
|
3771
3771
|
console.error("Failed to get microphone permission:", a), this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: ge.DENIED }), (n = this.connectionMilestones) === null || n === void 0 || n.record("microphone_permission_denied", Object.assign({}, $e(a)));
|
|
3772
3772
|
const s = a instanceof Error ? a.message : String(a);
|
|
3773
|
-
this.publicEventEmitter.emit(
|
|
3773
|
+
this.publicEventEmitter.emit(x.MIC_PERMISSION_DENIED, s);
|
|
3774
3774
|
}
|
|
3775
3775
|
}
|
|
3776
3776
|
});
|
|
@@ -3779,7 +3779,7 @@ class Lr {
|
|
|
3779
3779
|
* Set up audio track and add it to the peer connection using replaceTrack
|
|
3780
3780
|
*/
|
|
3781
3781
|
setupAudioTrack() {
|
|
3782
|
-
return
|
|
3782
|
+
return Q(this, void 0, void 0, function* () {
|
|
3783
3783
|
var e;
|
|
3784
3784
|
if (!this.peerConnection || !this.inputAudioStream)
|
|
3785
3785
|
return;
|
|
@@ -3802,11 +3802,11 @@ class Lr {
|
|
|
3802
3802
|
this.peerConnection.addTrack(i, this.inputAudioStream);
|
|
3803
3803
|
(e = this.connectionMilestones) === null || e === void 0 || e.record("input_audio_stream_started", {
|
|
3804
3804
|
audioTrackCount: this.inputAudioStream.getAudioTracks().length
|
|
3805
|
-
}), this.publicEventEmitter.emit(
|
|
3805
|
+
}), this.publicEventEmitter.emit(x.INPUT_AUDIO_STREAM_STARTED, this.inputAudioStream);
|
|
3806
3806
|
});
|
|
3807
3807
|
}
|
|
3808
3808
|
initPeerConnectionAndSendOffer() {
|
|
3809
|
-
return
|
|
3809
|
+
return Q(this, void 0, void 0, function* () {
|
|
3810
3810
|
var e, i, n, a, s, c;
|
|
3811
3811
|
if (yield this.initPeerConnection(), !this.peerConnection) {
|
|
3812
3812
|
console.error("StreamingClient - initPeerConnectionAndSendOffer: peer connection is not initialized");
|
|
@@ -3825,7 +3825,7 @@ class Lr {
|
|
|
3825
3825
|
});
|
|
3826
3826
|
}
|
|
3827
3827
|
shutdown() {
|
|
3828
|
-
return
|
|
3828
|
+
return Q(this, void 0, void 0, function* () {
|
|
3829
3829
|
var e;
|
|
3830
3830
|
if (this.iceRestartStopped = !0, this.cancelIceRestart(), this.showPeerConnectionStatsReport) {
|
|
3831
3831
|
const i = yield (e = this.peerConnection) === null || e === void 0 ? void 0 : e.getStats();
|
|
@@ -3883,7 +3883,7 @@ const yt = (t) => {
|
|
|
3883
3883
|
};
|
|
3884
3884
|
class Mr {
|
|
3885
3885
|
constructor(e, i) {
|
|
3886
|
-
this.reasoning_messages = [], this.publicEventEmitter = e, this.internalEventEmitter = i, this.internalEventEmitter.addListener(
|
|
3886
|
+
this.reasoning_messages = [], this.publicEventEmitter = e, this.internalEventEmitter = i, this.internalEventEmitter.addListener(F.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED, this.processWebRtcReasoningTextMessageEvent.bind(this));
|
|
3887
3887
|
}
|
|
3888
3888
|
webRtcTextMessageEventToReasoningStreamEvent(e) {
|
|
3889
3889
|
return {
|
|
@@ -3895,7 +3895,7 @@ class Mr {
|
|
|
3895
3895
|
}
|
|
3896
3896
|
processWebRtcReasoningTextMessageEvent(e) {
|
|
3897
3897
|
const i = this.webRtcTextMessageEventToReasoningStreamEvent(e);
|
|
3898
|
-
this.publicEventEmitter.emit(
|
|
3898
|
+
this.publicEventEmitter.emit(x.REASONING_STREAM_EVENT_RECEIVED, i);
|
|
3899
3899
|
const n = {
|
|
3900
3900
|
id: i.id,
|
|
3901
3901
|
content: i.content,
|
|
@@ -3906,7 +3906,7 @@ class Mr {
|
|
|
3906
3906
|
s.content += n.content, this.reasoning_messages[a] = s;
|
|
3907
3907
|
} else
|
|
3908
3908
|
this.reasoning_messages.push(n);
|
|
3909
|
-
i.endOfThought && this.publicEventEmitter.emit(
|
|
3909
|
+
i.endOfThought && this.publicEventEmitter.emit(x.REASONING_HISTORY_UPDATED, this.reasoning_messages);
|
|
3910
3910
|
}
|
|
3911
3911
|
}
|
|
3912
3912
|
var pe = function(t, e, i, n) {
|
|
@@ -3945,7 +3945,7 @@ class Dr {
|
|
|
3945
3945
|
}, this.sessionId = null, this.organizationId = null, this.streamingClient = null, this._isStreaming = !1;
|
|
3946
3946
|
const f = this.validateClientConfig(e, i, n);
|
|
3947
3947
|
if (f)
|
|
3948
|
-
throw new
|
|
3948
|
+
throw new W(f, X.CLIENT_ERROR_CODE_CONFIGURATION_ERROR, 400);
|
|
3949
3949
|
this.personaConfig = i, this.clientOptions = n, (!((a = n?.api) === null || a === void 0) && a.baseUrl || !((s = n?.api) === null || s === void 0) && s.apiVersion) && ir(n.api.baseUrl || on, n.api.apiVersion || $t), !((l = (c = n?.api) === null || c === void 0 ? void 0 : c.apiGateway) === null || l === void 0) && l.enabled && nr(n.api.apiGateway), !((m = n?.metrics) === null || m === void 0) && m.disableClientMetrics && rr(!0), this.publicEventEmitter = new Rr(), this.internalEventEmitter = new br(), this.toolCallManager = new hn(this.publicEventEmitter, this.internalEventEmitter), this.apiClient = new vr(e, n?.apiKey, n?.api), this.messageHistoryClient = new wr(this.publicEventEmitter, this.internalEventEmitter), this.reasoningHistoryClient = new Mr(this.publicEventEmitter, this.internalEventEmitter);
|
|
3950
3950
|
}
|
|
3951
3951
|
decodeJwt(e) {
|
|
@@ -4015,17 +4015,17 @@ class Dr {
|
|
|
4015
4015
|
}
|
|
4016
4016
|
startSession(e, i) {
|
|
4017
4017
|
return pe(this, void 0, void 0, function* () {
|
|
4018
|
-
var n, a, s, c, l, m, f, p, u,
|
|
4019
|
-
const
|
|
4018
|
+
var n, a, s, c, l, m, f, p, u, T, E, S, b, R, A, w, O;
|
|
4019
|
+
const k = this.personaConfig, y = this.buildStartSessionOptionsForClient();
|
|
4020
4020
|
i?.record("start_session_request_started");
|
|
4021
|
-
let
|
|
4021
|
+
let G;
|
|
4022
4022
|
try {
|
|
4023
|
-
|
|
4024
|
-
} catch (
|
|
4025
|
-
throw i?.record("start_session_request_failed", Object.assign({}, Oe(
|
|
4023
|
+
G = yield this.apiClient.startSession(k, y), i?.record("start_session_request_completed");
|
|
4024
|
+
} catch (oe) {
|
|
4025
|
+
throw i?.record("start_session_request_failed", Object.assign({}, Oe(oe))), i?.publishFailure(Object.assign({ failureStage: "start_session_request" }, Oe(oe))), oe;
|
|
4026
4026
|
}
|
|
4027
|
-
const { sessionId:
|
|
4028
|
-
this.sessionId =
|
|
4027
|
+
const { sessionId: I, clientConfig: D, engineHost: U, engineProtocol: J, signallingEndpoint: H } = G, { heartbeatIntervalSeconds: ie, maxWsReconnectionAttempts: ue, iceServers: he, iceTransportPolicy: Se } = D;
|
|
4028
|
+
this.sessionId = I, this.toolCallManager.setActiveSession(I), Fe({
|
|
4029
4029
|
sessionId: this.sessionId
|
|
4030
4030
|
}), i?.updateContext({
|
|
4031
4031
|
sessionId: this.sessionId,
|
|
@@ -4033,17 +4033,17 @@ class Dr {
|
|
|
4033
4033
|
});
|
|
4034
4034
|
const Te = (l = (a = (n = this.clientOptions) === null || n === void 0 ? void 0 : n.iceServers) !== null && a !== void 0 ? a : (c = (s = this.clientOptions) === null || s === void 0 ? void 0 : s.rtcConfiguration) === null || c === void 0 ? void 0 : c.iceServers) !== null && l !== void 0 ? l : he;
|
|
4035
4035
|
try {
|
|
4036
|
-
this.streamingClient = new Lr(
|
|
4036
|
+
this.streamingClient = new Lr(I, {
|
|
4037
4037
|
engine: {
|
|
4038
|
-
baseUrl: `${
|
|
4038
|
+
baseUrl: `${J}://${U}`
|
|
4039
4039
|
},
|
|
4040
4040
|
signalling: {
|
|
4041
|
-
heartbeatIntervalSeconds:
|
|
4041
|
+
heartbeatIntervalSeconds: ie,
|
|
4042
4042
|
maxWsReconnectionAttempts: ue,
|
|
4043
4043
|
url: {
|
|
4044
|
-
baseUrl:
|
|
4045
|
-
protocol:
|
|
4046
|
-
signallingPath:
|
|
4044
|
+
baseUrl: U,
|
|
4045
|
+
protocol: J,
|
|
4046
|
+
signallingPath: H
|
|
4047
4047
|
}
|
|
4048
4048
|
},
|
|
4049
4049
|
iceServers: Te,
|
|
@@ -4055,21 +4055,21 @@ class Dr {
|
|
|
4055
4055
|
audioDeviceId: (p = this.clientOptions) === null || p === void 0 ? void 0 : p.audioDeviceId,
|
|
4056
4056
|
disableInputAudio: (u = this.clientOptions) === null || u === void 0 ? void 0 : u.disableInputAudio
|
|
4057
4057
|
},
|
|
4058
|
-
apiGateway: (E = (
|
|
4058
|
+
apiGateway: (E = (T = this.clientOptions) === null || T === void 0 ? void 0 : T.api) === null || E === void 0 ? void 0 : E.apiGateway,
|
|
4059
4059
|
metrics: {
|
|
4060
|
-
showPeerConnectionStatsReport: (
|
|
4061
|
-
peerConnectionStatsReportOutputFormat: (
|
|
4060
|
+
showPeerConnectionStatsReport: (R = (b = (S = this.clientOptions) === null || S === void 0 ? void 0 : S.metrics) === null || b === void 0 ? void 0 : b.showPeerConnectionStatsReport) !== null && R !== void 0 ? R : !1,
|
|
4061
|
+
peerConnectionStatsReportOutputFormat: (O = (w = (A = this.clientOptions) === null || A === void 0 ? void 0 : A.metrics) === null || w === void 0 ? void 0 : w.peerConnectionStatsReportOutputFormat) !== null && O !== void 0 ? O : "console"
|
|
4062
4062
|
}
|
|
4063
4063
|
}, this.publicEventEmitter, this.internalEventEmitter, this.toolCallManager, i);
|
|
4064
|
-
} catch (
|
|
4065
|
-
throw i?.publishFailure(Object.assign({ failureStage: "streaming_client_initialization" }, Oe(
|
|
4064
|
+
} catch (oe) {
|
|
4065
|
+
throw i?.publishFailure(Object.assign({ failureStage: "streaming_client_initialization" }, Oe(oe))), this.toolCallManager.clearSessionState(), Fe({
|
|
4066
4066
|
sessionId: null
|
|
4067
|
-
}), new
|
|
4068
|
-
cause:
|
|
4069
|
-
sessionId:
|
|
4067
|
+
}), new W("Failed to initialize streaming client", X.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
|
|
4068
|
+
cause: oe instanceof Error ? oe.message : String(oe),
|
|
4069
|
+
sessionId: I
|
|
4070
4070
|
});
|
|
4071
4071
|
}
|
|
4072
|
-
return
|
|
4072
|
+
return I;
|
|
4073
4073
|
});
|
|
4074
4074
|
}
|
|
4075
4075
|
startSessionIfNeeded(e, i) {
|
|
@@ -4077,7 +4077,7 @@ class Dr {
|
|
|
4077
4077
|
if ((!this.sessionId || !this.streamingClient) && (yield this.startSession(e, i), !this.sessionId || !this.streamingClient))
|
|
4078
4078
|
throw i?.publishFailure({
|
|
4079
4079
|
failureStage: "start_session_validation"
|
|
4080
|
-
}), new
|
|
4080
|
+
}), new W("Session ID or streaming client is not available after starting session", X.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
|
|
4081
4081
|
cause: "Failed to initialize session properly"
|
|
4082
4082
|
});
|
|
4083
4083
|
});
|
|
@@ -4098,9 +4098,9 @@ class Dr {
|
|
|
4098
4098
|
var s;
|
|
4099
4099
|
const c = [];
|
|
4100
4100
|
let l = !1, m = !1;
|
|
4101
|
-
this.publicEventEmitter.addListener(
|
|
4101
|
+
this.publicEventEmitter.addListener(x.VIDEO_STREAM_STARTED, (f) => {
|
|
4102
4102
|
c.push(f), l = !0, m && a(c);
|
|
4103
|
-
}), this.publicEventEmitter.addListener(
|
|
4103
|
+
}), this.publicEventEmitter.addListener(x.AUDIO_STREAM_STARTED, (f) => {
|
|
4104
4104
|
c.push(f), m = !0, l && a(c);
|
|
4105
4105
|
}), (s = this.streamingClient) === null || s === void 0 || s.startConnection();
|
|
4106
4106
|
});
|
|
@@ -4122,7 +4122,7 @@ class Dr {
|
|
|
4122
4122
|
try {
|
|
4123
4123
|
yield this.startSessionIfNeeded(i, a);
|
|
4124
4124
|
} catch (s) {
|
|
4125
|
-
throw a.publishFailure(Object.assign({ failureStage: "start_session" }, Oe(s))), s instanceof
|
|
4125
|
+
throw a.publishFailure(Object.assign({ failureStage: "start_session" }, Oe(s))), s instanceof W ? s : new W("Failed to start session", X.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
|
|
4126
4126
|
cause: s instanceof Error ? s.message : String(s),
|
|
4127
4127
|
sessionId: this.sessionId
|
|
4128
4128
|
});
|
|
@@ -4222,7 +4222,7 @@ class Dr {
|
|
|
4222
4222
|
}
|
|
4223
4223
|
stopStreaming() {
|
|
4224
4224
|
return pe(this, void 0, void 0, function* () {
|
|
4225
|
-
this.streamingClient && (this.publicEventEmitter.emit(
|
|
4225
|
+
this.streamingClient && (this.publicEventEmitter.emit(x.CONNECTION_CLOSED, de.NORMAL), this.toolCallManager.clearSessionState(), yield this.streamingClient.stopConnection(), this.streamingClient = null, this.sessionId = null, Fe({
|
|
4226
4226
|
attemptCorrelationId: null,
|
|
4227
4227
|
sessionId: null,
|
|
4228
4228
|
organizationId: this.organizationId
|
|
@@ -4290,7 +4290,7 @@ class Dr {
|
|
|
4290
4290
|
return this.toolCallManager.registerHandler(e, i);
|
|
4291
4291
|
}
|
|
4292
4292
|
}
|
|
4293
|
-
const Oe = (t) => t instanceof
|
|
4293
|
+
const Oe = (t) => t instanceof W ? {
|
|
4294
4294
|
errorName: t.name,
|
|
4295
4295
|
errorCode: t.code,
|
|
4296
4296
|
httpStatusCode: t.statusCode
|
|
@@ -4367,7 +4367,7 @@ const Fr = () => /* @__PURE__ */ C("svg", { width: "14", height: "14", viewBox:
|
|
|
4367
4367
|
function Wr(t) {
|
|
4368
4368
|
return Vr[t.kind](t.data);
|
|
4369
4369
|
}
|
|
4370
|
-
const
|
|
4370
|
+
const te = {
|
|
4371
4371
|
SESSION_STARTED: "anam-agent:session-started",
|
|
4372
4372
|
SESSION_ENDED: "anam-agent:session-ended",
|
|
4373
4373
|
MESSAGE_RECEIVED: "anam-agent:message-received",
|
|
@@ -4394,39 +4394,39 @@ function Si(t) {
|
|
|
4394
4394
|
return {};
|
|
4395
4395
|
}
|
|
4396
4396
|
}
|
|
4397
|
-
function Gr(t, e) {
|
|
4398
|
-
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.";
|
|
4397
|
+
function Gr(t, e, i = !1, n) {
|
|
4398
|
+
return e === 403 && i ? n ? `This website isn't allowed to use this agent. Add ${n} under Allowed domains in Anam Lab, then publish.` : "This website isn't allowed to use this agent. Add it under Allowed domains in Anam Lab, then publish." : 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.";
|
|
4399
4399
|
}
|
|
4400
4400
|
function Ti(t, e) {
|
|
4401
4401
|
return t === de.SERVER_CLOSED_CONNECTION && e?.startsWith("Session reached max duration of ") === !0;
|
|
4402
4402
|
}
|
|
4403
4403
|
function Hr() {
|
|
4404
4404
|
return {
|
|
4405
|
-
client:
|
|
4406
|
-
connectionStatus:
|
|
4407
|
-
isStreaming:
|
|
4408
|
-
isMuted:
|
|
4409
|
-
messages:
|
|
4405
|
+
client: K(null),
|
|
4406
|
+
connectionStatus: K("idle"),
|
|
4407
|
+
isStreaming: K(!1),
|
|
4408
|
+
isMuted: K(!1),
|
|
4409
|
+
messages: K([]),
|
|
4410
4410
|
messageTimes: /* @__PURE__ */ new Map(),
|
|
4411
4411
|
pendingSent: [],
|
|
4412
4412
|
messageSeq: /* @__PURE__ */ new Map(),
|
|
4413
4413
|
seqCounter: 0,
|
|
4414
4414
|
localIdCounter: 0,
|
|
4415
|
-
toolBlocks:
|
|
4415
|
+
toolBlocks: K([]),
|
|
4416
4416
|
seenToolCallIds: /* @__PURE__ */ new Set(),
|
|
4417
|
-
caption:
|
|
4417
|
+
caption: K(null),
|
|
4418
4418
|
captionTimer: null,
|
|
4419
|
-
sentCaption:
|
|
4419
|
+
sentCaption: K(null),
|
|
4420
4420
|
sentCaptionTimer: null,
|
|
4421
|
-
error:
|
|
4422
|
-
timeLimitReached:
|
|
4423
|
-
sessionId:
|
|
4424
|
-
avatarThumbnailUrl:
|
|
4425
|
-
avatarVideoUrl:
|
|
4426
|
-
personaName:
|
|
4427
|
-
serverConfig:
|
|
4428
|
-
isConfigured:
|
|
4429
|
-
isReady:
|
|
4421
|
+
error: K(null),
|
|
4422
|
+
timeLimitReached: K(!1),
|
|
4423
|
+
sessionId: K(null),
|
|
4424
|
+
avatarThumbnailUrl: K(null),
|
|
4425
|
+
avatarVideoUrl: K(null),
|
|
4426
|
+
personaName: K(null),
|
|
4427
|
+
serverConfig: K(null),
|
|
4428
|
+
isConfigured: K(!1),
|
|
4429
|
+
isReady: K(!1),
|
|
4430
4430
|
generation: 0,
|
|
4431
4431
|
stopAttempt: null,
|
|
4432
4432
|
prevMessageCount: 0,
|
|
@@ -4474,163 +4474,163 @@ async function Yr(t, e, i, n, a) {
|
|
|
4474
4474
|
return;
|
|
4475
4475
|
const s = ++t.generation;
|
|
4476
4476
|
Vt(t), t.connectionStatus.value = "connecting", t.error.value = null, t.timeLimitReached.value = !1;
|
|
4477
|
-
let c, l =
|
|
4478
|
-
const
|
|
4479
|
-
clearInterval(
|
|
4480
|
-
},
|
|
4481
|
-
if (!
|
|
4482
|
-
const
|
|
4477
|
+
let c, l = !1, m, f = null, p = "", u = !1, T = null, E, S;
|
|
4478
|
+
const b = new AbortController(), R = () => {
|
|
4479
|
+
clearInterval(E), clearTimeout(S), E = void 0;
|
|
4480
|
+
}, A = () => {
|
|
4481
|
+
if (!f) return !1;
|
|
4482
|
+
const y = f.getActiveSessionId();
|
|
4483
4483
|
try {
|
|
4484
|
-
|
|
4484
|
+
f.stopStreaming().catch(() => {
|
|
4485
4485
|
});
|
|
4486
4486
|
} catch {
|
|
4487
4487
|
}
|
|
4488
|
-
if (
|
|
4489
|
-
|
|
4488
|
+
if (y && !u && T !== y) {
|
|
4489
|
+
T = y;
|
|
4490
4490
|
try {
|
|
4491
|
-
fetch(`${i.replace(/\/$/, "")}/api/sessions/${encodeURIComponent(
|
|
4491
|
+
fetch(`${i.replace(/\/$/, "")}/api/sessions/${encodeURIComponent(y)}/release`, {
|
|
4492
4492
|
method: "POST",
|
|
4493
4493
|
credentials: "same-origin",
|
|
4494
4494
|
keepalive: !0,
|
|
4495
|
-
headers: { Authorization: `Bearer ${
|
|
4495
|
+
headers: { Authorization: `Bearer ${p}` }
|
|
4496
4496
|
}).catch(() => {
|
|
4497
4497
|
});
|
|
4498
4498
|
} catch {
|
|
4499
4499
|
}
|
|
4500
4500
|
}
|
|
4501
|
-
return !!
|
|
4501
|
+
return !!y;
|
|
4502
4502
|
}, w = () => {
|
|
4503
|
-
if (clearTimeout(
|
|
4504
|
-
|
|
4503
|
+
if (clearTimeout(k), b.abort(), A()) {
|
|
4504
|
+
R();
|
|
4505
4505
|
return;
|
|
4506
4506
|
}
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
}, 100),
|
|
4510
|
-
},
|
|
4511
|
-
s === t.generation && (t.generation++, t.stopAttempt = null, w(), t.client.value = null, t.isStreaming.value = !1, t.sessionId.value = null, t.error.value =
|
|
4512
|
-
},
|
|
4507
|
+
f && !E && !T && (E = setInterval(() => {
|
|
4508
|
+
f?.getActiveSessionId() && A() && R();
|
|
4509
|
+
}, 100), S = setTimeout(R, 45e3));
|
|
4510
|
+
}, O = (y, G = "SESSION_ERROR") => {
|
|
4511
|
+
s === t.generation && (t.generation++, t.stopAttempt = null, w(), t.client.value = null, t.isStreaming.value = !1, t.sessionId.value = null, t.error.value = y, t.connectionStatus.value = "error", t.dispatch?.(te.ERROR, { code: G, message: y }));
|
|
4512
|
+
}, k = setTimeout(() => O(
|
|
4513
4513
|
"Taking too long to connect. Check your network and try again.",
|
|
4514
4514
|
"STARTUP_TIMEOUT"
|
|
4515
4515
|
), 45e3);
|
|
4516
4516
|
t.stopAttempt = w;
|
|
4517
4517
|
try {
|
|
4518
4518
|
if (a)
|
|
4519
|
-
|
|
4519
|
+
p = a;
|
|
4520
4520
|
else {
|
|
4521
4521
|
if (!fn(e))
|
|
4522
4522
|
throw new Error("Invalid agent ID format");
|
|
4523
|
-
const
|
|
4523
|
+
const I = await fetch(`${i}/v1/auth/widget`, {
|
|
4524
4524
|
method: "POST",
|
|
4525
4525
|
headers: { "Content-Type": "application/json" },
|
|
4526
4526
|
body: JSON.stringify({ agentId: e }),
|
|
4527
|
-
signal:
|
|
4527
|
+
signal: b.signal
|
|
4528
4528
|
});
|
|
4529
4529
|
if (s !== t.generation) return;
|
|
4530
|
-
if (c =
|
|
4531
|
-
const U = await
|
|
4532
|
-
throw new Error(U.error || `HTTP ${
|
|
4530
|
+
if (c = I.status, !I.ok) {
|
|
4531
|
+
const U = await I.json().catch(() => ({}));
|
|
4532
|
+
throw l = typeof U.error == "string" && U.error.startsWith("Origin not allowed"), typeof U.origin == "string" && /^https?:\/\//.test(U.origin) && (m = U.origin), new Error(U.error || `HTTP ${I.status}`);
|
|
4533
4533
|
}
|
|
4534
|
-
|
|
4534
|
+
p = (await I.json()).sessionToken;
|
|
4535
4535
|
}
|
|
4536
4536
|
if (s !== t.generation) return;
|
|
4537
|
-
const
|
|
4537
|
+
const y = Ur(p, {
|
|
4538
4538
|
api: i ? { baseUrl: i } : void 0,
|
|
4539
4539
|
metrics: { disableClientMetrics: !0 }
|
|
4540
4540
|
});
|
|
4541
|
-
|
|
4541
|
+
f = y, t.client.value = y, y.addListener(x.CONNECTION_ESTABLISHED, () => {
|
|
4542
4542
|
s === t.generation && (t.connectionStatus.value = "connected");
|
|
4543
|
-
}),
|
|
4544
|
-
}),
|
|
4543
|
+
}), y.addListener(x.AUDIO_STREAM_STARTED, () => {
|
|
4544
|
+
}), y.addListener(x.MESSAGE_HISTORY_UPDATED, (I) => {
|
|
4545
4545
|
if (s !== t.generation) return;
|
|
4546
|
-
for (let
|
|
4547
|
-
const
|
|
4548
|
-
t.dispatch?.(
|
|
4549
|
-
role:
|
|
4550
|
-
content:
|
|
4546
|
+
for (let J = t.prevMessageCount; J < I.length; J++) {
|
|
4547
|
+
const H = I[J];
|
|
4548
|
+
t.dispatch?.(te.MESSAGE_RECEIVED, {
|
|
4549
|
+
role: H.role === "persona" ? "agent" : "user",
|
|
4550
|
+
content: H.content
|
|
4551
4551
|
});
|
|
4552
4552
|
}
|
|
4553
|
-
t.prevMessageCount =
|
|
4554
|
-
const
|
|
4555
|
-
for (const
|
|
4556
|
-
t.messageTimes.has(
|
|
4557
|
-
t.messages.value =
|
|
4558
|
-
}),
|
|
4553
|
+
t.prevMessageCount = I.length;
|
|
4554
|
+
const D = zr(t, I), U = (/* @__PURE__ */ new Date()).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
4555
|
+
for (const J of D)
|
|
4556
|
+
t.messageTimes.has(J.id) || t.messageTimes.set(J.id, U);
|
|
4557
|
+
t.messages.value = D;
|
|
4558
|
+
}), y.addListener(x.MESSAGE_STREAM_EVENT_RECEIVED, (I) => {
|
|
4559
4559
|
if (s !== t.generation) return;
|
|
4560
4560
|
t.captionTimer && (clearTimeout(t.captionTimer), t.captionTimer = null);
|
|
4561
|
-
const
|
|
4562
|
-
t.caption.value = { id:
|
|
4561
|
+
const D = t.caption.value, U = I.role === ve.PERSONA && D?.id === I.id ? D.content + I.content : I.content;
|
|
4562
|
+
t.caption.value = { id: I.id, role: I.role, content: U, at: Date.now() }, I.endOfSpeech && (t.captionTimer = window.setTimeout(() => {
|
|
4563
4563
|
t.caption.value = null, t.captionTimer = null;
|
|
4564
4564
|
}, 4e3));
|
|
4565
|
-
}),
|
|
4565
|
+
}), y.addListener(x.TOOL_CALL_STARTED, (I) => {
|
|
4566
4566
|
if (s !== t.generation) return;
|
|
4567
|
-
t.dispatch?.(
|
|
4568
|
-
toolName:
|
|
4569
|
-
toolCallId:
|
|
4570
|
-
toolType:
|
|
4571
|
-
toolSubtype:
|
|
4572
|
-
arguments:
|
|
4567
|
+
t.dispatch?.(te.TOOL_CALL_STARTED, {
|
|
4568
|
+
toolName: I.toolName,
|
|
4569
|
+
toolCallId: I.toolCallId,
|
|
4570
|
+
toolType: I.toolType,
|
|
4571
|
+
toolSubtype: I.toolSubtype,
|
|
4572
|
+
arguments: I.arguments
|
|
4573
4573
|
});
|
|
4574
|
-
const
|
|
4575
|
-
|
|
4576
|
-
}),
|
|
4577
|
-
s === t.generation && t.dispatch?.(
|
|
4578
|
-
toolName:
|
|
4579
|
-
toolCallId:
|
|
4580
|
-
toolType:
|
|
4581
|
-
toolSubtype:
|
|
4582
|
-
result:
|
|
4583
|
-
executionTime:
|
|
4584
|
-
documentsAccessed:
|
|
4574
|
+
const D = Br(I.toolName, I.toolCallId, I.arguments);
|
|
4575
|
+
D && !t.seenToolCallIds.has(I.toolCallId) && (t.seenToolCallIds.add(I.toolCallId), t.messageSeq.set(D.id, t.seqCounter++), t.messageTimes.set(D.id, (/* @__PURE__ */ new Date()).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })), t.toolBlocks.value = [...t.toolBlocks.value, D]);
|
|
4576
|
+
}), y.addListener(x.TOOL_CALL_COMPLETED, (I) => {
|
|
4577
|
+
s === t.generation && t.dispatch?.(te.TOOL_CALL_COMPLETED, {
|
|
4578
|
+
toolName: I.toolName,
|
|
4579
|
+
toolCallId: I.toolCallId,
|
|
4580
|
+
toolType: I.toolType,
|
|
4581
|
+
toolSubtype: I.toolSubtype,
|
|
4582
|
+
result: I.result,
|
|
4583
|
+
executionTime: I.executionTime,
|
|
4584
|
+
documentsAccessed: I.documentsAccessed
|
|
4585
4585
|
});
|
|
4586
|
-
}),
|
|
4587
|
-
s === t.generation && t.dispatch?.(
|
|
4588
|
-
toolName:
|
|
4589
|
-
toolCallId:
|
|
4590
|
-
toolType:
|
|
4591
|
-
toolSubtype:
|
|
4592
|
-
errorMessage:
|
|
4593
|
-
executionTime:
|
|
4586
|
+
}), y.addListener(x.TOOL_CALL_FAILED, (I) => {
|
|
4587
|
+
s === t.generation && t.dispatch?.(te.TOOL_CALL_FAILED, {
|
|
4588
|
+
toolName: I.toolName,
|
|
4589
|
+
toolCallId: I.toolCallId,
|
|
4590
|
+
toolType: I.toolType,
|
|
4591
|
+
toolSubtype: I.toolSubtype,
|
|
4592
|
+
errorMessage: I.errorMessage,
|
|
4593
|
+
executionTime: I.executionTime
|
|
4594
4594
|
});
|
|
4595
|
-
}),
|
|
4595
|
+
}), y.addListener(x.CONNECTION_CLOSED, (I, D) => {
|
|
4596
4596
|
if (s !== t.generation) return;
|
|
4597
|
-
if (!t.isStreaming.value && !Ti(
|
|
4598
|
-
|
|
4597
|
+
if (!t.isStreaming.value && !Ti(I, D)) {
|
|
4598
|
+
O("The connection ended before playback. Please try again.");
|
|
4599
4599
|
return;
|
|
4600
4600
|
}
|
|
4601
4601
|
const U = t.sessionId.value;
|
|
4602
|
-
t.generation++, t.stopAttempt = null, w(), t.client.value = null, t.connectionStatus.value = "idle", t.isStreaming.value = !1, t.sessionId.value = null, t.timeLimitReached.value = Ti(
|
|
4602
|
+
t.generation++, t.stopAttempt = null, w(), t.client.value = null, t.connectionStatus.value = "idle", t.isStreaming.value = !1, t.sessionId.value = null, t.timeLimitReached.value = Ti(I, D), t.dispatch?.(te.SESSION_ENDED, {
|
|
4603
4603
|
sessionId: U ?? "",
|
|
4604
|
-
reason:
|
|
4604
|
+
reason: D ?? I
|
|
4605
4605
|
});
|
|
4606
|
-
}),
|
|
4607
|
-
s === t.generation && (
|
|
4606
|
+
}), y.addListener(x.SESSION_READY, (I) => {
|
|
4607
|
+
s === t.generation && (u = !0, t.sessionId.value = I, t.dispatch?.(te.SESSION_STARTED, { sessionId: I }));
|
|
4608
4608
|
});
|
|
4609
|
-
const
|
|
4609
|
+
const G = await y.stream();
|
|
4610
4610
|
if (s !== t.generation) {
|
|
4611
4611
|
w();
|
|
4612
4612
|
return;
|
|
4613
4613
|
}
|
|
4614
|
-
if (n &&
|
|
4615
|
-
const
|
|
4616
|
-
if (
|
|
4617
|
-
if (n.srcObject =
|
|
4618
|
-
t.isStreaming.value = !0, clearTimeout(
|
|
4614
|
+
if (n && G.length > 0) {
|
|
4615
|
+
const I = G.find((D) => D.getVideoTracks().length > 0);
|
|
4616
|
+
if (I) {
|
|
4617
|
+
if (n.srcObject = I, await n.play(), s !== t.generation) return;
|
|
4618
|
+
t.isStreaming.value = !0, clearTimeout(k);
|
|
4619
4619
|
}
|
|
4620
4620
|
}
|
|
4621
|
-
} catch (
|
|
4621
|
+
} catch (y) {
|
|
4622
4622
|
if (s !== t.generation) {
|
|
4623
4623
|
w();
|
|
4624
4624
|
return;
|
|
4625
4625
|
}
|
|
4626
|
-
|
|
4626
|
+
O(Gr(y, c, l, m), c ? `HTTP_${c}` : "SESSION_ERROR");
|
|
4627
4627
|
}
|
|
4628
4628
|
}
|
|
4629
4629
|
async function Kr(t) {
|
|
4630
4630
|
const e = t.sessionId.value, i = t.connectionStatus.value !== "idle";
|
|
4631
4631
|
t.generation++;
|
|
4632
4632
|
const n = t.stopAttempt;
|
|
4633
|
-
t.stopAttempt = null, t.client.value = null, t.connectionStatus.value = "idle", t.isStreaming.value = !1, t.isMuted.value = !1, Vt(t), t.captionTimer && clearTimeout(t.captionTimer), t.captionTimer = null, t.caption.value = null, t.sentCaptionTimer && clearTimeout(t.sentCaptionTimer), t.sentCaptionTimer = null, t.sentCaption.value = null, t.sessionId.value = null, t.timeLimitReached.value = !1, n?.(), i && t.dispatch?.(
|
|
4633
|
+
t.stopAttempt = null, t.client.value = null, t.connectionStatus.value = "idle", t.isStreaming.value = !1, t.isMuted.value = !1, Vt(t), t.captionTimer && clearTimeout(t.captionTimer), t.captionTimer = null, t.caption.value = null, t.sentCaptionTimer && clearTimeout(t.sentCaptionTimer), t.sentCaptionTimer = null, t.sentCaption.value = null, t.sessionId.value = null, t.timeLimitReached.value = !1, n?.(), i && t.dispatch?.(te.SESSION_ENDED, {
|
|
4634
4634
|
sessionId: e ?? "",
|
|
4635
4635
|
reason: "USER_ENDED"
|
|
4636
4636
|
});
|
|
@@ -4645,10 +4645,10 @@ function Jr(t, e) {
|
|
|
4645
4645
|
};
|
|
4646
4646
|
t.messageSeq.set(i.id, t.seqCounter++), t.messageTimes.set(i.id, (/* @__PURE__ */ new Date()).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })), t.pendingSent.push(i), t.messages.value = [...t.messages.value, i], t.sentCaptionTimer && clearTimeout(t.sentCaptionTimer), t.sentCaption.value = { id: i.id, role: ve.USER, content: e, at: Date.now() }, t.sentCaptionTimer = window.setTimeout(() => {
|
|
4647
4647
|
t.sentCaption.value = null, t.sentCaptionTimer = null;
|
|
4648
|
-
}, 4e3), t.dispatch?.(
|
|
4648
|
+
}, 4e3), t.dispatch?.(te.MESSAGE_SENT, { content: e });
|
|
4649
4649
|
}
|
|
4650
4650
|
function Xr(t) {
|
|
4651
|
-
t.client.value && (t.isMuted.value ? (t.client.value.unmuteInputAudio(), t.isMuted.value = !1, t.dispatch?.(
|
|
4651
|
+
t.client.value && (t.isMuted.value ? (t.client.value.unmuteInputAudio(), t.isMuted.value = !1, t.dispatch?.(te.MIC_UNMUTED, {})) : (t.client.value.muteInputAudio(), t.isMuted.value = !0, t.dispatch?.(te.MIC_MUTED, {})));
|
|
4652
4652
|
}
|
|
4653
4653
|
function Zr(t) {
|
|
4654
4654
|
t.generation++, t.stopAttempt?.(), t.stopAttempt = null, t.client.value = null, t.connectionStatus.value = "idle", t.isStreaming.value = !1, t.isMuted.value = !1, Vt(t), t.captionTimer && clearTimeout(t.captionTimer), t.captionTimer = null, t.caption.value = null, t.sentCaptionTimer && clearTimeout(t.sentCaptionTimer), t.sentCaptionTimer = null, t.sentCaption.value = null, t.error.value = null, t.timeLimitReached.value = !1, t.sessionId.value = null, t.avatarThumbnailUrl.value = null, t.avatarVideoUrl.value = null, t.personaName.value = null, t.serverConfig.value = null;
|
|
@@ -4806,32 +4806,32 @@ function fo({
|
|
|
4806
4806
|
onStop: m,
|
|
4807
4807
|
dispatch: f
|
|
4808
4808
|
}) {
|
|
4809
|
-
const p = Ye(null), [u,
|
|
4810
|
-
const
|
|
4811
|
-
|
|
4812
|
-
|
|
4809
|
+
const p = Ye(null), [u, T] = Rt(""), E = e.connectionStatus.value === "connected", S = e.connectionStatus.value === "connecting", b = e.connectionStatus.value === "error", R = e.isStreaming.value, A = !S && !E && !b, w = E || R, O = t.orientation ?? "landscape", k = t.showTranscript && w, [y, G] = Rt(!1), I = Ye(null), D = c || "Agent", U = We(() => {
|
|
4810
|
+
const q = !y;
|
|
4811
|
+
G(q), f(
|
|
4812
|
+
q ? te.TRANSCRIPT_OPENED : te.TRANSCRIPT_CLOSED,
|
|
4813
4813
|
{}
|
|
4814
4814
|
);
|
|
4815
|
-
}, [
|
|
4815
|
+
}, [y, f]);
|
|
4816
4816
|
Ie(() => {
|
|
4817
|
-
|
|
4818
|
-
}, [
|
|
4819
|
-
const
|
|
4817
|
+
w || G(!1);
|
|
4818
|
+
}, [w]);
|
|
4819
|
+
const J = e.toolBlocks.value.length;
|
|
4820
4820
|
Ie(() => {
|
|
4821
|
-
|
|
4822
|
-
}, [
|
|
4823
|
-
|
|
4824
|
-
}, [
|
|
4825
|
-
const
|
|
4826
|
-
if (!
|
|
4827
|
-
|
|
4828
|
-
}, [e.messages.value, e.toolBlocks.value,
|
|
4829
|
-
const
|
|
4821
|
+
J > 0 && w && k && !y && (G(!0), f(te.TRANSCRIPT_OPENED, {}));
|
|
4822
|
+
}, [J]), Ie(() => {
|
|
4823
|
+
y && I.current && (I.current.scrollTop = I.current.scrollHeight);
|
|
4824
|
+
}, [y]), Ie(() => {
|
|
4825
|
+
const q = I.current;
|
|
4826
|
+
if (!q || !y) return;
|
|
4827
|
+
q.scrollHeight - q.scrollTop - q.clientHeight < 160 && (q.scrollTop = q.scrollHeight);
|
|
4828
|
+
}, [e.messages.value, e.toolBlocks.value, y]);
|
|
4829
|
+
const H = k && y && O === "landscape", ie = t.showCaptions ? e.caption.value : null, ue = e.sentCaption.value, he = ie && ue ? ie.at >= ue.at ? ie : ue : ie ?? ue, Se = We(async () => {
|
|
4830
4830
|
i.current && await e.startSession(i.current);
|
|
4831
4831
|
}, [e.startSession]), Te = We(() => {
|
|
4832
|
-
u.trim() && (e.sendMessage(u.trim()),
|
|
4833
|
-
}, [u]),
|
|
4834
|
-
|
|
4832
|
+
u.trim() && (e.sendMessage(u.trim()), T(""), p.current?.focus());
|
|
4833
|
+
}, [u]), oe = We((q) => {
|
|
4834
|
+
q.key === "Enter" && !q.shiftKey && (q.preventDefault(), Te());
|
|
4835
4835
|
}, [Te]), ut = t.showTextInput ? /* @__PURE__ */ C("div", { class: "anam-ctl-input-wrap", children: [
|
|
4836
4836
|
/* @__PURE__ */ C(
|
|
4837
4837
|
"input",
|
|
@@ -4841,8 +4841,8 @@ function fo({
|
|
|
4841
4841
|
class: "anam-ctl-input",
|
|
4842
4842
|
placeholder: "Type a message...",
|
|
4843
4843
|
value: u,
|
|
4844
|
-
onInput: (
|
|
4845
|
-
onKeyDown:
|
|
4844
|
+
onInput: (q) => T(q.target.value),
|
|
4845
|
+
onKeyDown: oe,
|
|
4846
4846
|
disabled: !E
|
|
4847
4847
|
}
|
|
4848
4848
|
),
|
|
@@ -4867,13 +4867,13 @@ function fo({
|
|
|
4867
4867
|
}
|
|
4868
4868
|
),
|
|
4869
4869
|
ut,
|
|
4870
|
-
|
|
4870
|
+
k && O === "landscape" && /* @__PURE__ */ C(
|
|
4871
4871
|
"button",
|
|
4872
4872
|
{
|
|
4873
4873
|
class: "anam-ctl-btn anam-transcript-toggle",
|
|
4874
|
-
onClick:
|
|
4875
|
-
"aria-expanded":
|
|
4876
|
-
"aria-label":
|
|
4874
|
+
onClick: U,
|
|
4875
|
+
"aria-expanded": y,
|
|
4876
|
+
"aria-label": y ? "Hide transcript" : "Show transcript",
|
|
4877
4877
|
children: /* @__PURE__ */ C(co, {})
|
|
4878
4878
|
}
|
|
4879
4879
|
)
|
|
@@ -4882,23 +4882,23 @@ function fo({
|
|
|
4882
4882
|
"div",
|
|
4883
4883
|
{
|
|
4884
4884
|
class: "anam-sheet",
|
|
4885
|
-
"data-orientation":
|
|
4886
|
-
"data-transcript":
|
|
4885
|
+
"data-orientation": O,
|
|
4886
|
+
"data-transcript": y ? "open" : "closed",
|
|
4887
4887
|
children: [
|
|
4888
|
-
|
|
4888
|
+
k && O === "portrait" && /* @__PURE__ */ C("div", { class: "anam-transcript-rail", children: /* @__PURE__ */ C("div", { class: "anam-transcript-rail-inner", children: [
|
|
4889
4889
|
/* @__PURE__ */ C("div", { class: "anam-transcript-head", children: [
|
|
4890
4890
|
/* @__PURE__ */ C("span", { class: "anam-transcript-title", children: "Transcript" }),
|
|
4891
4891
|
/* @__PURE__ */ C(
|
|
4892
4892
|
"button",
|
|
4893
4893
|
{
|
|
4894
4894
|
class: "anam-transcript-collapse",
|
|
4895
|
-
onClick:
|
|
4895
|
+
onClick: U,
|
|
4896
4896
|
"aria-label": "Hide transcript",
|
|
4897
4897
|
children: /* @__PURE__ */ C(uo, {})
|
|
4898
4898
|
}
|
|
4899
4899
|
)
|
|
4900
4900
|
] }),
|
|
4901
|
-
/* @__PURE__ */ C(yi, { session: e, agentLabel:
|
|
4901
|
+
/* @__PURE__ */ C(yi, { session: e, agentLabel: D, rowsRef: I })
|
|
4902
4902
|
] }) }),
|
|
4903
4903
|
/* @__PURE__ */ C("div", { class: "anam-video-region", children: [
|
|
4904
4904
|
/* @__PURE__ */ C(
|
|
@@ -4908,7 +4908,7 @@ function fo({
|
|
|
4908
4908
|
class: "anam-video",
|
|
4909
4909
|
autoplay: !0,
|
|
4910
4910
|
playsinline: !0,
|
|
4911
|
-
"data-hidden":
|
|
4911
|
+
"data-hidden": R ? void 0 : "true"
|
|
4912
4912
|
}
|
|
4913
4913
|
),
|
|
4914
4914
|
A && (e.isConfigured.value ? (
|
|
@@ -4923,8 +4923,8 @@ function fo({
|
|
|
4923
4923
|
muted: !0,
|
|
4924
4924
|
playsinline: !0,
|
|
4925
4925
|
class: "anam-preview-video",
|
|
4926
|
-
onError: (
|
|
4927
|
-
|
|
4926
|
+
onError: (q) => {
|
|
4927
|
+
q.target.style.display = "none";
|
|
4928
4928
|
}
|
|
4929
4929
|
}
|
|
4930
4930
|
) : null,
|
|
@@ -4950,15 +4950,15 @@ function fo({
|
|
|
4950
4950
|
/* @__PURE__ */ C("span", { children: "Agent not configured" })
|
|
4951
4951
|
] })
|
|
4952
4952
|
)),
|
|
4953
|
-
|
|
4953
|
+
S && /* @__PURE__ */ C("div", { class: "anam-overlay-loading", children: [
|
|
4954
4954
|
/* @__PURE__ */ C("span", { class: "anam-spinner" }),
|
|
4955
4955
|
/* @__PURE__ */ C("span", { children: "Starting your conversation..." })
|
|
4956
4956
|
] }),
|
|
4957
|
-
|
|
4957
|
+
b && /* @__PURE__ */ C("div", { class: "anam-overlay-error", children: [
|
|
4958
4958
|
/* @__PURE__ */ C("div", { class: "anam-overlay-error-text", children: e.error.value || "Something went wrong" }),
|
|
4959
4959
|
/* @__PURE__ */ C("button", { class: "anam-retry-btn", onClick: Se, children: "Try Again" })
|
|
4960
4960
|
] }),
|
|
4961
|
-
(l || m && (E ||
|
|
4961
|
+
(l || m && (E || S || R)) && /* @__PURE__ */ C(
|
|
4962
4962
|
"button",
|
|
4963
4963
|
{
|
|
4964
4964
|
class: "anam-close-btn",
|
|
@@ -4967,7 +4967,7 @@ function fo({
|
|
|
4967
4967
|
children: /* @__PURE__ */ C(ro, {})
|
|
4968
4968
|
}
|
|
4969
4969
|
),
|
|
4970
|
-
|
|
4970
|
+
w && /* @__PURE__ */ C(Ce, { children: [
|
|
4971
4971
|
/* @__PURE__ */ C("div", { class: "anam-scrim" }),
|
|
4972
4972
|
he && /* @__PURE__ */ C(
|
|
4973
4973
|
"div",
|
|
@@ -4976,12 +4976,12 @@ function fo({
|
|
|
4976
4976
|
children: he.content
|
|
4977
4977
|
}
|
|
4978
4978
|
),
|
|
4979
|
-
!
|
|
4980
|
-
|
|
4979
|
+
!H && Xe,
|
|
4980
|
+
k && O === "portrait" && !y && /* @__PURE__ */ C(
|
|
4981
4981
|
"button",
|
|
4982
4982
|
{
|
|
4983
4983
|
class: "anam-transcript-tab",
|
|
4984
|
-
onClick:
|
|
4984
|
+
onClick: U,
|
|
4985
4985
|
"aria-label": "Show transcript",
|
|
4986
4986
|
children: /* @__PURE__ */ C(ho, {})
|
|
4987
4987
|
}
|
|
@@ -5003,9 +5003,9 @@ function fo({
|
|
|
5003
5003
|
}
|
|
5004
5004
|
)
|
|
5005
5005
|
] }),
|
|
5006
|
-
|
|
5007
|
-
/* @__PURE__ */ C(yi, { session: e, agentLabel:
|
|
5008
|
-
|
|
5006
|
+
k && O === "landscape" && /* @__PURE__ */ C("div", { class: "anam-transcript-pane", children: [
|
|
5007
|
+
/* @__PURE__ */ C(yi, { session: e, agentLabel: D, rowsRef: I }),
|
|
5008
|
+
H && /* @__PURE__ */ C("div", { class: "anam-transcript-footer", children: Xe })
|
|
5009
5009
|
] })
|
|
5010
5010
|
]
|
|
5011
5011
|
}
|
|
@@ -5018,9 +5018,9 @@ function po(t) {
|
|
|
5018
5018
|
] });
|
|
5019
5019
|
}
|
|
5020
5020
|
function _o(t) {
|
|
5021
|
-
const e = Ye(null), i = Ye(null), n = We((
|
|
5022
|
-
const
|
|
5023
|
-
|
|
5021
|
+
const e = Ye(null), i = Ye(null), n = We((O, k) => {
|
|
5022
|
+
const y = i.current?.getRootNode();
|
|
5023
|
+
y && y instanceof ShadowRoot && eo(y.host, O, k);
|
|
5024
5024
|
}, []);
|
|
5025
5025
|
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.");
|
|
5026
5026
|
const a = t["session-token"] ? void 0 : t["agent-id"], s = Qr(a, t["api-base-url"], t["session-token"], n);
|
|
@@ -5031,8 +5031,8 @@ function _o(t) {
|
|
|
5031
5031
|
() => no(t),
|
|
5032
5032
|
[t.layout, t["initial-state"], t.position, t["ui-mute-button"], t["ui-text-input"], t["ui-captions"], t["ui-transcript"], t["ui-preview-video"], t["call-to-action"]]
|
|
5033
5033
|
), l = ke(() => {
|
|
5034
|
-
const
|
|
5035
|
-
return kt(kt({ ...di },
|
|
5034
|
+
const O = s.serverConfig.value;
|
|
5035
|
+
return kt(kt({ ...di }, O ?? {}), c);
|
|
5036
5036
|
}, [s.serverConfig.value, c]), m = en(
|
|
5037
5037
|
l.layout === "floating" ? l.initialState : "expanded"
|
|
5038
5038
|
);
|
|
@@ -5041,15 +5041,15 @@ function _o(t) {
|
|
|
5041
5041
|
}, [l.layout, l.initialState]), Ie(() => {
|
|
5042
5042
|
s.fetchWidgetConfig();
|
|
5043
5043
|
}, [a, t["api-base-url"], t["session-token"]]);
|
|
5044
|
-
const f = t["avatar-url"] || s.avatarThumbnailUrl.value || null, p = l.showPreviewVideo && (t["avatar-video-url"] || s.avatarVideoUrl.value) || null,
|
|
5044
|
+
const f = t["avatar-url"] || s.avatarThumbnailUrl.value || null, p = l.showPreviewVideo && (t["avatar-video-url"] || s.avatarVideoUrl.value) || null, T = t["agent-name"] || s.personaName.value, E = l.callToAction === di.callToAction && T ? `Talk to ${T}` : l.callToAction, S = ke(() => {
|
|
5045
5045
|
if (l.layout === "inline") return "";
|
|
5046
|
-
const
|
|
5047
|
-
return Object.entries(
|
|
5048
|
-
}, [l.layout, l.position]),
|
|
5049
|
-
m.value = "expanded", n(
|
|
5046
|
+
const O = Hn(l.position);
|
|
5047
|
+
return Object.entries(O).map(([k, y]) => `${k}: ${y}`).join("; ");
|
|
5048
|
+
}, [l.layout, l.position]), b = l.layout === "floating", R = () => {
|
|
5049
|
+
m.value = "expanded", n(te.EXPANDED, {});
|
|
5050
5050
|
}, A = async () => {
|
|
5051
|
-
s.connectionStatus.value !== "idle" && await s.stopSession(), m.value = "minimized", n(
|
|
5052
|
-
},
|
|
5051
|
+
s.connectionStatus.value !== "idle" && await s.stopSession(), m.value = "minimized", n(te.COLLAPSED, {});
|
|
5052
|
+
}, w = b ? m.value === "expanded" : !0;
|
|
5053
5053
|
return s.isReady.value ? /* @__PURE__ */ C(
|
|
5054
5054
|
"div",
|
|
5055
5055
|
{
|
|
@@ -5057,18 +5057,18 @@ function _o(t) {
|
|
|
5057
5057
|
class: "anam-widget",
|
|
5058
5058
|
"data-layout": l.layout,
|
|
5059
5059
|
"data-state": m.value,
|
|
5060
|
-
style:
|
|
5060
|
+
style: S,
|
|
5061
5061
|
children: [
|
|
5062
|
-
|
|
5062
|
+
b && m.value === "minimized" && /* @__PURE__ */ C(
|
|
5063
5063
|
"button",
|
|
5064
5064
|
{
|
|
5065
5065
|
class: "anam-trigger",
|
|
5066
|
-
onClick:
|
|
5066
|
+
onClick: R,
|
|
5067
5067
|
"aria-label": E,
|
|
5068
5068
|
children: f ? /* @__PURE__ */ C("img", { src: f, alt: "Avatar" }) : /* @__PURE__ */ C(Lt, {})
|
|
5069
5069
|
}
|
|
5070
5070
|
),
|
|
5071
|
-
|
|
5071
|
+
w && /* @__PURE__ */ C(
|
|
5072
5072
|
fo,
|
|
5073
5073
|
{
|
|
5074
5074
|
config: l,
|
|
@@ -5077,9 +5077,9 @@ function _o(t) {
|
|
|
5077
5077
|
avatarSrc: f,
|
|
5078
5078
|
avatarVideoSrc: p,
|
|
5079
5079
|
displayCta: E,
|
|
5080
|
-
agentName:
|
|
5081
|
-
onCollapse:
|
|
5082
|
-
onStop:
|
|
5080
|
+
agentName: T || null,
|
|
5081
|
+
onCollapse: b ? A : null,
|
|
5082
|
+
onStop: b ? null : () => s.stopSession(),
|
|
5083
5083
|
dispatch: n
|
|
5084
5084
|
}
|
|
5085
5085
|
)
|
|
@@ -5127,6 +5127,6 @@ function Ii(t = "anam-agent") {
|
|
|
5127
5127
|
typeof window < "u" && typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", () => Ii()) : Ii());
|
|
5128
5128
|
export {
|
|
5129
5129
|
di as DefaultConfig,
|
|
5130
|
-
|
|
5130
|
+
te as WidgetEventNames,
|
|
5131
5131
|
Ii as registerWidget
|
|
5132
5132
|
};
|