@anam-ai/agent-widget 0.1.0-alpha.1 → 0.1.0-alpha.10

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