@aiden-voice/widget 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/widget.js CHANGED
@@ -45,59 +45,59 @@ function T(e, t, n, r, i) {
45
45
  function E(e) {
46
46
  return e.children;
47
47
  }
48
- function D(e, t) {
48
+ function te(e, t) {
49
49
  this.props = e, this.context = t;
50
50
  }
51
- function O(e, t) {
52
- if (t == null) return e.__ ? O(e.__, e.__i + 1) : null;
51
+ function D(e, t) {
52
+ if (t == null) return e.__ ? D(e.__, e.__i + 1) : null;
53
53
  for (var n; t < e.__k.length; t++) if ((n = e.__k[t]) != null && n.__e != null) return n.__e;
54
- return typeof e.type == "function" ? O(e) : null;
54
+ return typeof e.type == "function" ? D(e) : null;
55
55
  }
56
- function k(e) {
56
+ function O(e) {
57
57
  if (e.__P && e.__d) {
58
58
  var t = e.__v, n = t.__e, r = [], i = [], a = C({}, t);
59
- a.__v = t.__v + 1, o.vnode && o.vnode(a), se(e.__P, a, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [n] : null, r, n ?? O(t), !!(32 & t.__u), i), a.__v = t.__v, a.__.__k[a.__i] = a, le(r, a, i), t.__e = t.__ = null, a.__e != n && A(a);
59
+ a.__v = t.__v + 1, o.vnode && o.vnode(a), se(e.__P, a, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [n] : null, r, n ?? D(t), !!(32 & t.__u), i), a.__v = t.__v, a.__.__k[a.__i] = a, le(r, a, i), t.__e = t.__ = null, a.__e != n && k(a);
60
60
  }
61
61
  }
62
- function A(e) {
62
+ function k(e) {
63
63
  if ((e = e.__) != null && e.__c != null) return e.__e = e.__c.base = null, e.__k.some(function(t) {
64
64
  if (t != null && t.__e != null) return e.__e = e.__c.base = t.__e;
65
- }), A(e);
65
+ }), k(e);
66
66
  }
67
- function j(e) {
68
- (!e.__d && (e.__d = !0) && c.push(e) && !M.__r++ || l != o.debounceRendering) && ((l = o.debounceRendering) || u)(M);
67
+ function A(e) {
68
+ (!e.__d && (e.__d = !0) && c.push(e) && !j.__r++ || l != o.debounceRendering) && ((l = o.debounceRendering) || u)(j);
69
69
  }
70
- function M() {
70
+ function j() {
71
71
  try {
72
- for (var e, t = 1; c.length;) c.length > t && c.sort(d), e = c.shift(), t = c.length, k(e);
72
+ for (var e, t = 1; c.length;) c.length > t && c.sort(d), e = c.shift(), t = c.length, O(e);
73
73
  } finally {
74
- c.length = M.__r = 0;
74
+ c.length = j.__r = 0;
75
75
  }
76
76
  }
77
- function te(e, t, n, r, i, a, o, s, c, l, u) {
77
+ function ne(e, t, n, r, i, a, o, s, c, l, u) {
78
78
  var d, f, p, m, h, g, _ = r && r.__k || b, v = t.length;
79
- for (c = N(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && _[p.__i] || y, p.__i = d, g = se(e, p, f, i, a, o, s, c, l, u), m = p.__e, p.ref && f.ref != p.ref && (f.ref && fe(f.ref, null, p), u.push(p.ref, p.__c || m, p)), h == null && m != null && (h = m), 4 & p.__u ? (c = ne(p, c, e), f.__e && (f.__e = null)) : typeof p.type == "function" && g !== void 0 ? c = g : m && (c = m.nextSibling), p.__u &= -7);
79
+ for (c = M(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && _[p.__i] || y, p.__i = d, g = se(e, p, f, i, a, o, s, c, l, u), m = p.__e, p.ref && f.ref != p.ref && (f.ref && fe(f.ref, null, p), u.push(p.ref, p.__c || m, p)), h == null && m != null && (h = m), 4 & p.__u ? (c = re(p, c, e), f.__e && (f.__e = null)) : typeof p.type == "function" && g !== void 0 ? c = g : m && (c = m.nextSibling), p.__u &= -7);
80
80
  return n.__e = h, c;
81
81
  }
82
- function N(e, t, n, r, i) {
82
+ function M(e, t, n, r, i) {
83
83
  var a, o, s, c, l, u = n.length, d = u, f = 0;
84
- 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] = T(null, o, null, null, null) : S(o) ? o = e.__k[a] = T(E, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? o = e.__k[a] = T(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 = re(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;
85
- if (d) for (a = 0; a < u; a++) (s = n[a]) != null && !(2 & s.__u) && (s.__e == r && (r = O(s)), pe(s, s));
84
+ 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] = T(null, o, null, null, null) : S(o) ? o = e.__k[a] = T(E, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? o = e.__k[a] = T(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 = ie(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;
85
+ if (d) for (a = 0; a < u; a++) (s = n[a]) != null && !(2 & s.__u) && (s.__e == r && (r = D(s)), pe(s, s));
86
86
  return r;
87
87
  }
88
- function ne(e, t, n) {
88
+ function re(e, t, n) {
89
89
  var r, i;
90
90
  if (typeof e.type == "function") {
91
- for (r = e.__k, i = 0; r && i < r.length; i++) r[i] && (r[i].__ = e, t = ne(r[i], t, n));
91
+ for (r = e.__k, i = 0; r && i < r.length; i++) r[i] && (r[i].__ = e, t = re(r[i], t, n));
92
92
  return t;
93
93
  }
94
- e.__e != t && (t && e.type && !t.parentNode && (t = O(e)), t = n.insertBefore(e.__e, t || null));
94
+ e.__e != t && (t && e.type && !t.parentNode && (t = D(e)), t = n.insertBefore(e.__e, t || null));
95
95
  do
96
96
  t &&= t.nextSibling;
97
97
  while (t != null && t.nodeType == 8);
98
98
  return t;
99
99
  }
100
- function re(e, t, n, r) {
100
+ function ie(e, t, n, r) {
101
101
  var i, a, o, s = e.key, c = e.type, l = t[n], u = l != null && !(2 & l.__u);
102
102
  if (l === null && s == null || u && s == l.key && c == l.type) return n;
103
103
  if (r > +!!u) {
@@ -105,16 +105,16 @@ function re(e, t, n, r) {
105
105
  }
106
106
  return -1;
107
107
  }
108
- function ie(e, t, n) {
108
+ function ae(e, t, n) {
109
109
  t[0] == "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || x.test(t) ? n : n + "px";
110
110
  }
111
- function ae(e, t, n, r, i) {
111
+ function N(e, t, n, r, i) {
112
112
  var a, o;
113
113
  n: if (t == "style") {
114
114
  if (typeof n == "string") e.style.cssText = n;
115
115
  else {
116
- if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || ie(e.style, t, "");
117
- if (n) for (t in n) r && n[t] == r[t] || ie(e.style, t, n[t]);
116
+ if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || ae(e.style, t, "");
117
+ if (n) for (t in n) r && n[t] == r[t] || ae(e.style, t, n[t]);
118
118
  }
119
119
  } else if (t[0] == "o" && t[1] == "n") a = t != (t = t.replace(h, "$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[m] = r[m] : (n[m] = g, e.addEventListener(t, a ? v : _, a)) : e.removeEventListener(t, a ? v : _, a);
120
120
  else {
@@ -137,35 +137,35 @@ function oe(e) {
137
137
  };
138
138
  }
139
139
  function se(e, t, n, r, i, a, s, c, l, u) {
140
- var d, f, p, m, h, g, _, v, y, x, w, T, k, A, j, M, N = t.type;
140
+ var d, f, p, m, h, g, _, v, y, x, w, T, O, k, A, j, M = t.type;
141
141
  if (t.constructor !== void 0) return null;
142
142
  128 & n.__u && (l = !!(32 & n.__u), a = [c = t.__e = n.__e]), (d = o.__b) && d(t);
143
- n: if (typeof N == "function") {
143
+ n: if (typeof M == "function") {
144
144
  f = s.length;
145
145
  try {
146
- if (y = t.props, x = N.prototype && N.prototype.render, w = (d = N.contextType) && r[d.__c], T = d ? w ? w.props.value : d.__ : r, n.__c ? v = (p = t.__c = n.__c).__ = p.__E : (x ? t.__c = p = new N(y, T) : (t.__c = p = new D(y, T), p.constructor = N, p.render = me), w && w.sub(p), p.state || (p.state = {}), p.__n = r, m = p.__d = !0, p.__h = [], p._sb = []), x && p.__s == null && (p.__s = p.state), x && N.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = C({}, p.__s)), C(p.__s, N.getDerivedStateFromProps(y, p.__s))), h = p.props, g = p.state, p.__v = t, m) x && N.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), x && p.componentDidMount != null && p.__h.push(p.componentDidMount);
146
+ if (y = t.props, x = M.prototype && M.prototype.render, w = (d = M.contextType) && r[d.__c], T = d ? w ? w.props.value : d.__ : r, n.__c ? v = (p = t.__c = n.__c).__ = p.__E : (x ? t.__c = p = new M(y, T) : (t.__c = p = new te(y, T), p.constructor = M, p.render = me), w && w.sub(p), p.state || (p.state = {}), p.__n = r, m = p.__d = !0, p.__h = [], p._sb = []), x && p.__s == null && (p.__s = p.state), x && M.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = C({}, p.__s)), C(p.__s, M.getDerivedStateFromProps(y, p.__s))), h = p.props, g = p.state, p.__v = t, m) x && M.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), x && p.componentDidMount != null && p.__h.push(p.componentDidMount);
147
147
  else {
148
- if (x && N.getDerivedStateFromProps == null && y !== h && p.componentWillReceiveProps != null && p.componentWillReceiveProps(y, T), t.__v == n.__v || !p.__e && p.shouldComponentUpdate != null && !1 === p.shouldComponentUpdate(y, p.__s, T)) {
148
+ if (x && M.getDerivedStateFromProps == null && y !== h && p.componentWillReceiveProps != null && p.componentWillReceiveProps(y, T), t.__v == n.__v || !p.__e && p.shouldComponentUpdate != null && !1 === p.shouldComponentUpdate(y, p.__s, T)) {
149
149
  t.__v != n.__v && (p.props = y, p.state = p.__s, p.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.some(function(e) {
150
150
  e && (e.__ = t);
151
- }), b.push.apply(p.__h, p._sb), p._sb = [], p.__h.length && s.push(p), c = O(n);
151
+ }), b.push.apply(p.__h, p._sb), p._sb = [], p.__h.length && s.push(p), c = D(n);
152
152
  break n;
153
153
  }
154
154
  p.componentWillUpdate != null && p.componentWillUpdate(y, p.__s, T), x && p.componentDidUpdate != null && p.__h.push(function() {
155
155
  p.componentDidUpdate(h, g, _);
156
156
  });
157
157
  }
158
- if (p.context = T, p.props = y, p.__P = e, p.__e = !1, k = o.__r, A = 0, x) p.state = p.__s, p.__d = !1, k && k(t), d = p.render(p.props, p.state, p.context), b.push.apply(p.__h, p._sb), p._sb = [];
158
+ if (p.context = T, p.props = y, p.__P = e, p.__e = !1, O = o.__r, k = 0, x) p.state = p.__s, p.__d = !1, O && O(t), d = p.render(p.props, p.state, p.context), b.push.apply(p.__h, p._sb), p._sb = [];
159
159
  else do
160
- p.__d = !1, k && k(t), d = p.render(p.props, p.state, p.context), p.state = p.__s;
161
- while (p.__d && ++A < 25);
162
- p.state = p.__s, p.getChildContext != null && (r = C(C({}, r), p.getChildContext())), x && !m && p.getSnapshotBeforeUpdate != null && (_ = p.getSnapshotBeforeUpdate(h, g)), j = d != null && d.type === E && d.key == null ? ue(d.props.children) : d, c = te(e, S(j) ? j : [j], t, n, r, i, a, s, c, l, u), p.base = t.__e, t.__u &= -161, p.__h.length && s.push(p), v && (p.__E = p.__ = null);
160
+ p.__d = !1, O && O(t), d = p.render(p.props, p.state, p.context), p.state = p.__s;
161
+ while (p.__d && ++k < 25);
162
+ p.state = p.__s, p.getChildContext != null && (r = C(C({}, r), p.getChildContext())), x && !m && p.getSnapshotBeforeUpdate != null && (_ = p.getSnapshotBeforeUpdate(h, g)), A = d != null && d.type === E && d.key == null ? ue(d.props.children) : d, c = ne(e, S(A) ? A : [A], t, n, r, i, a, s, c, l, u), p.base = t.__e, t.__u &= -161, p.__h.length && s.push(p), v && (p.__E = p.__ = null);
163
163
  } catch (e) {
164
164
  if (s.length = f, t.__v = null, l || a != null) {
165
165
  if (e.then) {
166
166
  for (t.__u |= l ? 160 : 128; c && c.nodeType == 8 && c.nextSibling;) c = c.nextSibling;
167
167
  a != null && (a[a.indexOf(c)] = null), t.__e = c;
168
- } else if (a != null) for (M = a.length; M--;) ee(a[M]);
168
+ } else if (a != null) for (j = a.length; j--;) ee(a[j]);
169
169
  } else t.__e = n.__e;
170
170
  t.__k ??= n.__k || [], e.then || ce(t), o.__e(e, t, n);
171
171
  }
@@ -205,11 +205,11 @@ function de(e, t, n, r, i, s, c, l, u) {
205
205
  if (x == null) v === b || l && e.data == b || (e.data = b);
206
206
  else {
207
207
  if (s = x == "textarea" && b.defaultValue != null ? null : s && a.call(e.childNodes), !l && s != null) for (v = {}, d = 0; d < e.attributes.length; d++) v[(h = e.attributes[d]).name] = h.value;
208
- for (d in v) h = v[d], d == "dangerouslySetInnerHTML" ? p = h : d == "children" || d in b || d == "value" && "defaultValue" in b || d == "checked" && "defaultChecked" in b || ae(e, d, null, h, i);
209
- 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" || v[d] === h || ae(e, d, h, v[d], i);
208
+ for (d in v) h = v[d], d == "dangerouslySetInnerHTML" ? p = h : d == "children" || d in b || d == "value" && "defaultValue" in b || d == "checked" && "defaultChecked" in b || N(e, d, null, h, i);
209
+ 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" || v[d] === h || N(e, d, h, v[d], i);
210
210
  if (f) l || p && (f.__html == p.__html || f.__html == e.innerHTML) || (e.innerHTML = f.__html), t.__k = [];
211
- else if (p && (e.innerHTML = ""), te(t.type == "template" ? e.content : e, S(m) ? m : [m], t, n, r, x == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, c, s ? s[0] : n.__k && O(n, 0), l, u), s != null) for (d = s.length; d--;) ee(s[d]);
212
- l && x != "textarea" || (d = "value", x == "progress" && g == null ? e.removeAttribute("value") : g != null && (g !== e[d] || x == "progress" && !g || x == "option" && g != v[d]) && ae(e, d, g, v[d], i), d = "checked", _ != null && _ != e[d] && ae(e, d, _, v[d], i));
211
+ else if (p && (e.innerHTML = ""), ne(t.type == "template" ? e.content : e, S(m) ? m : [m], t, n, r, x == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, c, s ? s[0] : n.__k && D(n, 0), l, u), s != null) for (d = s.length; d--;) ee(s[d]);
212
+ l && x != "textarea" || (d = "value", x == "progress" && g == null ? e.removeAttribute("value") : g != null && (g !== e[d] || x == "progress" && !g || x == "option" && g != v[d]) && N(e, d, g, v[d], i), d = "checked", _ != null && _ != e[d] && N(e, d, _, v[d], i));
213
213
  }
214
214
  return e;
215
215
  }
@@ -250,14 +250,14 @@ a = b.slice, o = { __e: function(e, t, n, r) {
250
250
  e = t;
251
251
  }
252
252
  throw e;
253
- } }, s = 0, D.prototype.setState = function(e, t) {
253
+ } }, s = 0, te.prototype.setState = function(e, t) {
254
254
  var n = this.__s != null && this.__s != this.state ? this.__s : this.__s = C({}, this.state);
255
- typeof e == "function" && (e = e(C({}, n), this.props)), e && C(n, e), e != null && this.__v && (t && this._sb.push(t), j(this));
256
- }, D.prototype.forceUpdate = function(e) {
257
- this.__v && (this.__e = !0, e && this.__h.push(e), j(this));
258
- }, D.prototype.render = E, c = [], u = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, d = function(e, t) {
255
+ typeof e == "function" && (e = e(C({}, n), this.props)), e && C(n, e), e != null && this.__v && (t && this._sb.push(t), A(this));
256
+ }, te.prototype.forceUpdate = function(e) {
257
+ this.__v && (this.__e = !0, e && this.__h.push(e), A(this));
258
+ }, te.prototype.render = E, c = [], u = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, d = function(e, t) {
259
259
  return e.__v.__b - t.__v.__b;
260
- }, M.__r = 0, f = Math.random().toString(8), p = "__d" + f, m = "__a" + f, h = /(PointerCapture)$|Capture$/i, g = 0, _ = oe(!1), v = oe(!0);
260
+ }, j.__r = 0, f = Math.random().toString(8), p = "__d" + f, m = "__a" + f, h = /(PointerCapture)$|Capture$/i, g = 0, _ = oe(!1), v = oe(!0);
261
261
  //#endregion
262
262
  //#region node_modules/.pnpm/preact@10.29.8/node_modules/preact/hooks/dist/hooks.module.js
263
263
  var P, F, ge, _e, I = 0, ve = [], L = o, ye = L.__b, be = L.__r, xe = L.diffed, Se = L.__c, Ce = L.unmount, we = L.__;
@@ -269,12 +269,12 @@ function Te(e, t) {
269
269
  });
270
270
  return e >= n.__.length && n.__.push({}), n.__[e];
271
271
  }
272
- function R(e) {
273
- return I = 1, Ee(Ne, e);
272
+ function Ee(e) {
273
+ return I = 1, De(Pe, e);
274
274
  }
275
- function Ee(e, t, n) {
275
+ function De(e, t, n) {
276
276
  var r = Te(P++, 2);
277
- if (r.t = e, !r.__c && (r.__ = [n ? n(t) : Ne(void 0, t), function(e) {
277
+ if (r.t = e, !r.__c && (r.__ = [n ? n(t) : Pe(void 0, t), function(e) {
278
278
  var t = r.__N ? r.__N[0] : r.__[0], n = r.t(t, e);
279
279
  t !== n && (r.__N = [n, r.__[1]], r.__c.setState({}));
280
280
  }], r.__c = F, !F.__f)) {
@@ -305,24 +305,24 @@ function Ee(e, t, n) {
305
305
  }
306
306
  return r.__N || r.__;
307
307
  }
308
- function z(e, t) {
308
+ function R(e, t) {
309
309
  var n = Te(P++, 3);
310
- !L.__s && Me(n.__H, t) && (n.__ = e, n.u = t, F.__H.__h.push(n));
310
+ !L.__s && Ne(n.__H, t) && (n.__ = e, n.u = t, F.__H.__h.push(n));
311
311
  }
312
- function B(e) {
313
- return I = 5, De(function() {
312
+ function z(e) {
313
+ return I = 5, Oe(function() {
314
314
  return { current: e };
315
315
  }, []);
316
316
  }
317
- function De(e, t) {
317
+ function Oe(e, t) {
318
318
  var n = Te(P++, 7);
319
- return Me(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
319
+ return Ne(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
320
320
  }
321
- function Oe() {
321
+ function ke() {
322
322
  for (var e; e = ve.shift();) {
323
323
  var t = e.__H;
324
324
  if (e.__P && t) try {
325
- t.__h.some(V), t.__h.some(je), t.__h = [];
325
+ t.__h.some(B), t.__h.some(Me), t.__h = [];
326
326
  } catch (n) {
327
327
  t.__h = [], L.__e(n, e.__v);
328
328
  }
@@ -337,18 +337,18 @@ L.__b = function(e) {
337
337
  var t = (F = e.__c).__H;
338
338
  t && (ge === F ? (t.__h = [], F.__h = [], t.__.some(function(e) {
339
339
  e.__N && (e.__ = e.__N), e.u = e.__N = void 0;
340
- })) : (t.__h.some(V), t.__h.some(je), t.__h = [], P = 0)), ge = F;
340
+ })) : (t.__h.some(B), t.__h.some(Me), t.__h = [], P = 0)), ge = F;
341
341
  }, L.diffed = function(e) {
342
342
  xe && xe(e);
343
343
  var t = e.__c;
344
- t && t.__H && (t.__H.__h.length && (ve.push(t) !== 1 && _e === L.requestAnimationFrame || ((_e = L.requestAnimationFrame) || Ae)(Oe)), t.__H.__.some(function(e) {
344
+ t && t.__H && (t.__H.__h.length && (ve.push(t) !== 1 && _e === L.requestAnimationFrame || ((_e = L.requestAnimationFrame) || je)(ke)), t.__H.__.some(function(e) {
345
345
  e.u &&= (e.__H = e.u, void 0);
346
346
  })), ge = F = null;
347
347
  }, L.__c = function(e, t) {
348
348
  t.some(function(e) {
349
349
  try {
350
- e.__h.some(V), e.__h = e.__h.filter(function(e) {
351
- return !e.__ || je(e);
350
+ e.__h.some(B), e.__h = e.__h.filter(function(e) {
351
+ return !e.__ || Me(e);
352
352
  });
353
353
  } catch (n) {
354
354
  t.some(function(e) {
@@ -361,40 +361,40 @@ L.__b = function(e) {
361
361
  var t, n = e.__c;
362
362
  n && n.__H && (n.__H.__.some(function(e) {
363
363
  try {
364
- V(e);
364
+ B(e);
365
365
  } catch (e) {
366
366
  t = e;
367
367
  }
368
368
  }), n.__H = void 0, t && L.__e(t, n.__v));
369
369
  };
370
- var ke = typeof requestAnimationFrame == "function";
371
- function Ae(e) {
370
+ var Ae = typeof requestAnimationFrame == "function";
371
+ function je(e) {
372
372
  var t, n = function() {
373
- clearTimeout(r), ke && cancelAnimationFrame(t), setTimeout(e);
373
+ clearTimeout(r), Ae && cancelAnimationFrame(t), setTimeout(e);
374
374
  }, r = setTimeout(n, 35);
375
- ke && (t = requestAnimationFrame(n));
375
+ Ae && (t = requestAnimationFrame(n));
376
376
  }
377
- function V(e) {
377
+ function B(e) {
378
378
  var t = F, n = e.__c;
379
379
  typeof n == "function" && (e.__c = void 0, n()), F = t;
380
380
  }
381
- function je(e) {
381
+ function Me(e) {
382
382
  var t = F;
383
383
  e.__c = e.__(), F = t;
384
384
  }
385
- function Me(e, t) {
385
+ function Ne(e, t) {
386
386
  return !e || e.length !== t.length || t.some(function(t, n) {
387
387
  return t !== e[n];
388
388
  });
389
389
  }
390
- function Ne(e, t) {
390
+ function Pe(e, t) {
391
391
  return typeof t == "function" ? t(e) : t;
392
392
  }
393
393
  //#endregion
394
394
  //#region node_modules/.pnpm/preact@10.29.8/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
395
- var Pe = 0;
395
+ var Fe = 0;
396
396
  Array.isArray;
397
- function H(e, t, n, r, i, a) {
397
+ function V(e, t, n, r, i, a) {
398
398
  t ||= {};
399
399
  var s, c, l = t;
400
400
  if ("ref" in l) for (c in l = {}, t) c == "ref" ? s = t[c] : l[c] = t[c];
@@ -409,7 +409,7 @@ function H(e, t, n, r, i, a) {
409
409
  __e: null,
410
410
  __c: null,
411
411
  constructor: void 0,
412
- __v: --Pe,
412
+ __v: --Fe,
413
413
  __i: -1,
414
414
  __u: 0,
415
415
  __source: i,
@@ -420,8 +420,8 @@ function H(e, t, n, r, i, a) {
420
420
  }
421
421
  //#endregion
422
422
  //#region src/components/icons.tsx
423
- function U({ name: e, size: t, children: n }) {
424
- return /* @__PURE__ */ H("svg", {
423
+ function H({ name: e, size: t, children: n }) {
424
+ return /* @__PURE__ */ V("svg", {
425
425
  "data-icon": e,
426
426
  "aria-hidden": "true",
427
427
  focusable: "false",
@@ -436,59 +436,59 @@ function U({ name: e, size: t, children: n }) {
436
436
  children: n
437
437
  });
438
438
  }
439
- function Fe({ size: e = 26 }) {
440
- return /* @__PURE__ */ H(U, {
439
+ function Ie({ size: e = 26 }) {
440
+ return /* @__PURE__ */ V(H, {
441
441
  name: "chat",
442
442
  size: e,
443
- children: [/* @__PURE__ */ H("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__ */ H("path", {
443
+ children: [/* @__PURE__ */ V("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__ */ V("path", {
444
444
  d: "M8.5 9.5h.01M12 9.5h.01M15.5 9.5h.01",
445
445
  "stroke-width": "2.5"
446
446
  })]
447
447
  });
448
448
  }
449
- function Ie({ size: e = 26 }) {
450
- return /* @__PURE__ */ H(U, {
449
+ function Le({ size: e = 26 }) {
450
+ return /* @__PURE__ */ V(H, {
451
451
  name: "chevron-down",
452
452
  size: e,
453
- children: /* @__PURE__ */ H("path", { d: "M6 9l6 6 6-6" })
453
+ children: /* @__PURE__ */ V("path", { d: "M6 9l6 6 6-6" })
454
454
  });
455
455
  }
456
- function Le({ size: e = 18 }) {
457
- return /* @__PURE__ */ H(U, {
456
+ function Re({ size: e = 18 }) {
457
+ return /* @__PURE__ */ V(H, {
458
458
  name: "close",
459
459
  size: e,
460
- children: /* @__PURE__ */ H("path", { d: "M6 6l12 12M18 6L6 18" })
460
+ children: /* @__PURE__ */ V("path", { d: "M6 6l12 12M18 6L6 18" })
461
461
  });
462
462
  }
463
- var Re = "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";
464
- function ze({ size: e = 16 }) {
465
- return /* @__PURE__ */ H(U, {
463
+ var ze = "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";
464
+ function Be({ size: e = 16 }) {
465
+ return /* @__PURE__ */ V(H, {
466
466
  name: "thumb-up",
467
467
  size: e,
468
- children: /* @__PURE__ */ H("path", { d: Re })
468
+ children: /* @__PURE__ */ V("path", { d: ze })
469
469
  });
470
470
  }
471
- function Be({ size: e = 16 }) {
472
- return /* @__PURE__ */ H(U, {
471
+ function Ve({ size: e = 16 }) {
472
+ return /* @__PURE__ */ V(H, {
473
473
  name: "thumb-down",
474
474
  size: e,
475
- children: /* @__PURE__ */ H("path", {
476
- d: Re,
475
+ children: /* @__PURE__ */ V("path", {
476
+ d: ze,
477
477
  transform: "matrix(1 0 0 -1 0 24)"
478
478
  })
479
479
  });
480
480
  }
481
481
  //#endregion
482
482
  //#region src/components/Launcher.tsx
483
- function Ve({ isOpen: e, onClick: t, iconUrl: n, buttonRef: r }) {
484
- let [i, a] = R("loading"), o = n !== void 0 && i !== "failed", s = o && !e && i === "loaded";
485
- return /* @__PURE__ */ H("button", {
483
+ function He({ isOpen: e, onClick: t, iconUrl: n, buttonRef: r }) {
484
+ let [i, a] = Ee("loading"), o = n !== void 0 && i !== "failed", s = o && !e && i === "loaded";
485
+ return /* @__PURE__ */ V("button", {
486
486
  type: "button",
487
487
  class: "whoo-widget-launcher",
488
488
  onClick: t,
489
489
  "aria-label": e ? "Close chat" : "Open chat",
490
490
  ref: r,
491
- children: [e ? /* @__PURE__ */ H(Ie, {}) : s ? null : /* @__PURE__ */ H(Fe, {}), o ? /* @__PURE__ */ H("img", {
491
+ children: [e ? /* @__PURE__ */ V(Le, {}) : s ? null : /* @__PURE__ */ V(Ie, {}), o ? /* @__PURE__ */ V("img", {
492
492
  class: "whoo-widget-launcher-icon-image",
493
493
  src: n,
494
494
  alt: "",
@@ -501,16 +501,16 @@ function Ve({ isOpen: e, onClick: t, iconUrl: n, buttonRef: r }) {
501
501
  }
502
502
  //#endregion
503
503
  //#region src/components/Composer.tsx
504
- function He({ value: e, onChange: t, onSend: n, disabled: r, inputRef: i }) {
505
- return /* @__PURE__ */ H("div", {
504
+ function Ue({ value: e, onChange: t, onSend: n, disabled: r, inputRef: i }) {
505
+ return /* @__PURE__ */ V("div", {
506
506
  class: "whoo-widget-composer",
507
507
  children: [
508
- /* @__PURE__ */ H("label", {
508
+ /* @__PURE__ */ V("label", {
509
509
  class: "whoo-widget-sr-only",
510
510
  for: "whoo-widget-composer-input",
511
511
  children: "Message"
512
512
  }),
513
- /* @__PURE__ */ H("input", {
513
+ /* @__PURE__ */ V("input", {
514
514
  id: "whoo-widget-composer-input",
515
515
  class: "whoo-widget-composer-input",
516
516
  value: e,
@@ -522,11 +522,13 @@ function He({ value: e, onChange: t, onSend: n, disabled: r, inputRef: i }) {
522
522
  e.key === "Enter" && n();
523
523
  }
524
524
  }),
525
- /* @__PURE__ */ H("button", {
525
+ /* @__PURE__ */ V("button", {
526
526
  type: "button",
527
527
  class: "whoo-widget-composer-send",
528
- onClick: n,
529
- disabled: r,
528
+ "aria-disabled": r,
529
+ onClick: () => {
530
+ r || n();
531
+ },
530
532
  children: "Send"
531
533
  })
532
534
  ]
@@ -534,8 +536,8 @@ function He({ value: e, onChange: t, onSend: n, disabled: r, inputRef: i }) {
534
536
  }
535
537
  //#endregion
536
538
  //#region src/components/ErrorBanner.tsx
537
- function Ue({ message: e }) {
538
- return /* @__PURE__ */ H("div", {
539
+ function We({ message: e }) {
540
+ return /* @__PURE__ */ V("div", {
539
541
  class: "whoo-widget-error-banner",
540
542
  role: "alert",
541
543
  children: e
@@ -543,8 +545,8 @@ function Ue({ message: e }) {
543
545
  }
544
546
  //#endregion
545
547
  //#region src/markdown/tokenizer.ts
546
- var W = /\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/y, G = /\*\*([^*\s](?:[^*]*[^*\s])?)\*\*/y, K = /(?<![A-Za-z0-9_])_([^_\s](?:[^_]*[^_\s])?)_(?![A-Za-z0-9_])/y, q = /\*([^*\s](?:[^*]*[^*\s])?)\*/y, J = /[ \t]*[*+-][ \t]+/y, We = /https?:\/\/\S+/y, Ge = /[.,;:!?)\]}>]+$/;
547
- function Ke(e) {
548
+ var U = /\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/y, W = /\*\*([^*\s](?:[^*]*[^*\s])?)\*\*/y, G = /(?<![A-Za-z0-9_])_([^_\s](?:[^_]*[^_\s])?)_(?![A-Za-z0-9_])/y, K = /\*([^*\s](?:[^*]*[^*\s])?)\*/y, q = /[ \t]*[*+-][ \t]+/y, Ge = /https?:\/\/\S+/y, Ke = /[.,;:!?)\]}>]+$/;
549
+ function J(e) {
548
550
  let t = [], n = 0, r = 0, i = (n) => {
549
551
  n > r && t.push({
550
552
  type: "text",
@@ -554,13 +556,13 @@ function Ke(e) {
554
556
  });
555
557
  };
556
558
  for (; n < e.length;) {
557
- if ((n === 0 || e[n - 1] === "\n") && (J.lastIndex = n, J.exec(e))) {
559
+ if ((n === 0 || e[n - 1] === "\n") && (q.lastIndex = n, q.exec(e))) {
558
560
  i(n), t.push({
559
561
  type: "text",
560
562
  value: "• ",
561
563
  start: n,
562
- end: J.lastIndex
563
- }), n = J.lastIndex, r = n;
564
+ end: q.lastIndex
565
+ }), n = q.lastIndex, r = n;
564
566
  continue;
565
567
  }
566
568
  if (e[n] === "!" && n + 1 < e.length && e[n + 1] === "[") {
@@ -573,56 +575,56 @@ function Ke(e) {
573
575
  }
574
576
  }
575
577
  if (e[n - 1] !== "!") {
576
- W.lastIndex = n;
577
- let a = W.exec(e);
578
+ U.lastIndex = n;
579
+ let a = U.exec(e);
578
580
  if (a) {
579
581
  i(n), t.push({
580
582
  type: "link",
581
583
  text: a[1],
582
584
  url: a[2],
583
585
  start: n,
584
- end: W.lastIndex
585
- }), n = W.lastIndex, r = n;
586
+ end: U.lastIndex
587
+ }), n = U.lastIndex, r = n;
586
588
  continue;
587
589
  }
588
590
  }
589
- G.lastIndex = n;
590
- let a = G.exec(e);
591
+ W.lastIndex = n;
592
+ let a = W.exec(e);
591
593
  if (a) {
592
594
  i(n), t.push({
593
595
  type: "bold",
594
596
  value: a[1],
595
597
  start: n,
596
- end: G.lastIndex
597
- }), n = G.lastIndex, r = n;
598
+ end: W.lastIndex
599
+ }), n = W.lastIndex, r = n;
598
600
  continue;
599
601
  }
600
- K.lastIndex = n;
601
- let o = K.exec(e);
602
+ G.lastIndex = n;
603
+ let o = G.exec(e);
602
604
  if (o) {
603
605
  i(n), t.push({
604
606
  type: "italic",
605
607
  value: o[1],
606
608
  start: n,
607
- end: K.lastIndex
608
- }), n = K.lastIndex, r = n;
609
+ end: G.lastIndex
610
+ }), n = G.lastIndex, r = n;
609
611
  continue;
610
612
  }
611
- q.lastIndex = n;
612
- let s = q.exec(e);
613
+ K.lastIndex = n;
614
+ let s = K.exec(e);
613
615
  if (s) {
614
616
  i(n), t.push({
615
617
  type: "italic",
616
618
  value: s[1],
617
619
  start: n,
618
- end: q.lastIndex
619
- }), n = q.lastIndex, r = n;
620
+ end: K.lastIndex
621
+ }), n = K.lastIndex, r = n;
620
622
  continue;
621
623
  }
622
- We.lastIndex = n;
623
- let c = We.exec(e);
624
+ Ge.lastIndex = n;
625
+ let c = Ge.exec(e);
624
626
  if (c) {
625
- let e = c[0].match(Ge), a = e ? c[0].slice(0, c[0].length - e[0].length) : c[0];
627
+ let e = c[0].match(Ke), a = e ? c[0].slice(0, c[0].length - e[0].length) : c[0];
626
628
  if (a.length > 0) {
627
629
  i(n), t.push({
628
630
  type: "link",
@@ -640,16 +642,42 @@ function Ke(e) {
640
642
  }
641
643
  //#endregion
642
644
  //#region src/markdown/render.tsx
643
- function qe(e) {
644
- return Ke(e).map((e, t) => {
645
+ var qe = /^[ \t]*[*+-][ \t]+(.*)$/;
646
+ function Je(e) {
647
+ let t = [], n = [], r = [], i = () => {
648
+ n.length > 0 && t.push({
649
+ type: "text",
650
+ text: n.join("\n")
651
+ }), n = [];
652
+ }, a = () => {
653
+ r.length > 0 && t.push({
654
+ type: "list",
655
+ items: r
656
+ }), r = [];
657
+ };
658
+ for (let t of e.split("\n")) {
659
+ let e = t.match(qe);
660
+ e ? (i(), r.push(e[1])) : (a(), n.push(t));
661
+ }
662
+ return i(), a(), t.some((e) => e.type === "list") ? t.flatMap((e, n) => {
663
+ if (e.type === "list") return [e];
664
+ let { text: r } = e;
665
+ return t[n - 1]?.type === "list" && (r = r.replace(/^(?:[ \t]*\n)+/, "")), t[n + 1]?.type === "list" && (r = r.replace(/(?:\n[ \t]*)+$/, "")), r.trim() === "" ? [] : [{
666
+ type: "text",
667
+ text: r
668
+ }];
669
+ }) : null;
670
+ }
671
+ function Y(e) {
672
+ return J(e).map((e, t) => {
645
673
  switch (e.type) {
646
- case "bold": return /* @__PURE__ */ H("strong", { children: qe(e.value) }, t);
647
- case "italic": return /* @__PURE__ */ H("em", { children: qe(e.value) }, t);
648
- case "link": return /* @__PURE__ */ H("a", {
674
+ case "bold": return /* @__PURE__ */ V("strong", { children: Y(e.value) }, t);
675
+ case "italic": return /* @__PURE__ */ V("em", { children: Y(e.value) }, t);
676
+ case "link": return /* @__PURE__ */ V("a", {
649
677
  href: e.url,
650
678
  target: "_blank",
651
679
  rel: "noopener noreferrer",
652
- children: [e.text, /* @__PURE__ */ H("span", {
680
+ children: [e.text, /* @__PURE__ */ V("span", {
653
681
  class: "whoo-widget-sr-only",
654
682
  children: " (opens in new tab)"
655
683
  })]
@@ -658,9 +686,16 @@ function qe(e) {
658
686
  }
659
687
  });
660
688
  }
689
+ function Ye(e) {
690
+ let t = e.replace(/\r\n?/g, "\n"), n = Je(t);
691
+ return n ? n.map((e, t) => e.type === "list" ? /* @__PURE__ */ V("ul", {
692
+ class: "whoo-widget-list",
693
+ children: e.items.map((e, t) => /* @__PURE__ */ V("li", { children: Y(e) }, t))
694
+ }, t) : /* @__PURE__ */ V("span", { children: Y(e.text) }, t)) : Y(t);
695
+ }
661
696
  //#endregion
662
697
  //#region src/components/MessageFeedback.tsx
663
- var Je = [
698
+ var Xe = [
664
699
  {
665
700
  value: "",
666
701
  label: "Select a reason (optional)"
@@ -682,106 +717,101 @@ var Je = [
682
717
  label: "Other"
683
718
  }
684
719
  ];
685
- function Ye({ state: e, containerRef: t, onThumbsUp: n, onThumbsDown: r, onSubmitDetailed: i, onCancel: a }) {
686
- let [o, s] = R(""), [c, l] = R(""), u = B(e.status);
687
- if (z(() => {
688
- let n = u.current;
689
- if (u.current = e.status, n === e.status) return;
720
+ function Ze({ state: e, containerRef: t, onThumbsUp: n, onThumbsDown: r, onDraftChange: i, onSubmitDetailed: a, onCancel: o }) {
721
+ let s = e.correction ?? "", c = e.category ?? "", l = z(e.status);
722
+ if (R(() => {
723
+ let n = l.current;
724
+ if (l.current = e.status, n === e.status) return;
690
725
  let r = t?.current;
691
726
  if (!r) return;
692
727
  let i = r.getRootNode();
693
728
  r.contains(i.activeElement) || r.focus();
694
- }, [e.status, t]), e.status === "submitted") return /* @__PURE__ */ H("div", {
695
- class: "whoo-widget-feedback-submitted",
696
- role: "status",
697
- children: "Thanks for the feedback"
698
- });
699
- if (e.status === "expanded") return /* @__PURE__ */ H("div", {
729
+ }, [e.status, t]), e.status === "expanded") return /* @__PURE__ */ V("div", {
700
730
  class: "whoo-widget-feedback-form",
701
731
  children: [
702
- /* @__PURE__ */ H("label", { children: [/* @__PURE__ */ H("span", {
732
+ /* @__PURE__ */ V("label", { children: [/* @__PURE__ */ V("span", {
703
733
  class: "whoo-widget-sr-only",
704
734
  children: "Additional feedback"
705
- }), /* @__PURE__ */ H("textarea", {
735
+ }), /* @__PURE__ */ V("textarea", {
706
736
  class: "whoo-widget-feedback-textarea",
707
- value: o,
708
- onInput: (e) => s(e.target.value),
737
+ value: s,
738
+ onInput: (e) => i(e.target.value, c),
709
739
  placeholder: "What was wrong? (optional)"
710
740
  })] }),
711
- /* @__PURE__ */ H("select", {
741
+ /* @__PURE__ */ V("select", {
712
742
  class: "whoo-widget-feedback-select",
713
743
  "aria-label": "Feedback category",
714
744
  value: c,
715
- onChange: (e) => l(e.target.value),
716
- children: Je.map((e) => /* @__PURE__ */ H("option", {
745
+ onChange: (e) => i(s, e.target.value),
746
+ children: Xe.map((e) => /* @__PURE__ */ V("option", {
717
747
  value: e.value,
718
748
  children: e.label
719
749
  }, e.value))
720
750
  }),
721
- /* @__PURE__ */ H("div", {
751
+ /* @__PURE__ */ V("div", {
722
752
  class: "whoo-widget-feedback-form-buttons",
723
- children: [/* @__PURE__ */ H("button", {
753
+ children: [/* @__PURE__ */ V("button", {
724
754
  type: "button",
725
755
  class: "whoo-widget-feedback-submit",
726
- onClick: () => i(o, c),
756
+ onClick: () => a(s, c),
727
757
  children: "Submit"
728
- }), /* @__PURE__ */ H("button", {
758
+ }), /* @__PURE__ */ V("button", {
729
759
  type: "button",
730
760
  class: "whoo-widget-feedback-cancel",
731
- onClick: a,
761
+ onClick: o,
732
762
  children: "Cancel"
733
763
  })]
734
764
  })
735
765
  ]
736
766
  });
737
- let d = e.status === "submitting";
738
- return /* @__PURE__ */ H("div", {
767
+ let u = e.status === "submitting", d = e.status === "submitted";
768
+ return /* @__PURE__ */ V("div", {
739
769
  class: "whoo-widget-feedback",
740
- children: [/* @__PURE__ */ H("div", {
770
+ children: [d ? null : /* @__PURE__ */ V("div", {
741
771
  class: "whoo-widget-feedback-buttons",
742
- children: [/* @__PURE__ */ H("button", {
772
+ children: [/* @__PURE__ */ V("button", {
743
773
  type: "button",
744
774
  "aria-label": "Good response",
745
- disabled: d,
775
+ disabled: u,
746
776
  onClick: n,
747
- children: /* @__PURE__ */ H(ze, {})
748
- }), /* @__PURE__ */ H("button", {
777
+ children: /* @__PURE__ */ V(Be, {})
778
+ }), /* @__PURE__ */ V("button", {
749
779
  type: "button",
750
780
  "aria-label": "Bad response",
751
- disabled: d,
781
+ disabled: u,
752
782
  onClick: r,
753
- children: /* @__PURE__ */ H(Be, {})
783
+ children: /* @__PURE__ */ V(Ve, {})
754
784
  })]
755
- }), e.status === "error" ? /* @__PURE__ */ H("div", {
756
- class: "whoo-widget-feedback-error",
785
+ }), /* @__PURE__ */ V("div", {
757
786
  role: "status",
758
- children: "Couldn't send feedback"
759
- }) : null]
787
+ class: d ? "whoo-widget-feedback-submitted" : e.status === "error" ? "whoo-widget-feedback-error" : void 0,
788
+ children: d ? "Thanks for the feedback" : e.status === "error" ? "Couldn't send feedback" : null
789
+ })]
760
790
  });
761
791
  }
762
792
  //#endregion
763
793
  //#region src/components/MessageList.tsx
764
- function Xe({ isSlowResponse: e }) {
765
- return /* @__PURE__ */ H("div", {
794
+ function Qe({ isSlowResponse: e }) {
795
+ return /* @__PURE__ */ V("div", {
766
796
  class: "whoo-widget-pending",
767
797
  role: "status",
768
- children: [/* @__PURE__ */ H("span", {
798
+ children: [/* @__PURE__ */ V("span", {
769
799
  class: "whoo-widget-typing",
770
800
  "aria-hidden": "true",
771
801
  children: [
772
- /* @__PURE__ */ H("span", {}),
773
- /* @__PURE__ */ H("span", {}),
774
- /* @__PURE__ */ H("span", {})
802
+ /* @__PURE__ */ V("span", {}),
803
+ /* @__PURE__ */ V("span", {}),
804
+ /* @__PURE__ */ V("span", {})
775
805
  ]
776
- }), e ? /* @__PURE__ */ H("span", {
806
+ }), e ? /* @__PURE__ */ V("span", {
777
807
  class: "whoo-widget-pending-text",
778
808
  children: "Looking that up for you…"
779
809
  }) : null]
780
810
  });
781
811
  }
782
- function Ze({ url: e, alt: t }) {
783
- let [n, r] = R(!1);
784
- return n ? null : /* @__PURE__ */ H("img", {
812
+ function $e({ url: e, alt: t }) {
813
+ let [n, r] = Ee(!1);
814
+ return n ? null : /* @__PURE__ */ V("img", {
785
815
  class: "whoo-widget-empty-state-image",
786
816
  src: e,
787
817
  alt: t,
@@ -789,42 +819,54 @@ function Ze({ url: e, alt: t }) {
789
819
  onError: () => r(!0)
790
820
  });
791
821
  }
792
- function Qe({ message: e, feedbackState: t, showFeedback: n, pending: r, isSlowResponse: i, onThumbsUp: a, onThumbsDown: o, onSubmitDetailed: s, onCancelFeedback: c }) {
793
- let l = B(null), u = e.id;
794
- return /* @__PURE__ */ H("div", {
795
- ref: l,
822
+ function et({ message: e, speaker: t, feedbackState: n, showFeedback: r, pending: i, isSlowResponse: a, onThumbsUp: o, onThumbsDown: s, onDraftChange: c, onSubmitDetailed: l, onCancelFeedback: u }) {
823
+ let d = z(null), f = e.id;
824
+ return /* @__PURE__ */ V("div", {
825
+ ref: d,
796
826
  tabIndex: -1,
797
827
  class: `whoo-widget-message whoo-widget-message--${e.role}`,
798
- children: [r ? /* @__PURE__ */ H(Xe, { isSlowResponse: i }) : qe(e.content), n && e.role === "assistant" && u ? /* @__PURE__ */ H(Ye, {
799
- state: t,
800
- containerRef: l,
801
- onThumbsUp: () => a(u),
802
- onThumbsDown: () => o(u),
803
- onSubmitDetailed: (e, t) => s(u, e, t),
804
- onCancel: () => c(u)
805
- }) : null]
828
+ children: [
829
+ /* @__PURE__ */ V("span", {
830
+ class: "whoo-widget-sr-only",
831
+ children: [t, ": "]
832
+ }),
833
+ i ? /* @__PURE__ */ V(Qe, { isSlowResponse: a }) : Ye(e.content),
834
+ r && e.role === "assistant" && f ? /* @__PURE__ */ V(Ze, {
835
+ state: n,
836
+ containerRef: d,
837
+ onThumbsUp: () => o(f),
838
+ onThumbsDown: () => s(f),
839
+ onDraftChange: (e, t) => c(f, e, t),
840
+ onSubmitDetailed: (e, t) => l(f, e, t),
841
+ onCancel: () => u(f)
842
+ }) : null
843
+ ]
806
844
  });
807
845
  }
808
- function $e({ 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 }) {
809
- let d = B(null);
810
- return z(() => {
811
- let e = d.current;
846
+ function tt({ messages: e, messageFeedback: t, announcement: n, emptyStateImage: r, agentName: i = "Aiden", showFeedback: a = !1, isStreaming: o = !1, isSlowResponse: s = !1, onThumbsUp: c, onThumbsDown: l, onDraftChange: u = () => {}, onSubmitDetailed: d, onCancelFeedback: f }) {
847
+ let p = z(null);
848
+ return R(() => {
849
+ let e = p.current;
812
850
  e && (e.scrollTop = e.scrollHeight);
813
- }, [e, o]), /* @__PURE__ */ H(E, { children: [/* @__PURE__ */ H("div", {
851
+ }, [e, s]), /* @__PURE__ */ V(E, { children: [/* @__PURE__ */ V("section", {
814
852
  class: "whoo-widget-message-list",
815
- ref: d,
816
- children: [r ? /* @__PURE__ */ H(Ze, { ...r }) : null, e.map((n, r) => /* @__PURE__ */ H(Qe, {
853
+ ref: p,
854
+ "aria-label": "Conversation",
855
+ tabIndex: 0,
856
+ children: [r ? /* @__PURE__ */ V($e, { ...r }) : null, e.map((n, r) => /* @__PURE__ */ V(et, {
817
857
  message: n,
818
- showFeedback: i,
858
+ speaker: n.role === "user" ? "You" : i,
859
+ showFeedback: a,
819
860
  feedbackState: n.id ? t[n.id] ?? { status: "idle" } : { status: "idle" },
820
- pending: a && r === e.length - 1 && n.role === "assistant" && n.content === "",
821
- isSlowResponse: o,
822
- onThumbsUp: s,
823
- onThumbsDown: c,
824
- onSubmitDetailed: l,
825
- onCancelFeedback: u
861
+ pending: o && r === e.length - 1 && n.role === "assistant" && n.content === "",
862
+ isSlowResponse: s,
863
+ onThumbsUp: c,
864
+ onThumbsDown: l,
865
+ onDraftChange: u,
866
+ onSubmitDetailed: d,
867
+ onCancelFeedback: f
826
868
  }, n.id ?? r))]
827
- }), /* @__PURE__ */ H("div", {
869
+ }), /* @__PURE__ */ V("div", {
828
870
  class: "whoo-widget-sr-only",
829
871
  "aria-live": "polite",
830
872
  "aria-atomic": "true",
@@ -833,16 +875,16 @@ function $e({ messages: e, messageFeedback: t, lastCompletedMessageText: n, empt
833
875
  }
834
876
  //#endregion
835
877
  //#region src/components/Panel.tsx
836
- var et = "button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"])";
837
- function tt(e) {
838
- return Array.from(e.querySelectorAll(et)).filter((e) => {
878
+ var nt = "button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"])";
879
+ function rt(e) {
880
+ return Array.from(e.querySelectorAll(nt)).filter((e) => {
839
881
  let t = getComputedStyle(e);
840
882
  return t.display !== "none" && t.visibility !== "hidden";
841
883
  });
842
884
  }
843
- function nt({ state: e, controller: t, greeting: n }) {
844
- let i = B(null), a = B(null);
845
- z(() => {
885
+ function it({ state: e, controller: t, greeting: n }) {
886
+ let i = z(null), a = z(null);
887
+ R(() => {
846
888
  a.current?.focus();
847
889
  }, []);
848
890
  let o = (e) => {
@@ -853,7 +895,7 @@ function nt({ state: e, controller: t, greeting: n }) {
853
895
  if (e.key !== "Tab") return;
854
896
  let n = i.current;
855
897
  if (!n) return;
856
- let r = tt(n);
898
+ let r = rt(n);
857
899
  if (r.length === 0) return;
858
900
  let a = r[0], o = r[r.length - 1], s = n.getRootNode().activeElement;
859
901
  if (!n.contains(s)) {
@@ -864,58 +906,62 @@ function nt({ state: e, controller: t, greeting: n }) {
864
906
  }, s = () => {
865
907
  let n = e.draft.trim();
866
908
  n && !e.isStreaming && (t.setDraft(""), t.sendMessage(n));
867
- }, c = `Chat with ${r(t.config.name) || e.agentName || "Aiden"}`, l = e.messages.length === 0 && n ? [{
909
+ }, c = r(t.config.name) || e.agentName || "Aiden", l = `Chat with ${c}`, u = e.messages.length === 0 && n ? [{
868
910
  role: "assistant",
869
911
  content: n,
870
912
  id: null
871
- }] : e.messages, u = t.emptyStateImageUrl, d = e.messages.length === 0 && u ? {
872
- url: u,
913
+ }] : e.messages, d = t.emptyStateImageUrl, f = e.messages.length === 0 && d ? {
914
+ url: d,
873
915
  alt: t.emptyStateImageAlt
874
916
  } : void 0;
875
- return /* @__PURE__ */ H("div", {
917
+ return /* @__PURE__ */ V("div", {
876
918
  class: "whoo-widget-panel",
877
919
  role: "dialog",
878
920
  "aria-modal": "true",
879
- "aria-label": c,
921
+ "aria-label": l,
880
922
  ref: i,
881
923
  onKeyDown: o,
882
924
  children: [
883
- /* @__PURE__ */ H("div", {
925
+ /* @__PURE__ */ V("div", {
884
926
  class: "whoo-widget-header",
885
- children: [/* @__PURE__ */ H("h2", {
927
+ children: [/* @__PURE__ */ V("h2", {
886
928
  class: "whoo-widget-header-title",
887
- children: c
888
- }), /* @__PURE__ */ H("div", {
929
+ children: l
930
+ }), /* @__PURE__ */ V("div", {
889
931
  class: "whoo-widget-header-actions",
890
- children: [e.messages.length > 0 && /* @__PURE__ */ H("button", {
932
+ children: [e.messages.length > 0 && /* @__PURE__ */ V("button", {
891
933
  type: "button",
892
934
  class: "whoo-widget-header-reset",
893
- onClick: () => t.resetConversation(),
935
+ onClick: () => {
936
+ t.resetConversation(), a.current?.focus();
937
+ },
894
938
  children: "New conversation"
895
- }), /* @__PURE__ */ H("button", {
939
+ }), /* @__PURE__ */ V("button", {
896
940
  type: "button",
897
941
  class: "whoo-widget-header-close",
898
942
  "aria-label": "Close chat",
899
943
  onClick: () => t.close(),
900
- children: /* @__PURE__ */ H(Le, {})
944
+ children: /* @__PURE__ */ V(Re, {})
901
945
  })]
902
946
  })]
903
947
  }),
904
- /* @__PURE__ */ H($e, {
905
- messages: l,
948
+ /* @__PURE__ */ V(tt, {
949
+ messages: u,
906
950
  messageFeedback: e.messageFeedback,
907
- lastCompletedMessageText: e.lastCompletedMessageText,
908
- emptyStateImage: d,
951
+ announcement: e.announcement,
952
+ emptyStateImage: f,
953
+ agentName: c,
909
954
  showFeedback: t.showFeedback,
910
955
  isStreaming: e.isStreaming,
911
956
  isSlowResponse: e.isSlowResponse,
912
957
  onThumbsUp: (e) => t.submitFeedback(e, "up"),
913
958
  onThumbsDown: (e) => t.expandFeedback(e),
959
+ onDraftChange: (e, n, r) => t.setFeedbackDraft(e, n, r),
914
960
  onSubmitDetailed: (e, n, r) => t.submitFeedback(e, "down", n || void 0, r || void 0),
915
961
  onCancelFeedback: (e) => t.cancelFeedback(e)
916
962
  }),
917
- e.runtimeError && /* @__PURE__ */ H(Ue, { message: e.runtimeError }),
918
- /* @__PURE__ */ H(He, {
963
+ e.runtimeError && /* @__PURE__ */ V(We, { message: e.runtimeError }),
964
+ /* @__PURE__ */ V(Ue, {
919
965
  value: e.draft,
920
966
  onChange: (e) => t.setDraft(e),
921
967
  onSend: s,
@@ -927,16 +973,16 @@ function nt({ state: e, controller: t, greeting: n }) {
927
973
  }
928
974
  //#endregion
929
975
  //#region src/components/App.tsx
930
- function rt({ controller: e }) {
931
- let [t, n] = R(e.getState()), r = B(null), i = B(t.isOpen);
932
- return z(() => (n(e.getState()), e.subscribe(n)), [e]), z(() => {
976
+ function at({ controller: e }) {
977
+ let [t, n] = Ee(e.getState()), r = z(null), i = z(t.isOpen);
978
+ return R(() => (n(e.getState()), e.subscribe(n)), [e]), R(() => {
933
979
  i.current && !t.isOpen && r.current?.focus(), i.current = t.isOpen;
934
- }, [t.isOpen]), t.initError ? null : /* @__PURE__ */ H(E, { children: [/* @__PURE__ */ H(Ve, {
980
+ }, [t.isOpen]), t.initError ? null : /* @__PURE__ */ V(E, { children: [/* @__PURE__ */ V(He, {
935
981
  isOpen: t.isOpen,
936
982
  onClick: () => t.isOpen ? e.close() : e.open(),
937
983
  iconUrl: e.launcherIconUrl,
938
984
  buttonRef: r
939
- }), t.isOpen && /* @__PURE__ */ H(nt, {
985
+ }), t.isOpen && /* @__PURE__ */ V(it, {
940
986
  state: t,
941
987
  controller: e,
942
988
  greeting: e.config.greeting
@@ -944,44 +990,44 @@ function rt({ controller: e }) {
944
990
  }
945
991
  //#endregion
946
992
  //#region src/api/client.ts
947
- var Y = class extends Error {
993
+ var X = class extends Error {
948
994
  status;
949
995
  constructor(e, t) {
950
996
  super(e), this.name = "WidgetApiError", this.status = t;
951
997
  }
952
998
  };
953
- function X(e) {
999
+ function Z(e) {
954
1000
  if (typeof e != "string") return null;
955
1001
  let t = e.trim();
956
1002
  return t === "" ? null : t;
957
1003
  }
958
- async function it(e, t) {
1004
+ async function ot(e, t) {
959
1005
  let n = await fetch(`${e}/api/v1/widget/session`, {
960
1006
  method: "POST",
961
1007
  headers: { "Content-Type": "application/json" },
962
1008
  body: JSON.stringify({ publishable_key: t })
963
1009
  });
964
- if (!n.ok) throw new Y(`Failed to create widget session (${n.status})`, n.status);
1010
+ if (!n.ok) throw new X(`Failed to create widget session (${n.status})`, n.status);
965
1011
  let r = await n.json();
966
1012
  return {
967
1013
  token: r.token,
968
- ...at(r)
1014
+ ...st(r)
969
1015
  };
970
1016
  }
971
- function at(e) {
1017
+ function st(e) {
972
1018
  return {
973
- primaryColor: X(e.primary_color),
974
- name: X(e.name),
975
- accentColor: X(e.accent_color),
976
- inkColor: X(e.ink_color)
1019
+ primaryColor: Z(e.primary_color),
1020
+ name: Z(e.name),
1021
+ accentColor: Z(e.accent_color),
1022
+ inkColor: Z(e.ink_color)
977
1023
  };
978
1024
  }
979
- async function ot(e, t) {
1025
+ async function ct(e, t) {
980
1026
  let n = await fetch(`${e}/api/v1/widget/branding`, { headers: { Authorization: `Bearer ${t}` } });
981
- if (!n.ok) throw new Y(`Failed to load widget branding (${n.status})`, n.status);
982
- return at(await n.json());
1027
+ if (!n.ok) throw new X(`Failed to load widget branding (${n.status})`, n.status);
1028
+ return st(await n.json());
983
1029
  }
984
- async function st(e, t, n) {
1030
+ async function lt(e, t, n) {
985
1031
  let r = await fetch(`${e}/api/v1/widget/feedback`, {
986
1032
  method: "POST",
987
1033
  headers: {
@@ -995,11 +1041,11 @@ async function st(e, t, n) {
995
1041
  category: n.category ?? null
996
1042
  })
997
1043
  });
998
- if (!r.ok) throw new Y(`Feedback submission failed (${r.status})`, r.status);
1044
+ if (!r.ok) throw new X(`Feedback submission failed (${r.status})`, r.status);
999
1045
  }
1000
1046
  //#endregion
1001
1047
  //#region src/api/sse.ts
1002
- async function* ct(e, t, n, r, i) {
1048
+ async function* ut(e, t, n, r, i) {
1003
1049
  let a = await fetch(`${e}/api/v1/widget/chat`, {
1004
1050
  method: "POST",
1005
1051
  headers: {
@@ -1012,7 +1058,7 @@ async function* ct(e, t, n, r, i) {
1012
1058
  }),
1013
1059
  signal: i
1014
1060
  });
1015
- if (!a.ok || !a.body) throw new Y(`Chat request failed (${a.status})`, a.status);
1061
+ if (!a.ok || !a.body) throw new X(`Chat request failed (${a.status})`, a.status);
1016
1062
  let o = a.body.getReader(), s = new TextDecoder(), c = "";
1017
1063
  for (;;) {
1018
1064
  let { done: e, value: t } = await o.read();
@@ -1023,11 +1069,11 @@ async function* ct(e, t, n, r, i) {
1023
1069
  let e = c.slice(0, n);
1024
1070
  c = c.slice(n + 2);
1025
1071
  let t = e.split("\n").find((e) => e.startsWith("data: "));
1026
- t && (yield lt(JSON.parse(t.slice(6)))), n = c.indexOf("\n\n");
1072
+ t && (yield dt(JSON.parse(t.slice(6)))), n = c.indexOf("\n\n");
1027
1073
  }
1028
1074
  }
1029
1075
  }
1030
- function lt(e) {
1076
+ function dt(e) {
1031
1077
  return typeof e.error == "string" ? {
1032
1078
  type: "error",
1033
1079
  error: e.error,
@@ -1050,7 +1096,7 @@ function lt(e) {
1050
1096
  }
1051
1097
  //#endregion
1052
1098
  //#region src/imageUrl.ts
1053
- function ut(e, t) {
1099
+ function ft(e, t) {
1054
1100
  if (e != null && e !== "") {
1055
1101
  if (typeof e == "string") try {
1056
1102
  let t = new URL(e);
@@ -1060,17 +1106,29 @@ function ut(e, t) {
1060
1106
  }
1061
1107
  }
1062
1108
  //#endregion
1063
- //#region src/markdown/reveal.ts
1064
- var dt = 40, ft = 120;
1109
+ //#region src/markdown/plainText.ts
1065
1110
  function pt(e) {
1111
+ return J(e.replace(/\r\n?/g, "\n")).map((e) => {
1112
+ switch (e.type) {
1113
+ case "bold":
1114
+ case "italic": return pt(e.value);
1115
+ case "link": return e.text;
1116
+ default: return e.value;
1117
+ }
1118
+ }).join("");
1119
+ }
1120
+ //#endregion
1121
+ //#region src/markdown/reveal.ts
1122
+ var mt = 40, ht = 120;
1123
+ function gt(e) {
1066
1124
  let t = [];
1067
- for (let n of Ke(e)) if (n.type === "text") {
1125
+ for (let n of J(e)) if (n.type === "text") {
1068
1126
  let e = n.value.split(/(\s+)/), r = n.start;
1069
1127
  for (let n of e) r += n.length, n.trim().length > 0 && t.push(r);
1070
1128
  } else t.push(n.end);
1071
1129
  return t;
1072
1130
  }
1073
- function mt(e) {
1131
+ function _t(e) {
1074
1132
  let t = null;
1075
1133
  return e?.addEventListener("abort", () => {
1076
1134
  t?.();
@@ -1085,38 +1143,38 @@ function mt(e) {
1085
1143
  });
1086
1144
  };
1087
1145
  }
1088
- async function ht(e, t, n) {
1089
- let r = n?.wordIntervalMs ?? dt, i = n?.tokenIntervalMs ?? ft, a = n?.signal, o = Ke(e), s = new Set(o.filter((e) => e.type !== "text").map((e) => e.end)), c = mt(a), l = "";
1090
- for (let n of pt(e)) if (a?.aborted || (l = e.slice(0, n), t(l), await c(s.has(n) ? i : r), a?.aborted)) return;
1146
+ async function vt(e, t, n) {
1147
+ let r = n?.wordIntervalMs ?? mt, i = n?.tokenIntervalMs ?? ht, a = n?.signal, o = J(e), s = new Set(o.filter((e) => e.type !== "text").map((e) => e.end)), c = _t(a), l = "";
1148
+ for (let n of gt(e)) if (a?.aborted || (l = e.slice(0, n), t(l), await c(s.has(n) ? i : r), a?.aborted)) return;
1091
1149
  l !== e && t(e);
1092
1150
  }
1093
1151
  //#endregion
1094
1152
  //#region src/storage.ts
1095
- function gt(e) {
1153
+ function yt(e) {
1096
1154
  return `whoo-aiden-widget:conversation:${e}`;
1097
1155
  }
1098
- function _t(e) {
1156
+ function bt(e) {
1099
1157
  try {
1100
- return window.sessionStorage.getItem(gt(e));
1158
+ return window.sessionStorage.getItem(yt(e));
1101
1159
  } catch {
1102
1160
  return null;
1103
1161
  }
1104
1162
  }
1105
- function vt(e, t) {
1163
+ function xt(e, t) {
1106
1164
  try {
1107
- window.sessionStorage.setItem(gt(e), t);
1165
+ window.sessionStorage.setItem(yt(e), t);
1108
1166
  } catch {}
1109
1167
  }
1110
- function yt(e) {
1168
+ function St(e) {
1111
1169
  try {
1112
- window.sessionStorage.removeItem(gt(e));
1170
+ window.sessionStorage.removeItem(yt(e));
1113
1171
  } catch {}
1114
1172
  }
1115
1173
  //#endregion
1116
1174
  //#region src/theme.ts
1117
- var bt = /^(inherit|initial|unset|revert|revert-layer)$|\bcurrentcolor\b|\b(var|env|attr|light-dark)\(/i;
1118
- function xt(e) {
1119
- if (bt.test(e.trim())) return null;
1175
+ var Ct = /^(inherit|initial|unset|revert|revert-layer)$|\bcurrentcolor\b|\b(var|env|attr|light-dark)\(/i;
1176
+ function wt(e) {
1177
+ if (Ct.test(e.trim())) return null;
1120
1178
  let t = document.createElement("div");
1121
1179
  if (t.style.color = e, t.style.color === "") return null;
1122
1180
  let n = document.createElement("div");
@@ -1135,64 +1193,64 @@ function xt(e) {
1135
1193
  translucent: a < 1
1136
1194
  };
1137
1195
  }
1138
- function St(e) {
1139
- return xt(e)?.rgb ?? null;
1196
+ function Tt(e) {
1197
+ return wt(e)?.rgb ?? null;
1140
1198
  }
1141
- function Z([e, t, n]) {
1199
+ function Q([e, t, n]) {
1142
1200
  let r = (e) => {
1143
1201
  let t = e / 255;
1144
1202
  return t <= .03928 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
1145
1203
  };
1146
1204
  return .2126 * r(e) + .7152 * r(t) + .0722 * r(n);
1147
1205
  }
1148
- function Ct(e, t) {
1206
+ function Et(e, t) {
1149
1207
  let n = Math.max(e, t), r = Math.min(e, t);
1150
1208
  return (n + .05) / (r + .05);
1151
1209
  }
1152
- function wt(e) {
1153
- let t = St(e);
1210
+ function Dt(e) {
1211
+ let t = Tt(e);
1154
1212
  if (!t) return console.warn(`[whoo-aiden-widget] Could not parse color "${e}" for contrast calculation; defaulting to white text.`), "#ffffff";
1155
- let n = Z(t);
1156
- return Ct(n, Z([
1213
+ let n = Q(t);
1214
+ return Et(n, Q([
1157
1215
  0,
1158
1216
  0,
1159
1217
  0
1160
- ])) >= Ct(n, Z([
1218
+ ])) >= Et(n, Q([
1161
1219
  255,
1162
1220
  255,
1163
1221
  255
1164
1222
  ])) ? "#000000" : "#ffffff";
1165
1223
  }
1166
- var Q = "#4f46e5", Tt = "#ffffff", Et = "#f0f0f0", Dt = 4.5;
1167
- function Ot([e, t, n]) {
1224
+ var Ot = "#4f46e5", kt = "#ffffff", At = "#f0f0f0", jt = "#f3f4f6", Mt = 4.5;
1225
+ function Nt([e, t, n]) {
1168
1226
  return `#${[
1169
1227
  e,
1170
1228
  t,
1171
1229
  n
1172
1230
  ].map((e) => e.toString(16).padStart(2, "0")).join("")}`;
1173
1231
  }
1174
- function kt(e, t = Tt) {
1175
- let n = St(e), r = St(t);
1176
- if (!n || !r) return Q;
1177
- let i = Z(r), a = (e) => Ct(Z(e), i) >= Dt;
1178
- if (a(n)) return Ot(n);
1232
+ function Pt(e, t = kt) {
1233
+ let n = Tt(e), r = Tt(t);
1234
+ if (!n || !r) return Ot;
1235
+ let i = Q(r), a = (e) => Et(Q(e), i) >= Mt;
1236
+ if (a(n)) return Nt(n);
1179
1237
  for (let e = .99; e > 0; e -= .01) {
1180
1238
  let t = n.map((t) => Math.round(t * e));
1181
- if (a(t)) return Ot(t);
1239
+ if (a(t)) return Nt(t);
1182
1240
  }
1183
1241
  return "#000000";
1184
1242
  }
1185
- var At = "#111111", jt = "#0000ee";
1243
+ var Ft = "#111111", It = "#0000ee";
1186
1244
  function $(e) {
1187
1245
  if (typeof e != "string" || !e) return null;
1188
- let t = xt(e);
1189
- return t ? Ot(t.rgb) : null;
1246
+ let t = wt(e);
1247
+ return t ? Nt(t.rgb) : null;
1190
1248
  }
1191
- function Mt({ color: e, inkColor: t, accentColor: n }) {
1192
- 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;
1249
+ function Lt({ color: e, inkColor: t, accentColor: n }) {
1250
+ let r = $(e), i = r ?? Ot, a = Pt(i, jt), o = $(t), s = o ? Pt(o, At) : Ft, c = $(n), l = c ? Pt(c, At) : It;
1193
1251
  return {
1194
1252
  primary: i,
1195
- textOnPrimary: wt(i),
1253
+ textOnPrimary: Dt(i),
1196
1254
  primaryAsText: a,
1197
1255
  ink: s,
1198
1256
  link: l,
@@ -1203,27 +1261,27 @@ function Mt({ color: e, inkColor: t, accentColor: n }) {
1203
1261
  }
1204
1262
  };
1205
1263
  }
1206
- function Nt(e) {
1264
+ function Rt(e) {
1207
1265
  return typeof e == "string" ? `"${e}"` : `a ${typeof e} value`;
1208
1266
  }
1209
- function Pt(e, t, n = Q) {
1267
+ function zt(e, t, n = Ot) {
1210
1268
  let r = t;
1211
- $(t) === null && (console.warn(`[whoo-aiden-widget] Could not use ${Nt(t)} as the theme color; falling back to ${Nt(n)}.`), r = n);
1212
- let i = Mt({ color: r });
1269
+ $(t) === null && (console.warn(`[whoo-aiden-widget] Could not use ${Rt(t)} as the theme color; falling back to ${Rt(n)}.`), r = n);
1270
+ let i = Lt({ color: r });
1213
1271
  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);
1214
1272
  }
1215
- function Ft(e, { inkColor: t, accentColor: n }) {
1216
- let r = Mt({
1273
+ function Bt(e, { inkColor: t, accentColor: n }) {
1274
+ let r = Lt({
1217
1275
  inkColor: t,
1218
1276
  accentColor: n
1219
1277
  });
1220
1278
  e.style.setProperty("--whoo-widget-ink", r.ink), e.style.setProperty("--whoo-widget-link-color", r.link);
1221
1279
  }
1222
- function It(e, t) {
1223
- e && $(e) === null && console.warn(`[whoo-aiden-widget] Could not use ${Nt(e)} as the ${t}; using the default.`);
1280
+ function Vt(e, t) {
1281
+ e && $(e) === null && console.warn(`[whoo-aiden-widget] Could not use ${Rt(e)} as the ${t}; using the default.`);
1224
1282
  }
1225
- function Lt(e, t) {
1226
- Pt(e, t.color ?? Q), It(t.inkColor, "ink color"), It(t.accentColor, "accent color"), Ft(e, {
1283
+ function Ht(e, t) {
1284
+ zt(e, t.color ?? Ot), Vt(t.inkColor, "ink color"), Vt(t.accentColor, "accent color"), Bt(e, {
1227
1285
  inkColor: t.inkColor,
1228
1286
  accentColor: t.accentColor
1229
1287
  });
@@ -1232,7 +1290,7 @@ function Lt(e, t) {
1232
1290
  }
1233
1291
  //#endregion
1234
1292
  //#region src/controller.ts
1235
- var Rt = 8e3, zt = class {
1293
+ var Ut = 8e3, Wt = class {
1236
1294
  config;
1237
1295
  state;
1238
1296
  listeners = /* @__PURE__ */ new Set();
@@ -1247,7 +1305,7 @@ var Rt = 8e3, zt = class {
1247
1305
  emptyStateImageAlt;
1248
1306
  showFeedback;
1249
1307
  constructor(e) {
1250
- this.config = e, this.launcherIconUrl = ut(e.launcherIconUrl, "launcherIconUrl"), this.emptyStateImageUrl = ut(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 = {
1308
+ this.config = e, this.launcherIconUrl = ft(e.launcherIconUrl, "launcherIconUrl"), this.emptyStateImageUrl = ft(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 = {
1251
1309
  isOpen: !1,
1252
1310
  messages: [],
1253
1311
  isStreaming: !1,
@@ -1258,7 +1316,7 @@ var Rt = 8e3, zt = class {
1258
1316
  agentName: null,
1259
1317
  accentColor: null,
1260
1318
  inkColor: null,
1261
- lastCompletedMessageText: null,
1319
+ announcement: null,
1262
1320
  isSlowResponse: !1,
1263
1321
  draft: ""
1264
1322
  };
@@ -1284,7 +1342,7 @@ var Rt = 8e3, zt = class {
1284
1342
  try {
1285
1343
  if (this.config.sessionToken) this.sessionToken = this.config.sessionToken;
1286
1344
  else if (this.config.publishableKey) {
1287
- let { token: t, primaryColor: n, name: r, accentColor: i, inkColor: a } = await it(e, this.config.publishableKey);
1345
+ let { token: t, primaryColor: n, name: r, accentColor: i, inkColor: a } = await ot(e, this.config.publishableKey);
1288
1346
  this.sessionToken = t, this.setState({
1289
1347
  primaryColor: n,
1290
1348
  agentName: r,
@@ -1296,13 +1354,13 @@ var Rt = 8e3, zt = class {
1296
1354
  console.error("[whoo-aiden-widget] initialization failed:", e), this.setState({ initError: e instanceof Error ? e.message : String(e) });
1297
1355
  return;
1298
1356
  }
1299
- this.conversationId = _t(this.storageIdentifier), this.config.sessionToken && await this.loadBranding(e, this.config.sessionToken);
1357
+ this.conversationId = bt(this.storageIdentifier), this.config.sessionToken && await this.loadBranding(e, this.config.sessionToken);
1300
1358
  }
1301
1359
  async loadBranding(e, t) {
1302
1360
  try {
1303
1361
  let n = this.config;
1304
1362
  if ($(n.color) && $(n.inkColor) && $(n.accentColor) && r(n.name)) return;
1305
- let { primaryColor: i, name: a, accentColor: o, inkColor: s } = await ot(e, t);
1363
+ let { primaryColor: i, name: a, accentColor: o, inkColor: s } = await ct(e, t);
1306
1364
  this.setState({
1307
1365
  primaryColor: i,
1308
1366
  agentName: a,
@@ -1315,12 +1373,12 @@ var Rt = 8e3, zt = class {
1315
1373
  this.setState({ isOpen: !0 });
1316
1374
  }
1317
1375
  resetConversation() {
1318
- this.activeRequestController?.abort(), this.activeRequestController = null, this.clearSlowResponse(), this.conversationId = null, yt(this.storageIdentifier), this.setState({
1376
+ this.activeRequestController?.abort(), this.activeRequestController = null, this.clearSlowResponse(), this.conversationId = null, St(this.storageIdentifier), this.setState({
1319
1377
  messages: [],
1320
1378
  messageFeedback: {},
1321
1379
  runtimeError: null,
1322
1380
  isStreaming: !1,
1323
- lastCompletedMessageText: null
1381
+ announcement: "Conversation cleared"
1324
1382
  });
1325
1383
  }
1326
1384
  setDraft(e) {
@@ -1347,7 +1405,8 @@ var Rt = 8e3, zt = class {
1347
1405
  r
1348
1406
  ],
1349
1407
  isStreaming: !0,
1350
- runtimeError: null
1408
+ runtimeError: null,
1409
+ announcement: null
1351
1410
  });
1352
1411
  let i = (e) => {
1353
1412
  let t = [...this.state.messages];
@@ -1360,7 +1419,7 @@ var Rt = 8e3, zt = class {
1360
1419
  let { signal: a } = this.activeRequestController;
1361
1420
  this.slowResponseTimer = setTimeout(() => {
1362
1421
  this.slowResponseTimer = null, this.setState({ isSlowResponse: !0 });
1363
- }, Rt);
1422
+ }, Ut);
1364
1423
  let o = () => {
1365
1424
  this.setState({
1366
1425
  runtimeError: "Something went wrong, please try again.",
@@ -1368,17 +1427,17 @@ var Rt = 8e3, zt = class {
1368
1427
  });
1369
1428
  }, s = "";
1370
1429
  try {
1371
- for await (let n of ct(t, this.sessionToken, this.conversationId, e, a)) if (n.type === "conversation_id") this.conversationId = n.conversationId, vt(this.storageIdentifier, n.conversationId);
1372
- else if (n.type === "delta") this.clearSlowResponse(), n.verbatim && !this.prefersReducedMotion ? (await ht(n.delta, (e) => i(e), { signal: a }), s = n.delta) : n.verbatim ? (s = n.delta, i(s)) : (s += n.delta, i(s));
1430
+ for await (let n of ut(t, this.sessionToken, this.conversationId, e, a)) if (n.type === "conversation_id") this.conversationId = n.conversationId, xt(this.storageIdentifier, n.conversationId);
1431
+ else if (n.type === "delta") this.clearSlowResponse(), n.verbatim && !this.prefersReducedMotion ? (await vt(n.delta, (e) => i(e), { signal: a }), s = n.delta) : n.verbatim ? (s = n.delta, i(s)) : (s += n.delta, i(s));
1373
1432
  else if (n.type === "done") {
1374
- if (n.conversationId && (this.conversationId = n.conversationId, vt(this.storageIdentifier, n.conversationId)), n.messageId) {
1433
+ if (n.conversationId && (this.conversationId = n.conversationId, xt(this.storageIdentifier, n.conversationId)), n.messageId) {
1375
1434
  let e = [...this.state.messages];
1376
1435
  e[e.length - 1] = {
1377
1436
  ...e[e.length - 1],
1378
1437
  id: n.messageId
1379
1438
  }, this.setState({ messages: e });
1380
1439
  }
1381
- this.setState({ lastCompletedMessageText: s });
1440
+ this.setState({ announcement: pt(s) });
1382
1441
  } else if (n.type === "error") {
1383
1442
  console.error("[whoo-aiden-widget] chat error:", n.error), o(), this.activeRequestController?.abort();
1384
1443
  break;
@@ -1390,9 +1449,24 @@ var Rt = 8e3, zt = class {
1390
1449
  }
1391
1450
  }
1392
1451
  expandFeedback(e) {
1452
+ let { correction: t, category: n } = this.state.messageFeedback[e] ?? {};
1393
1453
  this.setState({ messageFeedback: {
1394
1454
  ...this.state.messageFeedback,
1395
- [e]: { status: "expanded" }
1455
+ [e]: {
1456
+ status: "expanded",
1457
+ correction: t,
1458
+ category: n
1459
+ }
1460
+ } });
1461
+ }
1462
+ setFeedbackDraft(e, t, n) {
1463
+ this.setState({ messageFeedback: {
1464
+ ...this.state.messageFeedback,
1465
+ [e]: {
1466
+ ...this.state.messageFeedback[e],
1467
+ correction: t,
1468
+ category: n
1469
+ }
1396
1470
  } });
1397
1471
  }
1398
1472
  cancelFeedback(e) {
@@ -1412,7 +1486,7 @@ var Rt = 8e3, zt = class {
1412
1486
  }
1413
1487
  } });
1414
1488
  try {
1415
- await st(i, this.sessionToken, {
1489
+ await lt(i, this.sessionToken, {
1416
1490
  messageId: e,
1417
1491
  rating: t,
1418
1492
  correction: n,
@@ -1424,42 +1498,44 @@ var Rt = 8e3, zt = class {
1424
1498
  rating: t
1425
1499
  }
1426
1500
  } });
1427
- } catch (n) {
1428
- console.error("[whoo-aiden-widget] feedback submission failed:", n), this.setState({ messageFeedback: {
1501
+ } catch (i) {
1502
+ console.error("[whoo-aiden-widget] feedback submission failed:", i), this.setState({ messageFeedback: {
1429
1503
  ...this.state.messageFeedback,
1430
1504
  [e]: {
1431
1505
  status: "error",
1432
- rating: t
1506
+ rating: t,
1507
+ correction: n,
1508
+ category: r
1433
1509
  }
1434
1510
  } });
1435
1511
  }
1436
1512
  }
1437
- }, 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}";
1513
+ }, 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-wrap:wrap;flex-shrink:0;justify-content:space-between;align-items:center;gap:8px;max-height:50%;padding:8px 8px 8px 16px;display:flex;overflow-y:auto}.whoo-widget-header-title{color:var(--whoo-widget-ink,#111);overflow-wrap:anywhere;flex:auto;min-width:0;margin:0;font-size:15px;font-weight:600}.whoo-widget-header-actions{background:#fff;flex-shrink:0;align-items:center;gap:4px;margin-left:auto;display:flex;position:sticky;bottom:0}.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:0;padding:12px;overflow-y:auto}.whoo-widget-message-list:focus-visible{outline-offset:-2px;outline:2px solid #111827;box-shadow:inset 0 0 0 4px #fff}.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{overflow-wrap:anywhere;white-space:pre-line;border-radius:8px;max-width:80%;margin-bottom:8px;padding:8px 12px}.whoo-widget-list{margin:4px 0;padding-left:20px}.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[aria-disabled=true],.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:#4b5563;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}@media (forced-colors:active){.whoo-widget-launcher,.whoo-widget-header-close,.whoo-widget-header-reset,.whoo-widget-composer-send,.whoo-widget-feedback-submit,.whoo-widget-feedback-buttons button{border:1px solid buttontext}.whoo-widget-panel{box-sizing:border-box;border:1px solid canvastext}}";
1438
1514
  //#endregion
1439
1515
  //#region src/mount.tsx
1440
- function Vt(e) {
1516
+ function Kt(e) {
1441
1517
  let t = document.createElement("div");
1442
1518
  t.id = "whoo-aiden-widget-host", t.style.position = "relative", t.style.zIndex = String(n(e.zIndex));
1443
1519
  let r = t.attachShadow({ mode: "open" }), i = document.createElement("style");
1444
- i.textContent = Bt, r.appendChild(i);
1520
+ i.textContent = Gt, r.appendChild(i);
1445
1521
  let a = document.createElement("div");
1446
- r.appendChild(a), Lt(a, e);
1447
- let o = new zt(e), s = $(e.color) !== null, c = null, l = "";
1522
+ r.appendChild(a), Ht(a, e);
1523
+ let o = new Wt(e), s = $(e.color) !== null, c = null, l = "";
1448
1524
  return o.subscribe((t) => {
1449
- !s && t.primaryColor && t.primaryColor !== c && (c = t.primaryColor, Pt(a, t.primaryColor, e.color));
1525
+ !s && t.primaryColor && t.primaryColor !== c && (c = t.primaryColor, zt(a, t.primaryColor, e.color));
1450
1526
  let n = `${t.inkColor}|${t.accentColor}`;
1451
- (t.inkColor || t.accentColor) && n !== l && (l = n, Ft(a, {
1527
+ (t.inkColor || t.accentColor) && n !== l && (l = n, Bt(a, {
1452
1528
  inkColor: $(e.inkColor) ? e.inkColor : t.inkColor,
1453
1529
  accentColor: $(e.accentColor) ? e.accentColor : t.accentColor
1454
1530
  }));
1455
- }), he(/* @__PURE__ */ H(rt, { controller: o }), a), o.init(), document.body.appendChild(t), { unmount() {
1531
+ }), he(/* @__PURE__ */ V(at, { controller: o }), a), o.init(), document.body.appendChild(t), { unmount() {
1456
1532
  he(null, a), t.remove();
1457
1533
  } };
1458
1534
  }
1459
1535
  //#endregion
1460
1536
  //#region src/index.ts
1461
- function Ht(e) {
1462
- return i(e), Vt(e);
1537
+ function qt(e) {
1538
+ return i(e), Kt(e);
1463
1539
  }
1464
1540
  //#endregion
1465
- export { Ht as init, Mt as resolveTheme };
1541
+ export { qt as init, Lt as resolveTheme };