@anam-ai/agent-widget 0.1.0-alpha.4 → 0.1.0-alpha.6

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,9 +1,9 @@
1
- var $e, k, hi, fi, Ee, Ht, pi, _i, Ei, At, mt, gt, Ue = {}, mi = [], an = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, rt = Array.isArray;
1
+ var $e, D, hi, fi, Ee, Ht, pi, _i, Ei, It, _t, Et, Ue = {}, mi = [], an = /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
9
  function Ce(t, e, n) {
@@ -14,7 +14,7 @@ function Ce(t, e, n) {
14
14
  }
15
15
  function xe(t, e, n, o, c) {
16
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;
17
+ return c == null && D.vnode != null && D.vnode(a), a;
18
18
  }
19
19
  function oe(t) {
20
20
  return t.children;
@@ -38,20 +38,20 @@ function gi(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) && !Xe.__r++ || Ht != D.debounceRendering) && ((Ht = D.debounceRendering) || pi)(Xe);
42
42
  }
43
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)));
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, D.vnode && D.vnode(n), At(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
45
  Xe.__r = 0;
46
46
  }
47
- function vi(t, e, n, o, c, a, u, l, g, p, _) {
48
- var d, S, m, y, A, b, w, I = o && o.__k || mi, R = e.length;
49
- for (g = ln(n, e, I, g, R), d = 0; d < R; d++) (m = n.__k[d]) != null && (S = m.__i == -1 ? Ue : I[m.__i] || Ue, m.__i = d, b = Rt(t, m, S, c, a, u, l, g, p, _), y = m.__e, m.ref && S.ref != m.ref && (S.ref && Nt(S.ref, null, m), _.push(m.ref, m.__c || y, m)), A == null && y != null && (A = y), (w = !!(4 & m.__u)) || S.__k === m.__k ? g = yi(m, g, t, w) : typeof m.type == "function" && b !== void 0 ? g = b : y && (g = y.nextSibling), m.__u &= -7);
50
- return n.__e = A, g;
47
+ function vi(t, e, n, o, c, a, u, l, m, p, _) {
48
+ var d, S, g, y, I, A, w, b = o && o.__k || mi, T = e.length;
49
+ for (m = ln(n, e, b, m, T), d = 0; d < T; d++) (g = n.__k[d]) != null && (S = g.__i == -1 ? Ue : b[g.__i] || Ue, g.__i = d, A = At(t, g, S, c, a, u, 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)), I == null && y != null && (I = y), (w = !!(4 & g.__u)) || S.__k === g.__k ? m = yi(g, m, t, w) : typeof g.type == "function" && A !== void 0 ? m = A : y && (m = y.nextSibling), g.__u &= -7);
50
+ return n.__e = I, m;
51
51
  }
52
52
  function ln(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] = xe(null, u, null, null, null) : rt(u) ? u = t.__k[a] = xe(oe, { children: u }, null, null, null) : u.constructor === void 0 && u.__b > 0 ? u = t.__k[a] = xe(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 = cn(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;
53
+ var a, u, l, m, 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] = xe(null, u, null, null, null) : rt(u) ? u = t.__k[a] = xe(oe, { children: u }, null, null, null) : u.constructor === void 0 && u.__b > 0 ? u = t.__k[a] = xe(u.type, u.props, u.key, u.ref ? u.ref : null, u.__v) : t.__k[a] = u, m = a + S, u.__ = t, u.__b = t.__b + 1, l = null, (p = u.__i = cn(u, n, m, 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 != m && (p == m - 1 ? S-- : p == m + 1 ? S++ : (p > m ? S-- : S++, u.__u |= 4))) : t.__k[a] = null;
55
55
  if (d) for (a = 0; a < _; a++) (l = n[a]) != null && (2 & l.__u) == 0 && (l.__e == o && (o = be(l)), Ci(l, l));
56
56
  return o;
57
57
  }
@@ -68,10 +68,10 @@ function yi(t, e, n, o) {
68
68
  return e;
69
69
  }
70
70
  function cn(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 c, a, u, 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 (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 && m == p.type) return u;
75
75
  }
76
76
  return -1;
77
77
  }
@@ -85,7 +85,7 @@ function je(t, e, n, o, c) {
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 ? gt : mt, a)) : t.removeEventListener(e, a ? gt : mt, a);
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 = It, t.addEventListener(e, a ? Et : _t, a)) : t.removeEventListener(e, a ? Et : _t, a);
89
89
  else {
90
90
  if (c == "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 {
@@ -100,127 +100,127 @@ 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, b, w, I, R, U, x, Z, H, ae, ne, re, Q = e.type;
109
+ function At(t, e, n, o, c, a, u, l, m, p) {
110
+ var _, d, S, g, y, I, A, w, b, T, O, x, Z, H, 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 (w = e.props, I = "prototype" in Q && Q.prototype.render, R = (_ = Q.contextType) && o[_.__c], U = _ ? R ? R.props.value : _.__ : o, n.__c ? b = (d = e.__c = n.__c).__ = d.__E : (I ? e.__c = d = new Q(w, U) : (e.__c = d = new Oe(w, U), d.constructor = Q, d.render = dn), R && R.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(w, d.__s))), m = 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);
114
+ if (w = e.props, b = "prototype" in Q && Q.prototype.render, T = (_ = Q.contextType) && o[_.__c], O = _ ? T ? T.props.value : _.__ : o, n.__c ? A = (d = e.__c = n.__c).__ = d.__E : (b ? e.__c = d = new Q(w, O) : (e.__c = d = new Oe(w, O), d.constructor = Q, d.render = dn), T && T.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(w, d.__s))), g = d.props, y = d.state, d.__v = e, S) b && Q.getDerivedStateFromProps == null && d.componentWillMount != null && d.componentWillMount(), b && d.componentDidMount != null && d.__h.push(d.componentDidMount);
115
115
  else {
116
- if (I && Q.getDerivedStateFromProps == null && w !== m && d.componentWillReceiveProps != null && d.componentWillReceiveProps(w, U), e.__v == n.__v || !d.__e && d.shouldComponentUpdate != null && d.shouldComponentUpdate(w, d.__s, U) === !1) {
116
+ if (b && Q.getDerivedStateFromProps == null && w !== g && d.componentWillReceiveProps != null && d.componentWillReceiveProps(w, O), e.__v == n.__v || !d.__e && d.shouldComponentUpdate != null && d.shouldComponentUpdate(w, d.__s, O) === !1) {
117
117
  for (e.__v != n.__v && (d.props = w, 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
119
  }), x = 0; x < d._sb.length; x++) d.__h.push(d._sb[x]);
120
120
  d._sb = [], d.__h.length && u.push(d);
121
121
  break e;
122
122
  }
123
- d.componentWillUpdate != null && d.componentWillUpdate(w, d.__s, U), I && d.componentDidUpdate != null && d.__h.push(function() {
124
- d.componentDidUpdate(m, y, A);
123
+ d.componentWillUpdate != null && d.componentWillUpdate(w, d.__s, O), b && d.componentDidUpdate != null && d.__h.push(function() {
124
+ d.componentDidUpdate(g, y, I);
125
125
  });
126
126
  }
127
- if (d.context = U, d.props = w, d.__P = t, d.__e = !1, Z = k.__r, H = 0, I) {
127
+ if (d.context = O, d.props = w, d.__P = t, d.__e = !1, Z = D.__r, H = 0, b) {
128
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]);
129
129
  d._sb = [];
130
130
  } else do
131
131
  d.__d = !1, Z && Z(e), _ = d.render(d.props, d.state, d.context), d.state = d.__s;
132
132
  while (d.__d && ++H < 25);
133
- d.state = d.__s, d.getChildContext != null && (o = ie(ie({}, o), d.getChildContext())), I && !S && d.getSnapshotBeforeUpdate != null && (A = d.getSnapshotBeforeUpdate(m, y)), ne = _, _ != null && _.type === oe && _.key == null && (ne = wi(_.props.children)), l = vi(t, rt(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), b && (d.__E = d.__ = null);
133
+ d.state = d.__s, d.getChildContext != null && (o = ie(ie({}, o), d.getChildContext())), b && !S && d.getSnapshotBeforeUpdate != null && (I = d.getSnapshotBeforeUpdate(g, y)), ne = _, _ != null && _.type === oe && _.key == null && (ne = wi(_.props.children)), l = vi(t, rt(ne) ? ne : [ne], e, n, o, c, a, u, l, m, p), d.base = e.__e, e.__u &= -161, d.__h.length && u.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
- vt(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 || vt(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 = un(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 = un(n.__e, e, n, o, c, a, u, m, p);
146
+ return (_ = D.diffed) && _(e), 128 & e.__u ? void 0 : l;
147
147
  }
148
- function vt(t) {
149
- t && t.__c && (t.__c.__e = !0), t && t.__k && t.__k.forEach(vt);
148
+ function mt(t) {
149
+ t && t.__c && (t.__c.__e = !0), t && t.__k && t.__k.forEach(mt);
150
150
  }
151
151
  function Si(t, e, n) {
152
- for (var o = 0; o < n.length; o++) Nt(n[o], n[++o], n[++o]);
153
- k.__c && k.__c(e, t), t.some(function(c) {
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(c) {
154
154
  try {
155
155
  t = c.__h, c.__h = [], t.some(function(a) {
156
156
  a.call(c);
157
157
  });
158
158
  } catch (a) {
159
- k.__e(a, c.__v);
159
+ D.__e(a, c.__v);
160
160
  }
161
161
  });
162
162
  }
163
163
  function wi(t) {
164
164
  return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : rt(t) ? t.map(wi) : ie({}, t);
165
165
  }
166
- function un(t, e, n, o, c, a, u, l, g) {
167
- var p, _, d, S, m, y, A, b = n.props || Ue, w = e.props, I = e.type;
168
- if (I == "svg" ? c = "http://www.w3.org/2000/svg" : I == "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 == !!I && (I ? m.localName == I : m.nodeType == 3)) {
170
- t = m, a[p] = null;
166
+ function un(t, e, n, o, c, a, u, l, m) {
167
+ var p, _, d, S, g, y, I, A = n.props || Ue, w = 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 ((g = a[p]) && "setAttribute" in g == !!b && (b ? g.localName == b : g.nodeType == 3)) {
170
+ t = g, a[p] = null;
171
171
  break;
172
172
  }
173
173
  }
174
174
  if (t == null) {
175
- if (I == null) return document.createTextNode(w);
176
- t = document.createElementNS(c, I, w.is && w), l && (k.__m && k.__m(e, a), l = !1), a = null;
175
+ if (b == null) return document.createTextNode(w);
176
+ t = document.createElementNS(c, b, w.is && w), l && (D.__m && D.__m(e, a), l = !1), a = null;
177
177
  }
178
- if (I == null) b === w || l && t.data == w || (t.data = w);
178
+ if (b == null) A === w || l && t.data == w || (t.data = w);
179
179
  else {
180
- if (a = a && $e.call(t.childNodes), !l && a != null) for (b = {}, p = 0; p < t.attributes.length; p++) b[(m = t.attributes[p]).name] = m.value;
181
- for (p in b) if (m = b[p], p != "children") {
182
- if (p == "dangerouslySetInnerHTML") d = m;
180
+ if (a = a && $e.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
183
  else if (!(p in w)) {
184
184
  if (p == "value" && "defaultValue" in w || p == "checked" && "defaultChecked" in w) continue;
185
- je(t, p, null, m, c);
185
+ je(t, p, null, g, c);
186
186
  }
187
187
  }
188
- for (p in w) m = w[p], p == "children" ? S = m : p == "dangerouslySetInnerHTML" ? _ = m : p == "value" ? y = m : p == "checked" ? A = m : l && typeof m != "function" || b[p] === m || je(t, p, m, b[p], c);
188
+ for (p in w) g = w[p], p == "children" ? S = g : p == "dangerouslySetInnerHTML" ? _ = g : p == "value" ? y = g : p == "checked" ? I = g : l && typeof g != "function" || A[p] === g || je(t, p, g, A[p], c);
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, rt(S) ? S : [S], e, n, o, I == "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", I == "progress" && y == null ? t.removeAttribute("value") : y != null && (y !== t[p] || I == "progress" && !y || I == "option" && y != b[p]) && je(t, p, y, b[p], c), p = "checked", A != null && A != t[p] && je(t, p, A, b[p], c));
190
+ else if (d && (t.innerHTML = ""), vi(e.type == "template" ? t.content : t, rt(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, m), a != null) for (p = a.length; p--; ) bt(a[p]);
191
+ l || (p = "value", b == "progress" && y == null ? t.removeAttribute("value") : y != null && (y !== t[p] || b == "progress" && !y || b == "option" && y != A[p]) && je(t, p, y, A[p], c), p = "checked", I != null && I != t[p] && je(t, p, I, A[p], c));
192
192
  }
193
193
  return t;
194
194
  }
195
- function Nt(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
201
  } catch (c) {
202
- k.__e(c, n);
202
+ D.__e(c, n);
203
203
  }
204
204
  }
205
205
  function Ci(t, e, n) {
206
206
  var o, c;
207
- if (k.unmount && k.unmount(t), (o = t.ref) && (o.current && o.current != t.__e || Nt(o, null, e)), (o = t.__c) != null) {
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
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;
216
+ n || bt(t.__e), t.__c = t.__ = t.__e = void 0;
217
217
  }
218
218
  function dn(t, e, n) {
219
219
  return this.constructor(t, n);
220
220
  }
221
221
  function ot(t, e, n) {
222
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 || Ue, Ue, e.namespaceURI, !o && n ? [n] : c ? null : e.firstChild ? $e.call(e.childNodes) : null, a, !o && n ? n : c ? c.__e : e.firstChild, o, u), Si(a, t, u);
223
+ e == document && (e = document.documentElement), D.__ && D.__(t, e), c = (o = typeof n == "function") ? null : n && n.__k || e.__k, a = [], u = [], At(e, t = (!o && n || e).__k = Ce(oe, null, [t]), c || Ue, Ue, e.namespaceURI, !o && n ? [n] : c ? null : e.firstChild ? $e.call(e.childNodes) : null, a, !o && n ? n : c ? c.__e : e.firstChild, o, u), Si(a, t, u);
224
224
  }
225
225
  function Ii(t, e) {
226
226
  ot(t, e, Ii);
@@ -230,7 +230,7 @@ function bi(t, e, n) {
230
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
231
  return arguments.length > 2 && (l.children = arguments.length > 3 ? $e.call(arguments, 2) : n), xe(t.type, l, o || t.key, c || t.ref, null);
232
232
  }
233
- $e = mi.slice, k = { __e: function(t, e, n, o) {
233
+ $e = mi.slice, D = { __e: function(t, e, n, o) {
234
234
  for (var c, a, u; e = e.__; ) if ((c = e.__c) && !c.__) try {
235
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;
236
236
  } catch (l) {
@@ -246,7 +246,7 @@ $e = mi.slice, k = { __e: function(t, e, n, o) {
246
246
  this.__v && (this.__e = !0, t && this.__h.push(t), Wt(this));
247
247
  }, Oe.prototype.render = oe, Ee = [], pi = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, _i = function(t, e) {
248
248
  return t.__v.__b - e.__v.__b;
249
- }, Xe.__r = 0, Ei = /(PointerCapture)$|Capture$/i, At = 0, mt = qt(!1), gt = qt(!0);
249
+ }, Xe.__r = 0, Ei = /(PointerCapture)$|Capture$/i, It = 0, _t = qt(!1), Et = qt(!0);
250
250
  function Ze() {
251
251
  return Ze = Object.assign ? Object.assign.bind() : function(t) {
252
252
  for (var e = 1; e < arguments.length; e++) {
@@ -305,7 +305,7 @@ function mn(t, e, n) {
305
305
  function gn() {
306
306
  ot(this._vdom = null, this._root);
307
307
  }
308
- function Yt(t, e) {
308
+ function Jt(t, e) {
309
309
  var n = this, o = t.useFragment, c = Ai(t, fn);
310
310
  return Ce(o ? oe : "slot", Ze({}, c, { ref: function(a) {
311
311
  a ? (n.ref = a, n._listener || (n._listener = function(u) {
@@ -319,66 +319,66 @@ function Ri(t, e, n) {
319
319
  var o = [], c = {}, a = 0, u = t.attributes, l = t.childNodes;
320
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);
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 = Ri(l[a], null, n), p = l[a].slot;
323
+ p ? c[p] = Ce(Jt, { name: p }, m) : o[a] = m;
324
324
  }
325
- var _ = !(!n || !n.shadow), d = e ? Ce(Yt, { useFragment: !_ }, o) : o;
325
+ var _ = !(!n || !n.shadow), d = e ? Ce(Jt, { useFragment: !_ }, o) : o;
326
326
  return !_ && e && (t.innerHTML = ""), Ce(e || t.nodeName.toLowerCase(), c, d);
327
327
  }
328
328
  var vn = 0;
329
329
  function C(t, e, n, o, c, 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: --vn, __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 Me, P, ft, Jt, Be = 0, Ni = [], F = k, Kt = F.__b, Xt = F.__r, Zt = F.diffed, Qt = F.__c, ei = F.unmount, ti = F.__;
338
- function xt(t, e) {
331
+ var u, l, m = e;
332
+ if ("ref" in m) for (l in m = {}, e) l == "ref" ? u = e[l] : m[l] = e[l];
333
+ var p = { type: t, props: m, key: n, ref: u, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --vn, __i: -1, __u: 0, __source: c, __self: a };
334
+ if (typeof t == "function" && (u = t.defaultProps)) for (l in u) m[l] === void 0 && (m[l] = u[l]);
335
+ return D.vnode && D.vnode(p), p;
336
+ }
337
+ var Me, P, dt, Yt, Be = 0, Ni = [], F = D, Kt = 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) {
343
+ function Je(t) {
344
344
  return Be = 1, yn(Oi, t);
345
345
  }
346
346
  function yn(t, e, n) {
347
- var o = xt(Me++, 2);
347
+ var o = Rt(Me++, 2);
348
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({}));
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 c = 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
369
  var a = P.shouldComponentUpdate, u = P.componentWillUpdate;
370
- P.componentWillUpdate = function(l, g, p) {
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, c(l, m, p), a = _;
374
374
  }
375
- u && u.call(this, l, g, p);
375
+ u && u.call(this, l, m, p);
376
376
  }, P.shouldComponentUpdate = c;
377
377
  }
378
378
  return o.__N || o.__;
379
379
  }
380
- function yt(t, e) {
381
- var n = xt(Me++, 3);
380
+ function gt(t, e) {
381
+ var n = Rt(Me++, 3);
382
382
  !F.__s && xi(n.__H, e) && (n.__ = t, n.u = e, P.__H.__h.push(n));
383
383
  }
384
384
  function Qe(t) {
@@ -387,7 +387,7 @@ function Qe(t) {
387
387
  }, []);
388
388
  }
389
389
  function Ie(t, e) {
390
- var n = xt(Me++, 7);
390
+ var n = Rt(Me++, 7);
391
391
  return xi(n.__H, e) && (n.__ = t(), n.__H = e, n.__h = t), n.__;
392
392
  }
393
393
  function He(t, e) {
@@ -397,7 +397,7 @@ function He(t, e) {
397
397
  }
398
398
  function Sn() {
399
399
  for (var t; t = Ni.shift(); ) if (t.__P && t.__H) try {
400
- t.__H.__h.forEach(Je), t.__H.__h.forEach(St), 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,20 +409,20 @@ F.__b = function(t) {
409
409
  }, F.__r = function(t) {
410
410
  Xt && Xt(t), Me = 0;
411
411
  var e = (P = t.__c).__H;
412
- e && (ft === 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(Je), e.__h.forEach(St), e.__h = [], Me = 0)), ft = P;
414
+ })) : (e.__h.forEach(Ye), e.__h.forEach(vt), e.__h = [], Me = 0)), dt = P;
415
415
  }, F.diffed = function(t) {
416
416
  Zt && Zt(t);
417
417
  var e = t.__c;
418
- e && e.__H && (e.__H.__h.length && (Ni.push(e) !== 1 && Jt === F.requestAnimationFrame || ((Jt = F.requestAnimationFrame) || wn)(Sn)), e.__H.__.forEach(function(n) {
418
+ e && e.__H && (e.__H.__h.length && (Ni.push(e) !== 1 && Yt === F.requestAnimationFrame || ((Yt = F.requestAnimationFrame) || wn)(Sn)), e.__H.__.forEach(function(n) {
419
419
  n.u && (n.__H = n.u), n.u = void 0;
420
- })), ft = 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(Je), n.__h = n.__h.filter(function(o) {
425
- return !o.__ || St(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
428
  e.some(function(c) {
@@ -435,7 +435,7 @@ 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
- Je(o);
438
+ Ye(o);
439
439
  } catch (c) {
440
440
  e = c;
441
441
  }
@@ -448,11 +448,11 @@ function wn(t) {
448
448
  }, o = setTimeout(n, 35);
449
449
  ii && (e = requestAnimationFrame(n));
450
450
  }
451
- function Je(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 St(t) {
455
+ function vt(t) {
456
456
  var e = P;
457
457
  t.__c = t.__(), P = e;
458
458
  }
@@ -471,7 +471,7 @@ function st() {
471
471
  else {
472
472
  for (var t, e = !1; ke !== void 0; ) {
473
473
  var n = ke;
474
- for (ke = void 0, wt++; n !== void 0; ) {
474
+ for (ke = void 0, yt++; n !== void 0; ) {
475
475
  var o = n.o;
476
476
  if (n.o = void 0, n.f &= -3, !(8 & n.f) && Ui(n)) try {
477
477
  n.c();
@@ -481,7 +481,7 @@ function st() {
481
481
  n = o;
482
482
  }
483
483
  }
484
- if (wt = 0, pe--, e) throw t;
484
+ if (yt = 0, pe--, e) throw t;
485
485
  }
486
486
  }
487
487
  function In(t) {
@@ -493,24 +493,24 @@ function In(t) {
493
493
  st();
494
494
  }
495
495
  }
496
- var O = void 0;
496
+ var k = void 0;
497
497
  function ki(t) {
498
- var e = O;
499
- O = void 0;
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, wt = 0, et = 0;
506
+ var ke = void 0, pe = 0, yt = 0, et = 0;
507
507
  function Di(t) {
508
- if (O !== void 0) {
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
516
  function j(t, e) {
@@ -540,12 +540,12 @@ j.prototype.U = function(t) {
540
540
  j.prototype.subscribe = function(t) {
541
541
  var e = this;
542
542
  return Ge(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
  };
@@ -559,12 +559,12 @@ j.prototype.toJSON = function() {
559
559
  return this.value;
560
560
  };
561
561
  j.prototype.peek = function() {
562
- var t = O;
563
- O = void 0;
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
570
  Object.defineProperty(j.prototype, "value", { get: function() {
@@ -572,7 +572,7 @@ Object.defineProperty(j.prototype, "value", { get: function() {
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 (wt > 100) throw new Error("Cycle detected");
575
+ if (yt > 100) throw new Error("Cycle detected");
576
576
  this.v = t, this.i++, et++, pe++;
577
577
  try {
578
578
  for (var e = this.t; e !== void 0; e = e.x) e.t.N();
@@ -581,7 +581,7 @@ Object.defineProperty(j.prototype, "value", { get: function() {
581
581
  }
582
582
  }
583
583
  } });
584
- function Y(t, e) {
584
+ function J(t, e) {
585
585
  return new j(t, e);
586
586
  }
587
587
  function Ui(t) {
@@ -613,15 +613,15 @@ ge.prototype.h = function() {
613
613
  if ((36 & this.f) == 32 || (this.f &= -5, this.g === et)) return !0;
614
614
  if (this.g = et, 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
- Mi(this), O = this;
618
+ Mi(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, Bi(this), this.f &= -2, !0;
625
625
  };
626
626
  ge.prototype.S = function(t) {
627
627
  if (this.t === void 0) {
@@ -655,24 +655,24 @@ function Li(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, st();
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
671
  t.x = void 0, t.s = void 0, Li(t);
672
672
  }
673
673
  function bn(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), st();
674
+ if (k !== this) throw new Error("Out-of-order effect");
675
+ Bi(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;
@@ -690,14 +690,14 @@ Ae.prototype.c = function() {
690
690
  Ae.prototype.S = function() {
691
691
  if (1 & this.f) throw new Error("Cycle detected");
692
692
  this.f |= 1, this.f &= -9, Li(this), Mi(this), pe++;
693
- var t = O;
694
- return O = this, bn.bind(this, t);
693
+ var t = k;
694
+ return k = this, bn.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();
@@ -712,34 +712,34 @@ function Ge(t, e) {
712
712
  var o = n.d.bind(n);
713
713
  return o[Symbol.dispose] = o, o;
714
714
  }
715
- var Pi, pt, An = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, Fi = [];
715
+ var Pi, ht, An = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, Fi = [];
716
716
  Ge(function() {
717
717
  Pi = 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
723
  function tt(t) {
724
- pt && pt(), pt = t && t.S();
724
+ ht && ht(), ht = t && t.S();
725
725
  }
726
726
  function $i(t) {
727
727
  var e = this, n = t.data, o = Gi(n);
728
728
  o.value = n;
729
729
  var c = Ie(function() {
730
- for (var l = e, g = e.__v; g = g.__; ) if (g.__c) {
731
- g.__c.__$f |= 4;
730
+ for (var l = e, m = e.__v; m = m.__; ) if (m.__c) {
731
+ m.__c.__$f |= 4;
732
732
  break;
733
733
  }
734
734
  var p = 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
738
  return !Array.isArray(p.value) && !fi(p.value);
739
739
  }), d = Ge(function() {
740
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);
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() {
@@ -794,16 +794,16 @@ Te("diffed", function(t, e) {
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 = Tn(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 = Tn(n, m, _, c), a[m] = p) : p.o(_, c);
800
800
  }
801
801
  }
802
802
  }
803
803
  t(e);
804
804
  });
805
805
  function Tn(t, e, n, o) {
806
- var c = e in t && t.ownerSVGElement === void 0, a = Y(n);
806
+ var c = e in t && t.ownerSVGElement === void 0, a = J(n);
807
807
  return { o: function(u, l) {
808
808
  a.value = u, o = l;
809
809
  }, d: Ge(function() {
@@ -850,8 +850,8 @@ Oe.prototype.shouldComponentUpdate = function(t, e) {
850
850
  return !1;
851
851
  };
852
852
  function Gi(t, e) {
853
- return Ye(function() {
854
- return Y(t, e);
853
+ return Je(function() {
854
+ return J(t, e);
855
855
  })[0];
856
856
  }
857
857
  var Rn = function(t) {
@@ -865,7 +865,7 @@ function Nn() {
865
865
  });
866
866
  }
867
867
  function Vi() {
868
- Fi.push(this) === 1 && (k.requestAnimationFrame || Rn)(Nn);
868
+ Fi.push(this) === 1 && (D.requestAnimationFrame || Rn)(Nn);
869
869
  }
870
870
  const We = {
871
871
  mode: "orb",
@@ -909,49 +909,49 @@ function xn(t) {
909
909
  }
910
910
  return Object.keys(n).length > 0 ? n : ze["bottom-right"];
911
911
  }
912
- var _t = {}, Ne = {}, ri;
912
+ var ft = {}, Ne = {}, ri;
913
913
  function On() {
914
914
  if (ri) return Ne;
915
915
  ri = 1, Ne.byteLength = l, Ne.toByteArray = p, Ne.fromByteArray = S;
916
916
  for (var t = [], e = [], n = typeof Uint8Array < "u" ? Uint8Array : Array, o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", c = 0, a = o.length; c < a; ++c)
917
917
  t[c] = o[c], e[o.charCodeAt(c)] = c;
918
918
  e[45] = 62, e[95] = 63;
919
- function u(m) {
920
- var y = m.length;
919
+ function u(g) {
920
+ var y = g.length;
921
921
  if (y % 4 > 0)
922
922
  throw new Error("Invalid string. Length must be a multiple of 4");
923
- var A = m.indexOf("=");
924
- A === -1 && (A = y);
925
- var b = A === y ? 0 : 4 - A % 4;
926
- return [A, b];
927
- }
928
- function l(m) {
929
- var y = u(m), A = y[0], b = y[1];
930
- return (A + b) * 3 / 4 - b;
931
- }
932
- function g(m, y, A) {
933
- return (y + A) * 3 / 4 - A;
934
- }
935
- function p(m) {
936
- var y, A = u(m), b = A[0], w = A[1], I = new n(g(m, b, w)), R = 0, U = w > 0 ? b - 4 : b, x;
937
- for (x = 0; x < U; x += 4)
938
- y = e[m.charCodeAt(x)] << 18 | e[m.charCodeAt(x + 1)] << 12 | e[m.charCodeAt(x + 2)] << 6 | e[m.charCodeAt(x + 3)], I[R++] = y >> 16 & 255, I[R++] = y >> 8 & 255, I[R++] = y & 255;
939
- return w === 2 && (y = e[m.charCodeAt(x)] << 2 | e[m.charCodeAt(x + 1)] >> 4, I[R++] = y & 255), w === 1 && (y = e[m.charCodeAt(x)] << 10 | e[m.charCodeAt(x + 1)] << 4 | e[m.charCodeAt(x + 2)] >> 2, I[R++] = y >> 8 & 255, I[R++] = y & 255), I;
940
- }
941
- function _(m) {
942
- return t[m >> 18 & 63] + t[m >> 12 & 63] + t[m >> 6 & 63] + t[m & 63];
943
- }
944
- function d(m, y, A) {
945
- for (var b, w = [], I = y; I < A; I += 3)
946
- b = (m[I] << 16 & 16711680) + (m[I + 1] << 8 & 65280) + (m[I + 2] & 255), w.push(_(b));
923
+ var I = g.indexOf("=");
924
+ I === -1 && (I = y);
925
+ var A = I === y ? 0 : 4 - I % 4;
926
+ return [I, A];
927
+ }
928
+ function l(g) {
929
+ var y = u(g), I = y[0], A = y[1];
930
+ return (I + A) * 3 / 4 - A;
931
+ }
932
+ function m(g, y, I) {
933
+ return (y + I) * 3 / 4 - I;
934
+ }
935
+ function p(g) {
936
+ var y, I = u(g), A = I[0], w = I[1], b = new n(m(g, A, w)), T = 0, O = w > 0 ? A - 4 : A, x;
937
+ for (x = 0; x < O; x += 4)
938
+ y = e[g.charCodeAt(x)] << 18 | e[g.charCodeAt(x + 1)] << 12 | e[g.charCodeAt(x + 2)] << 6 | e[g.charCodeAt(x + 3)], b[T++] = y >> 16 & 255, b[T++] = y >> 8 & 255, b[T++] = y & 255;
939
+ return w === 2 && (y = e[g.charCodeAt(x)] << 2 | e[g.charCodeAt(x + 1)] >> 4, b[T++] = y & 255), w === 1 && (y = e[g.charCodeAt(x)] << 10 | e[g.charCodeAt(x + 1)] << 4 | e[g.charCodeAt(x + 2)] >> 2, b[T++] = y >> 8 & 255, b[T++] = y & 255), b;
940
+ }
941
+ function _(g) {
942
+ return t[g >> 18 & 63] + t[g >> 12 & 63] + t[g >> 6 & 63] + t[g & 63];
943
+ }
944
+ function d(g, y, I) {
945
+ for (var A, w = [], b = y; b < I; b += 3)
946
+ A = (g[b] << 16 & 16711680) + (g[b + 1] << 8 & 65280) + (g[b + 2] & 255), w.push(_(A));
947
947
  return w.join("");
948
948
  }
949
- function S(m) {
950
- for (var y, A = m.length, b = A % 3, w = [], I = 16383, R = 0, U = A - b; R < U; R += I)
951
- w.push(d(m, R, R + I > U ? U : R + I));
952
- return b === 1 ? (y = m[A - 1], w.push(
949
+ function S(g) {
950
+ for (var y, I = g.length, A = I % 3, w = [], b = 16383, T = 0, O = I - A; T < O; T += b)
951
+ w.push(d(g, T, T + b > O ? O : T + b));
952
+ return A === 1 ? (y = g[I - 1], w.push(
953
953
  t[y >> 2] + t[y << 4 & 63] + "=="
954
- )) : b === 2 && (y = (m[A - 2] << 8) + m[A - 1], w.push(
954
+ )) : A === 2 && (y = (g[I - 2] << 8) + g[I - 1], w.push(
955
955
  t[y >> 10] + t[y >> 4 & 63] + t[y << 2 & 63] + "="
956
956
  )), w.join("");
957
957
  }
@@ -961,33 +961,33 @@ var qe = {};
961
961
  var oi;
962
962
  function kn() {
963
963
  return oi || (oi = 1, qe.read = function(t, e, n, o, c) {
964
- 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];
965
- for (d += S, a = m & (1 << -_) - 1, m >>= -_, _ += l; _ > 0; a = a * 256 + t[e + d], d += S, _ -= 8)
964
+ var a, u, l = c * 8 - o - 1, m = (1 << l) - 1, p = m >> 1, _ = -7, d = n ? c - 1 : 0, S = n ? -1 : 1, g = t[e + d];
965
+ for (d += S, a = g & (1 << -_) - 1, g >>= -_, _ += l; _ > 0; a = a * 256 + t[e + d], d += S, _ -= 8)
966
966
  ;
967
967
  for (u = a & (1 << -_) - 1, a >>= -_, _ += o; _ > 0; u = u * 256 + t[e + d], d += S, _ -= 8)
968
968
  ;
969
969
  if (a === 0)
970
970
  a = 1 - p;
971
971
  else {
972
- if (a === g)
973
- return u ? NaN : (m ? -1 : 1) * (1 / 0);
972
+ if (a === m)
973
+ return u ? NaN : (g ? -1 : 1) * (1 / 0);
974
974
  u = u + Math.pow(2, o), a = a - p;
975
975
  }
976
- return (m ? -1 : 1) * u * Math.pow(2, a - o);
976
+ return (g ? -1 : 1) * u * Math.pow(2, a - o);
977
977
  }, qe.write = function(t, e, n, o, c, a) {
978
- 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;
979
- 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)
978
+ var u, l, m, p = a * 8 - c - 1, _ = (1 << p) - 1, d = _ >> 1, S = c === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, g = o ? 0 : a - 1, y = o ? 1 : -1, I = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
979
+ 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 * (m = Math.pow(2, -u)) < 1 && (u--, m *= 2), u + d >= 1 ? e += S / m : e += S * Math.pow(2, 1 - d), e * m >= 2 && (u++, m /= 2), u + d >= _ ? (l = 0, u = _) : u + d >= 1 ? (l = (e * m - 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 + g] = l & 255, g += y, l /= 256, c -= 8)
980
980
  ;
981
- for (u = u << c | l, p += c; p > 0; t[n + m] = u & 255, m += y, u /= 256, p -= 8)
981
+ for (u = u << c | l, p += c; p > 0; t[n + g] = u & 255, g += y, u /= 256, p -= 8)
982
982
  ;
983
- t[n + m - y] |= A * 128;
983
+ t[n + g - y] |= I * 128;
984
984
  }), qe;
985
985
  }
986
986
  var si;
987
987
  function Dn() {
988
988
  return si || (si = 1, (function(t) {
989
989
  const e = On(), n = kn(), o = typeof Symbol == "function" && typeof Symbol.for == "function" ? /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom") : null;
990
- t.Buffer = l, t.SlowBuffer = I, t.INSPECT_MAX_BYTES = 50;
990
+ t.Buffer = l, t.SlowBuffer = b, t.INSPECT_MAX_BYTES = 50;
991
991
  const c = 2147483647;
992
992
  t.kMaxLength = c, l.TYPED_ARRAY_SUPPORT = a(), !l.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
993
993
  "This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
@@ -1029,10 +1029,10 @@ function Dn() {
1029
1029
  );
1030
1030
  return d(s);
1031
1031
  }
1032
- return g(s, i, r);
1032
+ return m(s, i, r);
1033
1033
  }
1034
1034
  l.poolSize = 8192;
1035
- function g(s, i, r) {
1035
+ function m(s, i, r) {
1036
1036
  if (typeof s == "string")
1037
1037
  return S(s, i);
1038
1038
  if (ArrayBuffer.isView(s))
@@ -1042,7 +1042,7 @@ function Dn() {
1042
1042
  "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof s
1043
1043
  );
1044
1044
  if (ee(s, ArrayBuffer) || s && ee(s.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (ee(s, SharedArrayBuffer) || s && ee(s.buffer, SharedArrayBuffer)))
1045
- return A(s, i, r);
1045
+ return I(s, i, r);
1046
1046
  if (typeof s == "number")
1047
1047
  throw new TypeError(
1048
1048
  'The "value" argument must not be of type number. Received type number'
@@ -1050,7 +1050,7 @@ function Dn() {
1050
1050
  const h = s.valueOf && s.valueOf();
1051
1051
  if (h != null && h !== s)
1052
1052
  return l.from(h, i, r);
1053
- const f = b(s);
1053
+ const f = A(s);
1054
1054
  if (f) return f;
1055
1055
  if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof s[Symbol.toPrimitive] == "function")
1056
1056
  return l.from(s[Symbol.toPrimitive]("string"), i, r);
@@ -1059,7 +1059,7 @@ function Dn() {
1059
1059
  );
1060
1060
  }
1061
1061
  l.from = function(s, i, r) {
1062
- return g(s, i, r);
1062
+ return m(s, i, r);
1063
1063
  }, Object.setPrototypeOf(l.prototype, Uint8Array.prototype), Object.setPrototypeOf(l, Uint8Array);
1064
1064
  function p(s) {
1065
1065
  if (typeof s != "number")
@@ -1084,12 +1084,12 @@ function Dn() {
1084
1084
  function S(s, i) {
1085
1085
  if ((typeof i != "string" || i === "") && (i = "utf8"), !l.isEncoding(i))
1086
1086
  throw new TypeError("Unknown encoding: " + i);
1087
- const r = R(s, i) | 0;
1087
+ const r = T(s, i) | 0;
1088
1088
  let h = u(r);
1089
1089
  const f = h.write(s, i);
1090
1090
  return f !== r && (h = h.slice(0, f)), h;
1091
1091
  }
1092
- function m(s) {
1092
+ function g(s) {
1093
1093
  const i = s.length < 0 ? 0 : w(s.length) | 0, r = u(i);
1094
1094
  for (let h = 0; h < i; h += 1)
1095
1095
  r[h] = s[h] & 255;
@@ -1098,11 +1098,11 @@ function Dn() {
1098
1098
  function y(s) {
1099
1099
  if (ee(s, Uint8Array)) {
1100
1100
  const i = new Uint8Array(s);
1101
- return A(i.buffer, i.byteOffset, i.byteLength);
1101
+ return I(i.buffer, i.byteOffset, i.byteLength);
1102
1102
  }
1103
- return m(s);
1103
+ return g(s);
1104
1104
  }
1105
- function A(s, i, r) {
1105
+ function I(s, i, r) {
1106
1106
  if (i < 0 || s.byteLength < i)
1107
1107
  throw new RangeError('"offset" is outside of buffer bounds');
1108
1108
  if (s.byteLength < i + (r || 0))
@@ -1110,22 +1110,22 @@ function Dn() {
1110
1110
  let h;
1111
1111
  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;
1112
1112
  }
1113
- function b(s) {
1113
+ function A(s) {
1114
1114
  if (l.isBuffer(s)) {
1115
1115
  const i = w(s.length) | 0, r = u(i);
1116
1116
  return r.length === 0 || s.copy(r, 0, 0, i), r;
1117
1117
  }
1118
1118
  if (s.length !== void 0)
1119
- return typeof s.length != "number" || ht(s.length) ? u(0) : m(s);
1119
+ return typeof s.length != "number" || ut(s.length) ? u(0) : g(s);
1120
1120
  if (s.type === "Buffer" && Array.isArray(s.data))
1121
- return m(s.data);
1121
+ return g(s.data);
1122
1122
  }
1123
1123
  function w(s) {
1124
1124
  if (s >= c)
1125
1125
  throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + c.toString(16) + " bytes");
1126
1126
  return s | 0;
1127
1127
  }
1128
- function I(s) {
1128
+ function b(s) {
1129
1129
  return +s != s && (s = 0), l.alloc(+s);
1130
1130
  }
1131
1131
  l.isBuffer = function(i) {
@@ -1187,7 +1187,7 @@ function Dn() {
1187
1187
  }
1188
1188
  return f;
1189
1189
  };
1190
- function R(s, i) {
1190
+ function T(s, i) {
1191
1191
  if (l.isBuffer(s))
1192
1192
  return s.length;
1193
1193
  if (ArrayBuffer.isView(s) || ee(s, ArrayBuffer))
@@ -1207,7 +1207,7 @@ function Dn() {
1207
1207
  return r;
1208
1208
  case "utf8":
1209
1209
  case "utf-8":
1210
- return dt(s).length;
1210
+ return ct(s).length;
1211
1211
  case "ucs2":
1212
1212
  case "ucs-2":
1213
1213
  case "utf16le":
@@ -1219,12 +1219,12 @@ function Dn() {
1219
1219
  return jt(s).length;
1220
1220
  default:
1221
1221
  if (f)
1222
- return h ? -1 : dt(s).length;
1222
+ return h ? -1 : ct(s).length;
1223
1223
  i = ("" + i).toLowerCase(), f = !0;
1224
1224
  }
1225
1225
  }
1226
- l.byteLength = R;
1227
- function U(s, i, r) {
1226
+ l.byteLength = T;
1227
+ function O(s, i, r) {
1228
1228
  let h = !1;
1229
1229
  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))
1230
1230
  return "";
@@ -1236,7 +1236,7 @@ function Dn() {
1236
1236
  case "utf-8":
1237
1237
  return Ut(this, i, r);
1238
1238
  case "ascii":
1239
- return Ji(this, i, r);
1239
+ return Yi(this, i, r);
1240
1240
  case "latin1":
1241
1241
  case "binary":
1242
1242
  return Ki(this, i, r);
@@ -1280,7 +1280,7 @@ function Dn() {
1280
1280
  return this;
1281
1281
  }, l.prototype.toString = function() {
1282
1282
  const i = this.length;
1283
- return i === 0 ? "" : arguments.length === 0 ? Ut(this, 0, i) : U.apply(this, arguments);
1283
+ return i === 0 ? "" : arguments.length === 0 ? Ut(this, 0, i) : O.apply(this, arguments);
1284
1284
  }, l.prototype.toLocaleString = l.prototype.toString, l.prototype.equals = function(i) {
1285
1285
  if (!l.isBuffer(i)) throw new TypeError("Argument must be a Buffer");
1286
1286
  return this === i ? !0 : l.compare(this, i) === 0;
@@ -1302,18 +1302,18 @@ function Dn() {
1302
1302
  if (r >= h)
1303
1303
  return 1;
1304
1304
  if (r >>>= 0, h >>>= 0, f >>>= 0, E >>>= 0, this === i) return 0;
1305
- let v = E - f, T = h - r;
1306
- const B = Math.min(v, T), M = this.slice(f, E), L = i.slice(r, h);
1307
- for (let D = 0; D < B; ++D)
1308
- if (M[D] !== L[D]) {
1309
- v = M[D], T = L[D];
1305
+ let v = E - f, R = h - r;
1306
+ const B = Math.min(v, R), M = this.slice(f, E), L = i.slice(r, h);
1307
+ for (let U = 0; U < B; ++U)
1308
+ if (M[U] !== L[U]) {
1309
+ v = M[U], R = L[U];
1310
1310
  break;
1311
1311
  }
1312
- return v < T ? -1 : T < v ? 1 : 0;
1312
+ return v < R ? -1 : R < v ? 1 : 0;
1313
1313
  };
1314
1314
  function Z(s, i, r, h, f) {
1315
1315
  if (s.length === 0) return -1;
1316
- if (typeof r == "string" ? (h = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r, ht(r) && (r = f ? 0 : s.length - 1), r < 0 && (r = s.length + r), r >= s.length) {
1316
+ 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) {
1317
1317
  if (f) return -1;
1318
1318
  r = s.length - 1;
1319
1319
  } else if (r < 0)
@@ -1326,28 +1326,28 @@ function Dn() {
1326
1326
  throw new TypeError("val must be string, number or Buffer");
1327
1327
  }
1328
1328
  function H(s, i, r, h, f) {
1329
- let E = 1, v = s.length, T = i.length;
1329
+ let E = 1, v = s.length, R = i.length;
1330
1330
  if (h !== void 0 && (h = String(h).toLowerCase(), h === "ucs2" || h === "ucs-2" || h === "utf16le" || h === "utf-16le")) {
1331
1331
  if (s.length < 2 || i.length < 2)
1332
1332
  return -1;
1333
- E = 2, v /= 2, T /= 2, r /= 2;
1333
+ E = 2, v /= 2, R /= 2, r /= 2;
1334
1334
  }
1335
- function B(L, D) {
1336
- return E === 1 ? L[D] : L.readUInt16BE(D * E);
1335
+ function B(L, U) {
1336
+ return E === 1 ? L[U] : L.readUInt16BE(U * E);
1337
1337
  }
1338
1338
  let M;
1339
1339
  if (f) {
1340
1340
  let L = -1;
1341
1341
  for (M = r; M < v; M++)
1342
1342
  if (B(s, M) === B(i, L === -1 ? 0 : M - L)) {
1343
- if (L === -1 && (L = M), M - L + 1 === T) return L * E;
1343
+ if (L === -1 && (L = M), M - L + 1 === R) return L * E;
1344
1344
  } else
1345
1345
  L !== -1 && (M -= M - L), L = -1;
1346
1346
  } else
1347
- for (r + T > v && (r = v - T), M = r; M >= 0; M--) {
1347
+ for (r + R > v && (r = v - R), M = r; M >= 0; M--) {
1348
1348
  let L = !0;
1349
- for (let D = 0; D < T; D++)
1350
- if (B(s, M + D) !== B(i, D)) {
1349
+ for (let U = 0; U < R; U++)
1350
+ if (B(s, M + U) !== B(i, U)) {
1351
1351
  L = !1;
1352
1352
  break;
1353
1353
  }
@@ -1370,14 +1370,14 @@ function Dn() {
1370
1370
  h > E / 2 && (h = E / 2);
1371
1371
  let v;
1372
1372
  for (v = 0; v < h; ++v) {
1373
- const T = parseInt(i.substr(v * 2, 2), 16);
1374
- if (ht(T)) return v;
1375
- s[r + v] = T;
1373
+ const R = parseInt(i.substr(v * 2, 2), 16);
1374
+ if (ut(R)) return v;
1375
+ s[r + v] = R;
1376
1376
  }
1377
1377
  return v;
1378
1378
  }
1379
1379
  function ne(s, i, r, h) {
1380
- return Ve(dt(i, s.length - r), s, r, h);
1380
+ return Ve(ct(i, s.length - r), s, r, h);
1381
1381
  }
1382
1382
  function re(s, i, r, h) {
1383
1383
  return Ve(nn(i), s, r, h);
@@ -1441,29 +1441,29 @@ function Dn() {
1441
1441
  let f = i;
1442
1442
  for (; f < r; ) {
1443
1443
  const E = s[f];
1444
- let v = null, T = E > 239 ? 4 : E > 223 ? 3 : E > 191 ? 2 : 1;
1445
- if (f + T <= r) {
1446
- let B, M, L, D;
1447
- switch (T) {
1444
+ let v = null, R = E > 239 ? 4 : E > 223 ? 3 : E > 191 ? 2 : 1;
1445
+ if (f + R <= r) {
1446
+ let B, M, L, U;
1447
+ switch (R) {
1448
1448
  case 1:
1449
1449
  E < 128 && (v = E);
1450
1450
  break;
1451
1451
  case 2:
1452
- B = s[f + 1], (B & 192) === 128 && (D = (E & 31) << 6 | B & 63, D > 127 && (v = D));
1452
+ B = s[f + 1], (B & 192) === 128 && (U = (E & 31) << 6 | B & 63, U > 127 && (v = U));
1453
1453
  break;
1454
1454
  case 3:
1455
- B = s[f + 1], M = s[f + 2], (B & 192) === 128 && (M & 192) === 128 && (D = (E & 15) << 12 | (B & 63) << 6 | M & 63, D > 2047 && (D < 55296 || D > 57343) && (v = D));
1455
+ B = s[f + 1], M = s[f + 2], (B & 192) === 128 && (M & 192) === 128 && (U = (E & 15) << 12 | (B & 63) << 6 | M & 63, U > 2047 && (U < 55296 || U > 57343) && (v = U));
1456
1456
  break;
1457
1457
  case 4:
1458
- B = s[f + 1], M = s[f + 2], L = s[f + 3], (B & 192) === 128 && (M & 192) === 128 && (L & 192) === 128 && (D = (E & 15) << 18 | (B & 63) << 12 | (M & 63) << 6 | L & 63, D > 65535 && D < 1114112 && (v = D));
1458
+ B = s[f + 1], M = s[f + 2], L = s[f + 3], (B & 192) === 128 && (M & 192) === 128 && (L & 192) === 128 && (U = (E & 15) << 18 | (B & 63) << 12 | (M & 63) << 6 | L & 63, U > 65535 && U < 1114112 && (v = U));
1459
1459
  }
1460
1460
  }
1461
- 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;
1461
+ v === null ? (v = 65533, R = 1) : v > 65535 && (v -= 65536, h.push(v >>> 10 & 1023 | 55296), v = 56320 | v & 1023), h.push(v), f += R;
1462
1462
  }
1463
- return Yi(h);
1463
+ return Ji(h);
1464
1464
  }
1465
1465
  const Mt = 4096;
1466
- function Yi(s) {
1466
+ function Ji(s) {
1467
1467
  const i = s.length;
1468
1468
  if (i <= Mt)
1469
1469
  return String.fromCharCode.apply(String, s);
@@ -1475,7 +1475,7 @@ function Dn() {
1475
1475
  );
1476
1476
  return r;
1477
1477
  }
1478
- function Ji(s, i, r) {
1478
+ function Yi(s, i, r) {
1479
1479
  let h = "";
1480
1480
  r = Math.min(s.length, r);
1481
1481
  for (let f = i; f < r; ++f)
@@ -1603,8 +1603,8 @@ function Dn() {
1603
1603
  }
1604
1604
  l.prototype.writeUintLE = l.prototype.writeUIntLE = function(i, r, h, f) {
1605
1605
  if (i = +i, r = r >>> 0, h = h >>> 0, !f) {
1606
- const T = Math.pow(2, 8 * h) - 1;
1607
- q(this, i, r, h, T, 0);
1606
+ const R = Math.pow(2, 8 * h) - 1;
1607
+ q(this, i, r, h, R, 0);
1608
1608
  }
1609
1609
  let E = 1, v = 0;
1610
1610
  for (this[r] = i & 255; ++v < h && (E *= 256); )
@@ -1612,8 +1612,8 @@ function Dn() {
1612
1612
  return r + h;
1613
1613
  }, l.prototype.writeUintBE = l.prototype.writeUIntBE = function(i, r, h, f) {
1614
1614
  if (i = +i, r = r >>> 0, h = h >>> 0, !f) {
1615
- const T = Math.pow(2, 8 * h) - 1;
1616
- q(this, i, r, h, T, 0);
1615
+ const R = Math.pow(2, 8 * h) - 1;
1616
+ q(this, i, r, h, R, 0);
1617
1617
  }
1618
1618
  let E = h - 1, v = 1;
1619
1619
  for (this[r + E] = i & 255; --E >= 0 && (v *= 256); )
@@ -1653,18 +1653,18 @@ function Dn() {
1653
1653
  const B = Math.pow(2, 8 * h - 1);
1654
1654
  q(this, i, r, h, B - 1, -B);
1655
1655
  }
1656
- let E = 0, v = 1, T = 0;
1656
+ let E = 0, v = 1, R = 0;
1657
1657
  for (this[r] = i & 255; ++E < h && (v *= 256); )
1658
- i < 0 && T === 0 && this[r + E - 1] !== 0 && (T = 1), this[r + E] = (i / v >> 0) - T & 255;
1658
+ i < 0 && R === 0 && this[r + E - 1] !== 0 && (R = 1), this[r + E] = (i / v >> 0) - R & 255;
1659
1659
  return r + h;
1660
1660
  }, l.prototype.writeIntBE = function(i, r, h, f) {
1661
1661
  if (i = +i, r = r >>> 0, !f) {
1662
1662
  const B = Math.pow(2, 8 * h - 1);
1663
1663
  q(this, i, r, h, B - 1, -B);
1664
1664
  }
1665
- let E = h - 1, v = 1, T = 0;
1665
+ let E = h - 1, v = 1, R = 0;
1666
1666
  for (this[r + E] = i & 255; --E >= 0 && (v *= 256); )
1667
- i < 0 && T === 0 && this[r + E + 1] !== 0 && (T = 1), this[r + E] = (i / v >> 0) - T & 255;
1667
+ i < 0 && R === 0 && this[r + E + 1] !== 0 && (R = 1), this[r + E] = (i / v >> 0) - R & 255;
1668
1668
  return r + h;
1669
1669
  }, l.prototype.writeInt8 = function(i, r, h) {
1670
1670
  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;
@@ -1735,16 +1735,16 @@ function Dn() {
1735
1735
  for (E = r; E < h; ++E)
1736
1736
  this[E] = i;
1737
1737
  else {
1738
- const v = l.isBuffer(i) ? i : l.from(i, f), T = v.length;
1739
- if (T === 0)
1738
+ const v = l.isBuffer(i) ? i : l.from(i, f), R = v.length;
1739
+ if (R === 0)
1740
1740
  throw new TypeError('The value "' + i + '" is invalid for argument "value"');
1741
1741
  for (E = 0; E < h - r; ++E)
1742
- this[E + r] = v[E % T];
1742
+ this[E + r] = v[E % R];
1743
1743
  }
1744
1744
  return this;
1745
1745
  };
1746
1746
  const ve = {};
1747
- function ut(s, i, r) {
1747
+ function lt(s, i, r) {
1748
1748
  ve[s] = class extends r {
1749
1749
  constructor() {
1750
1750
  super(), Object.defineProperty(this, "message", {
@@ -1769,19 +1769,19 @@ function Dn() {
1769
1769
  }
1770
1770
  };
1771
1771
  }
1772
- ut(
1772
+ lt(
1773
1773
  "ERR_BUFFER_OUT_OF_BOUNDS",
1774
1774
  function(s) {
1775
1775
  return s ? `${s} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
1776
1776
  },
1777
1777
  RangeError
1778
- ), ut(
1778
+ ), lt(
1779
1779
  "ERR_INVALID_ARG_TYPE",
1780
1780
  function(s, i) {
1781
1781
  return `The "${s}" argument must be of type number. Received type ${typeof i}`;
1782
1782
  },
1783
1783
  TypeError
1784
- ), ut(
1784
+ ), lt(
1785
1785
  "ERR_OUT_OF_RANGE",
1786
1786
  function(s, i, r) {
1787
1787
  let h = `The value of "${s}" is out of range.`, f = r;
@@ -1802,8 +1802,8 @@ function Dn() {
1802
1802
  function Vt(s, i, r, h, f, E) {
1803
1803
  if (s > r || s < i) {
1804
1804
  const v = typeof i == "bigint" ? "n" : "";
1805
- let T;
1806
- 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);
1805
+ let R;
1806
+ throw i === 0 || i === BigInt(0) ? R = `>= 0${v} and < 2${v} ** ${(E + 1) * 8}${v}` : R = `>= -(2${v} ** ${(E + 1) * 8 - 1}${v}) and < 2 ** ${(E + 1) * 8 - 1}${v}`, new ve.ERR_OUT_OF_RANGE("value", R, s);
1807
1807
  }
1808
1808
  Qi(h, f, E);
1809
1809
  }
@@ -1825,7 +1825,7 @@ function Dn() {
1825
1825
  s = s + "=";
1826
1826
  return s;
1827
1827
  }
1828
- function dt(s, i) {
1828
+ function ct(s, i) {
1829
1829
  i = i || 1 / 0;
1830
1830
  let r;
1831
1831
  const h = s.length;
@@ -1904,7 +1904,7 @@ function Dn() {
1904
1904
  function ee(s, i) {
1905
1905
  return s instanceof i || s != null && s.constructor != null && s.constructor.name != null && s.constructor.name === i.name;
1906
1906
  }
1907
- function ht(s) {
1907
+ function ut(s) {
1908
1908
  return s !== s;
1909
1909
  }
1910
1910
  const on = (function() {
@@ -1922,7 +1922,7 @@ function Dn() {
1922
1922
  function sn() {
1923
1923
  throw new Error("BigInt not supported");
1924
1924
  }
1925
- })(_t)), _t;
1925
+ })(ft)), ft;
1926
1926
  }
1927
1927
  var Un = Dn();
1928
1928
  const Mn = "https://api.anam.ai", Bn = "/v1", ji = {
@@ -1943,7 +1943,7 @@ var Ln = function(t, e, n, o) {
1943
1943
  u(d);
1944
1944
  }
1945
1945
  }
1946
- function g(_) {
1946
+ function m(_) {
1947
1947
  try {
1948
1948
  p(o.throw(_));
1949
1949
  } catch (d) {
@@ -1951,19 +1951,19 @@ var Ln = function(t, e, n, o) {
1951
1951
  }
1952
1952
  }
1953
1953
  function p(_) {
1954
- _.done ? a(_.value) : c(_.value).then(l, g);
1954
+ _.done ? a(_.value) : c(_.value).then(l, m);
1955
1955
  }
1956
1956
  p((o = o.apply(t, e || [])).next());
1957
1957
  });
1958
1958
  };
1959
- const Hi = "https://api.anam.ai", kt = "/v1";
1959
+ const Hi = "https://api.anam.ai", xt = "/v1";
1960
1960
  var se;
1961
1961
  (function(t) {
1962
1962
  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";
1963
1963
  })(se || (se = {}));
1964
- let Ct = Hi, Wi = kt, de, zi = !1;
1965
- const Pn = (t, e = kt) => {
1966
- Ct = t, Wi = e;
1964
+ let St = Hi, Wi = xt, de, zi = !1;
1965
+ const Pn = (t, e = xt) => {
1966
+ St = t, Wi = e;
1967
1967
  }, Fn = (t) => {
1968
1968
  de = t;
1969
1969
  }, $n = (t) => {
@@ -1985,7 +1985,7 @@ const Se = (t) => {
1985
1985
  let a, u = {
1986
1986
  "Content-Type": "application/json"
1987
1987
  };
1988
- de?.enabled && de?.baseUrl ? (a = `${de.baseUrl}${c}`, u["X-Anam-Target-Url"] = `${Ct}${c}`) : a = `${Ct}${c}`, yield fetch(a, {
1988
+ de?.enabled && de?.baseUrl ? (a = `${de.baseUrl}${c}`, u["X-Anam-Target-Url"] = `${St}${c}`) : a = `${St}${c}`, yield fetch(a, {
1989
1989
  method: "POST",
1990
1990
  headers: u,
1991
1991
  body: JSON.stringify({
@@ -2007,36 +2007,36 @@ const Se = (t) => {
2007
2007
  issues: []
2008
2008
  }, l = ((n = a["inbound-rtp"]) === null || n === void 0 ? void 0 : n.filter((d) => d.kind === "video")) || [];
2009
2009
  l.length > 0 && (u.personaVideoStream = [], l.forEach((d) => {
2010
- var S, m, y, A, b;
2010
+ var S, g, y, I, A;
2011
2011
  const w = {
2012
2012
  framesReceived: (S = d.framesReceived) !== null && S !== void 0 ? S : "unknown",
2013
- framesDropped: (m = d.framesDropped) !== null && m !== void 0 ? m : "unknown",
2013
+ framesDropped: (g = d.framesDropped) !== null && g !== void 0 ? g : "unknown",
2014
2014
  framesPerSecond: (y = d.framesPerSecond) !== null && y !== void 0 ? y : "unknown",
2015
- packetsReceived: (A = d.packetsReceived) !== null && A !== void 0 ? A : "unknown",
2016
- packetsLost: (b = d.packetsLost) !== null && b !== void 0 ? b : "unknown",
2015
+ packetsReceived: (I = d.packetsReceived) !== null && I !== void 0 ? I : "unknown",
2016
+ packetsLost: (A = d.packetsLost) !== null && A !== void 0 ? A : "unknown",
2017
2017
  resolution: d.frameWidth && d.frameHeight ? `${d.frameWidth}x${d.frameHeight}` : void 0,
2018
2018
  jitter: d.jitter !== void 0 ? d.jitter : void 0
2019
2019
  };
2020
2020
  u.personaVideoStream.push(w);
2021
2021
  }));
2022
- const g = ((o = a["inbound-rtp"]) === null || o === void 0 ? void 0 : o.filter((d) => d.kind === "audio")) || [];
2023
- g.length > 0 && (u.personaAudioStream = [], g.forEach((d) => {
2024
- var S, m, y;
2025
- const A = {
2022
+ const m = ((o = a["inbound-rtp"]) === null || o === void 0 ? void 0 : o.filter((d) => d.kind === "audio")) || [];
2023
+ m.length > 0 && (u.personaAudioStream = [], m.forEach((d) => {
2024
+ var S, g, y;
2025
+ const I = {
2026
2026
  packetsReceived: (S = d.packetsReceived) !== null && S !== void 0 ? S : "unknown",
2027
- packetsLost: (m = d.packetsLost) !== null && m !== void 0 ? m : "unknown",
2027
+ packetsLost: (g = d.packetsLost) !== null && g !== void 0 ? g : "unknown",
2028
2028
  audioLevel: (y = d.audioLevel) !== null && y !== void 0 ? y : "unknown",
2029
2029
  jitter: d.jitter !== void 0 ? d.jitter : void 0,
2030
2030
  totalAudioEnergy: d.totalAudioEnergy !== void 0 ? d.totalAudioEnergy : void 0
2031
2031
  };
2032
- u.personaAudioStream.push(A);
2032
+ u.personaAudioStream.push(I);
2033
2033
  }));
2034
2034
  const p = ((c = a["outbound-rtp"]) === null || c === void 0 ? void 0 : c.filter((d) => d.kind === "audio")) || [];
2035
2035
  p.length > 0 && (u.userAudioInput = [], p.forEach((d) => {
2036
- var S, m;
2036
+ var S, g;
2037
2037
  const y = {
2038
2038
  packetsSent: (S = d.packetsSent) !== null && S !== void 0 ? S : "unknown",
2039
- retransmittedPackets: (m = d.retransmittedPacketsSent) !== null && m !== void 0 ? m : void 0,
2039
+ retransmittedPackets: (g = d.retransmittedPacketsSent) !== null && g !== void 0 ? g : void 0,
2040
2040
  avgPacketSendDelay: d.totalPacketSendDelay !== void 0 ? d.totalPacketSendDelay / (d.packetsSent || 1) * 1e3 : void 0
2041
2041
  };
2042
2042
  u.userAudioInput.push(y);
@@ -2061,7 +2061,7 @@ const Se = (t) => {
2061
2061
  const _ = [];
2062
2062
  if (l.forEach((d) => {
2063
2063
  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)`);
2064
- }), g.forEach((d) => {
2064
+ }), m.forEach((d) => {
2065
2065
  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)`);
2066
2066
  }), u.issues = _, e === "json")
2067
2067
  return u;
@@ -2191,7 +2191,7 @@ var we = function(t, e, n, o) {
2191
2191
  u(d);
2192
2192
  }
2193
2193
  }
2194
- function g(_) {
2194
+ function m(_) {
2195
2195
  try {
2196
2196
  p(o.throw(_));
2197
2197
  } catch (d) {
@@ -2199,7 +2199,7 @@ var we = function(t, e, n, o) {
2199
2199
  }
2200
2200
  }
2201
2201
  function p(_) {
2202
- _.done ? a(_.value) : c(_.value).then(l, g);
2202
+ _.done ? a(_.value) : c(_.value).then(l, m);
2203
2203
  }
2204
2204
  p((o = o.apply(t, e || [])).next());
2205
2205
  });
@@ -2207,21 +2207,21 @@ var we = function(t, e, n, o) {
2207
2207
  const Hn = 5, Wn = 5;
2208
2208
  class zn {
2209
2209
  constructor(e, n, o, c, a) {
2210
- var u, l, g, p, _;
2210
+ var u, l, m, p, _;
2211
2211
  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)
2212
2212
  throw new Error("Signalling Client: sessionId is required");
2213
2213
  this.sessionId = e;
2214
- const { heartbeatIntervalSeconds: d, maxWsReconnectionAttempts: S, url: m } = n;
2215
- if (this.heartbeatIntervalSeconds = d || Hn, this.maxWsReconnectionAttempts = S || Wn, !m.baseUrl)
2214
+ const { heartbeatIntervalSeconds: d, maxWsReconnectionAttempts: S, url: g } = n;
2215
+ if (this.heartbeatIntervalSeconds = d || Hn, this.maxWsReconnectionAttempts = S || Wn, !g.baseUrl)
2216
2216
  throw new Error("Signalling Client: baseUrl is required");
2217
2217
  if (!((u = this.apiGatewayConfig) === null || u === void 0) && u.enabled && (!((l = this.apiGatewayConfig) === null || l === void 0) && l.baseUrl)) {
2218
- const y = new URL(this.apiGatewayConfig.baseUrl), A = (g = this.apiGatewayConfig.wsPath) !== null && g !== void 0 ? g : "/ws";
2219
- y.protocol = y.protocol.replace("http", "ws"), y.pathname = A, this.url = y;
2220
- const b = m.protocol || "https", w = b === "http" ? "ws" : "wss", I = `${b}://${m.baseUrl}`, R = (p = m.signallingPath) !== null && p !== void 0 ? p : "/ws", U = new URL(I);
2221
- U.protocol = w === "ws" ? "ws:" : "wss:", m.port && (U.port = m.port), U.pathname = R, U.searchParams.append("session_id", e), this.url.searchParams.append("target_url", U.href);
2218
+ const y = new URL(this.apiGatewayConfig.baseUrl), I = (m = this.apiGatewayConfig.wsPath) !== null && m !== void 0 ? m : "/ws";
2219
+ y.protocol = y.protocol.replace("http", "ws"), y.pathname = I, this.url = y;
2220
+ const A = g.protocol || "https", w = A === "http" ? "ws" : "wss", b = `${A}://${g.baseUrl}`, T = (p = g.signallingPath) !== null && p !== void 0 ? p : "/ws", O = new URL(b);
2221
+ O.protocol = w === "ws" ? "ws:" : "wss:", g.port && (O.port = g.port), O.pathname = T, O.searchParams.append("session_id", e), this.url.searchParams.append("target_url", O.href);
2222
2222
  } else {
2223
- const A = `${m.protocol || "https"}://${m.baseUrl}`;
2224
- 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);
2223
+ const I = `${g.protocol || "https"}://${g.baseUrl}`;
2224
+ this.url = new URL(I), 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);
2225
2225
  }
2226
2226
  }
2227
2227
  stop() {
@@ -2360,7 +2360,7 @@ var li = function(t, e, n, o) {
2360
2360
  u(d);
2361
2361
  }
2362
2362
  }
2363
- function g(_) {
2363
+ function m(_) {
2364
2364
  try {
2365
2365
  p(o.throw(_));
2366
2366
  } catch (d) {
@@ -2368,12 +2368,12 @@ var li = function(t, e, n, o) {
2368
2368
  }
2369
2369
  }
2370
2370
  function p(_) {
2371
- _.done ? a(_.value) : c(_.value).then(l, g);
2371
+ _.done ? a(_.value) : c(_.value).then(l, m);
2372
2372
  }
2373
2373
  p((o = o.apply(t, e || [])).next());
2374
2374
  });
2375
2375
  };
2376
- class Yn {
2376
+ class Jn {
2377
2377
  constructor(e, n, o) {
2378
2378
  if (!e && !n)
2379
2379
  throw new Error("Either sessionToken or apiKey must be provided");
@@ -2413,7 +2413,7 @@ class Yn {
2413
2413
  sessionOptions: n,
2414
2414
  clientMetadata: ji
2415
2415
  })
2416
- }), l = yield u.json(), g = l.error;
2416
+ }), l = yield u.json(), m = l.error;
2417
2417
  switch (u.status) {
2418
2418
  case 200:
2419
2419
  case 201:
@@ -2427,7 +2427,7 @@ class Yn {
2427
2427
  case 403:
2428
2428
  throw new $("Authentication failed when starting session", V.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 403, { cause: l.message });
2429
2429
  case 429:
2430
- 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 });
2430
+ throw m === "Concurrent session limit reached" ? new $("Concurrency limit reached, please upgrade your plan", V.CLIENT_ERROR_CODE_MAX_CONCURRENT_SESSIONS_REACHED, 429, { cause: l.message }) : m === "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 });
2431
2431
  case 503:
2432
2432
  throw new $("There are no available personas, please try again later", V.CLIENT_ERROR_CODE_SERVICE_BUSY, 503, { cause: l.message });
2433
2433
  default:
@@ -2466,7 +2466,7 @@ class Yn {
2466
2466
  return `${this.baseUrl}${this.apiVersion}`;
2467
2467
  }
2468
2468
  }
2469
- var Jn = function(t, e, n, o) {
2469
+ var Yn = function(t, e, n, o) {
2470
2470
  function c(a) {
2471
2471
  return a instanceof n ? a : new n(function(u) {
2472
2472
  u(a);
@@ -2480,7 +2480,7 @@ var Jn = function(t, e, n, o) {
2480
2480
  u(d);
2481
2481
  }
2482
2482
  }
2483
- function g(_) {
2483
+ function m(_) {
2484
2484
  try {
2485
2485
  p(o.throw(_));
2486
2486
  } catch (d) {
@@ -2488,7 +2488,7 @@ var Jn = function(t, e, n, o) {
2488
2488
  }
2489
2489
  }
2490
2490
  function p(_) {
2491
- _.done ? a(_.value) : c(_.value).then(l, g);
2491
+ _.done ? a(_.value) : c(_.value).then(l, m);
2492
2492
  }
2493
2493
  p((o = o.apply(t, e || [])).next());
2494
2494
  });
@@ -2498,7 +2498,7 @@ class Kn {
2498
2498
  this.baseUrl = e, this.sessionId = n, this.apiGatewayConfig = o;
2499
2499
  }
2500
2500
  sendTalkCommand(e) {
2501
- return Jn(this, void 0, void 0, function* () {
2501
+ return Yn(this, void 0, void 0, function* () {
2502
2502
  var n, o;
2503
2503
  try {
2504
2504
  let c, a = {
@@ -2511,15 +2511,15 @@ class Kn {
2511
2511
  a["X-Anam-Target-Url"] = p.href;
2512
2512
  } else
2513
2513
  c = `${this.baseUrl}${u}${l}`;
2514
- const g = yield fetch(c, {
2514
+ const m = yield fetch(c, {
2515
2515
  method: "POST",
2516
2516
  headers: a,
2517
2517
  body: JSON.stringify({
2518
2518
  content: e
2519
2519
  })
2520
2520
  });
2521
- if (!g.ok)
2522
- throw new Error(`Failed to send talk command: ${g.status} ${g.statusText}`);
2521
+ if (!m.ok)
2522
+ throw new Error(`Failed to send talk command: ${m.status} ${m.statusText}`);
2523
2523
  } catch (c) {
2524
2524
  throw console.error(c), new Error("EngineApiRestClient - sendTalkCommand: Failed to send talk command");
2525
2525
  }
@@ -2614,7 +2614,7 @@ var z;
2614
2614
  (function(t) {
2615
2615
  t[t.UNSTARTED = 0] = "UNSTARTED", t[t.STREAMING = 1] = "STREAMING", t[t.INTERRUPTED = 2] = "INTERRUPTED", t[t.ENDED = 3] = "ENDED";
2616
2616
  })(z || (z = {}));
2617
- var Et = function(t, e, n, o) {
2617
+ var pt = function(t, e, n, o) {
2618
2618
  function c(a) {
2619
2619
  return a instanceof n ? a : new n(function(u) {
2620
2620
  u(a);
@@ -2628,7 +2628,7 @@ var Et = function(t, e, n, o) {
2628
2628
  u(d);
2629
2629
  }
2630
2630
  }
2631
- function g(_) {
2631
+ function m(_) {
2632
2632
  try {
2633
2633
  p(o.throw(_));
2634
2634
  } catch (d) {
@@ -2636,7 +2636,7 @@ var Et = function(t, e, n, o) {
2636
2636
  }
2637
2637
  }
2638
2638
  function p(_) {
2639
- _.done ? a(_.value) : c(_.value).then(l, g);
2639
+ _.done ? a(_.value) : c(_.value).then(l, m);
2640
2640
  }
2641
2641
  p((o = o.apply(t, e || [])).next());
2642
2642
  });
@@ -2649,12 +2649,12 @@ class er {
2649
2649
  this.internalEventEmitter.removeListener(K.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this));
2650
2650
  }
2651
2651
  onSignalMessage(e) {
2652
- return Et(this, void 0, void 0, function* () {
2652
+ return pt(this, void 0, void 0, function* () {
2653
2653
  e.actionType === W.TALK_STREAM_INTERRUPTED && e.payload.correlationId === this.correlationId && (this.state = z.INTERRUPTED, this.onDeactivate());
2654
2654
  });
2655
2655
  }
2656
2656
  endMessage() {
2657
- return Et(this, void 0, void 0, function* () {
2657
+ return pt(this, void 0, void 0, function* () {
2658
2658
  if (this.state === z.ENDED) {
2659
2659
  console.warn("Talk stream is already ended via end of speech. No need to call endMessage.");
2660
2660
  return;
@@ -2673,7 +2673,7 @@ class er {
2673
2673
  });
2674
2674
  }
2675
2675
  streamMessageChunk(e, n) {
2676
- return Et(this, void 0, void 0, function* () {
2676
+ return pt(this, void 0, void 0, function* () {
2677
2677
  if (this.state !== z.STREAMING && this.state !== z.UNSTARTED)
2678
2678
  throw new Error("Talk stream is not in an active state: " + this.state);
2679
2679
  const o = {
@@ -2695,7 +2695,7 @@ class er {
2695
2695
  return this.state;
2696
2696
  }
2697
2697
  }
2698
- var J = function(t, e, n, o) {
2698
+ var Y = function(t, e, n, o) {
2699
2699
  function c(a) {
2700
2700
  return a instanceof n ? a : new n(function(u) {
2701
2701
  u(a);
@@ -2709,7 +2709,7 @@ var J = function(t, e, n, o) {
2709
2709
  u(d);
2710
2710
  }
2711
2711
  }
2712
- function g(_) {
2712
+ function m(_) {
2713
2713
  try {
2714
2714
  p(o.throw(_));
2715
2715
  } catch (d) {
@@ -2717,7 +2717,7 @@ var J = function(t, e, n, o) {
2717
2717
  }
2718
2718
  }
2719
2719
  function p(_) {
2720
- _.done ? a(_.value) : c(_.value).then(l, g);
2720
+ _.done ? a(_.value) : c(_.value).then(l, m);
2721
2721
  }
2722
2722
  p((o = o.apply(t, e || [])).next());
2723
2723
  });
@@ -2725,13 +2725,13 @@ var J = function(t, e, n, o) {
2725
2725
  const tr = 15e3, ir = 5e3, nr = 2;
2726
2726
  class rr {
2727
2727
  constructor(e, n, o, c) {
2728
- var a, u, l, g;
2728
+ var a, u, l, m;
2729
2729
  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 = {
2730
2730
  isMuted: !1,
2731
2731
  permissionState: fe.NOT_REQUESTED
2732
2732
  }, 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;
2733
2733
  const { inputAudio: p } = n;
2734
- this.inputAudioState = p.inputAudioState, n.inputAudio.userProvidedMediaStream && (this.inputAudioStream = n.inputAudio.userProvidedMediaStream), this.disableInputAudio = n.inputAudio.disableInputAudio === !0, this.internalEventEmitter.addListener(K.WEB_SOCKET_OPEN, this.onSignallingClientConnected.bind(this)), this.internalEventEmitter.addListener(K.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this)), this.iceServers = n.iceServers, this.signallingClient = new zn(e, n.signalling, this.publicEventEmitter, this.internalEventEmitter, this.apiGatewayConfig), this.engineApiRestClient = new Kn(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";
2734
+ this.inputAudioState = p.inputAudioState, n.inputAudio.userProvidedMediaStream && (this.inputAudioStream = n.inputAudio.userProvidedMediaStream), this.disableInputAudio = n.inputAudio.disableInputAudio === !0, this.internalEventEmitter.addListener(K.WEB_SOCKET_OPEN, this.onSignallingClientConnected.bind(this)), this.internalEventEmitter.addListener(K.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this)), this.iceServers = n.iceServers, this.signallingClient = new zn(e, n.signalling, this.publicEventEmitter, this.internalEventEmitter, this.apiGatewayConfig), this.engineApiRestClient = new Kn(n.engine.baseUrl, e, this.apiGatewayConfig), this.audioDeviceId = n.inputAudio.audioDeviceId, this.showPeerConnectionStatsReport = (u = (a = n.metrics) === null || a === void 0 ? void 0 : a.showPeerConnectionStatsReport) !== null && u !== void 0 ? u : !1, this.peerConnectionStatsReportOutputFormat = (m = (l = n.metrics) === null || l === void 0 ? void 0 : l.peerConnectionStatsReportOutputFormat) !== null && m !== void 0 ? m : "console";
2735
2735
  }
2736
2736
  onInputAudioStateChange(e, n) {
2737
2737
  e.isMuted !== n.isMuted && (n.isMuted ? this.muteAllAudioTracks() : this.unmuteAllAudioTracks());
@@ -2749,7 +2749,7 @@ class rr {
2749
2749
  });
2750
2750
  }
2751
2751
  startStatsCollection() {
2752
- this.statsCollectionInterval || (this.statsCollectionInterval = setInterval(() => J(this, void 0, void 0, function* () {
2752
+ this.statsCollectionInterval || (this.statsCollectionInterval = setInterval(() => Y(this, void 0, void 0, function* () {
2753
2753
  if (!(!this.peerConnection || !this.dataChannel || this.dataChannel.readyState !== "open"))
2754
2754
  try {
2755
2755
  const e = yield this.peerConnection.getStats();
@@ -2776,7 +2776,7 @@ class rr {
2776
2776
  const e = setTimeout(() => {
2777
2777
  this.successMetricPoller && (console.warn("No video frames received, there is a problem with the connection."), clearInterval(this.successMetricPoller), this.successMetricPoller = null);
2778
2778
  }, tr);
2779
- this.successMetricPoller = setInterval(() => J(this, void 0, void 0, function* () {
2779
+ this.successMetricPoller = setInterval(() => Y(this, void 0, void 0, function* () {
2780
2780
  if (!this.peerConnection || this.successMetricFired) {
2781
2781
  this.successMetricPoller && clearInterval(this.successMetricPoller), clearTimeout(e);
2782
2782
  return;
@@ -2807,7 +2807,7 @@ class rr {
2807
2807
  return this.peerConnection;
2808
2808
  }
2809
2809
  changeAudioInputDevice(e) {
2810
- return J(this, void 0, void 0, function* () {
2810
+ return Y(this, void 0, void 0, function* () {
2811
2811
  if (!this.peerConnection)
2812
2812
  throw new Error("StreamingClient - changeAudioInputDevice: peer connection is not initialized. Start streaming first.");
2813
2813
  if (e == null)
@@ -2863,12 +2863,12 @@ class rr {
2863
2863
  }
2864
2864
  }
2865
2865
  stopConnection() {
2866
- return J(this, void 0, void 0, function* () {
2866
+ return Y(this, void 0, void 0, function* () {
2867
2867
  yield this.shutdown();
2868
2868
  });
2869
2869
  }
2870
2870
  sendTalkCommand(e) {
2871
- return J(this, void 0, void 0, function* () {
2871
+ return Y(this, void 0, void 0, function* () {
2872
2872
  if (!this.peerConnection)
2873
2873
  throw new Error("StreamingClient - sendTalkCommand: peer connection is null");
2874
2874
  yield this.engineApiRestClient.sendTalkCommand(e);
@@ -2884,7 +2884,7 @@ class rr {
2884
2884
  return this.agentAudioInputStream;
2885
2885
  }
2886
2886
  initPeerConnection() {
2887
- return J(this, void 0, void 0, function* () {
2887
+ return Y(this, void 0, void 0, function* () {
2888
2888
  this.peerConnection = new RTCPeerConnection({
2889
2889
  iceServers: this.iceServers,
2890
2890
  iceCandidatePoolSize: nr
@@ -2894,7 +2894,7 @@ class rr {
2894
2894
  });
2895
2895
  }
2896
2896
  onSignalMessage(e) {
2897
- return J(this, void 0, void 0, function* () {
2897
+ return Y(this, void 0, void 0, function* () {
2898
2898
  if (!this.peerConnection) {
2899
2899
  console.error("StreamingClient - onSignalMessage: peerConnection is not initialized");
2900
2900
  return;
@@ -2921,8 +2921,8 @@ class rr {
2921
2921
  this.publicEventEmitter.emit(N.TALK_STREAM_INTERRUPTED, l.correlationId);
2922
2922
  break;
2923
2923
  case W.SESSION_READY:
2924
- const g = e.sessionId;
2925
- this.publicEventEmitter.emit(N.SESSION_READY, g);
2924
+ const m = e.sessionId;
2925
+ this.publicEventEmitter.emit(N.SESSION_READY, m);
2926
2926
  break;
2927
2927
  case W.HEARTBEAT:
2928
2928
  break;
@@ -2932,7 +2932,7 @@ class rr {
2932
2932
  });
2933
2933
  }
2934
2934
  onSignallingClientConnected() {
2935
- return J(this, void 0, void 0, function* () {
2935
+ return Y(this, void 0, void 0, function* () {
2936
2936
  if (!this.peerConnection)
2937
2937
  try {
2938
2938
  yield this.initPeerConnectionAndSendOffer();
@@ -2986,7 +2986,7 @@ class rr {
2986
2986
  * Set up the data channels for sending and receiving messages
2987
2987
  */
2988
2988
  setupDataChannels() {
2989
- return J(this, void 0, void 0, function* () {
2989
+ return Y(this, void 0, void 0, function* () {
2990
2990
  if (!this.peerConnection) {
2991
2991
  console.error("StreamingClient - setupDataChannels: peer connection is not initialized");
2992
2992
  return;
@@ -3029,7 +3029,7 @@ class rr {
3029
3029
  * Request microphone permission asynchronously without blocking connection
3030
3030
  */
3031
3031
  requestMicrophonePermissionAsync() {
3032
- return J(this, void 0, void 0, function* () {
3032
+ return Y(this, void 0, void 0, function* () {
3033
3033
  if (this.inputAudioState.permissionState !== fe.PENDING) {
3034
3034
  this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: fe.PENDING }), this.publicEventEmitter.emit(N.MIC_PERMISSION_PENDING);
3035
3035
  try {
@@ -3053,7 +3053,7 @@ class rr {
3053
3053
  * Set up audio track and add it to the peer connection using replaceTrack
3054
3054
  */
3055
3055
  setupAudioTrack() {
3056
- return J(this, void 0, void 0, function* () {
3056
+ return Y(this, void 0, void 0, function* () {
3057
3057
  if (!this.peerConnection || !this.inputAudioStream)
3058
3058
  return;
3059
3059
  if (!this.inputAudioStream.getAudioTracks().length) {
@@ -3077,7 +3077,7 @@ class rr {
3077
3077
  });
3078
3078
  }
3079
3079
  initPeerConnectionAndSendOffer() {
3080
- return J(this, void 0, void 0, function* () {
3080
+ return Y(this, void 0, void 0, function* () {
3081
3081
  if (yield this.initPeerConnection(), !this.peerConnection) {
3082
3082
  console.error("StreamingClient - initPeerConnectionAndSendOffer: peer connection is not initialized");
3083
3083
  return;
@@ -3094,7 +3094,7 @@ class rr {
3094
3094
  });
3095
3095
  }
3096
3096
  shutdown() {
3097
- return J(this, void 0, void 0, function* () {
3097
+ return Y(this, void 0, void 0, function* () {
3098
3098
  var e;
3099
3099
  if (this.showPeerConnectionStatsReport) {
3100
3100
  const n = yield (e = this.peerConnection) === null || e === void 0 ? void 0 : e.getStats();
@@ -3182,7 +3182,7 @@ var ue = function(t, e, n, o) {
3182
3182
  u(d);
3183
3183
  }
3184
3184
  }
3185
- function g(_) {
3185
+ function m(_) {
3186
3186
  try {
3187
3187
  p(o.throw(_));
3188
3188
  } catch (d) {
@@ -3190,14 +3190,14 @@ var ue = function(t, e, n, o) {
3190
3190
  }
3191
3191
  }
3192
3192
  function p(_) {
3193
- _.done ? a(_.value) : c(_.value).then(l, g);
3193
+ _.done ? a(_.value) : c(_.value).then(l, m);
3194
3194
  }
3195
3195
  p((o = o.apply(t, e || [])).next());
3196
3196
  });
3197
3197
  };
3198
3198
  class ar {
3199
3199
  constructor(e, n, o) {
3200
- var c, a, u, l, g;
3200
+ var c, a, u, l, m;
3201
3201
  this.inputAudioState = {
3202
3202
  isMuted: !1,
3203
3203
  permissionState: fe.NOT_REQUESTED
@@ -3205,7 +3205,7 @@ class ar {
3205
3205
  const p = this.validateClientConfig(e, n, o);
3206
3206
  if (p)
3207
3207
  throw new $(p, V.CLIENT_ERROR_CODE_CONFIGURATION_ERROR, 400);
3208
- this.personaConfig = n, this.clientOptions = o, (!((c = o?.api) === null || c === void 0) && c.baseUrl || !((a = o?.api) === null || a === void 0) && a.apiVersion) && Pn(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 && Fn(o.api.apiGateway), !((g = o?.metrics) === null || g === void 0) && g.disableClientMetrics && $n(!0), this.publicEventEmitter = new Qn(), this.internalEventEmitter = new Xn(), this.apiClient = new Yn(e, o?.apiKey, o?.api), this.messageHistoryClient = new Zn(this.publicEventEmitter, this.internalEventEmitter), this.reasoningHistoryClient = new sr(this.publicEventEmitter, this.internalEventEmitter);
3208
+ this.personaConfig = n, this.clientOptions = o, (!((c = o?.api) === null || c === void 0) && c.baseUrl || !((a = o?.api) === null || a === void 0) && a.apiVersion) && Pn(o.api.baseUrl || Hi, o.api.apiVersion || xt), !((l = (u = o?.api) === null || u === void 0 ? void 0 : u.apiGateway) === null || l === void 0) && l.enabled && Fn(o.api.apiGateway), !((m = o?.metrics) === null || m === void 0) && m.disableClientMetrics && $n(!0), this.publicEventEmitter = new Qn(), this.internalEventEmitter = new Xn(), this.apiClient = new Jn(e, o?.apiKey, o?.api), this.messageHistoryClient = new Zn(this.publicEventEmitter, this.internalEventEmitter), this.reasoningHistoryClient = new sr(this.publicEventEmitter, this.internalEventEmitter);
3209
3209
  }
3210
3210
  decodeJwt(e) {
3211
3211
  try {
@@ -3229,10 +3229,10 @@ class ar {
3229
3229
  this.organizationId = l.accountId, Se({
3230
3230
  organizationId: this.organizationId
3231
3231
  });
3232
- const g = (a = l.type) === null || a === void 0 ? void 0 : a.toLowerCase();
3233
- if (g === "legacy")
3232
+ const m = (a = l.type) === null || a === void 0 ? void 0 : a.toLowerCase();
3233
+ if (m === "legacy")
3234
3234
  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.";
3235
- if ((g === "ephemeral" || g === "stateful") && n)
3235
+ if ((m === "ephemeral" || m === "stateful") && n)
3236
3236
  return "This session token already contains a persona configuration. Please remove the personaConfig parameter.";
3237
3237
  } else if (!n)
3238
3238
  return "Missing persona config. Persona configuration must be provided when using apiKey";
@@ -3255,8 +3255,8 @@ class ar {
3255
3255
  }
3256
3256
  startSession(e) {
3257
3257
  return ue(this, void 0, void 0, function* () {
3258
- var n, o, c, a, u, l, g, p, _, d, S, m;
3259
- const y = this.personaConfig, A = this.buildStartSessionOptionsForClient(), b = yield this.apiClient.startSession(y, A), { sessionId: w, clientConfig: I, engineHost: R, engineProtocol: U, signallingEndpoint: x } = b, { heartbeatIntervalSeconds: Z, maxWsReconnectionAttempts: H, iceServers: ae } = I;
3258
+ var n, o, c, a, u, l, m, p, _, d, S, g;
3259
+ const y = this.personaConfig, I = this.buildStartSessionOptionsForClient(), A = yield this.apiClient.startSession(y, I), { sessionId: w, clientConfig: b, engineHost: T, engineProtocol: O, signallingEndpoint: x } = A, { heartbeatIntervalSeconds: Z, maxWsReconnectionAttempts: H, iceServers: ae } = b;
3260
3260
  this.sessionId = w, Se({
3261
3261
  sessionId: this.sessionId
3262
3262
  });
@@ -3264,14 +3264,14 @@ class ar {
3264
3264
  try {
3265
3265
  this.streamingClient = new rr(w, {
3266
3266
  engine: {
3267
- baseUrl: `${U}://${R}`
3267
+ baseUrl: `${O}://${T}`
3268
3268
  },
3269
3269
  signalling: {
3270
3270
  heartbeatIntervalSeconds: Z,
3271
3271
  maxWsReconnectionAttempts: H,
3272
3272
  url: {
3273
- baseUrl: R,
3274
- protocol: U,
3273
+ baseUrl: T,
3274
+ protocol: O,
3275
3275
  signallingPath: x
3276
3276
  }
3277
3277
  },
@@ -3284,8 +3284,8 @@ class ar {
3284
3284
  },
3285
3285
  apiGateway: (l = (u = this.clientOptions) === null || u === void 0 ? void 0 : u.api) === null || l === void 0 ? void 0 : l.apiGateway,
3286
3286
  metrics: {
3287
- 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,
3288
- 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"
3287
+ 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,
3288
+ 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"
3289
3289
  }
3290
3290
  }, this.publicEventEmitter, this.internalEventEmitter);
3291
3291
  } catch (re) {
@@ -3320,11 +3320,11 @@ class ar {
3320
3320
  }), 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) => {
3321
3321
  var a;
3322
3322
  const u = [];
3323
- let l = !1, g = !1;
3323
+ let l = !1, m = !1;
3324
3324
  this.publicEventEmitter.addListener(N.VIDEO_STREAM_STARTED, (p) => {
3325
- u.push(p), l = !0, g && c(u);
3325
+ u.push(p), l = !0, m && c(u);
3326
3326
  }), this.publicEventEmitter.addListener(N.AUDIO_STREAM_STARTED, (p) => {
3327
- u.push(p), g = !0, l && c(u);
3327
+ u.push(p), m = !0, l && c(u);
3328
3328
  }), (a = this.streamingClient) === null || a === void 0 || a.startConnection();
3329
3329
  });
3330
3330
  });
@@ -3486,44 +3486,57 @@ class ar {
3486
3486
  return this.sessionId;
3487
3487
  }
3488
3488
  }
3489
- const lr = (t, e) => new ar(t, void 0, e), cr = "https://api.anam.ai", X = Y(null), te = Y("idle"), Le = Y(!1), Ke = Y(!1), at = Y([]), Pe = Y(null), nt = Y(null), lt = Y(null), ct = Y(null), Dt = Y(null), ci = Y(!1), Fe = Y(!1);
3490
- function ur(t, e) {
3489
+ const lr = (t, e) => new ar(t, void 0, e), cr = "https://api.anam.ai";
3490
+ function ur(t) {
3491
+ try {
3492
+ const e = t.split(".")[1];
3493
+ return JSON.parse(atob(e));
3494
+ } catch {
3495
+ return {};
3496
+ }
3497
+ }
3498
+ const X = J(null), te = J("idle"), Le = J(!1), Ke = J(!1), at = J([]), Pe = J(null), nt = J(null), Ot = J(null), kt = J(null), Dt = J(null), ci = J(!1), Fe = J(!1);
3499
+ function dr(t, e) {
3491
3500
  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.";
3492
3501
  }
3493
- async function dr(t, e) {
3502
+ async function hr(t, e) {
3494
3503
  Fe.value = !1;
3495
3504
  try {
3496
3505
  const n = await fetch(`${e}/v1/personas/${t}/widget`);
3497
3506
  if (!n.ok) return;
3498
3507
  const o = await n.json();
3499
- lt.value = o.persona?.avatarImageUrl || null, ct.value = o.persona?.name || null, Dt.value = o.widgetConfig || null;
3508
+ Ot.value = o.persona?.avatarImageUrl || null, kt.value = o.persona?.name || null, Dt.value = o.widgetConfig || null;
3500
3509
  } catch {
3501
3510
  } finally {
3502
3511
  Fe.value = !0;
3503
3512
  }
3504
3513
  }
3505
- async function hr(t, e, n) {
3514
+ async function fr(t, e, n, o) {
3506
3515
  if (te.value === "connecting" || te.value === "connected")
3507
3516
  return;
3508
3517
  te.value = "connecting", Pe.value = null;
3509
- let o;
3518
+ let c;
3510
3519
  try {
3511
- console.log("[AnamWidget] Fetching session for agent:", t);
3512
- const c = await fetch(`${e}/v1/auth/widget`, {
3513
- method: "POST",
3514
- headers: { "Content-Type": "application/json" },
3515
- body: JSON.stringify({ agentId: t })
3516
- });
3517
- if (o = c.status, !c.ok) {
3518
- const g = await c.json().catch(() => ({}));
3519
- throw new Error(g.error || `HTTP ${c.status}`);
3520
- }
3521
- const a = await c.json();
3522
- console.log("[AnamWidget] Got session from agent-id:", {
3523
- persona: a.persona?.name,
3524
- hasToken: !!a.sessionToken
3525
- }), lt.value = a.persona?.avatarImageUrl || null, ct.value = a.persona?.name || null;
3526
- const u = lr(a.sessionToken, {
3520
+ let a;
3521
+ if (o)
3522
+ console.log("[AnamWidget] Using pre-created session token"), a = o;
3523
+ else {
3524
+ console.log("[AnamWidget] Fetching session for agent:", t);
3525
+ const m = await fetch(`${e}/v1/auth/widget`, {
3526
+ method: "POST",
3527
+ headers: { "Content-Type": "application/json" },
3528
+ body: JSON.stringify({ agentId: t })
3529
+ });
3530
+ if (c = m.status, !m.ok) {
3531
+ const _ = await m.json().catch(() => ({}));
3532
+ throw new Error(_.error || `HTTP ${m.status}`);
3533
+ }
3534
+ const p = await m.json();
3535
+ console.log("[AnamWidget] Got session from agent-id:", {
3536
+ hasToken: !!p.sessionToken
3537
+ }), a = p.sessionToken;
3538
+ }
3539
+ const u = lr(a, {
3527
3540
  api: e ? { baseUrl: e } : void 0,
3528
3541
  metrics: { disableClientMetrics: !0 }
3529
3542
  });
@@ -3533,23 +3546,23 @@ async function hr(t, e, n) {
3533
3546
  console.log("[AnamWidget] Video stream started"), Le.value = !0;
3534
3547
  }), u.addListener(N.AUDIO_STREAM_STARTED, () => {
3535
3548
  console.log("[AnamWidget] Audio stream started");
3536
- }), u.addListener(N.MESSAGE_HISTORY_UPDATED, (g) => {
3537
- at.value = [...g];
3538
- }), u.addListener(N.CONNECTION_CLOSED, (g, p) => {
3539
- console.log("[AnamWidget] Connection closed:", g, p), te.value = "idle", Le.value = !1, nt.value = null;
3540
- }), u.addListener(N.SESSION_READY, (g) => {
3541
- console.log("[AnamWidget] Session ready:", g), nt.value = g;
3549
+ }), u.addListener(N.MESSAGE_HISTORY_UPDATED, (m) => {
3550
+ at.value = [...m];
3551
+ }), u.addListener(N.CONNECTION_CLOSED, (m, p) => {
3552
+ console.log("[AnamWidget] Connection closed:", m, p), te.value = "idle", Le.value = !1, nt.value = null;
3553
+ }), u.addListener(N.SESSION_READY, (m) => {
3554
+ console.log("[AnamWidget] Session ready:", m), nt.value = m;
3542
3555
  }), X.value = u;
3543
3556
  const l = await u.stream();
3544
3557
  if (n && l.length > 0) {
3545
- const g = l.find((p) => p.getVideoTracks().length > 0);
3546
- g && (n.srcObject = g);
3558
+ const m = l.find((p) => p.getVideoTracks().length > 0);
3559
+ m && (n.srcObject = m);
3547
3560
  }
3548
- } catch (c) {
3549
- console.error("[AnamWidget] Failed to start session:", c), Pe.value = ur(c, o), te.value = "error", X.value = null;
3561
+ } catch (a) {
3562
+ console.error("[AnamWidget] Failed to start session:", a), Pe.value = dr(a, c), te.value = "error", X.value = null;
3550
3563
  }
3551
3564
  }
3552
- async function fr() {
3565
+ async function pr() {
3553
3566
  if (X.value)
3554
3567
  try {
3555
3568
  await X.value.stopStreaming();
@@ -3558,21 +3571,22 @@ async function fr() {
3558
3571
  }
3559
3572
  X.value = null, te.value = "idle", Le.value = !1, at.value = [];
3560
3573
  }
3561
- function pr(t) {
3574
+ function _r(t) {
3562
3575
  !X.value || te.value !== "connected" || X.value.sendUserMessage(t);
3563
3576
  }
3564
- function _r() {
3577
+ function Er() {
3565
3578
  X.value && (Ke.value ? (X.value.unmuteInputAudio(), Ke.value = !1) : (X.value.muteInputAudio(), Ke.value = !0));
3566
3579
  }
3567
- function Er() {
3580
+ function mr() {
3568
3581
  Fe.value = !0;
3569
3582
  }
3570
- function mr() {
3571
- X.value?.isStreaming() && X.value.stopStreaming(), X.value = null, te.value = "idle", Le.value = !1, at.value = [], Pe.value = null, nt.value = null, lt.value = null, ct.value = null, Dt.value = null;
3583
+ function gr() {
3584
+ X.value?.isStreaming() && X.value.stopStreaming(), X.value = null, te.value = "idle", Le.value = !1, at.value = [], Pe.value = null, nt.value = null, Ot.value = null, kt.value = null, Dt.value = null;
3572
3585
  }
3573
- function gr(t, e) {
3574
- ci.value = !!t;
3575
- const n = e || cr;
3586
+ function vr(t, e, n) {
3587
+ const o = t || (n ? ur(n).personaId : void 0);
3588
+ ci.value = !!o;
3589
+ const c = e || cr;
3576
3590
  return {
3577
3591
  connectionStatus: te,
3578
3592
  isStreaming: Le,
@@ -3582,53 +3596,53 @@ function gr(t, e) {
3582
3596
  sessionId: nt,
3583
3597
  hasAgentId: ci,
3584
3598
  isReady: Fe,
3585
- avatarThumbnailUrl: lt,
3586
- personaName: ct,
3599
+ avatarThumbnailUrl: Ot,
3600
+ personaName: kt,
3587
3601
  serverConfig: Dt,
3588
3602
  fetchWidgetConfig: () => {
3589
- if (!t) {
3603
+ if (!o) {
3590
3604
  Fe.value = !0;
3591
3605
  return;
3592
3606
  }
3593
- dr(t, n);
3607
+ hr(o, c);
3594
3608
  },
3595
- skipFetch: Er,
3596
- startSession: (a) => t ? hr(t, n, a) : (Pe.value = "No agent ID configured", Promise.resolve()),
3597
- stopSession: fr,
3598
- sendMessage: pr,
3599
- toggleMute: _r,
3600
- cleanup: mr
3609
+ skipFetch: mr,
3610
+ startSession: (l) => !o && !n ? (Pe.value = "No agent ID or session token configured", Promise.resolve()) : fr(o || "", c, l, n),
3611
+ stopSession: pr,
3612
+ sendMessage: _r,
3613
+ toggleMute: Er,
3614
+ cleanup: gr
3601
3615
  };
3602
3616
  }
3603
3617
  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{aspect-ratio:3/2;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}';
3604
- function It(t, e) {
3618
+ function wt(t, e) {
3605
3619
  const n = { ...t };
3606
3620
  for (const o of Object.keys(e)) {
3607
3621
  const c = e[o];
3608
- c !== void 0 && (c !== null && typeof c == "object" && !Array.isArray(c) && typeof n[o] == "object" && n[o] !== null && !Array.isArray(n[o]) ? n[o] = It(n[o], c) : n[o] = c);
3622
+ c !== void 0 && (c !== null && typeof c == "object" && !Array.isArray(c) && typeof n[o] == "object" && n[o] !== null && !Array.isArray(n[o]) ? n[o] = wt(n[o], c) : n[o] = c);
3609
3623
  }
3610
3624
  return n;
3611
3625
  }
3612
- const vr = () => /* @__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" }) }), yr = () => /* @__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" }) }), Sr = () => /* @__PURE__ */ C("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
3626
+ 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: [
3613
3627
  /* @__PURE__ */ C("path", { d: "M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z" }),
3614
3628
  /* @__PURE__ */ C("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
3615
3629
  /* @__PURE__ */ C("line", { x1: "12", y1: "19", x2: "12", y2: "22" })
3616
- ] }), wr = () => /* @__PURE__ */ C("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
3630
+ ] }), Cr = () => /* @__PURE__ */ C("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
3617
3631
  /* @__PURE__ */ C("line", { x1: "1", y1: "1", x2: "23", y2: "23" }),
3618
3632
  /* @__PURE__ */ C("path", { d: "M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V5a3 3 0 0 0-5.94-.6" }),
3619
3633
  /* @__PURE__ */ C("path", { d: "M17 16.95A7 7 0 0 1 5 12v-2m14 0v2c0 .87-.16 1.71-.46 2.49" }),
3620
3634
  /* @__PURE__ */ C("line", { x1: "12", y1: "19", x2: "12", y2: "22" })
3621
- ] }), Cr = () => /* @__PURE__ */ C("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
3635
+ ] }), Ir = () => /* @__PURE__ */ C("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
3622
3636
  /* @__PURE__ */ C("line", { x1: "22", y1: "2", x2: "11", y2: "13" }),
3623
3637
  /* @__PURE__ */ C("polygon", { points: "22 2 15 22 11 13 2 9 22 2" })
3624
- ] }), Ir = () => /* @__PURE__ */ C("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
3638
+ ] }), br = () => /* @__PURE__ */ C("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
3625
3639
  /* @__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" }),
3626
3640
  /* @__PURE__ */ C("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
3627
- ] }), bt = () => /* @__PURE__ */ C("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", style: { opacity: 0.3 }, children: [
3641
+ ] }), Ct = () => /* @__PURE__ */ C("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", style: { opacity: 0.3 }, children: [
3628
3642
  /* @__PURE__ */ C("circle", { cx: "24", cy: "18", r: "8", stroke: "white", "stroke-width": "2", fill: "none" }),
3629
3643
  /* @__PURE__ */ C("path", { d: "M8 42c0-8.837 7.163-16 16-16s16 7.163 16 16", stroke: "white", "stroke-width": "2", fill: "none" })
3630
3644
  ] });
3631
- function br({
3645
+ function Ar({
3632
3646
  config: t,
3633
3647
  session: e,
3634
3648
  videoRef: n,
@@ -3636,23 +3650,23 @@ function br({
3636
3650
  displayCta: c,
3637
3651
  onCollapse: a
3638
3652
  }) {
3639
- 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", b = e.connectionStatus.value === "error", w = e.isStreaming.value, I = !A && !y && !b, R = He(async () => {
3653
+ const u = Qe(null), [l, m] = Je(""), [p, _] = Je(null), [d, S] = Je(!1), g = Qe(null), y = e.connectionStatus.value === "connected", I = e.connectionStatus.value === "connecting", A = e.connectionStatus.value === "error", w = e.isStreaming.value, b = !I && !y && !A, T = He(async () => {
3640
3654
  n.current && await e.startSession(n.current);
3641
- }, []), U = He(async () => {
3655
+ }, []), O = He(async () => {
3642
3656
  await e.stopSession();
3643
3657
  }, []), x = He(() => {
3644
3658
  if (!l.trim()) return;
3645
3659
  const H = l.trim();
3646
- e.sendMessage(H), g(""), u.current?.focus(), m.current && clearTimeout(m.current), S(!1), _(H), m.current = window.setTimeout(() => {
3647
- S(!0), m.current = window.setTimeout(() => {
3660
+ e.sendMessage(H), m(""), u.current?.focus(), g.current && clearTimeout(g.current), S(!1), _(H), g.current = window.setTimeout(() => {
3661
+ S(!0), g.current = window.setTimeout(() => {
3648
3662
  _(null), S(!1);
3649
3663
  }, 400);
3650
3664
  }, 2600);
3651
3665
  }, [l]), Z = He((H) => {
3652
3666
  H.key === "Enter" && !H.shiftKey && (H.preventDefault(), x());
3653
3667
  }, [x]);
3654
- return yt(() => () => {
3655
- m.current && clearTimeout(m.current);
3668
+ return gt(() => () => {
3669
+ g.current && clearTimeout(g.current);
3656
3670
  }, []), /* @__PURE__ */ C("div", { class: "anam-sheet", children: [
3657
3671
  /* @__PURE__ */ C(
3658
3672
  "video",
@@ -3664,32 +3678,32 @@ function br({
3664
3678
  "data-hidden": w ? void 0 : "true"
3665
3679
  }
3666
3680
  ),
3667
- I && (e.hasAgentId.value ? (
3681
+ b && (e.hasAgentId.value ? (
3668
3682
  /* Has agent-id: show avatar or placeholder + CTA pill */
3669
3683
  /* @__PURE__ */ C("div", { class: "anam-overlay-idle", children: [
3670
- o ? /* @__PURE__ */ C("img", { src: o, alt: "Avatar" }) : /* @__PURE__ */ C(bt, {}),
3671
- /* @__PURE__ */ C("button", { class: "anam-cta-pill", onClick: R, children: [
3672
- /* @__PURE__ */ C(yr, {}),
3684
+ o ? /* @__PURE__ */ C("img", { src: o, alt: "Avatar" }) : /* @__PURE__ */ C(Ct, {}),
3685
+ /* @__PURE__ */ C("button", { class: "anam-cta-pill", onClick: T, children: [
3686
+ /* @__PURE__ */ C(Sr, {}),
3673
3687
  c
3674
3688
  ] })
3675
3689
  ] })
3676
3690
  ) : (
3677
3691
  /* No agent-id: unconfigured overlay */
3678
3692
  /* @__PURE__ */ C("div", { class: "anam-overlay-unconfigured", children: [
3679
- /* @__PURE__ */ C(bt, {}),
3693
+ /* @__PURE__ */ C(Ct, {}),
3680
3694
  /* @__PURE__ */ C("span", { children: "Agent not configured" })
3681
3695
  ] })
3682
3696
  )),
3683
- A && /* @__PURE__ */ C("div", { class: "anam-overlay-loading", children: [
3697
+ I && /* @__PURE__ */ C("div", { class: "anam-overlay-loading", children: [
3684
3698
  /* @__PURE__ */ C("span", { class: "anam-spinner" }),
3685
3699
  /* @__PURE__ */ C("span", { children: "Starting your conversation..." })
3686
3700
  ] }),
3687
- b && /* @__PURE__ */ C("div", { class: "anam-overlay-error", children: [
3701
+ A && /* @__PURE__ */ C("div", { class: "anam-overlay-error", children: [
3688
3702
  /* @__PURE__ */ C("div", { class: "anam-overlay-error-text", children: e.error.value || "Something went wrong" }),
3689
- /* @__PURE__ */ C("button", { class: "anam-retry-btn", onClick: R, children: "Try Again" })
3703
+ /* @__PURE__ */ C("button", { class: "anam-retry-btn", onClick: T, children: "Try Again" })
3690
3704
  ] }),
3691
3705
  (y || w) && /* @__PURE__ */ C(oe, { children: [
3692
- a && /* @__PURE__ */ C("button", { class: "anam-close-btn", onClick: a, "aria-label": "Close", children: /* @__PURE__ */ C(vr, {}) }),
3706
+ a && /* @__PURE__ */ C("button", { class: "anam-close-btn", onClick: a, "aria-label": "Close", children: /* @__PURE__ */ C(yr, {}) }),
3693
3707
  p && /* @__PURE__ */ C("div", { class: `anam-toast ${d ? "anam-toast-out" : ""}`, children: p }),
3694
3708
  /* @__PURE__ */ C("div", { class: "anam-control-bar", children: [
3695
3709
  t.showMuteButton && /* @__PURE__ */ C(
@@ -3698,7 +3712,7 @@ function br({
3698
3712
  class: `anam-ctl-btn ${e.isMuted.value ? "anam-ctl-btn-muted" : ""}`,
3699
3713
  onClick: () => e.toggleMute(),
3700
3714
  "aria-label": e.isMuted.value ? "Unmute" : "Mute",
3701
- children: e.isMuted.value ? /* @__PURE__ */ C(wr, {}) : /* @__PURE__ */ C(Sr, {})
3715
+ children: e.isMuted.value ? /* @__PURE__ */ C(Cr, {}) : /* @__PURE__ */ C(wr, {})
3702
3716
  }
3703
3717
  ),
3704
3718
  t.showTextInput && /* @__PURE__ */ C(oe, { children: [
@@ -3710,7 +3724,7 @@ function br({
3710
3724
  class: "anam-ctl-input",
3711
3725
  placeholder: t.textContents.placeholder,
3712
3726
  value: l,
3713
- onInput: (H) => g(H.target.value),
3727
+ onInput: (H) => m(H.target.value),
3714
3728
  onKeyDown: Z,
3715
3729
  disabled: !y
3716
3730
  }
@@ -3722,7 +3736,7 @@ function br({
3722
3736
  onClick: x,
3723
3737
  disabled: !y || !l.trim(),
3724
3738
  "aria-label": "Send message",
3725
- children: /* @__PURE__ */ C(Cr, {})
3739
+ children: /* @__PURE__ */ C(Ir, {})
3726
3740
  }
3727
3741
  )
3728
3742
  ] }),
@@ -3730,85 +3744,87 @@ function br({
3730
3744
  "button",
3731
3745
  {
3732
3746
  class: "anam-ctl-btn anam-ctl-end",
3733
- onClick: U,
3747
+ onClick: O,
3734
3748
  "aria-label": "End call",
3735
- children: /* @__PURE__ */ C(Ir, {})
3749
+ children: /* @__PURE__ */ C(br, {})
3736
3750
  }
3737
3751
  )
3738
3752
  ] })
3739
3753
  ] })
3740
3754
  ] });
3741
3755
  }
3742
- function Ar(t) {
3743
- const e = Qe(null), n = Gi(!1), o = gr(t["agent-id"], t["api-base-url"]), c = Ie(() => {
3756
+ function Tr(t) {
3757
+ const e = Qe(null), n = Gi(!1);
3758
+ 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.");
3759
+ const o = t["session-token"] ? void 0 : t["agent-id"], c = vr(o, t["api-base-url"], t["session-token"]), a = Ie(() => {
3744
3760
  if (t["override-config"])
3745
3761
  try {
3746
- const I = JSON.parse(t["override-config"]), R = It({ ...We }, I);
3747
- return R.mode === "orb" && (R.layout = "fixed"), R;
3748
- } catch (I) {
3749
- console.warn("[AnamWidget] Invalid override-config JSON:", I);
3750
- }
3751
- const b = o.serverConfig.value, w = b ? It({ ...We }, b) : { ...We };
3752
- return w.mode === "orb" && (w.layout = "fixed"), w;
3753
- }, [t["override-config"], o.serverConfig.value]);
3754
- yt(() => {
3762
+ const T = JSON.parse(t["override-config"]), O = wt({ ...We }, T);
3763
+ return O.mode === "orb" && (O.layout = "fixed"), O;
3764
+ } catch (T) {
3765
+ console.warn("[AnamWidget] Invalid override-config JSON:", T);
3766
+ }
3767
+ const w = c.serverConfig.value, b = w ? wt({ ...We }, w) : { ...We };
3768
+ return b.mode === "orb" && (b.layout = "fixed"), b;
3769
+ }, [t["override-config"], c.serverConfig.value]);
3770
+ gt(() => {
3755
3771
  if (t["override-config"]) {
3756
3772
  try {
3757
- const b = JSON.parse(t["override-config"]);
3758
- b.avatarImageUrl && (o.avatarThumbnailUrl.value = b.avatarImageUrl), b.personaName && (o.personaName.value = b.personaName);
3773
+ const w = JSON.parse(t["override-config"]);
3774
+ w.avatarImageUrl && (c.avatarThumbnailUrl.value = w.avatarImageUrl), w.personaName && (c.personaName.value = w.personaName);
3759
3775
  } catch {
3760
3776
  }
3761
- o.skipFetch();
3777
+ c.skipFetch();
3762
3778
  return;
3763
3779
  }
3764
- o.fetchWidgetConfig();
3765
- }, [t["agent-id"], t["api-base-url"], t["override-config"]]);
3766
- const a = o.avatarThumbnailUrl.value || null, u = c.textContents.callToAction === We.textContents.callToAction && o.personaName.value ? `Talk to ${o.personaName.value}` : c.textContents.callToAction, l = Ie(
3767
- () => `--anam-background: ${c.styles.backgroundColor}; --anam-text: ${c.styles.textColor};`,
3768
- [c.styles.backgroundColor, c.styles.textColor]
3769
- ), g = Ie(() => {
3770
- if (c.layout !== "fixed") return "";
3771
- const b = xn(c.position);
3772
- return Object.entries(b).map(([w, I]) => `${w}: ${I}`).join("; ");
3773
- }, [c.layout, c.position]), p = [l, g].filter(Boolean).join("; "), _ = Qe(!1), d = () => {
3774
- n.value = !0, _.current = !1, setTimeout(() => {
3775
- e.current && o.startSession(e.current);
3780
+ c.fetchWidgetConfig();
3781
+ }, [o, t["api-base-url"], t["override-config"], t["session-token"]]);
3782
+ const u = c.avatarThumbnailUrl.value || null, l = a.textContents.callToAction === We.textContents.callToAction && c.personaName.value ? `Talk to ${c.personaName.value}` : a.textContents.callToAction, m = Ie(
3783
+ () => `--anam-background: ${a.styles.backgroundColor}; --anam-text: ${a.styles.textColor};`,
3784
+ [a.styles.backgroundColor, a.styles.textColor]
3785
+ ), p = Ie(() => {
3786
+ if (a.layout !== "fixed") return "";
3787
+ const w = xn(a.position);
3788
+ return Object.entries(w).map(([b, T]) => `${b}: ${T}`).join("; ");
3789
+ }, [a.layout, a.position]), _ = [m, p].filter(Boolean).join("; "), d = Qe(!1), S = () => {
3790
+ n.value = !0, d.current = !1, setTimeout(() => {
3791
+ e.current && c.startSession(e.current);
3776
3792
  }, 50);
3777
- }, S = async () => {
3778
- o.connectionStatus.value !== "idle" && await o.stopSession(), _.current = !1, n.value = !1;
3779
- }, m = c.mode === "orb", y = o.connectionStatus.value;
3780
- (y === "connecting" || y === "connected") && (_.current = !0), yt(() => {
3781
- m && n.value && y === "idle" && _.current && (_.current = !1, n.value = !1);
3782
- }, [y]);
3783
- const A = m ? n.value : !0;
3784
- return o.isReady.value ? /* @__PURE__ */ C(oe, { children: [
3793
+ }, g = async () => {
3794
+ c.connectionStatus.value !== "idle" && await c.stopSession(), d.current = !1, n.value = !1;
3795
+ }, y = a.mode === "orb", I = c.connectionStatus.value;
3796
+ (I === "connecting" || I === "connected") && (d.current = !0), gt(() => {
3797
+ y && n.value && I === "idle" && d.current && (d.current = !1, n.value = !1);
3798
+ }, [I]);
3799
+ const A = y ? n.value : !0;
3800
+ return c.isReady.value ? /* @__PURE__ */ C(oe, { children: [
3785
3801
  /* @__PURE__ */ C("style", { children: ui }),
3786
3802
  /* @__PURE__ */ C(
3787
3803
  "div",
3788
3804
  {
3789
3805
  class: "anam-widget",
3790
- "data-mode": c.mode,
3791
- "data-layout": c.layout,
3792
- style: p,
3806
+ "data-mode": a.mode,
3807
+ "data-layout": a.layout,
3808
+ style: _,
3793
3809
  children: [
3794
- m && !n.value && /* @__PURE__ */ C(
3810
+ y && !n.value && /* @__PURE__ */ C(
3795
3811
  "button",
3796
3812
  {
3797
3813
  class: "anam-trigger",
3798
- onClick: d,
3799
- "aria-label": u,
3800
- children: a ? /* @__PURE__ */ C("img", { src: a, alt: "Avatar" }) : /* @__PURE__ */ C(bt, {})
3814
+ onClick: S,
3815
+ "aria-label": l,
3816
+ children: u ? /* @__PURE__ */ C("img", { src: u, alt: "Avatar" }) : /* @__PURE__ */ C(Ct, {})
3801
3817
  }
3802
3818
  ),
3803
3819
  A && /* @__PURE__ */ C(
3804
- br,
3820
+ Ar,
3805
3821
  {
3806
- config: c,
3807
- session: o,
3822
+ config: a,
3823
+ session: c,
3808
3824
  videoRef: e,
3809
- avatarSrc: a,
3810
- displayCta: u,
3811
- onCollapse: m ? S : null
3825
+ avatarSrc: u,
3826
+ displayCta: l,
3827
+ onCollapse: y ? g : null
3812
3828
  }
3813
3829
  )
3814
3830
  ]
@@ -3816,14 +3832,16 @@ function Ar(t) {
3816
3832
  )
3817
3833
  ] }) : /* @__PURE__ */ C("style", { children: ui });
3818
3834
  }
3819
- const Tr = [
3835
+ const Rr = [
3820
3836
  "agent-id",
3821
3837
  // Persona ID — required for session streaming + server config fetch
3822
3838
  "api-base-url",
3823
3839
  // API URL override (default: https://api.anam.ai)
3824
- "override-config"
3840
+ "override-config",
3825
3841
  // JSON string — bypasses server fetch when set
3826
- ], Nr = {
3842
+ "session-token"
3843
+ // Pre-created session token — skips /v1/auth/widget call when set
3844
+ ], xr = {
3827
3845
  SESSION_STARTED: "anam-agent:session-started",
3828
3846
  SESSION_ENDED: "anam-agent:session-ended",
3829
3847
  MESSAGE_RECEIVED: "anam-agent:message-received",
@@ -3835,13 +3853,13 @@ const Tr = [
3835
3853
  MIC_UNMUTED: "anam-agent:mic-unmuted"
3836
3854
  };
3837
3855
  function di(t = "anam-agent") {
3838
- pn(Ar, t, [...Tr], {
3856
+ pn(Tr, t, [...Rr], {
3839
3857
  shadow: !0
3840
3858
  });
3841
3859
  }
3842
3860
  typeof window < "u" && typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", () => di()) : di());
3843
3861
  export {
3844
3862
  We as DefaultConfig,
3845
- Nr as WidgetEventNames,
3863
+ xr as WidgetEventNames,
3846
3864
  di as registerWidget
3847
3865
  };