@anam-ai/agent-widget 0.1.0-alpha.14 → 0.1.0-alpha.16

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 CHANGED
@@ -44,14 +44,14 @@ function Ke() {
44
44
  for (var t, e, n, o, u, a, c, l = 1; Ee.length; ) Ee.length > l && Ee.sort(mi), t = Ee.shift(), l = Ee.length, t.__d && (n = void 0, o = void 0, u = (o = (e = t).__v).__e, a = [], c = [], e.__P && ((n = ie({}, o)).__v = o.__v + 1, k.vnode && k.vnode(n), At(e.__P, n, o, e.__n, e.__P.namespaceURI, 32 & o.__u ? [u] : null, a, u ?? be(o), !!(32 & o.__u), c), n.__v = o.__v, n.__.__k[n.__i] = n, Ci(a, n, c), o.__e = o.__ = null, n.__e != u && yi(n)));
45
45
  Ke.__r = 0;
46
46
  }
47
- function Si(t, e, n, o, u, a, c, l, E, p, _) {
48
- var d, S, g, y, C, A, I, b = o && o.__k || vi, N = e.length;
49
- for (E = un(n, e, b, E, N), d = 0; d < N; d++) (g = n.__k[d]) != null && (S = g.__i == -1 ? Me : b[g.__i] || Me, g.__i = d, A = At(t, g, S, u, a, c, l, E, p, _), y = g.__e, g.ref && S.ref != g.ref && (S.ref && Tt(S.ref, null, g), _.push(g.ref, g.__c || y, g)), C == null && y != null && (C = y), (I = !!(4 & g.__u)) || S.__k === g.__k ? E = wi(g, E, t, I) : typeof g.type == "function" && A !== void 0 ? E = A : y && (E = y.nextSibling), g.__u &= -7);
50
- return n.__e = C, E;
47
+ function Si(t, e, n, o, u, a, c, l, m, p, _) {
48
+ var d, S, g, y, C, A, I, b = o && o.__k || vi, R = e.length;
49
+ for (m = un(n, e, b, m, R), d = 0; d < R; d++) (g = n.__k[d]) != null && (S = g.__i == -1 ? Me : b[g.__i] || Me, g.__i = d, A = At(t, g, S, u, a, c, l, m, p, _), y = g.__e, g.ref && S.ref != g.ref && (S.ref && Tt(S.ref, null, g), _.push(g.ref, g.__c || y, g)), C == null && y != null && (C = y), (I = !!(4 & g.__u)) || S.__k === g.__k ? m = wi(g, m, t, I) : typeof g.type == "function" && A !== void 0 ? m = A : y && (m = y.nextSibling), g.__u &= -7);
50
+ return n.__e = C, m;
51
51
  }
52
52
  function un(t, e, n, o, u) {
53
- var a, c, l, E, p, _ = n.length, d = _, S = 0;
54
- for (t.__k = new Array(u), a = 0; a < u; a++) (c = e[a]) != null && typeof c != "boolean" && typeof c != "function" ? (typeof c == "string" || typeof c == "number" || typeof c == "bigint" || c.constructor == String ? c = t.__k[a] = xe(null, c, null, null, null) : it(c) ? c = t.__k[a] = xe(_e, { children: c }, null, null, null) : c.constructor === void 0 && c.__b > 0 ? c = t.__k[a] = xe(c.type, c.props, c.key, c.ref ? c.ref : null, c.__v) : t.__k[a] = c, E = a + S, c.__ = t, c.__b = t.__b + 1, l = null, (p = c.__i = dn(c, n, E, d)) != -1 && (d--, (l = n[p]) && (l.__u |= 2)), l == null || l.__v == null ? (p == -1 && (u > _ ? S-- : u < _ && S++), typeof c.type != "function" && (c.__u |= 4)) : p != E && (p == E - 1 ? S-- : p == E + 1 ? S++ : (p > E ? S-- : S++, c.__u |= 4))) : t.__k[a] = null;
53
+ var a, c, l, m, p, _ = n.length, d = _, S = 0;
54
+ for (t.__k = new Array(u), a = 0; a < u; a++) (c = e[a]) != null && typeof c != "boolean" && typeof c != "function" ? (typeof c == "string" || typeof c == "number" || typeof c == "bigint" || c.constructor == String ? c = t.__k[a] = xe(null, c, null, null, null) : it(c) ? c = t.__k[a] = xe(_e, { children: c }, null, null, null) : c.constructor === void 0 && c.__b > 0 ? c = t.__k[a] = xe(c.type, c.props, c.key, c.ref ? c.ref : null, c.__v) : t.__k[a] = c, m = a + S, c.__ = t, c.__b = t.__b + 1, l = null, (p = c.__i = dn(c, n, m, d)) != -1 && (d--, (l = n[p]) && (l.__u |= 2)), l == null || l.__v == null ? (p == -1 && (u > _ ? S-- : u < _ && S++), typeof c.type != "function" && (c.__u |= 4)) : p != m && (p == m - 1 ? S-- : p == m + 1 ? S++ : (p > m ? S-- : S++, c.__u |= 4))) : t.__k[a] = null;
55
55
  if (d) for (a = 0; a < _; a++) (l = n[a]) != null && (2 & l.__u) == 0 && (l.__e == o && (o = be(l)), bi(l, l));
56
56
  return o;
57
57
  }
@@ -68,10 +68,10 @@ function wi(t, e, n, o) {
68
68
  return e;
69
69
  }
70
70
  function dn(t, e, n, o) {
71
- var u, a, c, l = t.key, E = t.type, p = e[n], _ = p != null && (2 & p.__u) == 0;
72
- if (p === null && l == null || _ && l == p.key && E == p.type) return n;
71
+ var u, a, c, l = t.key, m = t.type, p = e[n], _ = p != null && (2 & p.__u) == 0;
72
+ if (p === null && l == null || _ && l == p.key && m == p.type) return n;
73
73
  if (o > (_ ? 1 : 0)) {
74
- for (u = n - 1, a = n + 1; u >= 0 || a < e.length; ) if ((p = e[c = u >= 0 ? u-- : a++]) != null && (2 & p.__u) == 0 && l == p.key && E == p.type) return c;
74
+ for (u = n - 1, a = n + 1; u >= 0 || a < e.length; ) if ((p = e[c = u >= 0 ? u-- : a++]) != null && (2 & p.__u) == 0 && l == p.key && m == p.type) return c;
75
75
  }
76
76
  return -1;
77
77
  }
@@ -106,43 +106,43 @@ function Yt(t) {
106
106
  }
107
107
  };
108
108
  }
109
- function At(t, e, n, o, u, a, c, l, E, p) {
110
- var _, d, S, g, y, C, A, I, b, N, D, x, Z, V, se, ne, re, Q = e.type;
109
+ function At(t, e, n, o, u, a, c, l, m, p) {
110
+ var _, d, S, g, y, C, A, I, b, R, M, x, Y, ne, $, re, oe, Q = e.type;
111
111
  if (e.constructor !== void 0) return null;
112
- 128 & n.__u && (E = !!(32 & n.__u), a = [l = e.__e = n.__e]), (_ = k.__b) && _(e);
112
+ 128 & n.__u && (m = !!(32 & n.__u), a = [l = e.__e = n.__e]), (_ = k.__b) && _(e);
113
113
  e: if (typeof Q == "function") try {
114
- if (I = e.props, b = "prototype" in Q && Q.prototype.render, N = (_ = Q.contextType) && o[_.__c], D = _ ? N ? N.props.value : _.__ : o, n.__c ? A = (d = e.__c = n.__c).__ = d.__E : (b ? e.__c = d = new Q(I, D) : (e.__c = d = new Oe(I, D), d.constructor = Q, d.render = fn), N && N.sub(d), d.state || (d.state = {}), d.__n = o, S = d.__d = !0, d.__h = [], d._sb = []), b && d.__s == null && (d.__s = d.state), b && Q.getDerivedStateFromProps != null && (d.__s == d.state && (d.__s = ie({}, d.__s)), ie(d.__s, Q.getDerivedStateFromProps(I, d.__s))), g = d.props, y = d.state, d.__v = e, S) b && Q.getDerivedStateFromProps == null && d.componentWillMount != null && d.componentWillMount(), b && d.componentDidMount != null && d.__h.push(d.componentDidMount);
114
+ if (I = e.props, b = "prototype" in Q && Q.prototype.render, R = (_ = Q.contextType) && o[_.__c], M = _ ? R ? R.props.value : _.__ : o, n.__c ? A = (d = e.__c = n.__c).__ = d.__E : (b ? e.__c = d = new Q(I, M) : (e.__c = d = new Oe(I, M), d.constructor = Q, d.render = fn), R && R.sub(d), d.state || (d.state = {}), d.__n = o, S = d.__d = !0, d.__h = [], d._sb = []), b && d.__s == null && (d.__s = d.state), b && Q.getDerivedStateFromProps != null && (d.__s == d.state && (d.__s = ie({}, d.__s)), ie(d.__s, Q.getDerivedStateFromProps(I, d.__s))), g = d.props, y = d.state, d.__v = e, S) b && Q.getDerivedStateFromProps == null && d.componentWillMount != null && d.componentWillMount(), b && d.componentDidMount != null && d.__h.push(d.componentDidMount);
115
115
  else {
116
- if (b && Q.getDerivedStateFromProps == null && I !== g && d.componentWillReceiveProps != null && d.componentWillReceiveProps(I, D), e.__v == n.__v || !d.__e && d.shouldComponentUpdate != null && d.shouldComponentUpdate(I, d.__s, D) === !1) {
116
+ if (b && Q.getDerivedStateFromProps == null && I !== g && d.componentWillReceiveProps != null && d.componentWillReceiveProps(I, M), e.__v == n.__v || !d.__e && d.shouldComponentUpdate != null && d.shouldComponentUpdate(I, d.__s, M) === !1) {
117
117
  for (e.__v != n.__v && (d.props = I, d.state = d.__s, d.__d = !1), e.__e = n.__e, e.__k = n.__k, e.__k.some(function(ae) {
118
118
  ae && (ae.__ = e);
119
119
  }), x = 0; x < d._sb.length; x++) d.__h.push(d._sb[x]);
120
120
  d._sb = [], d.__h.length && c.push(d);
121
121
  break e;
122
122
  }
123
- d.componentWillUpdate != null && d.componentWillUpdate(I, d.__s, D), b && d.componentDidUpdate != null && d.__h.push(function() {
123
+ d.componentWillUpdate != null && d.componentWillUpdate(I, d.__s, M), b && d.componentDidUpdate != null && d.__h.push(function() {
124
124
  d.componentDidUpdate(g, y, C);
125
125
  });
126
126
  }
127
- if (d.context = D, d.props = I, d.__P = t, d.__e = !1, Z = k.__r, V = 0, b) {
128
- for (d.state = d.__s, d.__d = !1, Z && Z(e), _ = d.render(d.props, d.state, d.context), se = 0; se < d._sb.length; se++) d.__h.push(d._sb[se]);
127
+ if (d.context = M, d.props = I, d.__P = t, d.__e = !1, Y = k.__r, ne = 0, b) {
128
+ for (d.state = d.__s, d.__d = !1, Y && Y(e), _ = d.render(d.props, d.state, d.context), $ = 0; $ < d._sb.length; $++) d.__h.push(d._sb[$]);
129
129
  d._sb = [];
130
130
  } else do
131
- d.__d = !1, Z && Z(e), _ = d.render(d.props, d.state, d.context), d.state = d.__s;
132
- while (d.__d && ++V < 25);
133
- d.state = d.__s, d.getChildContext != null && (o = ie(ie({}, o), d.getChildContext())), b && !S && d.getSnapshotBeforeUpdate != null && (C = d.getSnapshotBeforeUpdate(g, y)), ne = _, _ != null && _.type === _e && _.key == null && (ne = Ii(_.props.children)), l = Si(t, it(ne) ? ne : [ne], e, n, o, u, a, c, l, E, p), d.base = e.__e, e.__u &= -161, d.__h.length && c.push(d), A && (d.__E = d.__ = null);
131
+ d.__d = !1, Y && Y(e), _ = d.render(d.props, d.state, d.context), d.state = d.__s;
132
+ while (d.__d && ++ne < 25);
133
+ d.state = d.__s, d.getChildContext != null && (o = ie(ie({}, o), d.getChildContext())), b && !S && d.getSnapshotBeforeUpdate != null && (C = d.getSnapshotBeforeUpdate(g, y)), re = _, _ != null && _.type === _e && _.key == null && (re = Ii(_.props.children)), l = Si(t, it(re) ? re : [re], e, n, o, u, a, c, l, m, p), d.base = e.__e, e.__u &= -161, d.__h.length && c.push(d), A && (d.__E = d.__ = null);
134
134
  } catch (ae) {
135
- if (e.__v = null, E || a != null) if (ae.then) {
136
- for (e.__u |= E ? 160 : 128; l && l.nodeType == 8 && l.nextSibling; ) l = l.nextSibling;
135
+ if (e.__v = null, m || a != null) if (ae.then) {
136
+ for (e.__u |= m ? 160 : 128; l && l.nodeType == 8 && l.nextSibling; ) l = l.nextSibling;
137
137
  a[a.indexOf(l)] = null, e.__e = l;
138
138
  } else {
139
- for (re = a.length; re--; ) bt(a[re]);
139
+ for (oe = a.length; oe--; ) bt(a[oe]);
140
140
  Et(e);
141
141
  }
142
142
  else e.__e = n.__e, e.__k = n.__k, ae.then || Et(e);
143
143
  k.__e(ae, e, n);
144
144
  }
145
- else a == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : l = e.__e = hn(n.__e, e, n, o, u, a, c, E, p);
145
+ else a == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : l = e.__e = hn(n.__e, e, n, o, u, a, c, m, p);
146
146
  return (_ = k.diffed) && _(e), 128 & e.__u ? void 0 : l;
147
147
  }
148
148
  function Et(t) {
@@ -163,7 +163,7 @@ function Ci(t, e, n) {
163
163
  function Ii(t) {
164
164
  return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : it(t) ? t.map(Ii) : ie({}, t);
165
165
  }
166
- function hn(t, e, n, o, u, a, c, l, E) {
166
+ function hn(t, e, n, o, u, a, c, l, m) {
167
167
  var p, _, d, S, g, y, C, A = n.props || Me, I = e.props, b = e.type;
168
168
  if (b == "svg" ? u = "http://www.w3.org/2000/svg" : b == "math" ? u = "http://www.w3.org/1998/Math/MathML" : u || (u = "http://www.w3.org/1999/xhtml"), a != null) {
169
169
  for (p = 0; p < a.length; p++) if ((g = a[p]) && "setAttribute" in g == !!b && (b ? g.localName == b : g.nodeType == 3)) {
@@ -187,7 +187,7 @@ function hn(t, e, n, o, u, a, c, l, E) {
187
187
  }
188
188
  for (p in I) g = I[p], p == "children" ? S = g : p == "dangerouslySetInnerHTML" ? _ = g : p == "value" ? y = g : p == "checked" ? C = g : l && typeof g != "function" || A[p] === g || Ge(t, p, g, A[p], u);
189
189
  if (_) l || d && (_.__html == d.__html || _.__html == t.innerHTML) || (t.innerHTML = _.__html), e.__k = [];
190
- else if (d && (t.innerHTML = ""), Si(e.type == "template" ? t.content : t, it(S) ? S : [S], e, n, o, b == "foreignObject" ? "http://www.w3.org/1999/xhtml" : u, a, c, a ? a[0] : n.__k && be(n, 0), l, E), a != null) for (p = a.length; p--; ) bt(a[p]);
190
+ else if (d && (t.innerHTML = ""), Si(e.type == "template" ? t.content : t, it(S) ? S : [S], e, n, o, b == "foreignObject" ? "http://www.w3.org/1999/xhtml" : u, a, c, a ? a[0] : n.__k && be(n, 0), l, m), a != null) for (p = a.length; p--; ) bt(a[p]);
191
191
  l || (p = "value", b == "progress" && y == null ? t.removeAttribute("value") : y != null && (y !== t[p] || b == "progress" && !y || b == "option" && y != A[p]) && Ge(t, p, y, A[p], u), p = "checked", C != null && C != t[p] && Ge(t, p, C, A[p], u));
192
192
  }
193
193
  return t;
@@ -319,8 +319,8 @@ function xi(t, e, n) {
319
319
  var o = [], u = {}, a = 0, c = t.attributes, l = t.childNodes;
320
320
  for (a = c.length; a--; ) c[a].name !== "slot" && (u[c[a].name] = c[a].value, u[Ni(c[a].name)] = c[a].value);
321
321
  for (a = l.length; a--; ) {
322
- var E = xi(l[a], null, n), p = l[a].slot;
323
- p ? u[p] = Ce(Kt, { name: p }, E) : o[a] = E;
322
+ var m = xi(l[a], null, n), p = l[a].slot;
323
+ p ? u[p] = Ce(Kt, { name: p }, m) : o[a] = m;
324
324
  }
325
325
  var _ = !(!n || !n.shadow), d = e ? Ce(Kt, { useFragment: !_ }, o) : o;
326
326
  return !_ && e && (t.innerHTML = ""), Ce(e || t.nodeName.toLowerCase(), u, d);
@@ -328,10 +328,10 @@ function xi(t, e, n) {
328
328
  var Sn = 0;
329
329
  function w(t, e, n, o, u, a) {
330
330
  e || (e = {});
331
- var c, l, E = e;
332
- if ("ref" in E) for (l in E = {}, e) l == "ref" ? c = e[l] : E[l] = e[l];
333
- var p = { type: t, props: E, key: n, ref: c, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --Sn, __i: -1, __u: 0, __source: u, __self: a };
334
- if (typeof t == "function" && (c = t.defaultProps)) for (l in c) E[l] === void 0 && (E[l] = c[l]);
331
+ var c, l, m = e;
332
+ if ("ref" in m) for (l in m = {}, e) l == "ref" ? c = e[l] : m[l] = e[l];
333
+ var p = { type: t, props: m, key: n, ref: c, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --Sn, __i: -1, __u: 0, __source: u, __self: a };
334
+ if (typeof t == "function" && (c = t.defaultProps)) for (l in c) m[l] === void 0 && (m[l] = c[l]);
335
335
  return k.vnode && k.vnode(p), p;
336
336
  }
337
337
  var Ue, P, ct, Jt, Le = 0, Oi = [], F = k, Xt = F.__b, Zt = F.__r, Qt = F.diffed, ei = F.__c, ti = F.unmount, ii = F.__;
@@ -346,33 +346,33 @@ function ze(t) {
346
346
  function wn(t, e, n) {
347
347
  var o = Rt(Ue++, 2);
348
348
  if (o.t = t, !o.__c && (o.__ = [Di(void 0, e), function(l) {
349
- var E = o.__N ? o.__N[0] : o.__[0], p = o.t(E, l);
350
- E !== p && (o.__N = [p, o.__[1]], o.__c.setState({}));
349
+ var m = o.__N ? o.__N[0] : o.__[0], p = o.t(m, l);
350
+ m !== p && (o.__N = [p, o.__[1]], o.__c.setState({}));
351
351
  }], o.__c = P, !P.__f)) {
352
- var u = function(l, E, p) {
352
+ var u = function(l, m, p) {
353
353
  if (!o.__c.__H) return !0;
354
354
  var _ = o.__c.__H.__.filter(function(S) {
355
355
  return !!S.__c;
356
356
  });
357
357
  if (_.every(function(S) {
358
358
  return !S.__N;
359
- })) return !a || a.call(this, l, E, p);
359
+ })) return !a || a.call(this, l, m, p);
360
360
  var d = o.__c.props !== l;
361
361
  return _.forEach(function(S) {
362
362
  if (S.__N) {
363
363
  var g = S.__[0];
364
364
  S.__ = S.__N, S.__N = void 0, g !== S.__[0] && (d = !0);
365
365
  }
366
- }), a && a.call(this, l, E, p) || d;
366
+ }), a && a.call(this, l, m, p) || d;
367
367
  };
368
368
  P.__f = !0;
369
369
  var a = P.shouldComponentUpdate, c = P.componentWillUpdate;
370
- P.componentWillUpdate = function(l, E, p) {
370
+ P.componentWillUpdate = function(l, m, p) {
371
371
  if (this.__e) {
372
372
  var _ = a;
373
- a = void 0, u(l, E, p), a = _;
373
+ a = void 0, u(l, m, p), a = _;
374
374
  }
375
- c && c.call(this, l, E, p);
375
+ c && c.call(this, l, m, p);
376
376
  }, P.shouldComponentUpdate = u;
377
377
  }
378
378
  return o.__N || o.__;
@@ -727,8 +727,8 @@ function Gi(t) {
727
727
  var e = this, n = t.data, o = ji(n);
728
728
  o.value = n;
729
729
  var u = Ie(function() {
730
- for (var l = e, E = e.__v; E = E.__; ) if (E.__c) {
731
- E.__c.__$f |= 4;
730
+ for (var l = e, m = e.__v; m = m.__; ) if (m.__c) {
731
+ m.__c.__$f |= 4;
732
732
  break;
733
733
  }
734
734
  var p = ri(function() {
@@ -794,9 +794,9 @@ Te("diffed", function(t, e) {
794
794
  }
795
795
  else
796
796
  a = {}, n.U = a;
797
- for (var E in o) {
798
- var p = a[E], _ = o[E];
799
- p === void 0 ? (p = Nn(n, E, _, u), a[E] = p) : p.o(_, u);
797
+ for (var m in o) {
798
+ var p = a[m], _ = o[m];
799
+ p === void 0 ? (p = Nn(n, m, _, u), a[m] = p) : p.o(_, u);
800
800
  }
801
801
  }
802
802
  }
@@ -915,14 +915,14 @@ function Dn() {
915
915
  var y = c(g), C = y[0], A = y[1];
916
916
  return (C + A) * 3 / 4 - A;
917
917
  }
918
- function E(g, y, C) {
918
+ function m(g, y, C) {
919
919
  return (y + C) * 3 / 4 - C;
920
920
  }
921
921
  function p(g) {
922
- var y, C = c(g), A = C[0], I = C[1], b = new n(E(g, A, I)), N = 0, D = I > 0 ? A - 4 : A, x;
923
- for (x = 0; x < D; x += 4)
924
- y = e[g.charCodeAt(x)] << 18 | e[g.charCodeAt(x + 1)] << 12 | e[g.charCodeAt(x + 2)] << 6 | e[g.charCodeAt(x + 3)], b[N++] = y >> 16 & 255, b[N++] = y >> 8 & 255, b[N++] = y & 255;
925
- return I === 2 && (y = e[g.charCodeAt(x)] << 2 | e[g.charCodeAt(x + 1)] >> 4, b[N++] = y & 255), I === 1 && (y = e[g.charCodeAt(x)] << 10 | e[g.charCodeAt(x + 1)] << 4 | e[g.charCodeAt(x + 2)] >> 2, b[N++] = y >> 8 & 255, b[N++] = y & 255), b;
922
+ var y, C = c(g), A = C[0], I = C[1], b = new n(m(g, A, I)), R = 0, M = I > 0 ? A - 4 : A, x;
923
+ for (x = 0; x < M; x += 4)
924
+ y = e[g.charCodeAt(x)] << 18 | e[g.charCodeAt(x + 1)] << 12 | e[g.charCodeAt(x + 2)] << 6 | e[g.charCodeAt(x + 3)], b[R++] = y >> 16 & 255, b[R++] = y >> 8 & 255, b[R++] = y & 255;
925
+ return I === 2 && (y = e[g.charCodeAt(x)] << 2 | e[g.charCodeAt(x + 1)] >> 4, b[R++] = y & 255), I === 1 && (y = e[g.charCodeAt(x)] << 10 | e[g.charCodeAt(x + 1)] << 4 | e[g.charCodeAt(x + 2)] >> 2, b[R++] = y >> 8 & 255, b[R++] = y & 255), b;
926
926
  }
927
927
  function _(g) {
928
928
  return t[g >> 18 & 63] + t[g >> 12 & 63] + t[g >> 6 & 63] + t[g & 63];
@@ -933,8 +933,8 @@ function Dn() {
933
933
  return I.join("");
934
934
  }
935
935
  function S(g) {
936
- for (var y, C = g.length, A = C % 3, I = [], b = 16383, N = 0, D = C - A; N < D; N += b)
937
- I.push(d(g, N, N + b > D ? D : N + b));
936
+ for (var y, C = g.length, A = C % 3, I = [], b = 16383, R = 0, M = C - A; R < M; R += b)
937
+ I.push(d(g, R, R + b > M ? M : R + b));
938
938
  return A === 1 ? (y = g[C - 1], I.push(
939
939
  t[y >> 2] + t[y << 4 & 63] + "=="
940
940
  )) : A === 2 && (y = (g[C - 2] << 8) + g[C - 1], I.push(
@@ -947,7 +947,7 @@ var We = {};
947
947
  var ai;
948
948
  function Mn() {
949
949
  return ai || (ai = 1, We.read = function(t, e, n, o, u) {
950
- var a, c, l = u * 8 - o - 1, E = (1 << l) - 1, p = E >> 1, _ = -7, d = n ? u - 1 : 0, S = n ? -1 : 1, g = t[e + d];
950
+ var a, c, l = u * 8 - o - 1, m = (1 << l) - 1, p = m >> 1, _ = -7, d = n ? u - 1 : 0, S = n ? -1 : 1, g = t[e + d];
951
951
  for (d += S, a = g & (1 << -_) - 1, g >>= -_, _ += l; _ > 0; a = a * 256 + t[e + d], d += S, _ -= 8)
952
952
  ;
953
953
  for (c = a & (1 << -_) - 1, a >>= -_, _ += o; _ > 0; c = c * 256 + t[e + d], d += S, _ -= 8)
@@ -955,14 +955,14 @@ function Mn() {
955
955
  if (a === 0)
956
956
  a = 1 - p;
957
957
  else {
958
- if (a === E)
958
+ if (a === m)
959
959
  return c ? NaN : (g ? -1 : 1) * (1 / 0);
960
960
  c = c + Math.pow(2, o), a = a - p;
961
961
  }
962
962
  return (g ? -1 : 1) * c * Math.pow(2, a - o);
963
963
  }, We.write = function(t, e, n, o, u, a) {
964
- var c, l, E, p = a * 8 - u - 1, _ = (1 << p) - 1, d = _ >> 1, S = u === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, g = o ? 0 : a - 1, y = o ? 1 : -1, C = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
965
- for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (l = isNaN(e) ? 1 : 0, c = _) : (c = Math.floor(Math.log(e) / Math.LN2), e * (E = Math.pow(2, -c)) < 1 && (c--, E *= 2), c + d >= 1 ? e += S / E : e += S * Math.pow(2, 1 - d), e * E >= 2 && (c++, E /= 2), c + d >= _ ? (l = 0, c = _) : c + d >= 1 ? (l = (e * E - 1) * Math.pow(2, u), c = c + d) : (l = e * Math.pow(2, d - 1) * Math.pow(2, u), c = 0)); u >= 8; t[n + g] = l & 255, g += y, l /= 256, u -= 8)
964
+ var c, l, m, p = a * 8 - u - 1, _ = (1 << p) - 1, d = _ >> 1, S = u === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, g = o ? 0 : a - 1, y = o ? 1 : -1, C = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
965
+ for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (l = isNaN(e) ? 1 : 0, c = _) : (c = Math.floor(Math.log(e) / Math.LN2), e * (m = Math.pow(2, -c)) < 1 && (c--, m *= 2), c + d >= 1 ? e += S / m : e += S * Math.pow(2, 1 - d), e * m >= 2 && (c++, m /= 2), c + d >= _ ? (l = 0, c = _) : c + d >= 1 ? (l = (e * m - 1) * Math.pow(2, u), c = c + d) : (l = e * Math.pow(2, d - 1) * Math.pow(2, u), c = 0)); u >= 8; t[n + g] = l & 255, g += y, l /= 256, u -= 8)
966
966
  ;
967
967
  for (c = c << u | l, p += u; p > 0; t[n + g] = c & 255, g += y, c /= 256, p -= 8)
968
968
  ;
@@ -1015,10 +1015,10 @@ function Un() {
1015
1015
  );
1016
1016
  return d(s);
1017
1017
  }
1018
- return E(s, i, r);
1018
+ return m(s, i, r);
1019
1019
  }
1020
1020
  l.poolSize = 8192;
1021
- function E(s, i, r) {
1021
+ function m(s, i, r) {
1022
1022
  if (typeof s == "string")
1023
1023
  return S(s, i);
1024
1024
  if (ArrayBuffer.isView(s))
@@ -1045,7 +1045,7 @@ function Un() {
1045
1045
  );
1046
1046
  }
1047
1047
  l.from = function(s, i, r) {
1048
- return E(s, i, r);
1048
+ return m(s, i, r);
1049
1049
  }, Object.setPrototypeOf(l.prototype, Uint8Array.prototype), Object.setPrototypeOf(l, Uint8Array);
1050
1050
  function p(s) {
1051
1051
  if (typeof s != "number")
@@ -1070,7 +1070,7 @@ function Un() {
1070
1070
  function S(s, i) {
1071
1071
  if ((typeof i != "string" || i === "") && (i = "utf8"), !l.isEncoding(i))
1072
1072
  throw new TypeError("Unknown encoding: " + i);
1073
- const r = N(s, i) | 0;
1073
+ const r = R(s, i) | 0;
1074
1074
  let h = c(r);
1075
1075
  const f = h.write(s, i);
1076
1076
  return f !== r && (h = h.slice(0, f)), h;
@@ -1123,9 +1123,9 @@ function Un() {
1123
1123
  );
1124
1124
  if (i === r) return 0;
1125
1125
  let h = i.length, f = r.length;
1126
- for (let m = 0, v = Math.min(h, f); m < v; ++m)
1127
- if (i[m] !== r[m]) {
1128
- h = i[m], f = r[m];
1126
+ for (let E = 0, v = Math.min(h, f); E < v; ++E)
1127
+ if (i[E] !== r[E]) {
1128
+ h = i[E], f = r[E];
1129
1129
  break;
1130
1130
  }
1131
1131
  return h < f ? -1 : f < h ? 1 : 0;
@@ -1156,24 +1156,24 @@ function Un() {
1156
1156
  for (r = 0, h = 0; h < i.length; ++h)
1157
1157
  r += i[h].length;
1158
1158
  const f = l.allocUnsafe(r);
1159
- let m = 0;
1159
+ let E = 0;
1160
1160
  for (h = 0; h < i.length; ++h) {
1161
1161
  let v = i[h];
1162
1162
  if (ee(v, Uint8Array))
1163
- m + v.length > f.length ? (l.isBuffer(v) || (v = l.from(v)), v.copy(f, m)) : Uint8Array.prototype.set.call(
1163
+ E + v.length > f.length ? (l.isBuffer(v) || (v = l.from(v)), v.copy(f, E)) : Uint8Array.prototype.set.call(
1164
1164
  f,
1165
1165
  v,
1166
- m
1166
+ E
1167
1167
  );
1168
1168
  else if (l.isBuffer(v))
1169
- v.copy(f, m);
1169
+ v.copy(f, E);
1170
1170
  else
1171
1171
  throw new TypeError('"list" argument must be an Array of Buffers');
1172
- m += v.length;
1172
+ E += v.length;
1173
1173
  }
1174
1174
  return f;
1175
1175
  };
1176
- function N(s, i) {
1176
+ function R(s, i) {
1177
1177
  if (l.isBuffer(s))
1178
1178
  return s.length;
1179
1179
  if (ArrayBuffer.isView(s) || ee(s, ArrayBuffer))
@@ -1209,8 +1209,8 @@ function Un() {
1209
1209
  i = ("" + i).toLowerCase(), f = !0;
1210
1210
  }
1211
1211
  }
1212
- l.byteLength = N;
1213
- function D(s, i, r) {
1212
+ l.byteLength = R;
1213
+ function M(s, i, r) {
1214
1214
  let h = !1;
1215
1215
  if ((i === void 0 || i < 0) && (i = 0), i > this.length || ((r === void 0 || r > this.length) && (r = this.length), r <= 0) || (r >>>= 0, i >>>= 0, r <= i))
1216
1216
  return "";
@@ -1266,7 +1266,7 @@ function Un() {
1266
1266
  return this;
1267
1267
  }, l.prototype.toString = function() {
1268
1268
  const i = this.length;
1269
- return i === 0 ? "" : arguments.length === 0 ? Ut(this, 0, i) : D.apply(this, arguments);
1269
+ return i === 0 ? "" : arguments.length === 0 ? Ut(this, 0, i) : M.apply(this, arguments);
1270
1270
  }, l.prototype.toLocaleString = l.prototype.toString, l.prototype.equals = function(i) {
1271
1271
  if (!l.isBuffer(i)) throw new TypeError("Argument must be a Buffer");
1272
1272
  return this === i ? !0 : l.compare(this, i) === 0;
@@ -1274,30 +1274,30 @@ function Un() {
1274
1274
  let i = "";
1275
1275
  const r = t.INSPECT_MAX_BYTES;
1276
1276
  return i = this.toString("hex", 0, r).replace(/(.{2})/g, "$1 ").trim(), this.length > r && (i += " ... "), "<Buffer " + i + ">";
1277
- }, o && (l.prototype[o] = l.prototype.inspect), l.prototype.compare = function(i, r, h, f, m) {
1277
+ }, o && (l.prototype[o] = l.prototype.inspect), l.prototype.compare = function(i, r, h, f, E) {
1278
1278
  if (ee(i, Uint8Array) && (i = l.from(i, i.offset, i.byteLength)), !l.isBuffer(i))
1279
1279
  throw new TypeError(
1280
1280
  'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof i
1281
1281
  );
1282
- if (r === void 0 && (r = 0), h === void 0 && (h = i ? i.length : 0), f === void 0 && (f = 0), m === void 0 && (m = this.length), r < 0 || h > i.length || f < 0 || m > this.length)
1282
+ if (r === void 0 && (r = 0), h === void 0 && (h = i ? i.length : 0), f === void 0 && (f = 0), E === void 0 && (E = this.length), r < 0 || h > i.length || f < 0 || E > this.length)
1283
1283
  throw new RangeError("out of range index");
1284
- if (f >= m && r >= h)
1284
+ if (f >= E && r >= h)
1285
1285
  return 0;
1286
- if (f >= m)
1286
+ if (f >= E)
1287
1287
  return -1;
1288
1288
  if (r >= h)
1289
1289
  return 1;
1290
- if (r >>>= 0, h >>>= 0, f >>>= 0, m >>>= 0, this === i) return 0;
1291
- let v = m - f, T = h - r;
1292
- const L = Math.min(v, T), U = this.slice(f, m), B = i.slice(r, h);
1293
- for (let M = 0; M < L; ++M)
1294
- if (U[M] !== B[M]) {
1295
- v = U[M], T = B[M];
1290
+ if (r >>>= 0, h >>>= 0, f >>>= 0, E >>>= 0, this === i) return 0;
1291
+ let v = E - f, T = h - r;
1292
+ const L = Math.min(v, T), U = this.slice(f, E), B = i.slice(r, h);
1293
+ for (let D = 0; D < L; ++D)
1294
+ if (U[D] !== B[D]) {
1295
+ v = U[D], T = B[D];
1296
1296
  break;
1297
1297
  }
1298
1298
  return v < T ? -1 : T < v ? 1 : 0;
1299
1299
  };
1300
- function Z(s, i, r, h, f) {
1300
+ function Y(s, i, r, h, f) {
1301
1301
  if (s.length === 0) return -1;
1302
1302
  if (typeof r == "string" ? (h = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r, lt(r) && (r = f ? 0 : s.length - 1), r < 0 && (r = s.length + r), r >= s.length) {
1303
1303
  if (f) return -1;
@@ -1306,34 +1306,34 @@ function Un() {
1306
1306
  if (f) r = 0;
1307
1307
  else return -1;
1308
1308
  if (typeof i == "string" && (i = l.from(i, h)), l.isBuffer(i))
1309
- return i.length === 0 ? -1 : V(s, i, r, h, f);
1309
+ return i.length === 0 ? -1 : ne(s, i, r, h, f);
1310
1310
  if (typeof i == "number")
1311
- return i = i & 255, typeof Uint8Array.prototype.indexOf == "function" ? f ? Uint8Array.prototype.indexOf.call(s, i, r) : Uint8Array.prototype.lastIndexOf.call(s, i, r) : V(s, [i], r, h, f);
1311
+ return i = i & 255, typeof Uint8Array.prototype.indexOf == "function" ? f ? Uint8Array.prototype.indexOf.call(s, i, r) : Uint8Array.prototype.lastIndexOf.call(s, i, r) : ne(s, [i], r, h, f);
1312
1312
  throw new TypeError("val must be string, number or Buffer");
1313
1313
  }
1314
- function V(s, i, r, h, f) {
1315
- let m = 1, v = s.length, T = i.length;
1314
+ function ne(s, i, r, h, f) {
1315
+ let E = 1, v = s.length, T = i.length;
1316
1316
  if (h !== void 0 && (h = String(h).toLowerCase(), h === "ucs2" || h === "ucs-2" || h === "utf16le" || h === "utf-16le")) {
1317
1317
  if (s.length < 2 || i.length < 2)
1318
1318
  return -1;
1319
- m = 2, v /= 2, T /= 2, r /= 2;
1319
+ E = 2, v /= 2, T /= 2, r /= 2;
1320
1320
  }
1321
- function L(B, M) {
1322
- return m === 1 ? B[M] : B.readUInt16BE(M * m);
1321
+ function L(B, D) {
1322
+ return E === 1 ? B[D] : B.readUInt16BE(D * E);
1323
1323
  }
1324
1324
  let U;
1325
1325
  if (f) {
1326
1326
  let B = -1;
1327
1327
  for (U = r; U < v; U++)
1328
1328
  if (L(s, U) === L(i, B === -1 ? 0 : U - B)) {
1329
- if (B === -1 && (B = U), U - B + 1 === T) return B * m;
1329
+ if (B === -1 && (B = U), U - B + 1 === T) return B * E;
1330
1330
  } else
1331
1331
  B !== -1 && (U -= U - B), B = -1;
1332
1332
  } else
1333
1333
  for (r + T > v && (r = v - T), U = r; U >= 0; U--) {
1334
1334
  let B = !0;
1335
- for (let M = 0; M < T; M++)
1336
- if (L(s, U + M) !== L(i, M)) {
1335
+ for (let D = 0; D < T; D++)
1336
+ if (L(s, U + D) !== L(i, D)) {
1337
1337
  B = !1;
1338
1338
  break;
1339
1339
  }
@@ -1344,16 +1344,16 @@ function Un() {
1344
1344
  l.prototype.includes = function(i, r, h) {
1345
1345
  return this.indexOf(i, r, h) !== -1;
1346
1346
  }, l.prototype.indexOf = function(i, r, h) {
1347
- return Z(this, i, r, h, !0);
1347
+ return Y(this, i, r, h, !0);
1348
1348
  }, l.prototype.lastIndexOf = function(i, r, h) {
1349
- return Z(this, i, r, h, !1);
1349
+ return Y(this, i, r, h, !1);
1350
1350
  };
1351
- function se(s, i, r, h) {
1351
+ function $(s, i, r, h) {
1352
1352
  r = Number(r) || 0;
1353
1353
  const f = s.length - r;
1354
1354
  h ? (h = Number(h), h > f && (h = f)) : h = f;
1355
- const m = i.length;
1356
- h > m / 2 && (h = m / 2);
1355
+ const E = i.length;
1356
+ h > E / 2 && (h = E / 2);
1357
1357
  let v;
1358
1358
  for (v = 0; v < h; ++v) {
1359
1359
  const T = parseInt(i.substr(v * 2, 2), 16);
@@ -1362,10 +1362,10 @@ function Un() {
1362
1362
  }
1363
1363
  return v;
1364
1364
  }
1365
- function ne(s, i, r, h) {
1365
+ function re(s, i, r, h) {
1366
1366
  return Ve(at(i, s.length - r), s, r, h);
1367
1367
  }
1368
- function re(s, i, r, h) {
1368
+ function oe(s, i, r, h) {
1369
1369
  return Ve(on(i), s, r, h);
1370
1370
  }
1371
1371
  function Q(s, i, r, h) {
@@ -1385,22 +1385,22 @@ function Un() {
1385
1385
  throw new Error(
1386
1386
  "Buffer.write(string, encoding, offset[, length]) is no longer supported"
1387
1387
  );
1388
- const m = this.length - r;
1389
- if ((h === void 0 || h > m) && (h = m), i.length > 0 && (h < 0 || r < 0) || r > this.length)
1388
+ const E = this.length - r;
1389
+ if ((h === void 0 || h > E) && (h = E), i.length > 0 && (h < 0 || r < 0) || r > this.length)
1390
1390
  throw new RangeError("Attempt to write outside buffer bounds");
1391
1391
  f || (f = "utf8");
1392
1392
  let v = !1;
1393
1393
  for (; ; )
1394
1394
  switch (f) {
1395
1395
  case "hex":
1396
- return se(this, i, r, h);
1396
+ return $(this, i, r, h);
1397
1397
  case "utf8":
1398
1398
  case "utf-8":
1399
- return ne(this, i, r, h);
1399
+ return re(this, i, r, h);
1400
1400
  case "ascii":
1401
1401
  case "latin1":
1402
1402
  case "binary":
1403
- return re(this, i, r, h);
1403
+ return oe(this, i, r, h);
1404
1404
  case "base64":
1405
1405
  return Q(this, i, r, h);
1406
1406
  case "ucs2":
@@ -1426,22 +1426,22 @@ function Un() {
1426
1426
  const h = [];
1427
1427
  let f = i;
1428
1428
  for (; f < r; ) {
1429
- const m = s[f];
1430
- let v = null, T = m > 239 ? 4 : m > 223 ? 3 : m > 191 ? 2 : 1;
1429
+ const E = s[f];
1430
+ let v = null, T = E > 239 ? 4 : E > 223 ? 3 : E > 191 ? 2 : 1;
1431
1431
  if (f + T <= r) {
1432
- let L, U, B, M;
1432
+ let L, U, B, D;
1433
1433
  switch (T) {
1434
1434
  case 1:
1435
- m < 128 && (v = m);
1435
+ E < 128 && (v = E);
1436
1436
  break;
1437
1437
  case 2:
1438
- L = s[f + 1], (L & 192) === 128 && (M = (m & 31) << 6 | L & 63, M > 127 && (v = M));
1438
+ L = s[f + 1], (L & 192) === 128 && (D = (E & 31) << 6 | L & 63, D > 127 && (v = D));
1439
1439
  break;
1440
1440
  case 3:
1441
- L = s[f + 1], U = s[f + 2], (L & 192) === 128 && (U & 192) === 128 && (M = (m & 15) << 12 | (L & 63) << 6 | U & 63, M > 2047 && (M < 55296 || M > 57343) && (v = M));
1441
+ L = s[f + 1], U = s[f + 2], (L & 192) === 128 && (U & 192) === 128 && (D = (E & 15) << 12 | (L & 63) << 6 | U & 63, D > 2047 && (D < 55296 || D > 57343) && (v = D));
1442
1442
  break;
1443
1443
  case 4:
1444
- L = s[f + 1], U = s[f + 2], B = s[f + 3], (L & 192) === 128 && (U & 192) === 128 && (B & 192) === 128 && (M = (m & 15) << 18 | (L & 63) << 12 | (U & 63) << 6 | B & 63, M > 65535 && M < 1114112 && (v = M));
1444
+ L = s[f + 1], U = s[f + 2], B = s[f + 3], (L & 192) === 128 && (U & 192) === 128 && (B & 192) === 128 && (D = (E & 15) << 18 | (L & 63) << 12 | (U & 63) << 6 | B & 63, D > 65535 && D < 1114112 && (v = D));
1445
1445
  }
1446
1446
  }
1447
1447
  v === null ? (v = 65533, T = 1) : v > 65535 && (v -= 65536, h.push(v >>> 10 & 1023 | 55296), v = 56320 | v & 1023), h.push(v), f += T;
@@ -1479,15 +1479,15 @@ function Un() {
1479
1479
  const h = s.length;
1480
1480
  (!i || i < 0) && (i = 0), (!r || r < 0 || r > h) && (r = h);
1481
1481
  let f = "";
1482
- for (let m = i; m < r; ++m)
1483
- f += an[s[m]];
1482
+ for (let E = i; E < r; ++E)
1483
+ f += an[s[E]];
1484
1484
  return f;
1485
1485
  }
1486
1486
  function en(s, i, r) {
1487
1487
  const h = s.slice(i, r);
1488
1488
  let f = "";
1489
- for (let m = 0; m < h.length - 1; m += 2)
1490
- f += String.fromCharCode(h[m] + h[m + 1] * 256);
1489
+ for (let E = 0; E < h.length - 1; E += 2)
1490
+ f += String.fromCharCode(h[E] + h[E + 1] * 256);
1491
1491
  return f;
1492
1492
  }
1493
1493
  l.prototype.slice = function(i, r) {
@@ -1502,15 +1502,15 @@ function Un() {
1502
1502
  }
1503
1503
  l.prototype.readUintLE = l.prototype.readUIntLE = function(i, r, h) {
1504
1504
  i = i >>> 0, r = r >>> 0, h || G(i, r, this.length);
1505
- let f = this[i], m = 1, v = 0;
1506
- for (; ++v < r && (m *= 256); )
1507
- f += this[i + v] * m;
1505
+ let f = this[i], E = 1, v = 0;
1506
+ for (; ++v < r && (E *= 256); )
1507
+ f += this[i + v] * E;
1508
1508
  return f;
1509
1509
  }, l.prototype.readUintBE = l.prototype.readUIntBE = function(i, r, h) {
1510
1510
  i = i >>> 0, r = r >>> 0, h || G(i, r, this.length);
1511
- let f = this[i + --r], m = 1;
1512
- for (; r > 0 && (m *= 256); )
1513
- f += this[i + --r] * m;
1511
+ let f = this[i + --r], E = 1;
1512
+ for (; r > 0 && (E *= 256); )
1513
+ f += this[i + --r] * E;
1514
1514
  return f;
1515
1515
  }, l.prototype.readUint8 = l.prototype.readUInt8 = function(i, r) {
1516
1516
  return i = i >>> 0, r || G(i, 1, this.length), this[i];
@@ -1526,26 +1526,26 @@ function Un() {
1526
1526
  i = i >>> 0, ye(i, "offset");
1527
1527
  const r = this[i], h = this[i + 7];
1528
1528
  (r === void 0 || h === void 0) && Re(i, this.length - 8);
1529
- const f = r + this[++i] * 2 ** 8 + this[++i] * 2 ** 16 + this[++i] * 2 ** 24, m = this[++i] + this[++i] * 2 ** 8 + this[++i] * 2 ** 16 + h * 2 ** 24;
1530
- return BigInt(f) + (BigInt(m) << BigInt(32));
1529
+ const f = r + this[++i] * 2 ** 8 + this[++i] * 2 ** 16 + this[++i] * 2 ** 24, E = this[++i] + this[++i] * 2 ** 8 + this[++i] * 2 ** 16 + h * 2 ** 24;
1530
+ return BigInt(f) + (BigInt(E) << BigInt(32));
1531
1531
  }), l.prototype.readBigUInt64BE = le(function(i) {
1532
1532
  i = i >>> 0, ye(i, "offset");
1533
1533
  const r = this[i], h = this[i + 7];
1534
1534
  (r === void 0 || h === void 0) && Re(i, this.length - 8);
1535
- const f = r * 2 ** 24 + this[++i] * 2 ** 16 + this[++i] * 2 ** 8 + this[++i], m = this[++i] * 2 ** 24 + this[++i] * 2 ** 16 + this[++i] * 2 ** 8 + h;
1536
- return (BigInt(f) << BigInt(32)) + BigInt(m);
1535
+ const f = r * 2 ** 24 + this[++i] * 2 ** 16 + this[++i] * 2 ** 8 + this[++i], E = this[++i] * 2 ** 24 + this[++i] * 2 ** 16 + this[++i] * 2 ** 8 + h;
1536
+ return (BigInt(f) << BigInt(32)) + BigInt(E);
1537
1537
  }), l.prototype.readIntLE = function(i, r, h) {
1538
1538
  i = i >>> 0, r = r >>> 0, h || G(i, r, this.length);
1539
- let f = this[i], m = 1, v = 0;
1540
- for (; ++v < r && (m *= 256); )
1541
- f += this[i + v] * m;
1542
- return m *= 128, f >= m && (f -= Math.pow(2, 8 * r)), f;
1539
+ let f = this[i], E = 1, v = 0;
1540
+ for (; ++v < r && (E *= 256); )
1541
+ f += this[i + v] * E;
1542
+ return E *= 128, f >= E && (f -= Math.pow(2, 8 * r)), f;
1543
1543
  }, l.prototype.readIntBE = function(i, r, h) {
1544
1544
  i = i >>> 0, r = r >>> 0, h || G(i, r, this.length);
1545
- let f = r, m = 1, v = this[i + --f];
1546
- for (; f > 0 && (m *= 256); )
1547
- v += this[i + --f] * m;
1548
- return m *= 128, v >= m && (v -= Math.pow(2, 8 * r)), v;
1545
+ let f = r, E = 1, v = this[i + --f];
1546
+ for (; f > 0 && (E *= 256); )
1547
+ v += this[i + --f] * E;
1548
+ return E *= 128, v >= E && (v -= Math.pow(2, 8 * r)), v;
1549
1549
  }, l.prototype.readInt8 = function(i, r) {
1550
1550
  return i = i >>> 0, r || G(i, 1, this.length), this[i] & 128 ? (255 - this[i] + 1) * -1 : this[i];
1551
1551
  }, l.prototype.readInt16LE = function(i, r) {
@@ -1582,51 +1582,51 @@ function Un() {
1582
1582
  }, l.prototype.readDoubleBE = function(i, r) {
1583
1583
  return i = i >>> 0, r || G(i, 8, this.length), n.read(this, i, !1, 52, 8);
1584
1584
  };
1585
- function Y(s, i, r, h, f, m) {
1585
+ function K(s, i, r, h, f, E) {
1586
1586
  if (!l.isBuffer(s)) throw new TypeError('"buffer" argument must be a Buffer instance');
1587
- if (i > f || i < m) throw new RangeError('"value" argument is out of bounds');
1587
+ if (i > f || i < E) throw new RangeError('"value" argument is out of bounds');
1588
1588
  if (r + h > s.length) throw new RangeError("Index out of range");
1589
1589
  }
1590
1590
  l.prototype.writeUintLE = l.prototype.writeUIntLE = function(i, r, h, f) {
1591
1591
  if (i = +i, r = r >>> 0, h = h >>> 0, !f) {
1592
1592
  const T = Math.pow(2, 8 * h) - 1;
1593
- Y(this, i, r, h, T, 0);
1593
+ K(this, i, r, h, T, 0);
1594
1594
  }
1595
- let m = 1, v = 0;
1596
- for (this[r] = i & 255; ++v < h && (m *= 256); )
1597
- this[r + v] = i / m & 255;
1595
+ let E = 1, v = 0;
1596
+ for (this[r] = i & 255; ++v < h && (E *= 256); )
1597
+ this[r + v] = i / E & 255;
1598
1598
  return r + h;
1599
1599
  }, l.prototype.writeUintBE = l.prototype.writeUIntBE = function(i, r, h, f) {
1600
1600
  if (i = +i, r = r >>> 0, h = h >>> 0, !f) {
1601
1601
  const T = Math.pow(2, 8 * h) - 1;
1602
- Y(this, i, r, h, T, 0);
1602
+ K(this, i, r, h, T, 0);
1603
1603
  }
1604
- let m = h - 1, v = 1;
1605
- for (this[r + m] = i & 255; --m >= 0 && (v *= 256); )
1606
- this[r + m] = i / v & 255;
1604
+ let E = h - 1, v = 1;
1605
+ for (this[r + E] = i & 255; --E >= 0 && (v *= 256); )
1606
+ this[r + E] = i / v & 255;
1607
1607
  return r + h;
1608
1608
  }, l.prototype.writeUint8 = l.prototype.writeUInt8 = function(i, r, h) {
1609
- return i = +i, r = r >>> 0, h || Y(this, i, r, 1, 255, 0), this[r] = i & 255, r + 1;
1609
+ return i = +i, r = r >>> 0, h || K(this, i, r, 1, 255, 0), this[r] = i & 255, r + 1;
1610
1610
  }, l.prototype.writeUint16LE = l.prototype.writeUInt16LE = function(i, r, h) {
1611
- return i = +i, r = r >>> 0, h || Y(this, i, r, 2, 65535, 0), this[r] = i & 255, this[r + 1] = i >>> 8, r + 2;
1611
+ return i = +i, r = r >>> 0, h || K(this, i, r, 2, 65535, 0), this[r] = i & 255, this[r + 1] = i >>> 8, r + 2;
1612
1612
  }, l.prototype.writeUint16BE = l.prototype.writeUInt16BE = function(i, r, h) {
1613
- return i = +i, r = r >>> 0, h || Y(this, i, r, 2, 65535, 0), this[r] = i >>> 8, this[r + 1] = i & 255, r + 2;
1613
+ return i = +i, r = r >>> 0, h || K(this, i, r, 2, 65535, 0), this[r] = i >>> 8, this[r + 1] = i & 255, r + 2;
1614
1614
  }, l.prototype.writeUint32LE = l.prototype.writeUInt32LE = function(i, r, h) {
1615
- return i = +i, r = r >>> 0, h || Y(this, i, r, 4, 4294967295, 0), this[r + 3] = i >>> 24, this[r + 2] = i >>> 16, this[r + 1] = i >>> 8, this[r] = i & 255, r + 4;
1615
+ return i = +i, r = r >>> 0, h || K(this, i, r, 4, 4294967295, 0), this[r + 3] = i >>> 24, this[r + 2] = i >>> 16, this[r + 1] = i >>> 8, this[r] = i & 255, r + 4;
1616
1616
  }, l.prototype.writeUint32BE = l.prototype.writeUInt32BE = function(i, r, h) {
1617
- return i = +i, r = r >>> 0, h || Y(this, i, r, 4, 4294967295, 0), this[r] = i >>> 24, this[r + 1] = i >>> 16, this[r + 2] = i >>> 8, this[r + 3] = i & 255, r + 4;
1617
+ return i = +i, r = r >>> 0, h || K(this, i, r, 4, 4294967295, 0), this[r] = i >>> 24, this[r + 1] = i >>> 16, this[r + 2] = i >>> 8, this[r + 3] = i & 255, r + 4;
1618
1618
  };
1619
1619
  function Bt(s, i, r, h, f) {
1620
1620
  jt(i, h, f, s, r, 7);
1621
- let m = Number(i & BigInt(4294967295));
1622
- s[r++] = m, m = m >> 8, s[r++] = m, m = m >> 8, s[r++] = m, m = m >> 8, s[r++] = m;
1621
+ let E = Number(i & BigInt(4294967295));
1622
+ s[r++] = E, E = E >> 8, s[r++] = E, E = E >> 8, s[r++] = E, E = E >> 8, s[r++] = E;
1623
1623
  let v = Number(i >> BigInt(32) & BigInt(4294967295));
1624
1624
  return s[r++] = v, v = v >> 8, s[r++] = v, v = v >> 8, s[r++] = v, v = v >> 8, s[r++] = v, r;
1625
1625
  }
1626
1626
  function Pt(s, i, r, h, f) {
1627
1627
  jt(i, h, f, s, r, 7);
1628
- let m = Number(i & BigInt(4294967295));
1629
- s[r + 7] = m, m = m >> 8, s[r + 6] = m, m = m >> 8, s[r + 5] = m, m = m >> 8, s[r + 4] = m;
1628
+ let E = Number(i & BigInt(4294967295));
1629
+ s[r + 7] = E, E = E >> 8, s[r + 6] = E, E = E >> 8, s[r + 5] = E, E = E >> 8, s[r + 4] = E;
1630
1630
  let v = Number(i >> BigInt(32) & BigInt(4294967295));
1631
1631
  return s[r + 3] = v, v = v >> 8, s[r + 2] = v, v = v >> 8, s[r + 1] = v, v = v >> 8, s[r] = v, r + 8;
1632
1632
  }
@@ -1637,37 +1637,37 @@ function Un() {
1637
1637
  }), l.prototype.writeIntLE = function(i, r, h, f) {
1638
1638
  if (i = +i, r = r >>> 0, !f) {
1639
1639
  const L = Math.pow(2, 8 * h - 1);
1640
- Y(this, i, r, h, L - 1, -L);
1640
+ K(this, i, r, h, L - 1, -L);
1641
1641
  }
1642
- let m = 0, v = 1, T = 0;
1643
- for (this[r] = i & 255; ++m < h && (v *= 256); )
1644
- i < 0 && T === 0 && this[r + m - 1] !== 0 && (T = 1), this[r + m] = (i / v >> 0) - T & 255;
1642
+ let E = 0, v = 1, T = 0;
1643
+ for (this[r] = i & 255; ++E < h && (v *= 256); )
1644
+ i < 0 && T === 0 && this[r + E - 1] !== 0 && (T = 1), this[r + E] = (i / v >> 0) - T & 255;
1645
1645
  return r + h;
1646
1646
  }, l.prototype.writeIntBE = function(i, r, h, f) {
1647
1647
  if (i = +i, r = r >>> 0, !f) {
1648
1648
  const L = Math.pow(2, 8 * h - 1);
1649
- Y(this, i, r, h, L - 1, -L);
1649
+ K(this, i, r, h, L - 1, -L);
1650
1650
  }
1651
- let m = h - 1, v = 1, T = 0;
1652
- for (this[r + m] = i & 255; --m >= 0 && (v *= 256); )
1653
- i < 0 && T === 0 && this[r + m + 1] !== 0 && (T = 1), this[r + m] = (i / v >> 0) - T & 255;
1651
+ let E = h - 1, v = 1, T = 0;
1652
+ for (this[r + E] = i & 255; --E >= 0 && (v *= 256); )
1653
+ i < 0 && T === 0 && this[r + E + 1] !== 0 && (T = 1), this[r + E] = (i / v >> 0) - T & 255;
1654
1654
  return r + h;
1655
1655
  }, l.prototype.writeInt8 = function(i, r, h) {
1656
- return i = +i, r = r >>> 0, h || Y(this, i, r, 1, 127, -128), i < 0 && (i = 255 + i + 1), this[r] = i & 255, r + 1;
1656
+ return i = +i, r = r >>> 0, h || K(this, i, r, 1, 127, -128), i < 0 && (i = 255 + i + 1), this[r] = i & 255, r + 1;
1657
1657
  }, l.prototype.writeInt16LE = function(i, r, h) {
1658
- return i = +i, r = r >>> 0, h || Y(this, i, r, 2, 32767, -32768), this[r] = i & 255, this[r + 1] = i >>> 8, r + 2;
1658
+ return i = +i, r = r >>> 0, h || K(this, i, r, 2, 32767, -32768), this[r] = i & 255, this[r + 1] = i >>> 8, r + 2;
1659
1659
  }, l.prototype.writeInt16BE = function(i, r, h) {
1660
- return i = +i, r = r >>> 0, h || Y(this, i, r, 2, 32767, -32768), this[r] = i >>> 8, this[r + 1] = i & 255, r + 2;
1660
+ return i = +i, r = r >>> 0, h || K(this, i, r, 2, 32767, -32768), this[r] = i >>> 8, this[r + 1] = i & 255, r + 2;
1661
1661
  }, l.prototype.writeInt32LE = function(i, r, h) {
1662
- return i = +i, r = r >>> 0, h || Y(this, i, r, 4, 2147483647, -2147483648), this[r] = i & 255, this[r + 1] = i >>> 8, this[r + 2] = i >>> 16, this[r + 3] = i >>> 24, r + 4;
1662
+ return i = +i, r = r >>> 0, h || K(this, i, r, 4, 2147483647, -2147483648), this[r] = i & 255, this[r + 1] = i >>> 8, this[r + 2] = i >>> 16, this[r + 3] = i >>> 24, r + 4;
1663
1663
  }, l.prototype.writeInt32BE = function(i, r, h) {
1664
- return i = +i, r = r >>> 0, h || Y(this, i, r, 4, 2147483647, -2147483648), i < 0 && (i = 4294967295 + i + 1), this[r] = i >>> 24, this[r + 1] = i >>> 16, this[r + 2] = i >>> 8, this[r + 3] = i & 255, r + 4;
1664
+ return i = +i, r = r >>> 0, h || K(this, i, r, 4, 2147483647, -2147483648), i < 0 && (i = 4294967295 + i + 1), this[r] = i >>> 24, this[r + 1] = i >>> 16, this[r + 2] = i >>> 8, this[r + 3] = i & 255, r + 4;
1665
1665
  }, l.prototype.writeBigInt64LE = le(function(i, r = 0) {
1666
1666
  return Bt(this, i, r, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
1667
1667
  }), l.prototype.writeBigInt64BE = le(function(i, r = 0) {
1668
1668
  return Pt(this, i, r, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
1669
1669
  });
1670
- function Ft(s, i, r, h, f, m) {
1670
+ function Ft(s, i, r, h, f, E) {
1671
1671
  if (r + h > s.length) throw new RangeError("Index out of range");
1672
1672
  if (r < 0) throw new RangeError("Index out of range");
1673
1673
  }
@@ -1694,12 +1694,12 @@ function Un() {
1694
1694
  if (h < 0 || h >= this.length) throw new RangeError("Index out of range");
1695
1695
  if (f < 0) throw new RangeError("sourceEnd out of bounds");
1696
1696
  f > this.length && (f = this.length), i.length - r < f - h && (f = i.length - r + h);
1697
- const m = f - h;
1697
+ const E = f - h;
1698
1698
  return this === i && typeof Uint8Array.prototype.copyWithin == "function" ? this.copyWithin(r, h, f) : Uint8Array.prototype.set.call(
1699
1699
  i,
1700
1700
  this.subarray(h, f),
1701
1701
  r
1702
- ), m;
1702
+ ), E;
1703
1703
  }, l.prototype.fill = function(i, r, h, f) {
1704
1704
  if (typeof i == "string") {
1705
1705
  if (typeof r == "string" ? (f = r, r = 0, h = this.length) : typeof h == "string" && (f = h, h = this.length), f !== void 0 && typeof f != "string")
@@ -1716,16 +1716,16 @@ function Un() {
1716
1716
  if (h <= r)
1717
1717
  return this;
1718
1718
  r = r >>> 0, h = h === void 0 ? this.length : h >>> 0, i || (i = 0);
1719
- let m;
1719
+ let E;
1720
1720
  if (typeof i == "number")
1721
- for (m = r; m < h; ++m)
1722
- this[m] = i;
1721
+ for (E = r; E < h; ++E)
1722
+ this[E] = i;
1723
1723
  else {
1724
1724
  const v = l.isBuffer(i) ? i : l.from(i, f), T = v.length;
1725
1725
  if (T === 0)
1726
1726
  throw new TypeError('The value "' + i + '" is invalid for argument "value"');
1727
- for (m = 0; m < h - r; ++m)
1728
- this[m + r] = v[m % T];
1727
+ for (E = 0; E < h - r; ++E)
1728
+ this[E + r] = v[E % T];
1729
1729
  }
1730
1730
  return this;
1731
1731
  };
@@ -1785,13 +1785,13 @@ function Un() {
1785
1785
  function tn(s, i, r) {
1786
1786
  ye(i, "offset"), (s[i] === void 0 || s[i + r] === void 0) && Re(i, s.length - (r + 1));
1787
1787
  }
1788
- function jt(s, i, r, h, f, m) {
1788
+ function jt(s, i, r, h, f, E) {
1789
1789
  if (s > r || s < i) {
1790
1790
  const v = typeof i == "bigint" ? "n" : "";
1791
1791
  let T;
1792
- throw i === 0 || i === BigInt(0) ? T = `>= 0${v} and < 2${v} ** ${(m + 1) * 8}${v}` : T = `>= -(2${v} ** ${(m + 1) * 8 - 1}${v}) and < 2 ** ${(m + 1) * 8 - 1}${v}`, new ve.ERR_OUT_OF_RANGE("value", T, s);
1792
+ throw i === 0 || i === BigInt(0) ? T = `>= 0${v} and < 2${v} ** ${(E + 1) * 8}${v}` : T = `>= -(2${v} ** ${(E + 1) * 8 - 1}${v}) and < 2 ** ${(E + 1) * 8 - 1}${v}`, new ve.ERR_OUT_OF_RANGE("value", T, s);
1793
1793
  }
1794
- tn(h, f, m);
1794
+ tn(h, f, E);
1795
1795
  }
1796
1796
  function ye(s, i) {
1797
1797
  if (typeof s != "number")
@@ -1816,45 +1816,45 @@ function Un() {
1816
1816
  let r;
1817
1817
  const h = s.length;
1818
1818
  let f = null;
1819
- const m = [];
1819
+ const E = [];
1820
1820
  for (let v = 0; v < h; ++v) {
1821
1821
  if (r = s.charCodeAt(v), r > 55295 && r < 57344) {
1822
1822
  if (!f) {
1823
1823
  if (r > 56319) {
1824
- (i -= 3) > -1 && m.push(239, 191, 189);
1824
+ (i -= 3) > -1 && E.push(239, 191, 189);
1825
1825
  continue;
1826
1826
  } else if (v + 1 === h) {
1827
- (i -= 3) > -1 && m.push(239, 191, 189);
1827
+ (i -= 3) > -1 && E.push(239, 191, 189);
1828
1828
  continue;
1829
1829
  }
1830
1830
  f = r;
1831
1831
  continue;
1832
1832
  }
1833
1833
  if (r < 56320) {
1834
- (i -= 3) > -1 && m.push(239, 191, 189), f = r;
1834
+ (i -= 3) > -1 && E.push(239, 191, 189), f = r;
1835
1835
  continue;
1836
1836
  }
1837
1837
  r = (f - 55296 << 10 | r - 56320) + 65536;
1838
- } else f && (i -= 3) > -1 && m.push(239, 191, 189);
1838
+ } else f && (i -= 3) > -1 && E.push(239, 191, 189);
1839
1839
  if (f = null, r < 128) {
1840
1840
  if ((i -= 1) < 0) break;
1841
- m.push(r);
1841
+ E.push(r);
1842
1842
  } else if (r < 2048) {
1843
1843
  if ((i -= 2) < 0) break;
1844
- m.push(
1844
+ E.push(
1845
1845
  r >> 6 | 192,
1846
1846
  r & 63 | 128
1847
1847
  );
1848
1848
  } else if (r < 65536) {
1849
1849
  if ((i -= 3) < 0) break;
1850
- m.push(
1850
+ E.push(
1851
1851
  r >> 12 | 224,
1852
1852
  r >> 6 & 63 | 128,
1853
1853
  r & 63 | 128
1854
1854
  );
1855
1855
  } else if (r < 1114112) {
1856
1856
  if ((i -= 4) < 0) break;
1857
- m.push(
1857
+ E.push(
1858
1858
  r >> 18 | 240,
1859
1859
  r >> 12 & 63 | 128,
1860
1860
  r >> 6 & 63 | 128,
@@ -1863,7 +1863,7 @@ function Un() {
1863
1863
  } else
1864
1864
  throw new Error("Invalid code point");
1865
1865
  }
1866
- return m;
1866
+ return E;
1867
1867
  }
1868
1868
  function on(s) {
1869
1869
  const i = [];
@@ -1873,10 +1873,10 @@ function Un() {
1873
1873
  }
1874
1874
  function sn(s, i) {
1875
1875
  let r, h, f;
1876
- const m = [];
1876
+ const E = [];
1877
1877
  for (let v = 0; v < s.length && !((i -= 2) < 0); ++v)
1878
- r = s.charCodeAt(v), h = r >> 8, f = r % 256, m.push(f), m.push(h);
1879
- return m;
1878
+ r = s.charCodeAt(v), h = r >> 8, f = r % 256, E.push(f), E.push(h);
1879
+ return E;
1880
1880
  }
1881
1881
  function Ht(s) {
1882
1882
  return e.toByteArray(rn(s));
@@ -1929,7 +1929,7 @@ var Fn = function(t, e, n, o) {
1929
1929
  c(d);
1930
1930
  }
1931
1931
  }
1932
- function E(_) {
1932
+ function m(_) {
1933
1933
  try {
1934
1934
  p(o.throw(_));
1935
1935
  } catch (d) {
@@ -1937,16 +1937,16 @@ var Fn = function(t, e, n, o) {
1937
1937
  }
1938
1938
  }
1939
1939
  function p(_) {
1940
- _.done ? a(_.value) : u(_.value).then(l, E);
1940
+ _.done ? a(_.value) : u(_.value).then(l, m);
1941
1941
  }
1942
1942
  p((o = o.apply(t, e || [])).next());
1943
1943
  });
1944
1944
  };
1945
1945
  const zi = "https://api.anam.ai", xt = "/v1";
1946
- var oe;
1946
+ var se;
1947
1947
  (function(t) {
1948
1948
  t.CLIENT_METRIC_MEASUREMENT_ERROR = "client_error", t.CLIENT_METRIC_MEASUREMENT_CONNECTION_CLOSED = "client_connection_closed", t.CLIENT_METRIC_MEASUREMENT_CONNECTION_ESTABLISHED = "client_connection_established", t.CLIENT_METRIC_MEASUREMENT_SESSION_ATTEMPT = "client_session_attempt", t.CLIENT_METRIC_MEASUREMENT_SESSION_SUCCESS = "client_session_success";
1949
- })(oe || (oe = {}));
1949
+ })(se || (se = {}));
1950
1950
  let St = zi, qi = xt, ue, Yi = !1;
1951
1951
  const $n = (t, e = xt) => {
1952
1952
  St = t, qi = e;
@@ -2005,8 +2005,8 @@ const Se = (t) => {
2005
2005
  };
2006
2006
  c.personaVideoStream.push(I);
2007
2007
  }));
2008
- const E = ((o = a["inbound-rtp"]) === null || o === void 0 ? void 0 : o.filter((d) => d.kind === "audio")) || [];
2009
- E.length > 0 && (c.personaAudioStream = [], E.forEach((d) => {
2008
+ const m = ((o = a["inbound-rtp"]) === null || o === void 0 ? void 0 : o.filter((d) => d.kind === "audio")) || [];
2009
+ m.length > 0 && (c.personaAudioStream = [], m.forEach((d) => {
2010
2010
  var S, g, y;
2011
2011
  const C = {
2012
2012
  packetsReceived: (S = d.packetsReceived) !== null && S !== void 0 ? S : "unknown",
@@ -2047,7 +2047,7 @@ const Se = (t) => {
2047
2047
  const _ = [];
2048
2048
  if (l.forEach((d) => {
2049
2049
  typeof d.framesDropped == "number" && d.framesDropped > 0 && _.push(`Video: ${d.framesDropped} frames dropped`), typeof d.packetsLost == "number" && d.packetsLost > 0 && _.push(`Video: ${d.packetsLost} packets lost`), typeof d.framesPerSecond == "number" && d.framesPerSecond < 23 && _.push(`Video: Low frame rate (${d.framesPerSecond} fps)`);
2050
- }), E.forEach((d) => {
2050
+ }), m.forEach((d) => {
2051
2051
  typeof d.packetsLost == "number" && d.packetsLost > 0 && _.push(`Audio: ${d.packetsLost} packets lost`), typeof d.jitter == "number" && d.jitter > 0.1 && _.push(`Audio: High jitter (${(d.jitter * 1e3).toFixed(1)}ms)`);
2052
2052
  }), c.issues = _, e === "json")
2053
2053
  return c;
@@ -2067,9 +2067,9 @@ var j;
2067
2067
  (function(t) {
2068
2068
  t.CLIENT_ERROR_CODE_USAGE_LIMIT_REACHED = "CLIENT_ERROR_CODE_USAGE_LIMIT_REACHED", t.CLIENT_ERROR_CODE_SPEND_CAP_REACHED = "CLIENT_ERROR_CODE_SPEND_CAP_REACHED", t.CLIENT_ERROR_CODE_VALIDATION_ERROR = "CLIENT_ERROR_CODE_VALIDATION_ERROR", t.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR = "CLIENT_ERROR_CODE_AUTHENTICATION_ERROR", t.CLIENT_ERROR_CODE_SERVER_ERROR = "CLIENT_ERROR_CODE_SERVER_ERROR", t.CLIENT_ERROR_CODE_MAX_CONCURRENT_SESSIONS_REACHED = "CLIENT_ERROR_CODE_MAX_CONCURRENT_SESSIONS_REACHED", t.CLIENT_ERROR_CODE_SERVICE_BUSY = "CLIENT_ERROR_CODE_SERVICE_BUSY", t.CLIENT_ERROR_CODE_NO_PLAN_FOUND = "CLIENT_ERROR_CODE_NO_PLAN_FOUND", t.CLIENT_ERROR_CODE_UNKNOWN_ERROR = "CLIENT_ERROR_CODE_UNKNOWN_ERROR", t.CLIENT_ERROR_CODE_CONFIGURATION_ERROR = "CLIENT_ERROR_CODE_CONFIGURATION_ERROR";
2069
2069
  })(j || (j = {}));
2070
- class $ extends Error {
2070
+ class V extends Error {
2071
2071
  constructor(e, n, o = 500, u) {
2072
- super(e), this.name = "ClientError", this.code = n, this.statusCode = o, this.details = u, Object.setPrototypeOf(this, $.prototype), me(oe.CLIENT_METRIC_MEASUREMENT_ERROR, n, {
2072
+ super(e), this.name = "ClientError", this.code = n, this.statusCode = o, this.details = u, Object.setPrototypeOf(this, V.prototype), me(se.CLIENT_METRIC_MEASUREMENT_ERROR, n, {
2073
2073
  details: u,
2074
2074
  statusCode: o
2075
2075
  });
@@ -2109,14 +2109,14 @@ var Qe;
2109
2109
  (function(t) {
2110
2110
  t.USER = "user", t.PERSONA = "persona";
2111
2111
  })(Qe || (Qe = {}));
2112
- var R;
2112
+ var N;
2113
2113
  (function(t) {
2114
2114
  t.MESSAGE_HISTORY_UPDATED = "MESSAGE_HISTORY_UPDATED", t.MESSAGE_STREAM_EVENT_RECEIVED = "MESSAGE_STREAM_EVENT_RECEIVED", t.CONNECTION_ESTABLISHED = "CONNECTION_ESTABLISHED", t.CONNECTION_CLOSED = "CONNECTION_CLOSED", t.INPUT_AUDIO_STREAM_STARTED = "INPUT_AUDIO_STREAM_STARTED", t.VIDEO_STREAM_STARTED = "VIDEO_STREAM_STARTED", t.VIDEO_PLAY_STARTED = "VIDEO_PLAY_STARTED", t.AUDIO_STREAM_STARTED = "AUDIO_STREAM_STARTED", t.TALK_STREAM_INTERRUPTED = "TALK_STREAM_INTERRUPTED", t.SESSION_READY = "SESSION_READY", t.SERVER_WARNING = "SERVER_WARNING", t.MIC_PERMISSION_PENDING = "MIC_PERMISSION_PENDING", t.MIC_PERMISSION_GRANTED = "MIC_PERMISSION_GRANTED", t.MIC_PERMISSION_DENIED = "MIC_PERMISSION_DENIED", t.INPUT_AUDIO_DEVICE_CHANGED = "INPUT_AUDIO_DEVICE_CHANGED", t.CLIENT_TOOL_EVENT_RECEIVED = "CLIENT_TOOL_EVENT_RECEIVED", t.REASONING_HISTORY_UPDATED = "REASONING_HISTORY_UPDATED", t.REASONING_STREAM_EVENT_RECEIVED = "REASONING_STREAM_EVENT_RECEIVED";
2115
- })(R || (R = {}));
2116
- var J;
2115
+ })(N || (N = {}));
2116
+ var X;
2117
2117
  (function(t) {
2118
2118
  t.WEB_SOCKET_OPEN = "WEB_SOCKET_OPEN", t.SIGNAL_MESSAGE_RECEIVED = "SIGNAL_MESSAGE_RECEIVED", t.WEBRTC_CHAT_MESSAGE_RECEIVED = "WEBRTC_CHAT_MESSAGE_RECEIVED", t.WEBRTC_CLIENT_TOOL_EVENT_RECEIVED = "WEBRTC_CLIENT_TOOL_EVENT_RECEIVED", t.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED = "WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED";
2119
- })(J || (J = {}));
2119
+ })(X || (X = {}));
2120
2120
  var pe;
2121
2121
  (function(t) {
2122
2122
  t.NORMAL = "CONNECTION_CLOSED_CODE_NORMAL", t.MICROPHONE_PERMISSION_DENIED = "CONNECTION_CLOSED_CODE_MICROPHONE_PERMISSION_DENIED", t.SIGNALLING_CLIENT_CONNECTION_FAILURE = "CONNECTION_CLOSED_CODE_SIGNALLING_CLIENT_CONNECTION_FAILURE", t.WEBRTC_FAILURE = "CONNECTION_CLOSED_CODE_WEBRTC_FAILURE", t.SERVER_CLOSED_CONNECTION = "CONNECTION_CLOSED_CODE_SERVER_CLOSED_CONNECTION";
@@ -2177,7 +2177,7 @@ var we = function(t, e, n, o) {
2177
2177
  c(d);
2178
2178
  }
2179
2179
  }
2180
- function E(_) {
2180
+ function m(_) {
2181
2181
  try {
2182
2182
  p(o.throw(_));
2183
2183
  } catch (d) {
@@ -2185,7 +2185,7 @@ var we = function(t, e, n, o) {
2185
2185
  }
2186
2186
  }
2187
2187
  function p(_) {
2188
- _.done ? a(_.value) : u(_.value).then(l, E);
2188
+ _.done ? a(_.value) : u(_.value).then(l, m);
2189
2189
  }
2190
2190
  p((o = o.apply(t, e || [])).next());
2191
2191
  });
@@ -2193,7 +2193,7 @@ var we = function(t, e, n, o) {
2193
2193
  const zn = 5, qn = 5;
2194
2194
  class Yn {
2195
2195
  constructor(e, n, o, u, a) {
2196
- var c, l, E, p, _;
2196
+ var c, l, m, p, _;
2197
2197
  if (this.stopSignal = !1, this.sendingBuffer = [], this.wsConnectionAttempts = 0, this.socket = null, this.heartBeatIntervalRef = null, this.publicEventEmitter = o, this.internalEventEmitter = u, this.apiGatewayConfig = a, !e)
2198
2198
  throw new Error("Signalling Client: sessionId is required");
2199
2199
  this.sessionId = e;
@@ -2201,10 +2201,10 @@ class Yn {
2201
2201
  if (this.heartbeatIntervalSeconds = d || zn, this.maxWsReconnectionAttempts = S || qn, !g.baseUrl)
2202
2202
  throw new Error("Signalling Client: baseUrl is required");
2203
2203
  if (!((c = this.apiGatewayConfig) === null || c === void 0) && c.enabled && (!((l = this.apiGatewayConfig) === null || l === void 0) && l.baseUrl)) {
2204
- const y = new URL(this.apiGatewayConfig.baseUrl), C = (E = this.apiGatewayConfig.wsPath) !== null && E !== void 0 ? E : "/ws";
2204
+ const y = new URL(this.apiGatewayConfig.baseUrl), C = (m = this.apiGatewayConfig.wsPath) !== null && m !== void 0 ? m : "/ws";
2205
2205
  y.protocol = y.protocol.replace("http", "ws"), y.pathname = C, this.url = y;
2206
- const A = g.protocol || "https", I = A === "http" ? "ws" : "wss", b = `${A}://${g.baseUrl}`, N = (p = g.signallingPath) !== null && p !== void 0 ? p : "/ws", D = new URL(b);
2207
- D.protocol = I === "ws" ? "ws:" : "wss:", g.port && (D.port = g.port), D.pathname = N, D.searchParams.append("session_id", e), this.url.searchParams.append("target_url", D.href);
2206
+ const A = g.protocol || "https", I = A === "http" ? "ws" : "wss", b = `${A}://${g.baseUrl}`, R = (p = g.signallingPath) !== null && p !== void 0 ? p : "/ws", M = new URL(b);
2207
+ M.protocol = I === "ws" ? "ws:" : "wss:", g.port && (M.port = g.port), M.pathname = R, M.searchParams.append("session_id", e), this.url.searchParams.append("target_url", M.href);
2208
2208
  } else {
2209
2209
  const C = `${g.protocol || "https"}://${g.baseUrl}`;
2210
2210
  this.url = new URL(C), this.url.protocol = g.protocol === "http" ? "ws:" : "wss:", g.port && (this.url.port = g.port), this.url.pathname = (_ = g.signallingPath) !== null && _ !== void 0 ? _ : "/ws", this.url.searchParams.append("session_id", e);
@@ -2285,9 +2285,9 @@ class Yn {
2285
2285
  if (!this.socket)
2286
2286
  throw new Error("SignallingClient - onOpen: socket is null");
2287
2287
  try {
2288
- this.wsConnectionAttempts = 0, this.flushSendingBuffer(), this.socket.onmessage = this.onMessage.bind(this), this.startSendingHeartBeats(), this.internalEventEmitter.emit(J.WEB_SOCKET_OPEN);
2288
+ this.wsConnectionAttempts = 0, this.flushSendingBuffer(), this.socket.onmessage = this.onMessage.bind(this), this.startSendingHeartBeats(), this.internalEventEmitter.emit(X.WEB_SOCKET_OPEN);
2289
2289
  } catch (e) {
2290
- console.error("SignallingClient - onOpen: error in onOpen", e), this.publicEventEmitter.emit(R.CONNECTION_CLOSED, pe.SIGNALLING_CLIENT_CONNECTION_FAILURE);
2290
+ console.error("SignallingClient - onOpen: error in onOpen", e), this.publicEventEmitter.emit(N.CONNECTION_CLOSED, pe.SIGNALLING_CLIENT_CONNECTION_FAILURE);
2291
2291
  }
2292
2292
  });
2293
2293
  }
@@ -2295,7 +2295,7 @@ class Yn {
2295
2295
  return we(this, void 0, void 0, function* () {
2296
2296
  this.wsConnectionAttempts += 1, !this.stopSignal && (this.wsConnectionAttempts <= this.maxWsReconnectionAttempts ? (this.socket = null, setTimeout(() => {
2297
2297
  this.connect();
2298
- }, 100 * this.wsConnectionAttempts)) : (this.heartBeatIntervalRef && (clearInterval(this.heartBeatIntervalRef), this.heartBeatIntervalRef = null), this.publicEventEmitter.emit(R.CONNECTION_CLOSED, pe.SIGNALLING_CLIENT_CONNECTION_FAILURE)));
2298
+ }, 100 * this.wsConnectionAttempts)) : (this.heartBeatIntervalRef && (clearInterval(this.heartBeatIntervalRef), this.heartBeatIntervalRef = null), this.publicEventEmitter.emit(N.CONNECTION_CLOSED, pe.SIGNALLING_CLIENT_CONNECTION_FAILURE)));
2299
2299
  });
2300
2300
  }
2301
2301
  onError(e) {
@@ -2311,7 +2311,7 @@ class Yn {
2311
2311
  onMessage(e) {
2312
2312
  return we(this, void 0, void 0, function* () {
2313
2313
  const n = JSON.parse(e.data);
2314
- this.internalEventEmitter.emit(J.SIGNAL_MESSAGE_RECEIVED, n);
2314
+ this.internalEventEmitter.emit(X.SIGNAL_MESSAGE_RECEIVED, n);
2315
2315
  });
2316
2316
  }
2317
2317
  startSendingHeartBeats() {
@@ -2346,7 +2346,7 @@ var ui = function(t, e, n, o) {
2346
2346
  c(d);
2347
2347
  }
2348
2348
  }
2349
- function E(_) {
2349
+ function m(_) {
2350
2350
  try {
2351
2351
  p(o.throw(_));
2352
2352
  } catch (d) {
@@ -2354,7 +2354,7 @@ var ui = function(t, e, n, o) {
2354
2354
  }
2355
2355
  }
2356
2356
  function p(_) {
2357
- _.done ? a(_.value) : u(_.value).then(l, E);
2357
+ _.done ? a(_.value) : u(_.value).then(l, m);
2358
2358
  }
2359
2359
  p((o = o.apply(t, e || [])).next());
2360
2360
  });
@@ -2383,7 +2383,7 @@ class Jn {
2383
2383
  return ui(this, void 0, void 0, function* () {
2384
2384
  if (!this.sessionToken) {
2385
2385
  if (!e)
2386
- throw new $("Persona configuration must be provided when using apiKey", j.CLIENT_ERROR_CODE_VALIDATION_ERROR, 400);
2386
+ throw new V("Persona configuration must be provided when using apiKey", j.CLIENT_ERROR_CODE_VALIDATION_ERROR, 400);
2387
2387
  this.sessionToken = yield this.unsafe_getSessionToken(e);
2388
2388
  }
2389
2389
  e && "brainType" in e && console.warn("Warning: brainType is deprecated and will be removed in a future version. Please use llmId instead.");
@@ -2399,28 +2399,28 @@ class Jn {
2399
2399
  sessionOptions: n,
2400
2400
  clientMetadata: Wi
2401
2401
  })
2402
- }), l = yield c.json(), E = l.error;
2402
+ }), l = yield c.json(), m = l.error;
2403
2403
  switch (c.status) {
2404
2404
  case 200:
2405
2405
  case 201:
2406
2406
  return l;
2407
2407
  case 400:
2408
- throw new $("Invalid request to start session", j.CLIENT_ERROR_CODE_VALIDATION_ERROR, 400, { cause: l.message });
2408
+ throw new V("Invalid request to start session", j.CLIENT_ERROR_CODE_VALIDATION_ERROR, 400, { cause: l.message });
2409
2409
  case 401:
2410
- throw new $("Authentication failed when starting session", j.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 401, { cause: l.message });
2410
+ throw new V("Authentication failed when starting session", j.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 401, { cause: l.message });
2411
2411
  case 402:
2412
- throw new $("Please sign up for a plan to start a session", j.CLIENT_ERROR_CODE_NO_PLAN_FOUND, 402, { cause: l.message });
2412
+ throw new V("Please sign up for a plan to start a session", j.CLIENT_ERROR_CODE_NO_PLAN_FOUND, 402, { cause: l.message });
2413
2413
  case 403:
2414
- throw new $("Authentication failed when starting session", j.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 403, { cause: l.message });
2414
+ throw new V("Authentication failed when starting session", j.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 403, { cause: l.message });
2415
2415
  case 429:
2416
- throw E === "Concurrent session limit reached" ? new $("Concurrency limit reached, please upgrade your plan", j.CLIENT_ERROR_CODE_MAX_CONCURRENT_SESSIONS_REACHED, 429, { cause: l.message }) : E === "Spend cap reached" ? new $("Spend cap reached, please upgrade your plan", j.CLIENT_ERROR_CODE_SPEND_CAP_REACHED, 429, { cause: l.message }) : new $("Usage limit reached, please upgrade your plan", j.CLIENT_ERROR_CODE_USAGE_LIMIT_REACHED, 429, { cause: l.message });
2416
+ throw m === "Concurrent session limit reached" ? new V("Concurrency limit reached, please upgrade your plan", j.CLIENT_ERROR_CODE_MAX_CONCURRENT_SESSIONS_REACHED, 429, { cause: l.message }) : m === "Spend cap reached" ? new V("Spend cap reached, please upgrade your plan", j.CLIENT_ERROR_CODE_SPEND_CAP_REACHED, 429, { cause: l.message }) : new V("Usage limit reached, please upgrade your plan", j.CLIENT_ERROR_CODE_USAGE_LIMIT_REACHED, 429, { cause: l.message });
2417
2417
  case 503:
2418
- throw new $("There are no available personas, please try again later", j.CLIENT_ERROR_CODE_SERVICE_BUSY, 503, { cause: l.message });
2418
+ throw new V("There are no available personas, please try again later", j.CLIENT_ERROR_CODE_SERVICE_BUSY, 503, { cause: l.message });
2419
2419
  default:
2420
- throw new $("Unknown error when starting session", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, { cause: l.message });
2420
+ throw new V("Unknown error when starting session", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, { cause: l.message });
2421
2421
  }
2422
2422
  } catch (o) {
2423
- throw o instanceof $ ? o : new $("Failed to start session", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, { cause: o instanceof Error ? o.message : String(o) });
2423
+ throw o instanceof V ? o : new V("Failed to start session", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, { cause: o instanceof Error ? o.message : String(o) });
2424
2424
  }
2425
2425
  });
2426
2426
  }
@@ -2466,7 +2466,7 @@ var Xn = function(t, e, n, o) {
2466
2466
  c(d);
2467
2467
  }
2468
2468
  }
2469
- function E(_) {
2469
+ function m(_) {
2470
2470
  try {
2471
2471
  p(o.throw(_));
2472
2472
  } catch (d) {
@@ -2474,7 +2474,7 @@ var Xn = function(t, e, n, o) {
2474
2474
  }
2475
2475
  }
2476
2476
  function p(_) {
2477
- _.done ? a(_.value) : u(_.value).then(l, E);
2477
+ _.done ? a(_.value) : u(_.value).then(l, m);
2478
2478
  }
2479
2479
  p((o = o.apply(t, e || [])).next());
2480
2480
  });
@@ -2497,15 +2497,15 @@ class Zn {
2497
2497
  a["X-Anam-Target-Url"] = p.href;
2498
2498
  } else
2499
2499
  u = `${this.baseUrl}${c}${l}`;
2500
- const E = yield fetch(u, {
2500
+ const m = yield fetch(u, {
2501
2501
  method: "POST",
2502
2502
  headers: a,
2503
2503
  body: JSON.stringify({
2504
2504
  content: e
2505
2505
  })
2506
2506
  });
2507
- if (!E.ok)
2508
- throw new Error(`Failed to send talk command: ${E.status} ${E.statusText}`);
2507
+ if (!m.ok)
2508
+ throw new Error(`Failed to send talk command: ${m.status} ${m.statusText}`);
2509
2509
  } catch (u) {
2510
2510
  throw console.error(u), new Error("EngineApiRestClient - sendTalkCommand: Failed to send talk command");
2511
2511
  }
@@ -2530,7 +2530,7 @@ class Qn {
2530
2530
  }
2531
2531
  class er {
2532
2532
  constructor(e, n) {
2533
- this.messages = [], this.publicEventEmitter = e, this.internalEventEmitter = n, this.internalEventEmitter.addListener(J.WEBRTC_CHAT_MESSAGE_RECEIVED, this.processWebRtcTextMessageEvent.bind(this));
2533
+ this.messages = [], this.publicEventEmitter = e, this.internalEventEmitter = n, this.internalEventEmitter.addListener(X.WEBRTC_CHAT_MESSAGE_RECEIVED, this.processWebRtcTextMessageEvent.bind(this));
2534
2534
  }
2535
2535
  webRtcTextMessageEventToMessageStreamEvent(e) {
2536
2536
  return {
@@ -2565,7 +2565,7 @@ class er {
2565
2565
  }
2566
2566
  processWebRtcTextMessageEvent(e) {
2567
2567
  const n = this.webRtcTextMessageEventToMessageStreamEvent(e);
2568
- switch (this.publicEventEmitter.emit(R.MESSAGE_STREAM_EVENT_RECEIVED, n), n.role) {
2568
+ switch (this.publicEventEmitter.emit(N.MESSAGE_STREAM_EVENT_RECEIVED, n), n.role) {
2569
2569
  case Qe.USER:
2570
2570
  this.processUserMessage(n);
2571
2571
  break;
@@ -2573,7 +2573,7 @@ class er {
2573
2573
  this.processPersonaMessage(n);
2574
2574
  break;
2575
2575
  }
2576
- n.endOfSpeech && this.publicEventEmitter.emit(R.MESSAGE_HISTORY_UPDATED, this.messages);
2576
+ n.endOfSpeech && this.publicEventEmitter.emit(N.MESSAGE_HISTORY_UPDATED, this.messages);
2577
2577
  }
2578
2578
  }
2579
2579
  class tr {
@@ -2587,9 +2587,9 @@ class tr {
2587
2587
  this.listeners[e] && this.listeners[e].delete(n);
2588
2588
  }
2589
2589
  emit(e, ...n) {
2590
- if (e === R.CONNECTION_ESTABLISHED && me(oe.CLIENT_METRIC_MEASUREMENT_CONNECTION_ESTABLISHED, "1"), e === R.CONNECTION_CLOSED) {
2590
+ if (e === N.CONNECTION_ESTABLISHED && me(se.CLIENT_METRIC_MEASUREMENT_CONNECTION_ESTABLISHED, "1"), e === N.CONNECTION_CLOSED) {
2591
2591
  const [o, u] = n;
2592
- me(oe.CLIENT_METRIC_MEASUREMENT_CONNECTION_CLOSED, o, u ? { details: u } : void 0);
2592
+ me(se.CLIENT_METRIC_MEASUREMENT_CONNECTION_CLOSED, o, u ? { details: u } : void 0);
2593
2593
  }
2594
2594
  this.listeners[e] && this.listeners[e].forEach((o) => {
2595
2595
  o(...n);
@@ -2614,7 +2614,7 @@ var ht = function(t, e, n, o) {
2614
2614
  c(d);
2615
2615
  }
2616
2616
  }
2617
- function E(_) {
2617
+ function m(_) {
2618
2618
  try {
2619
2619
  p(o.throw(_));
2620
2620
  } catch (d) {
@@ -2622,17 +2622,17 @@ var ht = function(t, e, n, o) {
2622
2622
  }
2623
2623
  }
2624
2624
  function p(_) {
2625
- _.done ? a(_.value) : u(_.value).then(l, E);
2625
+ _.done ? a(_.value) : u(_.value).then(l, m);
2626
2626
  }
2627
2627
  p((o = o.apply(t, e || [])).next());
2628
2628
  });
2629
2629
  };
2630
2630
  class ir {
2631
2631
  constructor(e, n, o) {
2632
- this.state = z.UNSTARTED, this.correlationId = e, this.internalEventEmitter = n, this.signallingClient = o, this.internalEventEmitter.addListener(J.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this));
2632
+ this.state = z.UNSTARTED, this.correlationId = e, this.internalEventEmitter = n, this.signallingClient = o, this.internalEventEmitter.addListener(X.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this));
2633
2633
  }
2634
2634
  onDeactivate() {
2635
- this.internalEventEmitter.removeListener(J.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this));
2635
+ this.internalEventEmitter.removeListener(X.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this));
2636
2636
  }
2637
2637
  onSignalMessage(e) {
2638
2638
  return ht(this, void 0, void 0, function* () {
@@ -2681,7 +2681,7 @@ class ir {
2681
2681
  return this.state;
2682
2682
  }
2683
2683
  }
2684
- var K = function(t, e, n, o) {
2684
+ var J = function(t, e, n, o) {
2685
2685
  function u(a) {
2686
2686
  return a instanceof n ? a : new n(function(c) {
2687
2687
  c(a);
@@ -2695,7 +2695,7 @@ var K = function(t, e, n, o) {
2695
2695
  c(d);
2696
2696
  }
2697
2697
  }
2698
- function E(_) {
2698
+ function m(_) {
2699
2699
  try {
2700
2700
  p(o.throw(_));
2701
2701
  } catch (d) {
@@ -2703,7 +2703,7 @@ var K = function(t, e, n, o) {
2703
2703
  }
2704
2704
  }
2705
2705
  function p(_) {
2706
- _.done ? a(_.value) : u(_.value).then(l, E);
2706
+ _.done ? a(_.value) : u(_.value).then(l, m);
2707
2707
  }
2708
2708
  p((o = o.apply(t, e || [])).next());
2709
2709
  });
@@ -2711,13 +2711,13 @@ var K = function(t, e, n, o) {
2711
2711
  const nr = 15e3, rr = 5e3, or = 2;
2712
2712
  class sr {
2713
2713
  constructor(e, n, o, u) {
2714
- var a, c, l, E;
2714
+ var a, c, l, m;
2715
2715
  this.peerConnection = null, this.connectionReceivedAnswer = !1, this.remoteIceCandidateBuffer = [], this.inputAudioStream = null, this.dataChannel = null, this.videoElement = null, this.videoStream = null, this.audioStream = null, this.inputAudioState = {
2716
2716
  isMuted: !1,
2717
2717
  permissionState: he.NOT_REQUESTED
2718
2718
  }, this.successMetricPoller = null, this.successMetricFired = !1, this.showPeerConnectionStatsReport = !1, this.peerConnectionStatsReportOutputFormat = "console", this.statsCollectionInterval = null, this.agentAudioInputStream = null, this.publicEventEmitter = o, this.internalEventEmitter = u, this.apiGatewayConfig = n.apiGateway;
2719
2719
  const { inputAudio: p } = n;
2720
- this.inputAudioState = p.inputAudioState, n.inputAudio.userProvidedMediaStream && (this.inputAudioStream = n.inputAudio.userProvidedMediaStream), this.disableInputAudio = n.inputAudio.disableInputAudio === !0, this.internalEventEmitter.addListener(J.WEB_SOCKET_OPEN, this.onSignallingClientConnected.bind(this)), this.internalEventEmitter.addListener(J.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this)), this.iceServers = n.iceServers, this.signallingClient = new Yn(e, n.signalling, this.publicEventEmitter, this.internalEventEmitter, this.apiGatewayConfig), this.engineApiRestClient = new Zn(n.engine.baseUrl, e, this.apiGatewayConfig), this.audioDeviceId = n.inputAudio.audioDeviceId, this.showPeerConnectionStatsReport = (c = (a = n.metrics) === null || a === void 0 ? void 0 : a.showPeerConnectionStatsReport) !== null && c !== void 0 ? c : !1, this.peerConnectionStatsReportOutputFormat = (E = (l = n.metrics) === null || l === void 0 ? void 0 : l.peerConnectionStatsReportOutputFormat) !== null && E !== void 0 ? E : "console";
2720
+ this.inputAudioState = p.inputAudioState, n.inputAudio.userProvidedMediaStream && (this.inputAudioStream = n.inputAudio.userProvidedMediaStream), this.disableInputAudio = n.inputAudio.disableInputAudio === !0, this.internalEventEmitter.addListener(X.WEB_SOCKET_OPEN, this.onSignallingClientConnected.bind(this)), this.internalEventEmitter.addListener(X.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this)), this.iceServers = n.iceServers, this.signallingClient = new Yn(e, n.signalling, this.publicEventEmitter, this.internalEventEmitter, this.apiGatewayConfig), this.engineApiRestClient = new Zn(n.engine.baseUrl, e, this.apiGatewayConfig), this.audioDeviceId = n.inputAudio.audioDeviceId, this.showPeerConnectionStatsReport = (c = (a = n.metrics) === null || a === void 0 ? void 0 : a.showPeerConnectionStatsReport) !== null && c !== void 0 ? c : !1, this.peerConnectionStatsReportOutputFormat = (m = (l = n.metrics) === null || l === void 0 ? void 0 : l.peerConnectionStatsReportOutputFormat) !== null && m !== void 0 ? m : "console";
2721
2721
  }
2722
2722
  onInputAudioStateChange(e, n) {
2723
2723
  e.isMuted !== n.isMuted && (n.isMuted ? this.muteAllAudioTracks() : this.unmuteAllAudioTracks());
@@ -2735,7 +2735,7 @@ class sr {
2735
2735
  });
2736
2736
  }
2737
2737
  startStatsCollection() {
2738
- this.statsCollectionInterval || (this.statsCollectionInterval = setInterval(() => K(this, void 0, void 0, function* () {
2738
+ this.statsCollectionInterval || (this.statsCollectionInterval = setInterval(() => J(this, void 0, void 0, function* () {
2739
2739
  if (!(!this.peerConnection || !this.dataChannel || this.dataChannel.readyState !== "open"))
2740
2740
  try {
2741
2741
  const e = yield this.peerConnection.getStats();
@@ -2762,7 +2762,7 @@ class sr {
2762
2762
  const e = setTimeout(() => {
2763
2763
  this.successMetricPoller && (console.warn("No video frames received, there is a problem with the connection."), clearInterval(this.successMetricPoller), this.successMetricPoller = null);
2764
2764
  }, nr);
2765
- this.successMetricPoller = setInterval(() => K(this, void 0, void 0, function* () {
2765
+ this.successMetricPoller = setInterval(() => J(this, void 0, void 0, function* () {
2766
2766
  if (!this.peerConnection || this.successMetricFired) {
2767
2767
  this.successMetricPoller && clearInterval(this.successMetricPoller), clearTimeout(e);
2768
2768
  return;
@@ -2773,7 +2773,7 @@ class sr {
2773
2773
  n.forEach((a) => {
2774
2774
  a.type === "inbound-rtp" && a.kind === "video" && (a.framesDecoded !== void 0 && a.framesDecoded > 0 ? (o = !0, u = "framesDecoded") : a.framesReceived !== void 0 && a.framesReceived > 0 ? (o = !0, u = "framesReceived") : a.bytesReceived > 0 && a.packetsReceived > 0 && // Additional check: ensure we've received enough data for actual video
2775
2775
  a.bytesReceived > 1e5 && (o = !0, u = "bytesReceived"));
2776
- }), o && !this.successMetricFired && (this.successMetricFired = !0, me(oe.CLIENT_METRIC_MEASUREMENT_SESSION_SUCCESS, "1", u ? { detectionMethod: u } : void 0), this.successMetricPoller && clearInterval(this.successMetricPoller), clearTimeout(e), this.successMetricPoller = null);
2776
+ }), o && !this.successMetricFired && (this.successMetricFired = !0, me(se.CLIENT_METRIC_MEASUREMENT_SESSION_SUCCESS, "1", u ? { detectionMethod: u } : void 0), this.successMetricPoller && clearInterval(this.successMetricPoller), clearTimeout(e), this.successMetricPoller = null);
2777
2777
  } catch {
2778
2778
  }
2779
2779
  }), 500);
@@ -2793,7 +2793,7 @@ class sr {
2793
2793
  return this.peerConnection;
2794
2794
  }
2795
2795
  changeAudioInputDevice(e) {
2796
- return K(this, void 0, void 0, function* () {
2796
+ return J(this, void 0, void 0, function* () {
2797
2797
  if (!this.peerConnection)
2798
2798
  throw new Error("StreamingClient - changeAudioInputDevice: peer connection is not initialized. Start streaming first.");
2799
2799
  if (e == null)
@@ -2811,7 +2811,7 @@ class sr {
2811
2811
  };
2812
2812
  this.inputAudioStream = yield navigator.mediaDevices.getUserMedia({
2813
2813
  audio: o
2814
- }), this.audioDeviceId = e, yield this.setupAudioTrack(), n && this.muteAllAudioTracks(), this.publicEventEmitter.emit(R.INPUT_AUDIO_DEVICE_CHANGED, e);
2814
+ }), this.audioDeviceId = e, yield this.setupAudioTrack(), n && this.muteAllAudioTracks(), this.publicEventEmitter.emit(N.INPUT_AUDIO_DEVICE_CHANGED, e);
2815
2815
  } catch (o) {
2816
2816
  throw console.error("Failed to change audio input device:", o), new Error(`StreamingClient - changeAudioInputDevice: ${o instanceof Error ? o.message : String(o)}`);
2817
2817
  }
@@ -2849,12 +2849,12 @@ class sr {
2849
2849
  }
2850
2850
  }
2851
2851
  stopConnection() {
2852
- return K(this, void 0, void 0, function* () {
2852
+ return J(this, void 0, void 0, function* () {
2853
2853
  yield this.shutdown();
2854
2854
  });
2855
2855
  }
2856
2856
  sendTalkCommand(e) {
2857
- return K(this, void 0, void 0, function* () {
2857
+ return J(this, void 0, void 0, function* () {
2858
2858
  if (!this.peerConnection)
2859
2859
  throw new Error("StreamingClient - sendTalkCommand: peer connection is null");
2860
2860
  yield this.engineApiRestClient.sendTalkCommand(e);
@@ -2870,7 +2870,7 @@ class sr {
2870
2870
  return this.agentAudioInputStream;
2871
2871
  }
2872
2872
  initPeerConnection() {
2873
- return K(this, void 0, void 0, function* () {
2873
+ return J(this, void 0, void 0, function* () {
2874
2874
  this.peerConnection = new RTCPeerConnection({
2875
2875
  iceServers: this.iceServers,
2876
2876
  iceCandidatePoolSize: or
@@ -2880,7 +2880,7 @@ class sr {
2880
2880
  });
2881
2881
  }
2882
2882
  onSignalMessage(e) {
2883
- return K(this, void 0, void 0, function* () {
2883
+ return J(this, void 0, void 0, function* () {
2884
2884
  if (!this.peerConnection) {
2885
2885
  console.error("StreamingClient - onSignalMessage: peerConnection is not initialized");
2886
2886
  return;
@@ -2896,19 +2896,19 @@ class sr {
2896
2896
  break;
2897
2897
  case W.END_SESSION:
2898
2898
  const a = e.payload;
2899
- this.publicEventEmitter.emit(R.CONNECTION_CLOSED, pe.SERVER_CLOSED_CONNECTION, a), this.shutdown();
2899
+ this.publicEventEmitter.emit(N.CONNECTION_CLOSED, pe.SERVER_CLOSED_CONNECTION, a), this.shutdown();
2900
2900
  break;
2901
2901
  case W.WARNING:
2902
2902
  const c = e.payload;
2903
- console.warn("Warning received from server: " + c), this.publicEventEmitter.emit(R.SERVER_WARNING, c);
2903
+ console.warn("Warning received from server: " + c), this.publicEventEmitter.emit(N.SERVER_WARNING, c);
2904
2904
  break;
2905
2905
  case W.TALK_STREAM_INTERRUPTED:
2906
2906
  const l = e.payload;
2907
- this.publicEventEmitter.emit(R.TALK_STREAM_INTERRUPTED, l.correlationId);
2907
+ this.publicEventEmitter.emit(N.TALK_STREAM_INTERRUPTED, l.correlationId);
2908
2908
  break;
2909
2909
  case W.SESSION_READY:
2910
- const E = e.sessionId;
2911
- this.publicEventEmitter.emit(R.SESSION_READY, E);
2910
+ const m = e.sessionId;
2911
+ this.publicEventEmitter.emit(N.SESSION_READY, m);
2912
2912
  break;
2913
2913
  case W.HEARTBEAT:
2914
2914
  break;
@@ -2918,7 +2918,7 @@ class sr {
2918
2918
  });
2919
2919
  }
2920
2920
  onSignallingClientConnected() {
2921
- return K(this, void 0, void 0, function* () {
2921
+ return J(this, void 0, void 0, function* () {
2922
2922
  if (!this.peerConnection)
2923
2923
  try {
2924
2924
  yield this.initPeerConnectionAndSendOffer();
@@ -2943,14 +2943,14 @@ class sr {
2943
2943
  }
2944
2944
  onIceConnectionStateChange() {
2945
2945
  var e, n;
2946
- (((e = this.peerConnection) === null || e === void 0 ? void 0 : e.iceConnectionState) === "connected" || ((n = this.peerConnection) === null || n === void 0 ? void 0 : n.iceConnectionState) === "completed") && (this.publicEventEmitter.emit(R.CONNECTION_ESTABLISHED), this.startStatsCollection());
2946
+ (((e = this.peerConnection) === null || e === void 0 ? void 0 : e.iceConnectionState) === "connected" || ((n = this.peerConnection) === null || n === void 0 ? void 0 : n.iceConnectionState) === "completed") && (this.publicEventEmitter.emit(N.CONNECTION_ESTABLISHED), this.startStatsCollection());
2947
2947
  }
2948
2948
  onConnectionStateChange() {
2949
2949
  var e;
2950
2950
  ((e = this.peerConnection) === null || e === void 0 ? void 0 : e.connectionState) === "closed" && (console.error("StreamingClient - onConnectionStateChange: Connection closed"), this.handleWebrtcFailure("The connection to our servers was lost. Please try again."));
2951
2951
  }
2952
2952
  handleWebrtcFailure(e) {
2953
- console.error({ message: "StreamingClient - handleWebrtcFailure: ", err: e }), e.name === "NotAllowedError" && e.message === "Permission denied" ? this.publicEventEmitter.emit(R.CONNECTION_CLOSED, pe.MICROPHONE_PERMISSION_DENIED) : this.publicEventEmitter.emit(R.CONNECTION_CLOSED, pe.WEBRTC_FAILURE);
2953
+ console.error({ message: "StreamingClient - handleWebrtcFailure: ", err: e }), e.name === "NotAllowedError" && e.message === "Permission denied" ? this.publicEventEmitter.emit(N.CONNECTION_CLOSED, pe.MICROPHONE_PERMISSION_DENIED) : this.publicEventEmitter.emit(N.CONNECTION_CLOSED, pe.WEBRTC_FAILURE);
2954
2954
  try {
2955
2955
  this.stopConnection();
2956
2956
  } catch (n) {
@@ -2959,20 +2959,20 @@ class sr {
2959
2959
  }
2960
2960
  onTrackEventHandler(e) {
2961
2961
  if (e.track.kind === "video") {
2962
- if (this.startSuccessMetricPolling(), this.videoStream = e.streams[0], this.publicEventEmitter.emit(R.VIDEO_STREAM_STARTED, this.videoStream), this.videoElement) {
2962
+ if (this.startSuccessMetricPolling(), this.videoStream = e.streams[0], this.publicEventEmitter.emit(N.VIDEO_STREAM_STARTED, this.videoStream), this.videoElement) {
2963
2963
  this.videoElement.srcObject = this.videoStream;
2964
2964
  const n = this.videoElement.requestVideoFrameCallback(() => {
2965
2965
  var o;
2966
- (o = this.videoElement) === null || o === void 0 || o.cancelVideoFrameCallback(n), this.publicEventEmitter.emit(R.VIDEO_PLAY_STARTED), this.successMetricFired || (this.successMetricFired = !0, me(oe.CLIENT_METRIC_MEASUREMENT_SESSION_SUCCESS, "1", { detectionMethod: "videoElement" }));
2966
+ (o = this.videoElement) === null || o === void 0 || o.cancelVideoFrameCallback(n), this.publicEventEmitter.emit(N.VIDEO_PLAY_STARTED), this.successMetricFired || (this.successMetricFired = !0, me(se.CLIENT_METRIC_MEASUREMENT_SESSION_SUCCESS, "1", { detectionMethod: "videoElement" }));
2967
2967
  });
2968
2968
  }
2969
- } else e.track.kind === "audio" && (this.audioStream = e.streams[0], this.publicEventEmitter.emit(R.AUDIO_STREAM_STARTED, this.audioStream));
2969
+ } else e.track.kind === "audio" && (this.audioStream = e.streams[0], this.publicEventEmitter.emit(N.AUDIO_STREAM_STARTED, this.audioStream));
2970
2970
  }
2971
2971
  /**
2972
2972
  * Set up the data channels for sending and receiving messages
2973
2973
  */
2974
2974
  setupDataChannels() {
2975
- return K(this, void 0, void 0, function* () {
2975
+ return J(this, void 0, void 0, function* () {
2976
2976
  if (!this.peerConnection) {
2977
2977
  console.error("StreamingClient - setupDataChannels: peer connection is not initialized");
2978
2978
  return;
@@ -2990,16 +2990,16 @@ class sr {
2990
2990
  const o = JSON.parse(n.data);
2991
2991
  switch (o.messageType) {
2992
2992
  case De.SPEECH_TEXT:
2993
- this.internalEventEmitter.emit(J.WEBRTC_CHAT_MESSAGE_RECEIVED, o.data);
2993
+ this.internalEventEmitter.emit(X.WEBRTC_CHAT_MESSAGE_RECEIVED, o.data);
2994
2994
  break;
2995
2995
  case De.CLIENT_TOOL_EVENT:
2996
2996
  const u = o.data;
2997
- this.internalEventEmitter.emit(J.WEBRTC_CLIENT_TOOL_EVENT_RECEIVED, u);
2997
+ this.internalEventEmitter.emit(X.WEBRTC_CLIENT_TOOL_EVENT_RECEIVED, u);
2998
2998
  const a = ar.WebRTCClientToolEventToClientToolEvent(u);
2999
- this.publicEventEmitter.emit(R.CLIENT_TOOL_EVENT_RECEIVED, a);
2999
+ this.publicEventEmitter.emit(N.CLIENT_TOOL_EVENT_RECEIVED, a);
3000
3000
  break;
3001
3001
  case De.REASONING_TEXT:
3002
- this.internalEventEmitter.emit(J.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED, o.data);
3002
+ this.internalEventEmitter.emit(X.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED, o.data);
3003
3003
  break;
3004
3004
  // Unknown message types are silently ignored to maintain forward compatibility
3005
3005
  default:
@@ -3015,9 +3015,9 @@ class sr {
3015
3015
  * Request microphone permission asynchronously without blocking connection
3016
3016
  */
3017
3017
  requestMicrophonePermissionAsync() {
3018
- return K(this, void 0, void 0, function* () {
3018
+ return J(this, void 0, void 0, function* () {
3019
3019
  if (this.inputAudioState.permissionState !== he.PENDING) {
3020
- this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: he.PENDING }), this.publicEventEmitter.emit(R.MIC_PERMISSION_PENDING);
3020
+ this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: he.PENDING }), this.publicEventEmitter.emit(N.MIC_PERMISSION_PENDING);
3021
3021
  try {
3022
3022
  const e = {
3023
3023
  echoCancellation: !0
@@ -3026,11 +3026,11 @@ class sr {
3026
3026
  exact: this.audioDeviceId
3027
3027
  }), this.inputAudioStream = yield navigator.mediaDevices.getUserMedia({
3028
3028
  audio: e
3029
- }), this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: he.GRANTED }), this.publicEventEmitter.emit(R.MIC_PERMISSION_GRANTED), yield this.setupAudioTrack();
3029
+ }), this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: he.GRANTED }), this.publicEventEmitter.emit(N.MIC_PERMISSION_GRANTED), yield this.setupAudioTrack();
3030
3030
  } catch (e) {
3031
3031
  console.error("Failed to get microphone permission:", e), this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: he.DENIED });
3032
3032
  const n = e instanceof Error ? e.message : String(e);
3033
- this.publicEventEmitter.emit(R.MIC_PERMISSION_DENIED, n);
3033
+ this.publicEventEmitter.emit(N.MIC_PERMISSION_DENIED, n);
3034
3034
  }
3035
3035
  }
3036
3036
  });
@@ -3039,7 +3039,7 @@ class sr {
3039
3039
  * Set up audio track and add it to the peer connection using replaceTrack
3040
3040
  */
3041
3041
  setupAudioTrack() {
3042
- return K(this, void 0, void 0, function* () {
3042
+ return J(this, void 0, void 0, function* () {
3043
3043
  if (!this.peerConnection || !this.inputAudioStream)
3044
3044
  return;
3045
3045
  if (!this.inputAudioStream.getAudioTracks().length) {
@@ -3059,11 +3059,11 @@ class sr {
3059
3059
  }
3060
3060
  else
3061
3061
  this.peerConnection.addTrack(e, this.inputAudioStream);
3062
- this.publicEventEmitter.emit(R.INPUT_AUDIO_STREAM_STARTED, this.inputAudioStream);
3062
+ this.publicEventEmitter.emit(N.INPUT_AUDIO_STREAM_STARTED, this.inputAudioStream);
3063
3063
  });
3064
3064
  }
3065
3065
  initPeerConnectionAndSendOffer() {
3066
- return K(this, void 0, void 0, function* () {
3066
+ return J(this, void 0, void 0, function* () {
3067
3067
  if (yield this.initPeerConnection(), !this.peerConnection) {
3068
3068
  console.error("StreamingClient - initPeerConnectionAndSendOffer: peer connection is not initialized");
3069
3069
  return;
@@ -3080,7 +3080,7 @@ class sr {
3080
3080
  });
3081
3081
  }
3082
3082
  shutdown() {
3083
- return K(this, void 0, void 0, function* () {
3083
+ return J(this, void 0, void 0, function* () {
3084
3084
  var e;
3085
3085
  if (this.showPeerConnectionStatsReport) {
3086
3086
  const n = yield (e = this.peerConnection) === null || e === void 0 ? void 0 : e.getStats();
@@ -3128,7 +3128,7 @@ class ar {
3128
3128
  }
3129
3129
  class lr {
3130
3130
  constructor(e, n) {
3131
- this.reasoning_messages = [], this.publicEventEmitter = e, this.internalEventEmitter = n, this.internalEventEmitter.addListener(J.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED, this.processWebRtcReasoningTextMessageEvent.bind(this));
3131
+ this.reasoning_messages = [], this.publicEventEmitter = e, this.internalEventEmitter = n, this.internalEventEmitter.addListener(X.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED, this.processWebRtcReasoningTextMessageEvent.bind(this));
3132
3132
  }
3133
3133
  webRtcTextMessageEventToReasoningStreamEvent(e) {
3134
3134
  return {
@@ -3140,7 +3140,7 @@ class lr {
3140
3140
  }
3141
3141
  processWebRtcReasoningTextMessageEvent(e) {
3142
3142
  const n = this.webRtcTextMessageEventToReasoningStreamEvent(e);
3143
- this.publicEventEmitter.emit(R.REASONING_STREAM_EVENT_RECEIVED, n);
3143
+ this.publicEventEmitter.emit(N.REASONING_STREAM_EVENT_RECEIVED, n);
3144
3144
  const o = {
3145
3145
  id: n.id,
3146
3146
  content: n.content,
@@ -3151,7 +3151,7 @@ class lr {
3151
3151
  a.content += o.content, this.reasoning_messages[u] = a;
3152
3152
  } else
3153
3153
  this.reasoning_messages.push(o);
3154
- n.endOfThought && this.publicEventEmitter.emit(R.REASONING_HISTORY_UPDATED, this.reasoning_messages);
3154
+ n.endOfThought && this.publicEventEmitter.emit(N.REASONING_HISTORY_UPDATED, this.reasoning_messages);
3155
3155
  }
3156
3156
  }
3157
3157
  var ce = function(t, e, n, o) {
@@ -3168,7 +3168,7 @@ var ce = function(t, e, n, o) {
3168
3168
  c(d);
3169
3169
  }
3170
3170
  }
3171
- function E(_) {
3171
+ function m(_) {
3172
3172
  try {
3173
3173
  p(o.throw(_));
3174
3174
  } catch (d) {
@@ -3176,22 +3176,22 @@ var ce = function(t, e, n, o) {
3176
3176
  }
3177
3177
  }
3178
3178
  function p(_) {
3179
- _.done ? a(_.value) : u(_.value).then(l, E);
3179
+ _.done ? a(_.value) : u(_.value).then(l, m);
3180
3180
  }
3181
3181
  p((o = o.apply(t, e || [])).next());
3182
3182
  });
3183
3183
  };
3184
3184
  class cr {
3185
3185
  constructor(e, n, o) {
3186
- var u, a, c, l, E;
3186
+ var u, a, c, l, m;
3187
3187
  this.inputAudioState = {
3188
3188
  isMuted: !1,
3189
3189
  permissionState: he.NOT_REQUESTED
3190
3190
  }, this.sessionId = null, this.organizationId = null, this.streamingClient = null, this._isStreaming = !1;
3191
3191
  const p = this.validateClientConfig(e, n, o);
3192
3192
  if (p)
3193
- throw new $(p, j.CLIENT_ERROR_CODE_CONFIGURATION_ERROR, 400);
3194
- this.personaConfig = n, this.clientOptions = o, (!((u = o?.api) === null || u === void 0) && u.baseUrl || !((a = o?.api) === null || a === void 0) && a.apiVersion) && $n(o.api.baseUrl || zi, o.api.apiVersion || xt), !((l = (c = o?.api) === null || c === void 0 ? void 0 : c.apiGateway) === null || l === void 0) && l.enabled && Vn(o.api.apiGateway), !((E = o?.metrics) === null || E === void 0) && E.disableClientMetrics && Gn(!0), this.publicEventEmitter = new tr(), this.internalEventEmitter = new Qn(), this.apiClient = new Jn(e, o?.apiKey, o?.api), this.messageHistoryClient = new er(this.publicEventEmitter, this.internalEventEmitter), this.reasoningHistoryClient = new lr(this.publicEventEmitter, this.internalEventEmitter);
3193
+ throw new V(p, j.CLIENT_ERROR_CODE_CONFIGURATION_ERROR, 400);
3194
+ this.personaConfig = n, this.clientOptions = o, (!((u = o?.api) === null || u === void 0) && u.baseUrl || !((a = o?.api) === null || a === void 0) && a.apiVersion) && $n(o.api.baseUrl || zi, o.api.apiVersion || xt), !((l = (c = o?.api) === null || c === void 0 ? void 0 : c.apiGateway) === null || l === void 0) && l.enabled && Vn(o.api.apiGateway), !((m = o?.metrics) === null || m === void 0) && m.disableClientMetrics && Gn(!0), this.publicEventEmitter = new tr(), this.internalEventEmitter = new Qn(), this.apiClient = new Jn(e, o?.apiKey, o?.api), this.messageHistoryClient = new er(this.publicEventEmitter, this.internalEventEmitter), this.reasoningHistoryClient = new lr(this.publicEventEmitter, this.internalEventEmitter);
3195
3195
  }
3196
3196
  decodeJwt(e) {
3197
3197
  try {
@@ -3215,10 +3215,10 @@ class cr {
3215
3215
  this.organizationId = l.accountId, Se({
3216
3216
  organizationId: this.organizationId
3217
3217
  });
3218
- const E = (a = l.type) === null || a === void 0 ? void 0 : a.toLowerCase();
3219
- if (E === "legacy")
3218
+ const m = (a = l.type) === null || a === void 0 ? void 0 : a.toLowerCase();
3219
+ if (m === "legacy")
3220
3220
  return "Legacy session tokens are no longer supported. Please define your persona when creating your session token. See https://docs.anam.ai/resources/migrating-legacy for more information.";
3221
- if ((E === "ephemeral" || E === "stateful") && n)
3221
+ if ((m === "ephemeral" || m === "stateful") && n)
3222
3222
  return "This session token already contains a persona configuration. Please remove the personaConfig parameter.";
3223
3223
  } else if (!n)
3224
3224
  return "Missing persona config. Persona configuration must be provided when using apiKey";
@@ -3241,27 +3241,27 @@ class cr {
3241
3241
  }
3242
3242
  startSession(e) {
3243
3243
  return ce(this, void 0, void 0, function* () {
3244
- var n, o, u, a, c, l, E, p, _, d, S, g;
3245
- const y = this.personaConfig, C = this.buildStartSessionOptionsForClient(), A = yield this.apiClient.startSession(y, C), { sessionId: I, clientConfig: b, engineHost: N, engineProtocol: D, signallingEndpoint: x } = A, { heartbeatIntervalSeconds: Z, maxWsReconnectionAttempts: V, iceServers: se } = b;
3244
+ var n, o, u, a, c, l, m, p, _, d, S, g;
3245
+ const y = this.personaConfig, C = this.buildStartSessionOptionsForClient(), A = yield this.apiClient.startSession(y, C), { sessionId: I, clientConfig: b, engineHost: R, engineProtocol: M, signallingEndpoint: x } = A, { heartbeatIntervalSeconds: Y, maxWsReconnectionAttempts: ne, iceServers: $ } = b;
3246
3246
  this.sessionId = I, Se({
3247
3247
  sessionId: this.sessionId
3248
3248
  });
3249
- const ne = !((n = this.clientOptions) === null || n === void 0) && n.iceServers ? this.clientOptions.iceServers : se;
3249
+ const re = !((n = this.clientOptions) === null || n === void 0) && n.iceServers ? this.clientOptions.iceServers : $;
3250
3250
  try {
3251
3251
  this.streamingClient = new sr(I, {
3252
3252
  engine: {
3253
- baseUrl: `${D}://${N}`
3253
+ baseUrl: `${M}://${R}`
3254
3254
  },
3255
3255
  signalling: {
3256
- heartbeatIntervalSeconds: Z,
3257
- maxWsReconnectionAttempts: V,
3256
+ heartbeatIntervalSeconds: Y,
3257
+ maxWsReconnectionAttempts: ne,
3258
3258
  url: {
3259
- baseUrl: N,
3260
- protocol: D,
3259
+ baseUrl: R,
3260
+ protocol: M,
3261
3261
  signallingPath: x
3262
3262
  }
3263
3263
  },
3264
- iceServers: ne,
3264
+ iceServers: re,
3265
3265
  inputAudio: {
3266
3266
  inputAudioState: this.inputAudioState,
3267
3267
  userProvidedMediaStream: !((o = this.clientOptions) === null || o === void 0) && o.disableInputAudio ? void 0 : e,
@@ -3270,15 +3270,15 @@ class cr {
3270
3270
  },
3271
3271
  apiGateway: (l = (c = this.clientOptions) === null || c === void 0 ? void 0 : c.api) === null || l === void 0 ? void 0 : l.apiGateway,
3272
3272
  metrics: {
3273
- showPeerConnectionStatsReport: (_ = (p = (E = this.clientOptions) === null || E === void 0 ? void 0 : E.metrics) === null || p === void 0 ? void 0 : p.showPeerConnectionStatsReport) !== null && _ !== void 0 ? _ : !1,
3273
+ showPeerConnectionStatsReport: (_ = (p = (m = this.clientOptions) === null || m === void 0 ? void 0 : m.metrics) === null || p === void 0 ? void 0 : p.showPeerConnectionStatsReport) !== null && _ !== void 0 ? _ : !1,
3274
3274
  peerConnectionStatsReportOutputFormat: (g = (S = (d = this.clientOptions) === null || d === void 0 ? void 0 : d.metrics) === null || S === void 0 ? void 0 : S.peerConnectionStatsReportOutputFormat) !== null && g !== void 0 ? g : "console"
3275
3275
  }
3276
3276
  }, this.publicEventEmitter, this.internalEventEmitter);
3277
- } catch (re) {
3277
+ } catch (oe) {
3278
3278
  throw Se({
3279
3279
  sessionId: null
3280
- }), new $("Failed to initialize streaming client", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
3281
- cause: re instanceof Error ? re.message : String(re),
3280
+ }), new V("Failed to initialize streaming client", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
3281
+ cause: oe instanceof Error ? oe.message : String(oe),
3282
3282
  sessionId: I
3283
3283
  });
3284
3284
  }
@@ -3288,7 +3288,7 @@ class cr {
3288
3288
  startSessionIfNeeded(e) {
3289
3289
  return ce(this, void 0, void 0, function* () {
3290
3290
  if ((!this.sessionId || !this.streamingClient) && (yield this.startSession(e), !this.sessionId || !this.streamingClient))
3291
- throw new $("Session ID or streaming client is not available after starting session", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
3291
+ throw new V("Session ID or streaming client is not available after starting session", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
3292
3292
  cause: "Failed to initialize session properly"
3293
3293
  });
3294
3294
  });
@@ -3303,14 +3303,14 @@ class cr {
3303
3303
  attemptCorrelationId: o,
3304
3304
  sessionId: null
3305
3305
  // reset sessionId
3306
- }), me(oe.CLIENT_METRIC_MEASUREMENT_SESSION_ATTEMPT, "1"), !((n = this.clientOptions) === null || n === void 0) && n.disableInputAudio && e && console.warn("AnamClient:Input audio is disabled. User provided audio stream will be ignored."), yield this.startSessionIfNeeded(e), this._isStreaming = !0, new Promise((u) => {
3306
+ }), me(se.CLIENT_METRIC_MEASUREMENT_SESSION_ATTEMPT, "1"), !((n = this.clientOptions) === null || n === void 0) && n.disableInputAudio && e && console.warn("AnamClient:Input audio is disabled. User provided audio stream will be ignored."), yield this.startSessionIfNeeded(e), this._isStreaming = !0, new Promise((u) => {
3307
3307
  var a;
3308
3308
  const c = [];
3309
- let l = !1, E = !1;
3310
- this.publicEventEmitter.addListener(R.VIDEO_STREAM_STARTED, (p) => {
3311
- c.push(p), l = !0, E && u(c);
3312
- }), this.publicEventEmitter.addListener(R.AUDIO_STREAM_STARTED, (p) => {
3313
- c.push(p), E = !0, l && u(c);
3309
+ let l = !1, m = !1;
3310
+ this.publicEventEmitter.addListener(N.VIDEO_STREAM_STARTED, (p) => {
3311
+ c.push(p), l = !0, m && u(c);
3312
+ }), this.publicEventEmitter.addListener(N.AUDIO_STREAM_STARTED, (p) => {
3313
+ c.push(p), m = !0, l && u(c);
3314
3314
  }), (a = this.streamingClient) === null || a === void 0 || a.startConnection();
3315
3315
  });
3316
3316
  });
@@ -3331,11 +3331,11 @@ class cr {
3331
3331
  attemptCorrelationId: u,
3332
3332
  sessionId: null
3333
3333
  // reset sessionId
3334
- }), me(oe.CLIENT_METRIC_MEASUREMENT_SESSION_ATTEMPT, "1"), !((o = this.clientOptions) === null || o === void 0) && o.disableInputAudio && n && console.warn("AnamClient:Input audio is disabled. User provided audio stream will be ignored.");
3334
+ }), me(se.CLIENT_METRIC_MEASUREMENT_SESSION_ATTEMPT, "1"), !((o = this.clientOptions) === null || o === void 0) && o.disableInputAudio && n && console.warn("AnamClient:Input audio is disabled. User provided audio stream will be ignored.");
3335
3335
  try {
3336
3336
  yield this.startSessionIfNeeded(n);
3337
3337
  } catch (a) {
3338
- throw a instanceof $ ? a : new $("Failed to start session", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
3338
+ throw a instanceof V ? a : new V("Failed to start session", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
3339
3339
  cause: a instanceof Error ? a.message : String(a),
3340
3340
  sessionId: this.sessionId
3341
3341
  });
@@ -3407,7 +3407,7 @@ class cr {
3407
3407
  }
3408
3408
  stopStreaming() {
3409
3409
  return ce(this, void 0, void 0, function* () {
3410
- this.streamingClient && (this.publicEventEmitter.emit(R.CONNECTION_CLOSED, pe.NORMAL), yield this.streamingClient.stopConnection(), this.streamingClient = null, this.sessionId = null, Se({
3410
+ this.streamingClient && (this.publicEventEmitter.emit(N.CONNECTION_CLOSED, pe.NORMAL), yield this.streamingClient.stopConnection(), this.streamingClient = null, this.sessionId = null, Se({
3411
3411
  attemptCorrelationId: null,
3412
3412
  sessionId: null,
3413
3413
  organizationId: this.organizationId
@@ -3481,7 +3481,7 @@ function hr(t) {
3481
3481
  return {};
3482
3482
  }
3483
3483
  }
3484
- const X = q(null), te = q("idle"), Be = q(!1), Ye = q(!1), ot = q([]), Pe = q(null), et = q(null), Ot = q(null), kt = q(null), Dt = q(null), Mt = q(null), di = q(!1), tt = q(!1);
3484
+ const Z = q(null), te = q("idle"), Be = q(!1), Ye = q(!1), ot = q([]), Pe = q(null), et = q(null), Ot = q(null), kt = q(null), Dt = q(null), Mt = q(null), di = q(!1), tt = q(!1);
3485
3485
  function fr(t, e) {
3486
3486
  return e === 401 || e === 403 ? "This agent is not authorized. Check your agent ID." : e === 404 ? "Agent not found. Check your agent ID." : e === 429 ? "Too many requests. Please wait a moment." : e && e >= 500 ? "Server error. Please try again later." : t instanceof TypeError && t.message === "Failed to fetch" ? "Unable to connect. Check your network connection." : t instanceof Error && t.message.length < 80 ? t.message : "Something went wrong. Please try again.";
3487
3487
  }
@@ -3508,16 +3508,16 @@ async function _r(t, e, n, o) {
3508
3508
  console.log("[AnamWidget] Using pre-created session token"), a = o;
3509
3509
  else {
3510
3510
  console.log("[AnamWidget] Fetching session for agent:", t);
3511
- const E = await fetch(`${e}/v1/auth/widget`, {
3511
+ const m = await fetch(`${e}/v1/auth/widget`, {
3512
3512
  method: "POST",
3513
3513
  headers: { "Content-Type": "application/json" },
3514
3514
  body: JSON.stringify({ agentId: t })
3515
3515
  });
3516
- if (u = E.status, !E.ok) {
3517
- const _ = await E.json().catch(() => ({}));
3518
- throw new Error(_.error || `HTTP ${E.status}`);
3516
+ if (u = m.status, !m.ok) {
3517
+ const _ = await m.json().catch(() => ({}));
3518
+ throw new Error(_.error || `HTTP ${m.status}`);
3519
3519
  }
3520
- const p = await E.json();
3520
+ const p = await m.json();
3521
3521
  console.log("[AnamWidget] Got session from agent-id:", {
3522
3522
  hasToken: !!p.sessionToken
3523
3523
  }), a = p.sessionToken;
@@ -3526,45 +3526,45 @@ async function _r(t, e, n, o) {
3526
3526
  api: e ? { baseUrl: e } : void 0,
3527
3527
  metrics: { disableClientMetrics: !0 }
3528
3528
  });
3529
- c.addListener(R.CONNECTION_ESTABLISHED, () => {
3529
+ c.addListener(N.CONNECTION_ESTABLISHED, () => {
3530
3530
  console.log("[AnamWidget] Connection established"), te.value = "connected";
3531
- }), c.addListener(R.VIDEO_STREAM_STARTED, () => {
3531
+ }), c.addListener(N.VIDEO_STREAM_STARTED, () => {
3532
3532
  console.log("[AnamWidget] Video stream started"), Be.value = !0;
3533
- }), c.addListener(R.AUDIO_STREAM_STARTED, () => {
3533
+ }), c.addListener(N.AUDIO_STREAM_STARTED, () => {
3534
3534
  console.log("[AnamWidget] Audio stream started");
3535
- }), c.addListener(R.MESSAGE_HISTORY_UPDATED, (E) => {
3536
- ot.value = [...E];
3537
- }), c.addListener(R.CONNECTION_CLOSED, (E, p) => {
3538
- console.log("[AnamWidget] Connection closed:", E, p), te.value = "idle", Be.value = !1, et.value = null;
3539
- }), c.addListener(R.SESSION_READY, (E) => {
3540
- console.log("[AnamWidget] Session ready:", E), et.value = E;
3541
- }), X.value = c;
3535
+ }), c.addListener(N.MESSAGE_HISTORY_UPDATED, (m) => {
3536
+ ot.value = [...m];
3537
+ }), c.addListener(N.CONNECTION_CLOSED, (m, p) => {
3538
+ console.log("[AnamWidget] Connection closed:", m, p), te.value = "idle", Be.value = !1, et.value = null;
3539
+ }), c.addListener(N.SESSION_READY, (m) => {
3540
+ console.log("[AnamWidget] Session ready:", m), et.value = m;
3541
+ }), Z.value = c;
3542
3542
  const l = await c.stream();
3543
3543
  if (n && l.length > 0) {
3544
- const E = l.find((p) => p.getVideoTracks().length > 0);
3545
- E && (n.srcObject = E);
3544
+ const m = l.find((p) => p.getVideoTracks().length > 0);
3545
+ m && (n.srcObject = m);
3546
3546
  }
3547
3547
  } catch (a) {
3548
- console.error("[AnamWidget] Failed to start session:", a), Pe.value = fr(a, u), te.value = "error", X.value = null;
3548
+ console.error("[AnamWidget] Failed to start session:", a), Pe.value = fr(a, u), te.value = "error", Z.value = null;
3549
3549
  }
3550
3550
  }
3551
3551
  async function Er() {
3552
- if (X.value)
3552
+ if (Z.value)
3553
3553
  try {
3554
- await X.value.stopStreaming();
3554
+ await Z.value.stopStreaming();
3555
3555
  } catch (t) {
3556
3556
  console.error("[AnamWidget] Failed to stop session:", t);
3557
3557
  }
3558
- X.value = null, te.value = "idle", Be.value = !1, ot.value = [];
3558
+ Z.value = null, te.value = "idle", Be.value = !1, ot.value = [];
3559
3559
  }
3560
3560
  function mr(t) {
3561
- !X.value || te.value !== "connected" || X.value.sendUserMessage(t);
3561
+ !Z.value || te.value !== "connected" || Z.value.sendUserMessage(t);
3562
3562
  }
3563
3563
  function gr() {
3564
- X.value && (Ye.value ? (X.value.unmuteInputAudio(), Ye.value = !1) : (X.value.muteInputAudio(), Ye.value = !0));
3564
+ Z.value && (Ye.value ? (Z.value.unmuteInputAudio(), Ye.value = !1) : (Z.value.muteInputAudio(), Ye.value = !0));
3565
3565
  }
3566
3566
  function vr() {
3567
- X.value?.isStreaming() && X.value.stopStreaming(), X.value = null, te.value = "idle", Be.value = !1, ot.value = [], Pe.value = null, et.value = null, Ot.value = null, kt.value = null, Dt.value = null, Mt.value = null;
3567
+ Z.value?.isStreaming() && Z.value.stopStreaming(), Z.value = null, te.value = "idle", Be.value = !1, ot.value = [], Pe.value = null, et.value = null, Ot.value = null, kt.value = null, Dt.value = null, Mt.value = null;
3568
3568
  }
3569
3569
  function yr(t, e, n) {
3570
3570
  const o = t || (n ? hr(n).personaId : void 0);
@@ -3643,27 +3643,28 @@ function Tr({
3643
3643
  avatarSrc: o,
3644
3644
  avatarVideoSrc: u,
3645
3645
  displayCta: a,
3646
- onCollapse: c
3646
+ onCollapse: c,
3647
+ onStop: l
3647
3648
  }) {
3648
- const l = gt(null), [E, p] = ze(""), [_, d] = ze(null), [S, g] = ze(!1), y = gt(null), C = e.connectionStatus.value === "connected", A = e.connectionStatus.value === "connecting", I = e.connectionStatus.value === "error", b = e.isStreaming.value, N = !A && !C && !I, D = je(async () => {
3649
+ const m = gt(null), [p, _] = ze(""), [d, S] = ze(null), [g, y] = ze(!1), C = gt(null), A = e.connectionStatus.value === "connected", I = e.connectionStatus.value === "connecting", b = e.connectionStatus.value === "error", R = e.isStreaming.value, M = !I && !A && !b, x = je(async () => {
3649
3650
  n.current && await e.startSession(n.current);
3650
3651
  }, [e.startSession]);
3651
3652
  je(async () => {
3652
3653
  await e.stopSession();
3653
3654
  }, [e.stopSession]);
3654
- const x = je(() => {
3655
- if (!E.trim()) return;
3656
- const V = E.trim();
3657
- e.sendMessage(V), p(""), l.current?.focus(), y.current && clearTimeout(y.current), g(!1), d(V), y.current = window.setTimeout(() => {
3658
- g(!0), y.current = window.setTimeout(() => {
3659
- d(null), g(!1);
3655
+ const Y = je(() => {
3656
+ if (!p.trim()) return;
3657
+ const $ = p.trim();
3658
+ e.sendMessage($), _(""), m.current?.focus(), C.current && clearTimeout(C.current), y(!1), S($), C.current = window.setTimeout(() => {
3659
+ y(!0), C.current = window.setTimeout(() => {
3660
+ S(null), y(!1);
3660
3661
  }, 400);
3661
3662
  }, 2600);
3662
- }, [E]), Z = je((V) => {
3663
- V.key === "Enter" && !V.shiftKey && (V.preventDefault(), x());
3664
- }, [x]);
3663
+ }, [p]), ne = je(($) => {
3664
+ $.key === "Enter" && !$.shiftKey && ($.preventDefault(), Y());
3665
+ }, [Y]);
3665
3666
  return mt(() => () => {
3666
- y.current && clearTimeout(y.current);
3667
+ C.current && clearTimeout(C.current);
3667
3668
  }, []), /* @__PURE__ */ w("div", { class: "anam-sheet", children: [
3668
3669
  /* @__PURE__ */ w(
3669
3670
  "video",
@@ -3672,10 +3673,10 @@ function Tr({
3672
3673
  class: "anam-video",
3673
3674
  autoplay: !0,
3674
3675
  playsinline: !0,
3675
- "data-hidden": b ? void 0 : "true"
3676
+ "data-hidden": R ? void 0 : "true"
3676
3677
  }
3677
3678
  ),
3678
- N && (e.isConfigured.value ? (
3679
+ M && (e.isConfigured.value ? (
3679
3680
  /* Has agent-id: show avatar or placeholder + CTA pill */
3680
3681
  /* @__PURE__ */ w("div", { class: "anam-overlay-idle", children: [
3681
3682
  u ? /* @__PURE__ */ w(
@@ -3687,8 +3688,8 @@ function Tr({
3687
3688
  muted: !0,
3688
3689
  playsinline: !0,
3689
3690
  class: "anam-preview-video",
3690
- onError: (V) => {
3691
- V.target.style.display = "none";
3691
+ onError: ($) => {
3692
+ $.target.style.display = "none";
3692
3693
  }
3693
3694
  }
3694
3695
  ) : null,
@@ -3700,7 +3701,7 @@ function Tr({
3700
3701
  class: u ? "anam-preview-fallback" : void 0
3701
3702
  }
3702
3703
  ) : /* @__PURE__ */ w(Ct, {}),
3703
- /* @__PURE__ */ w("button", { class: "anam-cta-pill", onClick: D, children: [
3704
+ /* @__PURE__ */ w("button", { class: "anam-cta-pill", onClick: x, children: [
3704
3705
  /* @__PURE__ */ w(Cr, {}),
3705
3706
  a
3706
3707
  ] })
@@ -3712,25 +3713,25 @@ function Tr({
3712
3713
  /* @__PURE__ */ w("span", { children: "Agent not configured" })
3713
3714
  ] })
3714
3715
  )),
3715
- A && /* @__PURE__ */ w("div", { class: "anam-overlay-loading", children: [
3716
+ I && /* @__PURE__ */ w("div", { class: "anam-overlay-loading", children: [
3716
3717
  /* @__PURE__ */ w("span", { class: "anam-spinner" }),
3717
3718
  /* @__PURE__ */ w("span", { children: "Starting your conversation..." })
3718
3719
  ] }),
3719
- I && /* @__PURE__ */ w("div", { class: "anam-overlay-error", children: [
3720
+ b && /* @__PURE__ */ w("div", { class: "anam-overlay-error", children: [
3720
3721
  /* @__PURE__ */ w("div", { class: "anam-overlay-error-text", children: e.error.value || "Something went wrong" }),
3721
- /* @__PURE__ */ w("button", { class: "anam-retry-btn", onClick: D, children: "Try Again" })
3722
+ /* @__PURE__ */ w("button", { class: "anam-retry-btn", onClick: x, children: "Try Again" })
3722
3723
  ] }),
3723
- c && /* @__PURE__ */ w(
3724
+ (c || l && (A || I || R)) && /* @__PURE__ */ w(
3724
3725
  "button",
3725
3726
  {
3726
3727
  class: "anam-close-btn",
3727
- onClick: c,
3728
- "aria-label": "Close",
3728
+ onClick: c || l,
3729
+ "aria-label": c ? "Close" : "End call",
3729
3730
  children: /* @__PURE__ */ w(wr, {})
3730
3731
  }
3731
3732
  ),
3732
- (C || b) && /* @__PURE__ */ w(_e, { children: [
3733
- _ && /* @__PURE__ */ w("div", { class: `anam-toast ${S ? "anam-toast-out" : ""}`, children: _ }),
3733
+ (A || R) && /* @__PURE__ */ w(_e, { children: [
3734
+ d && /* @__PURE__ */ w("div", { class: `anam-toast ${g ? "anam-toast-out" : ""}`, children: d }),
3734
3735
  /* @__PURE__ */ w("div", { class: "anam-control-bar", children: [
3735
3736
  t.showMuteButton && /* @__PURE__ */ w(
3736
3737
  "button",
@@ -3745,22 +3746,22 @@ function Tr({
3745
3746
  /* @__PURE__ */ w(
3746
3747
  "input",
3747
3748
  {
3748
- ref: l,
3749
+ ref: m,
3749
3750
  type: "text",
3750
3751
  class: "anam-ctl-input",
3751
3752
  placeholder: "Type a message...",
3752
- value: E,
3753
- onInput: (V) => p(V.target.value),
3754
- onKeyDown: Z,
3755
- disabled: !C
3753
+ value: p,
3754
+ onInput: ($) => _($.target.value),
3755
+ onKeyDown: ne,
3756
+ disabled: !A
3756
3757
  }
3757
3758
  ),
3758
3759
  /* @__PURE__ */ w(
3759
3760
  "button",
3760
3761
  {
3761
3762
  class: "anam-ctl-send",
3762
- onClick: x,
3763
- disabled: !C || !E.trim(),
3763
+ onClick: Y,
3764
+ disabled: !A || !p.trim(),
3764
3765
  "aria-label": "Send message",
3765
3766
  children: /* @__PURE__ */ w(Ar, {})
3766
3767
  }
@@ -3802,10 +3803,10 @@ function Rr(t) {
3802
3803
  }, [a.layout, a.initialState]), mt(() => {
3803
3804
  o.fetchWidgetConfig();
3804
3805
  }, [n, t["api-base-url"], t["session-token"]]);
3805
- const l = t["avatar-url"] || o.avatarThumbnailUrl.value || null, E = o.avatarVideoUrl.value || null, _ = t["agent-name"] || o.personaName.value, d = a.callToAction === oi.callToAction && _ ? `Talk to ${_}` : a.callToAction, S = Ie(() => {
3806
+ const l = t["avatar-url"] || o.avatarThumbnailUrl.value || null, m = t["avatar-video-url"] || o.avatarVideoUrl.value || null, _ = t["agent-name"] || o.personaName.value, d = a.callToAction === oi.callToAction && _ ? `Talk to ${_}` : a.callToAction, S = Ie(() => {
3806
3807
  if (a.layout === "inline") return "";
3807
3808
  const I = kn(a.position);
3808
- return Object.entries(I).map(([b, N]) => `${b}: ${N}`).join("; ");
3809
+ return Object.entries(I).map(([b, R]) => `${b}: ${R}`).join("; ");
3809
3810
  }, [a.layout, a.position]), g = a.layout === "floating", y = () => {
3810
3811
  c.value = "expanded";
3811
3812
  }, C = async () => {
@@ -3837,9 +3838,10 @@ function Rr(t) {
3837
3838
  session: o,
3838
3839
  videoRef: e,
3839
3840
  avatarSrc: l,
3840
- avatarVideoSrc: E,
3841
+ avatarVideoSrc: m,
3841
3842
  displayCta: d,
3842
- onCollapse: g ? C : null
3843
+ onCollapse: g ? C : null,
3844
+ onStop: g ? null : () => o.stopSession()
3843
3845
  }
3844
3846
  )
3845
3847
  ]
@@ -3870,6 +3872,8 @@ const Nr = [
3870
3872
  // Custom CTA text for the start button
3871
3873
  "avatar-url",
3872
3874
  // Override avatar thumbnail (Lab preview)
3875
+ "avatar-video-url",
3876
+ // Override avatar preview video (Lab preview)
3873
3877
  "agent-name"
3874
3878
  // Override persona name for CTA (Lab preview)
3875
3879
  ], Or = {