@anam-ai/agent-widget 0.8.0 → 0.8.1-alpha.1

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