@anam-ai/agent-widget 0.6.1-alpha.1 → 0.7.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -58,6 +58,7 @@ Configure the widget entirely via HTML attributes. All are optional except `agen
58
58
  | `ui-text-input` | `true` \| `false` | `true` | Show text message input. |
59
59
  | `ui-captions` | `true` \| `false` | `false` | Show conversation captions. |
60
60
  | `ui-transcript` | `true` \| `false` | `true` | Show the expandable transcript pane during a call. |
61
+ | `ui-preview-video` | `true` \| `false` | `true` | Play the avatar's looping idle video before a call. Set to `false` to show the still image instead; the video is then not downloaded. |
61
62
  | `call-to-action` | string | `Talk to our assistant` | Text on the start button. |
62
63
  | `avatar-url` | string | — | Override avatar thumbnail image URL. |
63
64
  | `avatar-video-url` | string | — | Override avatar preview video URL. |
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var Ye, M, Ii, bi, ye, Jt, wi, Ri, Ai, Mt, It, bt, Ge = {}, Oi = [], Cn = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, lt = Array.isArray;
1
+ var Ke, M, Ii, bi, ye, Jt, wi, Ri, Ai, Mt, It, bt, He = {}, Oi = [], Cn = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, lt = Array.isArray;
2
2
  function le(t, e) {
3
3
  for (var i in e) t[i] = e[i];
4
4
  return t;
@@ -9,10 +9,10 @@ function Dt(t) {
9
9
  function xe(t, e, i) {
10
10
  var n, a, s, c = {};
11
11
  for (s in e) s == "key" ? n = e[s] : s == "ref" ? a = e[s] : c[s] = e[s];
12
- if (arguments.length > 2 && (c.children = arguments.length > 3 ? Ye.call(arguments, 2) : i), typeof t == "function" && t.defaultProps != null) for (s in t.defaultProps) c[s] === void 0 && (c[s] = t.defaultProps[s]);
13
- return We(t, c, n, a, null);
12
+ if (arguments.length > 2 && (c.children = arguments.length > 3 ? Ke.call(arguments, 2) : i), typeof t == "function" && t.defaultProps != null) for (s in t.defaultProps) c[s] === void 0 && (c[s] = t.defaultProps[s]);
13
+ return je(t, c, n, a, null);
14
14
  }
15
- function We(t, e, i, n, a) {
15
+ function je(t, e, i, n, a) {
16
16
  var s = { type: t, props: e, key: i, ref: n, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: a ?? ++Ii, __i: -1, __u: 0 };
17
17
  return a == null && M.vnode != null && M.vnode(s), s;
18
18
  }
@@ -46,12 +46,12 @@ function rt() {
46
46
  }
47
47
  function Ni(t, e, i, n, a, s, c, l, m, f, p) {
48
48
  var u, y, E, T, I, w, A, R = n && n.__k || Oi, b = e.length;
49
- for (m = Sn(i, e, R, m, b), u = 0; u < b; u++) (E = i.__k[u]) != null && (y = E.__i == -1 ? Ge : R[E.__i] || Ge, E.__i = u, w = Ut(t, E, y, a, s, c, l, m, f, p), T = E.__e, E.ref && y.ref != E.ref && (y.ref && Pt(y.ref, null, E), p.push(E.ref, E.__c || T, E)), I == null && T != null && (I = T), (A = !!(4 & E.__u)) || y.__k === E.__k ? m = ki(E, m, t, A) : typeof E.type == "function" && w !== void 0 ? m = w : T && (m = T.nextSibling), E.__u &= -7);
49
+ for (m = Sn(i, e, R, m, b), u = 0; u < b; u++) (E = i.__k[u]) != null && (y = E.__i == -1 ? He : R[E.__i] || He, E.__i = u, w = Ut(t, E, y, a, s, c, l, m, f, p), T = E.__e, E.ref && y.ref != E.ref && (y.ref && Pt(y.ref, null, E), p.push(E.ref, E.__c || T, E)), I == null && T != null && (I = T), (A = !!(4 & E.__u)) || y.__k === E.__k ? m = ki(E, m, t, A) : typeof E.type == "function" && w !== void 0 ? m = w : T && (m = T.nextSibling), E.__u &= -7);
50
50
  return i.__e = I, m;
51
51
  }
52
52
  function Sn(t, e, i, n, a) {
53
53
  var s, c, l, m, f, p = i.length, u = p, y = 0;
54
- for (t.__k = new Array(a), s = 0; s < a; s++) (c = e[s]) != null && typeof c != "boolean" && typeof c != "function" ? (typeof c == "string" || typeof c == "number" || typeof c == "bigint" || c.constructor == String ? c = t.__k[s] = We(null, c, null, null, null) : lt(c) ? c = t.__k[s] = We(Ce, { children: c }, null, null, null) : c.constructor === void 0 && c.__b > 0 ? c = t.__k[s] = We(c.type, c.props, c.key, c.ref ? c.ref : null, c.__v) : t.__k[s] = c, m = s + y, c.__ = t, c.__b = t.__b + 1, l = null, (f = c.__i = Tn(c, i, m, u)) != -1 && (u--, (l = i[f]) && (l.__u |= 2)), l == null || l.__v == null ? (f == -1 && (a > p ? y-- : a < p && y++), typeof c.type != "function" && (c.__u |= 4)) : f != m && (f == m - 1 ? y-- : f == m + 1 ? y++ : (f > m ? y-- : y++, c.__u |= 4))) : t.__k[s] = null;
54
+ for (t.__k = new Array(a), s = 0; s < a; s++) (c = e[s]) != null && typeof c != "boolean" && typeof c != "function" ? (typeof c == "string" || typeof c == "number" || typeof c == "bigint" || c.constructor == String ? c = t.__k[s] = je(null, c, null, null, null) : lt(c) ? c = t.__k[s] = je(Ce, { children: c }, null, null, null) : c.constructor === void 0 && c.__b > 0 ? c = t.__k[s] = je(c.type, c.props, c.key, c.ref ? c.ref : null, c.__v) : t.__k[s] = c, m = s + y, c.__ = t, c.__b = t.__b + 1, l = null, (f = c.__i = Tn(c, i, m, u)) != -1 && (u--, (l = i[f]) && (l.__u |= 2)), l == null || l.__v == null ? (f == -1 && (a > p ? y-- : a < p && y++), typeof c.type != "function" && (c.__u |= 4)) : f != m && (f == m - 1 ? y-- : f == m + 1 ? y++ : (f > m ? y-- : y++, c.__u |= 4))) : t.__k[s] = null;
55
55
  if (u) for (s = 0; s < p; s++) (l = i[s]) != null && (2 & l.__u) == 0 && (l.__e == n && (n = Le(l)), Di(l, l));
56
56
  return n;
57
57
  }
@@ -78,7 +78,7 @@ function Tn(t, e, i, n) {
78
78
  function Zt(t, e, i) {
79
79
  e[0] == "-" ? t.setProperty(e, i ?? "") : t[e] = i == null ? "" : typeof i != "number" || Cn.test(e) ? i : i + "px";
80
80
  }
81
- function Ze(t, e, i, n, a) {
81
+ function Qe(t, e, i, n, a) {
82
82
  var s, c;
83
83
  e: if (e == "style") if (typeof i == "string") t.style.cssText = i;
84
84
  else {
@@ -164,7 +164,7 @@ function Mi(t) {
164
164
  return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : lt(t) ? t.map(Mi) : le({}, t);
165
165
  }
166
166
  function yn(t, e, i, n, a, s, c, l, m) {
167
- var f, p, u, y, E, T, I, w = i.props || Ge, A = e.props, R = e.type;
167
+ var f, p, u, y, E, T, I, w = i.props || He, A = e.props, R = e.type;
168
168
  if (R == "svg" ? a = "http://www.w3.org/2000/svg" : R == "math" ? a = "http://www.w3.org/1998/Math/MathML" : a || (a = "http://www.w3.org/1999/xhtml"), s != null) {
169
169
  for (f = 0; f < s.length; f++) if ((E = s[f]) && "setAttribute" in E == !!R && (R ? E.localName == R : E.nodeType == 3)) {
170
170
  t = E, s[f] = null;
@@ -177,18 +177,18 @@ function yn(t, e, i, n, a, s, c, l, m) {
177
177
  }
178
178
  if (R == null) w === A || l && t.data == A || (t.data = A);
179
179
  else {
180
- if (s = s && Ye.call(t.childNodes), !l && s != null) for (w = {}, f = 0; f < t.attributes.length; f++) w[(E = t.attributes[f]).name] = E.value;
180
+ if (s = s && Ke.call(t.childNodes), !l && s != null) for (w = {}, f = 0; f < t.attributes.length; f++) w[(E = t.attributes[f]).name] = E.value;
181
181
  for (f in w) if (E = w[f], f != "children") {
182
182
  if (f == "dangerouslySetInnerHTML") u = E;
183
183
  else if (!(f in A)) {
184
184
  if (f == "value" && "defaultValue" in A || f == "checked" && "defaultChecked" in A) continue;
185
- Ze(t, f, null, E, a);
185
+ Qe(t, f, null, E, a);
186
186
  }
187
187
  }
188
- for (f in A) E = A[f], f == "children" ? y = E : f == "dangerouslySetInnerHTML" ? p = E : f == "value" ? T = E : f == "checked" ? I = E : l && typeof E != "function" || w[f] === E || Ze(t, f, E, w[f], a);
188
+ for (f in A) E = A[f], f == "children" ? y = E : f == "dangerouslySetInnerHTML" ? p = E : f == "value" ? T = E : f == "checked" ? I = E : l && typeof E != "function" || w[f] === E || Qe(t, f, E, w[f], a);
189
189
  if (p) l || u && (p.__html == u.__html || p.__html == t.innerHTML) || (t.innerHTML = p.__html), e.__k = [];
190
190
  else if (u && (t.innerHTML = ""), Ni(e.type == "template" ? t.content : t, lt(y) ? y : [y], e, i, n, R == "foreignObject" ? "http://www.w3.org/1999/xhtml" : a, s, c, s ? s[0] : i.__k && Le(i, 0), l, m), s != null) for (f = s.length; f--; ) Dt(s[f]);
191
- l || (f = "value", R == "progress" && T == null ? t.removeAttribute("value") : T != null && (T !== t[f] || R == "progress" && !T || R == "option" && T != w[f]) && Ze(t, f, T, w[f], a), f = "checked", I != null && I != t[f] && Ze(t, f, I, w[f], a));
191
+ l || (f = "value", R == "progress" && T == null ? t.removeAttribute("value") : T != null && (T !== t[f] || R == "progress" && !T || R == "option" && T != w[f]) && Qe(t, f, T, w[f], a), f = "checked", I != null && I != t[f] && Qe(t, f, I, w[f], a));
192
192
  }
193
193
  return t;
194
194
  }
@@ -220,7 +220,7 @@ function In(t, e, i) {
220
220
  }
221
221
  function ct(t, e, i) {
222
222
  var n, a, s, c;
223
- e == document && (e = document.documentElement), M.__ && M.__(t, e), a = (n = typeof i == "function") ? null : i && i.__k || e.__k, s = [], c = [], Ut(e, t = (!n && i || e).__k = xe(Ce, null, [t]), a || Ge, Ge, e.namespaceURI, !n && i ? [i] : a ? null : e.firstChild ? Ye.call(e.childNodes) : null, s, !n && i ? i : a ? a.__e : e.firstChild, n, c), Li(s, t, c);
223
+ e == document && (e = document.documentElement), M.__ && M.__(t, e), a = (n = typeof i == "function") ? null : i && i.__k || e.__k, s = [], c = [], Ut(e, t = (!n && i || e).__k = xe(Ce, null, [t]), a || He, He, e.namespaceURI, !n && i ? [i] : a ? null : e.firstChild ? Ke.call(e.childNodes) : null, s, !n && i ? i : a ? a.__e : e.firstChild, n, c), Li(s, t, c);
224
224
  }
225
225
  function Ui(t, e) {
226
226
  ct(t, e, Ui);
@@ -228,9 +228,9 @@ function Ui(t, e) {
228
228
  function Pi(t, e, i) {
229
229
  var n, a, s, c, l = le({}, t.props);
230
230
  for (s in t.type && t.type.defaultProps && (c = t.type.defaultProps), e) s == "key" ? n = e[s] : s == "ref" ? a = e[s] : l[s] = e[s] === void 0 && c != null ? c[s] : e[s];
231
- return arguments.length > 2 && (l.children = arguments.length > 3 ? Ye.call(arguments, 2) : i), We(t.type, l, n || t.key, a || t.ref, null);
231
+ return arguments.length > 2 && (l.children = arguments.length > 3 ? Ke.call(arguments, 2) : i), je(t.type, l, n || t.key, a || t.ref, null);
232
232
  }
233
- Ye = Oi.slice, M = { __e: function(t, e, i, n) {
233
+ Ke = Oi.slice, M = { __e: function(t, e, i, n) {
234
234
  for (var a, s, c; e = e.__; ) if ((a = e.__c) && !a.__) try {
235
235
  if ((s = a.constructor) && s.getDerivedStateFromError != null && (a.setState(s.getDerivedStateFromError(t)), c = a.__d), a.componentDidCatch != null && (a.componentDidCatch(t, n || {}), c = a.__d), c) return a.__E = a;
236
236
  } catch (l) {
@@ -334,17 +334,17 @@ function C(t, e, i, n, a, s) {
334
334
  if (typeof t == "function" && (c = t.defaultProps)) for (l in c) m[l] === void 0 && (m[l] = c[l]);
335
335
  return M.vnode && M.vnode(f), f;
336
336
  }
337
- var He, W, _t, ti, ze = 0, Vi = [], j = M, ii = j.__b, ni = j.__r, ri = j.diffed, oi = j.__c, si = j.unmount, ai = j.__;
337
+ var ze, W, _t, ti, qe = 0, Vi = [], j = M, ii = j.__b, ni = j.__r, ri = j.diffed, oi = j.__c, si = j.unmount, ai = j.__;
338
338
  function Bt(t, e) {
339
- j.__h && j.__h(W, t, ze || e), ze = 0;
339
+ j.__h && j.__h(W, t, qe || e), qe = 0;
340
340
  var i = W.__H || (W.__H = { __: [], __h: [] });
341
341
  return t >= i.__.length && i.__.push({}), i.__[t];
342
342
  }
343
343
  function Rt(t) {
344
- return ze = 1, Ln(ji, t);
344
+ return qe = 1, Ln(ji, t);
345
345
  }
346
346
  function Ln(t, e, i) {
347
- var n = Bt(He++, 2);
347
+ var n = Bt(ze++, 2);
348
348
  if (n.t = t, !n.__c && (n.__ = [ji(void 0, e), function(l) {
349
349
  var m = n.__N ? n.__N[0] : n.__[0], f = n.t(m, l);
350
350
  m !== f && (n.__N = [f, n.__[1]], n.__c.setState({}));
@@ -378,20 +378,20 @@ function Ln(t, e, i) {
378
378
  return n.__N || n.__;
379
379
  }
380
380
  function Ie(t, e) {
381
- var i = Bt(He++, 3);
381
+ var i = Bt(ze++, 3);
382
382
  !j.__s && Wi(i.__H, e) && (i.__ = t, i.u = e, W.__H.__h.push(i));
383
383
  }
384
- function qe(t) {
385
- return ze = 5, ke(function() {
384
+ function Ye(t) {
385
+ return qe = 5, ke(function() {
386
386
  return { current: t };
387
387
  }, []);
388
388
  }
389
389
  function ke(t, e) {
390
- var i = Bt(He++, 7);
390
+ var i = Bt(ze++, 7);
391
391
  return Wi(i.__H, e) && (i.__ = t(), i.__H = e, i.__h = t), i.__;
392
392
  }
393
- function Ve(t, e) {
394
- return ze = 8, ke(function() {
393
+ function We(t, e) {
394
+ return qe = 8, ke(function() {
395
395
  return t;
396
396
  }, e);
397
397
  }
@@ -407,11 +407,11 @@ j.__b = function(t) {
407
407
  }, j.__ = function(t, e) {
408
408
  t && e.__k && e.__k.__m && (t.__m = e.__k.__m), ai && ai(t, e);
409
409
  }, j.__r = function(t) {
410
- ni && ni(t), He = 0;
410
+ ni && ni(t), ze = 0;
411
411
  var e = (W = t.__c).__H;
412
412
  e && (_t === W ? (e.__h = [], W.__h = [], e.__.forEach(function(i) {
413
413
  i.__N && (i.__ = i.__N), i.u = i.__N = void 0;
414
- })) : (e.__h.forEach(it), e.__h.forEach(At), e.__h = [], He = 0)), _t = W;
414
+ })) : (e.__h.forEach(it), e.__h.forEach(At), e.__h = [], ze = 0)), _t = W;
415
415
  }, j.diffed = function(t) {
416
416
  ri && ri(t);
417
417
  var e = t.__c;
@@ -469,9 +469,9 @@ function dt() {
469
469
  if (ge > 1)
470
470
  ge--;
471
471
  else {
472
- for (var t, e = !1; je !== void 0; ) {
473
- var i = je;
474
- for (je = void 0, Ot++; i !== void 0; ) {
472
+ for (var t, e = !1; Ge !== void 0; ) {
473
+ var i = Ge;
474
+ for (Ge = void 0, Ot++; i !== void 0; ) {
475
475
  var n = i.o;
476
476
  if (i.o = void 0, i.f &= -3, !(8 & i.f) && zi(i)) try {
477
477
  i.c();
@@ -503,7 +503,7 @@ function Gi(t) {
503
503
  L = e;
504
504
  }
505
505
  }
506
- var je = void 0, ge = 0, Ot = 0, st = 0;
506
+ var Ge = void 0, ge = 0, Ot = 0, st = 0;
507
507
  function Hi(t) {
508
508
  if (L !== void 0) {
509
509
  var e = t.n;
@@ -539,7 +539,7 @@ X.prototype.U = function(t) {
539
539
  };
540
540
  X.prototype.subscribe = function(t) {
541
541
  var e = this;
542
- return Ke(function() {
542
+ return Je(function() {
543
543
  var i = e.value, n = L;
544
544
  L = void 0;
545
545
  try {
@@ -694,7 +694,7 @@ De.prototype.S = function() {
694
694
  return L = this, Bn.bind(this, t);
695
695
  };
696
696
  De.prototype.N = function() {
697
- 2 & this.f || (this.f |= 2, this.o = je, je = this);
697
+ 2 & this.f || (this.f |= 2, this.o = Ge, Ge = this);
698
698
  };
699
699
  De.prototype.d = function() {
700
700
  this.f |= 8, 1 & this.f || Ft(this);
@@ -702,7 +702,7 @@ De.prototype.d = function() {
702
702
  De.prototype.dispose = function() {
703
703
  this.d();
704
704
  };
705
- function Ke(t, e) {
705
+ function Je(t, e) {
706
706
  var i = new De(t, e);
707
707
  try {
708
708
  i.c();
@@ -713,7 +713,7 @@ function Ke(t, e) {
713
713
  return n[Symbol.dispose] = n, n;
714
714
  }
715
715
  var Ji, mt, Fn = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, Xi = [];
716
- Ke(function() {
716
+ Je(function() {
717
717
  Ji = this.N;
718
718
  })();
719
719
  function Ue(t, e) {
@@ -736,7 +736,7 @@ function Zi(t) {
736
736
  return E === 0 ? 0 : E === !0 ? "" : E || "";
737
737
  }), p = ci(function() {
738
738
  return !Array.isArray(f.value) && !bi(f.value);
739
- }), u = Ke(function() {
739
+ }), u = Je(function() {
740
740
  if (this.N = en, p.value) {
741
741
  var E = f.value;
742
742
  l.__v && l.__v.__e && l.__v.__e.nodeType === 3 && (l.__v.__e.data = E);
@@ -768,7 +768,7 @@ Ue("__r", function(t, e) {
768
768
  var i, n = e.__c;
769
769
  n && (n.__$f &= -2, (i = n.__$u) === void 0 && (n.__$u = i = (function(a, s) {
770
770
  var c;
771
- return Ke(function() {
771
+ return Je(function() {
772
772
  c = this;
773
773
  }, { name: s }), c.c = a, c;
774
774
  })(function() {
@@ -806,7 +806,7 @@ function $n(t, e, i, n) {
806
806
  var a = e in t && t.ownerSVGElement === void 0, s = q(i);
807
807
  return { o: function(c, l) {
808
808
  s.value = c, n = l;
809
- }, d: Ke(function() {
809
+ }, d: Je(function() {
810
810
  this.N = en;
811
811
  var c = s.value.value;
812
812
  n[e] !== c && (n[e] = c, a ? t[e] = c : c != null && (c !== !1 || e[4] === "-") ? t.setAttribute(e, c) : t.removeAttribute(e));
@@ -875,9 +875,10 @@ const di = {
875
875
  showTextInput: !0,
876
876
  showMuteButton: !0,
877
877
  showTranscript: !0,
878
+ showPreviewVideo: !0,
878
879
  removeWatermark: !1,
879
880
  callToAction: "Talk to our assistant"
880
- }, Qe = {
881
+ }, et = {
881
882
  "bottom-right": { bottom: "24px", right: "24px" },
882
883
  "bottom-left": { bottom: "24px", left: "24px" },
883
884
  "top-right": { top: "24px", right: "24px" },
@@ -894,10 +895,10 @@ const di = {
894
895
  "margin-left"
895
896
  ]);
896
897
  function Gn(t) {
897
- if (Qe[t])
898
- return Qe[t];
898
+ if (et[t])
899
+ return et[t];
899
900
  const e = t.match(/^\[(.+)\]$/);
900
- if (!e) return Qe["bottom-right"];
901
+ if (!e) return et["bottom-right"];
901
902
  const i = {};
902
903
  for (const n of e[1].split(",")) {
903
904
  const a = n.trim(), s = a.lastIndexOf("-");
@@ -907,7 +908,7 @@ function Gn(t) {
907
908
  const l = a.slice(s + 1);
908
909
  /^[\w.%-]+$/.test(l) && (i[c] = /^\d+$/.test(l) ? `${l}px` : l);
909
910
  }
910
- return Object.keys(i).length > 0 ? i : Qe["bottom-right"];
911
+ return Object.keys(i).length > 0 ? i : et["bottom-right"];
911
912
  }
912
913
  var gt = {}, Be = {}, ui;
913
914
  function Hn() {
@@ -957,10 +958,10 @@ function Hn() {
957
958
  }
958
959
  return Be;
959
960
  }
960
- var et = {};
961
+ var tt = {};
961
962
  var hi;
962
963
  function zn() {
963
- return hi || (hi = 1, et.read = function(t, e, i, n, a) {
964
+ return hi || (hi = 1, tt.read = function(t, e, i, n, a) {
964
965
  var s, c, l = a * 8 - n - 1, m = (1 << l) - 1, f = m >> 1, p = -7, u = i ? a - 1 : 0, y = i ? -1 : 1, E = t[e + u];
965
966
  for (u += y, s = E & (1 << -p) - 1, E >>= -p, p += l; p > 0; s = s * 256 + t[e + u], u += y, p -= 8)
966
967
  ;
@@ -974,14 +975,14 @@ function zn() {
974
975
  c = c + Math.pow(2, n), s = s - f;
975
976
  }
976
977
  return (E ? -1 : 1) * c * Math.pow(2, s - n);
977
- }, et.write = function(t, e, i, n, a, s) {
978
+ }, tt.write = function(t, e, i, n, a, s) {
978
979
  var c, l, m, f = s * 8 - a - 1, p = (1 << f) - 1, u = p >> 1, y = a === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, E = n ? 0 : s - 1, T = n ? 1 : -1, I = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
979
980
  for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (l = isNaN(e) ? 1 : 0, c = p) : (c = Math.floor(Math.log(e) / Math.LN2), e * (m = Math.pow(2, -c)) < 1 && (c--, m *= 2), c + u >= 1 ? e += y / m : e += y * Math.pow(2, 1 - u), e * m >= 2 && (c++, m /= 2), c + u >= p ? (l = 0, c = p) : c + u >= 1 ? (l = (e * m - 1) * Math.pow(2, a), c = c + u) : (l = e * Math.pow(2, u - 1) * Math.pow(2, a), c = 0)); a >= 8; t[i + E] = l & 255, E += T, l /= 256, a -= 8)
980
981
  ;
981
982
  for (c = c << a | l, f += a; f > 0; t[i + E] = c & 255, E += T, c /= 256, f -= 8)
982
983
  ;
983
984
  t[i + E - T] |= I * 128;
984
- }), et;
985
+ }), tt;
985
986
  }
986
987
  var fi;
987
988
  function qn() {
@@ -1231,7 +1232,7 @@ function qn() {
1231
1232
  for (d || (d = "utf8"); ; )
1232
1233
  switch (d) {
1233
1234
  case "hex":
1234
- return Je(this, r, o);
1235
+ return Xe(this, r, o);
1235
1236
  case "utf8":
1236
1237
  case "utf-8":
1237
1238
  return ue(this, r, o);
@@ -1377,16 +1378,16 @@ function qn() {
1377
1378
  return v;
1378
1379
  }
1379
1380
  function Y(d, r, o, h) {
1380
- return Xe(ft(r, d.length - o), d, o, h);
1381
+ return Ze(ft(r, d.length - o), d, o, h);
1381
1382
  }
1382
1383
  function oe(d, r, o, h) {
1383
- return Xe(mn(r), d, o, h);
1384
+ return Ze(mn(r), d, o, h);
1384
1385
  }
1385
1386
  function K(d, r, o, h) {
1386
- return Xe(Kt(r), d, o, h);
1387
+ return Ze(Kt(r), d, o, h);
1387
1388
  }
1388
1389
  function te(d, r, o, h) {
1389
- return Xe(gn(r, d.length - o), d, o, h);
1390
+ return Ze(gn(r, d.length - o), d, o, h);
1390
1391
  }
1391
1392
  l.prototype.write = function(r, o, h, _) {
1392
1393
  if (o === void 0)
@@ -1489,7 +1490,7 @@ function qn() {
1489
1490
  h += String.fromCharCode(d[_]);
1490
1491
  return h;
1491
1492
  }
1492
- function Je(d, r, o) {
1493
+ function Xe(d, r, o) {
1493
1494
  const h = d.length;
1494
1495
  (!r || r < 0) && (r = 0), (!o || o < 0 || o > h) && (o = h);
1495
1496
  let _ = "";
@@ -1895,7 +1896,7 @@ function qn() {
1895
1896
  function Kt(d) {
1896
1897
  return e.toByteArray(_n(d));
1897
1898
  }
1898
- function Xe(d, r, o, h) {
1899
+ function Ze(d, r, o, h) {
1899
1900
  let _;
1900
1901
  for (_ = 0; _ < h && !(_ + o >= r.length || _ >= d.length); ++_)
1901
1902
  r[_ + o] = d[_];
@@ -4649,7 +4650,7 @@ function Xr(t) {
4649
4650
  t.generation++, t.stopAttempt?.(), t.stopAttempt = null, t.client.value = null, t.connectionStatus.value = "idle", t.isStreaming.value = !1, t.isMuted.value = !1, Vt(t), t.captionTimer && clearTimeout(t.captionTimer), t.captionTimer = null, t.caption.value = null, t.sentCaptionTimer && clearTimeout(t.sentCaptionTimer), t.sentCaptionTimer = null, t.sentCaption.value = null, t.error.value = null, t.sessionId.value = null, t.avatarThumbnailUrl.value = null, t.avatarVideoUrl.value = null, t.personaName.value = null, t.serverConfig.value = null;
4650
4651
  }
4651
4652
  function Zr(t, e, i, n) {
4652
- const a = qe();
4653
+ const a = Ye();
4653
4654
  a.current || (a.current = Gr());
4654
4655
  const s = a.current;
4655
4656
  s.dispatch = n ?? null;
@@ -4723,21 +4724,23 @@ function kt(t, e) {
4723
4724
  }
4724
4725
  return i;
4725
4726
  }
4726
- function tt(t) {
4727
+ function Ve(t) {
4727
4728
  if (t !== void 0)
4728
4729
  return t === "true";
4729
4730
  }
4730
4731
  function io(t) {
4731
4732
  const e = {};
4732
4733
  t.layout && (e.layout = t.layout), t["initial-state"] && (e.initialState = t["initial-state"]), t.position && (e.position = t.position);
4733
- const i = tt(t["ui-mute-button"]);
4734
+ const i = Ve(t["ui-mute-button"]);
4734
4735
  i !== void 0 && (e.showMuteButton = i);
4735
- const n = tt(t["ui-text-input"]);
4736
+ const n = Ve(t["ui-text-input"]);
4736
4737
  n !== void 0 && (e.showTextInput = n);
4737
- const a = tt(t["ui-captions"]);
4738
+ const a = Ve(t["ui-captions"]);
4738
4739
  a !== void 0 && (e.showCaptions = a);
4739
- const s = tt(t["ui-transcript"]);
4740
- return s !== void 0 && (e.showTranscript = s), t["call-to-action"] && (e.callToAction = t["call-to-action"]), e;
4740
+ const s = Ve(t["ui-transcript"]);
4741
+ s !== void 0 && (e.showTranscript = s);
4742
+ const c = Ve(t["ui-preview-video"]);
4743
+ return c !== void 0 && (e.showPreviewVideo = c), t["call-to-action"] && (e.callToAction = t["call-to-action"]), e;
4741
4744
  }
4742
4745
  const no = () => /* @__PURE__ */ C("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "3", "stroke-linecap": "round", children: /* @__PURE__ */ C("path", { d: "M18 6L6 18M6 6l12 12" }) }), ro = () => /* @__PURE__ */ C("svg", { width: "24", height: "24", viewBox: "0 0 640 640", fill: "currentColor", children: /* @__PURE__ */ C("path", { d: "M187.2 100.9C174.8 94.1 159.8 94.4 147.6 101.6C135.4 108.8 128 121.9 128 136L128 504C128 518.1 135.5 531.2 147.6 538.4C159.7 545.6 174.8 545.9 187.2 539.1L523.2 355.1C536 348.1 544 334.6 544 320C544 305.4 536 291.9 523.2 284.9L187.2 100.9z" }) }), oo = () => /* @__PURE__ */ C("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
4743
4746
  /* @__PURE__ */ C("path", { d: "M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z" }),
@@ -4798,7 +4801,7 @@ function ho({
4798
4801
  onStop: m,
4799
4802
  dispatch: f
4800
4803
  }) {
4801
- const p = qe(null), [u, y] = Rt(""), E = e.connectionStatus.value === "connected", T = e.connectionStatus.value === "connecting", I = e.connectionStatus.value === "error", w = e.isStreaming.value, A = !T && !E && !I, R = E || w, b = t.orientation ?? "landscape", N = t.showTranscript && R, [S, k] = Rt(!1), U = qe(null), z = c || "Agent", Y = Ve(() => {
4804
+ const p = Ye(null), [u, y] = Rt(""), E = e.connectionStatus.value === "connected", T = e.connectionStatus.value === "connecting", I = e.connectionStatus.value === "error", w = e.isStreaming.value, A = !T && !E && !I, R = E || w, b = t.orientation ?? "landscape", N = t.showTranscript && R, [S, k] = Rt(!1), U = Ye(null), z = c || "Agent", Y = We(() => {
4802
4805
  const G = !S;
4803
4806
  k(G), f(
4804
4807
  G ? ee.TRANSCRIPT_OPENED : ee.TRANSCRIPT_CLOSED,
@@ -4818,11 +4821,11 @@ function ho({
4818
4821
  if (!G || !S) return;
4819
4822
  G.scrollHeight - G.scrollTop - G.clientHeight < 160 && (G.scrollTop = G.scrollHeight);
4820
4823
  }, [e.messages.value, e.toolBlocks.value, S]);
4821
- const K = N && S && b === "landscape", te = t.showCaptions ? e.caption.value : null, de = e.sentCaption.value, ue = te && de ? te.at >= de.at ? te : de : te ?? de, Se = Ve(async () => {
4824
+ const K = N && S && b === "landscape", te = t.showCaptions ? e.caption.value : null, de = e.sentCaption.value, ue = te && de ? te.at >= de.at ? te : de : te ?? de, Se = We(async () => {
4822
4825
  i.current && await e.startSession(i.current);
4823
- }, [e.startSession]), Te = Ve(() => {
4826
+ }, [e.startSession]), Te = We(() => {
4824
4827
  u.trim() && (e.sendMessage(u.trim()), y(""), p.current?.focus());
4825
- }, [u]), re = Ve((G) => {
4828
+ }, [u]), re = We((G) => {
4826
4829
  G.key === "Enter" && !G.shiftKey && (G.preventDefault(), Te());
4827
4830
  }, [Te]), ut = t.showTextInput ? /* @__PURE__ */ C("div", { class: "anam-ctl-input-wrap", children: [
4828
4831
  /* @__PURE__ */ C(
@@ -4848,7 +4851,7 @@ function ho({
4848
4851
  children: /* @__PURE__ */ C(ao, {})
4849
4852
  }
4850
4853
  )
4851
- ] }) : null, Je = /* @__PURE__ */ C("div", { class: "anam-control-bar", children: [
4854
+ ] }) : null, Xe = /* @__PURE__ */ C("div", { class: "anam-control-bar", children: [
4852
4855
  t.showMuteButton && /* @__PURE__ */ C(
4853
4856
  "button",
4854
4857
  {
@@ -4967,7 +4970,7 @@ function ho({
4967
4970
  children: ue.content
4968
4971
  }
4969
4972
  ),
4970
- !K && Je,
4973
+ !K && Xe,
4971
4974
  N && b === "portrait" && !S && /* @__PURE__ */ C(
4972
4975
  "button",
4973
4976
  {
@@ -4996,7 +4999,7 @@ function ho({
4996
4999
  ] }),
4997
5000
  N && b === "landscape" && /* @__PURE__ */ C("div", { class: "anam-transcript-pane", children: [
4998
5001
  /* @__PURE__ */ C(Ti, { session: e, agentLabel: z, rowsRef: U }),
4999
- K && /* @__PURE__ */ C("div", { class: "anam-transcript-footer", children: Je })
5002
+ K && /* @__PURE__ */ C("div", { class: "anam-transcript-footer", children: Xe })
5000
5003
  ] })
5001
5004
  ]
5002
5005
  }
@@ -5009,7 +5012,7 @@ function fo(t) {
5009
5012
  ] });
5010
5013
  }
5011
5014
  function po(t) {
5012
- const e = qe(null), i = qe(null), n = Ve((b, N) => {
5015
+ const e = Ye(null), i = Ye(null), n = We((b, N) => {
5013
5016
  const S = i.current?.getRootNode();
5014
5017
  S && S instanceof ShadowRoot && Qr(S.host, b, N);
5015
5018
  }, []);
@@ -5020,7 +5023,7 @@ function po(t) {
5020
5023
  }, []);
5021
5024
  const c = ke(
5022
5025
  () => io(t),
5023
- [t.layout, t["initial-state"], t.position, t["ui-mute-button"], t["ui-text-input"], t["ui-captions"], t["ui-transcript"], t["call-to-action"]]
5026
+ [t.layout, t["initial-state"], t.position, t["ui-mute-button"], t["ui-text-input"], t["ui-captions"], t["ui-transcript"], t["ui-preview-video"], t["call-to-action"]]
5024
5027
  ), l = ke(() => {
5025
5028
  const b = s.serverConfig.value;
5026
5029
  return kt(kt({ ...di }, b ?? {}), c);
@@ -5032,7 +5035,7 @@ function po(t) {
5032
5035
  }, [l.layout, l.initialState]), Ie(() => {
5033
5036
  s.fetchWidgetConfig();
5034
5037
  }, [a, t["api-base-url"], t["session-token"]]);
5035
- const f = t["avatar-url"] || s.avatarThumbnailUrl.value || null, p = t["avatar-video-url"] || s.avatarVideoUrl.value || null, y = t["agent-name"] || s.personaName.value, E = l.callToAction === di.callToAction && y ? `Talk to ${y}` : l.callToAction, T = ke(() => {
5038
+ const f = t["avatar-url"] || s.avatarThumbnailUrl.value || null, p = l.showPreviewVideo && (t["avatar-video-url"] || s.avatarVideoUrl.value) || null, y = t["agent-name"] || s.personaName.value, E = l.callToAction === di.callToAction && y ? `Talk to ${y}` : l.callToAction, T = ke(() => {
5036
5039
  if (l.layout === "inline") return "";
5037
5040
  const b = Gn(l.position);
5038
5041
  return Object.entries(b).map(([N, S]) => `${N}: ${S}`).join("; ");
@@ -5099,6 +5102,8 @@ const _o = [
5099
5102
  // "true" | "false" -- show captions
5100
5103
  "ui-transcript",
5101
5104
  // "true" | "false" -- show the expandable transcript pane
5105
+ "ui-preview-video",
5106
+ // "true" | "false" -- play the idle preview video before a call
5102
5107
  "call-to-action",
5103
5108
  // Custom CTA text for the start button
5104
5109
  "avatar-url",