@aiden-voice/widget 0.3.1 → 0.4.0

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/widget.js CHANGED
@@ -1,96 +1,100 @@
1
- function e(e) {
1
+ var e = 2147483e3, t = 2147483647;
2
+ function n(n) {
3
+ return n === void 0 ? e : Number.isInteger(n) && Math.abs(n) <= t ? n : (console.warn(`whoo-aiden-widget: ignoring zIndex ${String(n)} (expected an integer between -${t} and ${t}); using ${e}.`), e);
4
+ }
5
+ function r(e) {
2
6
  if ((typeof e.publishableKey == "string" && e.publishableKey.length > 0) == (typeof e.sessionToken == "string" && e.sessionToken.length > 0)) throw Error("whoo-aiden-widget: init() requires exactly one of `publishableKey` or `sessionToken`, not both or neither.");
3
7
  }
4
8
  //#endregion
5
9
  //#region node_modules/.pnpm/preact@10.29.8/node_modules/preact/dist/preact.module.js
6
- var t, n, r, i, a, o, s, c, l, u, d, f, p, m, h = {}, g = [], _ = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, v = Array.isArray;
7
- function y(e, t) {
10
+ var i, a, o, s, c, l, u, d, f, p, m, h, g, _, v = {}, y = [], b = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, x = Array.isArray;
11
+ function S(e, t) {
8
12
  for (var n in t) e[n] = t[n];
9
13
  return e;
10
14
  }
11
- function b(e) {
15
+ function ee(e) {
12
16
  e && e.parentNode && e.parentNode.removeChild(e);
13
17
  }
14
- function x(e, n, r) {
15
- var i, a, o, s = {};
16
- for (o in n) o == "key" ? i = n[o] : o == "ref" ? a = n[o] : s[o] = n[o];
17
- if (arguments.length > 2 && (s.children = arguments.length > 3 ? t.call(arguments, 2) : r), typeof e == "function" && e.defaultProps != null) for (o in e.defaultProps) s[o] === void 0 && (s[o] = e.defaultProps[o]);
18
- return S(e, s, i, a, null);
18
+ function C(e, t, n) {
19
+ var r, a, o, s = {};
20
+ for (o in t) o == "key" ? r = t[o] : o == "ref" ? a = t[o] : s[o] = t[o];
21
+ if (arguments.length > 2 && (s.children = arguments.length > 3 ? i.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null) for (o in e.defaultProps) s[o] === void 0 && (s[o] = e.defaultProps[o]);
22
+ return w(e, s, r, a, null);
19
23
  }
20
- function S(e, t, i, a, o) {
24
+ function w(e, t, n, r, i) {
21
25
  var s = {
22
26
  type: e,
23
27
  props: t,
24
- key: i,
25
- ref: a,
28
+ key: n,
29
+ ref: r,
26
30
  __k: null,
27
31
  __: null,
28
32
  __b: 0,
29
33
  __e: null,
30
34
  __c: null,
31
35
  constructor: void 0,
32
- __v: o ?? ++r,
36
+ __v: i ?? ++o,
33
37
  __i: -1,
34
38
  __u: 0
35
39
  };
36
- return o == null && n.vnode != null && n.vnode(s), s;
40
+ return i == null && a.vnode != null && a.vnode(s), s;
37
41
  }
38
- function C(e) {
42
+ function T(e) {
39
43
  return e.children;
40
44
  }
41
- function w(e, t) {
45
+ function E(e, t) {
42
46
  this.props = e, this.context = t;
43
47
  }
44
- function T(e, t) {
45
- if (t == null) return e.__ ? T(e.__, e.__i + 1) : null;
48
+ function D(e, t) {
49
+ if (t == null) return e.__ ? D(e.__, e.__i + 1) : null;
46
50
  for (var n; t < e.__k.length; t++) if ((n = e.__k[t]) != null && n.__e != null) return n.__e;
47
- return typeof e.type == "function" ? T(e) : null;
51
+ return typeof e.type == "function" ? D(e) : null;
48
52
  }
49
- function E(e) {
53
+ function O(e) {
50
54
  if (e.__P && e.__d) {
51
- var t = e.__v, r = t.__e, i = [], a = [], o = y({}, t);
52
- o.__v = t.__v + 1, n.vnode && n.vnode(o), ne(e.__P, o, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [r] : null, i, r ?? T(t), !!(32 & t.__u), a), o.__v = t.__v, o.__.__k[o.__i] = o, ie(i, o, a), t.__e = t.__ = null, o.__e != r && D(o);
55
+ var t = e.__v, n = t.__e, r = [], i = [], o = S({}, t);
56
+ o.__v = t.__v + 1, a.vnode && a.vnode(o), ae(e.__P, o, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [n] : null, r, n ?? D(t), !!(32 & t.__u), i), o.__v = t.__v, o.__.__k[o.__i] = o, se(r, o, i), t.__e = t.__ = null, o.__e != n && k(o);
53
57
  }
54
58
  }
55
- function D(e) {
59
+ function k(e) {
56
60
  if ((e = e.__) != null && e.__c != null) return e.__e = e.__c.base = null, e.__k.some(function(t) {
57
61
  if (t != null && t.__e != null) return e.__e = e.__c.base = t.__e;
58
- }), D(e);
62
+ }), k(e);
59
63
  }
60
- function O(e) {
61
- (!e.__d && (e.__d = !0) && i.push(e) && !k.__r++ || a != n.debounceRendering) && ((a = n.debounceRendering) || o)(k);
64
+ function A(e) {
65
+ (!e.__d && (e.__d = !0) && s.push(e) && !j.__r++ || c != a.debounceRendering) && ((c = a.debounceRendering) || l)(j);
62
66
  }
63
- function k() {
67
+ function j() {
64
68
  try {
65
- for (var e, t = 1; i.length;) i.length > t && i.sort(s), e = i.shift(), t = i.length, E(e);
69
+ for (var e, t = 1; s.length;) s.length > t && s.sort(u), e = s.shift(), t = s.length, O(e);
66
70
  } finally {
67
- i.length = k.__r = 0;
71
+ s.length = j.__r = 0;
68
72
  }
69
73
  }
70
- function ee(e, t, n, r, i, a, o, s, c, l, u) {
71
- var d, f, p, m, _, v, y = r && r.__k || g, b = t.length;
72
- for (c = A(n, t, y, c, b), d = 0; d < b; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && y[p.__i] || h, p.__i = d, v = ne(e, p, f, i, a, o, s, c, l, u), m = p.__e, p.ref && f.ref != p.ref && (f.ref && se(f.ref, null, p), u.push(p.ref, p.__c || m, p)), _ == null && m != null && (_ = m), 4 & p.__u ? (c = j(p, c, e), f.__e && (f.__e = null)) : typeof p.type == "function" && v !== void 0 ? c = v : m && (c = m.nextSibling), p.__u &= -7);
73
- return n.__e = _, c;
74
+ function te(e, t, n, r, i, a, o, s, c, l, u) {
75
+ var d, f, p, m, h, g, _ = r && r.__k || y, b = t.length;
76
+ for (c = M(n, t, _, c, b), d = 0; d < b; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && _[p.__i] || v, p.__i = d, g = ae(e, p, f, i, a, o, s, c, l, u), m = p.__e, p.ref && f.ref != p.ref && (f.ref && ue(f.ref, null, p), u.push(p.ref, p.__c || m, p)), h == null && m != null && (h = m), 4 & p.__u ? (c = N(p, c, e), f.__e && (f.__e = null)) : typeof p.type == "function" && g !== void 0 ? c = g : m && (c = m.nextSibling), p.__u &= -7);
77
+ return n.__e = h, c;
74
78
  }
75
- function A(e, t, n, r, i) {
79
+ function M(e, t, n, r, i) {
76
80
  var a, o, s, c, l, u = n.length, d = u, f = 0;
77
- for (e.__k = Array(i), a = 0; a < i; a++) (o = t[a]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? o = e.__k[a] = S(null, o, null, null, null) : v(o) ? o = e.__k[a] = S(C, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? o = e.__k[a] = S(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : e.__k[a] = o, c = a + f, o.__ = e, o.__b = e.__b + 1, s = null, (l = o.__i = M(o, n, c, d)) != -1 && (d--, (s = n[l]) && (s.__u |= 2)), s == null || s.__v == null ? (l == -1 && (i > u ? f-- : i < u && f++), typeof o.type != "function" && (o.__u |= 4)) : l != c && (l == c - 1 ? f-- : l == c + 1 ? f++ : (l > c ? f-- : f++, o.__u |= 4))) : e.__k[a] = null;
78
- if (d) for (a = 0; a < u; a++) (s = n[a]) != null && !(2 & s.__u) && (s.__e == r && (r = T(s)), ce(s, s));
81
+ for (e.__k = Array(i), a = 0; a < i; a++) (o = t[a]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? o = e.__k[a] = w(null, o, null, null, null) : x(o) ? o = e.__k[a] = w(T, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? o = e.__k[a] = w(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : e.__k[a] = o, c = a + f, o.__ = e, o.__b = e.__b + 1, s = null, (l = o.__i = ne(o, n, c, d)) != -1 && (d--, (s = n[l]) && (s.__u |= 2)), s == null || s.__v == null ? (l == -1 && (i > u ? f-- : i < u && f++), typeof o.type != "function" && (o.__u |= 4)) : l != c && (l == c - 1 ? f-- : l == c + 1 ? f++ : (l > c ? f-- : f++, o.__u |= 4))) : e.__k[a] = null;
82
+ if (d) for (a = 0; a < u; a++) (s = n[a]) != null && !(2 & s.__u) && (s.__e == r && (r = D(s)), de(s, s));
79
83
  return r;
80
84
  }
81
- function j(e, t, n) {
85
+ function N(e, t, n) {
82
86
  var r, i;
83
87
  if (typeof e.type == "function") {
84
- for (r = e.__k, i = 0; r && i < r.length; i++) r[i] && (r[i].__ = e, t = j(r[i], t, n));
88
+ for (r = e.__k, i = 0; r && i < r.length; i++) r[i] && (r[i].__ = e, t = N(r[i], t, n));
85
89
  return t;
86
90
  }
87
- e.__e != t && (t && e.type && !t.parentNode && (t = T(e)), t = n.insertBefore(e.__e, t || null));
91
+ e.__e != t && (t && e.type && !t.parentNode && (t = D(e)), t = n.insertBefore(e.__e, t || null));
88
92
  do
89
93
  t &&= t.nextSibling;
90
94
  while (t != null && t.nodeType == 8);
91
95
  return t;
92
96
  }
93
- function M(e, t, n, r) {
97
+ function ne(e, t, n, r) {
94
98
  var i, a, o, s = e.key, c = e.type, l = t[n], u = l != null && !(2 & l.__u);
95
99
  if (l === null && s == null || u && s == l.key && c == l.type) return n;
96
100
  if (r > +!!u) {
@@ -98,18 +102,18 @@ function M(e, t, n, r) {
98
102
  }
99
103
  return -1;
100
104
  }
101
- function N(e, t, n) {
102
- t[0] == "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || _.test(t) ? n : n + "px";
105
+ function re(e, t, n) {
106
+ t[0] == "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || b.test(t) ? n : n + "px";
103
107
  }
104
108
  function P(e, t, n, r, i) {
105
109
  var a, o;
106
110
  n: if (t == "style") {
107
111
  if (typeof n == "string") e.style.cssText = n;
108
112
  else {
109
- if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || N(e.style, t, "");
110
- if (n) for (t in n) r && n[t] == r[t] || N(e.style, t, n[t]);
113
+ if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || re(e.style, t, "");
114
+ if (n) for (t in n) r && n[t] == r[t] || re(e.style, t, n[t]);
111
115
  }
112
- } else if (t[0] == "o" && t[1] == "n") a = t != (t = t.replace(d, "$1")), o = t.toLowerCase(), t = o in e || t == "onFocusOut" || t == "onFocusIn" ? o.slice(2) : t.slice(2), e.l ||= {}, e.l[t + a] = n, n ? r ? n[u] = r[u] : (n[u] = f, e.addEventListener(t, a ? m : p, a)) : e.removeEventListener(t, a ? m : p, a);
116
+ } else if (t[0] == "o" && t[1] == "n") a = t != (t = t.replace(m, "$1")), o = t.toLowerCase(), t = o in e || t == "onFocusOut" || t == "onFocusIn" ? o.slice(2) : t.slice(2), e.l ||= {}, e.l[t + a] = n, n ? r ? n[p] = r[p] : (n[p] = h, e.addEventListener(t, a ? _ : g, a)) : e.removeEventListener(t, a ? _ : g, a);
113
117
  else {
114
118
  if (i == "http://www.w3.org/2000/svg") t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
115
119
  else if (t != "width" && t != "height" && t != "href" && t != "list" && t != "form" && t != "tabIndex" && t != "download" && t != "rowSpan" && t != "colSpan" && t != "role" && t != "popover" && t in e) try {
@@ -119,155 +123,155 @@ function P(e, t, n, r, i) {
119
123
  typeof n == "function" || (n == null || !1 === n && t[4] != "-" ? e.removeAttribute(t) : e.setAttribute(t, t == "popover" && n == 1 ? "" : n));
120
124
  }
121
125
  }
122
- function te(e) {
126
+ function ie(e) {
123
127
  return function(t) {
124
128
  if (this.l) {
125
- var r = this.l[t.type + e];
126
- if (t[l] == null) t[l] = f++;
127
- else if (t[l] < r[u]) return;
128
- return r(n.event ? n.event(t) : t);
129
+ var n = this.l[t.type + e];
130
+ if (t[f] == null) t[f] = h++;
131
+ else if (t[f] < n[p]) return;
132
+ return n(a.event ? a.event(t) : t);
129
133
  }
130
134
  };
131
135
  }
132
- function ne(e, t, r, i, a, o, s, c, l, u) {
133
- var d, f, p, m, h, _, x, S, E, D, O, k, A, j, M, N, P = t.type;
136
+ function ae(e, t, n, r, i, o, s, c, l, u) {
137
+ var d, f, p, m, h, g, _, v, b, C, w, O, k, A, j, M, N = t.type;
134
138
  if (t.constructor !== void 0) return null;
135
- 128 & r.__u && (l = !!(32 & r.__u), o = [c = t.__e = r.__e]), (d = n.__b) && d(t);
136
- n: if (typeof P == "function") {
139
+ 128 & n.__u && (l = !!(32 & n.__u), o = [c = t.__e = n.__e]), (d = a.__b) && d(t);
140
+ n: if (typeof N == "function") {
137
141
  f = s.length;
138
142
  try {
139
- if (E = t.props, D = P.prototype && P.prototype.render, O = (d = P.contextType) && i[d.__c], k = d ? O ? O.props.value : d.__ : i, r.__c ? S = (p = t.__c = r.__c).__ = p.__E : (D ? t.__c = p = new P(E, k) : (t.__c = p = new w(E, k), p.constructor = P, p.render = le), O && O.sub(p), p.state || (p.state = {}), p.__n = i, m = p.__d = !0, p.__h = [], p._sb = []), D && p.__s == null && (p.__s = p.state), D && P.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = y({}, p.__s)), y(p.__s, P.getDerivedStateFromProps(E, p.__s))), h = p.props, _ = p.state, p.__v = t, m) D && P.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), D && p.componentDidMount != null && p.__h.push(p.componentDidMount);
143
+ if (b = t.props, C = N.prototype && N.prototype.render, w = (d = N.contextType) && r[d.__c], O = d ? w ? w.props.value : d.__ : r, n.__c ? v = (p = t.__c = n.__c).__ = p.__E : (C ? t.__c = p = new N(b, O) : (t.__c = p = new E(b, O), p.constructor = N, p.render = fe), w && w.sub(p), p.state || (p.state = {}), p.__n = r, m = p.__d = !0, p.__h = [], p._sb = []), C && p.__s == null && (p.__s = p.state), C && N.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = S({}, p.__s)), S(p.__s, N.getDerivedStateFromProps(b, p.__s))), h = p.props, g = p.state, p.__v = t, m) C && N.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), C && p.componentDidMount != null && p.__h.push(p.componentDidMount);
140
144
  else {
141
- if (D && P.getDerivedStateFromProps == null && E !== h && p.componentWillReceiveProps != null && p.componentWillReceiveProps(E, k), t.__v == r.__v || !p.__e && p.shouldComponentUpdate != null && !1 === p.shouldComponentUpdate(E, p.__s, k)) {
142
- t.__v != r.__v && (p.props = E, p.state = p.__s, p.__d = !1), t.__e = r.__e, t.__k = r.__k, t.__k.some(function(e) {
145
+ if (C && N.getDerivedStateFromProps == null && b !== h && p.componentWillReceiveProps != null && p.componentWillReceiveProps(b, O), t.__v == n.__v || !p.__e && p.shouldComponentUpdate != null && !1 === p.shouldComponentUpdate(b, p.__s, O)) {
146
+ t.__v != n.__v && (p.props = b, p.state = p.__s, p.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.some(function(e) {
143
147
  e && (e.__ = t);
144
- }), g.push.apply(p.__h, p._sb), p._sb = [], p.__h.length && s.push(p), c = T(r);
148
+ }), y.push.apply(p.__h, p._sb), p._sb = [], p.__h.length && s.push(p), c = D(n);
145
149
  break n;
146
150
  }
147
- p.componentWillUpdate != null && p.componentWillUpdate(E, p.__s, k), D && p.componentDidUpdate != null && p.__h.push(function() {
148
- p.componentDidUpdate(h, _, x);
151
+ p.componentWillUpdate != null && p.componentWillUpdate(b, p.__s, O), C && p.componentDidUpdate != null && p.__h.push(function() {
152
+ p.componentDidUpdate(h, g, _);
149
153
  });
150
154
  }
151
- if (p.context = k, p.props = E, p.__P = e, p.__e = !1, A = n.__r, j = 0, D) p.state = p.__s, p.__d = !1, A && A(t), d = p.render(p.props, p.state, p.context), g.push.apply(p.__h, p._sb), p._sb = [];
155
+ if (p.context = O, p.props = b, p.__P = e, p.__e = !1, k = a.__r, A = 0, C) p.state = p.__s, p.__d = !1, k && k(t), d = p.render(p.props, p.state, p.context), y.push.apply(p.__h, p._sb), p._sb = [];
152
156
  else do
153
- p.__d = !1, A && A(t), d = p.render(p.props, p.state, p.context), p.state = p.__s;
154
- while (p.__d && ++j < 25);
155
- p.state = p.__s, p.getChildContext != null && (i = y(y({}, i), p.getChildContext())), D && !m && p.getSnapshotBeforeUpdate != null && (x = p.getSnapshotBeforeUpdate(h, _)), M = d != null && d.type === C && d.key == null ? ae(d.props.children) : d, c = ee(e, v(M) ? M : [M], t, r, i, a, o, s, c, l, u), p.base = t.__e, t.__u &= -161, p.__h.length && s.push(p), S && (p.__E = p.__ = null);
157
+ p.__d = !1, k && k(t), d = p.render(p.props, p.state, p.context), p.state = p.__s;
158
+ while (p.__d && ++A < 25);
159
+ p.state = p.__s, p.getChildContext != null && (r = S(S({}, r), p.getChildContext())), C && !m && p.getSnapshotBeforeUpdate != null && (_ = p.getSnapshotBeforeUpdate(h, g)), j = d != null && d.type === T && d.key == null ? ce(d.props.children) : d, c = te(e, x(j) ? j : [j], t, n, r, i, o, s, c, l, u), p.base = t.__e, t.__u &= -161, p.__h.length && s.push(p), v && (p.__E = p.__ = null);
156
160
  } catch (e) {
157
161
  if (s.length = f, t.__v = null, l || o != null) {
158
162
  if (e.then) {
159
163
  for (t.__u |= l ? 160 : 128; c && c.nodeType == 8 && c.nextSibling;) c = c.nextSibling;
160
164
  o != null && (o[o.indexOf(c)] = null), t.__e = c;
161
- } else if (o != null) for (N = o.length; N--;) b(o[N]);
162
- } else t.__e = r.__e;
163
- t.__k ??= r.__k || [], e.then || re(t), n.__e(e, t, r);
165
+ } else if (o != null) for (M = o.length; M--;) ee(o[M]);
166
+ } else t.__e = n.__e;
167
+ t.__k ??= n.__k || [], e.then || oe(t), a.__e(e, t, n);
164
168
  }
165
- } else o == null && t.__v == r.__v ? (t.__k = r.__k, t.__e = r.__e) : c = t.__e = oe(r.__e, t, r, i, a, o, s, l, u);
166
- return (d = n.diffed) && d(t), 128 & t.__u ? void 0 : c;
169
+ } else o == null && t.__v == n.__v ? (t.__k = n.__k, t.__e = n.__e) : c = t.__e = le(n.__e, t, n, r, i, o, s, l, u);
170
+ return (d = a.diffed) && d(t), 128 & t.__u ? void 0 : c;
167
171
  }
168
- function re(e) {
169
- e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(re));
172
+ function oe(e) {
173
+ e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(oe));
170
174
  }
171
- function ie(e, t, r) {
172
- for (var i = 0; i < r.length; i++) se(r[i], r[++i], r[++i]);
173
- n.__c && n.__c(t, e), e.some(function(t) {
175
+ function se(e, t, n) {
176
+ for (var r = 0; r < n.length; r++) ue(n[r], n[++r], n[++r]);
177
+ a.__c && a.__c(t, e), e.some(function(t) {
174
178
  try {
175
179
  e = t.__h, t.__h = [], e.some(function(e) {
176
180
  e.call(t);
177
181
  });
178
182
  } catch (e) {
179
- n.__e(e, t.__v);
183
+ a.__e(e, t.__v);
180
184
  }
181
185
  });
182
186
  }
183
- function ae(e) {
184
- return typeof e != "object" || !e || e.__b > 0 ? e : v(e) ? e.map(ae) : e.constructor === void 0 ? y({}, e) : null;
187
+ function ce(e) {
188
+ return typeof e != "object" || !e || e.__b > 0 ? e : x(e) ? e.map(ce) : e.constructor === void 0 ? S({}, e) : null;
185
189
  }
186
- function oe(e, r, i, a, o, s, c, l, u) {
187
- var d, f, p, m, g, _, y, x = i.props || h, S = r.props, C = r.type;
188
- if (C == "svg" ? o = "http://www.w3.org/2000/svg" : C == "math" ? o = "http://www.w3.org/1998/Math/MathML" : o ||= "http://www.w3.org/1999/xhtml", s != null) {
189
- for (d = 0; d < s.length; d++) if ((g = s[d]) && "setAttribute" in g == !!C && (C ? g.localName == C : g.nodeType == 3)) {
190
- e = g, s[d] = null;
190
+ function le(e, t, n, r, o, s, c, l, u) {
191
+ var d, f, p, m, h, g, _, y = n.props || v, b = t.props, S = t.type;
192
+ if (S == "svg" ? o = "http://www.w3.org/2000/svg" : S == "math" ? o = "http://www.w3.org/1998/Math/MathML" : o ||= "http://www.w3.org/1999/xhtml", s != null) {
193
+ for (d = 0; d < s.length; d++) if ((h = s[d]) && "setAttribute" in h == !!S && (S ? h.localName == S : h.nodeType == 3)) {
194
+ e = h, s[d] = null;
191
195
  break;
192
196
  }
193
197
  }
194
198
  if (e == null) {
195
- if (C == null) return document.createTextNode(S);
196
- e = document.createElementNS(o, C, S.is && S), l &&= (n.__m && n.__m(r, s), !1), s = null;
199
+ if (S == null) return document.createTextNode(b);
200
+ e = document.createElementNS(o, S, b.is && b), l &&= (a.__m && a.__m(t, s), !1), s = null;
197
201
  }
198
- if (C == null) x === S || l && e.data == S || (e.data = S);
202
+ if (S == null) y === b || l && e.data == b || (e.data = b);
199
203
  else {
200
- if (s = C == "textarea" && S.defaultValue != null ? null : s && t.call(e.childNodes), !l && s != null) for (x = {}, d = 0; d < e.attributes.length; d++) x[(g = e.attributes[d]).name] = g.value;
201
- for (d in x) g = x[d], d == "dangerouslySetInnerHTML" ? p = g : d == "children" || d in S || d == "value" && "defaultValue" in S || d == "checked" && "defaultChecked" in S || P(e, d, null, g, o);
202
- for (d in S) g = S[d], d == "children" ? m = g : d == "dangerouslySetInnerHTML" ? f = g : d == "value" ? _ = g : d == "checked" ? y = g : l && typeof g != "function" || x[d] === g || P(e, d, g, x[d], o);
203
- if (f) l || p && (f.__html == p.__html || f.__html == e.innerHTML) || (e.innerHTML = f.__html), r.__k = [];
204
- else if (p && (e.innerHTML = ""), ee(r.type == "template" ? e.content : e, v(m) ? m : [m], r, i, a, C == "foreignObject" ? "http://www.w3.org/1999/xhtml" : o, s, c, s ? s[0] : i.__k && T(i, 0), l, u), s != null) for (d = s.length; d--;) b(s[d]);
205
- l && C != "textarea" || (d = "value", C == "progress" && _ == null ? e.removeAttribute("value") : _ != null && (_ !== e[d] || C == "progress" && !_ || C == "option" && _ != x[d]) && P(e, d, _, x[d], o), d = "checked", y != null && y != e[d] && P(e, d, y, x[d], o));
204
+ if (s = S == "textarea" && b.defaultValue != null ? null : s && i.call(e.childNodes), !l && s != null) for (y = {}, d = 0; d < e.attributes.length; d++) y[(h = e.attributes[d]).name] = h.value;
205
+ for (d in y) h = y[d], d == "dangerouslySetInnerHTML" ? p = h : d == "children" || d in b || d == "value" && "defaultValue" in b || d == "checked" && "defaultChecked" in b || P(e, d, null, h, o);
206
+ for (d in b) h = b[d], d == "children" ? m = h : d == "dangerouslySetInnerHTML" ? f = h : d == "value" ? g = h : d == "checked" ? _ = h : l && typeof h != "function" || y[d] === h || P(e, d, h, y[d], o);
207
+ if (f) l || p && (f.__html == p.__html || f.__html == e.innerHTML) || (e.innerHTML = f.__html), t.__k = [];
208
+ else if (p && (e.innerHTML = ""), te(t.type == "template" ? e.content : e, x(m) ? m : [m], t, n, r, S == "foreignObject" ? "http://www.w3.org/1999/xhtml" : o, s, c, s ? s[0] : n.__k && D(n, 0), l, u), s != null) for (d = s.length; d--;) ee(s[d]);
209
+ l && S != "textarea" || (d = "value", S == "progress" && g == null ? e.removeAttribute("value") : g != null && (g !== e[d] || S == "progress" && !g || S == "option" && g != y[d]) && P(e, d, g, y[d], o), d = "checked", _ != null && _ != e[d] && P(e, d, _, y[d], o));
206
210
  }
207
211
  return e;
208
212
  }
209
- function se(e, t, r) {
213
+ function ue(e, t, n) {
210
214
  try {
211
215
  if (typeof e == "function") {
212
- var i = typeof e.__u == "function";
213
- i && e.__u(), i && t == null || (e.__u = e(t));
216
+ var r = typeof e.__u == "function";
217
+ r && e.__u(), r && t == null || (e.__u = e(t));
214
218
  } else e.current = t;
215
219
  } catch (e) {
216
- n.__e(e, r);
220
+ a.__e(e, n);
217
221
  }
218
222
  }
219
- function ce(e, t, r) {
220
- var i, a;
221
- if (n.unmount && n.unmount(e), (i = e.ref) && (i.current && i.current != e.__e || se(i, null, t)), (i = e.__c) != null) {
222
- if (i.componentWillUnmount) try {
223
- i.componentWillUnmount();
223
+ function de(e, t, n) {
224
+ var r, i;
225
+ if (a.unmount && a.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || ue(r, null, t)), (r = e.__c) != null) {
226
+ if (r.componentWillUnmount) try {
227
+ r.componentWillUnmount();
224
228
  } catch (e) {
225
- n.__e(e, t);
229
+ a.__e(e, t);
226
230
  }
227
- i.base = i.__P = i.__n = null;
231
+ r.base = r.__P = r.__n = null;
228
232
  }
229
- if (i = e.__k) for (a = 0; a < i.length; a++) i[a] && ce(i[a], t, r || typeof e.type != "function");
230
- r || b(e.__e), e.__c = e.__ = e.__e = void 0;
233
+ if (r = e.__k) for (i = 0; i < r.length; i++) r[i] && de(r[i], t, n || typeof e.type != "function");
234
+ n || ee(e.__e), e.__c = e.__ = e.__e = void 0;
231
235
  }
232
- function le(e, t, n) {
236
+ function fe(e, t, n) {
233
237
  return this.constructor(e, n);
234
238
  }
235
- function ue(e, r, i) {
236
- var a, o, s, c;
237
- r == document && (r = document.documentElement), n.__ && n.__(e, r), o = (a = typeof i == "function") ? null : i && i.__k || r.__k, s = [], c = [], ne(r, e = (!a && i || r).__k = x(C, null, [e]), o || h, h, r.namespaceURI, !a && i ? [i] : o ? null : r.firstChild ? t.call(r.childNodes) : null, s, !a && i ? i : o ? o.__e : r.firstChild, a, c), ie(s, e, c), e.props.children = null;
239
+ function pe(e, t, n) {
240
+ var r, o, s, c;
241
+ t == document && (t = document.documentElement), a.__ && a.__(e, t), o = (r = typeof n == "function") ? null : n && n.__k || t.__k, s = [], c = [], ae(t, e = (!r && n || t).__k = C(T, null, [e]), o || v, v, t.namespaceURI, !r && n ? [n] : o ? null : t.firstChild ? i.call(t.childNodes) : null, s, !r && n ? n : o ? o.__e : t.firstChild, r, c), se(s, e, c), e.props.children = null;
238
242
  }
239
- t = g.slice, n = { __e: function(e, t, n, r) {
243
+ i = y.slice, a = { __e: function(e, t, n, r) {
240
244
  for (var i, a, o; t = t.__;) if ((i = t.__c) && !i.__) try {
241
245
  if ((a = i.constructor) && a.getDerivedStateFromError != null && (i.setState(a.getDerivedStateFromError(e)), o = i.__d), i.componentDidCatch != null && (i.componentDidCatch(e, r || {}), o = i.__d), o) return i.__E = i;
242
246
  } catch (t) {
243
247
  e = t;
244
248
  }
245
249
  throw e;
246
- } }, r = 0, w.prototype.setState = function(e, t) {
247
- var n = this.__s != null && this.__s != this.state ? this.__s : this.__s = y({}, this.state);
248
- typeof e == "function" && (e = e(y({}, n), this.props)), e && y(n, e), e != null && this.__v && (t && this._sb.push(t), O(this));
249
- }, w.prototype.forceUpdate = function(e) {
250
- this.__v && (this.__e = !0, e && this.__h.push(e), O(this));
251
- }, w.prototype.render = C, i = [], o = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, s = function(e, t) {
250
+ } }, o = 0, E.prototype.setState = function(e, t) {
251
+ var n = this.__s != null && this.__s != this.state ? this.__s : this.__s = S({}, this.state);
252
+ typeof e == "function" && (e = e(S({}, n), this.props)), e && S(n, e), e != null && this.__v && (t && this._sb.push(t), A(this));
253
+ }, E.prototype.forceUpdate = function(e) {
254
+ this.__v && (this.__e = !0, e && this.__h.push(e), A(this));
255
+ }, E.prototype.render = T, s = [], l = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, u = function(e, t) {
252
256
  return e.__v.__b - t.__v.__b;
253
- }, k.__r = 0, c = Math.random().toString(8), l = "__d" + c, u = "__a" + c, d = /(PointerCapture)$|Capture$/i, f = 0, p = te(!1), m = te(!0);
257
+ }, j.__r = 0, d = Math.random().toString(8), f = "__d" + d, p = "__a" + d, m = /(PointerCapture)$|Capture$/i, h = 0, g = ie(!1), _ = ie(!0);
254
258
  //#endregion
255
259
  //#region node_modules/.pnpm/preact@10.29.8/node_modules/preact/hooks/dist/hooks.module.js
256
- var F, I, L, de, R = 0, fe = [], z = n, pe = z.__b, me = z.__r, he = z.diffed, ge = z.__c, _e = z.unmount, ve = z.__;
257
- function ye(e, t) {
258
- z.__h && z.__h(I, e, R || t), R = 0;
260
+ var F, I, me, he, L = 0, ge = [], R = a, _e = R.__b, ve = R.__r, ye = R.diffed, be = R.__c, xe = R.unmount, Se = R.__;
261
+ function Ce(e, t) {
262
+ R.__h && R.__h(I, e, L || t), L = 0;
259
263
  var n = I.__H || (I.__H = {
260
264
  __: [],
261
265
  __h: []
262
266
  });
263
267
  return e >= n.__.length && n.__.push({}), n.__[e];
264
268
  }
265
- function B(e) {
266
- return R = 1, be(De, e);
269
+ function z(e) {
270
+ return L = 1, we(je, e);
267
271
  }
268
- function be(e, t, n) {
269
- var r = ye(F++, 2);
270
- if (r.t = e, !r.__c && (r.__ = [n ? n(t) : De(void 0, t), function(e) {
272
+ function we(e, t, n) {
273
+ var r = Ce(F++, 2);
274
+ if (r.t = e, !r.__c && (r.__ = [n ? n(t) : je(void 0, t), function(e) {
271
275
  var t = r.__N ? r.__N[0] : r.__[0], n = r.t(t, e);
272
276
  t !== n && (r.__N = [n, r.__[1]], r.__c.setState({}));
273
277
  }], r.__c = I, !I.__f)) {
@@ -298,103 +302,103 @@ function be(e, t, n) {
298
302
  }
299
303
  return r.__N || r.__;
300
304
  }
301
- function V(e, t) {
302
- var n = ye(F++, 3);
303
- !z.__s && Ee(n.__H, t) && (n.__ = e, n.u = t, I.__H.__h.push(n));
305
+ function B(e, t) {
306
+ var n = Ce(F++, 3);
307
+ !R.__s && Ae(n.__H, t) && (n.__ = e, n.u = t, I.__H.__h.push(n));
304
308
  }
305
- function H(e) {
306
- return R = 5, xe(function() {
309
+ function V(e) {
310
+ return L = 5, Te(function() {
307
311
  return { current: e };
308
312
  }, []);
309
313
  }
310
- function xe(e, t) {
311
- var n = ye(F++, 7);
312
- return Ee(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
314
+ function Te(e, t) {
315
+ var n = Ce(F++, 7);
316
+ return Ae(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
313
317
  }
314
- function Se() {
315
- for (var e; e = fe.shift();) {
318
+ function Ee() {
319
+ for (var e; e = ge.shift();) {
316
320
  var t = e.__H;
317
321
  if (e.__P && t) try {
318
- t.__h.some(U), t.__h.some(Te), t.__h = [];
322
+ t.__h.some(H), t.__h.some(ke), t.__h = [];
319
323
  } catch (n) {
320
- t.__h = [], z.__e(n, e.__v);
324
+ t.__h = [], R.__e(n, e.__v);
321
325
  }
322
326
  }
323
327
  }
324
- z.__b = function(e) {
325
- I = null, pe && pe(e);
326
- }, z.__ = function(e, t) {
327
- e && t.__k && t.__k.__m && (e.__m = t.__k.__m), ve && ve(e, t);
328
- }, z.__r = function(e) {
329
- me && me(e), F = 0;
328
+ R.__b = function(e) {
329
+ I = null, _e && _e(e);
330
+ }, R.__ = function(e, t) {
331
+ e && t.__k && t.__k.__m && (e.__m = t.__k.__m), Se && Se(e, t);
332
+ }, R.__r = function(e) {
333
+ ve && ve(e), F = 0;
330
334
  var t = (I = e.__c).__H;
331
- t && (L === I ? (t.__h = [], I.__h = [], t.__.some(function(e) {
335
+ t && (me === I ? (t.__h = [], I.__h = [], t.__.some(function(e) {
332
336
  e.__N && (e.__ = e.__N), e.u = e.__N = void 0;
333
- })) : (t.__h.some(U), t.__h.some(Te), t.__h = [], F = 0)), L = I;
334
- }, z.diffed = function(e) {
335
- he && he(e);
337
+ })) : (t.__h.some(H), t.__h.some(ke), t.__h = [], F = 0)), me = I;
338
+ }, R.diffed = function(e) {
339
+ ye && ye(e);
336
340
  var t = e.__c;
337
- t && t.__H && (t.__H.__h.length && (fe.push(t) !== 1 && de === z.requestAnimationFrame || ((de = z.requestAnimationFrame) || we)(Se)), t.__H.__.some(function(e) {
341
+ t && t.__H && (t.__H.__h.length && (ge.push(t) !== 1 && he === R.requestAnimationFrame || ((he = R.requestAnimationFrame) || Oe)(Ee)), t.__H.__.some(function(e) {
338
342
  e.u &&= (e.__H = e.u, void 0);
339
- })), L = I = null;
340
- }, z.__c = function(e, t) {
343
+ })), me = I = null;
344
+ }, R.__c = function(e, t) {
341
345
  t.some(function(e) {
342
346
  try {
343
- e.__h.some(U), e.__h = e.__h.filter(function(e) {
344
- return !e.__ || Te(e);
347
+ e.__h.some(H), e.__h = e.__h.filter(function(e) {
348
+ return !e.__ || ke(e);
345
349
  });
346
350
  } catch (n) {
347
351
  t.some(function(e) {
348
352
  e.__h &&= [];
349
- }), t = [], z.__e(n, e.__v);
353
+ }), t = [], R.__e(n, e.__v);
350
354
  }
351
- }), ge && ge(e, t);
352
- }, z.unmount = function(e) {
353
- _e && _e(e);
355
+ }), be && be(e, t);
356
+ }, R.unmount = function(e) {
357
+ xe && xe(e);
354
358
  var t, n = e.__c;
355
359
  n && n.__H && (n.__H.__.some(function(e) {
356
360
  try {
357
- U(e);
361
+ H(e);
358
362
  } catch (e) {
359
363
  t = e;
360
364
  }
361
- }), n.__H = void 0, t && z.__e(t, n.__v));
365
+ }), n.__H = void 0, t && R.__e(t, n.__v));
362
366
  };
363
- var Ce = typeof requestAnimationFrame == "function";
364
- function we(e) {
367
+ var De = typeof requestAnimationFrame == "function";
368
+ function Oe(e) {
365
369
  var t, n = function() {
366
- clearTimeout(r), Ce && cancelAnimationFrame(t), setTimeout(e);
370
+ clearTimeout(r), De && cancelAnimationFrame(t), setTimeout(e);
367
371
  }, r = setTimeout(n, 35);
368
- Ce && (t = requestAnimationFrame(n));
372
+ De && (t = requestAnimationFrame(n));
369
373
  }
370
- function U(e) {
374
+ function H(e) {
371
375
  var t = I, n = e.__c;
372
376
  typeof n == "function" && (e.__c = void 0, n()), I = t;
373
377
  }
374
- function Te(e) {
378
+ function ke(e) {
375
379
  var t = I;
376
380
  e.__c = e.__(), I = t;
377
381
  }
378
- function Ee(e, t) {
382
+ function Ae(e, t) {
379
383
  return !e || e.length !== t.length || t.some(function(t, n) {
380
384
  return t !== e[n];
381
385
  });
382
386
  }
383
- function De(e, t) {
387
+ function je(e, t) {
384
388
  return typeof t == "function" ? t(e) : t;
385
389
  }
386
390
  //#endregion
387
391
  //#region node_modules/.pnpm/preact@10.29.8/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
388
- var Oe = 0;
392
+ var Me = 0;
389
393
  Array.isArray;
390
- function W(e, t, r, i, a, o) {
394
+ function U(e, t, n, r, i, o) {
391
395
  t ||= {};
392
396
  var s, c, l = t;
393
397
  if ("ref" in l) for (c in l = {}, t) c == "ref" ? s = t[c] : l[c] = t[c];
394
398
  var u = {
395
399
  type: e,
396
400
  props: l,
397
- key: r,
401
+ key: n,
398
402
  ref: s,
399
403
  __k: null,
400
404
  __: null,
@@ -402,19 +406,19 @@ function W(e, t, r, i, a, o) {
402
406
  __e: null,
403
407
  __c: null,
404
408
  constructor: void 0,
405
- __v: --Oe,
409
+ __v: --Me,
406
410
  __i: -1,
407
411
  __u: 0,
408
- __source: a,
412
+ __source: i,
409
413
  __self: o
410
414
  };
411
415
  if (typeof e == "function" && (s = e.defaultProps)) for (c in s) l[c] === void 0 && (l[c] = s[c]);
412
- return n.vnode && n.vnode(u), u;
416
+ return a.vnode && a.vnode(u), u;
413
417
  }
414
418
  //#endregion
415
419
  //#region src/components/icons.tsx
416
- function G({ name: e, size: t, children: n }) {
417
- return /* @__PURE__ */ W("svg", {
420
+ function W({ name: e, size: t, children: n }) {
421
+ return /* @__PURE__ */ U("svg", {
418
422
  "data-icon": e,
419
423
  "aria-hidden": "true",
420
424
  focusable: "false",
@@ -429,59 +433,59 @@ function G({ name: e, size: t, children: n }) {
429
433
  children: n
430
434
  });
431
435
  }
432
- function ke({ size: e = 26 }) {
433
- return /* @__PURE__ */ W(G, {
436
+ function Ne({ size: e = 26 }) {
437
+ return /* @__PURE__ */ U(W, {
434
438
  name: "chat",
435
439
  size: e,
436
- children: [/* @__PURE__ */ W("path", { d: "M4 5.5A2.5 2.5 0 0 1 6.5 3h11A2.5 2.5 0 0 1 20 5.5v8a2.5 2.5 0 0 1-2.5 2.5H10l-4.5 4v-4h0A1.5 1.5 0 0 1 4 14.5z" }), /* @__PURE__ */ W("path", {
440
+ children: [/* @__PURE__ */ U("path", { d: "M4 5.5A2.5 2.5 0 0 1 6.5 3h11A2.5 2.5 0 0 1 20 5.5v8a2.5 2.5 0 0 1-2.5 2.5H10l-4.5 4v-4h0A1.5 1.5 0 0 1 4 14.5z" }), /* @__PURE__ */ U("path", {
437
441
  d: "M8.5 9.5h.01M12 9.5h.01M15.5 9.5h.01",
438
442
  "stroke-width": "2.5"
439
443
  })]
440
444
  });
441
445
  }
442
- function Ae({ size: e = 26 }) {
443
- return /* @__PURE__ */ W(G, {
446
+ function Pe({ size: e = 26 }) {
447
+ return /* @__PURE__ */ U(W, {
444
448
  name: "chevron-down",
445
449
  size: e,
446
- children: /* @__PURE__ */ W("path", { d: "M6 9l6 6 6-6" })
450
+ children: /* @__PURE__ */ U("path", { d: "M6 9l6 6 6-6" })
447
451
  });
448
452
  }
449
- function je({ size: e = 18 }) {
450
- return /* @__PURE__ */ W(G, {
453
+ function Fe({ size: e = 18 }) {
454
+ return /* @__PURE__ */ U(W, {
451
455
  name: "close",
452
456
  size: e,
453
- children: /* @__PURE__ */ W("path", { d: "M6 6l12 12M18 6L6 18" })
457
+ children: /* @__PURE__ */ U("path", { d: "M6 6l12 12M18 6L6 18" })
454
458
  });
455
459
  }
456
- var Me = "M7 11v9M7 11l3.5-7.2A1.8 1.8 0 0 1 14 4.6V9h4.6a2 2 0 0 1 2 2.3l-1.2 7A2 2 0 0 1 17.4 20H7M7 11H4.5A1.5 1.5 0 0 0 3 12.5v6A1.5 1.5 0 0 0 4.5 20H7";
457
- function Ne({ size: e = 16 }) {
458
- return /* @__PURE__ */ W(G, {
460
+ var Ie = "M7 11v9M7 11l3.5-7.2A1.8 1.8 0 0 1 14 4.6V9h4.6a2 2 0 0 1 2 2.3l-1.2 7A2 2 0 0 1 17.4 20H7M7 11H4.5A1.5 1.5 0 0 0 3 12.5v6A1.5 1.5 0 0 0 4.5 20H7";
461
+ function Le({ size: e = 16 }) {
462
+ return /* @__PURE__ */ U(W, {
459
463
  name: "thumb-up",
460
464
  size: e,
461
- children: /* @__PURE__ */ W("path", { d: Me })
465
+ children: /* @__PURE__ */ U("path", { d: Ie })
462
466
  });
463
467
  }
464
- function Pe({ size: e = 16 }) {
465
- return /* @__PURE__ */ W(G, {
468
+ function Re({ size: e = 16 }) {
469
+ return /* @__PURE__ */ U(W, {
466
470
  name: "thumb-down",
467
471
  size: e,
468
- children: /* @__PURE__ */ W("path", {
469
- d: Me,
472
+ children: /* @__PURE__ */ U("path", {
473
+ d: Ie,
470
474
  transform: "matrix(1 0 0 -1 0 24)"
471
475
  })
472
476
  });
473
477
  }
474
478
  //#endregion
475
479
  //#region src/components/Launcher.tsx
476
- function Fe({ isOpen: e, onClick: t, iconUrl: n, buttonRef: r }) {
477
- let [i, a] = B("loading"), o = n !== void 0 && i !== "failed", s = o && !e && i === "loaded";
478
- return /* @__PURE__ */ W("button", {
480
+ function ze({ isOpen: e, onClick: t, iconUrl: n, buttonRef: r }) {
481
+ let [i, a] = z("loading"), o = n !== void 0 && i !== "failed", s = o && !e && i === "loaded";
482
+ return /* @__PURE__ */ U("button", {
479
483
  type: "button",
480
484
  class: "whoo-widget-launcher",
481
485
  onClick: t,
482
486
  "aria-label": e ? "Close chat" : "Open chat",
483
487
  ref: r,
484
- children: [e ? /* @__PURE__ */ W(Ae, {}) : s ? null : /* @__PURE__ */ W(ke, {}), o ? /* @__PURE__ */ W("img", {
488
+ children: [e ? /* @__PURE__ */ U(Pe, {}) : s ? null : /* @__PURE__ */ U(Ne, {}), o ? /* @__PURE__ */ U("img", {
485
489
  class: "whoo-widget-launcher-icon-image",
486
490
  src: n,
487
491
  alt: "",
@@ -494,16 +498,16 @@ function Fe({ isOpen: e, onClick: t, iconUrl: n, buttonRef: r }) {
494
498
  }
495
499
  //#endregion
496
500
  //#region src/components/Composer.tsx
497
- function Ie({ value: e, onChange: t, onSend: n, disabled: r, inputRef: i }) {
498
- return /* @__PURE__ */ W("div", {
501
+ function Be({ value: e, onChange: t, onSend: n, disabled: r, inputRef: i }) {
502
+ return /* @__PURE__ */ U("div", {
499
503
  class: "whoo-widget-composer",
500
504
  children: [
501
- /* @__PURE__ */ W("label", {
505
+ /* @__PURE__ */ U("label", {
502
506
  class: "whoo-widget-sr-only",
503
507
  for: "whoo-widget-composer-input",
504
508
  children: "Message"
505
509
  }),
506
- /* @__PURE__ */ W("input", {
510
+ /* @__PURE__ */ U("input", {
507
511
  id: "whoo-widget-composer-input",
508
512
  class: "whoo-widget-composer-input",
509
513
  value: e,
@@ -515,7 +519,7 @@ function Ie({ value: e, onChange: t, onSend: n, disabled: r, inputRef: i }) {
515
519
  e.key === "Enter" && n();
516
520
  }
517
521
  }),
518
- /* @__PURE__ */ W("button", {
522
+ /* @__PURE__ */ U("button", {
519
523
  type: "button",
520
524
  class: "whoo-widget-composer-send",
521
525
  onClick: n,
@@ -527,8 +531,8 @@ function Ie({ value: e, onChange: t, onSend: n, disabled: r, inputRef: i }) {
527
531
  }
528
532
  //#endregion
529
533
  //#region src/components/ErrorBanner.tsx
530
- function Le({ message: e }) {
531
- return /* @__PURE__ */ W("div", {
534
+ function Ve({ message: e }) {
535
+ return /* @__PURE__ */ U("div", {
532
536
  class: "whoo-widget-error-banner",
533
537
  role: "alert",
534
538
  children: e
@@ -536,8 +540,8 @@ function Le({ message: e }) {
536
540
  }
537
541
  //#endregion
538
542
  //#region src/markdown/tokenizer.ts
539
- var K = /\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/y, q = /\*\*([^*\s](?:[^*]*[^*\s])?)\*\*/y, J = /(?<![A-Za-z0-9_])_([^_\s](?:[^_]*[^_\s])?)_(?![A-Za-z0-9_])/y, Y = /\*([^*\s](?:[^*]*[^*\s])?)\*/y, X = /[ \t]*[*+-][ \t]+/y, Re = /https?:\/\/\S+/y, ze = /[.,;:!?)\]}>]+$/;
540
- function Be(e) {
543
+ var G = /\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/y, K = /\*\*([^*\s](?:[^*]*[^*\s])?)\*\*/y, q = /(?<![A-Za-z0-9_])_([^_\s](?:[^_]*[^_\s])?)_(?![A-Za-z0-9_])/y, J = /\*([^*\s](?:[^*]*[^*\s])?)\*/y, Y = /[ \t]*[*+-][ \t]+/y, He = /https?:\/\/\S+/y, Ue = /[.,;:!?)\]}>]+$/;
544
+ function We(e) {
541
545
  let t = [], n = 0, r = 0, i = (n) => {
542
546
  n > r && t.push({
543
547
  type: "text",
@@ -547,13 +551,13 @@ function Be(e) {
547
551
  });
548
552
  };
549
553
  for (; n < e.length;) {
550
- if ((n === 0 || e[n - 1] === "\n") && (X.lastIndex = n, X.exec(e))) {
554
+ if ((n === 0 || e[n - 1] === "\n") && (Y.lastIndex = n, Y.exec(e))) {
551
555
  i(n), t.push({
552
556
  type: "text",
553
557
  value: "• ",
554
558
  start: n,
555
- end: X.lastIndex
556
- }), n = X.lastIndex, r = n;
559
+ end: Y.lastIndex
560
+ }), n = Y.lastIndex, r = n;
557
561
  continue;
558
562
  }
559
563
  if (e[n] === "!" && n + 1 < e.length && e[n + 1] === "[") {
@@ -566,56 +570,56 @@ function Be(e) {
566
570
  }
567
571
  }
568
572
  if (e[n - 1] !== "!") {
569
- K.lastIndex = n;
570
- let a = K.exec(e);
573
+ G.lastIndex = n;
574
+ let a = G.exec(e);
571
575
  if (a) {
572
576
  i(n), t.push({
573
577
  type: "link",
574
578
  text: a[1],
575
579
  url: a[2],
576
580
  start: n,
577
- end: K.lastIndex
578
- }), n = K.lastIndex, r = n;
581
+ end: G.lastIndex
582
+ }), n = G.lastIndex, r = n;
579
583
  continue;
580
584
  }
581
585
  }
582
- q.lastIndex = n;
583
- let a = q.exec(e);
586
+ K.lastIndex = n;
587
+ let a = K.exec(e);
584
588
  if (a) {
585
589
  i(n), t.push({
586
590
  type: "bold",
587
591
  value: a[1],
588
592
  start: n,
589
- end: q.lastIndex
590
- }), n = q.lastIndex, r = n;
593
+ end: K.lastIndex
594
+ }), n = K.lastIndex, r = n;
591
595
  continue;
592
596
  }
593
- J.lastIndex = n;
594
- let o = J.exec(e);
597
+ q.lastIndex = n;
598
+ let o = q.exec(e);
595
599
  if (o) {
596
600
  i(n), t.push({
597
601
  type: "italic",
598
602
  value: o[1],
599
603
  start: n,
600
- end: J.lastIndex
601
- }), n = J.lastIndex, r = n;
604
+ end: q.lastIndex
605
+ }), n = q.lastIndex, r = n;
602
606
  continue;
603
607
  }
604
- Y.lastIndex = n;
605
- let s = Y.exec(e);
608
+ J.lastIndex = n;
609
+ let s = J.exec(e);
606
610
  if (s) {
607
611
  i(n), t.push({
608
612
  type: "italic",
609
613
  value: s[1],
610
614
  start: n,
611
- end: Y.lastIndex
612
- }), n = Y.lastIndex, r = n;
615
+ end: J.lastIndex
616
+ }), n = J.lastIndex, r = n;
613
617
  continue;
614
618
  }
615
- Re.lastIndex = n;
616
- let c = Re.exec(e);
619
+ He.lastIndex = n;
620
+ let c = He.exec(e);
617
621
  if (c) {
618
- let e = c[0].match(ze), a = e ? c[0].slice(0, c[0].length - e[0].length) : c[0];
622
+ let e = c[0].match(Ue), a = e ? c[0].slice(0, c[0].length - e[0].length) : c[0];
619
623
  if (a.length > 0) {
620
624
  i(n), t.push({
621
625
  type: "link",
@@ -633,16 +637,16 @@ function Be(e) {
633
637
  }
634
638
  //#endregion
635
639
  //#region src/markdown/render.tsx
636
- function Ve(e) {
637
- return Be(e).map((e, t) => {
640
+ function Ge(e) {
641
+ return We(e).map((e, t) => {
638
642
  switch (e.type) {
639
- case "bold": return /* @__PURE__ */ W("strong", { children: Ve(e.value) }, t);
640
- case "italic": return /* @__PURE__ */ W("em", { children: Ve(e.value) }, t);
641
- case "link": return /* @__PURE__ */ W("a", {
643
+ case "bold": return /* @__PURE__ */ U("strong", { children: Ge(e.value) }, t);
644
+ case "italic": return /* @__PURE__ */ U("em", { children: Ge(e.value) }, t);
645
+ case "link": return /* @__PURE__ */ U("a", {
642
646
  href: e.url,
643
647
  target: "_blank",
644
648
  rel: "noopener noreferrer",
645
- children: [e.text, /* @__PURE__ */ W("span", {
649
+ children: [e.text, /* @__PURE__ */ U("span", {
646
650
  class: "whoo-widget-sr-only",
647
651
  children: " (opens in new tab)"
648
652
  })]
@@ -653,7 +657,7 @@ function Ve(e) {
653
657
  }
654
658
  //#endregion
655
659
  //#region src/components/MessageFeedback.tsx
656
- var He = [
660
+ var Ke = [
657
661
  {
658
662
  value: "",
659
663
  label: "Select a reason (optional)"
@@ -675,50 +679,50 @@ var He = [
675
679
  label: "Other"
676
680
  }
677
681
  ];
678
- function Ue({ state: e, containerRef: t, onThumbsUp: n, onThumbsDown: r, onSubmitDetailed: i, onCancel: a }) {
679
- let [o, s] = B(""), [c, l] = B(""), u = H(e.status);
680
- if (V(() => {
682
+ function qe({ state: e, containerRef: t, onThumbsUp: n, onThumbsDown: r, onSubmitDetailed: i, onCancel: a }) {
683
+ let [o, s] = z(""), [c, l] = z(""), u = V(e.status);
684
+ if (B(() => {
681
685
  let n = u.current;
682
686
  if (u.current = e.status, n === e.status) return;
683
687
  let r = t?.current;
684
688
  if (!r) return;
685
689
  let i = r.getRootNode();
686
690
  r.contains(i.activeElement) || r.focus();
687
- }, [e.status, t]), e.status === "submitted") return /* @__PURE__ */ W("div", {
691
+ }, [e.status, t]), e.status === "submitted") return /* @__PURE__ */ U("div", {
688
692
  class: "whoo-widget-feedback-submitted",
689
693
  role: "status",
690
694
  children: "Thanks for the feedback"
691
695
  });
692
- if (e.status === "expanded") return /* @__PURE__ */ W("div", {
696
+ if (e.status === "expanded") return /* @__PURE__ */ U("div", {
693
697
  class: "whoo-widget-feedback-form",
694
698
  children: [
695
- /* @__PURE__ */ W("label", { children: [/* @__PURE__ */ W("span", {
699
+ /* @__PURE__ */ U("label", { children: [/* @__PURE__ */ U("span", {
696
700
  class: "whoo-widget-sr-only",
697
701
  children: "Additional feedback"
698
- }), /* @__PURE__ */ W("textarea", {
702
+ }), /* @__PURE__ */ U("textarea", {
699
703
  class: "whoo-widget-feedback-textarea",
700
704
  value: o,
701
705
  onInput: (e) => s(e.target.value),
702
706
  placeholder: "What was wrong? (optional)"
703
707
  })] }),
704
- /* @__PURE__ */ W("select", {
708
+ /* @__PURE__ */ U("select", {
705
709
  class: "whoo-widget-feedback-select",
706
710
  "aria-label": "Feedback category",
707
711
  value: c,
708
712
  onChange: (e) => l(e.target.value),
709
- children: He.map((e) => /* @__PURE__ */ W("option", {
713
+ children: Ke.map((e) => /* @__PURE__ */ U("option", {
710
714
  value: e.value,
711
715
  children: e.label
712
716
  }, e.value))
713
717
  }),
714
- /* @__PURE__ */ W("div", {
718
+ /* @__PURE__ */ U("div", {
715
719
  class: "whoo-widget-feedback-form-buttons",
716
- children: [/* @__PURE__ */ W("button", {
720
+ children: [/* @__PURE__ */ U("button", {
717
721
  type: "button",
718
722
  class: "whoo-widget-feedback-submit",
719
723
  onClick: () => i(o, c),
720
724
  children: "Submit"
721
- }), /* @__PURE__ */ W("button", {
725
+ }), /* @__PURE__ */ U("button", {
722
726
  type: "button",
723
727
  class: "whoo-widget-feedback-cancel",
724
728
  onClick: a,
@@ -728,24 +732,24 @@ function Ue({ state: e, containerRef: t, onThumbsUp: n, onThumbsDown: r, onSubmi
728
732
  ]
729
733
  });
730
734
  let d = e.status === "submitting";
731
- return /* @__PURE__ */ W("div", {
735
+ return /* @__PURE__ */ U("div", {
732
736
  class: "whoo-widget-feedback",
733
- children: [/* @__PURE__ */ W("div", {
737
+ children: [/* @__PURE__ */ U("div", {
734
738
  class: "whoo-widget-feedback-buttons",
735
- children: [/* @__PURE__ */ W("button", {
739
+ children: [/* @__PURE__ */ U("button", {
736
740
  type: "button",
737
741
  "aria-label": "Good response",
738
742
  disabled: d,
739
743
  onClick: n,
740
- children: /* @__PURE__ */ W(Ne, {})
741
- }), /* @__PURE__ */ W("button", {
744
+ children: /* @__PURE__ */ U(Le, {})
745
+ }), /* @__PURE__ */ U("button", {
742
746
  type: "button",
743
747
  "aria-label": "Bad response",
744
748
  disabled: d,
745
749
  onClick: r,
746
- children: /* @__PURE__ */ W(Pe, {})
750
+ children: /* @__PURE__ */ U(Re, {})
747
751
  })]
748
- }), e.status === "error" ? /* @__PURE__ */ W("div", {
752
+ }), e.status === "error" ? /* @__PURE__ */ U("div", {
749
753
  class: "whoo-widget-feedback-error",
750
754
  role: "status",
751
755
  children: "Couldn't send feedback"
@@ -754,27 +758,27 @@ function Ue({ state: e, containerRef: t, onThumbsUp: n, onThumbsDown: r, onSubmi
754
758
  }
755
759
  //#endregion
756
760
  //#region src/components/MessageList.tsx
757
- function We({ isSlowResponse: e }) {
758
- return /* @__PURE__ */ W("div", {
761
+ function Je({ isSlowResponse: e }) {
762
+ return /* @__PURE__ */ U("div", {
759
763
  class: "whoo-widget-pending",
760
764
  role: "status",
761
- children: [/* @__PURE__ */ W("span", {
765
+ children: [/* @__PURE__ */ U("span", {
762
766
  class: "whoo-widget-typing",
763
767
  "aria-hidden": "true",
764
768
  children: [
765
- /* @__PURE__ */ W("span", {}),
766
- /* @__PURE__ */ W("span", {}),
767
- /* @__PURE__ */ W("span", {})
769
+ /* @__PURE__ */ U("span", {}),
770
+ /* @__PURE__ */ U("span", {}),
771
+ /* @__PURE__ */ U("span", {})
768
772
  ]
769
- }), e ? /* @__PURE__ */ W("span", {
773
+ }), e ? /* @__PURE__ */ U("span", {
770
774
  class: "whoo-widget-pending-text",
771
775
  children: "Looking that up for you…"
772
776
  }) : null]
773
777
  });
774
778
  }
775
- function Ge({ url: e, alt: t }) {
776
- let [n, r] = B(!1);
777
- return n ? null : /* @__PURE__ */ W("img", {
779
+ function Ye({ url: e, alt: t }) {
780
+ let [n, r] = z(!1);
781
+ return n ? null : /* @__PURE__ */ U("img", {
778
782
  class: "whoo-widget-empty-state-image",
779
783
  src: e,
780
784
  alt: t,
@@ -782,41 +786,42 @@ function Ge({ url: e, alt: t }) {
782
786
  onError: () => r(!0)
783
787
  });
784
788
  }
785
- function Ke({ message: e, feedbackState: t, pending: n, isSlowResponse: r, onThumbsUp: i, onThumbsDown: a, onSubmitDetailed: o, onCancelFeedback: s }) {
786
- let c = H(null), l = e.id;
787
- return /* @__PURE__ */ W("div", {
788
- ref: c,
789
+ function Xe({ message: e, feedbackState: t, showFeedback: n, pending: r, isSlowResponse: i, onThumbsUp: a, onThumbsDown: o, onSubmitDetailed: s, onCancelFeedback: c }) {
790
+ let l = V(null), u = e.id;
791
+ return /* @__PURE__ */ U("div", {
792
+ ref: l,
789
793
  tabIndex: -1,
790
794
  class: `whoo-widget-message whoo-widget-message--${e.role}`,
791
- children: [n ? /* @__PURE__ */ W(We, { isSlowResponse: r }) : Ve(e.content), e.role === "assistant" && l ? /* @__PURE__ */ W(Ue, {
795
+ children: [r ? /* @__PURE__ */ U(Je, { isSlowResponse: i }) : Ge(e.content), n && e.role === "assistant" && u ? /* @__PURE__ */ U(qe, {
792
796
  state: t,
793
- containerRef: c,
794
- onThumbsUp: () => i(l),
795
- onThumbsDown: () => a(l),
796
- onSubmitDetailed: (e, t) => o(l, e, t),
797
- onCancel: () => s(l)
797
+ containerRef: l,
798
+ onThumbsUp: () => a(u),
799
+ onThumbsDown: () => o(u),
800
+ onSubmitDetailed: (e, t) => s(u, e, t),
801
+ onCancel: () => c(u)
798
802
  }) : null]
799
803
  });
800
804
  }
801
- function qe({ messages: e, messageFeedback: t, lastCompletedMessageText: n, emptyStateImage: r, isStreaming: i = !1, isSlowResponse: a = !1, onThumbsUp: o, onThumbsDown: s, onSubmitDetailed: c, onCancelFeedback: l }) {
802
- let u = H(null);
803
- return V(() => {
804
- let e = u.current;
805
+ function Ze({ messages: e, messageFeedback: t, lastCompletedMessageText: n, emptyStateImage: r, showFeedback: i = !1, isStreaming: a = !1, isSlowResponse: o = !1, onThumbsUp: s, onThumbsDown: c, onSubmitDetailed: l, onCancelFeedback: u }) {
806
+ let d = V(null);
807
+ return B(() => {
808
+ let e = d.current;
805
809
  e && (e.scrollTop = e.scrollHeight);
806
- }, [e, a]), /* @__PURE__ */ W(C, { children: [/* @__PURE__ */ W("div", {
810
+ }, [e, o]), /* @__PURE__ */ U(T, { children: [/* @__PURE__ */ U("div", {
807
811
  class: "whoo-widget-message-list",
808
- ref: u,
809
- children: [r ? /* @__PURE__ */ W(Ge, { ...r }) : null, e.map((n, r) => /* @__PURE__ */ W(Ke, {
812
+ ref: d,
813
+ children: [r ? /* @__PURE__ */ U(Ye, { ...r }) : null, e.map((n, r) => /* @__PURE__ */ U(Xe, {
810
814
  message: n,
815
+ showFeedback: i,
811
816
  feedbackState: n.id ? t[n.id] ?? { status: "idle" } : { status: "idle" },
812
- pending: i && r === e.length - 1 && n.role === "assistant" && n.content === "",
813
- isSlowResponse: a,
814
- onThumbsUp: o,
815
- onThumbsDown: s,
816
- onSubmitDetailed: c,
817
- onCancelFeedback: l
817
+ pending: a && r === e.length - 1 && n.role === "assistant" && n.content === "",
818
+ isSlowResponse: o,
819
+ onThumbsUp: s,
820
+ onThumbsDown: c,
821
+ onSubmitDetailed: l,
822
+ onCancelFeedback: u
818
823
  }, n.id ?? r))]
819
- }), /* @__PURE__ */ W("div", {
824
+ }), /* @__PURE__ */ U("div", {
820
825
  class: "whoo-widget-sr-only",
821
826
  "aria-live": "polite",
822
827
  "aria-atomic": "true",
@@ -825,16 +830,16 @@ function qe({ messages: e, messageFeedback: t, lastCompletedMessageText: n, empt
825
830
  }
826
831
  //#endregion
827
832
  //#region src/components/Panel.tsx
828
- var Je = "button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"])";
829
- function Ye(e) {
830
- return Array.from(e.querySelectorAll(Je)).filter((e) => {
833
+ var Qe = "button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"])";
834
+ function $e(e) {
835
+ return Array.from(e.querySelectorAll(Qe)).filter((e) => {
831
836
  let t = getComputedStyle(e);
832
837
  return t.display !== "none" && t.visibility !== "hidden";
833
838
  });
834
839
  }
835
- function Xe({ state: e, controller: t, greeting: n }) {
836
- let r = H(null), i = H(null);
837
- V(() => {
840
+ function et({ state: e, controller: t, greeting: n }) {
841
+ let r = V(null), i = V(null);
842
+ B(() => {
838
843
  i.current?.focus();
839
844
  }, []);
840
845
  let a = (e) => {
@@ -845,7 +850,7 @@ function Xe({ state: e, controller: t, greeting: n }) {
845
850
  if (e.key !== "Tab") return;
846
851
  let n = r.current;
847
852
  if (!n) return;
848
- let i = Ye(n);
853
+ let i = $e(n);
849
854
  if (i.length === 0) return;
850
855
  let a = i[0], o = i[i.length - 1], s = n.getRootNode().activeElement;
851
856
  if (!n.contains(s)) {
@@ -864,7 +869,7 @@ function Xe({ state: e, controller: t, greeting: n }) {
864
869
  url: l,
865
870
  alt: t.emptyStateImageAlt
866
871
  } : void 0;
867
- return /* @__PURE__ */ W("div", {
872
+ return /* @__PURE__ */ U("div", {
868
873
  class: "whoo-widget-panel",
869
874
  role: "dialog",
870
875
  "aria-modal": "true",
@@ -872,32 +877,33 @@ function Xe({ state: e, controller: t, greeting: n }) {
872
877
  ref: r,
873
878
  onKeyDown: a,
874
879
  children: [
875
- /* @__PURE__ */ W("div", {
880
+ /* @__PURE__ */ U("div", {
876
881
  class: "whoo-widget-header",
877
- children: [/* @__PURE__ */ W("h2", {
882
+ children: [/* @__PURE__ */ U("h2", {
878
883
  class: "whoo-widget-header-title",
879
884
  children: s
880
- }), /* @__PURE__ */ W("div", {
885
+ }), /* @__PURE__ */ U("div", {
881
886
  class: "whoo-widget-header-actions",
882
- children: [e.messages.length > 0 && /* @__PURE__ */ W("button", {
887
+ children: [e.messages.length > 0 && /* @__PURE__ */ U("button", {
883
888
  type: "button",
884
889
  class: "whoo-widget-header-reset",
885
890
  onClick: () => t.resetConversation(),
886
891
  children: "New conversation"
887
- }), /* @__PURE__ */ W("button", {
892
+ }), /* @__PURE__ */ U("button", {
888
893
  type: "button",
889
894
  class: "whoo-widget-header-close",
890
895
  "aria-label": "Close chat",
891
896
  onClick: () => t.close(),
892
- children: /* @__PURE__ */ W(je, {})
897
+ children: /* @__PURE__ */ U(Fe, {})
893
898
  })]
894
899
  })]
895
900
  }),
896
- /* @__PURE__ */ W(qe, {
901
+ /* @__PURE__ */ U(Ze, {
897
902
  messages: c,
898
903
  messageFeedback: e.messageFeedback,
899
904
  lastCompletedMessageText: e.lastCompletedMessageText,
900
905
  emptyStateImage: u,
906
+ showFeedback: t.showFeedback,
901
907
  isStreaming: e.isStreaming,
902
908
  isSlowResponse: e.isSlowResponse,
903
909
  onThumbsUp: (e) => t.submitFeedback(e, "up"),
@@ -905,8 +911,8 @@ function Xe({ state: e, controller: t, greeting: n }) {
905
911
  onSubmitDetailed: (e, n, r) => t.submitFeedback(e, "down", n || void 0, r || void 0),
906
912
  onCancelFeedback: (e) => t.cancelFeedback(e)
907
913
  }),
908
- e.runtimeError && /* @__PURE__ */ W(Le, { message: e.runtimeError }),
909
- /* @__PURE__ */ W(Ie, {
914
+ e.runtimeError && /* @__PURE__ */ U(Ve, { message: e.runtimeError }),
915
+ /* @__PURE__ */ U(Be, {
910
916
  value: e.draft,
911
917
  onChange: (e) => t.setDraft(e),
912
918
  onSend: o,
@@ -918,16 +924,16 @@ function Xe({ state: e, controller: t, greeting: n }) {
918
924
  }
919
925
  //#endregion
920
926
  //#region src/components/App.tsx
921
- function Ze({ controller: e }) {
922
- let [t, n] = B(e.getState()), r = H(null), i = H(t.isOpen);
923
- return V(() => (n(e.getState()), e.subscribe(n)), [e]), V(() => {
927
+ function tt({ controller: e }) {
928
+ let [t, n] = z(e.getState()), r = V(null), i = V(t.isOpen);
929
+ return B(() => (n(e.getState()), e.subscribe(n)), [e]), B(() => {
924
930
  i.current && !t.isOpen && r.current?.focus(), i.current = t.isOpen;
925
- }, [t.isOpen]), t.initError ? null : /* @__PURE__ */ W(C, { children: [/* @__PURE__ */ W(Fe, {
931
+ }, [t.isOpen]), t.initError ? null : /* @__PURE__ */ U(T, { children: [/* @__PURE__ */ U(ze, {
926
932
  isOpen: t.isOpen,
927
933
  onClick: () => t.isOpen ? e.close() : e.open(),
928
934
  iconUrl: e.launcherIconUrl,
929
935
  buttonRef: r
930
- }), t.isOpen && /* @__PURE__ */ W(Xe, {
936
+ }), t.isOpen && /* @__PURE__ */ U(et, {
931
937
  state: t,
932
938
  controller: e,
933
939
  greeting: e.config.greeting
@@ -935,34 +941,34 @@ function Ze({ controller: e }) {
935
941
  }
936
942
  //#endregion
937
943
  //#region src/api/client.ts
938
- var Qe = class extends Error {
944
+ var nt = class extends Error {
939
945
  status;
940
946
  constructor(e, t) {
941
947
  super(e), this.name = "WidgetApiError", this.status = t;
942
948
  }
943
949
  };
944
- function $e(e) {
950
+ function rt(e) {
945
951
  if (typeof e != "string") return null;
946
952
  let t = e.trim();
947
953
  return t === "" ? null : t;
948
954
  }
949
- async function et(e, t) {
955
+ async function it(e, t) {
950
956
  let n = await fetch(`${e}/api/v1/widget/session`, {
951
957
  method: "POST",
952
958
  headers: { "Content-Type": "application/json" },
953
959
  body: JSON.stringify({ publishable_key: t })
954
960
  });
955
- if (!n.ok) throw new Qe(`Failed to create widget session (${n.status})`, n.status);
961
+ if (!n.ok) throw new nt(`Failed to create widget session (${n.status})`, n.status);
956
962
  let r = await n.json();
957
963
  return {
958
964
  token: r.token,
959
965
  primaryColor: r.primary_color ?? null,
960
- name: $e(r.name),
961
- accentColor: $e(r.accent_color),
962
- inkColor: $e(r.ink_color)
966
+ name: rt(r.name),
967
+ accentColor: rt(r.accent_color),
968
+ inkColor: rt(r.ink_color)
963
969
  };
964
970
  }
965
- async function tt(e, t, n) {
971
+ async function at(e, t, n) {
966
972
  let r = await fetch(`${e}/api/v1/widget/feedback`, {
967
973
  method: "POST",
968
974
  headers: {
@@ -976,11 +982,11 @@ async function tt(e, t, n) {
976
982
  category: n.category ?? null
977
983
  })
978
984
  });
979
- if (!r.ok) throw new Qe(`Feedback submission failed (${r.status})`, r.status);
985
+ if (!r.ok) throw new nt(`Feedback submission failed (${r.status})`, r.status);
980
986
  }
981
987
  //#endregion
982
988
  //#region src/api/sse.ts
983
- async function* nt(e, t, n, r, i) {
989
+ async function* ot(e, t, n, r, i) {
984
990
  let a = await fetch(`${e}/api/v1/widget/chat`, {
985
991
  method: "POST",
986
992
  headers: {
@@ -993,7 +999,7 @@ async function* nt(e, t, n, r, i) {
993
999
  }),
994
1000
  signal: i
995
1001
  });
996
- if (!a.ok || !a.body) throw new Qe(`Chat request failed (${a.status})`, a.status);
1002
+ if (!a.ok || !a.body) throw new nt(`Chat request failed (${a.status})`, a.status);
997
1003
  let o = a.body.getReader(), s = new TextDecoder(), c = "";
998
1004
  for (;;) {
999
1005
  let { done: e, value: t } = await o.read();
@@ -1004,11 +1010,11 @@ async function* nt(e, t, n, r, i) {
1004
1010
  let e = c.slice(0, n);
1005
1011
  c = c.slice(n + 2);
1006
1012
  let t = e.split("\n").find((e) => e.startsWith("data: "));
1007
- t && (yield rt(JSON.parse(t.slice(6)))), n = c.indexOf("\n\n");
1013
+ t && (yield st(JSON.parse(t.slice(6)))), n = c.indexOf("\n\n");
1008
1014
  }
1009
1015
  }
1010
1016
  }
1011
- function rt(e) {
1017
+ function st(e) {
1012
1018
  return typeof e.error == "string" ? {
1013
1019
  type: "error",
1014
1020
  error: e.error,
@@ -1031,7 +1037,7 @@ function rt(e) {
1031
1037
  }
1032
1038
  //#endregion
1033
1039
  //#region src/imageUrl.ts
1034
- function it(e, t) {
1040
+ function ct(e, t) {
1035
1041
  if (e != null && e !== "") {
1036
1042
  if (typeof e == "string") try {
1037
1043
  let t = new URL(e);
@@ -1042,16 +1048,16 @@ function it(e, t) {
1042
1048
  }
1043
1049
  //#endregion
1044
1050
  //#region src/markdown/reveal.ts
1045
- var at = 40, ot = 120;
1046
- function st(e) {
1051
+ var lt = 40, ut = 120;
1052
+ function dt(e) {
1047
1053
  let t = [];
1048
- for (let n of Be(e)) if (n.type === "text") {
1054
+ for (let n of We(e)) if (n.type === "text") {
1049
1055
  let e = n.value.split(/(\s+)/), r = n.start;
1050
1056
  for (let n of e) r += n.length, n.trim().length > 0 && t.push(r);
1051
1057
  } else t.push(n.end);
1052
1058
  return t;
1053
1059
  }
1054
- function ct(e) {
1060
+ function ft(e) {
1055
1061
  let t = null;
1056
1062
  return e?.addEventListener("abort", () => {
1057
1063
  t?.();
@@ -1066,36 +1072,36 @@ function ct(e) {
1066
1072
  });
1067
1073
  };
1068
1074
  }
1069
- async function lt(e, t, n) {
1070
- let r = n?.wordIntervalMs ?? at, i = n?.tokenIntervalMs ?? ot, a = n?.signal, o = Be(e), s = new Set(o.filter((e) => e.type !== "text").map((e) => e.end)), c = ct(a), l = "";
1071
- for (let n of st(e)) if (a?.aborted || (l = e.slice(0, n), t(l), await c(s.has(n) ? i : r), a?.aborted)) return;
1075
+ async function pt(e, t, n) {
1076
+ let r = n?.wordIntervalMs ?? lt, i = n?.tokenIntervalMs ?? ut, a = n?.signal, o = We(e), s = new Set(o.filter((e) => e.type !== "text").map((e) => e.end)), c = ft(a), l = "";
1077
+ for (let n of dt(e)) if (a?.aborted || (l = e.slice(0, n), t(l), await c(s.has(n) ? i : r), a?.aborted)) return;
1072
1078
  l !== e && t(e);
1073
1079
  }
1074
1080
  //#endregion
1075
1081
  //#region src/storage.ts
1076
- function ut(e) {
1082
+ function mt(e) {
1077
1083
  return `whoo-aiden-widget:conversation:${e}`;
1078
1084
  }
1079
- function dt(e) {
1085
+ function ht(e) {
1080
1086
  try {
1081
- return window.sessionStorage.getItem(ut(e));
1087
+ return window.sessionStorage.getItem(mt(e));
1082
1088
  } catch {
1083
1089
  return null;
1084
1090
  }
1085
1091
  }
1086
- function ft(e, t) {
1092
+ function gt(e, t) {
1087
1093
  try {
1088
- window.sessionStorage.setItem(ut(e), t);
1094
+ window.sessionStorage.setItem(mt(e), t);
1089
1095
  } catch {}
1090
1096
  }
1091
- function pt(e) {
1097
+ function _t(e) {
1092
1098
  try {
1093
- window.sessionStorage.removeItem(ut(e));
1099
+ window.sessionStorage.removeItem(mt(e));
1094
1100
  } catch {}
1095
1101
  }
1096
1102
  //#endregion
1097
1103
  //#region src/controller.ts
1098
- var mt = 8e3, ht = class {
1104
+ var vt = 8e3, yt = class {
1099
1105
  config;
1100
1106
  state;
1101
1107
  listeners = /* @__PURE__ */ new Set();
@@ -1108,8 +1114,9 @@ var mt = 8e3, ht = class {
1108
1114
  launcherIconUrl;
1109
1115
  emptyStateImageUrl;
1110
1116
  emptyStateImageAlt;
1117
+ showFeedback;
1111
1118
  constructor(e) {
1112
- this.config = e, this.launcherIconUrl = it(e.launcherIconUrl, "launcherIconUrl"), this.emptyStateImageUrl = it(e.emptyStateImageUrl, "emptyStateImageUrl"), this.emptyStateImageAlt = typeof e.emptyStateImageAlt == "string" ? e.emptyStateImageAlt.trim() : "", this.storageIdentifier = e.publishableKey ?? "session-token-mode", this.prefersReducedMotion = typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, this.state = {
1119
+ this.config = e, this.launcherIconUrl = ct(e.launcherIconUrl, "launcherIconUrl"), this.emptyStateImageUrl = ct(e.emptyStateImageUrl, "emptyStateImageUrl"), this.emptyStateImageAlt = typeof e.emptyStateImageAlt == "string" ? e.emptyStateImageAlt.trim() : "", this.showFeedback = e.showFeedback === !0, this.storageIdentifier = e.publishableKey ?? "session-token-mode", this.prefersReducedMotion = typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, this.state = {
1113
1120
  isOpen: !1,
1114
1121
  messages: [],
1115
1122
  isStreaming: !1,
@@ -1146,7 +1153,7 @@ var mt = 8e3, ht = class {
1146
1153
  try {
1147
1154
  if (this.config.sessionToken) this.sessionToken = this.config.sessionToken;
1148
1155
  else if (this.config.publishableKey) {
1149
- let { token: t, primaryColor: n, name: r, accentColor: i, inkColor: a } = await et(e, this.config.publishableKey);
1156
+ let { token: t, primaryColor: n, name: r, accentColor: i, inkColor: a } = await it(e, this.config.publishableKey);
1150
1157
  this.sessionToken = t, this.setState({
1151
1158
  primaryColor: n,
1152
1159
  agentName: r,
@@ -1158,13 +1165,13 @@ var mt = 8e3, ht = class {
1158
1165
  console.error("[whoo-aiden-widget] initialization failed:", e), this.setState({ initError: e instanceof Error ? e.message : String(e) });
1159
1166
  return;
1160
1167
  }
1161
- this.conversationId = dt(this.storageIdentifier);
1168
+ this.conversationId = ht(this.storageIdentifier);
1162
1169
  }
1163
1170
  open() {
1164
1171
  this.setState({ isOpen: !0 });
1165
1172
  }
1166
1173
  resetConversation() {
1167
- this.activeRequestController?.abort(), this.activeRequestController = null, this.clearSlowResponse(), this.conversationId = null, pt(this.storageIdentifier), this.setState({
1174
+ this.activeRequestController?.abort(), this.activeRequestController = null, this.clearSlowResponse(), this.conversationId = null, _t(this.storageIdentifier), this.setState({
1168
1175
  messages: [],
1169
1176
  messageFeedback: {},
1170
1177
  runtimeError: null,
@@ -1209,7 +1216,7 @@ var mt = 8e3, ht = class {
1209
1216
  let { signal: a } = this.activeRequestController;
1210
1217
  this.slowResponseTimer = setTimeout(() => {
1211
1218
  this.slowResponseTimer = null, this.setState({ isSlowResponse: !0 });
1212
- }, mt);
1219
+ }, vt);
1213
1220
  let o = () => {
1214
1221
  this.setState({
1215
1222
  runtimeError: "Something went wrong, please try again.",
@@ -1217,10 +1224,10 @@ var mt = 8e3, ht = class {
1217
1224
  });
1218
1225
  }, s = "";
1219
1226
  try {
1220
- for await (let n of nt(t, this.sessionToken, this.conversationId, e, a)) if (n.type === "conversation_id") this.conversationId = n.conversationId, ft(this.storageIdentifier, n.conversationId);
1221
- else if (n.type === "delta") this.clearSlowResponse(), n.verbatim && !this.prefersReducedMotion ? (await lt(n.delta, (e) => i(e), { signal: a }), s = n.delta) : n.verbatim ? (s = n.delta, i(s)) : (s += n.delta, i(s));
1227
+ for await (let n of ot(t, this.sessionToken, this.conversationId, e, a)) if (n.type === "conversation_id") this.conversationId = n.conversationId, gt(this.storageIdentifier, n.conversationId);
1228
+ else if (n.type === "delta") this.clearSlowResponse(), n.verbatim && !this.prefersReducedMotion ? (await pt(n.delta, (e) => i(e), { signal: a }), s = n.delta) : n.verbatim ? (s = n.delta, i(s)) : (s += n.delta, i(s));
1222
1229
  else if (n.type === "done") {
1223
- if (n.conversationId && (this.conversationId = n.conversationId, ft(this.storageIdentifier, n.conversationId)), n.messageId) {
1230
+ if (n.conversationId && (this.conversationId = n.conversationId, gt(this.storageIdentifier, n.conversationId)), n.messageId) {
1224
1231
  let e = [...this.state.messages];
1225
1232
  e[e.length - 1] = {
1226
1233
  ...e[e.length - 1],
@@ -1261,7 +1268,7 @@ var mt = 8e3, ht = class {
1261
1268
  }
1262
1269
  } });
1263
1270
  try {
1264
- await tt(i, this.sessionToken, {
1271
+ await at(i, this.sessionToken, {
1265
1272
  messageId: e,
1266
1273
  rating: t,
1267
1274
  correction: n,
@@ -1283,9 +1290,9 @@ var mt = 8e3, ht = class {
1283
1290
  } });
1284
1291
  }
1285
1292
  }
1286
- }, gt = ":host,.whoo-widget-root{all:initial;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.whoo-widget-launcher{bottom:20px;left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);background:var(--whoo-widget-color,#4f46e5);width:56px;height:56px;color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;border-radius:50%;justify-content:center;align-items:center;padding:0;font-size:24px;display:flex;position:fixed;box-shadow:0 2px 8px #0003}.whoo-widget-launcher:focus-visible{box-shadow:0 2px 8px #0003,0 0 0 4px #fff}.whoo-widget-launcher svg{display:block}.whoo-widget-launcher-icon-image{object-fit:cover;border-radius:50%;width:32px;height:32px}.whoo-widget-launcher-icon-image[hidden]{display:none}.whoo-widget-panel{bottom:88px;left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);background:#fff;border-radius:12px;flex-direction:column;width:360px;max-width:calc(100vw - 40px);height:480px;max-height:calc(100vh - 108px);display:flex;position:fixed;overflow:hidden;box-shadow:0 4px 16px #0003}@media (width<=400px),(height<=420px){.whoo-widget-panel{width:auto;max-width:none;height:auto;max-height:none;inset:8px}}.whoo-widget-header{border-bottom:1px solid #e5e5e5;flex-shrink:0;justify-content:space-between;align-items:center;gap:8px;padding:8px 8px 8px 16px;display:flex}.whoo-widget-header-title{color:var(--whoo-widget-ink,#111);text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:15px;font-weight:600;overflow:hidden}.whoo-widget-header-actions{flex-shrink:0;align-items:center;gap:4px;display:flex}.whoo-widget-header-close,.whoo-widget-header-reset{color:var(--whoo-widget-color-text,#4f46e5);cursor:pointer;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;min-width:24px;min-height:24px;padding:4px 8px;font-size:13px;display:inline-flex}.whoo-widget-header-close{width:32px;height:32px;padding:0}.whoo-widget-header-close:hover,.whoo-widget-header-reset:hover{background:#f3f4f6}.whoo-widget-message-list{flex:1;min-height:100px;padding:12px;overflow-y:auto}.whoo-widget-empty-state-image{object-fit:contain;max-width:min(160px,100%);height:auto;max-height:160px;margin:8px auto 16px;display:block}@media (width<=400px),(height<=420px){.whoo-widget-empty-state-image{max-height:64px;margin:0 auto 8px}}.whoo-widget-message{white-space:pre-line;border-radius:8px;max-width:80%;margin-bottom:8px;padding:8px 12px}.whoo-widget-message--user{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);margin-left:auto}.whoo-widget-message--user a{color:inherit}.whoo-widget-message--assistant{color:var(--whoo-widget-ink,#111);background:#f0f0f0}.whoo-widget-message--assistant a{color:var(--whoo-widget-link-color,#00e)}.whoo-widget-pending{flex-wrap:wrap;align-items:center;gap:8px;min-height:1.2em;display:flex}.whoo-widget-typing{align-items:center;gap:4px;display:inline-flex}.whoo-widget-typing span{background:#6b7280;border-radius:50%;width:6px;height:6px;animation:1.2s ease-in-out infinite whoo-widget-typing-bounce}.whoo-widget-typing span:nth-child(2){animation-delay:.2s}.whoo-widget-typing span:nth-child(3){animation-delay:.4s}@keyframes whoo-widget-typing-bounce{0%,80%,to{transform:translateY(0)}40%{transform:translateY(-4px)}}@media (prefers-reduced-motion:reduce){.whoo-widget-typing span{animation:none}}.whoo-widget-error-banner{color:#991b1b;background:#fee2e2;padding:8px 12px;font-size:13px}.whoo-widget-composer{border-top:1px solid #e5e5e5;gap:8px;padding:12px;display:flex}.whoo-widget-composer-input{border:1px solid #6b7280;border-radius:6px;flex:1;padding:8px}.whoo-widget-composer-send{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;border-radius:6px;padding:8px 16px}.whoo-widget-composer-send:disabled,.whoo-widget-composer-input[aria-disabled=true]{opacity:.6;cursor:not-allowed}.whoo-widget-feedback{align-items:center;gap:6px;margin-top:4px;display:flex}.whoo-widget-feedback-buttons{gap:6px;display:flex}.whoo-widget-feedback-buttons button{cursor:pointer;color:#4b5563;background:0 0;border:none;border-radius:4px;justify-content:center;align-items:center;min-width:24px;min-height:24px;padding:4px;display:inline-flex}.whoo-widget-feedback-buttons button:hover:not(:disabled){color:#111;background:#0000000f}.whoo-widget-feedback-buttons button:disabled{opacity:.3;cursor:not-allowed}.whoo-widget-feedback-form{flex-direction:column;gap:6px;margin-top:6px;display:flex}.whoo-widget-feedback-textarea{box-sizing:border-box;resize:vertical;border:1px solid #6b7280;border-radius:6px;width:100%;padding:6px;font-size:12px}.whoo-widget-feedback-select{border:1px solid #6b7280;border-radius:6px;min-height:24px;padding:4px;font-size:12px}.whoo-widget-feedback-form-buttons{gap:6px;display:flex}.whoo-widget-feedback-submit{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;border-radius:6px;padding:8px 16px;font-size:13px}.whoo-widget-feedback-cancel{color:#111;cursor:pointer;background:#fff;border:1px solid #6b7280;border-radius:6px;padding:8px 16px;font-size:13px}.whoo-widget-feedback-submitted{color:#6b7280;margin-top:4px;font-size:12px}.whoo-widget-feedback-error{color:#991b1b;font-size:12px}.whoo-widget-sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,a:focus-visible{outline-offset:2px;outline:2px solid #111827;box-shadow:0 0 0 4px #fff}", _t = /^(inherit|initial|unset|revert|revert-layer)$|\bcurrentcolor\b|\b(var|env|attr|light-dark)\(/i;
1287
- function vt(e) {
1288
- if (_t.test(e.trim())) return null;
1293
+ }, bt = ":host,.whoo-widget-root{all:initial;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.whoo-widget-launcher{bottom:20px;left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);background:var(--whoo-widget-color,#4f46e5);width:56px;height:56px;color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;border-radius:50%;justify-content:center;align-items:center;padding:0;font-size:24px;display:flex;position:fixed;box-shadow:0 2px 8px #0003}.whoo-widget-launcher:focus-visible{box-shadow:0 2px 8px #0003,0 0 0 4px #fff}.whoo-widget-launcher svg{display:block}.whoo-widget-launcher-icon-image{object-fit:cover;border-radius:50%;width:32px;height:32px}.whoo-widget-launcher-icon-image[hidden]{display:none}.whoo-widget-panel{bottom:88px;left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);background:#fff;border-radius:12px;flex-direction:column;width:360px;max-width:calc(100vw - 40px);height:480px;max-height:calc(100vh - 108px);display:flex;position:fixed;overflow:hidden;box-shadow:0 4px 16px #0003}@media (width<=400px),(height<=420px){.whoo-widget-panel{width:auto;max-width:none;height:auto;max-height:none;inset:8px}}.whoo-widget-header{border-bottom:1px solid #e5e5e5;flex-shrink:0;justify-content:space-between;align-items:center;gap:8px;padding:8px 8px 8px 16px;display:flex}.whoo-widget-header-title{color:var(--whoo-widget-ink,#111);text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:15px;font-weight:600;overflow:hidden}.whoo-widget-header-actions{flex-shrink:0;align-items:center;gap:4px;display:flex}.whoo-widget-header-close,.whoo-widget-header-reset{color:var(--whoo-widget-color-text,#4f46e5);cursor:pointer;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;min-width:24px;min-height:24px;padding:4px 8px;font-size:13px;display:inline-flex}.whoo-widget-header-close{width:32px;height:32px;padding:0}.whoo-widget-header-close:hover,.whoo-widget-header-reset:hover{background:#f3f4f6}.whoo-widget-message-list{flex:1;min-height:100px;padding:12px;overflow-y:auto}.whoo-widget-empty-state-image{object-fit:contain;max-width:min(160px,100%);height:auto;max-height:160px;margin:8px auto 16px;display:block}@media (width<=400px),(height<=420px){.whoo-widget-empty-state-image{max-height:64px;margin:0 auto 8px}}.whoo-widget-message{white-space:pre-line;border-radius:8px;max-width:80%;margin-bottom:8px;padding:8px 12px}.whoo-widget-message--user{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);margin-left:auto}.whoo-widget-message--user a{color:inherit}.whoo-widget-message--assistant{color:var(--whoo-widget-ink,#111);background:#f0f0f0}.whoo-widget-message--assistant a{color:var(--whoo-widget-link-color,#00e)}.whoo-widget-pending{flex-wrap:wrap;align-items:center;gap:8px;min-height:1.2em;display:flex}.whoo-widget-typing{align-items:center;gap:4px;display:inline-flex}.whoo-widget-typing span{background:#6b7280;border-radius:50%;width:6px;height:6px;animation:1.2s ease-in-out infinite whoo-widget-typing-bounce}.whoo-widget-typing span:nth-child(2){animation-delay:.2s}.whoo-widget-typing span:nth-child(3){animation-delay:.4s}@keyframes whoo-widget-typing-bounce{0%,80%,to{transform:translateY(0)}40%{transform:translateY(-4px)}}@media (prefers-reduced-motion:reduce){.whoo-widget-typing span{animation:none}}.whoo-widget-error-banner{color:#991b1b;background:#fee2e2;padding:8px 12px;font-size:13px}.whoo-widget-composer{border-top:1px solid #e5e5e5;gap:8px;padding:12px;display:flex}.whoo-widget-composer-input{border:1px solid #6b7280;border-radius:6px;flex:1;padding:8px}.whoo-widget-composer-send{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;border-radius:6px;padding:8px 16px}.whoo-widget-composer-send:disabled,.whoo-widget-composer-input[aria-disabled=true]{opacity:.6;cursor:not-allowed}.whoo-widget-feedback{align-items:center;gap:6px;margin-top:4px;display:flex}.whoo-widget-feedback-buttons{gap:6px;display:flex}.whoo-widget-feedback-buttons button{cursor:pointer;color:#4b5563;background:0 0;border:none;border-radius:4px;justify-content:center;align-items:center;min-width:24px;min-height:24px;padding:4px;display:inline-flex}.whoo-widget-feedback-buttons button:hover:not(:disabled){color:#111;background:#0000000f}.whoo-widget-feedback-buttons button:disabled{opacity:.3;cursor:not-allowed}.whoo-widget-feedback-form{flex-direction:column;gap:6px;margin-top:6px;display:flex}.whoo-widget-feedback-textarea{box-sizing:border-box;resize:vertical;border:1px solid #6b7280;border-radius:6px;width:100%;padding:6px;font-size:12px}.whoo-widget-feedback-select{border:1px solid #6b7280;border-radius:6px;min-height:24px;padding:4px;font-size:12px}.whoo-widget-feedback-form-buttons{gap:6px;display:flex}.whoo-widget-feedback-submit{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;border-radius:6px;padding:8px 16px;font-size:13px}.whoo-widget-feedback-cancel{color:#111;cursor:pointer;background:#fff;border:1px solid #6b7280;border-radius:6px;padding:8px 16px;font-size:13px}.whoo-widget-feedback-submitted{color:#6b7280;margin-top:4px;font-size:12px}.whoo-widget-feedback-error{color:#991b1b;font-size:12px}.whoo-widget-sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,a:focus-visible{outline-offset:2px;outline:2px solid #111827;box-shadow:0 0 0 4px #fff}", xt = /^(inherit|initial|unset|revert|revert-layer)$|\bcurrentcolor\b|\b(var|env|attr|light-dark)\(/i;
1294
+ function St(e) {
1295
+ if (xt.test(e.trim())) return null;
1289
1296
  let t = document.createElement("div");
1290
1297
  if (t.style.color = e, t.style.color === "") return null;
1291
1298
  let n = document.createElement("div");
@@ -1304,64 +1311,64 @@ function vt(e) {
1304
1311
  translucent: a < 1
1305
1312
  };
1306
1313
  }
1307
- function yt(e) {
1308
- return vt(e)?.rgb ?? null;
1314
+ function Ct(e) {
1315
+ return St(e)?.rgb ?? null;
1309
1316
  }
1310
- function Z([e, t, n]) {
1317
+ function X([e, t, n]) {
1311
1318
  let r = (e) => {
1312
1319
  let t = e / 255;
1313
1320
  return t <= .03928 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
1314
1321
  };
1315
1322
  return .2126 * r(e) + .7152 * r(t) + .0722 * r(n);
1316
1323
  }
1317
- function bt(e, t) {
1324
+ function Z(e, t) {
1318
1325
  let n = Math.max(e, t), r = Math.min(e, t);
1319
1326
  return (n + .05) / (r + .05);
1320
1327
  }
1321
- function xt(e) {
1322
- let t = yt(e);
1328
+ function wt(e) {
1329
+ let t = Ct(e);
1323
1330
  if (!t) return console.warn(`[whoo-aiden-widget] Could not parse color "${e}" for contrast calculation; defaulting to white text.`), "#ffffff";
1324
- let n = Z(t);
1325
- return bt(n, Z([
1331
+ let n = X(t);
1332
+ return Z(n, X([
1326
1333
  0,
1327
1334
  0,
1328
1335
  0
1329
- ])) >= bt(n, Z([
1336
+ ])) >= Z(n, X([
1330
1337
  255,
1331
1338
  255,
1332
1339
  255
1333
1340
  ])) ? "#000000" : "#ffffff";
1334
1341
  }
1335
- var Q = "#4f46e5", St = "#ffffff", Ct = "#f0f0f0", wt = 4.5;
1336
- function Tt([e, t, n]) {
1342
+ var Q = "#4f46e5", Tt = "#ffffff", Et = "#f0f0f0", Dt = 4.5;
1343
+ function Ot([e, t, n]) {
1337
1344
  return `#${[
1338
1345
  e,
1339
1346
  t,
1340
1347
  n
1341
1348
  ].map((e) => e.toString(16).padStart(2, "0")).join("")}`;
1342
1349
  }
1343
- function Et(e, t = St) {
1344
- let n = yt(e), r = yt(t);
1350
+ function kt(e, t = Tt) {
1351
+ let n = Ct(e), r = Ct(t);
1345
1352
  if (!n || !r) return Q;
1346
- let i = Z(r), a = (e) => bt(Z(e), i) >= wt;
1347
- if (a(n)) return Tt(n);
1353
+ let i = X(r), a = (e) => Z(X(e), i) >= Dt;
1354
+ if (a(n)) return Ot(n);
1348
1355
  for (let e = .99; e > 0; e -= .01) {
1349
1356
  let t = n.map((t) => Math.round(t * e));
1350
- if (a(t)) return Tt(t);
1357
+ if (a(t)) return Ot(t);
1351
1358
  }
1352
1359
  return "#000000";
1353
1360
  }
1354
- var Dt = "#111111", Ot = "#0000ee";
1361
+ var At = "#111111", jt = "#0000ee";
1355
1362
  function $(e) {
1356
1363
  if (!e) return null;
1357
- let t = vt(e);
1358
- return t ? Tt(t.rgb) : null;
1364
+ let t = St(e);
1365
+ return t ? Ot(t.rgb) : null;
1359
1366
  }
1360
- function kt({ color: e, inkColor: t, accentColor: n }) {
1361
- let r = $(e), i = r ?? Q, a = Et(i), o = $(t), s = o ? Et(o, Ct) : Dt, c = $(n), l = c ? Et(c, Ct) : Ot;
1367
+ function Mt({ color: e, inkColor: t, accentColor: n }) {
1368
+ let r = $(e), i = r ?? Q, a = kt(i), o = $(t), s = o ? kt(o, Et) : At, c = $(n), l = c ? kt(c, Et) : jt;
1362
1369
  return {
1363
1370
  primary: i,
1364
- textOnPrimary: xt(i),
1371
+ textOnPrimary: wt(i),
1365
1372
  primaryAsText: a,
1366
1373
  ink: s,
1367
1374
  link: l,
@@ -1372,24 +1379,24 @@ function kt({ color: e, inkColor: t, accentColor: n }) {
1372
1379
  }
1373
1380
  };
1374
1381
  }
1375
- function At(e, t, n = Q) {
1382
+ function Nt(e, t, n = Q) {
1376
1383
  let r = t;
1377
1384
  $(t) === null && (console.warn(`[whoo-aiden-widget] Could not use "${t}" as the theme color; falling back to "${n}".`), r = n);
1378
- let i = kt({ color: r });
1385
+ let i = Mt({ color: r });
1379
1386
  e.style.setProperty("--whoo-widget-color", i.primary), e.style.setProperty("--whoo-widget-text-on-color", i.textOnPrimary), e.style.setProperty("--whoo-widget-color-text", i.primaryAsText);
1380
1387
  }
1381
- function jt(e, { inkColor: t, accentColor: n }) {
1382
- let r = kt({
1388
+ function Pt(e, { inkColor: t, accentColor: n }) {
1389
+ let r = Mt({
1383
1390
  inkColor: t,
1384
1391
  accentColor: n
1385
1392
  });
1386
1393
  e.style.setProperty("--whoo-widget-ink", r.ink), e.style.setProperty("--whoo-widget-link-color", r.link);
1387
1394
  }
1388
- function Mt(e, t) {
1395
+ function Ft(e, t) {
1389
1396
  e && $(e) === null && console.warn(`[whoo-aiden-widget] Could not use "${e}" as the ${t}; using the default.`);
1390
1397
  }
1391
- function Nt(e, t) {
1392
- At(e, t.color ?? Q), Mt(t.inkColor, "ink color"), Mt(t.accentColor, "accent color"), jt(e, {
1398
+ function It(e, t) {
1399
+ Nt(e, t.color ?? Q), Ft(t.inkColor, "ink color"), Ft(t.accentColor, "accent color"), Pt(e, {
1393
1400
  inkColor: t.inkColor,
1394
1401
  accentColor: t.accentColor
1395
1402
  });
@@ -1398,29 +1405,29 @@ function Nt(e, t) {
1398
1405
  }
1399
1406
  //#endregion
1400
1407
  //#region src/mount.tsx
1401
- function Pt(e) {
1408
+ function Lt(e) {
1402
1409
  let t = document.createElement("div");
1403
- t.id = "whoo-aiden-widget-host";
1404
- let n = t.attachShadow({ mode: "open" }), r = document.createElement("style");
1405
- r.textContent = gt, n.appendChild(r);
1406
- let i = document.createElement("div");
1407
- n.appendChild(i), Nt(i, e);
1408
- let a = new ht(e), o = null, s = "";
1409
- return a.subscribe((t) => {
1410
- t.primaryColor && t.primaryColor !== o && (o = t.primaryColor, At(i, t.primaryColor, e.color));
1410
+ t.id = "whoo-aiden-widget-host", t.style.position = "relative", t.style.zIndex = String(n(e.zIndex));
1411
+ let r = t.attachShadow({ mode: "open" }), i = document.createElement("style");
1412
+ i.textContent = bt, r.appendChild(i);
1413
+ let a = document.createElement("div");
1414
+ r.appendChild(a), It(a, e);
1415
+ let o = new yt(e), s = null, c = "";
1416
+ return o.subscribe((t) => {
1417
+ t.primaryColor && t.primaryColor !== s && (s = t.primaryColor, Nt(a, t.primaryColor, e.color));
1411
1418
  let n = `${t.inkColor}|${t.accentColor}`;
1412
- (t.inkColor || t.accentColor) && n !== s && (s = n, jt(i, {
1419
+ (t.inkColor || t.accentColor) && n !== c && (c = n, Pt(a, {
1413
1420
  inkColor: $(t.inkColor) ? t.inkColor : e.inkColor,
1414
1421
  accentColor: $(t.accentColor) ? t.accentColor : e.accentColor
1415
1422
  }));
1416
- }), ue(/* @__PURE__ */ W(Ze, { controller: a }), i), a.init(), document.body.appendChild(t), { unmount() {
1417
- ue(null, i), t.remove();
1423
+ }), pe(/* @__PURE__ */ U(tt, { controller: o }), a), o.init(), document.body.appendChild(t), { unmount() {
1424
+ pe(null, a), t.remove();
1418
1425
  } };
1419
1426
  }
1420
1427
  //#endregion
1421
1428
  //#region src/index.ts
1422
- function Ft(t) {
1423
- return e(t), Pt(t);
1429
+ function Rt(e) {
1430
+ return r(e), Lt(e);
1424
1431
  }
1425
1432
  //#endregion
1426
- export { Ft as init, kt as resolveTheme };
1433
+ export { Rt as init, Mt as resolveTheme };