@aiden-voice/widget 0.10.2 → 0.10.3

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
@@ -28,6 +28,10 @@ var e = {
28
28
  conversationCleared: "New conversation started. Previous messages were cleared.",
29
29
  genericError: "Something went wrong, please try again.",
30
30
  sessionExpired: "This chat session has expired. Reload the page to continue.",
31
+ tooManyMessages: "You're sending messages too quickly. Please wait a moment and try again.",
32
+ assistantUnavailable: "The assistant is unavailable right now. Please try again later.",
33
+ waitForReply: "Please wait for the current reply to finish.",
34
+ messageLimitReached: "This conversation has reached its message limit. Please try again later.",
31
35
  opensInNewTab: "(opens in new tab)",
32
36
  agreeToNotice: "I agree"
33
37
  }, t = Object.keys(e);
@@ -235,16 +239,16 @@ var k = {
235
239
  function A(e, t, n) {
236
240
  return e == null ? n : typeof e == "number" && Number.isFinite(e) && e >= 0 ? e : (p(`ignoring \`${t}\` -- expected a non-negative number of pixels; using ${n}.`), n);
237
241
  }
238
- function j(e, t, n, r) {
242
+ function ce(e, t, n, r) {
239
243
  let i = Math.min(r, Math.max(n, e));
240
244
  return i !== e && p(`\`${t}\` ${e} is out of range (${r === Infinity ? `at least ${n}` : `${n}-${r}`}); using ${i}.`), i;
241
245
  }
242
- var ce = /* @__PURE__ */ new WeakMap();
243
- function le(e) {
246
+ var le = /* @__PURE__ */ new WeakMap();
247
+ function ue(e) {
244
248
  let t = { ...k };
245
249
  if (e == null) return t;
246
250
  if (!x(e)) return v(e), t;
247
- let n = ce.get(e);
251
+ let n = le.get(e);
248
252
  if (n) return n;
249
253
  w(e, [
250
254
  "offset",
@@ -253,18 +257,18 @@ function le(e) {
253
257
  "cornerRadius"
254
258
  ], "layout");
255
259
  let r = C(e, "offset", "layout.offset");
256
- r && (w(r, ["x", "y"], "layout.offset"), t.offsetX = A(r.x, "layout.offset.x", k.offsetX), t.offsetY = A(r.y, "layout.offset.y", k.offsetY)), t.launcherSize = j(A(e.launcherSize, "layout.launcherSize", k.launcherSize), "layout.launcherSize", 24, 120);
260
+ r && (w(r, ["x", "y"], "layout.offset"), t.offsetX = A(r.x, "layout.offset.x", k.offsetX), t.offsetY = A(r.y, "layout.offset.y", k.offsetY)), t.launcherSize = ce(A(e.launcherSize, "layout.launcherSize", k.launcherSize), "layout.launcherSize", 24, 120);
257
261
  let i = C(e, "panel", "layout.panel");
258
- i && (w(i, ["width", "height"], "layout.panel"), t.panelWidth = j(A(i.width, "layout.panel.width", k.panelWidth), "layout.panel.width", 280, Infinity), t.panelHeight = j(A(i.height, "layout.panel.height", k.panelHeight), "layout.panel.height", 320, Infinity));
262
+ i && (w(i, ["width", "height"], "layout.panel"), t.panelWidth = ce(A(i.width, "layout.panel.width", k.panelWidth), "layout.panel.width", 280, Infinity), t.panelHeight = ce(A(i.height, "layout.panel.height", k.panelHeight), "layout.panel.height", 320, Infinity));
259
263
  let a = e.cornerRadius;
260
- return typeof a == "number" && Number.isFinite(a) && a >= 0 ? t.cornerRadius = j(a, "layout.cornerRadius", 0, 32) : S(a) || p("ignoring `layout.cornerRadius` -- expected a non-negative number of pixels."), ce.set(e, t), t;
264
+ return typeof a == "number" && Number.isFinite(a) && a >= 0 ? t.cornerRadius = ce(a, "layout.cornerRadius", 0, 32) : S(a) || p("ignoring `layout.cornerRadius` -- expected a non-negative number of pixels."), le.set(e, t), t;
261
265
  }
262
266
  // node_modules/.pnpm/preact@11.1.1/node_modules/preact/dist/preact.mjs
263
- var M, ue, N, de, fe, pe, P, me, he, ge, _e = Symbol.for("pv"), ve = {}, ye = [], be = /^m(i|n|o|s|text|space)$/, xe = Array.isArray, Se = ye.slice, F = Object.assign;
264
- function I(e) {
267
+ var j, de, M, fe, pe, me, he, ge, _e, ve, ye = Symbol.for("pv"), be = {}, xe = [], Se = /^m(i|n|o|s|text|space)$/, Ce = Array.isArray, we = xe.slice, N = Object.assign;
268
+ function P(e) {
265
269
  e && e.parentNode && e.remove();
266
270
  }
267
- function Ce(e, t, n, r, i) {
271
+ function Te(e, t, n, r, i) {
268
272
  var a = {
269
273
  type: e,
270
274
  props: t,
@@ -275,48 +279,48 @@ function Ce(e, t, n, r, i) {
275
279
  __b: 0,
276
280
  __e: null,
277
281
  __c: null,
278
- constructor: _e,
279
- __v: i || ++ue,
282
+ constructor: ye,
283
+ __v: i || ++de,
280
284
  __i: -1,
281
285
  __u: 0
282
286
  };
283
- return !i && M.vnode && M.vnode(a), a;
287
+ return !i && j.vnode && j.vnode(a), a;
284
288
  }
285
- function L(e) {
289
+ function F(e) {
286
290
  return e.children;
287
291
  }
288
- function we(e, t) {
292
+ function Ee(e, t) {
289
293
  this.props = e, this.context = t, this.__g = 0;
290
294
  }
291
- function R(e, t) {
292
- if (t == null) return e.__ && R(e.__, e.__i + 1);
295
+ function I(e, t) {
296
+ if (t == null) return e.__ && I(e.__, e.__i + 1);
293
297
  for (var n; t < e.__k.length; t++) if ((n = e.__k[t]) && n.__e) return n.__e;
294
- return typeof e.type != "function" || e.props.__P ? null : R(e);
298
+ return typeof e.type != "function" || e.props.__P ? null : I(e);
295
299
  }
296
- function Te(e) {
300
+ function De(e) {
297
301
  if ((e = e.__) && e.__c && !e.props.__P) return e.__e = null, e.__k.some(function(t) {
298
302
  return t && (e.__e = t.__e);
299
- }), Te(e);
303
+ }), De(e);
300
304
  }
301
- function Ee(e) {
302
- (8 & e.__g || (e.__g |= 8, N.push(e), fe++)) && de == M.debounceRendering || ((de = M.debounceRendering) || queueMicrotask)(De);
305
+ function Oe(e) {
306
+ (8 & e.__g || (e.__g |= 8, M.push(e), pe++)) && fe == j.debounceRendering || ((fe = j.debounceRendering) || queueMicrotask)(ke);
303
307
  }
304
- function De() {
308
+ function ke() {
305
309
  var e, t, n, r, i, a, o, s, c;
306
310
  try {
307
- for (t = 1; N.length;) N.length > t && N.sort(pe), e = N.shift(), t = N.length, 8 & e.__g && (r = void 0, i = void 0, a = (i = (n = e).__v).__e, o = [], s = [], (c = n.__P) && ((r = F({ constructor: _e }, i)).__v = i.__v + 1, M.vnode && M.vnode(r), Fe(c, r, i, n.__n, c.namespaceURI, 32 & i.__u ? [a] : null, o, a || R(i), 32 & i.__u, s), r.__v = i.__v, r.__.__k[r.__i] = r, Re(o, r, s), i.__ = i.__e = null, r.__e != a && Te(r)));
311
+ for (t = 1; M.length;) M.length > t && M.sort(me), e = M.shift(), t = M.length, 8 & e.__g && (r = void 0, i = void 0, a = (i = (n = e).__v).__e, o = [], s = [], (c = n.__P) && ((r = N({ constructor: ye }, i)).__v = i.__v + 1, j.vnode && j.vnode(r), Le(c, r, i, n.__n, c.namespaceURI, 32 & i.__u ? [a] : null, o, a || I(i), 32 & i.__u, s), r.__v = i.__v, r.__.__k[r.__i] = r, Be(o, r, s), i.__ = i.__e = null, r.__e != a && De(r)));
308
312
  } finally {
309
- (fe = N.length) && (de || queueMicrotask)(De);
313
+ (pe = M.length) && (fe || queueMicrotask)(ke);
310
314
  }
311
315
  }
312
- function Oe(e, t, n, r, i, a, o, s, c, l, u) {
313
- var d, f, p, m, h, g, _ = r.__k || ye, v = t.length;
314
- for (c = ke(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = ~p.__i && _[p.__i] || ve, p.__i = d, g = Fe(e, p, f, i, a, o, s, c, l, u), m = p.__e, (f.ref != p.ref || 8 & f.__u) && (f.ref && Be(f.ref, null, p, f), p.ref && u.push(p.ref, p.__c || m, p)), h ||= m, 4 & p.__u ? (c = Ae(p, c, e, !f.__v), f.__e && (f.__e = null)) : typeof p.type == "function" && g !== void 0 ? c = g : m && (c = m.nextSibling), p.__u &= -21);
316
+ function Ae(e, t, n, r, i, a, o, s, c, l, u) {
317
+ var d, f, p, m, h, g, _ = r.__k || xe, v = t.length;
318
+ for (c = je(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = ~p.__i && _[p.__i] || be, p.__i = d, g = Le(e, p, f, i, a, o, s, c, l, u), m = p.__e, (f.ref != p.ref || 8 & f.__u) && (f.ref && He(f.ref, null, p, f), p.ref && u.push(p.ref, p.__c || m, p)), h ||= m, 4 & p.__u ? (c = Me(p, c, e, !f.__v), f.__e && (f.__e = null)) : typeof p.type == "function" && g !== void 0 ? c = g : m && (c = m.nextSibling), p.__u &= -21);
315
319
  return n.__e = h, c;
316
320
  }
317
- function ke(e, t, n, r, i) {
321
+ function je(e, t, n, r, i) {
318
322
  var a, o, s, c, l, u, d, f, p, m = n.length, h = m, g = 0, _ = 0, v = e.__k = Array(i);
319
- for (a = 0; a < i; a++) (o = t[a]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o != "object" || o.constructor === String ? o = v[a] = Ce(null, o) : xe(o) ? o = v[a] = Ce(L, { children: o }) : o.constructor === _e && o.__b ? o = v[a] = Ce(o.type, o.props, o.key, o.ref, o.__v) : v[a] = o, c = a + g, o.__ = e, o.__b = e.__b + 1, s = null, ~(l = o.__i = je(o, n, c, h)) && (h--, (s = n[l]) && (s.__u |= 2)), s && s.__v ? (o.__u |= 16, l == c - 1 ? g-- : l == c + 1 ? g++ : l != c && (l > c ? g-- : g++, _ = 1)) : (~l || (i > m ? g-- : i < m && g++), typeof o.type != "function" && (o.__u |= 4))) : v[a] = null;
323
+ for (a = 0; a < i; a++) (o = t[a]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o != "object" || o.constructor === String ? o = v[a] = Te(null, o) : Ce(o) ? o = v[a] = Te(F, { children: o }) : o.constructor === ye && o.__b ? o = v[a] = Te(o.type, o.props, o.key, o.ref, o.__v) : v[a] = o, c = a + g, o.__ = e, o.__b = e.__b + 1, s = null, ~(l = o.__i = Ne(o, n, c, h)) && (h--, (s = n[l]) && (s.__u |= 2)), s && s.__v ? (o.__u |= 16, l == c - 1 ? g-- : l == c + 1 ? g++ : l != c && (l > c ? g-- : g++, _ = 1)) : (~l || (i > m ? g-- : i < m && g++), typeof o.type != "function" && (o.__u |= 4))) : v[a] = null;
320
324
  if (_) {
321
325
  for (u = [], d = [], a = 0; a < i; a++) if ((o = v[a]) && 16 & o.__u) {
322
326
  for (g = 0, f = u.length; g < f;) u[p = g + f >> 1] < o.__i ? g = p + 1 : f = p;
@@ -324,21 +328,21 @@ function ke(e, t, n, r, i) {
324
328
  }
325
329
  for (g = u.length; a--;) d[a] && (d[a] == g ? g-- : v[a].__u |= 4);
326
330
  }
327
- if (h) for (a = 0; a < m; a++) !(s = n[a]) || 2 & s.__u || (s.__e == r && (r = R(s)), Ve(s, s));
331
+ if (h) for (a = 0; a < m; a++) !(s = n[a]) || 2 & s.__u || (s.__e == r && (r = I(s)), Ue(s, s));
328
332
  return r;
329
333
  }
330
- function Ae(e, t, n, r) {
334
+ function Me(e, t, n, r) {
331
335
  var i, a, o, s;
332
336
  if (typeof e.type == "function") {
333
337
  if (e.props.__P) return t;
334
- if (i = e.__k) for (a = 0; a < i.length; a++) i[a] && (i[a].__ = e, t = Ae(i[a], t, n, !1));
338
+ if (i = e.__k) for (a = 0; a < i.length; a++) i[a] && (i[a].__ = e, t = Me(i[a], t, n, !1));
335
339
  return t;
336
340
  }
337
- for (t && !t.parentNode && (t = R(e)) && !t.parentNode && (t = null), o = e.__e, s = t; s && s.nodeType == 8;) s = s.nextSibling;
341
+ for (t && !t.parentNode && (t = I(e)) && !t.parentNode && (t = null), o = e.__e, s = t; s && s.nodeType == 8;) s = s.nextSibling;
338
342
  for (o != s && (!r && n.moveBefore && o.parentNode ? n.moveBefore(o, t) : n.insertBefore(o, t || null)), t = o; (t &&= t.nextSibling) && t.nodeType == 8 && !t.data.startsWith("$s"););
339
343
  return t;
340
344
  }
341
- function je(e, t, n, r) {
345
+ function Ne(e, t, n, r) {
342
346
  var i, a = e.key, o = e.type, s = t[n], c = s && !(2 & s.__u);
343
347
  if (s === null && a == null || c && a == s.key && o == s.type) return n;
344
348
  if (r > +!!c) {
@@ -347,18 +351,18 @@ function je(e, t, n, r) {
347
351
  }
348
352
  return -1;
349
353
  }
350
- function Me(e, t, n) {
354
+ function Pe(e, t, n) {
351
355
  n ??= "", t[0] == "-" ? e.setProperty(t, n) : e[t] = n;
352
356
  }
353
- function Ne(e, t, n, r, i) {
357
+ function Fe(e, t, n, r, i) {
354
358
  var a, o;
355
359
  if (t == "style") {
356
360
  if (typeof n == "string") e.style.cssText = n;
357
361
  else {
358
- if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || Me(e.style, t);
359
- if (n) for (t in n) r && n[t] == r[t] || Me(e.style, t, n[t]);
362
+ if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || Pe(e.style, t);
363
+ if (n) for (t in n) r && n[t] == r[t] || Pe(e.style, t, n[t]);
360
364
  }
361
- } else if (t[0] == "o" && t[1] == "n") (e.__e ||= {})[t] = n, n && r || (o = ge[t] || (ge[t] = Pe(t)), (e.__a ||= {})[t] = he, a = t != (t = t.replace(me, "$1")), (t = t.slice(2))[0] < "a" && (t = t.toLowerCase()), n ? e.addEventListener(t, o, a) : e.removeEventListener(t, o, a));
365
+ } else if (t[0] == "o" && t[1] == "n") (e.__e ||= {})[t] = n, n && r || (o = ve[t] || (ve[t] = Ie(t)), (e.__a ||= {})[t] = _e, a = t != (t = t.replace(ge, "$1")), (t = t.slice(2))[0] < "a" && (t = t.toLowerCase()), n ? e.addEventListener(t, o, a) : e.removeEventListener(t, o, a));
362
366
  else {
363
367
  if (i == "http://www.w3.org/2000/svg") t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
364
368
  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 {
@@ -369,41 +373,41 @@ function Ne(e, t, n, r, i) {
369
373
  n == null || !1 === n && t[4] != "-" ? e.removeAttribute(t) : e.setAttribute(t, t == "popover" && n == 1 ? "" : n);
370
374
  }
371
375
  }
372
- function Pe(e) {
376
+ function Ie(e) {
373
377
  return function(t) {
374
378
  var n = this.__e;
375
379
  if (n) {
376
- if (n = n[e], t[P] == null) t[P] = he++;
377
- else if (t[P] < this.__a[e]) return;
378
- return n(M.event ? M.event(t) : t);
380
+ if (n = n[e], t[he] == null) t[he] = _e++;
381
+ else if (t[he] < this.__a[e]) return;
382
+ return n(j.event ? j.event(t) : t);
379
383
  }
380
384
  };
381
385
  }
382
- function Fe(e, t, n, r, i, a, o, s, c, l) {
386
+ function Le(e, t, n, r, i, a, o, s, c, l) {
383
387
  var u, d, f, p, m, h, g, _, v, y, b, x, S, C, w, T, E, D, O = t.type;
384
- if (t.constructor !== _e) return null;
385
- 128 & n.__u && (c = 32 & n.__u, u = n.__c.__z) && (t.__u |= c, d = a = [], u.nodeType == 8 ? s = Ie(u, a) : a.push(u), s = a[0] || s), (u = M.__b) && u(t);
388
+ if (t.constructor !== ye) return null;
389
+ 128 & n.__u && (c = 32 & n.__u, u = n.__c.__z) && (t.__u |= c, d = a = [], u.nodeType == 8 ? s = Re(u, a) : a.push(u), s = a[0] || s), (u = j.__b) && u(t);
386
390
  n: if (typeof O == "function") {
387
391
  f = o.length;
388
392
  try {
389
- if (_ = t.props, v = (u = O.prototype) && u.render, y = (u = O.contextType) && r[u.__c], b = u ? y ? y.props.value : u.__ : r, (p = n.__c) ? (t.__c = p, 2 & p.__g && (p.__g |= 1)) : (v ? t.__c = p = new O(_, b) : (t.__c = p = new we(_, b), p.constructor = O, p.render = He), y && y.sub(p), p.state || (p.state = {}), p.__n = r, p.__g |= 8, p.__h = [], p.__k = []), v && (p.__s || (p.__s = p.state), O.getDerivedStateFromProps && (p.__s == p.state && (p.__s = F({}, p.__s)), F(p.__s, O.getDerivedStateFromProps(_, p.__s)))), m = p.props, h = p.state, p.__v = t, n.__c) {
393
+ if (_ = t.props, v = (u = O.prototype) && u.render, y = (u = O.contextType) && r[u.__c], b = u ? y ? y.props.value : u.__ : r, (p = n.__c) ? (t.__c = p, 2 & p.__g && (p.__g |= 1)) : (v ? t.__c = p = new O(_, b) : (t.__c = p = new Ee(_, b), p.constructor = O, p.render = We), y && y.sub(p), p.state || (p.state = {}), p.__n = r, p.__g |= 8, p.__h = [], p.__k = []), v && (p.__s || (p.__s = p.state), O.getDerivedStateFromProps && (p.__s == p.state && (p.__s = N({}, p.__s)), N(p.__s, O.getDerivedStateFromProps(_, p.__s)))), m = p.props, h = p.state, p.__v = t, n.__c) {
390
394
  if (_ !== m && v && !O.getDerivedStateFromProps && p.componentWillReceiveProps && p.componentWillReceiveProps(_, b), t.__v == n.__v && !(8 & p.__g) || !(4 & p.__g) && p.shouldComponentUpdate && !1 === p.shouldComponentUpdate(_, p.__s, b)) {
391
395
  t.__v != n.__v && (p.props = _, p.state = p.__s, p.__g &= -9), t.__e = n.__e, t.__k = n.__k, t.__k.some(function(e) {
392
396
  e && (e.__ = t);
393
- }), ye.push.apply(p.__h, p.__k), p.__k = [], p.__h.length && o.push(p), s = R(n);
397
+ }), xe.push.apply(p.__h, p.__k), p.__k = [], p.__h.length && o.push(p), s = I(n);
394
398
  break n;
395
399
  }
396
400
  p.componentWillUpdate && p.componentWillUpdate(_, p.__s, b), v && p.componentDidUpdate && p.__h.push(function() {
397
401
  p.componentDidUpdate(m, h, g);
398
402
  });
399
403
  } else v && !O.getDerivedStateFromProps && p.componentWillMount && p.componentWillMount(), v && p.componentDidMount && p.__h.push(p.componentDidMount);
400
- if (p.context = b, p.props = _, p.__P = e, p.__g &= -5, x = M.__r, S = 0, v) p.state = p.__s, p.__g &= -9, x && x(t), u = p.render(p.props, p.state, p.context), ye.push.apply(p.__h, p.__k), p.__k = [];
404
+ if (p.context = b, p.props = _, p.__P = e, p.__g &= -5, x = j.__r, S = 0, v) p.state = p.__s, p.__g &= -9, x && x(t), u = p.render(p.props, p.state, p.context), xe.push.apply(p.__h, p.__k), p.__k = [];
401
405
  else do
402
406
  p.__g &= -9, x && x(t), u = p.render(p.props, p.state, p.context), p.state = p.__s;
403
407
  while (8 & p.__g && ++S < 25);
404
- p.state = p.__s, p.getChildContext && (r = F({}, r, p.getChildContext())), v && n.__c && p.getSnapshotBeforeUpdate && (g = p.getSnapshotBeforeUpdate(m, h)), C = u && u.type === L && u.key == null ? u.props.children : u, _.__P && (u = s, i = (e = _.__P).namespaceURI, c = a = null, n.props && n.props.__P != e && (n.__k.some(function(e) {
405
- e && Ve(e, e);
406
- }), n.__k = null), s = n.__k ? R(n, 0) : null), s = Oe(e, xe(C) ? C : [C], t, n, r, i, a, o, s, c, l), _.__P && (t.__e = null, s = u), t.__u &= -161, d && d.some(I), p.__h.length && o.push(p), 1 & p.__g && (p.__g &= -4);
408
+ p.state = p.__s, p.getChildContext && (r = N({}, r, p.getChildContext())), v && n.__c && p.getSnapshotBeforeUpdate && (g = p.getSnapshotBeforeUpdate(m, h)), C = u && u.type === F && u.key == null ? u.props.children : u, _.__P && (u = s, i = (e = _.__P).namespaceURI, c = a = null, n.props && n.props.__P != e && (n.__k.some(function(e) {
409
+ e && Ue(e, e);
410
+ }), n.__k = null), s = n.__k ? I(n, 0) : null), s = Ae(e, Ce(C) ? C : [C], t, n, r, i, a, o, s, c, l), _.__P && (t.__e = null, s = u), t.__u &= -161, d && d.some(P), p.__h.length && o.push(p), 1 & p.__g && (p.__g &= -4);
407
411
  } catch (e) {
408
412
  if (o.length = f, t.__v = null, c || a) {
409
413
  if (e.then) {
@@ -420,15 +424,15 @@ function Fe(e, t, n, r, i, a, o, s, c, l) {
420
424
  for (; s && s.nodeType == 8 && s.nextSibling;) s = s.nextSibling;
421
425
  T = s;
422
426
  }
423
- (u = Ie(T = t.__c.__z || (t.__c.__z = T))) ? (t.__e = T, s = u) : t.__e = s, s &&= s.nextSibling;
424
- } else a && a.some(I);
427
+ (u = Re(T = t.__c.__z || (t.__c.__z = T))) ? (t.__e = T, s = u) : t.__e = s, s &&= s.nextSibling;
428
+ } else a && a.some(P);
425
429
  } else t.__e = n.__e;
426
- t.__k ||= n.__k || [], e.then || Le(t), M.__e(e, t, n);
430
+ t.__k ||= n.__k || [], e.then || ze(t), j.__e(e, t, n);
427
431
  }
428
- } else s = t.__e = ze(n.__e, t, n, r, i, a, o, c, l, e);
429
- return (u = M.diffed) && u(t), s;
432
+ } else s = t.__e = Ve(n.__e, t, n, r, i, a, o, c, l, e);
433
+ return (u = j.diffed) && u(t), s;
430
434
  }
431
- function Ie(e, t) {
435
+ function Re(e, t) {
432
436
  if (e && e.nodeType == 8 && e.data.startsWith("$s")) for (var n = 1; e = e.nextSibling;) {
433
437
  if (e.nodeType == 8) {
434
438
  if (e.data.startsWith("$s")) n++;
@@ -437,23 +441,23 @@ function Ie(e, t) {
437
441
  t && t.push(e);
438
442
  }
439
443
  }
440
- function Le(e) {
441
- e && (e.__c && (e.__c.__g |= 4), e.__k && e.__k.some(Le));
444
+ function ze(e) {
445
+ e && (e.__c && (e.__c.__g |= 4), e.__k && e.__k.some(ze));
442
446
  }
443
- function Re(e, t, n) {
444
- for (var r = 0; r < n.length;) Be(n[r++], n[r++], n[r++]);
445
- M.__c && M.__c(t, e), e.some(function(t) {
447
+ function Be(e, t, n) {
448
+ for (var r = 0; r < n.length;) He(n[r++], n[r++], n[r++]);
449
+ j.__c && j.__c(t, e), e.some(function(t) {
446
450
  try {
447
451
  e = t.__h, t.__h = [], e.some(function(e) {
448
452
  e.call(t);
449
453
  });
450
454
  } catch (e) {
451
- M.__e(e, t.__v);
455
+ j.__e(e, t.__v);
452
456
  }
453
457
  });
454
458
  }
455
- function ze(e, t, n, r, i, a, o, s, c, l) {
456
- var u, d, f, p, m, h, g, _, v, y = n.props || ve, b = t.props, x = t.type;
459
+ function Ve(e, t, n, r, i, a, o, s, c, l) {
460
+ var u, d, f, p, m, h, g, _, v, y = n.props || be, b = t.props, x = t.type;
457
461
  if (x == "svg" ? i = "http://www.w3.org/2000/svg" : x == "math" ? i = "http://www.w3.org/1998/Math/MathML" : i ||= "http://www.w3.org/1999/xhtml", a) {
458
462
  for (u = 0; u < a.length; u++) if ((m = a[u]) && (x ? m.localName == x : m.nodeType == 3)) {
459
463
  e = m, a[u] = null;
@@ -462,44 +466,44 @@ function ze(e, t, n, r, i, a, o, s, c, l) {
462
466
  }
463
467
  if (!e) {
464
468
  if (_ = l.ownerDocument || document, !x) return _.createTextNode(b);
465
- e = _.createElementNS(i, x, b.is && b), s &&= (M.__m && M.__m(t, a), !1), a = null;
469
+ e = _.createElementNS(i, x, b.is && b), s &&= (j.__m && j.__m(t, a), !1), a = null;
466
470
  }
467
471
  if (x) {
468
- if (l = x == "template" && e.content || e, a = x == "textarea" && b.defaultValue != null ? null : a && Se.call(l.childNodes), !s && a) for (y = {}, u = 0; u < e.attributes.length; u++) y[(m = e.attributes[u]).name] = m.value;
469
- for (u in y) m = y[u], u == "dangerouslySetInnerHTML" ? f = m : u == "children" || u in b || u == "value" && "defaultValue" in b || u == "checked" && "defaultChecked" in b || Ne(e, u, null, m, i);
470
- for (u in v = 1 & n.__u, b) m = b[u], u == "children" ? p = m : u == "dangerouslySetInnerHTML" ? d = m : u == "value" ? h = m : u == "checked" ? g = m : s && typeof m != "function" || !(y[u] !== m || v && m != null) || Ne(e, u, m, y[u], i);
471
- d ? (s || f && (d.__html == f.__html || d.__html == e.innerHTML) || (e.innerHTML = d.__html), t.__k = []) : (f && (e.textContent = ""), (x == "foreignObject" || i == "http://www.w3.org/1998/Math/MathML" && be.test(x)) && (i = "http://www.w3.org/1999/xhtml"), Oe(l, xe(p) ? p : [p], t, n, r, i, a, o, a ? a[0] : n.__k && R(n, 0), s, c), a && a.some(I)), s && x != "textarea" || (u = "value", x == "progress" && h == null ? e.removeAttribute(u) : h == null || h === e[u] && (x != "progress" || h) || Ne(e, u, h, y[u], i), u = "checked", g != null && g != e[u] && Ne(e, u, g, y[u], i));
472
+ if (l = x == "template" && e.content || e, a = x == "textarea" && b.defaultValue != null ? null : a && we.call(l.childNodes), !s && a) for (y = {}, u = 0; u < e.attributes.length; u++) y[(m = e.attributes[u]).name] = m.value;
473
+ for (u in y) m = y[u], u == "dangerouslySetInnerHTML" ? f = m : u == "children" || u in b || u == "value" && "defaultValue" in b || u == "checked" && "defaultChecked" in b || Fe(e, u, null, m, i);
474
+ for (u in v = 1 & n.__u, b) m = b[u], u == "children" ? p = m : u == "dangerouslySetInnerHTML" ? d = m : u == "value" ? h = m : u == "checked" ? g = m : s && typeof m != "function" || !(y[u] !== m || v && m != null) || Fe(e, u, m, y[u], i);
475
+ d ? (s || f && (d.__html == f.__html || d.__html == e.innerHTML) || (e.innerHTML = d.__html), t.__k = []) : (f && (e.textContent = ""), (x == "foreignObject" || i == "http://www.w3.org/1998/Math/MathML" && Se.test(x)) && (i = "http://www.w3.org/1999/xhtml"), Ae(l, Ce(p) ? p : [p], t, n, r, i, a, o, a ? a[0] : n.__k && I(n, 0), s, c), a && a.some(P)), s && x != "textarea" || (u = "value", x == "progress" && h == null ? e.removeAttribute(u) : h == null || h === e[u] && (x != "progress" || h) || Fe(e, u, h, y[u], i), u = "checked", g != null && g != e[u] && Fe(e, u, g, y[u], i));
472
476
  } else y === b || s && e.data == b || (e.data = b);
473
477
  return e;
474
478
  }
475
- function Be(e, t, n, r) {
479
+ function He(e, t, n, r) {
476
480
  try {
477
481
  typeof e == "function" ? t ? t.__x = e(t) || 1 : (r &&= r.__c || r.__e) && (t = r.__x) && (r.__x = null, typeof t == "function" ? t() : e(null)) : e.current = t;
478
482
  } catch (e) {
479
- M.__e(e, n);
483
+ j.__e(e, n);
480
484
  }
481
485
  }
482
- function Ve(e, t, n) {
486
+ function Ue(e, t, n) {
483
487
  var r, i, a, o;
484
- if (M.unmount && M.unmount(e), !(r = e.ref) || r.current && r.current != e.__e || Be(r, null, t, e), r = e.__c) {
488
+ if (j.unmount && j.unmount(e), !(r = e.ref) || r.current && r.current != e.__e || He(r, null, t, e), r = e.__c) {
485
489
  if (r.componentWillUnmount) try {
486
490
  r.componentWillUnmount();
487
491
  } catch (e) {
488
- M.__e(e, t);
492
+ j.__e(e, t);
489
493
  }
490
494
  r.__P = r.__n = null;
491
495
  }
492
- if (r = e.__k) for (o = 0; o < r.length; o++) r[o] && Ve(r[o], t, typeof e.type != "function" || n && !e.props.__P);
493
- !n && (r = e.__c) && (r = r.__z) && (i = Ie(r, a = [])) && (r == e.__e && a.some(I), I(i), I(r)), (r = e.__e) && (n || I(r), r.__e && (r.__e = null)), e.__e = e.__c = e.__ = null;
496
+ if (r = e.__k) for (o = 0; o < r.length; o++) r[o] && Ue(r[o], t, typeof e.type != "function" || n && !e.props.__P);
497
+ !n && (r = e.__c) && (r = r.__z) && (i = Re(r, a = [])) && (r == e.__e && a.some(P), P(i), P(r)), (r = e.__e) && (n || P(r), r.__e && (r.__e = null)), e.__e = e.__c = e.__ = null;
494
498
  }
495
- function He(e, t, n) {
499
+ function We(e, t, n) {
496
500
  return this.constructor(e, n);
497
501
  }
498
- function Ue(e, t) {
502
+ function Ge(e, t) {
499
503
  var n, r, i, a;
500
- M.__ && M.__(e, t), t.nodeType == 9 && (t = t.documentElement), r = (n = e && 32 & e.__u) ? null : t.__k, t.__k = Ce(L, { children: [e] }), i = [], a = [], Fe(t, t.__k, r || ve, ve, t.namespaceURI, r ? null : t.firstChild ? Se.call(t.childNodes) : null, i, r ? r.__e : t.firstChild, n, a), Re(i, t.__k, a), t.__k.props.children = null;
504
+ j.__ && j.__(e, t), t.nodeType == 9 && (t = t.documentElement), r = (n = e && 32 & e.__u) ? null : t.__k, t.__k = Te(F, { children: [e] }), i = [], a = [], Le(t, t.__k, r || be, be, t.namespaceURI, r ? null : t.firstChild ? we.call(t.childNodes) : null, i, r ? r.__e : t.firstChild, n, a), Be(i, t.__k, a), t.__k.props.children = null;
501
505
  }
502
- M = { __e: function(e, t, n, r) {
506
+ j = { __e: function(e, t, n, r) {
503
507
  for (var i, a, o; t = t.__;) if ((i = t.__c) && !(1 & i.__g)) {
504
508
  i.__g |= 4;
505
509
  try {
@@ -508,42 +512,42 @@ M = { __e: function(e, t, n, r) {
508
512
  e = t;
509
513
  }
510
514
  }
511
- throw fe = 0, e;
512
- } }, ue = 0, we.prototype.setState = function(e, t) {
515
+ throw pe = 0, e;
516
+ } }, de = 0, Ee.prototype.setState = function(e, t) {
513
517
  var n = this.__s;
514
- n && n != this.state || (n = this.__s = F({}, this.state)), typeof e == "function" && (e = e(F({}, n), this.props)), e && (F(n, e), this.__v && (t && this.__k.push(t), Ee(this)));
515
- }, we.prototype.forceUpdate = function(e) {
516
- this.__v && (this.__g |= 4, e && this.__h.push(e), Ee(this));
517
- }, we.prototype.render = L, N = [], fe = 0, pe = function(e, t) {
518
+ n && n != this.state || (n = this.__s = N({}, this.state)), typeof e == "function" && (e = e(N({}, n), this.props)), e && (N(n, e), this.__v && (t && this.__k.push(t), Oe(this)));
519
+ }, Ee.prototype.forceUpdate = function(e) {
520
+ this.__v && (this.__g |= 4, e && this.__h.push(e), Oe(this));
521
+ }, Ee.prototype.render = F, M = [], pe = 0, me = function(e, t) {
518
522
  return e.__v.__b - t.__v.__b;
519
- }, P = Symbol(), me = /(PointerCapture)$|Capture$/i, he = 0, ge = {};
523
+ }, he = Symbol(), ge = /(PointerCapture)$|Capture$/i, _e = 0, ve = {};
520
524
  // node_modules/.pnpm/preact@11.1.1/node_modules/preact/hooks/dist/hooks.mjs
521
- var z, B, We, Ge, Ke = Object.is, qe = 0, Je = [], Ye = [], V = M, Xe = V.__b, Ze = V.__r, Qe = V.diffed, $e = V.__c, et = V.unmount, tt = V.__;
522
- function nt(e, t) {
523
- V.__h && V.__h(B, e, qe || t), qe = 0;
524
- var n = B.__H || (B.__H = {
525
+ var L, R, Ke, qe, Je = Object.is, Ye = 0, Xe = [], Ze = [], z = j, Qe = z.__b, $e = z.__r, et = z.diffed, tt = z.__c, nt = z.unmount, rt = z.__;
526
+ function it(e, t) {
527
+ z.__h && z.__h(R, e, Ye || t), Ye = 0;
528
+ var n = R.__H || (R.__H = {
525
529
  __: [],
526
530
  __h: []
527
531
  });
528
532
  return e >= n.__.length && n.__.push({}), n.__[e];
529
533
  }
530
- function rt(e) {
531
- return qe = 1, it(pt, e);
534
+ function at(e) {
535
+ return Ye = 1, ot(ht, e);
532
536
  }
533
- function it(e, t, n) {
534
- var r = nt(z++, 2);
535
- if (r.t = e, !r.__c && (r.__ = [n ? n(t) : pt(void 0, t), function(e) {
537
+ function ot(e, t, n) {
538
+ var r = it(L++, 2);
539
+ if (r.t = e, !r.__c && (r.__ = [n ? n(t) : ht(void 0, t), function(e) {
536
540
  var t = r.__N ? r.__N[0] : r.__[0], n = r.t(t, e);
537
- Ke(t, n) || (r.__N = [n, r.__[1]], r.__c.setState({}));
538
- }], r.__c = B, !B.__f)) {
539
- B.__f = !0;
540
- var i = B.shouldComponentUpdate;
541
- B.shouldComponentUpdate = function(e, t, n) {
541
+ Je(t, n) || (r.__N = [n, r.__[1]], r.__c.setState({}));
542
+ }], r.__c = R, !R.__f)) {
543
+ R.__f = !0;
544
+ var i = R.shouldComponentUpdate;
545
+ R.shouldComponentUpdate = function(e, t, n) {
542
546
  var r = this.__H;
543
547
  if (!r) return !0;
544
548
  var a = !1, o = this.props != e;
545
549
  if (r.__.some(function(e) {
546
- e.__N && (a = !0, Ke(e.__[0], e.__N[0]) || (o = !0));
550
+ e.__N && (a = !0, Je(e.__[0], e.__N[0]) || (o = !0));
547
551
  }), i) {
548
552
  var s = i.call(this, e, t, n);
549
553
  return a ? s || o : s;
@@ -553,71 +557,71 @@ function it(e, t, n) {
553
557
  }
554
558
  return r.__;
555
559
  }
556
- function at(e, t) {
557
- var n = nt(z++, 3);
558
- !V.__s && ft(n.__H, t) && (n.__P = !0, n.__ = e, n.u = t, B.__H.__h.push(n));
560
+ function st(e, t) {
561
+ var n = it(L++, 3);
562
+ !z.__s && mt(n.__H, t) && (n.__P = !0, n.__ = e, n.u = t, R.__H.__h.push(n));
559
563
  }
560
- function H(e, t) {
561
- var n = nt(z++, 4);
562
- !V.__s && ft(n.__H, t) && (n.__P = !1, n.__ = e, n.u = t, B.__h.push(n));
564
+ function B(e, t) {
565
+ var n = it(L++, 4);
566
+ !z.__s && mt(n.__H, t) && (n.__P = !1, n.__ = e, n.u = t, R.__h.push(n));
563
567
  }
564
- function U(e) {
565
- return qe = 5, ot(function() {
568
+ function V(e) {
569
+ return Ye = 5, ct(function() {
566
570
  return { current: e };
567
571
  }, []);
568
572
  }
569
- function ot(e, t) {
570
- var n = nt(z++, 7);
571
- return ft(n.__H, t) && (n.__ = e(), n.__H = t), n.__;
573
+ function ct(e, t) {
574
+ var n = it(L++, 7);
575
+ return mt(n.__H, t) && (n.__ = e(), n.__H = t), n.__;
572
576
  }
573
- function st() {
577
+ function lt() {
574
578
  var e;
575
579
  do {
576
- for (; e = Ye.shift();) try {
577
- W(e);
580
+ for (; e = Ze.shift();) try {
581
+ H(e);
578
582
  } catch (t) {
579
- V.__e(t, { __: (e = e.__P) && e.__v });
583
+ z.__e(t, { __: (e = e.__P) && e.__v });
580
584
  }
581
- for (; e = Je.shift();) {
585
+ for (; e = Xe.shift();) {
582
586
  var t = e.__H;
583
587
  if (e.__P && t) try {
584
- t.__h.some(W), t.__h.some(dt), t.__h = [];
588
+ t.__h.some(H), t.__h.some(pt), t.__h = [];
585
589
  } catch (n) {
586
- t.__h = [], V.__e(n, e.__v);
590
+ t.__h = [], z.__e(n, e.__v);
587
591
  }
588
592
  }
589
- } while (Ye.length);
590
- }
591
- V.__b = function(e) {
592
- B = null, Xe && Xe(e);
593
- }, V.__ = function(e, t) {
594
- e && t.__k && t.__k.__m && (e.__m = t.__k.__m), tt && tt(e, t);
595
- }, V.__r = function(e) {
596
- Ze && Ze(e), z = 0;
597
- var t = (B = e.__c).__H;
598
- t && (We == B ? B.__h = [] : (t.__h.some(W), t.__h.some(dt), z = 0), t.__h = [], t.__.some(function(e) {
593
+ } while (Ze.length);
594
+ }
595
+ z.__b = function(e) {
596
+ R = null, Qe && Qe(e);
597
+ }, z.__ = function(e, t) {
598
+ e && t.__k && t.__k.__m && (e.__m = t.__k.__m), rt && rt(e, t);
599
+ }, z.__r = function(e) {
600
+ $e && $e(e), L = 0;
601
+ var t = (R = e.__c).__H;
602
+ t && (Ke == R ? R.__h = [] : (t.__h.some(H), t.__h.some(pt), L = 0), t.__h = [], t.__.some(function(e) {
599
603
  e.__N && (e.__ = e.__N), e.u = e.__N = void 0;
600
- })), We = B;
601
- }, V.diffed = function(e) {
602
- Qe && Qe(e);
604
+ })), Ke = R;
605
+ }, z.diffed = function(e) {
606
+ et && et(e);
603
607
  var t = e.__c;
604
- t && t.__H && (t.__H.__h.length && ut(Je.push(t)), t.__H.__.some(function(e) {
608
+ t && t.__H && (t.__H.__h.length && ft(Xe.push(t)), t.__H.__.some(function(e) {
605
609
  e.u && (e.__H = e.u);
606
- })), We = B = null;
607
- }, V.__c = function(e, t) {
610
+ })), Ke = R = null;
611
+ }, z.__c = function(e, t) {
608
612
  t.some(function(e) {
609
613
  try {
610
- e.__h.some(W), e.__h = e.__h.filter(function(e) {
611
- return !e.__ || dt(e);
614
+ e.__h.some(H), e.__h = e.__h.filter(function(e) {
615
+ return !e.__ || pt(e);
612
616
  });
613
617
  } catch (t) {
614
618
  e.__h = [function() {
615
619
  throw t;
616
620
  }];
617
621
  }
618
- }), $e && $e(e, t);
619
- }, V.unmount = function(e) {
620
- et && et(e);
622
+ }), tt && tt(e, t);
623
+ }, z.unmount = function(e) {
624
+ nt && nt(e);
621
625
  var t, n, r = e.__c;
622
626
  r && r.__H && (r.__H.__.some(function(r) {
623
627
  try {
@@ -626,43 +630,43 @@ V.__b = function(e) {
626
630
  for (n = e.__; n && (!n.__c || !n.__c.__P);) n = n.__;
627
631
  n &&= n.__c;
628
632
  }
629
- r.__P = n, ut(Ye.push(r));
630
- } else W(r);
633
+ r.__P = n, ft(Ze.push(r));
634
+ } else H(r);
631
635
  } catch (e) {
632
636
  t = e;
633
637
  }
634
- }), r.__H = void 0, t && V.__e(t, r.__v));
638
+ }), r.__H = void 0, t && z.__e(t, r.__v));
635
639
  };
636
- var ct = typeof requestAnimationFrame == "function";
637
- function lt(e) {
640
+ var ut = typeof requestAnimationFrame == "function";
641
+ function dt(e) {
638
642
  var t, n = function() {
639
- clearTimeout(r), ct && cancelAnimationFrame(t), setTimeout(e);
643
+ clearTimeout(r), ut && cancelAnimationFrame(t), setTimeout(e);
640
644
  }, r = setTimeout(n, 35);
641
- ct && (t = requestAnimationFrame(n));
645
+ ut && (t = requestAnimationFrame(n));
642
646
  }
643
- function ut(e) {
644
- e != 1 && Ge == V.requestAnimationFrame || ((Ge = V.requestAnimationFrame) || lt)(st);
647
+ function ft(e) {
648
+ e != 1 && qe == z.requestAnimationFrame || ((qe = z.requestAnimationFrame) || dt)(lt);
645
649
  }
646
- function W(e) {
647
- var t = B, n = e.__c;
648
- typeof n == "function" && (e.__c = void 0, n()), B = t;
650
+ function H(e) {
651
+ var t = R, n = e.__c;
652
+ typeof n == "function" && (e.__c = void 0, n()), R = t;
649
653
  }
650
- function dt(e) {
651
- var t = B;
652
- e.__c = e.__(), B = t;
654
+ function pt(e) {
655
+ var t = R;
656
+ e.__c = e.__(), R = t;
653
657
  }
654
- function ft(e, t) {
658
+ function mt(e, t) {
655
659
  return !e || e.length != t.length || t.some(function(t, n) {
656
- return !Ke(t, e[n]);
660
+ return !Je(t, e[n]);
657
661
  });
658
662
  }
659
- function pt(e, t) {
663
+ function ht(e, t) {
660
664
  return typeof t == "function" ? t(e) : t;
661
665
  }
662
666
  // node_modules/.pnpm/preact@11.1.1/node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs
663
- var mt = Symbol.for("pv"), ht = 0;
667
+ var gt = Symbol.for("pv"), _t = 0;
664
668
  Array.isArray;
665
- function G(e, t, n, r, i, a) {
669
+ function U(e, t, n, r, i, a) {
666
670
  t ||= {};
667
671
  var o, s, c = t;
668
672
  if ("ref" in c && typeof e != "function") for (s in c = {}, t) s == "ref" ? o = t[s] : c[s] = t[s];
@@ -676,16 +680,16 @@ function G(e, t, n, r, i, a) {
676
680
  __b: 0,
677
681
  __e: null,
678
682
  __c: null,
679
- constructor: mt,
680
- __v: --ht,
683
+ constructor: gt,
684
+ __v: --_t,
681
685
  __i: -1,
682
686
  __u: 0
683
687
  };
684
- return (i || a) && (l.__source = i, l.__self = a), M.vnode && M.vnode(l), l;
688
+ return (i || a) && (l.__source = i, l.__self = a), j.vnode && j.vnode(l), l;
685
689
  }
686
690
  // src/components/icons.tsx
687
- function K({ name: e, size: t, children: n }) {
688
- return /* @__PURE__ */ G("svg", {
691
+ function W({ name: e, size: t, children: n }) {
692
+ return /* @__PURE__ */ U("svg", {
689
693
  "data-icon": e,
690
694
  "aria-hidden": "true",
691
695
  focusable: "false",
@@ -700,82 +704,82 @@ function K({ name: e, size: t, children: n }) {
700
704
  children: n
701
705
  });
702
706
  }
703
- function gt({ size: e = 26 }) {
704
- return /* @__PURE__ */ G(K, {
707
+ function vt({ size: e = 26 }) {
708
+ return /* @__PURE__ */ U(W, {
705
709
  name: "chat",
706
710
  size: e,
707
- children: [/* @__PURE__ */ G("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__ */ G("path", {
711
+ 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", {
708
712
  d: "M8.5 9.5h.01M12 9.5h.01M15.5 9.5h.01",
709
713
  "stroke-width": "2.5"
710
714
  })]
711
715
  });
712
716
  }
713
- function _t({ size: e = 26 }) {
714
- return /* @__PURE__ */ G(K, {
717
+ function yt({ size: e = 26 }) {
718
+ return /* @__PURE__ */ U(W, {
715
719
  name: "message",
716
720
  size: e,
717
- children: /* @__PURE__ */ G("path", { d: "M21 11.5a8.5 8.5 0 0 1-12.4 7.5L3 20.5l1.6-5.1A8.5 8.5 0 1 1 21 11.5z" })
721
+ children: /* @__PURE__ */ U("path", { d: "M21 11.5a8.5 8.5 0 0 1-12.4 7.5L3 20.5l1.6-5.1A8.5 8.5 0 1 1 21 11.5z" })
718
722
  });
719
723
  }
720
- function vt({ size: e = 26 }) {
721
- return /* @__PURE__ */ G(K, {
724
+ function bt({ size: e = 26 }) {
725
+ return /* @__PURE__ */ U(W, {
722
726
  name: "sparkle",
723
727
  size: e,
724
- children: [/* @__PURE__ */ G("path", { d: "M11 3l1.9 5.1L18 10l-5.1 1.9L11 17l-1.9-5.1L4 10l5.1-1.9z" }), /* @__PURE__ */ G("path", { d: "M19 15l.7 1.8 1.8.7-1.8.7L19 20l-.7-1.8-1.8-.7 1.8-.7z" })]
728
+ children: [/* @__PURE__ */ U("path", { d: "M11 3l1.9 5.1L18 10l-5.1 1.9L11 17l-1.9-5.1L4 10l5.1-1.9z" }), /* @__PURE__ */ U("path", { d: "M19 15l.7 1.8 1.8.7-1.8.7L19 20l-.7-1.8-1.8-.7 1.8-.7z" })]
725
729
  });
726
730
  }
727
- function yt({ size: e = 26 }) {
728
- return /* @__PURE__ */ G(K, {
731
+ function xt({ size: e = 26 }) {
732
+ return /* @__PURE__ */ U(W, {
729
733
  name: "chevron-down",
730
734
  size: e,
731
- children: /* @__PURE__ */ G("path", { d: "M6 9l6 6 6-6" })
735
+ children: /* @__PURE__ */ U("path", { d: "M6 9l6 6 6-6" })
732
736
  });
733
737
  }
734
- function bt({ size: e = 18 }) {
735
- return /* @__PURE__ */ G(K, {
738
+ function St({ size: e = 18 }) {
739
+ return /* @__PURE__ */ U(W, {
736
740
  name: "close",
737
741
  size: e,
738
- children: /* @__PURE__ */ G("path", { d: "M6 6l12 12M18 6L6 18" })
742
+ children: /* @__PURE__ */ U("path", { d: "M6 6l12 12M18 6L6 18" })
739
743
  });
740
744
  }
741
- var xt = "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";
742
- function St({ size: e = 16 }) {
743
- return /* @__PURE__ */ G(K, {
745
+ var Ct = "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";
746
+ function wt({ size: e = 16 }) {
747
+ return /* @__PURE__ */ U(W, {
744
748
  name: "thumb-up",
745
749
  size: e,
746
- children: /* @__PURE__ */ G("path", { d: xt })
750
+ children: /* @__PURE__ */ U("path", { d: Ct })
747
751
  });
748
752
  }
749
- function Ct({ size: e = 16 }) {
750
- return /* @__PURE__ */ G(K, {
753
+ function Tt({ size: e = 16 }) {
754
+ return /* @__PURE__ */ U(W, {
751
755
  name: "thumb-down",
752
756
  size: e,
753
- children: /* @__PURE__ */ G("path", {
754
- d: xt,
757
+ children: /* @__PURE__ */ U("path", {
758
+ d: Ct,
755
759
  transform: "matrix(1 0 0 -1 0 24)"
756
760
  })
757
761
  });
758
762
  }
759
763
  // src/components/Launcher.tsx
760
- var wt = {
761
- chat: gt,
762
- message: _t,
763
- sparkle: vt
764
- }, Tt = {
765
- "chevron-down": yt,
766
- close: bt
764
+ var Et = {
765
+ chat: vt,
766
+ message: yt,
767
+ sparkle: bt
768
+ }, Dt = {
769
+ "chevron-down": xt,
770
+ close: St
767
771
  };
768
- function Et({ isOpen: t, onClick: n, iconUrl: r, icon: i = "chat", openIconUrl: a, openIcon: o = "chevron-down", buttonRef: s, text: c = e }) {
769
- let [l, u] = rt("loading"), [d, f] = rt("loading"), p = r !== void 0 && l !== "failed", m = a !== void 0 && d !== "failed", h = p && !t && l === "loaded", g = m && t && d === "loaded", _ = wt[i] ?? gt, v = Tt[o] ?? yt;
770
- return /* @__PURE__ */ G("button", {
772
+ function Ot({ isOpen: t, onClick: n, iconUrl: r, icon: i = "chat", openIconUrl: a, openIcon: o = "chevron-down", buttonRef: s, text: c = e }) {
773
+ let [l, u] = at("loading"), [d, f] = at("loading"), p = r !== void 0 && l !== "failed", m = a !== void 0 && d !== "failed", h = p && !t && l === "loaded", g = m && t && d === "loaded", _ = Et[i] ?? vt, v = Dt[o] ?? xt;
774
+ return /* @__PURE__ */ U("button", {
771
775
  type: "button",
772
776
  class: "whoo-widget-launcher",
773
777
  onClick: n,
774
778
  "aria-label": t ? c.closeChat : c.openChat,
775
779
  ref: s,
776
780
  children: [
777
- t ? g ? null : /* @__PURE__ */ G(v, {}) : h ? null : /* @__PURE__ */ G(_, {}),
778
- p ? /* @__PURE__ */ G("img", {
781
+ t ? g ? null : /* @__PURE__ */ U(v, {}) : h ? null : /* @__PURE__ */ U(_, {}),
782
+ p ? /* @__PURE__ */ U("img", {
779
783
  class: "whoo-widget-launcher-icon-image",
780
784
  src: r,
781
785
  alt: "",
@@ -784,7 +788,7 @@ function Et({ isOpen: t, onClick: n, iconUrl: r, icon: i = "chat", openIconUrl:
784
788
  onLoad: () => u("loaded"),
785
789
  onError: () => u("failed")
786
790
  }) : null,
787
- m ? /* @__PURE__ */ G("img", {
791
+ m ? /* @__PURE__ */ U("img", {
788
792
  class: "whoo-widget-launcher-icon-image",
789
793
  src: a,
790
794
  alt: "",
@@ -797,7 +801,7 @@ function Et({ isOpen: t, onClick: n, iconUrl: r, icon: i = "chat", openIconUrl:
797
801
  });
798
802
  }
799
803
  // src/i18n/index.ts
800
- var Dt = {
804
+ var kt = {
801
805
  en: e,
802
806
  fr: {
803
807
  openChat: "Ouvrir le chat",
@@ -828,6 +832,10 @@ var Dt = {
828
832
  conversationCleared: "Nouvelle conversation démarrée. Les messages précédents ont été effacés.",
829
833
  genericError: "Une erreur s’est produite. Veuillez réessayer.",
830
834
  sessionExpired: "Cette session de chat a expiré. Rechargez la page pour continuer.",
835
+ tooManyMessages: "Vous envoyez des messages trop rapidement. Veuillez patienter un instant et réessayer.",
836
+ assistantUnavailable: "L’assistant n’est pas disponible pour le moment. Veuillez réessayer plus tard.",
837
+ waitForReply: "Veuillez attendre la fin de la réponse en cours.",
838
+ messageLimitReached: "Cette conversation a atteint sa limite de messages. Veuillez réessayer plus tard.",
831
839
  opensInNewTab: "(s’ouvre dans un nouvel onglet)",
832
840
  agreeToNotice: "J’accepte"
833
841
  },
@@ -860,6 +868,10 @@ var Dt = {
860
868
  conversationCleared: "Se inició una nueva conversación. Se borraron los mensajes anteriores.",
861
869
  genericError: "Algo salió mal. Inténtelo de nuevo.",
862
870
  sessionExpired: "Esta sesión de chat expiró. Vuelva a cargar la página para continuar.",
871
+ tooManyMessages: "Está enviando mensajes demasiado rápido. Espere un momento e inténtelo de nuevo.",
872
+ assistantUnavailable: "El asistente no está disponible en este momento. Inténtelo de nuevo más tarde.",
873
+ waitForReply: "Espere a que termine la respuesta actual.",
874
+ messageLimitReached: "Esta conversación alcanzó su límite de mensajes. Inténtelo de nuevo más tarde.",
863
875
  opensInNewTab: "(se abre en una pestaña nueva)",
864
876
  agreeToNotice: "Acepto"
865
877
  },
@@ -892,6 +904,10 @@ var Dt = {
892
904
  conversationCleared: "Nova conversa iniciada. As mensagens anteriores foram apagadas.",
893
905
  genericError: "Algo deu errado. Tente novamente.",
894
906
  sessionExpired: "Esta sessão de chat expirou. Recarregue a página para continuar.",
907
+ tooManyMessages: "Você está enviando mensagens rápido demais. Aguarde um momento e tente novamente.",
908
+ assistantUnavailable: "O assistente não está disponível no momento. Tente novamente mais tarde.",
909
+ waitForReply: "Aguarde até que a resposta atual termine.",
910
+ messageLimitReached: "Esta conversa atingiu o limite de mensagens. Tente novamente mais tarde.",
895
911
  opensInNewTab: "(abre em uma nova aba)",
896
912
  agreeToNotice: "Concordo"
897
913
  },
@@ -924,6 +940,10 @@ var Dt = {
924
940
  conversationCleared: "Neue Unterhaltung gestartet. Die bisherigen Nachrichten wurden gelöscht.",
925
941
  genericError: "Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut.",
926
942
  sessionExpired: "Diese Chat-Sitzung ist abgelaufen. Laden Sie die Seite neu, um fortzufahren.",
943
+ tooManyMessages: "Sie senden zu schnell Nachrichten. Bitte warten Sie einen Moment und versuchen Sie es erneut.",
944
+ assistantUnavailable: "Der Assistent ist gerade nicht verfügbar. Bitte versuchen Sie es später erneut.",
945
+ waitForReply: "Bitte warten Sie, bis die aktuelle Antwort fertig ist.",
946
+ messageLimitReached: "Diese Unterhaltung hat ihr Nachrichtenlimit erreicht. Bitte versuchen Sie es später erneut.",
927
947
  opensInNewTab: "(öffnet sich in neuem Tab)",
928
948
  agreeToNotice: "Ich stimme zu"
929
949
  },
@@ -956,6 +976,10 @@ var Dt = {
956
976
  conversationCleared: "Nuova conversazione avviata. I messaggi precedenti sono stati cancellati.",
957
977
  genericError: "Si è verificato un errore. Riprovi.",
958
978
  sessionExpired: "Questa sessione di chat è scaduta. Ricarichi la pagina per continuare.",
979
+ tooManyMessages: "Sta inviando messaggi troppo rapidamente. Attenda un momento e riprovi.",
980
+ assistantUnavailable: "L’assistente non è disponibile al momento. Riprovi più tardi.",
981
+ waitForReply: "Attenda che la risposta in corso sia completata.",
982
+ messageLimitReached: "Questa conversazione ha raggiunto il limite di messaggi. Riprovi più tardi.",
959
983
  opensInNewTab: "(si apre in una nuova scheda)",
960
984
  agreeToNotice: "Accetto"
961
985
  },
@@ -988,6 +1012,10 @@ var Dt = {
988
1012
  conversationCleared: "新しい会話を開始しました。以前のメッセージは消去されました。",
989
1013
  genericError: "エラーが発生しました。もう一度お試しください。",
990
1014
  sessionExpired: "このチャットセッションの有効期限が切れました。続けるにはページを再読み込みしてください。",
1015
+ tooManyMessages: "メッセージの送信が速すぎます。少し待ってからもう一度お試しください。",
1016
+ assistantUnavailable: "現在アシスタントはご利用いただけません。しばらくしてからもう一度お試しください。",
1017
+ waitForReply: "現在の返信が完了するまでお待ちください。",
1018
+ messageLimitReached: "この会話のメッセージ数が上限に達しました。しばらくしてからもう一度お試しください。",
991
1019
  opensInNewTab: "(新しいタブで開きます)",
992
1020
  agreeToNotice: "同意する"
993
1021
  },
@@ -1020,6 +1048,10 @@ var Dt = {
1020
1048
  conversationCleared: "已开始新对话。之前的消息已清除。",
1021
1049
  genericError: "出了点问题,请重试。",
1022
1050
  sessionExpired: "此聊天会话已过期。请刷新页面后继续。",
1051
+ tooManyMessages: "您发送消息的速度过快。请稍候再试。",
1052
+ assistantUnavailable: "助手暂时无法使用。请稍后再试。",
1053
+ waitForReply: "请等待当前回复完成。",
1054
+ messageLimitReached: "此对话的消息数量已达上限。请稍后再试。",
1023
1055
  opensInNewTab: "(将在新标签页中打开)",
1024
1056
  agreeToNotice: "我同意"
1025
1057
  },
@@ -1052,6 +1084,10 @@ var Dt = {
1052
1084
  conversationCleared: "Начат новый диалог. Предыдущие сообщения удалены.",
1053
1085
  genericError: "Что-то пошло не так. Попробуйте ещё раз.",
1054
1086
  sessionExpired: "Срок действия сеанса чата истёк. Перезагрузите страницу, чтобы продолжить.",
1087
+ tooManyMessages: "Вы отправляете сообщения слишком часто. Подождите немного и попробуйте ещё раз.",
1088
+ assistantUnavailable: "Ассистент сейчас недоступен. Попробуйте позже.",
1089
+ waitForReply: "Дождитесь окончания текущего ответа.",
1090
+ messageLimitReached: "В этом диалоге достигнут лимит сообщений. Попробуйте позже.",
1055
1091
  opensInNewTab: "(откроется в новой вкладке)",
1056
1092
  agreeToNotice: "Принимаю"
1057
1093
  },
@@ -1084,6 +1120,10 @@ var Dt = {
1084
1120
  conversationCleared: "नई बातचीत शुरू हुई। पिछले संदेश मिटा दिए गए।",
1085
1121
  genericError: "कुछ ग़लत हो गया। कृपया फिर से कोशिश करें।",
1086
1122
  sessionExpired: "यह चैट सत्र समाप्त हो गया है। जारी रखने के लिए पेज को फिर से लोड करें।",
1123
+ tooManyMessages: "संदेश बहुत जल्दी-जल्दी भेजे जा रहे हैं। कृपया थोड़ी देर रुककर फिर से कोशिश करें।",
1124
+ assistantUnavailable: "सहायक अभी उपलब्ध नहीं है। कृपया बाद में फिर से कोशिश करें।",
1125
+ waitForReply: "कृपया मौजूदा जवाब पूरा होने तक प्रतीक्षा करें।",
1126
+ messageLimitReached: "इस बातचीत में संदेशों की सीमा पूरी हो गई है। कृपया बाद में फिर से कोशिश करें।",
1087
1127
  opensInNewTab: "(नए टैब में खुलता है)",
1088
1128
  agreeToNotice: "मैं सहमत हूँ"
1089
1129
  },
@@ -1116,48 +1156,52 @@ var Dt = {
1116
1156
  conversationCleared: "بدأت محادثة جديدة. تم مسح الرسائل السابقة.",
1117
1157
  genericError: "حدث خطأ ما. يُرجى المحاولة مرة أخرى.",
1118
1158
  sessionExpired: "انتهت صلاحية جلسة الدردشة هذه. يُرجى إعادة تحميل الصفحة للمتابعة.",
1159
+ tooManyMessages: "يتم إرسال الرسائل بسرعة كبيرة. يُرجى الانتظار قليلاً ثم المحاولة مرة أخرى.",
1160
+ assistantUnavailable: "المساعد غير متاح حاليًا. يُرجى المحاولة لاحقًا.",
1161
+ waitForReply: "يُرجى الانتظار حتى يكتمل الرد الحالي.",
1162
+ messageLimitReached: "وصلت هذه المحادثة إلى الحد الأقصى للرسائل. يُرجى المحاولة لاحقًا.",
1119
1163
  opensInNewTab: "(يُفتح في علامة تبويب جديدة)",
1120
1164
  agreeToNotice: "أوافق"
1121
1165
  }
1122
- }, Ot = Object.freeze(Object.keys(Dt)), kt = {
1166
+ }, At = Object.freeze(Object.keys(kt)), jt = {
1123
1167
  pt: "pt-BR",
1124
1168
  es: "es-419",
1125
1169
  zh: "zh-Hans"
1126
- }, At = /* @__PURE__ */ new Set(["ar"]), jt = /^[a-z]{2,8}([-_][a-z0-9]{1,8})*$/i, Mt = /^zh[-_](hant|tw|hk|mo)(?=$|[-_])/i;
1127
- function Nt(e) {
1128
- return Dt[e];
1170
+ }, Mt = /* @__PURE__ */ new Set(["ar"]), Nt = /^[a-z]{2,8}([-_][a-z0-9]{1,8})*$/i, Pt = /^zh[-_](hant|tw|hk|mo)(?=$|[-_])/i;
1171
+ function Ft(e) {
1172
+ return kt[e];
1129
1173
  }
1130
- function Pt(e) {
1174
+ function It(e) {
1131
1175
  let t = e.trim();
1132
- if (!jt.test(t) || Mt.test(t)) return null;
1176
+ if (!Nt.test(t) || Pt.test(t)) return null;
1133
1177
  let n = t.split(/[-_]/)[0].toLowerCase();
1134
- return Object.hasOwn(Dt, n) ? n : null;
1178
+ return Object.hasOwn(kt, n) ? n : null;
1135
1179
  }
1136
- function Ft(e, t) {
1180
+ function Lt(e, t) {
1137
1181
  let n = null;
1138
- return e != null && e !== "" && (n = typeof e == "string" ? Pt(e) : null, n || console.warn(`whoo-aiden-widget: ignoring \`language\` ${It(e)} -- expected one of ${Ot.join(", ")} (or a regional tag like pt-BR). Using the page's language instead.`)), n ??= typeof t == "string" ? Pt(t) : null, n ??= "en", {
1182
+ return e != null && e !== "" && (n = typeof e == "string" ? It(e) : null, n || console.warn(`whoo-aiden-widget: ignoring \`language\` ${Rt(e)} -- expected one of ${At.join(", ")} (or a regional tag like pt-BR). Using the page's language instead.`)), n ??= typeof t == "string" ? It(t) : null, n ??= "en", {
1139
1183
  language: n,
1140
- tag: kt[n] ?? n,
1141
- dir: At.has(n) ? "rtl" : "ltr"
1184
+ tag: jt[n] ?? n,
1185
+ dir: Mt.has(n) ? "rtl" : "ltr"
1142
1186
  };
1143
1187
  }
1144
- function It(e) {
1188
+ function Rt(e) {
1145
1189
  return typeof e == "string" ? JSON.stringify(e) : `(a ${typeof e})`;
1146
1190
  }
1147
- function Lt(e) {
1191
+ function zt(e) {
1148
1192
  if (typeof e != "string") return null;
1149
1193
  let t = e.trim().replace(/_/g, "-");
1150
- return jt.test(t) ? t : null;
1194
+ return Nt.test(t) ? t : null;
1151
1195
  }
1152
- function Rt(e, t, n) {
1196
+ function Bt(e, t, n) {
1153
1197
  if (e != null && e !== "") {
1154
- let t = Lt(e);
1198
+ let t = zt(e);
1155
1199
  if (t) return t;
1156
- console.warn(`whoo-aiden-widget: ignoring \`contentLanguage\` ${It(e)} -- expected a language tag such as 'nl' or 'pt-BR'. Using the page's language instead.`);
1200
+ console.warn(`whoo-aiden-widget: ignoring \`contentLanguage\` ${Rt(e)} -- expected a language tag such as 'nl' or 'pt-BR'. Using the page's language instead.`);
1157
1201
  }
1158
- return Lt(t) ?? Lt(n) ?? "";
1202
+ return zt(t) ?? zt(n) ?? "";
1159
1203
  }
1160
- function zt(e) {
1204
+ function Vt(e) {
1161
1205
  let t = e.indexOf("{name}");
1162
1206
  return t === -1 ? {
1163
1207
  before: e,
@@ -1169,23 +1213,23 @@ function zt(e) {
1169
1213
  hasName: !0
1170
1214
  };
1171
1215
  }
1172
- function Bt(e, t) {
1216
+ function Ht(e, t) {
1173
1217
  return e.split("{name}").join(t.name);
1174
1218
  }
1175
1219
  // src/viewport.ts
1176
- var Vt = "(max-width: 400px), (max-height: 420px)", Ht = "data-fit-visible", Ut = 40;
1177
- function Wt(e) {
1220
+ var Ut = "(max-width: 400px), (max-height: 420px)", Wt = "data-fit-visible", Gt = 40;
1221
+ function Kt(e) {
1178
1222
  let t = typeof window < "u" ? window.visualViewport : null;
1179
1223
  if (!t) return () => {};
1180
1224
  let n = () => {
1181
- e.removeAttribute(Ht), e.style.removeProperty("--whoo-widget-visible-top"), e.style.removeProperty("--whoo-widget-visible-height");
1225
+ e.removeAttribute(Wt), e.style.removeProperty("--whoo-widget-visible-top"), e.style.removeProperty("--whoo-widget-visible-height");
1182
1226
  }, r = () => {
1183
1227
  let r = document.documentElement.clientHeight, i = Math.abs(t.scale - 1) > .01, a = r - t.height;
1184
- if (i || r === 0 || a < Ut) {
1228
+ if (i || r === 0 || a < Gt) {
1185
1229
  n();
1186
1230
  return;
1187
1231
  }
1188
- e.setAttribute(Ht, ""), e.style.setProperty("--whoo-widget-visible-top", `${Math.max(0, t.offsetTop)}px`), e.style.setProperty("--whoo-widget-visible-height", `${t.height}px`);
1232
+ e.setAttribute(Wt, ""), e.style.setProperty("--whoo-widget-visible-top", `${Math.max(0, t.offsetTop)}px`), e.style.setProperty("--whoo-widget-visible-height", `${t.height}px`);
1189
1233
  let o = e.getRootNode().activeElement;
1190
1234
  o && e.contains(o) && typeof o.scrollIntoView == "function" && o.scrollIntoView({ block: "nearest" });
1191
1235
  };
@@ -1193,51 +1237,51 @@ function Wt(e) {
1193
1237
  t.removeEventListener("resize", r), t.removeEventListener("scroll", r), n();
1194
1238
  };
1195
1239
  }
1196
- function Gt(e, t) {
1240
+ function qt(e, t) {
1197
1241
  return typeof e.addEventListener == "function" ? (e.addEventListener("change", t), () => e.removeEventListener("change", t)) : typeof e.addListener == "function" ? (e.addListener(t), () => e.removeListener(t)) : () => {};
1198
1242
  }
1199
- var Kt = 0, qt = "";
1200
- function Jt() {
1201
- Kt++ === 0 && (qt = document.documentElement.style.overflow, document.documentElement.style.overflow = "hidden");
1243
+ var Jt = 0, Yt = "";
1244
+ function Xt() {
1245
+ Jt++ === 0 && (Yt = document.documentElement.style.overflow, document.documentElement.style.overflow = "hidden");
1202
1246
  }
1203
- function Yt() {
1204
- --Kt === 0 && (document.documentElement.style.overflow = qt);
1247
+ function Zt() {
1248
+ --Jt === 0 && (document.documentElement.style.overflow = Yt);
1205
1249
  }
1206
- function Xt() {
1250
+ function Qt() {
1207
1251
  if (typeof window > "u" || typeof window.matchMedia != "function") return () => {};
1208
- let e = window.matchMedia(Vt), t = !1, n = () => {
1209
- e.matches && !t ? (t = !0, Jt()) : !e.matches && t && (t = !1, Yt());
1252
+ let e = window.matchMedia(Ut), t = !1, n = () => {
1253
+ e.matches && !t ? (t = !0, Xt()) : !e.matches && t && (t = !1, Zt());
1210
1254
  };
1211
1255
  n();
1212
- let r = Gt(e, n);
1256
+ let r = qt(e, n);
1213
1257
  return () => {
1214
- r(), t && (t = !1, Yt());
1258
+ r(), t && (t = !1, Zt());
1215
1259
  };
1216
1260
  }
1217
- function Zt(e) {
1261
+ function $t(e) {
1218
1262
  if (typeof window > "u" || typeof window.matchMedia != "function" || typeof e.showModal != "function") return () => {};
1219
- let t = window.matchMedia(Vt), n = !1, r = () => {
1263
+ let t = window.matchMedia(Ut), n = !1, r = () => {
1220
1264
  if (t.matches === n || !e.isConnected) return;
1221
1265
  n = t.matches;
1222
1266
  let r = e.getRootNode().activeElement;
1223
1267
  e.close(), n ? e.showModal() : e.show(), r && e.contains(r) && r.focus({ preventScroll: !0 });
1224
1268
  };
1225
- return r(), Gt(t, r);
1269
+ return r(), qt(t, r);
1226
1270
  }
1227
1271
  // src/components/Composer.tsx
1228
- function Qt(e) {
1272
+ function en(e) {
1229
1273
  return e.isComposing || e.keyCode === 229;
1230
1274
  }
1231
- function $t({ value: t, onChange: n, onSend: r, disabled: i, inputRef: a, text: o = e, contentLanguage: s }) {
1232
- return /* @__PURE__ */ G("div", {
1275
+ function tn({ value: t, onChange: n, onSend: r, disabled: i, inputRef: a, text: o = e, contentLanguage: s }) {
1276
+ return /* @__PURE__ */ U("div", {
1233
1277
  class: "whoo-widget-composer",
1234
1278
  children: [
1235
- /* @__PURE__ */ G("label", {
1279
+ /* @__PURE__ */ U("label", {
1236
1280
  class: "whoo-widget-sr-only",
1237
1281
  for: "whoo-widget-composer-input",
1238
1282
  children: o.message
1239
1283
  }),
1240
- /* @__PURE__ */ G("input", {
1284
+ /* @__PURE__ */ U("input", {
1241
1285
  id: "whoo-widget-composer-input",
1242
1286
  class: "whoo-widget-composer-input",
1243
1287
  lang: s,
@@ -1249,10 +1293,10 @@ function $t({ value: t, onChange: n, onSend: r, disabled: i, inputRef: a, text:
1249
1293
  ref: a,
1250
1294
  onInput: (e) => n(e.target.value),
1251
1295
  onKeyDown: (e) => {
1252
- e.key === "Enter" && !Qt(e) && r();
1296
+ e.key === "Enter" && !en(e) && r();
1253
1297
  }
1254
1298
  }),
1255
- /* @__PURE__ */ G("button", {
1299
+ /* @__PURE__ */ U("button", {
1256
1300
  type: "button",
1257
1301
  class: "whoo-widget-composer-send",
1258
1302
  "aria-disabled": i,
@@ -1265,16 +1309,16 @@ function $t({ value: t, onChange: n, onSend: r, disabled: i, inputRef: a, text:
1265
1309
  });
1266
1310
  }
1267
1311
  // src/components/ErrorBanner.tsx
1268
- function en({ message: e }) {
1269
- return /* @__PURE__ */ G("div", {
1312
+ function nn({ message: e }) {
1313
+ return /* @__PURE__ */ U("div", {
1270
1314
  class: "whoo-widget-error-banner",
1271
1315
  role: "alert",
1272
1316
  children: e
1273
1317
  });
1274
1318
  }
1275
1319
  // src/markdown/tokenizer.ts
1276
- var tn = /\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/y, nn = /\*\*([^*\s](?:[^*]*[^*\s])?)\*\*/y, rn = /(?<![A-Za-z0-9_])_([^_\s](?:[^_]*[^_\s])?)_(?![A-Za-z0-9_])/y, an = /\*([^*\s](?:[^*]*[^*\s])?)\*/y, on = /[ \t]*[*+-][ \t]+/y, sn = /https?:\/\/\S+/y, cn = /[.,;:!?)\]}>]+$/;
1277
- function ln(e) {
1320
+ var rn = /\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/y, an = /\*\*([^*\s](?:[^*]*[^*\s])?)\*\*/y, on = /(?<![A-Za-z0-9_])_([^_\s](?:[^_]*[^_\s])?)_(?![A-Za-z0-9_])/y, sn = /\*([^*\s](?:[^*]*[^*\s])?)\*/y, cn = /[ \t]*[*+-][ \t]+/y, ln = /https?:\/\/\S+/y, un = /[.,;:!?)\]}>]+$/;
1321
+ function dn(e) {
1278
1322
  let t = [], n = 0, r = 0, i = (n) => {
1279
1323
  n > r && t.push({
1280
1324
  type: "text",
@@ -1284,13 +1328,13 @@ function ln(e) {
1284
1328
  });
1285
1329
  };
1286
1330
  for (; n < e.length;) {
1287
- if ((n === 0 || e[n - 1] === "\n") && (on.lastIndex = n, on.exec(e))) {
1331
+ if ((n === 0 || e[n - 1] === "\n") && (cn.lastIndex = n, cn.exec(e))) {
1288
1332
  i(n), t.push({
1289
1333
  type: "text",
1290
1334
  value: "• ",
1291
1335
  start: n,
1292
- end: on.lastIndex
1293
- }), n = on.lastIndex, r = n;
1336
+ end: cn.lastIndex
1337
+ }), n = cn.lastIndex, r = n;
1294
1338
  continue;
1295
1339
  }
1296
1340
  if (e[n] === "!" && n + 1 < e.length && e[n + 1] === "[") {
@@ -1303,56 +1347,56 @@ function ln(e) {
1303
1347
  }
1304
1348
  }
1305
1349
  if (e[n - 1] !== "!") {
1306
- tn.lastIndex = n;
1307
- let a = tn.exec(e);
1350
+ rn.lastIndex = n;
1351
+ let a = rn.exec(e);
1308
1352
  if (a) {
1309
1353
  i(n), t.push({
1310
1354
  type: "link",
1311
1355
  text: a[1],
1312
1356
  url: a[2],
1313
1357
  start: n,
1314
- end: tn.lastIndex
1315
- }), n = tn.lastIndex, r = n;
1358
+ end: rn.lastIndex
1359
+ }), n = rn.lastIndex, r = n;
1316
1360
  continue;
1317
1361
  }
1318
1362
  }
1319
- nn.lastIndex = n;
1320
- let a = nn.exec(e);
1363
+ an.lastIndex = n;
1364
+ let a = an.exec(e);
1321
1365
  if (a) {
1322
1366
  i(n), t.push({
1323
1367
  type: "bold",
1324
1368
  value: a[1],
1325
1369
  start: n,
1326
- end: nn.lastIndex
1327
- }), n = nn.lastIndex, r = n;
1370
+ end: an.lastIndex
1371
+ }), n = an.lastIndex, r = n;
1328
1372
  continue;
1329
1373
  }
1330
- rn.lastIndex = n;
1331
- let o = rn.exec(e);
1374
+ on.lastIndex = n;
1375
+ let o = on.exec(e);
1332
1376
  if (o) {
1333
1377
  i(n), t.push({
1334
1378
  type: "italic",
1335
1379
  value: o[1],
1336
1380
  start: n,
1337
- end: rn.lastIndex
1338
- }), n = rn.lastIndex, r = n;
1381
+ end: on.lastIndex
1382
+ }), n = on.lastIndex, r = n;
1339
1383
  continue;
1340
1384
  }
1341
- an.lastIndex = n;
1342
- let s = an.exec(e);
1385
+ sn.lastIndex = n;
1386
+ let s = sn.exec(e);
1343
1387
  if (s) {
1344
1388
  i(n), t.push({
1345
1389
  type: "italic",
1346
1390
  value: s[1],
1347
1391
  start: n,
1348
- end: an.lastIndex
1349
- }), n = an.lastIndex, r = n;
1392
+ end: sn.lastIndex
1393
+ }), n = sn.lastIndex, r = n;
1350
1394
  continue;
1351
1395
  }
1352
- sn.lastIndex = n;
1353
- let c = sn.exec(e);
1396
+ ln.lastIndex = n;
1397
+ let c = ln.exec(e);
1354
1398
  if (c) {
1355
- let e = c[0].match(cn), a = e ? c[0].slice(0, c[0].length - e[0].length) : c[0];
1399
+ let e = c[0].match(un), a = e ? c[0].slice(0, c[0].length - e[0].length) : c[0];
1356
1400
  if (a.length > 0) {
1357
1401
  i(n), t.push({
1358
1402
  type: "link",
@@ -1369,12 +1413,12 @@ function ln(e) {
1369
1413
  return i(e.length), t;
1370
1414
  }
1371
1415
  // src/markdown/render.tsx
1372
- var un = /^[ \t]*[*+-][ \t]+(.*)$/, dn = /[\p{Script=Arabic}\p{Script=Hebrew}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}\p{Script=Adlam}\p{Script=Samaritan}\p{Script=Mandaic}\p{Script=Hanifi_Rohingya}\p{Script=Mende_Kikakui}]/u;
1373
- function fn(e) {
1416
+ var fn = /^[ \t]*[*+-][ \t]+(.*)$/, pn = /[\p{Script=Arabic}\p{Script=Hebrew}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}\p{Script=Adlam}\p{Script=Samaritan}\p{Script=Mandaic}\p{Script=Hanifi_Rohingya}\p{Script=Mende_Kikakui}]/u;
1417
+ function mn(e) {
1374
1418
  let t = e.match(/\p{L}/u)?.[0];
1375
- if (t) return dn.test(t) ? "rtl" : "ltr";
1419
+ if (t) return pn.test(t) ? "rtl" : "ltr";
1376
1420
  }
1377
- function pn(e) {
1421
+ function hn(e) {
1378
1422
  let t = [], n = [], r = [], i = () => {
1379
1423
  n.length > 0 && t.push({
1380
1424
  type: "text",
@@ -1387,7 +1431,7 @@ function pn(e) {
1387
1431
  }), r = [];
1388
1432
  };
1389
1433
  for (let t of e.split("\n")) {
1390
- let e = t.match(un);
1434
+ let e = t.match(fn);
1391
1435
  e ? (i(), r.push(e[1])) : (a(), n.push(t));
1392
1436
  }
1393
1437
  return i(), a(), t.some((e) => e.type === "list") ? t.flatMap((e, n) => {
@@ -1399,16 +1443,16 @@ function pn(e) {
1399
1443
  }];
1400
1444
  }) : null;
1401
1445
  }
1402
- function q(e, t = {}) {
1403
- return ln(e).map((e, n) => {
1446
+ function G(e, t = {}) {
1447
+ return dn(e).map((e, n) => {
1404
1448
  switch (e.type) {
1405
- case "bold": return /* @__PURE__ */ G("strong", { children: q(e.value, t) }, n);
1406
- case "italic": return /* @__PURE__ */ G("em", { children: q(e.value, t) }, n);
1407
- case "link": return /* @__PURE__ */ G("a", {
1449
+ case "bold": return /* @__PURE__ */ U("strong", { children: G(e.value, t) }, n);
1450
+ case "italic": return /* @__PURE__ */ U("em", { children: G(e.value, t) }, n);
1451
+ case "link": return /* @__PURE__ */ U("a", {
1408
1452
  href: e.url,
1409
1453
  target: "_blank",
1410
1454
  rel: "noopener noreferrer",
1411
- children: [e.text, /* @__PURE__ */ G("span", {
1455
+ children: [e.text, /* @__PURE__ */ U("span", {
1412
1456
  class: "whoo-widget-sr-only",
1413
1457
  lang: t.linkCueLang,
1414
1458
  children: [" ", t.linkCue ?? "(opens in new tab)"]
@@ -1418,19 +1462,19 @@ function q(e, t = {}) {
1418
1462
  }
1419
1463
  });
1420
1464
  }
1421
- function mn(e, t = {}) {
1422
- let n = e.replace(/\r\n?/g, "\n"), r = pn(n);
1423
- return r ? r.map((e, n) => e.type === "list" ? /* @__PURE__ */ G("ul", {
1465
+ function gn(e, t = {}) {
1466
+ let n = e.replace(/\r\n?/g, "\n"), r = hn(n);
1467
+ return r ? r.map((e, n) => e.type === "list" ? /* @__PURE__ */ U("ul", {
1424
1468
  class: "whoo-widget-list",
1425
- dir: fn(e.items.find((e) => fn(e)) ?? ""),
1426
- children: e.items.map((e, n) => /* @__PURE__ */ G("li", {
1427
- dir: fn(e),
1428
- children: q(e, t)
1469
+ dir: mn(e.items.find((e) => mn(e)) ?? ""),
1470
+ children: e.items.map((e, n) => /* @__PURE__ */ U("li", {
1471
+ dir: mn(e),
1472
+ children: G(e, t)
1429
1473
  }, n))
1430
- }, n) : /* @__PURE__ */ G("span", { children: q(e.text, t) }, n)) : q(n, t);
1474
+ }, n) : /* @__PURE__ */ U("span", { children: G(e.text, t) }, n)) : G(n, t);
1431
1475
  }
1432
1476
  // src/components/MessageFeedback.tsx
1433
- function hn(e) {
1477
+ function _n(e) {
1434
1478
  return [
1435
1479
  {
1436
1480
  value: "",
@@ -1454,9 +1498,9 @@ function hn(e) {
1454
1498
  }
1455
1499
  ];
1456
1500
  }
1457
- function gn({ state: t, containerRef: n, onThumbsUp: r, onThumbsDown: i, onDraftChange: a, onSubmitDetailed: o, onCancel: s, text: c = e, contentLanguage: l }) {
1458
- let u = t.correction ?? "", d = t.category ?? "", f = U(t.status), p = U(null), m = U(null);
1459
- if (H(() => {
1501
+ function vn({ state: t, containerRef: n, onThumbsUp: r, onThumbsDown: i, onDraftChange: a, onSubmitDetailed: o, onCancel: s, text: c = e, contentLanguage: l }) {
1502
+ let u = t.correction ?? "", d = t.category ?? "", f = V(t.status), p = V(null), m = V(null);
1503
+ if (B(() => {
1460
1504
  let e = f.current;
1461
1505
  if (f.current = t.status, e === t.status) return;
1462
1506
  if (t.status === "expanded") {
@@ -1471,13 +1515,13 @@ function gn({ state: t, containerRef: n, onThumbsUp: r, onThumbsDown: i, onDraft
1471
1515
  if (!r) return;
1472
1516
  let i = r.getRootNode(), a = r.ownerDocument, o = i.activeElement;
1473
1517
  (o === null ? a.activeElement === null || a.activeElement === a.body : o === a.body) && r.focus();
1474
- }, [t.status, n]), t.status === "expanded") return /* @__PURE__ */ G("div", {
1518
+ }, [t.status, n]), t.status === "expanded") return /* @__PURE__ */ U("div", {
1475
1519
  class: "whoo-widget-feedback-form",
1476
1520
  children: [
1477
- /* @__PURE__ */ G("label", { children: [/* @__PURE__ */ G("span", {
1521
+ /* @__PURE__ */ U("label", { children: [/* @__PURE__ */ U("span", {
1478
1522
  class: "whoo-widget-sr-only",
1479
1523
  children: c.additionalFeedback
1480
- }), /* @__PURE__ */ G("textarea", {
1524
+ }), /* @__PURE__ */ U("textarea", {
1481
1525
  ref: p,
1482
1526
  class: "whoo-widget-feedback-textarea",
1483
1527
  lang: l,
@@ -1485,24 +1529,24 @@ function gn({ state: t, containerRef: n, onThumbsUp: r, onThumbsDown: i, onDraft
1485
1529
  onInput: (e) => a(e.target.value, d),
1486
1530
  placeholder: c.feedbackPlaceholder
1487
1531
  })] }),
1488
- /* @__PURE__ */ G("select", {
1532
+ /* @__PURE__ */ U("select", {
1489
1533
  class: "whoo-widget-feedback-select",
1490
1534
  "aria-label": c.feedbackCategory,
1491
1535
  value: d,
1492
1536
  onChange: (e) => a(u, e.target.value),
1493
- children: hn(c).map((e) => /* @__PURE__ */ G("option", {
1537
+ children: _n(c).map((e) => /* @__PURE__ */ U("option", {
1494
1538
  value: e.value,
1495
1539
  children: e.label
1496
1540
  }, e.value))
1497
1541
  }),
1498
- /* @__PURE__ */ G("div", {
1542
+ /* @__PURE__ */ U("div", {
1499
1543
  class: "whoo-widget-feedback-form-buttons",
1500
- children: [/* @__PURE__ */ G("button", {
1544
+ children: [/* @__PURE__ */ U("button", {
1501
1545
  type: "button",
1502
1546
  class: "whoo-widget-feedback-submit",
1503
1547
  onClick: () => o(u, d),
1504
1548
  children: c.submit
1505
- }), /* @__PURE__ */ G("button", {
1549
+ }), /* @__PURE__ */ U("button", {
1506
1550
  type: "button",
1507
1551
  class: "whoo-widget-feedback-cancel",
1508
1552
  onClick: s,
@@ -1512,19 +1556,19 @@ function gn({ state: t, containerRef: n, onThumbsUp: r, onThumbsDown: i, onDraft
1512
1556
  ]
1513
1557
  });
1514
1558
  let h = t.status === "submitting", g = t.status === "submitted";
1515
- return /* @__PURE__ */ G("div", {
1559
+ return /* @__PURE__ */ U("div", {
1516
1560
  class: "whoo-widget-feedback",
1517
- children: [g ? null : /* @__PURE__ */ G("div", {
1561
+ children: [g ? null : /* @__PURE__ */ U("div", {
1518
1562
  class: "whoo-widget-feedback-buttons",
1519
- children: [/* @__PURE__ */ G("button", {
1563
+ children: [/* @__PURE__ */ U("button", {
1520
1564
  type: "button",
1521
1565
  "aria-label": c.goodResponse,
1522
1566
  "aria-disabled": h,
1523
1567
  onClick: () => {
1524
1568
  h || r();
1525
1569
  },
1526
- children: /* @__PURE__ */ G(St, {})
1527
- }), /* @__PURE__ */ G("button", {
1570
+ children: /* @__PURE__ */ U(wt, {})
1571
+ }), /* @__PURE__ */ U("button", {
1528
1572
  ref: m,
1529
1573
  type: "button",
1530
1574
  "aria-label": c.badResponse,
@@ -1532,9 +1576,9 @@ function gn({ state: t, containerRef: n, onThumbsUp: r, onThumbsDown: i, onDraft
1532
1576
  onClick: () => {
1533
1577
  h || i();
1534
1578
  },
1535
- children: /* @__PURE__ */ G(Ct, {})
1579
+ children: /* @__PURE__ */ U(Tt, {})
1536
1580
  })]
1537
- }), /* @__PURE__ */ G("div", {
1581
+ }), /* @__PURE__ */ U("div", {
1538
1582
  role: "status",
1539
1583
  class: g ? "whoo-widget-feedback-submitted" : t.status === "error" ? "whoo-widget-feedback-error" : void 0,
1540
1584
  children: g ? c.feedbackThanks : t.status === "error" ? c.feedbackFailed : null
@@ -1542,26 +1586,26 @@ function gn({ state: t, containerRef: n, onThumbsUp: r, onThumbsDown: i, onDraft
1542
1586
  });
1543
1587
  }
1544
1588
  // src/components/MessageList.tsx
1545
- function _n({ isSlowResponse: e, text: t }) {
1546
- return /* @__PURE__ */ G("div", {
1589
+ function yn({ isSlowResponse: e, text: t }) {
1590
+ return /* @__PURE__ */ U("div", {
1547
1591
  class: "whoo-widget-pending",
1548
- children: [/* @__PURE__ */ G("span", {
1592
+ children: [/* @__PURE__ */ U("span", {
1549
1593
  class: "whoo-widget-typing",
1550
1594
  "aria-hidden": "true",
1551
1595
  children: [
1552
- /* @__PURE__ */ G("span", {}),
1553
- /* @__PURE__ */ G("span", {}),
1554
- /* @__PURE__ */ G("span", {})
1596
+ /* @__PURE__ */ U("span", {}),
1597
+ /* @__PURE__ */ U("span", {}),
1598
+ /* @__PURE__ */ U("span", {})
1555
1599
  ]
1556
- }), e ? /* @__PURE__ */ G("span", {
1600
+ }), e ? /* @__PURE__ */ U("span", {
1557
1601
  class: "whoo-widget-pending-text",
1558
1602
  children: t.lookingItUp
1559
1603
  }) : null]
1560
1604
  });
1561
1605
  }
1562
- function vn({ url: e, alt: t, lang: n }) {
1563
- let [r, i] = rt(!1);
1564
- return r ? null : /* @__PURE__ */ G("img", {
1606
+ function bn({ url: e, alt: t, lang: n }) {
1607
+ let [r, i] = at(!1);
1608
+ return r ? null : /* @__PURE__ */ U("img", {
1565
1609
  class: "whoo-widget-empty-state-image",
1566
1610
  src: e,
1567
1611
  alt: t,
@@ -1570,48 +1614,48 @@ function vn({ url: e, alt: t, lang: n }) {
1570
1614
  onError: () => i(!0)
1571
1615
  });
1572
1616
  }
1573
- var yn = "whoo-widget-notice";
1574
- function bn({ notice: e, placement: t = "top", text: n, contentLanguage: r, languageTag: i }) {
1575
- return t === "footer" ? /* @__PURE__ */ G("div", {
1576
- id: yn,
1617
+ var xn = "whoo-widget-notice";
1618
+ function Sn({ notice: e, placement: t = "top", text: n, contentLanguage: r, languageTag: i }) {
1619
+ return t === "footer" ? /* @__PURE__ */ U("div", {
1620
+ id: xn,
1577
1621
  class: "whoo-widget-notice-footer",
1578
1622
  role: "note",
1579
1623
  tabIndex: 0,
1580
- children: /* @__PURE__ */ G("div", {
1624
+ children: /* @__PURE__ */ U("div", {
1581
1625
  class: "whoo-widget-message-text",
1582
1626
  dir: "auto",
1583
1627
  lang: r,
1584
- children: mn(e, {
1628
+ children: gn(e, {
1585
1629
  linkCue: n.opensInNewTab,
1586
1630
  linkCueLang: i
1587
1631
  })
1588
1632
  })
1589
- }) : /* @__PURE__ */ G("div", {
1590
- id: yn,
1633
+ }) : /* @__PURE__ */ U("div", {
1634
+ id: xn,
1591
1635
  class: "whoo-widget-notice",
1592
1636
  role: "note",
1593
- children: /* @__PURE__ */ G("div", {
1637
+ children: /* @__PURE__ */ U("div", {
1594
1638
  class: "whoo-widget-message-text",
1595
1639
  dir: "auto",
1596
1640
  lang: r,
1597
- children: mn(e, {
1641
+ children: gn(e, {
1598
1642
  linkCue: n.opensInNewTab,
1599
1643
  linkCueLang: i
1600
1644
  })
1601
1645
  })
1602
1646
  });
1603
1647
  }
1604
- function xn({ message: e, speaker: t, feedbackState: n, showFeedback: r, pending: i, isSlowResponse: a, onThumbsUp: o, onThumbsDown: s, onDraftChange: c, onSubmitDetailed: l, onCancelFeedback: u, text: d, contentLanguage: f, languageTag: p }) {
1605
- let m = U(null), h = e.id;
1606
- return /* @__PURE__ */ G("div", {
1648
+ function Cn({ message: e, speaker: t, feedbackState: n, showFeedback: r, pending: i, isSlowResponse: a, onThumbsUp: o, onThumbsDown: s, onDraftChange: c, onSubmitDetailed: l, onCancelFeedback: u, text: d, contentLanguage: f, languageTag: p }) {
1649
+ let m = V(null), h = e.id;
1650
+ return /* @__PURE__ */ U("div", {
1607
1651
  ref: m,
1608
1652
  tabIndex: -1,
1609
1653
  class: `whoo-widget-message whoo-widget-message--${e.role}`,
1610
1654
  children: [
1611
- /* @__PURE__ */ G("span", {
1655
+ /* @__PURE__ */ U("span", {
1612
1656
  class: "whoo-widget-sr-only",
1613
1657
  children: [
1614
- e.role === "assistant" ? /* @__PURE__ */ G("span", {
1658
+ e.role === "assistant" ? /* @__PURE__ */ U("span", {
1615
1659
  lang: f,
1616
1660
  children: t
1617
1661
  }) : t,
@@ -1619,19 +1663,19 @@ function xn({ message: e, speaker: t, feedbackState: n, showFeedback: r, pending
1619
1663
  " "
1620
1664
  ]
1621
1665
  }),
1622
- i ? /* @__PURE__ */ G(_n, {
1666
+ i ? /* @__PURE__ */ U(yn, {
1623
1667
  isSlowResponse: a,
1624
1668
  text: d
1625
- }) : /* @__PURE__ */ G("div", {
1669
+ }) : /* @__PURE__ */ U("div", {
1626
1670
  class: "whoo-widget-message-text",
1627
1671
  dir: "auto",
1628
1672
  lang: f,
1629
- children: mn(e.content, {
1673
+ children: gn(e.content, {
1630
1674
  linkCue: d.opensInNewTab,
1631
1675
  linkCueLang: p
1632
1676
  })
1633
1677
  }),
1634
- r && e.role === "assistant" && h ? /* @__PURE__ */ G(gn, {
1678
+ r && e.role === "assistant" && h ? /* @__PURE__ */ U(vn, {
1635
1679
  state: n,
1636
1680
  containerRef: m,
1637
1681
  onThumbsUp: () => o(h),
@@ -1645,9 +1689,9 @@ function xn({ message: e, speaker: t, feedbackState: n, showFeedback: r, pending
1645
1689
  ]
1646
1690
  });
1647
1691
  }
1648
- function Sn({ messages: t, messageFeedback: n, announcement: r, emptyStateImage: i, centerEmptyState: a = !1, centeredGreeting: o, notice: s, agentName: c = l, showFeedback: u = !1, isStreaming: d = !1, isSlowResponse: f = !1, onThumbsUp: p, onThumbsDown: m, onDraftChange: h = () => {}, onSubmitDetailed: g, onCancelFeedback: _, text: v = e, contentLanguage: y, languageTag: b, announcementIsContent: x = !1 }) {
1649
- let S = U(null), C = !!s && !t.some((e) => e.role === "user");
1650
- at(() => {
1692
+ function wn({ messages: t, messageFeedback: n, announcement: r, emptyStateImage: i, centerEmptyState: a = !1, centeredGreeting: o, notice: s, agentName: c = l, showFeedback: u = !1, isStreaming: d = !1, isSlowResponse: f = !1, onThumbsUp: p, onThumbsDown: m, onDraftChange: h = () => {}, onSubmitDetailed: g, onCancelFeedback: _, text: v = e, contentLanguage: y, languageTag: b, announcementIsContent: x = !1 }) {
1693
+ let S = V(null), C = !!s && !t.some((e) => e.role === "user");
1694
+ st(() => {
1651
1695
  let e = S.current;
1652
1696
  e && (e.scrollTop = C ? 0 : e.scrollHeight);
1653
1697
  }, [
@@ -1655,36 +1699,36 @@ function Sn({ messages: t, messageFeedback: n, announcement: r, emptyStateImage:
1655
1699
  f,
1656
1700
  C
1657
1701
  ]);
1658
- let w = i ? /* @__PURE__ */ G(vn, {
1702
+ let w = i ? /* @__PURE__ */ U(bn, {
1659
1703
  ...i,
1660
1704
  lang: y
1661
1705
  }) : null, T = a && t.length === 0 && (i || o);
1662
- return /* @__PURE__ */ G(L, { children: [/* @__PURE__ */ G("section", {
1706
+ return /* @__PURE__ */ U(F, { children: [/* @__PURE__ */ U("section", {
1663
1707
  class: `whoo-widget-message-list${T ? " whoo-widget-message-list--centered" : ""}`,
1664
1708
  ref: S,
1665
1709
  "aria-label": v.conversation,
1666
1710
  tabIndex: 0,
1667
1711
  children: [
1668
1712
  a ? null : w,
1669
- s ? /* @__PURE__ */ G(bn, {
1713
+ s ? /* @__PURE__ */ U(Sn, {
1670
1714
  notice: s,
1671
1715
  text: v,
1672
1716
  contentLanguage: y,
1673
1717
  languageTag: b
1674
1718
  }) : null,
1675
- T ? /* @__PURE__ */ G("div", {
1719
+ T ? /* @__PURE__ */ U("div", {
1676
1720
  class: "whoo-widget-empty-state",
1677
- children: [w, o ? /* @__PURE__ */ G("div", {
1721
+ children: [w, o ? /* @__PURE__ */ U("div", {
1678
1722
  class: "whoo-widget-empty-state-greeting whoo-widget-message-text",
1679
1723
  dir: "auto",
1680
1724
  lang: y,
1681
- children: mn(o, {
1725
+ children: gn(o, {
1682
1726
  linkCue: v.opensInNewTab,
1683
1727
  linkCueLang: b
1684
1728
  })
1685
1729
  }) : null]
1686
1730
  }) : null,
1687
- t.map((e, r) => /* @__PURE__ */ G(xn, {
1731
+ t.map((e, r) => /* @__PURE__ */ U(Cn, {
1688
1732
  message: e,
1689
1733
  speaker: e.role === "user" ? v.you : c,
1690
1734
  showFeedback: u,
@@ -1701,7 +1745,7 @@ function Sn({ messages: t, messageFeedback: n, announcement: r, emptyStateImage:
1701
1745
  languageTag: b
1702
1746
  }, e.id ?? r))
1703
1747
  ]
1704
- }), /* @__PURE__ */ G("div", {
1748
+ }), /* @__PURE__ */ U("div", {
1705
1749
  class: "whoo-widget-sr-only",
1706
1750
  role: "status",
1707
1751
  "aria-live": "polite",
@@ -1711,38 +1755,38 @@ function Sn({ messages: t, messageFeedback: n, announcement: r, emptyStateImage:
1711
1755
  })] });
1712
1756
  }
1713
1757
  // src/components/Panel.tsx
1714
- var Cn = "button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"])";
1715
- function wn(e) {
1716
- return Array.from(e.querySelectorAll(Cn)).filter((e) => {
1758
+ var Tn = "button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"])";
1759
+ function En(e) {
1760
+ return Array.from(e.querySelectorAll(Tn)).filter((e) => {
1717
1761
  let t = getComputedStyle(e);
1718
1762
  return t.display !== "none" && t.visibility !== "hidden";
1719
1763
  });
1720
1764
  }
1721
- function Tn({ state: e, controller: t, greeting: n }) {
1722
- let r = U(null), i = U(null), a = U(null), o = U(!1);
1723
- H(() => {
1765
+ function Dn({ state: e, controller: t, greeting: n }) {
1766
+ let r = V(null), i = V(null), a = V(null), o = V(!1);
1767
+ B(() => {
1724
1768
  (a.current ?? i.current)?.focus();
1725
- }, []), H(() => {
1769
+ }, []), B(() => {
1726
1770
  e.noticeAgreed && o.current && (o.current = !1, i.current?.focus());
1727
- }, [e.noticeAgreed]), H(() => {
1728
- let e = r.current, n = e ? Wt(e) : () => {}, i = e ? Zt(e) : () => {}, a = () => {
1771
+ }, [e.noticeAgreed]), B(() => {
1772
+ let e = r.current, n = e ? Kt(e) : () => {}, i = e ? $t(e) : () => {}, a = () => {
1729
1773
  e && !e.open && t.close();
1730
1774
  };
1731
1775
  e?.addEventListener("close", a);
1732
- let o = Xt();
1776
+ let o = Qt();
1733
1777
  return () => {
1734
1778
  n(), i(), e?.removeEventListener("close", a), o();
1735
1779
  };
1736
1780
  }, []);
1737
1781
  let s = (e) => {
1738
- if (e.key === "Escape" && !Qt(e)) {
1782
+ if (e.key === "Escape" && !en(e)) {
1739
1783
  e.preventDefault(), t.close();
1740
1784
  return;
1741
1785
  }
1742
1786
  if (e.key !== "Tab") return;
1743
1787
  let n = r.current;
1744
1788
  if (!n) return;
1745
- let i = wn(n);
1789
+ let i = En(n);
1746
1790
  if (i.length === 0) return;
1747
1791
  let a = n.getRootNode().activeElement;
1748
1792
  e.preventDefault();
@@ -1756,7 +1800,7 @@ function Tn({ state: e, controller: t, greeting: n }) {
1756
1800
  }, c = () => {
1757
1801
  let n = e.draft.trim();
1758
1802
  n && !e.isStreaming && (t.setDraft(""), t.sendMessage(n));
1759
- }, l = t.resolvedAgentName, d = u(t.config.title), { before: f, after: p, hasName: m } = zt(t.text.chatWith), h = t.greetingStyle === "centered", g = e.messages.length === 0 && n && !h ? [{
1803
+ }, l = t.resolvedAgentName, d = u(t.config.title), { before: f, after: p, hasName: m } = Vt(t.text.chatWith), h = t.greetingStyle === "centered", g = e.messages.length === 0 && n && !h ? [{
1760
1804
  role: "assistant",
1761
1805
  content: n,
1762
1806
  id: null
@@ -1764,64 +1808,64 @@ function Tn({ state: e, controller: t, greeting: n }) {
1764
1808
  url: y,
1765
1809
  alt: t.emptyStateImageAlt
1766
1810
  } : void 0;
1767
- return /* @__PURE__ */ G("dialog", {
1811
+ return /* @__PURE__ */ U("dialog", {
1768
1812
  open: !0,
1769
1813
  class: "whoo-widget-panel",
1770
1814
  "aria-modal": "true",
1771
1815
  "aria-labelledby": "whoo-widget-title",
1772
- "aria-describedby": t.notice && e.noticeAgreed && e.messages.length === 0 ? yn : void 0,
1816
+ "aria-describedby": t.notice && e.noticeAgreed && e.messages.length === 0 ? xn : void 0,
1773
1817
  ref: r,
1774
1818
  onKeyDown: s,
1775
1819
  onCancel: (e) => {
1776
1820
  e.preventDefault(), t.close();
1777
1821
  },
1778
1822
  children: [
1779
- /* @__PURE__ */ G("div", {
1823
+ /* @__PURE__ */ U("div", {
1780
1824
  class: "whoo-widget-header",
1781
- children: [/* @__PURE__ */ G("div", {
1825
+ children: [/* @__PURE__ */ U("div", {
1782
1826
  class: "whoo-widget-header-titles",
1783
- children: [d ? /* @__PURE__ */ G("h2", {
1827
+ children: [d ? /* @__PURE__ */ U("h2", {
1784
1828
  id: "whoo-widget-title",
1785
1829
  class: "whoo-widget-header-title",
1786
1830
  lang: t.contentLanguage,
1787
1831
  dir: "auto",
1788
1832
  children: d
1789
- }) : /* @__PURE__ */ G("h2", {
1833
+ }) : /* @__PURE__ */ U("h2", {
1790
1834
  id: "whoo-widget-title",
1791
1835
  class: "whoo-widget-header-title",
1792
1836
  children: [
1793
1837
  f,
1794
- m ? /* @__PURE__ */ G("bdi", {
1838
+ m ? /* @__PURE__ */ U("bdi", {
1795
1839
  lang: t.contentLanguage,
1796
1840
  children: l
1797
1841
  }) : null,
1798
1842
  p
1799
1843
  ]
1800
- }), t.subtitle ? /* @__PURE__ */ G("p", {
1844
+ }), t.subtitle ? /* @__PURE__ */ U("p", {
1801
1845
  class: "whoo-widget-header-subtitle",
1802
1846
  lang: t.contentLanguage,
1803
1847
  dir: "auto",
1804
1848
  children: t.subtitle
1805
1849
  }) : null]
1806
- }), /* @__PURE__ */ G("div", {
1850
+ }), /* @__PURE__ */ U("div", {
1807
1851
  class: "whoo-widget-header-actions",
1808
- children: [e.messages.length > 0 && /* @__PURE__ */ G("button", {
1852
+ children: [e.messages.length > 0 && /* @__PURE__ */ U("button", {
1809
1853
  type: "button",
1810
1854
  class: "whoo-widget-header-reset",
1811
1855
  onClick: () => {
1812
1856
  t.resetConversation(), i.current?.focus();
1813
1857
  },
1814
1858
  children: t.text.newConversation
1815
- }), /* @__PURE__ */ G("button", {
1859
+ }), /* @__PURE__ */ U("button", {
1816
1860
  type: "button",
1817
1861
  class: "whoo-widget-header-close",
1818
1862
  "aria-label": t.text.closeChat,
1819
1863
  onClick: () => t.close(),
1820
- children: /* @__PURE__ */ G(bt, {})
1864
+ children: /* @__PURE__ */ U(St, {})
1821
1865
  })]
1822
1866
  })]
1823
1867
  }),
1824
- /* @__PURE__ */ G(Sn, {
1868
+ /* @__PURE__ */ U(wn, {
1825
1869
  messages: g,
1826
1870
  messageFeedback: e.messageFeedback,
1827
1871
  announcement: e.announcement,
@@ -1843,8 +1887,8 @@ function Tn({ state: e, controller: t, greeting: n }) {
1843
1887
  languageTag: t.languageTag,
1844
1888
  announcementIsContent: e.announcementIsContent
1845
1889
  }),
1846
- e.runtimeError && /* @__PURE__ */ G(en, { message: e.runtimeError }),
1847
- e.noticeAgreed ? /* @__PURE__ */ G($t, {
1890
+ e.runtimeError && /* @__PURE__ */ U(nn, { message: e.runtimeError }),
1891
+ e.noticeAgreed ? /* @__PURE__ */ U(tn, {
1848
1892
  value: e.draft,
1849
1893
  onChange: (e) => t.setDraft(e),
1850
1894
  onSend: c,
@@ -1852,13 +1896,13 @@ function Tn({ state: e, controller: t, greeting: n }) {
1852
1896
  inputRef: i,
1853
1897
  text: t.text,
1854
1898
  contentLanguage: t.contentLanguage
1855
- }) : /* @__PURE__ */ G("div", {
1899
+ }) : /* @__PURE__ */ U("div", {
1856
1900
  class: "whoo-widget-agreement",
1857
- children: /* @__PURE__ */ G("button", {
1901
+ children: /* @__PURE__ */ U("button", {
1858
1902
  type: "button",
1859
1903
  class: "whoo-widget-agreement-button",
1860
1904
  ref: a,
1861
- "aria-describedby": yn,
1905
+ "aria-describedby": xn,
1862
1906
  autoFocus: !0,
1863
1907
  onClick: () => {
1864
1908
  o.current = !0, t.agreeToNotice();
@@ -1866,7 +1910,7 @@ function Tn({ state: e, controller: t, greeting: n }) {
1866
1910
  children: t.text.agreeToNotice
1867
1911
  })
1868
1912
  }),
1869
- v ? /* @__PURE__ */ G(bn, {
1913
+ v ? /* @__PURE__ */ U(Sn, {
1870
1914
  notice: t.notice,
1871
1915
  placement: "footer",
1872
1916
  text: t.text,
@@ -1877,11 +1921,11 @@ function Tn({ state: e, controller: t, greeting: n }) {
1877
1921
  });
1878
1922
  }
1879
1923
  // src/components/App.tsx
1880
- function En({ controller: e }) {
1881
- let [t, n] = rt(e.getState()), r = U(null), i = U(t.isOpen);
1882
- return at(() => (n(e.getState()), e.subscribe(n)), [e]), H(() => {
1924
+ function On({ controller: e }) {
1925
+ let [t, n] = at(e.getState()), r = V(null), i = V(t.isOpen);
1926
+ return st(() => (n(e.getState()), e.subscribe(n)), [e]), B(() => {
1883
1927
  i.current && !t.isOpen && r.current?.focus(), i.current = t.isOpen;
1884
- }, [t.isOpen]), t.initError || t.isInitializing ? null : /* @__PURE__ */ G(L, { children: [/* @__PURE__ */ G(Et, {
1928
+ }, [t.isOpen]), t.initError || t.isInitializing ? null : /* @__PURE__ */ U(F, { children: [/* @__PURE__ */ U(Ot, {
1885
1929
  isOpen: t.isOpen,
1886
1930
  onClick: () => t.isOpen ? e.close() : e.open(),
1887
1931
  iconUrl: e.launcher.iconUrl,
@@ -1890,51 +1934,52 @@ function En({ controller: e }) {
1890
1934
  openIcon: e.launcher.openIcon,
1891
1935
  buttonRef: r,
1892
1936
  text: e.text
1893
- }), t.isOpen && /* @__PURE__ */ G(Tn, {
1937
+ }), t.isOpen && /* @__PURE__ */ U(Dn, {
1894
1938
  state: t,
1895
1939
  controller: e,
1896
1940
  greeting: e.config.greeting
1897
1941
  })] });
1898
1942
  }
1899
1943
  // src/api/client.ts
1900
- var Dn = class extends Error {
1944
+ var kn = class extends Error {
1901
1945
  status;
1902
- constructor(e, t) {
1903
- super(e), this.name = "WidgetApiError", this.status = t;
1946
+ code;
1947
+ constructor(e, t, n) {
1948
+ super(e), this.name = "WidgetApiError", this.status = t, this.code = n;
1904
1949
  }
1905
1950
  };
1906
- function On(e) {
1951
+ function An(e) {
1907
1952
  if (typeof e != "string") return null;
1908
1953
  let t = e.trim();
1909
1954
  return t === "" ? null : t;
1910
1955
  }
1911
- async function kn(e, t) {
1956
+ async function jn(e, t) {
1912
1957
  let n = await fetch(`${e}/api/v1/widget/session`, {
1913
1958
  method: "POST",
1914
1959
  headers: { "Content-Type": "application/json" },
1915
1960
  body: JSON.stringify({ publishable_key: t })
1916
1961
  });
1917
- if (!n.ok) throw new Dn(`Failed to create widget session (${n.status})`, n.status);
1962
+ if (!n.ok) throw new kn(`Failed to create widget session (${n.status})`, n.status);
1918
1963
  let r = await n.json();
1919
1964
  return {
1920
1965
  token: r.token,
1921
- ...An(r)
1966
+ ...Mn(r)
1922
1967
  };
1923
1968
  }
1924
- function An(e) {
1969
+ function Mn(e) {
1925
1970
  return {
1926
- primaryColor: On(e.primary_color),
1927
- name: On(e.name),
1928
- accentColor: On(e.accent_color),
1929
- inkColor: On(e.ink_color)
1971
+ primaryColor: An(e.primary_color),
1972
+ name: An(e.name),
1973
+ accentColor: An(e.accent_color),
1974
+ inkColor: An(e.ink_color)
1930
1975
  };
1931
1976
  }
1932
- async function jn(e, t) {
1977
+ async function Nn(e, t) {
1933
1978
  let n = await fetch(`${e}/api/v1/widget/branding`, { headers: { Authorization: `Bearer ${t}` } });
1934
- if (!n.ok) throw new Dn(`Failed to load widget branding (${n.status})`, n.status);
1935
- return An(await n.json());
1979
+ if (!n.ok) throw new kn(`Failed to load widget branding (${n.status})`, n.status);
1980
+ return Mn(await n.json());
1936
1981
  }
1937
- async function Mn(e, t, n) {
1982
+ async function Pn(e, t, n) {
1938
1983
  let r = await fetch(`${e}/api/v1/widget/feedback`, {
1939
1984
  method: "POST",
1940
1985
  headers: {
@@ -1948,10 +1993,10 @@ async function Mn(e, t, n) {
1948
1993
  category: n.category ?? null
1949
1994
  })
1950
1995
  });
1951
- if (!r.ok) throw new Dn(`Feedback submission failed (${r.status})`, r.status);
1996
+ if (!r.ok) throw new kn(`Feedback submission failed (${r.status})`, r.status);
1952
1997
  }
1953
1998
  // src/api/sse.ts
1954
- async function* Nn(e, t, n, r, i) {
1999
+ async function* Fn(e, t, n, r, i) {
1955
2000
  let a = await fetch(`${e}/api/v1/widget/chat`, {
1956
2001
  method: "POST",
1957
2002
  headers: {
@@ -1964,7 +2009,7 @@ async function* Nn(e, t, n, r, i) {
1964
2009
  }),
1965
2010
  signal: i
1966
2011
  });
1967
- if (!a.ok || !a.body) throw new Dn(`Chat request failed (${a.status})`, a.status);
2012
+ if (!a.ok || !a.body) throw new kn(`Chat request failed (${a.status})`, a.status, a.status === 429 ? await Ln(a) : void 0);
1968
2013
  let o = a.body.getReader(), s = new TextDecoder(), c = "";
1969
2014
  for (;;) {
1970
2015
  let { done: e, value: t } = await o.read();
@@ -1976,11 +2021,11 @@ async function* Nn(e, t, n, r, i) {
1976
2021
  c = c.slice(n + 2);
1977
2022
  let t = e.split("\n").find((e) => e.startsWith("data: "));
1978
2023
  if (i?.aborted) return;
1979
- t && (yield Pn(JSON.parse(t.slice(6)))), n = c.indexOf("\n\n");
2024
+ t && (yield In(JSON.parse(t.slice(6)))), n = c.indexOf("\n\n");
1980
2025
  }
1981
2026
  }
1982
2027
  }
1983
- function Pn(e) {
2028
+ function In(e) {
1984
2029
  return typeof e.error == "string" ? {
1985
2030
  type: "error",
1986
2031
  error: e.error,
@@ -2001,28 +2046,36 @@ function Pn(e) {
2001
2046
  conversationId: e.conversation_id
2002
2047
  };
2003
2048
  }
2049
+ async function Ln(e) {
2050
+ try {
2051
+ let t = (await e.json())?.detail?.code;
2052
+ return typeof t == "string" ? t : void 0;
2053
+ } catch {
2054
+ return;
2055
+ }
2056
+ }
2004
2057
  // src/markdown/plainText.ts
2005
- function Fn(e) {
2006
- return ln(e.replace(/\r\n?/g, "\n")).map((e) => {
2058
+ function Rn(e) {
2059
+ return dn(e.replace(/\r\n?/g, "\n")).map((e) => {
2007
2060
  switch (e.type) {
2008
2061
  case "bold":
2009
- case "italic": return Fn(e.value);
2062
+ case "italic": return Rn(e.value);
2010
2063
  case "link": return e.text;
2011
2064
  default: return e.value;
2012
2065
  }
2013
2066
  }).join("");
2014
2067
  }
2015
2068
  // src/markdown/reveal.ts
2016
- var In = 40, Ln = 120;
2017
- function Rn(e) {
2069
+ var zn = 40, Bn = 120;
2070
+ function Vn(e) {
2018
2071
  let t = [];
2019
- for (let n of ln(e)) if (n.type === "text") {
2072
+ for (let n of dn(e)) if (n.type === "text") {
2020
2073
  let e = n.value.split(/(\s+)/), r = n.start;
2021
2074
  for (let n of e) r += n.length, n.trim().length > 0 && t.push(r);
2022
2075
  } else t.push(n.end);
2023
2076
  return t;
2024
2077
  }
2025
- function zn(e) {
2078
+ function Hn(e) {
2026
2079
  let t = null;
2027
2080
  return e?.addEventListener("abort", () => {
2028
2081
  t?.();
@@ -2037,13 +2090,13 @@ function zn(e) {
2037
2090
  });
2038
2091
  };
2039
2092
  }
2040
- async function Bn(e, t, n) {
2041
- let r = n?.wordIntervalMs ?? In, i = n?.tokenIntervalMs ?? Ln, a = n?.signal, o = ln(e), s = new Set(o.filter((e) => e.type !== "text").map((e) => e.end)), c = zn(a), l = "";
2042
- for (let n of Rn(e)) if (a?.aborted || (l = e.slice(0, n), t(l), await c(s.has(n) ? i : r), a?.aborted)) return;
2093
+ async function Un(e, t, n) {
2094
+ let r = n?.wordIntervalMs ?? zn, i = n?.tokenIntervalMs ?? Bn, a = n?.signal, o = dn(e), s = new Set(o.filter((e) => e.type !== "text").map((e) => e.end)), c = Hn(a), l = "";
2095
+ for (let n of Vn(e)) if (a?.aborted || (l = e.slice(0, n), t(l), await c(s.has(n) ? i : r), a?.aborted)) return;
2043
2096
  l !== e && t(e);
2044
2097
  }
2045
2098
  // src/sessionToken.ts
2046
- function Vn(e) {
2099
+ function Wn(e) {
2047
2100
  let t = e.split(".");
2048
2101
  if (t.length !== 3 || t.some((e) => e === "")) return null;
2049
2102
  let n = t[1];
@@ -2057,58 +2110,58 @@ function Vn(e) {
2057
2110
  return null;
2058
2111
  }
2059
2112
  }
2060
- function Hn(e) {
2061
- let t = Vn(e)?.exp;
2113
+ function Gn(e) {
2114
+ let t = Wn(e)?.exp;
2062
2115
  return typeof t == "number" ? t * 1e3 : null;
2063
2116
  }
2064
- function Un(e, t = Date.now()) {
2065
- let n = Hn(e);
2117
+ function Kn(e, t = Date.now()) {
2118
+ let n = Gn(e);
2066
2119
  return n !== null && n <= t;
2067
2120
  }
2068
- function Wn(e, t = Date.now()) {
2069
- let n = Vn(e);
2121
+ function qn(e, t = Date.now()) {
2122
+ let n = Wn(e);
2070
2123
  return n?.exp == null ? null : n.iat != null && n.exp > n.iat ? t + (n.exp - n.iat) * 1e3 : n.exp * 1e3;
2071
2124
  }
2072
2125
  // src/storage.ts
2073
- function Gn(e) {
2126
+ function Jn(e) {
2074
2127
  return `whoo-aiden-widget:conversation:${e}`;
2075
2128
  }
2076
- function Kn(e) {
2129
+ function Yn(e) {
2077
2130
  try {
2078
- return window.sessionStorage.getItem(Gn(e));
2131
+ return window.sessionStorage.getItem(Jn(e));
2079
2132
  } catch {
2080
2133
  return null;
2081
2134
  }
2082
2135
  }
2083
- function qn(e, t) {
2136
+ function Xn(e, t) {
2084
2137
  try {
2085
- window.sessionStorage.setItem(Gn(e), t);
2138
+ window.sessionStorage.setItem(Jn(e), t);
2086
2139
  } catch {}
2087
2140
  }
2088
- function Jn(e) {
2141
+ function Zn(e) {
2089
2142
  return `whoo-aiden-widget:notice-agreed:${e}`;
2090
2143
  }
2091
- function Yn(e, t) {
2144
+ function Qn(e, t) {
2092
2145
  try {
2093
- return window.sessionStorage.getItem(Jn(e)) === t;
2146
+ return window.sessionStorage.getItem(Zn(e)) === t;
2094
2147
  } catch {
2095
2148
  return !1;
2096
2149
  }
2097
2150
  }
2098
- function Xn(e, t) {
2151
+ function $n(e, t) {
2099
2152
  try {
2100
- window.sessionStorage.setItem(Jn(e), t);
2153
+ window.sessionStorage.setItem(Zn(e), t);
2101
2154
  } catch {}
2102
2155
  }
2103
- function Zn(e) {
2156
+ function er(e) {
2104
2157
  try {
2105
- window.sessionStorage.removeItem(Gn(e));
2158
+ window.sessionStorage.removeItem(Jn(e));
2106
2159
  } catch {}
2107
2160
  }
2108
2161
  // src/theme.ts
2109
- var Qn = /^(inherit|initial|unset|revert|revert-layer)$|\bcurrentcolor\b|\b(var|env|attr|light-dark)\(/i;
2110
- function $n(e) {
2111
- if (Qn.test(e.trim())) return null;
2162
+ var tr = /^(inherit|initial|unset|revert|revert-layer)$|\bcurrentcolor\b|\b(var|env|attr|light-dark)\(/i;
2163
+ function nr(e) {
2164
+ if (tr.test(e.trim())) return null;
2112
2165
  let t = document.createElement("div");
2113
2166
  if (t.style.color = e, t.style.color === "") return null;
2114
2167
  let n = document.createElement("div");
@@ -2127,69 +2180,69 @@ function $n(e) {
2127
2180
  translucent: a < 1
2128
2181
  };
2129
2182
  }
2130
- function J(e) {
2131
- return $n(e)?.rgb ?? null;
2183
+ function K(e) {
2184
+ return nr(e)?.rgb ?? null;
2132
2185
  }
2133
- function Y([e, t, n]) {
2186
+ function q([e, t, n]) {
2134
2187
  let r = (e) => {
2135
2188
  let t = e / 255;
2136
2189
  return t <= .03928 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
2137
2190
  };
2138
2191
  return .2126 * r(e) + .7152 * r(t) + .0722 * r(n);
2139
2192
  }
2140
- function er(e, t) {
2193
+ function rr(e, t) {
2141
2194
  let n = Math.max(e, t), r = Math.min(e, t);
2142
2195
  return (n + .05) / (r + .05);
2143
2196
  }
2144
- function tr(e) {
2145
- let t = J(e);
2197
+ function ir(e) {
2198
+ let t = K(e);
2146
2199
  if (!t) return console.warn(`[whoo-aiden-widget] Could not parse color "${e}" for contrast calculation; defaulting to white text.`), "#ffffff";
2147
- let n = Y(t);
2148
- return er(n, Y([
2200
+ let n = q(t);
2201
+ return rr(n, q([
2149
2202
  0,
2150
2203
  0,
2151
2204
  0
2152
- ])) >= er(n, Y([
2205
+ ])) >= rr(n, q([
2153
2206
  255,
2154
2207
  255,
2155
2208
  255
2156
2209
  ])) ? "#000000" : "#ffffff";
2157
2210
  }
2158
- function nr(e, t) {
2159
- let n = J(e), r = J(t);
2160
- return !n || !r ? NaN : er(Y(n), Y(r));
2211
+ function ar(e, t) {
2212
+ let n = K(e), r = K(t);
2213
+ return !n || !r ? NaN : rr(q(n), q(r));
2161
2214
  }
2162
- var rr = i.primary, ir = i.panel, ar = i.assistantBubble, or = i.headerHover, sr = 4.5;
2163
- function cr([e, t, n]) {
2215
+ var or = i.primary, sr = i.panel, cr = i.assistantBubble, lr = i.headerHover, ur = 4.5;
2216
+ function J([e, t, n]) {
2164
2217
  return `#${[
2165
2218
  e,
2166
2219
  t,
2167
2220
  n
2168
2221
  ].map((e) => e.toString(16).padStart(2, "0")).join("")}`;
2169
2222
  }
2170
- function lr(e, t = ir) {
2171
- let n = J(e), r = J(t);
2172
- if (!n || !r) return rr;
2173
- let i = Y(r), a = (e) => er(Y(e), i) >= sr;
2174
- if (a(n)) return cr(n);
2223
+ function dr(e, t = sr) {
2224
+ let n = K(e), r = K(t);
2225
+ if (!n || !r) return or;
2226
+ let i = q(r), a = (e) => rr(q(e), i) >= ur;
2227
+ if (a(n)) return J(n);
2175
2228
  for (let e = .99; e > 0; e -= .01) {
2176
2229
  let t = n.map((t) => Math.round(t * e));
2177
- if (a(t)) return cr(t);
2230
+ if (a(t)) return J(t);
2178
2231
  }
2179
2232
  return "#000000";
2180
2233
  }
2181
- var ur = i.ink, dr = i.link;
2182
- function X(e) {
2234
+ var fr = i.ink, pr = i.link;
2235
+ function Y(e) {
2183
2236
  if (typeof e != "string" || !e) return null;
2184
- let t = $n(e);
2185
- return t ? cr(t.rgb) : null;
2237
+ let t = nr(e);
2238
+ return t ? J(t.rgb) : null;
2186
2239
  }
2187
- function fr(e) {
2240
+ function mr(e) {
2188
2241
  if (typeof e != "string" || !e) return null;
2189
- let t = $n(e);
2190
- return t ? t.translucent ? e.trim() : cr(t.rgb) : null;
2242
+ let t = nr(e);
2243
+ return t ? t.translucent ? e.trim() : J(t.rgb) : null;
2191
2244
  }
2192
- var pr = [
2245
+ var hr = [
2193
2246
  {
2194
2247
  role: "onPrimary",
2195
2248
  against: ["primary"],
@@ -2241,8 +2294,8 @@ var pr = [
2241
2294
  required: 3
2242
2295
  }
2243
2296
  ];
2244
- function Z({ color: e, inkColor: t, accentColor: n, overrides: a }) {
2245
- let o = typeof a == "object" && a && !Array.isArray(a) ? a : {}, s = (e) => fr(o[e]), c = X(e), l = s("primary"), u = l ?? c ?? rr, d = s("primaryText"), f = d ?? lr(u, or), p = s("onPrimary") ?? tr(u), m = X(t), h = s("ink") ?? (m ? lr(m, ar) : ur), g = X(n), _ = s("link") ?? (g ? lr(g, ar) : dr), v = (e) => s(e) ?? i[e], y = {
2297
+ function X({ color: e, inkColor: t, accentColor: n, overrides: a }) {
2298
+ let o = typeof a == "object" && a && !Array.isArray(a) ? a : {}, s = (e) => mr(o[e]), c = Y(e), l = s("primary"), u = l ?? c ?? or, d = s("primaryText"), f = d ?? dr(u, lr), p = s("onPrimary") ?? ir(u), m = Y(t), h = s("ink") ?? (m ? dr(m, cr) : fr), g = Y(n), _ = s("link") ?? (g ? dr(g, cr) : pr), v = (e) => s(e) ?? i[e], y = {
2246
2299
  primary: u,
2247
2300
  onPrimary: p,
2248
2301
  primaryText: f,
@@ -2260,9 +2313,9 @@ function Z({ color: e, inkColor: t, accentColor: n, overrides: a }) {
2260
2313
  inputBorder: v("inputBorder"),
2261
2314
  focusRing: v("focusRing")
2262
2315
  }, b = Object.fromEntries(r.map((e) => [e, s(e) !== null])), x = [];
2263
- for (let { role: e, against: t, required: n } of pr) for (let r of t) {
2316
+ for (let { role: e, against: t, required: n } of hr) for (let r of t) {
2264
2317
  if (!b[e] && !b[r]) continue;
2265
- let t = nr(y[e], y[r]);
2318
+ let t = ar(y[e], y[r]);
2266
2319
  Number.isFinite(t) && t < n && x.push({
2267
2320
  role: e,
2268
2321
  against: r,
@@ -2288,64 +2341,64 @@ function Z({ color: e, inkColor: t, accentColor: n, overrides: a }) {
2288
2341
  contrastWarnings: x
2289
2342
  };
2290
2343
  }
2291
- function Q(e) {
2344
+ function Z(e) {
2292
2345
  return typeof e == "string" ? `"${e}"` : `a ${typeof e} value`;
2293
2346
  }
2294
- function mr(e, t, n = rr) {
2347
+ function gr(e, t, n = or) {
2295
2348
  let r = t;
2296
- X(t) === null && (console.warn(`[whoo-aiden-widget] Could not use ${Q(t)} as the theme color; falling back to ${Q(n)}.`), r = n);
2297
- let i = Z({ color: r });
2349
+ Y(t) === null && (console.warn(`[whoo-aiden-widget] Could not use ${Z(t)} as the theme color; falling back to ${Z(n)}.`), r = n);
2350
+ let i = X({ color: r });
2298
2351
  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);
2299
2352
  }
2300
- function hr(e, { inkColor: t, accentColor: n }) {
2301
- let r = Z({
2353
+ function _r(e, { inkColor: t, accentColor: n }) {
2354
+ let r = X({
2302
2355
  inkColor: t,
2303
2356
  accentColor: n
2304
2357
  });
2305
2358
  e.style.setProperty("--whoo-widget-ink", r.ink), e.style.setProperty("--whoo-widget-link-color", r.link);
2306
2359
  }
2307
- function gr(e, t) {
2308
- let n = Z({ overrides: t });
2360
+ function vr(e, t) {
2361
+ let n = X({ overrides: t });
2309
2362
  for (let t of r) {
2310
2363
  let r = n.overridden.primary && (t === "onPrimary" || t === "primaryText");
2311
2364
  (n.overridden[t] || r) && e.style.setProperty(a[t], n.roles[t]);
2312
2365
  }
2313
2366
  }
2314
- function _r(e, t) {
2315
- e && X(e) === null && console.warn(`[whoo-aiden-widget] Could not use ${Q(e)} as the ${t}; using the default.`);
2367
+ function yr(e, t) {
2368
+ e && Y(e) === null && console.warn(`[whoo-aiden-widget] Could not use ${Z(e)} as the ${t}; using the default.`);
2316
2369
  }
2317
- function vr(e, t, n) {
2370
+ function br(e, t, n) {
2318
2371
  for (let e of r) {
2319
2372
  let n = t[e];
2320
- n && X(n) === null && console.warn(`[whoo-aiden-widget] Could not use ${Q(n)} as theme.colors.${e}; using the calculated color.`);
2373
+ n && Y(n) === null && console.warn(`[whoo-aiden-widget] Could not use ${Z(n)} as theme.colors.${e}; using the calculated color.`);
2321
2374
  }
2322
2375
  let i = t.primary;
2323
- typeof i == "string" && $n(i)?.translucent && console.warn(`[whoo-aiden-widget] theme.colors.primary ${Q(i)} is translucent. The launcher shows your page through it, so its icon may be unreadable over dark content; pass a solid color.`), yr({
2376
+ typeof i == "string" && nr(i)?.translucent && console.warn(`[whoo-aiden-widget] theme.colors.primary ${Z(i)} is translucent. The launcher shows your page through it, so its icon may be unreadable over dark content; pass a solid color.`), xr({
2324
2377
  color: e.color,
2325
2378
  inkColor: e.inkColor,
2326
2379
  accentColor: e.accentColor,
2327
2380
  overrides: t
2328
2381
  }, n);
2329
2382
  }
2330
- function yr(e, t) {
2331
- for (let n of Z(e).contrastWarnings) {
2383
+ function xr(e, t) {
2384
+ for (let n of X(e).contrastWarnings) {
2332
2385
  let { role: e, against: r, value: i, ratio: a, required: o, overridden: s } = n, c = `${e}|${r}|${i}`;
2333
2386
  t.has(c) || (t.add(c), console.warn(s ? `[whoo-aiden-widget] theme.colors.${e} (${i}) has ${a.toFixed(2)}:1 contrast against the ${r} color; ${o}:1 is recommended. Using it as given.` : `[whoo-aiden-widget] the ${e} color (${i}) has ${a.toFixed(2)}:1 contrast against your theme.colors.${r}; ${o}:1 is recommended. Override theme.colors.${e} too.`));
2334
2387
  }
2335
2388
  }
2336
- function br(e, t, n = /* @__PURE__ */ new Set()) {
2337
- mr(e, t.color ?? rr), _r(t.inkColor, "ink color"), _r(t.accentColor, "accent color"), hr(e, {
2389
+ function Sr(e, t, n = /* @__PURE__ */ new Set()) {
2390
+ gr(e, t.color ?? or), yr(t.inkColor, "ink color"), yr(t.accentColor, "accent color"), _r(e, {
2338
2391
  inkColor: t.inkColor,
2339
2392
  accentColor: t.accentColor
2340
2393
  });
2341
2394
  let r = se(t.theme);
2342
- vr(t, r.colors, n), gr(e, r.colors), r.fontFamily && e.style.setProperty("--whoo-widget-font", r.fontFamily);
2395
+ br(t, r.colors, n), vr(e, r.colors), r.fontFamily && e.style.setProperty("--whoo-widget-font", r.fontFamily);
2343
2396
  }
2344
2397
  // src/controller.ts
2345
- var xr = 8e3, Sr = 3e3, Cr = 15e3, wr = class extends Error {
2398
+ var Cr = 8e3, wr = 3e3, Tr = 15e3, Er = class extends Error {
2346
2399
  name = "SessionUnavailableError";
2347
2400
  };
2348
- function Tr(e, t) {
2401
+ function Dr(e, t) {
2349
2402
  return t ? new Promise((n, r) => {
2350
2403
  let i = () => r(new DOMException("Aborted", "AbortError"));
2351
2404
  if (t.aborted) return i();
@@ -2356,23 +2409,31 @@ function Tr(e, t) {
2356
2409
  });
2357
2410
  }) : e;
2358
2411
  }
2359
- function Er(e, t) {
2360
- return e === "refused" ? new Or(t) : new wr();
2412
+ function Or(e, t) {
2413
+ return e === "refused" ? new Ar(t) : new Er();
2361
2414
  }
2362
- function Dr(e) {
2415
+ function kr(e) {
2363
2416
  let t = e?.status;
2364
2417
  return t === 401 || t === 403 || t === 404;
2365
2418
  }
2366
- var Or = class extends Error {
2419
+ var Ar = class extends Error {
2367
2420
  name = "SessionExpiredError";
2368
2421
  constructor(e) {
2369
2422
  super(e instanceof Error ? e.message : "The session has expired.");
2370
2423
  }
2371
2424
  };
2372
- function kr(e) {
2425
+ function jr(e) {
2373
2426
  return e?.status === 401;
2374
2427
  }
2375
- function Ar(e, t) {
2428
+ function Q(e) {
2429
+ if (e?.status !== 429) return;
2430
+ let t = e.code;
2431
+ return typeof t == "string" ? t : null;
2432
+ }
2433
+ function Mr(e) {
2434
+ return Q(e) === "session_message_limit";
2435
+ }
2436
+ function Nr(e, t) {
2376
2437
  return new Promise((n) => {
2377
2438
  let r = setTimeout(n, t);
2378
2439
  e.then(() => {
@@ -2380,7 +2441,7 @@ function Ar(e, t) {
2380
2441
  });
2381
2442
  });
2382
2443
  }
2383
- var jr = class {
2444
+ var Pr = class {
2384
2445
  config;
2385
2446
  state;
2386
2447
  listeners = /* @__PURE__ */ new Set();
@@ -2418,9 +2479,9 @@ var jr = class {
2418
2479
  ...t,
2419
2480
  ...r ? { iconUrl: r } : {}
2420
2481
  }, this.launcherIconUrl = r, this.emptyStateImageUrl = n(e.emptyStateImageUrl, "emptyStateImageUrl"), this.emptyStateImageAlt = typeof e.emptyStateImageAlt == "string" ? e.emptyStateImageAlt.trim() : "", this.notice = typeof e.notice == "string" && !d(e.notice) ? e.notice.trim() : "", this.requireNoticeAgreement = e.requireNoticeAgreement === !0 && this.notice !== "", e.requireNoticeAgreement === !0 && !this.notice && console.warn("whoo-aiden-widget: `requireNoticeAgreement` has no effect without a `notice`, so it is ignored."), this.noticePlacement = ee(e.noticePlacement), this.subtitle = typeof e.subtitle == "string" && !d(e.subtitle) ? e.subtitle.trim() : "", this.greetingStyle = O(e.greetingStyle), this.showFeedback = e.showFeedback === !0, this.storageIdentifier = e.publishableKey ?? "session-token-mode", this.getSessionToken = m(e);
2421
- let { language: i, tag: a, dir: o } = Ft(e.language, typeof document > "u" ? void 0 : document.documentElement.lang);
2422
- this.language = i, this.languageTag = a, this.dir = o, this.contentLanguage = Rt(e.contentLanguage, typeof document > "u" ? void 0 : document.documentElement.lang, e.language), this.text = {
2423
- ...Nt(i),
2482
+ let { language: i, tag: a, dir: o } = Lt(e.language, typeof document > "u" ? void 0 : document.documentElement.lang);
2483
+ this.language = i, this.languageTag = a, this.dir = o, this.contentLanguage = Bt(e.contentLanguage, typeof document > "u" ? void 0 : document.documentElement.lang, e.language), this.text = {
2484
+ ...Ft(i),
2424
2485
  ...b(e.messages)
2425
2486
  }, this.prefersReducedMotion = typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, this.state = {
2426
2487
  isOpen: !1,
@@ -2437,7 +2498,7 @@ var jr = class {
2437
2498
  announcement: null,
2438
2499
  announcementIsContent: !1,
2439
2500
  isSlowResponse: !1,
2440
- noticeAgreed: !this.requireNoticeAgreement || Yn(this.storageIdentifier, this.notice),
2501
+ noticeAgreed: !this.requireNoticeAgreement || Qn(this.storageIdentifier, this.notice),
2441
2502
  draft: ""
2442
2503
  };
2443
2504
  }
@@ -2483,12 +2544,12 @@ var jr = class {
2483
2544
  let e = this.config.apiBaseUrl ?? "https://api.aidenvoice.com";
2484
2545
  try {
2485
2546
  if (this.config.sessionToken) {
2486
- if (Un(this.config.sessionToken)) {
2547
+ if (Kn(this.config.sessionToken)) {
2487
2548
  if (!("token" in await this.renewToken())) throw Error("The sessionToken has expired.");
2488
- } else this.sessionToken = this.config.sessionToken, this.sessionTokenExpiresAt = Hn(this.config.sessionToken);
2549
+ } else this.sessionToken = this.config.sessionToken, this.sessionTokenExpiresAt = Gn(this.config.sessionToken);
2489
2550
  } else if (this.config.publishableKey) {
2490
- let { token: t, primaryColor: n, name: r, accentColor: i, inkColor: a } = await kn(e, this.config.publishableKey);
2491
- this.sessionToken = t, this.sessionTokenExpiresAt = Wn(t), this.setState({
2551
+ let { token: t, primaryColor: n, name: r, accentColor: i, inkColor: a } = await jn(e, this.config.publishableKey);
2552
+ this.sessionToken = t, this.sessionTokenExpiresAt = qn(t), this.setState({
2492
2553
  primaryColor: n,
2493
2554
  agentName: r,
2494
2555
  accentColor: i,
@@ -2499,13 +2560,13 @@ var jr = class {
2499
2560
  console.error("[whoo-aiden-widget] initialization failed:", e), this.setState({ initError: e instanceof Error ? e.message : String(e) });
2500
2561
  return;
2501
2562
  }
2502
- this.conversationId = Kn(this.storageIdentifier), this.config.sessionToken && await Ar(this.loadBranding(e), Sr);
2563
+ this.conversationId = Yn(this.storageIdentifier), this.config.sessionToken && await Nr(this.loadBranding(e), wr);
2503
2564
  }
2504
2565
  async loadBranding(e) {
2505
2566
  try {
2506
2567
  let t = this.config;
2507
- if (X(t.color) && X(t.inkColor) && X(t.accentColor) && u(t.name)) return;
2508
- let { primaryColor: n, name: r, accentColor: i, inkColor: a } = await this.withSession((t) => jn(e, t));
2568
+ if (Y(t.color) && Y(t.inkColor) && Y(t.accentColor) && u(t.name)) return;
2569
+ let { primaryColor: n, name: r, accentColor: i, inkColor: a } = await this.withSession((t) => Nn(e, t));
2509
2570
  this.setState({
2510
2571
  primaryColor: n,
2511
2572
  agentName: r,
@@ -2514,14 +2575,14 @@ var jr = class {
2514
2575
  });
2515
2576
  } catch (e) {
2516
2577
  let t = e?.status;
2517
- (e instanceof Or || t === 401 || t === 403) && (this.state.isInitializing ? (console.error("[whoo-aiden-widget] initialization failed:", e), this.setState({ initError: e instanceof Error ? e.message : String(e) })) : (console.error("[whoo-aiden-widget] the session was refused after start-up:", e), this.setState({ runtimeError: this.text.sessionExpired })));
2578
+ (e instanceof Ar || t === 401 || t === 403) && (this.state.isInitializing ? (console.error("[whoo-aiden-widget] initialization failed:", e), this.setState({ initError: e instanceof Error ? e.message : String(e) })) : (console.error("[whoo-aiden-widget] the session was refused after start-up:", e), this.setState({ runtimeError: this.text.sessionExpired })));
2518
2579
  }
2519
2580
  }
2520
2581
  open() {
2521
2582
  this.setState({ isOpen: !0 });
2522
2583
  }
2523
2584
  resetConversation() {
2524
- this.sendEpoch += 1, this.activeRequestController?.abort("reset"), this.activeRequestController = null, this.clearSlowResponse(), this.conversationId = null, Zn(this.storageIdentifier), this.setState({
2585
+ this.sendEpoch += 1, this.activeRequestController?.abort("reset"), this.activeRequestController = null, this.clearSlowResponse(), this.conversationId = null, er(this.storageIdentifier), this.setState({
2525
2586
  messages: [],
2526
2587
  messageFeedback: {},
2527
2588
  runtimeError: null,
@@ -2529,7 +2590,7 @@ var jr = class {
2529
2590
  }), this.announce(this.text.conversationCleared);
2530
2591
  }
2531
2592
  agreeToNotice() {
2532
- this.state.noticeAgreed || (Xn(this.storageIdentifier, this.notice), this.setState({ noticeAgreed: !0 }));
2593
+ this.state.noticeAgreed || ($n(this.storageIdentifier, this.notice), this.setState({ noticeAgreed: !0 }));
2533
2594
  }
2534
2595
  setDraft(e) {
2535
2596
  this.setState({ draft: e });
@@ -2558,7 +2619,7 @@ var jr = class {
2558
2619
  ],
2559
2620
  isStreaming: !0,
2560
2621
  runtimeError: null
2561
- }), this.announce(Bt(this.text.messageSent, { name: this.resolvedAgentName }), !1, !0);
2622
+ }), this.announce(Ht(this.text.messageSent, { name: this.resolvedAgentName }), !1, !0);
2562
2623
  let o = a, s = (e) => {
2563
2624
  let t = o;
2564
2625
  o = {
@@ -2570,35 +2631,46 @@ var jr = class {
2570
2631
  let { signal: u } = l, d = !1;
2571
2632
  this.slowResponseTimer = setTimeout(() => {
2572
2633
  this.slowResponseTimer = null, this.setState({ isSlowResponse: !0 }), r() && this.announce(this.text.lookingItUp);
2573
- }, xr);
2634
+ }, Cr);
2574
2635
  let f = !1, p = () => {
2575
2636
  this.state.draft === "" && (f = !0, this.setState({ draft: e }));
2576
2637
  }, m = !1, h = (e) => {
2577
- m = !0, this.announce(Fn(e), !0);
2638
+ m = !0, this.announce(Rn(e), !0);
2578
2639
  }, g = (e = this.text.genericError) => {
2579
2640
  r() && (m || (m = !0, this.announce(null)), this.setState({ runtimeError: e }), p());
2580
2641
  }, _ = "";
2581
2642
  try {
2582
2643
  let { stream: n, first: i } = await this.withSession(async (n) => {
2583
2644
  d = !0;
2584
- let r = Nn(t, n, this.conversationId, e, u);
2585
- return {
2586
- stream: r,
2587
- first: await r.next()
2588
- };
2645
+ let r = Fn(t, n, this.conversationId, e, u);
2646
+ try {
2647
+ return {
2648
+ stream: r,
2649
+ first: await r.next()
2650
+ };
2651
+ } catch (e) {
2652
+ throw (jr(e) || Q(e) !== void 0) && (d = !1), e;
2653
+ }
2589
2654
  }, u);
2590
2655
  for (let e = i; !e.done && !u.aborted && r(); e = await n.next()) {
2591
2656
  let t = e.value;
2592
- if (t.type === "conversation_id") this.conversationId = t.conversationId, qn(this.storageIdentifier, t.conversationId);
2593
- else if (t.type === "delta") this.clearSlowResponse(), t.verbatim && !this.prefersReducedMotion ? (await Bn(t.delta, (e) => c(e), { signal: u }), _ = t.delta) : t.verbatim ? (_ = t.delta, c(_)) : (_ += t.delta, c(_));
2594
- else if (t.type === "done") t.conversationId && (this.conversationId = t.conversationId, qn(this.storageIdentifier, t.conversationId)), t.messageId && s({ id: t.messageId }), r() && h(_);
2657
+ if (t.type === "conversation_id") this.conversationId = t.conversationId, Xn(this.storageIdentifier, t.conversationId);
2658
+ else if (t.type === "delta") this.clearSlowResponse(), t.verbatim && !this.prefersReducedMotion ? (await Un(t.delta, (e) => c(e), { signal: u }), _ = t.delta) : t.verbatim ? (_ = t.delta, c(_)) : (_ += t.delta, c(_));
2659
+ else if (t.type === "done") t.conversationId && (this.conversationId = t.conversationId, Xn(this.storageIdentifier, t.conversationId)), t.messageId && s({ id: t.messageId }), r() && h(_);
2595
2660
  else if (t.type === "error") {
2596
2661
  console.error("[whoo-aiden-widget] chat error:", t.error), _.trim() !== "" && r() && h(_), g(), l.abort();
2597
2662
  break;
2598
2663
  }
2599
2664
  }
2600
2665
  } catch (e) {
2601
- u.aborted ? u.reason === "close" && r() && !d && p() : e instanceof Or ? (console.error("[whoo-aiden-widget] chat request failed: the session has expired.", e), g(this.text.sessionExpired)) : e instanceof wr ? (console.error("[whoo-aiden-widget] chat request failed: no session could be had."), g()) : (console.error("[whoo-aiden-widget] chat request failed:", e), g());
2666
+ if (u.aborted) u.reason === "close" && r() && !d && p();
2667
+ else if (e instanceof Ar) console.error("[whoo-aiden-widget] chat request failed: the session has expired.", e), g(this.text.sessionExpired);
2668
+ else if (e instanceof Er) console.error("[whoo-aiden-widget] chat request failed: no session could be had."), g();
2669
+ else if (Q(e) !== void 0) {
2670
+ console.error("[whoo-aiden-widget] chat request refused:", Q(e));
2671
+ let t = Q(e);
2672
+ g(t === "assistant_unavailable" ? this.text.assistantUnavailable : t === "turn_in_progress" ? this.text.waitForReply : t === "session_message_limit" ? this.text.messageLimitReached : this.text.tooManyMessages);
2673
+ } else console.error("[whoo-aiden-widget] chat request failed:", e), g();
2602
2674
  } finally {
2603
2675
  let e = o.id === null && o.content.trim() === "", t = this.state.messages.filter((t) => !(e && t === o) && !(e && f && t === i)), n = t.length !== this.state.messages.length;
2604
2676
  r() ? (this.activeRequestController = null, this.clearSlowResponse(), m || (!u.aborted && _.trim() !== "" ? h(_) : this.announce(null)), this.setState({
@@ -2645,7 +2717,7 @@ var jr = class {
2645
2717
  }
2646
2718
  } });
2647
2719
  try {
2648
- await this.withSession((a) => Mn(i, a, {
2720
+ await this.withSession((a) => Pn(i, a, {
2649
2721
  messageId: e,
2650
2722
  rating: t,
2651
2723
  correction: n,
@@ -2671,7 +2743,7 @@ var jr = class {
2671
2743
  }
2672
2744
  async currentToken(e) {
2673
2745
  let t = this.sessionToken, n = this.sessionTokenExpiresAt;
2674
- return t && (n === null || n - Date.now() > 6e4) ? { token: t } : Tr(this.renewToken(), e);
2746
+ return t && (n === null || n - Date.now() > 6e4) ? { token: t } : Dr(this.renewToken(), e);
2675
2747
  }
2676
2748
  renewToken() {
2677
2749
  return this.tokenRenewal ??= this.fetchNewToken().finally(() => {
@@ -2682,7 +2754,7 @@ var jr = class {
2682
2754
  let e = ++this.renewalGeneration, t, n = new Promise((e) => {
2683
2755
  t = setTimeout(() => {
2684
2756
  console.error("[whoo-aiden-widget] could not renew the session: it took too long."), e({ failure: "unavailable" });
2685
- }, Cr);
2757
+ }, Tr);
2686
2758
  });
2687
2759
  try {
2688
2760
  return await Promise.race([this.obtainToken(e), n]);
@@ -2693,79 +2765,79 @@ var jr = class {
2693
2765
  async obtainToken(e) {
2694
2766
  let t = this.config.apiBaseUrl ?? "https://api.aidenvoice.com", n;
2695
2767
  try {
2696
- if (this.config.publishableKey) n = (await kn(t, this.config.publishableKey)).token;
2768
+ if (this.config.publishableKey) n = (await jn(t, this.config.publishableKey)).token;
2697
2769
  else if (this.getSessionToken) n = await this.getSessionToken();
2698
2770
  else return { failure: "refused" };
2699
2771
  } catch (e) {
2700
- return console.error("[whoo-aiden-widget] could not renew the session:", e), { failure: this.config.publishableKey && Dr(e) ? "refused" : "unavailable" };
2772
+ return console.error("[whoo-aiden-widget] could not renew the session:", e), { failure: this.config.publishableKey && kr(e) ? "refused" : "unavailable" };
2701
2773
  }
2702
- let r = typeof n == "string" ? Wn(n) : null;
2774
+ let r = typeof n == "string" ? qn(n) : null;
2703
2775
  return typeof n != "string" || n === "" || r !== null && r <= Date.now() ? (console.error("[whoo-aiden-widget] could not renew the session: no usable token was returned."), { failure: "refused" }) : (e === this.renewalGeneration && (this.sessionToken = n, this.sessionTokenExpiresAt = r), { token: n });
2704
2776
  }
2705
2777
  async withSession(e, t) {
2706
2778
  let n = await this.currentToken(t);
2707
- if (!("token" in n)) throw Er(n.failure);
2779
+ if (!("token" in n)) throw Or(n.failure);
2708
2780
  let { token: r } = n;
2709
2781
  try {
2710
2782
  return await e(r);
2711
2783
  } catch (n) {
2712
- if (!kr(n)) throw n;
2713
- let i = this.sessionToken && this.sessionToken !== r ? { token: this.sessionToken } : await Tr(this.renewToken(), t);
2714
- if (!("token" in i)) throw Er(i.failure, n);
2784
+ if (!jr(n) && !Mr(n)) throw n;
2785
+ let i = this.sessionToken && this.sessionToken !== r ? { token: this.sessionToken } : await Dr(this.renewToken(), t);
2786
+ if (!("token" in i)) throw Or(i.failure, n);
2715
2787
  try {
2716
2788
  return await e(i.token);
2717
2789
  } catch (e) {
2718
- throw kr(e) ? new Or(e) : e;
2790
+ throw jr(e) ? new Ar(e) : e;
2719
2791
  }
2720
2792
  }
2721
2793
  }
2722
- }, $ = 20, Mr = 12, Nr = 300, Pr = 352;
2723
- function Fr() {
2794
+ }, $ = 20, Fr = 12, Ir = 300, Lr = 352;
2795
+ function Rr() {
2724
2796
  try {
2725
2797
  return typeof CSS < "u" && CSS.supports?.("height", "100dvh") ? "dvh" : "vh";
2726
2798
  } catch {
2727
2799
  return "vh";
2728
2800
  }
2729
2801
  }
2730
- function Ir(e, t) {
2731
- let { offsetX: n, offsetY: r, launcherSize: i, panelWidth: a, panelHeight: o, cornerRadius: s } = le(t.layout), c = (e) => typeof t.layout?.offset?.[e] == "number";
2802
+ function zr(e, t) {
2803
+ let { offsetX: n, offsetY: r, launcherSize: i, panelWidth: a, panelHeight: o, cornerRadius: s } = ue(t.layout), c = (e) => typeof t.layout?.offset?.[e] == "number";
2732
2804
  if (typeof window < "u" && window.innerWidth > 0 && window.innerHeight > 0) {
2733
- let e = Math.max($, window.innerWidth - Nr), t = Math.max($, window.innerHeight - i - Pr);
2805
+ let e = Math.max($, window.innerWidth - Ir), t = Math.max($, window.innerHeight - i - Lr);
2734
2806
  c("x") && (n > e || n > window.innerWidth - i) && console.warn(`whoo-aiden-widget: \`layout.offset.x\` ${n} leaves no room for the launcher and panel in this viewport; it is held back.`), c("y") && (r > t || r > window.innerHeight - i) && console.warn(`whoo-aiden-widget: \`layout.offset.y\` ${r} leaves no room for the launcher and panel in this viewport; it is held back.`);
2735
2807
  }
2736
- let l = `100${Fr()}`, u = `min(${n}px, max(${$}px, calc(100vw - ${Nr}px)), calc(100vw - ${i}px))`, d = `min(${r}px, max(${$}px, calc(${l} - ${i + Pr}px)), calc(${l} - ${i}px))`, f = `calc(${d} + ${i}px + ${Mr}px)`, p = t.position === "bottom-left", m = (t, n) => e.style.setProperty(t, n);
2808
+ let l = `100${Rr()}`, u = `min(${n}px, max(${$}px, calc(100vw - ${Ir}px)), calc(100vw - ${i}px))`, d = `min(${r}px, max(${$}px, calc(${l} - ${i + Lr}px)), calc(${l} - ${i}px))`, f = `calc(${d} + ${i}px + ${Fr}px)`, p = t.position === "bottom-left", m = (t, n) => e.style.setProperty(t, n);
2737
2809
  m("--whoo-widget-inset-left", p ? u : "auto"), m("--whoo-widget-inset-right", p ? "auto" : u), m("--whoo-widget-inset-bottom", d), m("--whoo-widget-launcher-size", `${i}px`), m("--whoo-widget-panel-bottom", f), m("--whoo-widget-panel-width", `${a}px`), m("--whoo-widget-panel-height", `${o}px`), m("--whoo-widget-panel-max-width", `calc(100vw - ${u} - ${$}px)`), m("--whoo-widget-panel-max-height", `calc(${l} - ${f} - ${$}px)`), s === void 0 ? e.style.removeProperty("--whoo-widget-corner-radius") : m("--whoo-widget-corner-radius", `${s}px`);
2738
2810
  }
2739
2811
  // src/styles.css?inline
2740
- var Lr = ":host,.whoo-widget-root{all:initial;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.whoo-widget-launcher{bottom:var(--whoo-widget-inset-bottom,20px);left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);width:var(--whoo-widget-launcher-size,56px);height:var(--whoo-widget-launcher-size,56px);background:var(--whoo-widget-color,#4f46e5);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{width:calc(var(--whoo-widget-launcher-size,56px) * 13 / 28);height:calc(var(--whoo-widget-launcher-size,56px) * 13 / 28);display:block}.whoo-widget-launcher-icon-image{width:calc(var(--whoo-widget-launcher-size,56px) * 4 / 7);height:calc(var(--whoo-widget-launcher-size,56px) * 4 / 7);object-fit:cover;border-radius:50%}.whoo-widget-launcher-icon-image[hidden]{display:none}.whoo-widget-panel{bottom:var(--whoo-widget-panel-bottom,88px);left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);width:var(--whoo-widget-panel-width,360px);height:var(--whoo-widget-panel-height,480px);max-width:var(--whoo-widget-panel-max-width,calc(100vw - 40px));max-height:var(--whoo-widget-panel-max-height,calc(100vh - 108px));background:var(--whoo-widget-panel,#fff);border-radius:var(--whoo-widget-corner-radius,12px);font-family:var(--whoo-widget-font,-apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif);color:inherit;border:none;flex-direction:column;margin:0;padding:0;display:flex;position:fixed;overflow:hidden;box-shadow:0 4px 16px #0003}button,input,textarea,select{font-family:inherit}.whoo-widget-panel:not([open]){display:none}.whoo-widget-panel::backdrop{background:0 0}@media (width<=400px),(height<=420px){.whoo-widget-panel{width:auto;max-width:none;height:auto;max-height:none;inset:8px}}.whoo-widget-panel[data-fit-visible]{top:calc(var(--whoo-widget-visible-top,0px) + max(8px, var(--whoo-widget-visible-height,100%) - 8px - var(--whoo-widget-panel-height,480px)));height:min(var(--whoo-widget-panel-height,480px), calc(var(--whoo-widget-visible-height,100%) - 16px));max-height:none;bottom:auto}@media (width<=400px),(height<=420px){.whoo-widget-panel[data-fit-visible]{top:calc(var(--whoo-widget-visible-top,0px) + 8px);height:calc(var(--whoo-widget-visible-height,100%) - 16px)}}.whoo-widget-header{border-bottom:1px solid var(--whoo-widget-border,#e5e5e5);flex-wrap:wrap;flex-shrink:0;justify-content:space-between;align-items:center;gap:8px;max-height:50%;padding-block:8px;padding-inline:16px 8px;display:flex;overflow-y:auto}.whoo-widget-header-titles{flex:10em;min-width:0}.whoo-widget-header-title{color:var(--whoo-widget-ink,#111);overflow-wrap:anywhere;margin:0;font-size:15px;font-weight:600}.whoo-widget-header-subtitle{color:var(--whoo-widget-muted,#4b5563);overflow-wrap:anywhere;margin:2px 0 0;font-size:13px}.whoo-widget-header-actions{background:var(--whoo-widget-panel,#fff);flex-shrink:0;align-items:center;gap:4px;margin-inline-start: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:var(--whoo-widget-header-hover,#f3f4f6)}.whoo-widget-message-list{overscroll-behavior:contain;flex:1;min-height:0;padding:12px;overflow-y:auto}.whoo-widget-message-list:focus-visible{outline:2px solid var(--whoo-widget-focus-ring,#111827);outline-offset:-2px;box-shadow:inset 0 0 0 4px var(--whoo-widget-panel,#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}.whoo-widget-message-list--centered{flex-direction:column;display:flex}.whoo-widget-empty-state{margin-block:auto}.whoo-widget-empty-state-greeting{color:var(--whoo-widget-ink,#111);text-align:center;overflow-wrap:anywhere;white-space:pre-line}.whoo-widget-empty-state-greeting a{color:var(--whoo-widget-link-color,#00e)}@media (width<=400px),(height<=420px){.whoo-widget-empty-state-image{max-height:64px;margin:0 auto 8px}}.whoo-widget-notice{border:1px solid var(--whoo-widget-border,#e5e5e5);color:var(--whoo-widget-ink,#111);overflow-wrap:anywhere;white-space:pre-line;border-radius:8px;margin-bottom:12px;padding:8px 12px}.whoo-widget-notice a,.whoo-widget-notice-footer a{color:var(--whoo-widget-link-color,#00e)}.whoo-widget-message{overflow-wrap:anywhere;white-space:pre-line;border-radius:8px;max-width:80%;margin-bottom:8px;padding:8px 12px}.whoo-widget-message-text,.whoo-widget-message-text li{unicode-bidi:plaintext}.whoo-widget-list{margin:4px 0;padding-inline-start:0}.whoo-widget-list li{margin-inline-start:20px}.whoo-widget-message--user{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);margin-inline-start:auto}.whoo-widget-message--user a{color:inherit}.whoo-widget-message--assistant{background:var(--whoo-widget-assistant-bubble,#f0f0f0);color:var(--whoo-widget-ink,#111)}.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:var(--whoo-widget-typing-dots,#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{background:var(--whoo-widget-error-bg,#fee2e2);color:var(--whoo-widget-error-text,#991b1b);padding:8px 12px;font-size:13px}.whoo-widget-composer{border-top:1px solid var(--whoo-widget-border,#e5e5e5);gap:8px;padding:12px;display:flex}.whoo-widget-composer-input{border:1px solid var(--whoo-widget-input-border,#6b7280);border-radius:var(--whoo-widget-corner-radius,6px);unicode-bidi:plaintext;flex:1;min-width:0;padding:8px;font-size:16px}.whoo-widget-agreement{border-top:1px solid var(--whoo-widget-border,#e5e5e5);padding:12px}.whoo-widget-agreement-button{border-radius:var(--whoo-widget-corner-radius,6px);background:var(--whoo-widget-color,#4f46e5);width:100%;min-height:44px;color:var(--whoo-widget-text-on-color,#fff);overflow-wrap:anywhere;cursor:pointer;border:none;padding:8px 16px;font-weight:600;display:block}.whoo-widget-composer-send{border-radius:var(--whoo-widget-corner-radius,6px);background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;padding:8px 16px}.whoo-widget-composer-input::placeholder{color:var(--whoo-widget-muted,#4b5563);opacity:1}.whoo-widget-notice-footer{overscroll-behavior:contain;border-top:1px solid var(--whoo-widget-border,#e5e5e5);min-height:0;max-height:25%;color:var(--whoo-widget-muted,#4b5563);text-align:center;overflow-wrap:anywhere;white-space:pre-line;flex:0 auto;padding:8px 16px;font-size:12px;line-height:1.4;overflow-y:auto}.whoo-widget-notice-footer:focus-visible{outline:2px solid var(--whoo-widget-focus-ring,#111827);outline-offset:-2px;box-shadow:inset 0 0 0 4px var(--whoo-widget-panel,#fff)}.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:var(--whoo-widget-muted,#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:var(--whoo-widget-text,#111);background:#0000000f}.whoo-widget-feedback-buttons button[aria-disabled=true]{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;border:1px solid var(--whoo-widget-input-border,#6b7280);resize:vertical;unicode-bidi:plaintext;border-radius:6px;width:100%;padding:6px;font-size:16px}.whoo-widget-feedback-select{border:1px solid var(--whoo-widget-input-border,#6b7280);border-radius:6px;height:2em;min-height:24px;padding:4px;font-size:16px}.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{border:1px solid var(--whoo-widget-input-border,#6b7280);background:var(--whoo-widget-panel,#fff);color:var(--whoo-widget-text,#111);cursor:pointer;border-radius:6px;padding:8px 16px;font-size:13px}.whoo-widget-feedback-submitted{color:var(--whoo-widget-muted,#4b5563);margin-top:4px;font-size:12px}.whoo-widget-feedback-error{color:var(--whoo-widget-error-text,#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:2px solid var(--whoo-widget-focus-ring,#111827);outline-offset:2px;box-shadow:0 0 0 4px var(--whoo-widget-panel,#fff)}@media (forced-colors:active){.whoo-widget-message{border:1px solid canvastext}.whoo-widget-launcher,.whoo-widget-header-close,.whoo-widget-header-reset,.whoo-widget-composer-send,.whoo-widget-agreement-button,.whoo-widget-feedback-submit,.whoo-widget-feedback-buttons button{border:1px solid buttontext}.whoo-widget-panel{box-sizing:border-box;border:1px solid canvastext}}";
2812
+ var Br = ":host,.whoo-widget-root{all:initial;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.whoo-widget-launcher{bottom:var(--whoo-widget-inset-bottom,20px);left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);width:var(--whoo-widget-launcher-size,56px);height:var(--whoo-widget-launcher-size,56px);background:var(--whoo-widget-color,#4f46e5);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{width:calc(var(--whoo-widget-launcher-size,56px) * 13 / 28);height:calc(var(--whoo-widget-launcher-size,56px) * 13 / 28);display:block}.whoo-widget-launcher-icon-image{width:calc(var(--whoo-widget-launcher-size,56px) * 4 / 7);height:calc(var(--whoo-widget-launcher-size,56px) * 4 / 7);object-fit:cover;border-radius:50%}.whoo-widget-launcher-icon-image[hidden]{display:none}.whoo-widget-panel{bottom:var(--whoo-widget-panel-bottom,88px);left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);width:var(--whoo-widget-panel-width,360px);height:var(--whoo-widget-panel-height,480px);max-width:var(--whoo-widget-panel-max-width,calc(100vw - 40px));max-height:var(--whoo-widget-panel-max-height,calc(100vh - 108px));background:var(--whoo-widget-panel,#fff);border-radius:var(--whoo-widget-corner-radius,12px);font-family:var(--whoo-widget-font,-apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif);color:inherit;border:none;flex-direction:column;margin:0;padding:0;display:flex;position:fixed;overflow:hidden;box-shadow:0 4px 16px #0003}button,input,textarea,select{font-family:inherit}.whoo-widget-panel:not([open]){display:none}.whoo-widget-panel::backdrop{background:0 0}@media (width<=400px),(height<=420px){.whoo-widget-panel{width:auto;max-width:none;height:auto;max-height:none;inset:8px}}.whoo-widget-panel[data-fit-visible]{top:calc(var(--whoo-widget-visible-top,0px) + max(8px, var(--whoo-widget-visible-height,100%) - 8px - var(--whoo-widget-panel-height,480px)));height:min(var(--whoo-widget-panel-height,480px), calc(var(--whoo-widget-visible-height,100%) - 16px));max-height:none;bottom:auto}@media (width<=400px),(height<=420px){.whoo-widget-panel[data-fit-visible]{top:calc(var(--whoo-widget-visible-top,0px) + 8px);height:calc(var(--whoo-widget-visible-height,100%) - 16px)}}.whoo-widget-header{border-bottom:1px solid var(--whoo-widget-border,#e5e5e5);flex-wrap:wrap;flex-shrink:0;justify-content:space-between;align-items:center;gap:8px;max-height:50%;padding-block:8px;padding-inline:16px 8px;display:flex;overflow-y:auto}.whoo-widget-header-titles{flex:10em;min-width:0}.whoo-widget-header-title{color:var(--whoo-widget-ink,#111);overflow-wrap:anywhere;margin:0;font-size:15px;font-weight:600}.whoo-widget-header-subtitle{color:var(--whoo-widget-muted,#4b5563);overflow-wrap:anywhere;margin:2px 0 0;font-size:13px}.whoo-widget-header-actions{background:var(--whoo-widget-panel,#fff);flex-shrink:0;align-items:center;gap:4px;margin-inline-start: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:var(--whoo-widget-header-hover,#f3f4f6)}.whoo-widget-message-list{overscroll-behavior:contain;flex:1;min-height:0;padding:12px;overflow-y:auto}.whoo-widget-message-list:focus-visible{outline:2px solid var(--whoo-widget-focus-ring,#111827);outline-offset:-2px;box-shadow:inset 0 0 0 4px var(--whoo-widget-panel,#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}.whoo-widget-message-list--centered{flex-direction:column;display:flex}.whoo-widget-empty-state{margin-block:auto}.whoo-widget-empty-state-greeting{color:var(--whoo-widget-ink,#111);text-align:center;overflow-wrap:anywhere;white-space:pre-line}.whoo-widget-empty-state-greeting a{color:var(--whoo-widget-link-color,#00e)}@media (width<=400px),(height<=420px){.whoo-widget-empty-state-image{max-height:64px;margin:0 auto 8px}}.whoo-widget-notice{border:1px solid var(--whoo-widget-border,#e5e5e5);color:var(--whoo-widget-ink,#111);overflow-wrap:anywhere;white-space:pre-line;border-radius:8px;margin-bottom:12px;padding:8px 12px}.whoo-widget-notice a,.whoo-widget-notice-footer a{color:var(--whoo-widget-link-color,#00e)}.whoo-widget-message{overflow-wrap:anywhere;white-space:pre-line;border-radius:8px;max-width:80%;margin-bottom:8px;padding:8px 12px}.whoo-widget-message-text,.whoo-widget-message-text li{unicode-bidi:plaintext}.whoo-widget-list{margin:4px 0;padding-inline-start:0}.whoo-widget-list li{margin-inline-start:20px}.whoo-widget-message--user{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);margin-inline-start:auto}.whoo-widget-message--user a{color:inherit}.whoo-widget-message--assistant{background:var(--whoo-widget-assistant-bubble,#f0f0f0);color:var(--whoo-widget-ink,#111)}.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:var(--whoo-widget-typing-dots,#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{background:var(--whoo-widget-error-bg,#fee2e2);color:var(--whoo-widget-error-text,#991b1b);padding:8px 12px;font-size:13px}.whoo-widget-composer{border-top:1px solid var(--whoo-widget-border,#e5e5e5);gap:8px;padding:12px;display:flex}.whoo-widget-composer-input{border:1px solid var(--whoo-widget-input-border,#6b7280);border-radius:var(--whoo-widget-corner-radius,6px);unicode-bidi:plaintext;flex:1;min-width:0;padding:8px;font-size:16px}.whoo-widget-agreement{border-top:1px solid var(--whoo-widget-border,#e5e5e5);padding:12px}.whoo-widget-agreement-button{border-radius:var(--whoo-widget-corner-radius,6px);background:var(--whoo-widget-color,#4f46e5);width:100%;min-height:44px;color:var(--whoo-widget-text-on-color,#fff);overflow-wrap:anywhere;cursor:pointer;border:none;padding:8px 16px;font-weight:600;display:block}.whoo-widget-composer-send{border-radius:var(--whoo-widget-corner-radius,6px);background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;padding:8px 16px}.whoo-widget-composer-input::placeholder{color:var(--whoo-widget-muted,#4b5563);opacity:1}.whoo-widget-notice-footer{overscroll-behavior:contain;border-top:1px solid var(--whoo-widget-border,#e5e5e5);min-height:0;max-height:25%;color:var(--whoo-widget-muted,#4b5563);text-align:center;overflow-wrap:anywhere;white-space:pre-line;flex:0 auto;padding:8px 16px;font-size:12px;line-height:1.4;overflow-y:auto}.whoo-widget-notice-footer:focus-visible{outline:2px solid var(--whoo-widget-focus-ring,#111827);outline-offset:-2px;box-shadow:inset 0 0 0 4px var(--whoo-widget-panel,#fff)}.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:var(--whoo-widget-muted,#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:var(--whoo-widget-text,#111);background:#0000000f}.whoo-widget-feedback-buttons button[aria-disabled=true]{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;border:1px solid var(--whoo-widget-input-border,#6b7280);resize:vertical;unicode-bidi:plaintext;border-radius:6px;width:100%;padding:6px;font-size:16px}.whoo-widget-feedback-select{border:1px solid var(--whoo-widget-input-border,#6b7280);border-radius:6px;height:2em;min-height:24px;padding:4px;font-size:16px}.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{border:1px solid var(--whoo-widget-input-border,#6b7280);background:var(--whoo-widget-panel,#fff);color:var(--whoo-widget-text,#111);cursor:pointer;border-radius:6px;padding:8px 16px;font-size:13px}.whoo-widget-feedback-submitted{color:var(--whoo-widget-muted,#4b5563);margin-top:4px;font-size:12px}.whoo-widget-feedback-error{color:var(--whoo-widget-error-text,#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:2px solid var(--whoo-widget-focus-ring,#111827);outline-offset:2px;box-shadow:0 0 0 4px var(--whoo-widget-panel,#fff)}@media (forced-colors:active){.whoo-widget-message{border:1px solid canvastext}.whoo-widget-launcher,.whoo-widget-header-close,.whoo-widget-header-reset,.whoo-widget-composer-send,.whoo-widget-agreement-button,.whoo-widget-feedback-submit,.whoo-widget-feedback-buttons button{border:1px solid buttontext}.whoo-widget-panel{box-sizing:border-box;border:1px solid canvastext}}";
2741
2813
  // src/mount.tsx
2742
- function Rr(e) {
2814
+ function Vr(e) {
2743
2815
  let t = document.createElement("div");
2744
2816
  t.id = "whoo-aiden-widget-host", t.style.position = "relative", t.style.zIndex = String(c(e.zIndex));
2745
2817
  let n = t.attachShadow({ mode: "open" }), r = document.createElement("style");
2746
- r.textContent = Lr, n.appendChild(r);
2818
+ r.textContent = Br, n.appendChild(r);
2747
2819
  let i = document.createElement("div");
2748
2820
  n.appendChild(i);
2749
2821
  let a = /* @__PURE__ */ new Set();
2750
- br(i, e, a), Ir(i, e);
2751
- let o = new jr(e);
2822
+ Sr(i, e, a), zr(i, e);
2823
+ let o = new Pr(e);
2752
2824
  i.setAttribute("lang", o.languageTag), i.setAttribute("dir", o.dir);
2753
- let s = X(e.color) !== null, l = null, u = "", d = se(e.theme).colors, f = Object.keys(d).length > 0, p = {
2825
+ let s = Y(e.color) !== null, l = null, u = "", d = se(e.theme).colors, f = Object.keys(d).length > 0, p = {
2754
2826
  color: e.color,
2755
2827
  inkColor: e.inkColor,
2756
2828
  accentColor: e.accentColor
2757
2829
  };
2758
2830
  return o.subscribe((t) => {
2759
2831
  let n = !1;
2760
- !s && t.primaryColor && t.primaryColor !== l && (l = t.primaryColor, mr(i, t.primaryColor, e.color), X(t.primaryColor) && (p = {
2832
+ !s && t.primaryColor && t.primaryColor !== l && (l = t.primaryColor, gr(i, t.primaryColor, e.color), Y(t.primaryColor) && (p = {
2761
2833
  ...p,
2762
2834
  color: t.primaryColor
2763
2835
  }), n = !0);
2764
2836
  let r = `${t.inkColor}|${t.accentColor}`;
2765
2837
  if ((t.inkColor || t.accentColor) && r !== u) {
2766
2838
  u = r;
2767
- let a = X(e.inkColor) ? e.inkColor : t.inkColor, o = X(e.accentColor) ? e.accentColor : t.accentColor;
2768
- hr(i, {
2839
+ let a = Y(e.inkColor) ? e.inkColor : t.inkColor, o = Y(e.accentColor) ? e.accentColor : t.accentColor;
2840
+ _r(i, {
2769
2841
  inkColor: a,
2770
2842
  accentColor: o
2771
2843
  }), p = {
@@ -2774,16 +2846,16 @@ function Rr(e) {
2774
2846
  accentColor: o
2775
2847
  }, n = !0;
2776
2848
  }
2777
- n && (gr(i, d), f && yr({
2849
+ n && (vr(i, d), f && xr({
2778
2850
  ...p,
2779
2851
  overrides: d
2780
2852
  }, a));
2781
- }), o.init(), Ue(/* @__PURE__ */ G(En, { controller: o }), i), document.body.appendChild(t), { unmount() {
2782
- Ue(null, i), t.remove();
2853
+ }), o.init(), Ge(/* @__PURE__ */ U(On, { controller: o }), i), document.body.appendChild(t), { unmount() {
2854
+ Ge(null, i), t.remove();
2783
2855
  } };
2784
2856
  }
2785
2857
  // src/index.ts
2786
- function zr(e) {
2787
- return f(e), Rr(e);
2858
+ function Hr(e) {
2859
+ return f(e), Vr(e);
2788
2860
  }
2789
- export { Ot as SUPPORTED_LANGUAGES, zr as init, Z as resolveTheme };
2861
+ export { At as SUPPORTED_LANGUAGES, Hr as init, X as resolveTheme };