@aiden-voice/widget 0.9.1 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/widget.js CHANGED
@@ -7,7 +7,9 @@ var e = {
7
7
  conversation: "Conversation",
8
8
  you: "You",
9
9
  message: "Message",
10
+ messagePlaceholder: "Type a message…",
10
11
  send: "Send",
12
+ messageSent: "Message sent. {name} is preparing a response.",
11
13
  lookingItUp: "Looking that up for you…",
12
14
  goodResponse: "Good response",
13
15
  badResponse: "Bad response",
@@ -23,7 +25,7 @@ var e = {
23
25
  cancel: "Cancel",
24
26
  feedbackThanks: "Thanks for the feedback",
25
27
  feedbackFailed: "Couldn't send feedback",
26
- conversationCleared: "Conversation cleared",
28
+ conversationCleared: "New conversation started. Previous messages were cleared.",
27
29
  genericError: "Something went wrong, please try again.",
28
30
  sessionExpired: "This chat session has expired. Reload the page to continue.",
29
31
  opensInNewTab: "(opens in new tab)",
@@ -165,22 +167,29 @@ function T(e, t, n) {
165
167
  p(`ignoring \`${n}\` -- expected one of ${t.join(", ")}.`);
166
168
  }
167
169
  }
168
- var E = 200, D = /url\(|[@;{}\\]/i;
170
+ var E = ["bubble", "centered"], D = ["top", "footer"];
169
171
  function O(e) {
172
+ return T(e, E, "greetingStyle") ?? "bubble";
173
+ }
174
+ function k(e) {
175
+ return T(e, D, "noticePlacement") ?? "top";
176
+ }
177
+ var A = 200, ee = /url\(|[@;{}\\]/i;
178
+ function te(e) {
170
179
  if (!S(e)) {
171
180
  if (typeof e == "string") {
172
181
  let t = e.trim();
173
- if (t && t.length <= E && !D.test(t)) return t;
182
+ if (t && t.length <= A && !ee.test(t)) return t;
174
183
  }
175
- p(`ignoring \`theme.fonts.family\` -- expected a font-family stack of at most ${E} characters, without url(), @, ;, {, } or \\.`);
184
+ p(`ignoring \`theme.fonts.family\` -- expected a font-family stack of at most ${A} characters, without url(), @, ;, {, } or \\.`);
176
185
  }
177
186
  }
178
- var k = [
187
+ var ne = [
179
188
  "chat",
180
189
  "message",
181
190
  "sparkle"
182
- ], A = ["chevron-down", "close"], ee = /* @__PURE__ */ new WeakMap();
183
- function te(e) {
191
+ ], re = ["chevron-down", "close"], ie = /* @__PURE__ */ new WeakMap();
192
+ function ae(e) {
184
193
  let t = {
185
194
  colors: {},
186
195
  fontFamily: void 0,
@@ -188,7 +197,7 @@ function te(e) {
188
197
  };
189
198
  if (e == null) return t;
190
199
  if (!x(e)) return _(e), t;
191
- let i = ee.get(e);
200
+ let i = ie.get(e);
192
201
  if (i) return i;
193
202
  w(e, [
194
203
  "colors",
@@ -204,7 +213,7 @@ function te(e) {
204
213
  }
205
214
  }
206
215
  let o = C(e, "fonts", "theme.fonts");
207
- o && (w(o, ["family"], "theme.fonts"), t.fontFamily = O(o.family));
216
+ o && (w(o, ["family"], "theme.fonts"), t.fontFamily = te(o.family));
208
217
  let s = C(e, "launcher", "theme.launcher");
209
218
  if (s) {
210
219
  w(s, [
@@ -213,10 +222,10 @@ function te(e) {
213
222
  "openIcon",
214
223
  "openIconUrl"
215
224
  ], "theme.launcher");
216
- let e = T(s.icon, k, "theme.launcher.icon"), r = n(s.iconUrl, "theme.launcher.iconUrl"), i = T(s.openIcon, A, "theme.launcher.openIcon"), a = n(s.openIconUrl, "theme.launcher.openIconUrl");
225
+ let e = T(s.icon, ne, "theme.launcher.icon"), r = n(s.iconUrl, "theme.launcher.iconUrl"), i = T(s.openIcon, re, "theme.launcher.openIcon"), a = n(s.openIconUrl, "theme.launcher.openIconUrl");
217
226
  e && (t.launcher.icon = e), r && (t.launcher.iconUrl = r), i && (t.launcher.openIcon = i), a && (t.launcher.openIconUrl = a);
218
227
  }
219
- return ee.set(e, t), t;
228
+ return ie.set(e, t), t;
220
229
  }
221
230
  var j = {
222
231
  offsetX: 20,
@@ -228,34 +237,37 @@ var j = {
228
237
  function M(e, t, n) {
229
238
  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);
230
239
  }
231
- function ne(e, t, n, r) {
240
+ function oe(e, t, n, r) {
232
241
  let i = Math.min(r, Math.max(n, e));
233
242
  return i !== e && p(`\`${t}\` ${e} is out of range (${r === Infinity ? `at least ${n}` : `${n}-${r}`}); using ${i}.`), i;
234
243
  }
235
- var re = /* @__PURE__ */ new WeakMap();
236
- function ie(e) {
244
+ var se = /* @__PURE__ */ new WeakMap();
245
+ function ce(e) {
237
246
  let t = { ...j };
238
247
  if (e == null) return t;
239
248
  if (!x(e)) return v(e), t;
240
- let n = re.get(e);
249
+ let n = se.get(e);
241
250
  if (n) return n;
242
251
  w(e, [
243
252
  "offset",
244
253
  "launcherSize",
245
- "panel"
254
+ "panel",
255
+ "cornerRadius"
246
256
  ], "layout");
247
257
  let r = C(e, "offset", "layout.offset");
248
- r && (w(r, ["x", "y"], "layout.offset"), t.offsetX = M(r.x, "layout.offset.x", j.offsetX), t.offsetY = M(r.y, "layout.offset.y", j.offsetY)), t.launcherSize = ne(M(e.launcherSize, "layout.launcherSize", j.launcherSize), "layout.launcherSize", 24, 120);
258
+ r && (w(r, ["x", "y"], "layout.offset"), t.offsetX = M(r.x, "layout.offset.x", j.offsetX), t.offsetY = M(r.y, "layout.offset.y", j.offsetY)), t.launcherSize = oe(M(e.launcherSize, "layout.launcherSize", j.launcherSize), "layout.launcherSize", 24, 120);
249
259
  let i = C(e, "panel", "layout.panel");
250
- return i && (w(i, ["width", "height"], "layout.panel"), t.panelWidth = ne(M(i.width, "layout.panel.width", j.panelWidth), "layout.panel.width", 280, Infinity), t.panelHeight = ne(M(i.height, "layout.panel.height", j.panelHeight), "layout.panel.height", 320, Infinity)), re.set(e, t), t;
260
+ i && (w(i, ["width", "height"], "layout.panel"), t.panelWidth = oe(M(i.width, "layout.panel.width", j.panelWidth), "layout.panel.width", 280, Infinity), t.panelHeight = oe(M(i.height, "layout.panel.height", j.panelHeight), "layout.panel.height", 320, Infinity));
261
+ let a = e.cornerRadius;
262
+ return typeof a == "number" && Number.isFinite(a) && a >= 0 ? t.cornerRadius = oe(a, "layout.cornerRadius", 0, 32) : S(a) || p("ignoring `layout.cornerRadius` -- expected a non-negative number of pixels."), se.set(e, t), t;
251
263
  }
252
264
  //#endregion
253
265
  //#region node_modules/.pnpm/preact@11.0.1/node_modules/preact/dist/preact.mjs
254
- var N, ae, P, oe, se, ce, le, ue, de, fe, pe = {}, me = [], he = /^m(i|n|o|s|text|space)$/, ge = Array.isArray, _e = me.slice, F = Object.assign;
255
- function ve(e) {
266
+ var N, le, P, ue, de, fe, pe, me, he, ge, _e = {}, ve = [], ye = /^m(i|n|o|s|text|space)$/, be = Array.isArray, xe = ve.slice, F = Object.assign;
267
+ function Se(e) {
256
268
  e && e.parentNode && e.remove();
257
269
  }
258
- function ye(e, t, n, r, i) {
270
+ function Ce(e, t, n, r, i) {
259
271
  var a = {
260
272
  type: e,
261
273
  props: t,
@@ -267,7 +279,7 @@ function ye(e, t, n, r, i) {
267
279
  __e: null,
268
280
  __c: null,
269
281
  constructor: void 0,
270
- __v: i || ++ae,
282
+ __v: i || ++le,
271
283
  __i: -1,
272
284
  __u: 0
273
285
  };
@@ -276,7 +288,7 @@ function ye(e, t, n, r, i) {
276
288
  function I(e) {
277
289
  return e.children;
278
290
  }
279
- function be(e, t) {
291
+ function we(e, t) {
280
292
  this.props = e, this.context = t, this.__g = 0;
281
293
  }
282
294
  function L(e, t) {
@@ -284,30 +296,30 @@ function L(e, t) {
284
296
  for (var n; t < e.__k.length; t++) if ((n = e.__k[t]) && n.__e) return n.__e;
285
297
  return typeof e.type != "function" || e.props.__P ? null : L(e);
286
298
  }
287
- function xe(e) {
299
+ function Te(e) {
288
300
  if ((e = e.__) && e.__c && !e.props.__P) return e.__e = null, e.__k.some(function(t) {
289
301
  return t && (e.__e = t.__e);
290
- }), xe(e);
302
+ }), Te(e);
291
303
  }
292
- function Se(e) {
293
- (8 & e.__g || !(e.__g |= 8) || !P.push(e) || se++) && oe == N.debounceRendering || ((oe = N.debounceRendering) || queueMicrotask)(Ce);
304
+ function Ee(e) {
305
+ (8 & e.__g || !(e.__g |= 8) || !P.push(e) || de++) && ue == N.debounceRendering || ((ue = N.debounceRendering) || queueMicrotask)(De);
294
306
  }
295
- function Ce() {
307
+ function De() {
296
308
  var e, t, n, r, i, a, o, s, c;
297
309
  try {
298
- for (t = 1; P.length;) P.length > t && P.sort(ce), e = P.shift(), t = P.length, 8 & e.__g && (r = void 0, i = void 0, a = (i = (n = e).__v).__e, o = [], s = [], (c = n.__P) && ((r = F({ constructor: void 0 }, i)).__v = i.__v + 1, N.vnode && N.vnode(r), je(c, r, i, n.__n, c.namespaceURI, 32 & i.__u ? [a] : null, o, a || L(i), 32 & i.__u, s), r.__v = i.__v, r.__.__k[r.__i] = r, Ne(o, r, s), i.__ = i.__e = null, r.__e != a && xe(r)));
310
+ for (t = 1; P.length;) P.length > t && P.sort(fe), e = P.shift(), t = P.length, 8 & e.__g && (r = void 0, i = void 0, a = (i = (n = e).__v).__e, o = [], s = [], (c = n.__P) && ((r = F({ constructor: void 0 }, i)).__v = i.__v + 1, N.vnode && N.vnode(r), Fe(c, r, i, n.__n, c.namespaceURI, 32 & i.__u ? [a] : null, o, a || L(i), 32 & i.__u, s), r.__v = i.__v, r.__.__k[r.__i] = r, Le(o, r, s), i.__ = i.__e = null, r.__e != a && Te(r)));
299
311
  } finally {
300
- P.length = se = 0;
312
+ P.length = de = 0;
301
313
  }
302
314
  }
303
- function we(e, t, n, r, i, a, o, s, c, l, u) {
304
- var d, f, p, m, h, g, _ = r.__k || me, v = t.length;
305
- for (c = Te(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = ~p.__i && _[p.__i] || pe, p.__i = d, g = je(e, p, f, i, a, o, s, c, l, u), m = p.__e, (f.ref != p.ref || 8 & f.__u) && (f.ref && Fe(f.ref, null, p, f), p.ref && u.push(p.ref, p.__c || m, p)), h ||= m, 4 & p.__u ? (c = Ee(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 &= -7);
315
+ function Oe(e, t, n, r, i, a, o, s, c, l, u) {
316
+ var d, f, p, m, h, g, _ = r.__k || ve, v = t.length;
317
+ for (c = ke(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = ~p.__i && _[p.__i] || _e, 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 && ze(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 &= -7);
306
318
  return n.__e = h, c;
307
319
  }
308
- function Te(e, t, n, r, i) {
320
+ function ke(e, t, n, r, i) {
309
321
  var a, o, s, c, l, u, d, f, p, m, h = n.length, g = h, _ = 0, v = !1, y = e.__k = Array(i);
310
- for (a = 0; a < i; a++) (o = t[a]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o != "object" || o.constructor == String ? o = y[a] = ye(null, o) : ge(o) ? o = y[a] = ye(I, { children: o }) : o.constructor === void 0 && o.__b ? o = y[a] = ye(o.type, o.props, o.key, o.ref, o.__v) : y[a] = o, c = a + _, o.__ = e, o.__b = e.__b + 1, s = null, ~(l = o.__i = De(o, n, c, g)) && (g--, (s = n[l]) && (s.__u |= 2)), s && s.__v ? (o.__u |= 2, l == c - 1 ? _-- : l == c + 1 ? _++ : l != c && (l > c ? _-- : _++, v = !0)) : (~l || (i > h ? _-- : i < h && _++), typeof o.type != "function" && (o.__u |= 4))) : y[a] = null;
322
+ for (a = 0; a < i; a++) (o = t[a]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o != "object" || o.constructor == String ? o = y[a] = Ce(null, o) : be(o) ? o = y[a] = Ce(I, { children: o }) : o.constructor === void 0 && o.__b ? o = y[a] = Ce(o.type, o.props, o.key, o.ref, o.__v) : y[a] = o, c = a + _, o.__ = e, o.__b = e.__b + 1, s = null, ~(l = o.__i = je(o, n, c, g)) && (g--, (s = n[l]) && (s.__u |= 2)), s && s.__v ? (o.__u |= 2, l == c - 1 ? _-- : l == c + 1 ? _++ : l != c && (l > c ? _-- : _++, v = !0)) : (~l || (i > h ? _-- : i < h && _++), typeof o.type != "function" && (o.__u |= 4))) : y[a] = null;
311
323
  if (v) {
312
324
  for (u = [], d = [], a = 0; a < i; a++) if ((o = y[a]) && 2 & o.__u) {
313
325
  for (f = 0, p = u.length; f < p;) u[m = f + p >> 1] < o.__i ? f = m + 1 : p = m;
@@ -315,21 +327,21 @@ function Te(e, t, n, r, i) {
315
327
  }
316
328
  for (_ = u.length; a--;) d[a] && (d[a] == _ ? _-- : y[a].__u |= 4);
317
329
  }
318
- if (g) for (a = 0; a < h; a++) !(s = n[a]) || 2 & s.__u || (s.__e == r && (r = L(s)), Ie(s, s));
330
+ if (g) for (a = 0; a < h; a++) !(s = n[a]) || 2 & s.__u || (s.__e == r && (r = L(s)), Be(s, s));
319
331
  return r;
320
332
  }
321
- function Ee(e, t, n, r) {
333
+ function Ae(e, t, n, r) {
322
334
  var i, a, o;
323
335
  if (typeof e.type == "function") {
324
336
  if (e.props.__P) return t;
325
- if (i = e.__k) for (a = 0; a < i.length; a++) i[a] && (i[a].__ = e, t = Ee(i[a], t, n, !1));
337
+ if (i = e.__k) for (a = 0; a < i.length; a++) i[a] && (i[a].__ = e, t = Ae(i[a], t, n, !1));
326
338
  return t;
327
339
  }
328
340
  for (t && !t.parentNode && (t = L(e)) && !t.parentNode && (t = null), o = t; o && o.nodeType == 8;) o = o.nextSibling;
329
341
  for (e.__e != o && (!r && n.moveBefore && e.__e.parentNode ? n.moveBefore(e.__e, t) : n.insertBefore(e.__e, t || null)), t = e.__e; (t &&= t.nextSibling) && t.nodeType == 8;);
330
342
  return t;
331
343
  }
332
- function De(e, t, n, r) {
344
+ function je(e, t, n, r) {
333
345
  var i, a, o, s = e.key, c = e.type, l = t[n], u = l && !(2 & l.__u);
334
346
  if (l === null && s == null || u && s == l.key && c == l.type) return n;
335
347
  if (r > +!!u) {
@@ -337,18 +349,18 @@ function De(e, t, n, r) {
337
349
  }
338
350
  return -1;
339
351
  }
340
- function Oe(e, t, n) {
352
+ function Me(e, t, n) {
341
353
  n ??= "", t[0] == "-" ? e.setProperty(t, n) : e[t] = n;
342
354
  }
343
- function ke(e, t, n, r, i) {
355
+ function Ne(e, t, n, r, i) {
344
356
  var a, o;
345
357
  n: if (t == "style") {
346
358
  if (typeof n == "string") e.style.cssText = n;
347
359
  else {
348
- if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || Oe(e.style, t, "");
349
- if (n) for (t in n) r && n[t] == r[t] || Oe(e.style, t, n[t]);
360
+ if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || Me(e.style, t, "");
361
+ if (n) for (t in n) r && n[t] == r[t] || Me(e.style, t, n[t]);
350
362
  }
351
- } else if (t[0] == "o" && t[1] == "n") (e.__e ||= {})[t] = n, n && r || (o = fe[t] || (fe[t] = Ae(t)), (e.__a ||= {})[t] = de, a = t != (t = t.replace(ue, "$1")), (t = t.slice(2))[0] < "a" && (t = t.toLowerCase()), n ? e.addEventListener(t, o, a) : e.removeEventListener(t, o, a));
363
+ } 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));
352
364
  else {
353
365
  if (i == "http://www.w3.org/2000/svg") t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
354
366
  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 {
@@ -358,17 +370,17 @@ function ke(e, t, n, r, i) {
358
370
  typeof n == "function" || (n == null || !1 === n && t[4] != "-" ? e.removeAttribute(t) : e.setAttribute(t, t == "popover" && n == 1 ? "" : n));
359
371
  }
360
372
  }
361
- function Ae(e) {
373
+ function Pe(e) {
362
374
  return function(t) {
363
375
  if (this.__e) {
364
376
  var n = this.__e[e];
365
- if (t[le] == null) t[le] = de++;
366
- else if (t[le] < this.__a[e]) return;
377
+ if (t[pe] == null) t[pe] = he++;
378
+ else if (t[pe] < this.__a[e]) return;
367
379
  return n(N.event ? N.event(t) : t);
368
380
  }
369
381
  };
370
382
  }
371
- function je(e, t, n, r, i, a, o, s, c, l) {
383
+ function Fe(e, t, n, r, i, a, o, s, c, l) {
372
384
  var u, d, f, p, m, h, g, _, v, y, b, x, S, C, w, T, E, D, O, k, A = t.type;
373
385
  if (t.constructor !== void 0) return null;
374
386
  if (128 & n.__u && (c = 32 & n.__u, u = n.__c.__z)) {
@@ -386,24 +398,24 @@ function je(e, t, n, r, i, a, o, s, c, l) {
386
398
  n: if (typeof A == "function") {
387
399
  m = o.length;
388
400
  try {
389
- if (y = t.props, b = (u = A.prototype) && u.render, x = (u = A.contextType) && r[u.__c], S = u ? x ? x.props.value : u.__ : r, n.__c ? 2 & (h = t.__c = n.__c).__g && (h.__g |= 1) : (b ? t.__c = h = new A(y, S) : (t.__c = h = new be(y, S), h.constructor = A, h.render = Le), x && x.sub(h), h.state || (h.state = {}), h.__n = r, h.__g |= 8, h.__h = [], h.__k = []), b && (h.__s || (h.__s = h.state), A.getDerivedStateFromProps && (h.__s == h.state && (h.__s = F({}, h.__s)), F(h.__s, A.getDerivedStateFromProps(y, h.__s)))), g = h.props, _ = h.state, h.__v = t, n.__c) {
401
+ if (y = t.props, b = (u = A.prototype) && u.render, x = (u = A.contextType) && r[u.__c], S = u ? x ? x.props.value : u.__ : r, n.__c ? 2 & (h = t.__c = n.__c).__g && (h.__g |= 1) : (b ? t.__c = h = new A(y, S) : (t.__c = h = new we(y, S), h.constructor = A, h.render = Ve), x && x.sub(h), h.state || (h.state = {}), h.__n = r, h.__g |= 8, h.__h = [], h.__k = []), b && (h.__s || (h.__s = h.state), A.getDerivedStateFromProps && (h.__s == h.state && (h.__s = F({}, h.__s)), F(h.__s, A.getDerivedStateFromProps(y, h.__s)))), g = h.props, _ = h.state, h.__v = t, n.__c) {
390
402
  if (b && !A.getDerivedStateFromProps && y !== g && h.componentWillReceiveProps && h.componentWillReceiveProps(y, S), t.__v == n.__v && !(8 & h.__g) || !(4 & h.__g) && h.shouldComponentUpdate && !1 === h.shouldComponentUpdate(y, h.__s, S)) {
391
403
  t.__v != n.__v && (h.props = y, h.state = h.__s, h.__g &= -9), t.__e = n.__e, t.__k = n.__k, t.__k.some(function(e) {
392
404
  e && (e.__ = t);
393
- }), me.push.apply(h.__h, h.__k), h.__k = [], h.__h.length && o.push(h), s = L(n);
405
+ }), ve.push.apply(h.__h, h.__k), h.__k = [], h.__h.length && o.push(h), s = L(n);
394
406
  break n;
395
407
  }
396
408
  h.componentWillUpdate && h.componentWillUpdate(y, h.__s, S), b && h.componentDidUpdate && h.__h.push(function() {
397
409
  h.componentDidUpdate(g, _, v);
398
410
  });
399
411
  } else b && !A.getDerivedStateFromProps && h.componentWillMount && h.componentWillMount(), b && h.componentDidMount && h.__h.push(h.componentDidMount);
400
- if (h.context = S, h.props = y, h.__P = e, h.__g &= -5, C = N.__r, w = 0, b) h.state = h.__s, h.__g &= -9, C && C(t), u = h.render(h.props, h.state, h.context), me.push.apply(h.__h, h.__k), h.__k = [];
412
+ if (h.context = S, h.props = y, h.__P = e, h.__g &= -5, C = N.__r, w = 0, b) h.state = h.__s, h.__g &= -9, C && C(t), u = h.render(h.props, h.state, h.context), ve.push.apply(h.__h, h.__k), h.__k = [];
401
413
  else do
402
414
  h.__g &= -9, C && C(t), u = h.render(h.props, h.state, h.context), h.state = h.__s;
403
415
  while (8 & h.__g && ++w < 25);
404
416
  h.state = h.__s, h.getChildContext && (r = F({}, r, h.getChildContext())), b && n.__c && h.getSnapshotBeforeUpdate && (v = h.getSnapshotBeforeUpdate(g, _)), T = u && u.type === I && u.key == null ? u.props.children : u, y.__P && (u = s, i = (e = y.__P).namespaceURI, c = a = null, n.props && n.props.__P != e && (n.__k.some(function(e) {
405
- e && Ie(e, e);
406
- }), n.__k = null), s = n.__k ? L(n, 0) : null), s = we(e, ge(T) ? T : [T], t, n, r, i, a, o, s, c, l), y.__P && (t.__e = null, s = u), t.__u &= -161, 128 & n.__u && (h.__z = null), d && d.some(ve), h.__h.length && o.push(h), 1 & h.__g && (h.__g &= -4);
417
+ e && Be(e, e);
418
+ }), n.__k = null), s = n.__k ? L(n, 0) : null), s = Oe(e, be(T) ? T : [T], t, n, r, i, a, o, s, c, l), y.__P && (t.__e = null, s = u), t.__u &= -161, 128 & n.__u && (h.__z = null), d && d.some(Se), h.__h.length && o.push(h), 1 & h.__g && (h.__g &= -4);
407
419
  } catch (e) {
408
420
  if (o.length = m, t.__v = null, c || a) {
409
421
  if (e.then) {
@@ -424,18 +436,18 @@ function je(e, t, n, r, i, a, o, s, c, l) {
424
436
  D = s;
425
437
  }
426
438
  t.__c.__z || (t.__c.__z = D), t.__e = s;
427
- } else a && a.some(ve);
439
+ } else a && a.some(Se);
428
440
  } else t.__e = n.__e;
429
- t.__k ||= n.__k || [], e.then || Me(t), N.__e(e, t, n);
441
+ t.__k ||= n.__k || [], e.then || Ie(t), N.__e(e, t, n);
430
442
  }
431
- } else s = t.__e = Pe(n.__e, t, n, r, i, a, o, c, l, e);
443
+ } else s = t.__e = Re(n.__e, t, n, r, i, a, o, c, l, e);
432
444
  return (u = N.diffed) && u(t), 128 & t.__u ? void 0 : s;
433
445
  }
434
- function Me(e) {
435
- e && (e.__c && (e.__c.__g |= 4), e.__k && e.__k.some(Me));
446
+ function Ie(e) {
447
+ e && (e.__c && (e.__c.__g |= 4), e.__k && e.__k.some(Ie));
436
448
  }
437
- function Ne(e, t, n) {
438
- for (var r = 0; r < n.length;) Fe(n[r++], n[r++], n[r++]);
449
+ function Le(e, t, n) {
450
+ for (var r = 0; r < n.length;) ze(n[r++], n[r++], n[r++]);
439
451
  N.__c && N.__c(t, e), e.some(function(t) {
440
452
  try {
441
453
  e = t.__h, t.__h = [], e.some(function(e) {
@@ -446,8 +458,8 @@ function Ne(e, t, n) {
446
458
  }
447
459
  });
448
460
  }
449
- function Pe(e, t, n, r, i, a, o, s, c, l) {
450
- var u, d, f, p, m, h, g, _, v, y = n.props || pe, b = t.props, x = t.type;
461
+ function Re(e, t, n, r, i, a, o, s, c, l) {
462
+ var u, d, f, p, m, h, g, _, v, y = n.props || _e, b = t.props, x = t.type;
451
463
  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) {
452
464
  for (u = 0; u < a.length; u++) if ((m = a[u]) && (x ? m.localName == x : m.nodeType == 3)) {
453
465
  e = m, a[u] = null;
@@ -459,23 +471,23 @@ function Pe(e, t, n, r, i, a, o, s, c, l) {
459
471
  e = _.createElementNS(i, x, b.is && b), s &&= (N.__m && N.__m(t, a), !1), a = null;
460
472
  }
461
473
  if (x) {
462
- if (l = x == "template" ? e.content : e, a = x == "textarea" && b.defaultValue != null ? null : a && _e.call(l.childNodes), !s && a) for (y = {}, u = 0; u < e.attributes.length; u++) y[(m = e.attributes[u]).name] = m.value;
463
- 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 || ke(e, u, null, m, i);
464
- 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) || ke(e, u, m, y[u], i);
465
- 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" && he.test(x)) && (i = "http://www.w3.org/1999/xhtml"), we(l, ge(p) ? p : [p], t, n, r, i, a, o, a ? a[0] : n.__k && L(n, 0), s, c), a && a.some(ve)), s && x != "textarea" || (u = "value", x == "progress" && h == null ? e.removeAttribute(u) : h == null || h === e[u] && (x != "progress" || h) || ke(e, u, h, y[u], i), u = "checked", g != null && g != e[u] && ke(e, u, g, y[u], i));
474
+ if (l = x == "template" ? e.content : e, a = x == "textarea" && b.defaultValue != null ? null : a && xe.call(l.childNodes), !s && a) for (y = {}, u = 0; u < e.attributes.length; u++) y[(m = e.attributes[u]).name] = m.value;
475
+ 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);
476
+ 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);
477
+ 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" && ye.test(x)) && (i = "http://www.w3.org/1999/xhtml"), Oe(l, be(p) ? p : [p], t, n, r, i, a, o, a ? a[0] : n.__k && L(n, 0), s, c), a && a.some(Se)), 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));
466
478
  } else y === b || s && e.data == b || (e.data = b);
467
479
  return e;
468
480
  }
469
- function Fe(e, t, n, r) {
481
+ function ze(e, t, n, r) {
470
482
  try {
471
483
  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;
472
484
  } catch (e) {
473
485
  N.__e(e, n);
474
486
  }
475
487
  }
476
- function Ie(e, t, n) {
488
+ function Be(e, t, n) {
477
489
  var r, i;
478
- if (N.unmount && N.unmount(e), !(r = e.ref) || r.current && r.current != e.__e || Fe(r, null, t, e), r = e.__c) {
490
+ if (N.unmount && N.unmount(e), !(r = e.ref) || r.current && r.current != e.__e || ze(r, null, t, e), r = e.__c) {
479
491
  if (r.componentWillUnmount) try {
480
492
  r.componentWillUnmount();
481
493
  } catch (e) {
@@ -483,15 +495,15 @@ function Ie(e, t, n) {
483
495
  }
484
496
  r.__P = r.__n = null;
485
497
  }
486
- if (r = e.__k) for (i = 0; i < r.length; i++) r[i] && Ie(r[i], t, typeof e.type != "function" || n && !e.props.__P);
487
- (r = e.__e) && (n || ve(r), r.__e && (r.__e = null)), e.__e = e.__c = e.__ = null;
498
+ if (r = e.__k) for (i = 0; i < r.length; i++) r[i] && Be(r[i], t, typeof e.type != "function" || n && !e.props.__P);
499
+ (r = e.__e) && (n || Se(r), r.__e && (r.__e = null)), e.__e = e.__c = e.__ = null;
488
500
  }
489
- function Le(e, t, n) {
501
+ function Ve(e, t, n) {
490
502
  return this.constructor(e, n);
491
503
  }
492
- function Re(e, t) {
504
+ function He(e, t) {
493
505
  var n, r, i, a;
494
- N.__ && N.__(e, t), t.nodeType == 9 && (t = t.documentElement), r = (n = e && 32 & e.__u) ? null : t.__k, t.__k = ye(I, { children: [e] }), i = [], a = [], je(t, t.__k, r || pe, pe, t.namespaceURI, r ? null : t.firstChild ? _e.call(t.childNodes) : null, i, r ? r.__e : t.firstChild, n, a), Ne(i, t.__k, a), t.__k.props.children = null;
506
+ N.__ && N.__(e, t), t.nodeType == 9 && (t = t.documentElement), r = (n = e && 32 & e.__u) ? null : t.__k, t.__k = Ce(I, { children: [e] }), i = [], a = [], Fe(t, t.__k, r || _e, _e, t.namespaceURI, r ? null : t.firstChild ? xe.call(t.childNodes) : null, i, r ? r.__e : t.firstChild, n, a), Le(i, t.__k, a), t.__k.props.children = null;
495
507
  }
496
508
  N = { __e: function(e, t, n, r) {
497
509
  for (var i, a, o; t = t.__;) if ((i = t.__c) && !(1 & i.__g)) {
@@ -502,34 +514,34 @@ N = { __e: function(e, t, n, r) {
502
514
  e = t, o = 0;
503
515
  }
504
516
  }
505
- throw se = 0, e;
506
- } }, ae = 0, be.prototype.setState = function(e, t) {
517
+ throw de = 0, e;
518
+ } }, le = 0, we.prototype.setState = function(e, t) {
507
519
  var n = this.__s;
508
- 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), Se(this)));
509
- }, be.prototype.forceUpdate = function(e) {
510
- this.__v && (this.__g |= 4, e && this.__h.push(e), Se(this));
511
- }, be.prototype.render = I, P = [], se = 0, ce = function(e, t) {
520
+ 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)));
521
+ }, we.prototype.forceUpdate = function(e) {
522
+ this.__v && (this.__g |= 4, e && this.__h.push(e), Ee(this));
523
+ }, we.prototype.render = I, P = [], de = 0, fe = function(e, t) {
512
524
  return e.__v.__b - t.__v.__b;
513
- }, le = Symbol(), ue = /(PointerCapture)$|Capture$/i, de = 0, fe = {};
525
+ }, pe = Symbol(), me = /(PointerCapture)$|Capture$/i, he = 0, ge = {};
514
526
  //#endregion
515
527
  //#region node_modules/.pnpm/preact@11.0.1/node_modules/preact/hooks/dist/hooks.mjs
516
- var R, z, ze, Be, Ve = Object.is, He = 0, Ue = [], We = [], B = N, Ge = B.__b, Ke = B.__r, qe = B.diffed, Je = B.__c, Ye = B.unmount, Xe = B.__;
517
- function Ze(e, t) {
518
- B.__h && B.__h(z, e, He || t), He = 0;
528
+ var R, z, Ue, We, Ge = Object.is, Ke = 0, qe = [], Je = [], B = N, Ye = B.__b, Xe = B.__r, Ze = B.diffed, Qe = B.__c, $e = B.unmount, et = B.__;
529
+ function tt(e, t) {
530
+ B.__h && B.__h(z, e, Ke || t), Ke = 0;
519
531
  var n = z.__H || (z.__H = {
520
532
  __: [],
521
533
  __h: []
522
534
  });
523
535
  return e >= n.__.length && n.__.push({}), n.__[e];
524
536
  }
525
- function Qe(e) {
526
- return He = 1, $e(ct, e);
537
+ function nt(e) {
538
+ return Ke = 1, rt(ft, e);
527
539
  }
528
- function $e(e, t, n) {
529
- var r = Ze(R++, 2);
530
- if (r.t = e, !r.__c && (r.__ = [n ? n(t) : ct(void 0, t), function(e) {
540
+ function rt(e, t, n) {
541
+ var r = tt(R++, 2);
542
+ if (r.t = e, !r.__c && (r.__ = [n ? n(t) : ft(void 0, t), function(e) {
531
543
  var t = r.__N ? r.__N[0] : r.__[0], n = r.t(t, e);
532
- Ve(t, n) || (r.__N = [n, r.__[1]], r.__c.setState({}));
544
+ Ge(t, n) || (r.__N = [n, r.__[1]], r.__c.setState({}));
533
545
  }], r.__c = z, !z.__f)) {
534
546
  z.__f = !0;
535
547
  var i = z.shouldComponentUpdate;
@@ -538,7 +550,7 @@ function $e(e, t, n) {
538
550
  if (!r) return !0;
539
551
  var a = !1, o = this.props != e;
540
552
  if (r.__.some(function(e) {
541
- e.__N && (a = !0, Ve(e.__[0], e.__N[0]) || (o = !0));
553
+ e.__N && (a = !0, Ge(e.__[0], e.__N[0]) || (o = !0));
542
554
  }), i) {
543
555
  var s = i.call(this, e, t, n);
544
556
  return a ? s || o : s;
@@ -548,71 +560,71 @@ function $e(e, t, n) {
548
560
  }
549
561
  return r.__;
550
562
  }
551
- function et(e, t) {
552
- var n = Ze(R++, 3);
553
- !B.__s && st(n.__H, t) && (n.__P = !0, n.__ = e, n.u = t, z.__H.__h.push(n));
563
+ function it(e, t) {
564
+ var n = tt(R++, 3);
565
+ !B.__s && dt(n.__H, t) && (n.__P = !0, n.__ = e, n.u = t, z.__H.__h.push(n));
554
566
  }
555
567
  function V(e, t) {
556
- var n = Ze(R++, 4);
557
- !B.__s && st(n.__H, t) && (n.__P = !1, n.__ = e, n.u = t, z.__h.push(n));
568
+ var n = tt(R++, 4);
569
+ !B.__s && dt(n.__H, t) && (n.__P = !1, n.__ = e, n.u = t, z.__h.push(n));
558
570
  }
559
571
  function H(e) {
560
- return He = 5, tt(function() {
572
+ return Ke = 5, at(function() {
561
573
  return { current: e };
562
574
  }, []);
563
575
  }
564
- function tt(e, t) {
565
- var n = Ze(R++, 7);
566
- return st(n.__H, t) && (n.__ = e(), n.__H = t), n.__;
576
+ function at(e, t) {
577
+ var n = tt(R++, 7);
578
+ return dt(n.__H, t) && (n.__ = e(), n.__H = t), n.__;
567
579
  }
568
- function nt() {
580
+ function ot() {
569
581
  var e;
570
582
  do {
571
- for (; e = We.shift();) try {
583
+ for (; e = Je.shift();) try {
572
584
  U(e);
573
585
  } catch (t) {
574
586
  B.__e(t, { __: (e = e.__P) && e.__v });
575
587
  }
576
- for (; e = Ue.shift();) {
588
+ for (; e = qe.shift();) {
577
589
  var t = e.__H;
578
590
  if (e.__P && t) try {
579
- t.__h.some(U), t.__h.some(ot), t.__h = [];
591
+ t.__h.some(U), t.__h.some(ut), t.__h = [];
580
592
  } catch (n) {
581
593
  t.__h = [], B.__e(n, e.__v);
582
594
  }
583
595
  }
584
- } while (We.length);
596
+ } while (Je.length);
585
597
  }
586
598
  B.__b = function(e) {
587
- z = null, Ge && Ge(e);
599
+ z = null, Ye && Ye(e);
588
600
  }, B.__ = function(e, t) {
589
- e && t.__k && t.__k.__m && (e.__m = t.__k.__m), Xe && Xe(e, t);
601
+ e && t.__k && t.__k.__m && (e.__m = t.__k.__m), et && et(e, t);
590
602
  }, B.__r = function(e) {
591
- Ke && Ke(e), R = 0;
603
+ Xe && Xe(e), R = 0;
592
604
  var t = (z = e.__c).__H;
593
- t && (ze == z ? z.__h = [] : (t.__h.some(U), t.__h.some(ot), R = 0), t.__h = [], t.__.some(function(e) {
605
+ t && (Ue == z ? z.__h = [] : (t.__h.some(U), t.__h.some(ut), R = 0), t.__h = [], t.__.some(function(e) {
594
606
  e.__N && (e.__ = e.__N), e.u = e.__N = void 0;
595
- })), ze = z;
607
+ })), Ue = z;
596
608
  }, B.diffed = function(e) {
597
- qe && qe(e);
609
+ Ze && Ze(e);
598
610
  var t = e.__c;
599
- t && t.__H && (t.__H.__h.length && at(Ue.push(t)), t.__H.__.some(function(e) {
611
+ t && t.__H && (t.__H.__h.length && lt(qe.push(t)), t.__H.__.some(function(e) {
600
612
  e.u && (e.__H = e.u);
601
- })), ze = z = null;
613
+ })), Ue = z = null;
602
614
  }, B.__c = function(e, t) {
603
615
  t.some(function(e) {
604
616
  try {
605
617
  e.__h.some(U), e.__h = e.__h.filter(function(e) {
606
- return !e.__ || ot(e);
618
+ return !e.__ || ut(e);
607
619
  });
608
620
  } catch (n) {
609
621
  t.some(function(e) {
610
622
  e.__h &&= [];
611
623
  }), t = [], B.__e(n, e.__v);
612
624
  }
613
- }), Je && Je(e, t);
625
+ }), Qe && Qe(e, t);
614
626
  }, B.unmount = function(e) {
615
- Ye && Ye(e);
627
+ $e && $e(e);
616
628
  var t, n, r = e.__c;
617
629
  r && r.__H && (r.__H.__.some(function(r) {
618
630
  try {
@@ -621,42 +633,42 @@ B.__b = function(e) {
621
633
  for (n = e.__; n && (!n.__c || !n.__c.__P);) n = n.__;
622
634
  n &&= n.__c;
623
635
  }
624
- r.__P = n, at(We.push(r));
636
+ r.__P = n, lt(Je.push(r));
625
637
  } else U(r);
626
638
  } catch (e) {
627
639
  t = e;
628
640
  }
629
641
  }), r.__H = void 0, t && B.__e(t, r.__v));
630
642
  };
631
- var rt = typeof requestAnimationFrame == "function";
632
- function it(e) {
643
+ var st = typeof requestAnimationFrame == "function";
644
+ function ct(e) {
633
645
  var t, n = function() {
634
- clearTimeout(r), rt && cancelAnimationFrame(t), setTimeout(e);
646
+ clearTimeout(r), st && cancelAnimationFrame(t), setTimeout(e);
635
647
  }, r = setTimeout(n, 35);
636
- rt && (t = requestAnimationFrame(n));
648
+ st && (t = requestAnimationFrame(n));
637
649
  }
638
- function at(e) {
639
- e != 1 && Be == B.requestAnimationFrame || ((Be = B.requestAnimationFrame) || it)(nt);
650
+ function lt(e) {
651
+ e != 1 && We == B.requestAnimationFrame || ((We = B.requestAnimationFrame) || ct)(ot);
640
652
  }
641
653
  function U(e) {
642
654
  var t = z, n = e.__c;
643
655
  typeof n == "function" && (e.__c = void 0, n()), z = t;
644
656
  }
645
- function ot(e) {
657
+ function ut(e) {
646
658
  var t = z;
647
659
  e.__c = e.__(), z = t;
648
660
  }
649
- function st(e, t) {
661
+ function dt(e, t) {
650
662
  return !e || e.length != t.length || t.some(function(t, n) {
651
- return !Ve(t, e[n]);
663
+ return !Ge(t, e[n]);
652
664
  });
653
665
  }
654
- function ct(e, t) {
666
+ function ft(e, t) {
655
667
  return typeof t == "function" ? t(e) : t;
656
668
  }
657
669
  //#endregion
658
670
  //#region node_modules/.pnpm/preact@11.0.1/node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs
659
- var lt = 0;
671
+ var pt = 0;
660
672
  Array.isArray;
661
673
  function W(e, t, n, r, i, a) {
662
674
  t ||= {};
@@ -673,7 +685,7 @@ function W(e, t, n, r, i, a) {
673
685
  __e: null,
674
686
  __c: null,
675
687
  constructor: void 0,
676
- __v: --lt,
688
+ __v: --pt,
677
689
  __i: -1,
678
690
  __u: 0
679
691
  };
@@ -697,7 +709,7 @@ function G({ name: e, size: t, children: n }) {
697
709
  children: n
698
710
  });
699
711
  }
700
- function ut({ size: e = 26 }) {
712
+ function mt({ size: e = 26 }) {
701
713
  return /* @__PURE__ */ W(G, {
702
714
  name: "chat",
703
715
  size: e,
@@ -707,64 +719,64 @@ function ut({ size: e = 26 }) {
707
719
  })]
708
720
  });
709
721
  }
710
- function dt({ size: e = 26 }) {
722
+ function ht({ size: e = 26 }) {
711
723
  return /* @__PURE__ */ W(G, {
712
724
  name: "message",
713
725
  size: e,
714
726
  children: /* @__PURE__ */ W("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" })
715
727
  });
716
728
  }
717
- function ft({ size: e = 26 }) {
729
+ function gt({ size: e = 26 }) {
718
730
  return /* @__PURE__ */ W(G, {
719
731
  name: "sparkle",
720
732
  size: e,
721
733
  children: [/* @__PURE__ */ W("path", { d: "M11 3l1.9 5.1L18 10l-5.1 1.9L11 17l-1.9-5.1L4 10l5.1-1.9z" }), /* @__PURE__ */ W("path", { d: "M19 15l.7 1.8 1.8.7-1.8.7L19 20l-.7-1.8-1.8-.7 1.8-.7z" })]
722
734
  });
723
735
  }
724
- function pt({ size: e = 26 }) {
736
+ function _t({ size: e = 26 }) {
725
737
  return /* @__PURE__ */ W(G, {
726
738
  name: "chevron-down",
727
739
  size: e,
728
740
  children: /* @__PURE__ */ W("path", { d: "M6 9l6 6 6-6" })
729
741
  });
730
742
  }
731
- function mt({ size: e = 18 }) {
743
+ function vt({ size: e = 18 }) {
732
744
  return /* @__PURE__ */ W(G, {
733
745
  name: "close",
734
746
  size: e,
735
747
  children: /* @__PURE__ */ W("path", { d: "M6 6l12 12M18 6L6 18" })
736
748
  });
737
749
  }
738
- var ht = "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";
739
- function gt({ size: e = 16 }) {
750
+ var yt = "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";
751
+ function bt({ size: e = 16 }) {
740
752
  return /* @__PURE__ */ W(G, {
741
753
  name: "thumb-up",
742
754
  size: e,
743
- children: /* @__PURE__ */ W("path", { d: ht })
755
+ children: /* @__PURE__ */ W("path", { d: yt })
744
756
  });
745
757
  }
746
- function _t({ size: e = 16 }) {
758
+ function xt({ size: e = 16 }) {
747
759
  return /* @__PURE__ */ W(G, {
748
760
  name: "thumb-down",
749
761
  size: e,
750
762
  children: /* @__PURE__ */ W("path", {
751
- d: ht,
763
+ d: yt,
752
764
  transform: "matrix(1 0 0 -1 0 24)"
753
765
  })
754
766
  });
755
767
  }
756
768
  //#endregion
757
769
  //#region src/components/Launcher.tsx
758
- var vt = {
759
- chat: ut,
760
- message: dt,
761
- sparkle: ft
762
- }, yt = {
763
- "chevron-down": pt,
764
- close: mt
770
+ var St = {
771
+ chat: mt,
772
+ message: ht,
773
+ sparkle: gt
774
+ }, Ct = {
775
+ "chevron-down": _t,
776
+ close: vt
765
777
  };
766
- function bt({ isOpen: t, onClick: n, iconUrl: r, icon: i = "chat", openIconUrl: a, openIcon: o = "chevron-down", buttonRef: s, text: c = e }) {
767
- let [l, u] = Qe("loading"), [d, f] = Qe("loading"), p = r !== void 0 && l !== "failed", m = a !== void 0 && d !== "failed", h = p && !t && l === "loaded", g = m && t && d === "loaded", _ = vt[i] ?? ut, v = yt[o] ?? pt;
778
+ function wt({ isOpen: t, onClick: n, iconUrl: r, icon: i = "chat", openIconUrl: a, openIcon: o = "chevron-down", buttonRef: s, text: c = e }) {
779
+ let [l, u] = nt("loading"), [d, f] = nt("loading"), p = r !== void 0 && l !== "failed", m = a !== void 0 && d !== "failed", h = p && !t && l === "loaded", g = m && t && d === "loaded", _ = St[i] ?? mt, v = Ct[o] ?? _t;
768
780
  return /* @__PURE__ */ W("button", {
769
781
  type: "button",
770
782
  class: "whoo-widget-launcher",
@@ -796,7 +808,7 @@ function bt({ isOpen: t, onClick: n, iconUrl: r, icon: i = "chat", openIconUrl:
796
808
  }
797
809
  //#endregion
798
810
  //#region src/i18n/index.ts
799
- var xt = {
811
+ var Tt = {
800
812
  en: e,
801
813
  fr: {
802
814
  openChat: "Ouvrir le chat",
@@ -806,7 +818,9 @@ var xt = {
806
818
  conversation: "Conversation",
807
819
  you: "Vous",
808
820
  message: "Message",
821
+ messagePlaceholder: "Écrivez un message…",
809
822
  send: "Envoyer",
823
+ messageSent: "Message envoyé. {name} prépare une réponse.",
810
824
  lookingItUp: "Je recherche l’information pour vous…",
811
825
  goodResponse: "Réponse utile",
812
826
  badResponse: "Réponse peu utile",
@@ -822,7 +836,7 @@ var xt = {
822
836
  cancel: "Annuler",
823
837
  feedbackThanks: "Merci pour votre commentaire",
824
838
  feedbackFailed: "Impossible d’envoyer votre commentaire",
825
- conversationCleared: "Conversation effacée",
839
+ conversationCleared: "Nouvelle conversation démarrée. Les messages précédents ont été effacés.",
826
840
  genericError: "Une erreur s’est produite. Veuillez réessayer.",
827
841
  sessionExpired: "Cette session de chat a expiré. Rechargez la page pour continuer.",
828
842
  opensInNewTab: "(s’ouvre dans un nouvel onglet)",
@@ -836,7 +850,9 @@ var xt = {
836
850
  conversation: "Conversación",
837
851
  you: "Usted",
838
852
  message: "Mensaje",
853
+ messagePlaceholder: "Escriba un mensaje…",
839
854
  send: "Enviar",
855
+ messageSent: "Mensaje enviado. {name} está preparando una respuesta.",
840
856
  lookingItUp: "Estoy buscando esa información…",
841
857
  goodResponse: "Buena respuesta",
842
858
  badResponse: "Mala respuesta",
@@ -852,7 +868,7 @@ var xt = {
852
868
  cancel: "Cancelar",
853
869
  feedbackThanks: "Gracias por sus comentarios",
854
870
  feedbackFailed: "No se pudieron enviar sus comentarios",
855
- conversationCleared: "Se inició una nueva conversación",
871
+ conversationCleared: "Se inició una nueva conversación. Se borraron los mensajes anteriores.",
856
872
  genericError: "Algo salió mal. Inténtelo de nuevo.",
857
873
  sessionExpired: "Esta sesión de chat expiró. Vuelva a cargar la página para continuar.",
858
874
  opensInNewTab: "(se abre en una pestaña nueva)",
@@ -866,7 +882,9 @@ var xt = {
866
882
  conversation: "Conversa",
867
883
  you: "Você",
868
884
  message: "Mensagem",
885
+ messagePlaceholder: "Digite uma mensagem…",
869
886
  send: "Enviar",
887
+ messageSent: "Mensagem enviada. {name} está preparando uma resposta.",
870
888
  lookingItUp: "Estou buscando essa informação…",
871
889
  goodResponse: "Boa resposta",
872
890
  badResponse: "Resposta ruim",
@@ -882,7 +900,7 @@ var xt = {
882
900
  cancel: "Cancelar",
883
901
  feedbackThanks: "Agradecemos seu feedback",
884
902
  feedbackFailed: "Não foi possível enviar o feedback",
885
- conversationCleared: "Nova conversa iniciada",
903
+ conversationCleared: "Nova conversa iniciada. As mensagens anteriores foram apagadas.",
886
904
  genericError: "Algo deu errado. Tente novamente.",
887
905
  sessionExpired: "Esta sessão de chat expirou. Recarregue a página para continuar.",
888
906
  opensInNewTab: "(abre em uma nova aba)",
@@ -896,7 +914,9 @@ var xt = {
896
914
  conversation: "Unterhaltung",
897
915
  you: "Sie",
898
916
  message: "Nachricht",
917
+ messagePlaceholder: "Nachricht eingeben…",
899
918
  send: "Senden",
919
+ messageSent: "Nachricht gesendet. {name} bereitet eine Antwort vor.",
900
920
  lookingItUp: "Ich suche die Informationen für Sie heraus…",
901
921
  goodResponse: "Gute Antwort",
902
922
  badResponse: "Schlechte Antwort",
@@ -912,7 +932,7 @@ var xt = {
912
932
  cancel: "Abbrechen",
913
933
  feedbackThanks: "Danke für Ihr Feedback",
914
934
  feedbackFailed: "Feedback konnte nicht gesendet werden",
915
- conversationCleared: "Neue Unterhaltung gestartet",
935
+ conversationCleared: "Neue Unterhaltung gestartet. Die bisherigen Nachrichten wurden gelöscht.",
916
936
  genericError: "Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut.",
917
937
  sessionExpired: "Diese Chat-Sitzung ist abgelaufen. Laden Sie die Seite neu, um fortzufahren.",
918
938
  opensInNewTab: "(öffnet sich in neuem Tab)",
@@ -926,7 +946,9 @@ var xt = {
926
946
  conversation: "Conversazione",
927
947
  you: "Tu",
928
948
  message: "Messaggio",
949
+ messagePlaceholder: "Scrivi un messaggio…",
929
950
  send: "Invia",
951
+ messageSent: "Messaggio inviato. {name} sta preparando una risposta.",
930
952
  lookingItUp: "Sto cercando le informazioni richieste…",
931
953
  goodResponse: "Risposta utile",
932
954
  badResponse: "Risposta non utile",
@@ -942,7 +964,7 @@ var xt = {
942
964
  cancel: "Annulla",
943
965
  feedbackThanks: "Grazie per il feedback",
944
966
  feedbackFailed: "Impossibile inviare il feedback",
945
- conversationCleared: "Nuova conversazione avviata",
967
+ conversationCleared: "Nuova conversazione avviata. I messaggi precedenti sono stati cancellati.",
946
968
  genericError: "Si è verificato un errore. Riprovi.",
947
969
  sessionExpired: "Questa sessione di chat è scaduta. Ricarichi la pagina per continuare.",
948
970
  opensInNewTab: "(si apre in una nuova scheda)",
@@ -956,7 +978,9 @@ var xt = {
956
978
  conversation: "会話",
957
979
  you: "あなた",
958
980
  message: "メッセージ",
981
+ messagePlaceholder: "メッセージを入力…",
959
982
  send: "送信",
983
+ messageSent: "メッセージを送信しました。{name}が回答を準備しています。",
960
984
  lookingItUp: "確認しています…",
961
985
  goodResponse: "良い回答",
962
986
  badResponse: "良くない回答",
@@ -972,7 +996,7 @@ var xt = {
972
996
  cancel: "キャンセル",
973
997
  feedbackThanks: "フィードバックありがとうございます",
974
998
  feedbackFailed: "フィードバックを送信できませんでした",
975
- conversationCleared: "会話を消去しました",
999
+ conversationCleared: "新しい会話を開始しました。以前のメッセージは消去されました。",
976
1000
  genericError: "エラーが発生しました。もう一度お試しください。",
977
1001
  sessionExpired: "このチャットセッションの有効期限が切れました。続けるにはページを再読み込みしてください。",
978
1002
  opensInNewTab: "(新しいタブで開きます)",
@@ -986,7 +1010,9 @@ var xt = {
986
1010
  conversation: "对话",
987
1011
  you: "您",
988
1012
  message: "消息",
1013
+ messagePlaceholder: "输入消息…",
989
1014
  send: "发送",
1015
+ messageSent: "消息已发送。{name}正在准备回复。",
990
1016
  lookingItUp: "正在为您查找……",
991
1017
  goodResponse: "回答很好",
992
1018
  badResponse: "回答不好",
@@ -1002,7 +1028,7 @@ var xt = {
1002
1028
  cancel: "取消",
1003
1029
  feedbackThanks: "感谢您的反馈",
1004
1030
  feedbackFailed: "反馈提交失败",
1005
- conversationCleared: "对话已清除",
1031
+ conversationCleared: "已开始新对话。之前的消息已清除。",
1006
1032
  genericError: "出了点问题,请重试。",
1007
1033
  sessionExpired: "此聊天会话已过期。请刷新页面后继续。",
1008
1034
  opensInNewTab: "(将在新标签页中打开)",
@@ -1016,7 +1042,9 @@ var xt = {
1016
1042
  conversation: "Диалог",
1017
1043
  you: "Вы",
1018
1044
  message: "Сообщение",
1045
+ messagePlaceholder: "Введите сообщение…",
1019
1046
  send: "Отправить",
1047
+ messageSent: "Сообщение отправлено. {name} готовит ответ.",
1020
1048
  lookingItUp: "Ищу информацию…",
1021
1049
  goodResponse: "Хороший ответ",
1022
1050
  badResponse: "Плохой ответ",
@@ -1032,7 +1060,7 @@ var xt = {
1032
1060
  cancel: "Отмена",
1033
1061
  feedbackThanks: "Спасибо за отзыв",
1034
1062
  feedbackFailed: "Не удалось отправить отзыв",
1035
- conversationCleared: "Диалог очищен",
1063
+ conversationCleared: "Начат новый диалог. Предыдущие сообщения удалены.",
1036
1064
  genericError: "Что-то пошло не так. Попробуйте ещё раз.",
1037
1065
  sessionExpired: "Срок действия сеанса чата истёк. Перезагрузите страницу, чтобы продолжить.",
1038
1066
  opensInNewTab: "(откроется в новой вкладке)",
@@ -1046,7 +1074,9 @@ var xt = {
1046
1074
  conversation: "बातचीत",
1047
1075
  you: "आप",
1048
1076
  message: "संदेश",
1077
+ messagePlaceholder: "संदेश लिखें…",
1049
1078
  send: "भेजें",
1079
+ messageSent: "संदेश भेज दिया गया। {name} द्वारा जवाब तैयार किया जा रहा है।",
1050
1080
  lookingItUp: "आपके लिए जानकारी खोजी जा रही है…",
1051
1081
  goodResponse: "अच्छा जवाब",
1052
1082
  badResponse: "ख़राब जवाब",
@@ -1062,7 +1092,7 @@ var xt = {
1062
1092
  cancel: "रद्द करें",
1063
1093
  feedbackThanks: "आपके फ़ीडबैक के लिए धन्यवाद",
1064
1094
  feedbackFailed: "फ़ीडबैक नहीं भेजा जा सका",
1065
- conversationCleared: "बातचीत मिटा दी गई",
1095
+ conversationCleared: "नई बातचीत शुरू हुई। पिछले संदेश मिटा दिए गए।",
1066
1096
  genericError: "कुछ ग़लत हो गया। कृपया फिर से कोशिश करें।",
1067
1097
  sessionExpired: "यह चैट सत्र समाप्त हो गया है। जारी रखने के लिए पेज को फिर से लोड करें।",
1068
1098
  opensInNewTab: "(नए टैब में खुलता है)",
@@ -1076,7 +1106,9 @@ var xt = {
1076
1106
  conversation: "المحادثة",
1077
1107
  you: "أنت",
1078
1108
  message: "الرسالة",
1109
+ messagePlaceholder: "كتابة رسالة…",
1079
1110
  send: "إرسال",
1111
+ messageSent: "تم إرسال الرسالة. جارٍ إعداد الرد من قِبل {name}.",
1080
1112
  lookingItUp: "جارٍ البحث عن المعلومات…",
1081
1113
  goodResponse: "إجابة جيدة",
1082
1114
  badResponse: "إجابة سيئة",
@@ -1092,51 +1124,51 @@ var xt = {
1092
1124
  cancel: "إلغاء",
1093
1125
  feedbackThanks: "شكرًا على ملاحظاتك",
1094
1126
  feedbackFailed: "تعذّر إرسال الملاحظات",
1095
- conversationCleared: "تم مسح المحادثة",
1127
+ conversationCleared: "بدأت محادثة جديدة. تم مسح الرسائل السابقة.",
1096
1128
  genericError: "حدث خطأ ما. يُرجى المحاولة مرة أخرى.",
1097
1129
  sessionExpired: "انتهت صلاحية جلسة الدردشة هذه. يُرجى إعادة تحميل الصفحة للمتابعة.",
1098
1130
  opensInNewTab: "(يُفتح في علامة تبويب جديدة)",
1099
1131
  agreeToNotice: "أوافق"
1100
1132
  }
1101
- }, St = Object.freeze(Object.keys(xt)), Ct = {
1133
+ }, Et = Object.freeze(Object.keys(Tt)), Dt = {
1102
1134
  pt: "pt-BR",
1103
1135
  es: "es-419",
1104
1136
  zh: "zh-Hans"
1105
- }, wt = /* @__PURE__ */ new Set(["ar"]), Tt = /^[a-z]{2,8}([-_][a-z0-9]{1,8})*$/i, Et = /^zh[-_](hant|tw|hk|mo)(?=$|[-_])/i;
1106
- function Dt(e) {
1107
- return xt[e];
1137
+ }, Ot = /* @__PURE__ */ new Set(["ar"]), kt = /^[a-z]{2,8}([-_][a-z0-9]{1,8})*$/i, At = /^zh[-_](hant|tw|hk|mo)(?=$|[-_])/i;
1138
+ function jt(e) {
1139
+ return Tt[e];
1108
1140
  }
1109
- function Ot(e) {
1141
+ function Mt(e) {
1110
1142
  let t = e.trim();
1111
- if (!Tt.test(t) || Et.test(t)) return null;
1143
+ if (!kt.test(t) || At.test(t)) return null;
1112
1144
  let n = t.split(/[-_]/)[0].toLowerCase();
1113
- return Object.hasOwn(xt, n) ? n : null;
1145
+ return Object.hasOwn(Tt, n) ? n : null;
1114
1146
  }
1115
- function kt(e, t) {
1147
+ function Nt(e, t) {
1116
1148
  let n = null;
1117
- return e != null && e !== "" && (n = typeof e == "string" ? Ot(e) : null, n || console.warn(`whoo-aiden-widget: ignoring \`language\` ${At(e)} -- expected one of ${St.join(", ")} (or a regional tag like pt-BR). Using the page's language instead.`)), n ??= typeof t == "string" ? Ot(t) : null, n ??= "en", {
1149
+ return e != null && e !== "" && (n = typeof e == "string" ? Mt(e) : null, n || console.warn(`whoo-aiden-widget: ignoring \`language\` ${Pt(e)} -- expected one of ${Et.join(", ")} (or a regional tag like pt-BR). Using the page's language instead.`)), n ??= typeof t == "string" ? Mt(t) : null, n ??= "en", {
1118
1150
  language: n,
1119
- tag: Ct[n] ?? n,
1120
- dir: wt.has(n) ? "rtl" : "ltr"
1151
+ tag: Dt[n] ?? n,
1152
+ dir: Ot.has(n) ? "rtl" : "ltr"
1121
1153
  };
1122
1154
  }
1123
- function At(e) {
1155
+ function Pt(e) {
1124
1156
  return typeof e == "string" ? JSON.stringify(e) : `(a ${typeof e})`;
1125
1157
  }
1126
- function jt(e) {
1158
+ function Ft(e) {
1127
1159
  if (typeof e != "string") return null;
1128
1160
  let t = e.trim().replace(/_/g, "-");
1129
- return Tt.test(t) ? t : null;
1161
+ return kt.test(t) ? t : null;
1130
1162
  }
1131
- function Mt(e, t, n) {
1163
+ function It(e, t, n) {
1132
1164
  if (e != null && e !== "") {
1133
- let t = jt(e);
1165
+ let t = Ft(e);
1134
1166
  if (t) return t;
1135
- console.warn(`whoo-aiden-widget: ignoring \`contentLanguage\` ${At(e)} -- expected a language tag such as 'nl' or 'pt-BR'. Using the page's language instead.`);
1167
+ console.warn(`whoo-aiden-widget: ignoring \`contentLanguage\` ${Pt(e)} -- expected a language tag such as 'nl' or 'pt-BR'. Using the page's language instead.`);
1136
1168
  }
1137
- return jt(t) ?? jt(n) ?? "";
1169
+ return Ft(t) ?? Ft(n) ?? "";
1138
1170
  }
1139
- function Nt(e) {
1171
+ function Lt(e) {
1140
1172
  let t = e.indexOf("{name}");
1141
1173
  return t === -1 ? {
1142
1174
  before: e,
@@ -1148,21 +1180,24 @@ function Nt(e) {
1148
1180
  hasName: !0
1149
1181
  };
1150
1182
  }
1183
+ function Rt(e, t) {
1184
+ return e.split("{name}").join(t.name);
1185
+ }
1151
1186
  //#endregion
1152
1187
  //#region src/viewport.ts
1153
- var Pt = "(max-width: 400px), (max-height: 420px)", Ft = "data-fit-visible", It = 40;
1154
- function Lt(e) {
1188
+ var zt = "(max-width: 400px), (max-height: 420px)", Bt = "data-fit-visible", Vt = 40;
1189
+ function Ht(e) {
1155
1190
  let t = typeof window < "u" ? window.visualViewport : null;
1156
1191
  if (!t) return () => {};
1157
1192
  let n = () => {
1158
- e.removeAttribute(Ft), e.style.removeProperty("--whoo-widget-visible-top"), e.style.removeProperty("--whoo-widget-visible-height");
1193
+ e.removeAttribute(Bt), e.style.removeProperty("--whoo-widget-visible-top"), e.style.removeProperty("--whoo-widget-visible-height");
1159
1194
  }, r = () => {
1160
1195
  let r = document.documentElement.clientHeight, i = Math.abs(t.scale - 1) > .01, a = r - t.height;
1161
- if (i || r === 0 || a < It) {
1196
+ if (i || r === 0 || a < Vt) {
1162
1197
  n();
1163
1198
  return;
1164
1199
  }
1165
- e.setAttribute(Ft, ""), e.style.setProperty("--whoo-widget-visible-top", `${Math.max(0, t.offsetTop)}px`), e.style.setProperty("--whoo-widget-visible-height", `${t.height}px`);
1200
+ e.setAttribute(Bt, ""), e.style.setProperty("--whoo-widget-visible-top", `${Math.max(0, t.offsetTop)}px`), e.style.setProperty("--whoo-widget-visible-height", `${t.height}px`);
1166
1201
  let o = e.getRootNode().activeElement;
1167
1202
  o && e.contains(o) && typeof o.scrollIntoView == "function" && o.scrollIntoView({ block: "nearest" });
1168
1203
  };
@@ -1170,43 +1205,43 @@ function Lt(e) {
1170
1205
  t.removeEventListener("resize", r), t.removeEventListener("scroll", r), n();
1171
1206
  };
1172
1207
  }
1173
- function Rt(e, t) {
1208
+ function Ut(e, t) {
1174
1209
  return typeof e.addEventListener == "function" ? (e.addEventListener("change", t), () => e.removeEventListener("change", t)) : typeof e.addListener == "function" ? (e.addListener(t), () => e.removeListener(t)) : () => {};
1175
1210
  }
1176
- var zt = 0, Bt = "";
1177
- function Vt() {
1178
- zt++ === 0 && (Bt = document.documentElement.style.overflow, document.documentElement.style.overflow = "hidden");
1211
+ var Wt = 0, Gt = "";
1212
+ function Kt() {
1213
+ Wt++ === 0 && (Gt = document.documentElement.style.overflow, document.documentElement.style.overflow = "hidden");
1179
1214
  }
1180
- function Ht() {
1181
- --zt === 0 && (document.documentElement.style.overflow = Bt);
1215
+ function qt() {
1216
+ --Wt === 0 && (document.documentElement.style.overflow = Gt);
1182
1217
  }
1183
- function Ut() {
1218
+ function Jt() {
1184
1219
  if (typeof window > "u" || typeof window.matchMedia != "function") return () => {};
1185
- let e = window.matchMedia(Pt), t = !1, n = () => {
1186
- e.matches && !t ? (t = !0, Vt()) : !e.matches && t && (t = !1, Ht());
1220
+ let e = window.matchMedia(zt), t = !1, n = () => {
1221
+ e.matches && !t ? (t = !0, Kt()) : !e.matches && t && (t = !1, qt());
1187
1222
  };
1188
1223
  n();
1189
- let r = Rt(e, n);
1224
+ let r = Ut(e, n);
1190
1225
  return () => {
1191
- r(), t && (t = !1, Ht());
1226
+ r(), t && (t = !1, qt());
1192
1227
  };
1193
1228
  }
1194
- function Wt(e) {
1229
+ function Yt(e) {
1195
1230
  if (typeof window > "u" || typeof window.matchMedia != "function" || typeof e.showModal != "function") return () => {};
1196
- let t = window.matchMedia(Pt), n = !1, r = () => {
1231
+ let t = window.matchMedia(zt), n = !1, r = () => {
1197
1232
  if (t.matches === n || !e.isConnected) return;
1198
1233
  n = t.matches;
1199
1234
  let r = e.getRootNode().activeElement;
1200
1235
  e.close(), n ? e.showModal() : e.show(), r && e.contains(r) && r.focus({ preventScroll: !0 });
1201
1236
  };
1202
- return r(), Rt(t, r);
1237
+ return r(), Ut(t, r);
1203
1238
  }
1204
1239
  //#endregion
1205
1240
  //#region src/components/Composer.tsx
1206
- function Gt(e) {
1241
+ function Xt(e) {
1207
1242
  return e.isComposing || e.keyCode === 229;
1208
1243
  }
1209
- function Kt({ value: t, onChange: n, onSend: r, disabled: i, inputRef: a, text: o = e, contentLanguage: s }) {
1244
+ function Zt({ value: t, onChange: n, onSend: r, disabled: i, inputRef: a, text: o = e, contentLanguage: s }) {
1210
1245
  return /* @__PURE__ */ W("div", {
1211
1246
  class: "whoo-widget-composer",
1212
1247
  children: [
@@ -1220,13 +1255,14 @@ function Kt({ value: t, onChange: n, onSend: r, disabled: i, inputRef: a, text:
1220
1255
  class: "whoo-widget-composer-input",
1221
1256
  lang: s,
1222
1257
  autoFocus: !0,
1258
+ placeholder: o.messagePlaceholder,
1223
1259
  value: t,
1224
1260
  readOnly: i,
1225
1261
  "aria-disabled": i,
1226
1262
  ref: a,
1227
1263
  onInput: (e) => n(e.target.value),
1228
1264
  onKeyDown: (e) => {
1229
- e.key === "Enter" && !Gt(e) && r();
1265
+ e.key === "Enter" && !Xt(e) && r();
1230
1266
  }
1231
1267
  }),
1232
1268
  /* @__PURE__ */ W("button", {
@@ -1243,7 +1279,7 @@ function Kt({ value: t, onChange: n, onSend: r, disabled: i, inputRef: a, text:
1243
1279
  }
1244
1280
  //#endregion
1245
1281
  //#region src/components/ErrorBanner.tsx
1246
- function qt({ message: e }) {
1282
+ function Qt({ message: e }) {
1247
1283
  return /* @__PURE__ */ W("div", {
1248
1284
  class: "whoo-widget-error-banner",
1249
1285
  role: "alert",
@@ -1252,8 +1288,8 @@ function qt({ message: e }) {
1252
1288
  }
1253
1289
  //#endregion
1254
1290
  //#region src/markdown/tokenizer.ts
1255
- var Jt = /\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/y, Yt = /\*\*([^*\s](?:[^*]*[^*\s])?)\*\*/y, Xt = /(?<![A-Za-z0-9_])_([^_\s](?:[^_]*[^_\s])?)_(?![A-Za-z0-9_])/y, Zt = /\*([^*\s](?:[^*]*[^*\s])?)\*/y, Qt = /[ \t]*[*+-][ \t]+/y, $t = /https?:\/\/\S+/y, en = /[.,;:!?)\]}>]+$/;
1256
- function tn(e) {
1291
+ var K = /\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/y, $t = /\*\*([^*\s](?:[^*]*[^*\s])?)\*\*/y, en = /(?<![A-Za-z0-9_])_([^_\s](?:[^_]*[^_\s])?)_(?![A-Za-z0-9_])/y, tn = /\*([^*\s](?:[^*]*[^*\s])?)\*/y, nn = /[ \t]*[*+-][ \t]+/y, rn = /https?:\/\/\S+/y, an = /[.,;:!?)\]}>]+$/;
1292
+ function on(e) {
1257
1293
  let t = [], n = 0, r = 0, i = (n) => {
1258
1294
  n > r && t.push({
1259
1295
  type: "text",
@@ -1263,13 +1299,13 @@ function tn(e) {
1263
1299
  });
1264
1300
  };
1265
1301
  for (; n < e.length;) {
1266
- if ((n === 0 || e[n - 1] === "\n") && (Qt.lastIndex = n, Qt.exec(e))) {
1302
+ if ((n === 0 || e[n - 1] === "\n") && (nn.lastIndex = n, nn.exec(e))) {
1267
1303
  i(n), t.push({
1268
1304
  type: "text",
1269
1305
  value: "• ",
1270
1306
  start: n,
1271
- end: Qt.lastIndex
1272
- }), n = Qt.lastIndex, r = n;
1307
+ end: nn.lastIndex
1308
+ }), n = nn.lastIndex, r = n;
1273
1309
  continue;
1274
1310
  }
1275
1311
  if (e[n] === "!" && n + 1 < e.length && e[n + 1] === "[") {
@@ -1282,56 +1318,56 @@ function tn(e) {
1282
1318
  }
1283
1319
  }
1284
1320
  if (e[n - 1] !== "!") {
1285
- Jt.lastIndex = n;
1286
- let a = Jt.exec(e);
1321
+ K.lastIndex = n;
1322
+ let a = K.exec(e);
1287
1323
  if (a) {
1288
1324
  i(n), t.push({
1289
1325
  type: "link",
1290
1326
  text: a[1],
1291
1327
  url: a[2],
1292
1328
  start: n,
1293
- end: Jt.lastIndex
1294
- }), n = Jt.lastIndex, r = n;
1329
+ end: K.lastIndex
1330
+ }), n = K.lastIndex, r = n;
1295
1331
  continue;
1296
1332
  }
1297
1333
  }
1298
- Yt.lastIndex = n;
1299
- let a = Yt.exec(e);
1334
+ $t.lastIndex = n;
1335
+ let a = $t.exec(e);
1300
1336
  if (a) {
1301
1337
  i(n), t.push({
1302
1338
  type: "bold",
1303
1339
  value: a[1],
1304
1340
  start: n,
1305
- end: Yt.lastIndex
1306
- }), n = Yt.lastIndex, r = n;
1341
+ end: $t.lastIndex
1342
+ }), n = $t.lastIndex, r = n;
1307
1343
  continue;
1308
1344
  }
1309
- Xt.lastIndex = n;
1310
- let o = Xt.exec(e);
1345
+ en.lastIndex = n;
1346
+ let o = en.exec(e);
1311
1347
  if (o) {
1312
1348
  i(n), t.push({
1313
1349
  type: "italic",
1314
1350
  value: o[1],
1315
1351
  start: n,
1316
- end: Xt.lastIndex
1317
- }), n = Xt.lastIndex, r = n;
1352
+ end: en.lastIndex
1353
+ }), n = en.lastIndex, r = n;
1318
1354
  continue;
1319
1355
  }
1320
- Zt.lastIndex = n;
1321
- let s = Zt.exec(e);
1356
+ tn.lastIndex = n;
1357
+ let s = tn.exec(e);
1322
1358
  if (s) {
1323
1359
  i(n), t.push({
1324
1360
  type: "italic",
1325
1361
  value: s[1],
1326
1362
  start: n,
1327
- end: Zt.lastIndex
1328
- }), n = Zt.lastIndex, r = n;
1363
+ end: tn.lastIndex
1364
+ }), n = tn.lastIndex, r = n;
1329
1365
  continue;
1330
1366
  }
1331
- $t.lastIndex = n;
1332
- let c = $t.exec(e);
1367
+ rn.lastIndex = n;
1368
+ let c = rn.exec(e);
1333
1369
  if (c) {
1334
- let e = c[0].match(en), a = e ? c[0].slice(0, c[0].length - e[0].length) : c[0];
1370
+ let e = c[0].match(an), a = e ? c[0].slice(0, c[0].length - e[0].length) : c[0];
1335
1371
  if (a.length > 0) {
1336
1372
  i(n), t.push({
1337
1373
  type: "link",
@@ -1349,12 +1385,12 @@ function tn(e) {
1349
1385
  }
1350
1386
  //#endregion
1351
1387
  //#region src/markdown/render.tsx
1352
- var nn = /^[ \t]*[*+-][ \t]+(.*)$/, rn = /[\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;
1353
- function an(e) {
1388
+ var sn = /^[ \t]*[*+-][ \t]+(.*)$/, cn = /[\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;
1389
+ function ln(e) {
1354
1390
  let t = e.match(/\p{L}/u)?.[0];
1355
- if (t) return rn.test(t) ? "rtl" : "ltr";
1391
+ if (t) return cn.test(t) ? "rtl" : "ltr";
1356
1392
  }
1357
- function on(e) {
1393
+ function un(e) {
1358
1394
  let t = [], n = [], r = [], i = () => {
1359
1395
  n.length > 0 && t.push({
1360
1396
  type: "text",
@@ -1367,7 +1403,7 @@ function on(e) {
1367
1403
  }), r = [];
1368
1404
  };
1369
1405
  for (let t of e.split("\n")) {
1370
- let e = t.match(nn);
1406
+ let e = t.match(sn);
1371
1407
  e ? (i(), r.push(e[1])) : (a(), n.push(t));
1372
1408
  }
1373
1409
  return i(), a(), t.some((e) => e.type === "list") ? t.flatMap((e, n) => {
@@ -1379,11 +1415,11 @@ function on(e) {
1379
1415
  }];
1380
1416
  }) : null;
1381
1417
  }
1382
- function K(e, t = {}) {
1383
- return tn(e).map((e, n) => {
1418
+ function q(e, t = {}) {
1419
+ return on(e).map((e, n) => {
1384
1420
  switch (e.type) {
1385
- case "bold": return /* @__PURE__ */ W("strong", { children: K(e.value, t) }, n);
1386
- case "italic": return /* @__PURE__ */ W("em", { children: K(e.value, t) }, n);
1421
+ case "bold": return /* @__PURE__ */ W("strong", { children: q(e.value, t) }, n);
1422
+ case "italic": return /* @__PURE__ */ W("em", { children: q(e.value, t) }, n);
1387
1423
  case "link": return /* @__PURE__ */ W("a", {
1388
1424
  href: e.url,
1389
1425
  target: "_blank",
@@ -1398,20 +1434,20 @@ function K(e, t = {}) {
1398
1434
  }
1399
1435
  });
1400
1436
  }
1401
- function sn(e, t = {}) {
1402
- let n = e.replace(/\r\n?/g, "\n"), r = on(n);
1437
+ function dn(e, t = {}) {
1438
+ let n = e.replace(/\r\n?/g, "\n"), r = un(n);
1403
1439
  return r ? r.map((e, n) => e.type === "list" ? /* @__PURE__ */ W("ul", {
1404
1440
  class: "whoo-widget-list",
1405
- dir: an(e.items.find((e) => an(e)) ?? ""),
1441
+ dir: ln(e.items.find((e) => ln(e)) ?? ""),
1406
1442
  children: e.items.map((e, n) => /* @__PURE__ */ W("li", {
1407
- dir: an(e),
1408
- children: K(e, t)
1443
+ dir: ln(e),
1444
+ children: q(e, t)
1409
1445
  }, n))
1410
- }, n) : /* @__PURE__ */ W("span", { children: K(e.text, t) }, n)) : K(n, t);
1446
+ }, n) : /* @__PURE__ */ W("span", { children: q(e.text, t) }, n)) : q(n, t);
1411
1447
  }
1412
1448
  //#endregion
1413
1449
  //#region src/components/MessageFeedback.tsx
1414
- function cn(e) {
1450
+ function fn(e) {
1415
1451
  return [
1416
1452
  {
1417
1453
  value: "",
@@ -1435,7 +1471,7 @@ function cn(e) {
1435
1471
  }
1436
1472
  ];
1437
1473
  }
1438
- function ln({ state: t, containerRef: n, onThumbsUp: r, onThumbsDown: i, onDraftChange: a, onSubmitDetailed: o, onCancel: s, text: c = e, contentLanguage: l }) {
1474
+ function pn({ state: t, containerRef: n, onThumbsUp: r, onThumbsDown: i, onDraftChange: a, onSubmitDetailed: o, onCancel: s, text: c = e, contentLanguage: l }) {
1439
1475
  let u = t.correction ?? "", d = t.category ?? "", f = H(t.status), p = H(null), m = H(null);
1440
1476
  if (V(() => {
1441
1477
  let e = f.current;
@@ -1471,7 +1507,7 @@ function ln({ state: t, containerRef: n, onThumbsUp: r, onThumbsDown: i, onDraft
1471
1507
  "aria-label": c.feedbackCategory,
1472
1508
  value: d,
1473
1509
  onChange: (e) => a(u, e.target.value),
1474
- children: cn(c).map((e) => /* @__PURE__ */ W("option", {
1510
+ children: fn(c).map((e) => /* @__PURE__ */ W("option", {
1475
1511
  value: e.value,
1476
1512
  children: e.label
1477
1513
  }, e.value))
@@ -1504,7 +1540,7 @@ function ln({ state: t, containerRef: n, onThumbsUp: r, onThumbsDown: i, onDraft
1504
1540
  onClick: () => {
1505
1541
  h || r();
1506
1542
  },
1507
- children: /* @__PURE__ */ W(gt, {})
1543
+ children: /* @__PURE__ */ W(bt, {})
1508
1544
  }), /* @__PURE__ */ W("button", {
1509
1545
  ref: m,
1510
1546
  type: "button",
@@ -1513,7 +1549,7 @@ function ln({ state: t, containerRef: n, onThumbsUp: r, onThumbsDown: i, onDraft
1513
1549
  onClick: () => {
1514
1550
  h || i();
1515
1551
  },
1516
- children: /* @__PURE__ */ W(_t, {})
1552
+ children: /* @__PURE__ */ W(xt, {})
1517
1553
  })]
1518
1554
  }), /* @__PURE__ */ W("div", {
1519
1555
  role: "status",
@@ -1524,10 +1560,9 @@ function ln({ state: t, containerRef: n, onThumbsUp: r, onThumbsDown: i, onDraft
1524
1560
  }
1525
1561
  //#endregion
1526
1562
  //#region src/components/MessageList.tsx
1527
- function un({ isSlowResponse: e, text: t }) {
1563
+ function mn({ isSlowResponse: e, text: t }) {
1528
1564
  return /* @__PURE__ */ W("div", {
1529
1565
  class: "whoo-widget-pending",
1530
- role: "status",
1531
1566
  children: [/* @__PURE__ */ W("span", {
1532
1567
  class: "whoo-widget-typing",
1533
1568
  "aria-hidden": "true",
@@ -1542,8 +1577,8 @@ function un({ isSlowResponse: e, text: t }) {
1542
1577
  }) : null]
1543
1578
  });
1544
1579
  }
1545
- function dn({ url: e, alt: t, lang: n }) {
1546
- let [r, i] = Qe(!1);
1580
+ function hn({ url: e, alt: t, lang: n }) {
1581
+ let [r, i] = nt(!1);
1547
1582
  return r ? null : /* @__PURE__ */ W("img", {
1548
1583
  class: "whoo-widget-empty-state-image",
1549
1584
  src: e,
@@ -1553,24 +1588,38 @@ function dn({ url: e, alt: t, lang: n }) {
1553
1588
  onError: () => i(!0)
1554
1589
  });
1555
1590
  }
1556
- var fn = "whoo-widget-notice";
1557
- function pn({ notice: e, text: t, contentLanguage: n, languageTag: r }) {
1558
- return /* @__PURE__ */ W("div", {
1559
- id: fn,
1591
+ var gn = "whoo-widget-notice";
1592
+ function _n({ notice: e, placement: t = "top", text: n, contentLanguage: r, languageTag: i }) {
1593
+ return t === "footer" ? /* @__PURE__ */ W("div", {
1594
+ id: gn,
1595
+ class: "whoo-widget-notice-footer",
1596
+ role: "note",
1597
+ tabIndex: 0,
1598
+ children: /* @__PURE__ */ W("div", {
1599
+ class: "whoo-widget-message-text",
1600
+ dir: "auto",
1601
+ lang: r,
1602
+ children: dn(e, {
1603
+ linkCue: n.opensInNewTab,
1604
+ linkCueLang: i
1605
+ })
1606
+ })
1607
+ }) : /* @__PURE__ */ W("div", {
1608
+ id: gn,
1560
1609
  class: "whoo-widget-notice",
1561
1610
  role: "note",
1562
1611
  children: /* @__PURE__ */ W("div", {
1563
1612
  class: "whoo-widget-message-text",
1564
1613
  dir: "auto",
1565
- lang: n,
1566
- children: sn(e, {
1567
- linkCue: t.opensInNewTab,
1568
- linkCueLang: r
1614
+ lang: r,
1615
+ children: dn(e, {
1616
+ linkCue: n.opensInNewTab,
1617
+ linkCueLang: i
1569
1618
  })
1570
1619
  })
1571
1620
  });
1572
1621
  }
1573
- function mn({ 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 }) {
1622
+ function vn({ 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 }) {
1574
1623
  let m = H(null), h = e.id;
1575
1624
  return /* @__PURE__ */ W("div", {
1576
1625
  ref: m,
@@ -1588,19 +1637,19 @@ function mn({ message: e, speaker: t, feedbackState: n, showFeedback: r, pending
1588
1637
  " "
1589
1638
  ]
1590
1639
  }),
1591
- i ? /* @__PURE__ */ W(un, {
1640
+ i ? /* @__PURE__ */ W(mn, {
1592
1641
  isSlowResponse: a,
1593
1642
  text: d
1594
1643
  }) : /* @__PURE__ */ W("div", {
1595
1644
  class: "whoo-widget-message-text",
1596
1645
  dir: "auto",
1597
1646
  lang: f,
1598
- children: sn(e.content, {
1647
+ children: dn(e.content, {
1599
1648
  linkCue: d.opensInNewTab,
1600
1649
  linkCueLang: p
1601
1650
  })
1602
1651
  }),
1603
- r && e.role === "assistant" && h ? /* @__PURE__ */ W(ln, {
1652
+ r && e.role === "assistant" && h ? /* @__PURE__ */ W(pn, {
1604
1653
  state: n,
1605
1654
  containerRef: m,
1606
1655
  onThumbsUp: () => o(h),
@@ -1614,90 +1663,105 @@ function mn({ message: e, speaker: t, feedbackState: n, showFeedback: r, pending
1614
1663
  ]
1615
1664
  });
1616
1665
  }
1617
- function hn({ messages: t, messageFeedback: n, announcement: r, emptyStateImage: i, notice: a, agentName: o = l, showFeedback: s = !1, isStreaming: c = !1, isSlowResponse: u = !1, onThumbsUp: d, onThumbsDown: f, onDraftChange: p = () => {}, onSubmitDetailed: m, onCancelFeedback: h, text: g = e, contentLanguage: _, languageTag: v, announcementIsContent: y = !1 }) {
1618
- let b = H(null), x = !!a && !t.some((e) => e.role === "user");
1619
- return et(() => {
1620
- let e = b.current;
1621
- e && (e.scrollTop = x ? 0 : e.scrollHeight);
1666
+ function yn({ 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 }) {
1667
+ let S = H(null), C = !!s && !t.some((e) => e.role === "user");
1668
+ it(() => {
1669
+ let e = S.current;
1670
+ e && (e.scrollTop = C ? 0 : e.scrollHeight);
1622
1671
  }, [
1623
1672
  t,
1624
- u,
1625
- x
1626
- ]), /* @__PURE__ */ W(I, { children: [/* @__PURE__ */ W("section", {
1627
- class: "whoo-widget-message-list",
1628
- ref: b,
1629
- "aria-label": g.conversation,
1673
+ f,
1674
+ C
1675
+ ]);
1676
+ let w = i ? /* @__PURE__ */ W(hn, {
1677
+ ...i,
1678
+ lang: y
1679
+ }) : null, T = a && t.length === 0 && (i || o);
1680
+ return /* @__PURE__ */ W(I, { children: [/* @__PURE__ */ W("section", {
1681
+ class: `whoo-widget-message-list${T ? " whoo-widget-message-list--centered" : ""}`,
1682
+ ref: S,
1683
+ "aria-label": v.conversation,
1630
1684
  tabIndex: 0,
1631
1685
  children: [
1632
- i ? /* @__PURE__ */ W(dn, {
1633
- ...i,
1634
- lang: _
1686
+ a ? null : w,
1687
+ s ? /* @__PURE__ */ W(_n, {
1688
+ notice: s,
1689
+ text: v,
1690
+ contentLanguage: y,
1691
+ languageTag: b
1635
1692
  }) : null,
1636
- a ? /* @__PURE__ */ W(pn, {
1637
- notice: a,
1638
- text: g,
1639
- contentLanguage: _,
1640
- languageTag: v
1693
+ T ? /* @__PURE__ */ W("div", {
1694
+ class: "whoo-widget-empty-state",
1695
+ children: [w, o ? /* @__PURE__ */ W("div", {
1696
+ class: "whoo-widget-empty-state-greeting whoo-widget-message-text",
1697
+ dir: "auto",
1698
+ lang: y,
1699
+ children: dn(o, {
1700
+ linkCue: v.opensInNewTab,
1701
+ linkCueLang: b
1702
+ })
1703
+ }) : null]
1641
1704
  }) : null,
1642
- t.map((e, r) => /* @__PURE__ */ W(mn, {
1705
+ t.map((e, r) => /* @__PURE__ */ W(vn, {
1643
1706
  message: e,
1644
- speaker: e.role === "user" ? g.you : o,
1645
- showFeedback: s,
1707
+ speaker: e.role === "user" ? v.you : c,
1708
+ showFeedback: u,
1646
1709
  feedbackState: e.id ? n[e.id] ?? { status: "idle" } : { status: "idle" },
1647
- pending: c && r === t.length - 1 && e.role === "assistant" && e.content === "",
1648
- isSlowResponse: u,
1649
- onThumbsUp: d,
1650
- onThumbsDown: f,
1651
- onDraftChange: p,
1652
- onSubmitDetailed: m,
1653
- onCancelFeedback: h,
1654
- text: g,
1655
- contentLanguage: _,
1656
- languageTag: v
1710
+ pending: d && r === t.length - 1 && e.role === "assistant" && e.content === "",
1711
+ isSlowResponse: f,
1712
+ onThumbsUp: p,
1713
+ onThumbsDown: m,
1714
+ onDraftChange: h,
1715
+ onSubmitDetailed: g,
1716
+ onCancelFeedback: _,
1717
+ text: v,
1718
+ contentLanguage: y,
1719
+ languageTag: b
1657
1720
  }, e.id ?? r))
1658
1721
  ]
1659
1722
  }), /* @__PURE__ */ W("div", {
1660
1723
  class: "whoo-widget-sr-only",
1724
+ role: "status",
1661
1725
  "aria-live": "polite",
1662
1726
  "aria-atomic": "true",
1663
- lang: y ? _ : v,
1727
+ lang: x ? y : b,
1664
1728
  children: r ?? ""
1665
1729
  })] });
1666
1730
  }
1667
1731
  //#endregion
1668
1732
  //#region src/components/Panel.tsx
1669
- var gn = "button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"])";
1670
- function _n(e) {
1671
- return Array.from(e.querySelectorAll(gn)).filter((e) => {
1733
+ var bn = "button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"])";
1734
+ function xn(e) {
1735
+ return Array.from(e.querySelectorAll(bn)).filter((e) => {
1672
1736
  let t = getComputedStyle(e);
1673
1737
  return t.display !== "none" && t.visibility !== "hidden";
1674
1738
  });
1675
1739
  }
1676
- function vn({ state: e, controller: t, greeting: n }) {
1740
+ function Sn({ state: e, controller: t, greeting: n }) {
1677
1741
  let r = H(null), i = H(null), a = H(null), o = H(!1);
1678
1742
  V(() => {
1679
1743
  (a.current ?? i.current)?.focus();
1680
1744
  }, []), V(() => {
1681
1745
  e.noticeAgreed && o.current && (o.current = !1, i.current?.focus());
1682
1746
  }, [e.noticeAgreed]), V(() => {
1683
- let e = r.current, n = e ? Lt(e) : () => {}, i = e ? Wt(e) : () => {}, a = () => {
1747
+ let e = r.current, n = e ? Ht(e) : () => {}, i = e ? Yt(e) : () => {}, a = () => {
1684
1748
  e && !e.open && t.close();
1685
1749
  };
1686
1750
  e?.addEventListener("close", a);
1687
- let o = Ut();
1751
+ let o = Jt();
1688
1752
  return () => {
1689
1753
  n(), i(), e?.removeEventListener("close", a), o();
1690
1754
  };
1691
1755
  }, []);
1692
1756
  let s = (e) => {
1693
- if (e.key === "Escape" && !Gt(e)) {
1757
+ if (e.key === "Escape" && !Xt(e)) {
1694
1758
  e.preventDefault(), t.close();
1695
1759
  return;
1696
1760
  }
1697
1761
  if (e.key !== "Tab") return;
1698
1762
  let n = r.current;
1699
1763
  if (!n) return;
1700
- let i = _n(n);
1764
+ let i = xn(n);
1701
1765
  if (i.length === 0) return;
1702
1766
  let a = n.getRootNode().activeElement;
1703
1767
  e.preventDefault();
@@ -1711,12 +1775,12 @@ function vn({ state: e, controller: t, greeting: n }) {
1711
1775
  }, c = () => {
1712
1776
  let n = e.draft.trim();
1713
1777
  n && !e.isStreaming && (t.setDraft(""), t.sendMessage(n));
1714
- }, l = u(t.config.name) || e.agentName || "Aiden", d = u(t.config.title), { before: f, after: p, hasName: m } = Nt(t.text.chatWith), h = e.messages.length === 0 && n ? [{
1778
+ }, l = t.resolvedAgentName, d = u(t.config.title), { before: f, after: p, hasName: m } = Lt(t.text.chatWith), h = t.greetingStyle === "centered", g = e.messages.length === 0 && n && !h ? [{
1715
1779
  role: "assistant",
1716
1780
  content: n,
1717
1781
  id: null
1718
- }] : e.messages, g = t.emptyStateImageUrl, _ = e.messages.length === 0 && g ? {
1719
- url: g,
1782
+ }] : e.messages, _ = e.messages.length === 0 && h ? n : void 0, v = t.notice !== "" && t.noticePlacement === "footer", y = t.emptyStateImageUrl, b = e.messages.length === 0 && y ? {
1783
+ url: y,
1720
1784
  alt: t.emptyStateImageAlt
1721
1785
  } : void 0;
1722
1786
  return /* @__PURE__ */ W("dialog", {
@@ -1724,7 +1788,7 @@ function vn({ state: e, controller: t, greeting: n }) {
1724
1788
  class: "whoo-widget-panel",
1725
1789
  "aria-modal": "true",
1726
1790
  "aria-labelledby": "whoo-widget-title",
1727
- "aria-describedby": t.notice && e.noticeAgreed && e.messages.length === 0 ? fn : void 0,
1791
+ "aria-describedby": t.notice && e.noticeAgreed && e.messages.length === 0 ? gn : void 0,
1728
1792
  ref: r,
1729
1793
  onKeyDown: s,
1730
1794
  onCancel: (e) => {
@@ -1733,23 +1797,31 @@ function vn({ state: e, controller: t, greeting: n }) {
1733
1797
  children: [
1734
1798
  /* @__PURE__ */ W("div", {
1735
1799
  class: "whoo-widget-header",
1736
- children: [d ? /* @__PURE__ */ W("h2", {
1737
- id: "whoo-widget-title",
1738
- class: "whoo-widget-header-title",
1739
- lang: t.contentLanguage,
1740
- dir: "auto",
1741
- children: d
1742
- }) : /* @__PURE__ */ W("h2", {
1743
- id: "whoo-widget-title",
1744
- class: "whoo-widget-header-title",
1745
- children: [
1746
- f,
1747
- m ? /* @__PURE__ */ W("bdi", {
1748
- lang: t.contentLanguage,
1749
- children: l
1750
- }) : null,
1751
- p
1752
- ]
1800
+ children: [/* @__PURE__ */ W("div", {
1801
+ class: "whoo-widget-header-titles",
1802
+ children: [d ? /* @__PURE__ */ W("h2", {
1803
+ id: "whoo-widget-title",
1804
+ class: "whoo-widget-header-title",
1805
+ lang: t.contentLanguage,
1806
+ dir: "auto",
1807
+ children: d
1808
+ }) : /* @__PURE__ */ W("h2", {
1809
+ id: "whoo-widget-title",
1810
+ class: "whoo-widget-header-title",
1811
+ children: [
1812
+ f,
1813
+ m ? /* @__PURE__ */ W("bdi", {
1814
+ lang: t.contentLanguage,
1815
+ children: l
1816
+ }) : null,
1817
+ p
1818
+ ]
1819
+ }), t.subtitle ? /* @__PURE__ */ W("p", {
1820
+ class: "whoo-widget-header-subtitle",
1821
+ lang: t.contentLanguage,
1822
+ dir: "auto",
1823
+ children: t.subtitle
1824
+ }) : null]
1753
1825
  }), /* @__PURE__ */ W("div", {
1754
1826
  class: "whoo-widget-header-actions",
1755
1827
  children: [e.messages.length > 0 && /* @__PURE__ */ W("button", {
@@ -1764,16 +1836,18 @@ function vn({ state: e, controller: t, greeting: n }) {
1764
1836
  class: "whoo-widget-header-close",
1765
1837
  "aria-label": t.text.closeChat,
1766
1838
  onClick: () => t.close(),
1767
- children: /* @__PURE__ */ W(mt, {})
1839
+ children: /* @__PURE__ */ W(vt, {})
1768
1840
  })]
1769
1841
  })]
1770
1842
  }),
1771
- /* @__PURE__ */ W(hn, {
1772
- messages: h,
1843
+ /* @__PURE__ */ W(yn, {
1844
+ messages: g,
1773
1845
  messageFeedback: e.messageFeedback,
1774
1846
  announcement: e.announcement,
1775
- emptyStateImage: _,
1776
- notice: t.notice,
1847
+ emptyStateImage: b,
1848
+ centerEmptyState: h,
1849
+ centeredGreeting: _,
1850
+ notice: v ? void 0 : t.notice,
1777
1851
  agentName: l,
1778
1852
  showFeedback: t.showFeedback,
1779
1853
  isStreaming: e.isStreaming,
@@ -1788,8 +1862,8 @@ function vn({ state: e, controller: t, greeting: n }) {
1788
1862
  languageTag: t.languageTag,
1789
1863
  announcementIsContent: e.announcementIsContent
1790
1864
  }),
1791
- e.runtimeError && /* @__PURE__ */ W(qt, { message: e.runtimeError }),
1792
- e.noticeAgreed ? /* @__PURE__ */ W(Kt, {
1865
+ e.runtimeError && /* @__PURE__ */ W(Qt, { message: e.runtimeError }),
1866
+ e.noticeAgreed ? /* @__PURE__ */ W(Zt, {
1793
1867
  value: e.draft,
1794
1868
  onChange: (e) => t.setDraft(e),
1795
1869
  onSend: c,
@@ -1803,24 +1877,31 @@ function vn({ state: e, controller: t, greeting: n }) {
1803
1877
  type: "button",
1804
1878
  class: "whoo-widget-agreement-button",
1805
1879
  ref: a,
1806
- "aria-describedby": fn,
1880
+ "aria-describedby": gn,
1807
1881
  autoFocus: !0,
1808
1882
  onClick: () => {
1809
1883
  o.current = !0, t.agreeToNotice();
1810
1884
  },
1811
1885
  children: t.text.agreeToNotice
1812
1886
  })
1813
- })
1887
+ }),
1888
+ v ? /* @__PURE__ */ W(_n, {
1889
+ notice: t.notice,
1890
+ placement: "footer",
1891
+ text: t.text,
1892
+ contentLanguage: t.contentLanguage,
1893
+ languageTag: t.languageTag
1894
+ }) : null
1814
1895
  ]
1815
1896
  });
1816
1897
  }
1817
1898
  //#endregion
1818
1899
  //#region src/components/App.tsx
1819
- function yn({ controller: e }) {
1820
- let [t, n] = Qe(e.getState()), r = H(null), i = H(t.isOpen);
1821
- return et(() => (n(e.getState()), e.subscribe(n)), [e]), V(() => {
1900
+ function Cn({ controller: e }) {
1901
+ let [t, n] = nt(e.getState()), r = H(null), i = H(t.isOpen);
1902
+ return it(() => (n(e.getState()), e.subscribe(n)), [e]), V(() => {
1822
1903
  i.current && !t.isOpen && r.current?.focus(), i.current = t.isOpen;
1823
- }, [t.isOpen]), t.initError || t.isInitializing ? null : /* @__PURE__ */ W(I, { children: [/* @__PURE__ */ W(bt, {
1904
+ }, [t.isOpen]), t.initError || t.isInitializing ? null : /* @__PURE__ */ W(I, { children: [/* @__PURE__ */ W(wt, {
1824
1905
  isOpen: t.isOpen,
1825
1906
  onClick: () => t.isOpen ? e.close() : e.open(),
1826
1907
  iconUrl: e.launcher.iconUrl,
@@ -1829,7 +1910,7 @@ function yn({ controller: e }) {
1829
1910
  openIcon: e.launcher.openIcon,
1830
1911
  buttonRef: r,
1831
1912
  text: e.text
1832
- }), t.isOpen && /* @__PURE__ */ W(vn, {
1913
+ }), t.isOpen && /* @__PURE__ */ W(Sn, {
1833
1914
  state: t,
1834
1915
  controller: e,
1835
1916
  greeting: e.config.greeting
@@ -1837,44 +1918,44 @@ function yn({ controller: e }) {
1837
1918
  }
1838
1919
  //#endregion
1839
1920
  //#region src/api/client.ts
1840
- var bn = class extends Error {
1921
+ var wn = class extends Error {
1841
1922
  status;
1842
1923
  constructor(e, t) {
1843
1924
  super(e), this.name = "WidgetApiError", this.status = t;
1844
1925
  }
1845
1926
  };
1846
- function xn(e) {
1927
+ function Tn(e) {
1847
1928
  if (typeof e != "string") return null;
1848
1929
  let t = e.trim();
1849
1930
  return t === "" ? null : t;
1850
1931
  }
1851
- async function Sn(e, t) {
1932
+ async function En(e, t) {
1852
1933
  let n = await fetch(`${e}/api/v1/widget/session`, {
1853
1934
  method: "POST",
1854
1935
  headers: { "Content-Type": "application/json" },
1855
1936
  body: JSON.stringify({ publishable_key: t })
1856
1937
  });
1857
- if (!n.ok) throw new bn(`Failed to create widget session (${n.status})`, n.status);
1938
+ if (!n.ok) throw new wn(`Failed to create widget session (${n.status})`, n.status);
1858
1939
  let r = await n.json();
1859
1940
  return {
1860
1941
  token: r.token,
1861
- ...Cn(r)
1942
+ ...Dn(r)
1862
1943
  };
1863
1944
  }
1864
- function Cn(e) {
1945
+ function Dn(e) {
1865
1946
  return {
1866
- primaryColor: xn(e.primary_color),
1867
- name: xn(e.name),
1868
- accentColor: xn(e.accent_color),
1869
- inkColor: xn(e.ink_color)
1947
+ primaryColor: Tn(e.primary_color),
1948
+ name: Tn(e.name),
1949
+ accentColor: Tn(e.accent_color),
1950
+ inkColor: Tn(e.ink_color)
1870
1951
  };
1871
1952
  }
1872
- async function wn(e, t) {
1953
+ async function On(e, t) {
1873
1954
  let n = await fetch(`${e}/api/v1/widget/branding`, { headers: { Authorization: `Bearer ${t}` } });
1874
- if (!n.ok) throw new bn(`Failed to load widget branding (${n.status})`, n.status);
1875
- return Cn(await n.json());
1955
+ if (!n.ok) throw new wn(`Failed to load widget branding (${n.status})`, n.status);
1956
+ return Dn(await n.json());
1876
1957
  }
1877
- async function Tn(e, t, n) {
1958
+ async function kn(e, t, n) {
1878
1959
  let r = await fetch(`${e}/api/v1/widget/feedback`, {
1879
1960
  method: "POST",
1880
1961
  headers: {
@@ -1888,11 +1969,11 @@ async function Tn(e, t, n) {
1888
1969
  category: n.category ?? null
1889
1970
  })
1890
1971
  });
1891
- if (!r.ok) throw new bn(`Feedback submission failed (${r.status})`, r.status);
1972
+ if (!r.ok) throw new wn(`Feedback submission failed (${r.status})`, r.status);
1892
1973
  }
1893
1974
  //#endregion
1894
1975
  //#region src/api/sse.ts
1895
- async function* En(e, t, n, r, i) {
1976
+ async function* An(e, t, n, r, i) {
1896
1977
  let a = await fetch(`${e}/api/v1/widget/chat`, {
1897
1978
  method: "POST",
1898
1979
  headers: {
@@ -1905,7 +1986,7 @@ async function* En(e, t, n, r, i) {
1905
1986
  }),
1906
1987
  signal: i
1907
1988
  });
1908
- if (!a.ok || !a.body) throw new bn(`Chat request failed (${a.status})`, a.status);
1989
+ if (!a.ok || !a.body) throw new wn(`Chat request failed (${a.status})`, a.status);
1909
1990
  let o = a.body.getReader(), s = new TextDecoder(), c = "";
1910
1991
  for (;;) {
1911
1992
  let { done: e, value: t } = await o.read();
@@ -1917,11 +1998,11 @@ async function* En(e, t, n, r, i) {
1917
1998
  c = c.slice(n + 2);
1918
1999
  let t = e.split("\n").find((e) => e.startsWith("data: "));
1919
2000
  if (i?.aborted) return;
1920
- t && (yield Dn(JSON.parse(t.slice(6)))), n = c.indexOf("\n\n");
2001
+ t && (yield jn(JSON.parse(t.slice(6)))), n = c.indexOf("\n\n");
1921
2002
  }
1922
2003
  }
1923
2004
  }
1924
- function Dn(e) {
2005
+ function jn(e) {
1925
2006
  return typeof e.error == "string" ? {
1926
2007
  type: "error",
1927
2008
  error: e.error,
@@ -1944,11 +2025,11 @@ function Dn(e) {
1944
2025
  }
1945
2026
  //#endregion
1946
2027
  //#region src/markdown/plainText.ts
1947
- function On(e) {
1948
- return tn(e.replace(/\r\n?/g, "\n")).map((e) => {
2028
+ function Mn(e) {
2029
+ return on(e.replace(/\r\n?/g, "\n")).map((e) => {
1949
2030
  switch (e.type) {
1950
2031
  case "bold":
1951
- case "italic": return On(e.value);
2032
+ case "italic": return Mn(e.value);
1952
2033
  case "link": return e.text;
1953
2034
  default: return e.value;
1954
2035
  }
@@ -1956,16 +2037,16 @@ function On(e) {
1956
2037
  }
1957
2038
  //#endregion
1958
2039
  //#region src/markdown/reveal.ts
1959
- var kn = 40, An = 120;
1960
- function jn(e) {
2040
+ var Nn = 40, Pn = 120;
2041
+ function Fn(e) {
1961
2042
  let t = [];
1962
- for (let n of tn(e)) if (n.type === "text") {
2043
+ for (let n of on(e)) if (n.type === "text") {
1963
2044
  let e = n.value.split(/(\s+)/), r = n.start;
1964
2045
  for (let n of e) r += n.length, n.trim().length > 0 && t.push(r);
1965
2046
  } else t.push(n.end);
1966
2047
  return t;
1967
2048
  }
1968
- function Mn(e) {
2049
+ function In(e) {
1969
2050
  let t = null;
1970
2051
  return e?.addEventListener("abort", () => {
1971
2052
  t?.();
@@ -1980,14 +2061,14 @@ function Mn(e) {
1980
2061
  });
1981
2062
  };
1982
2063
  }
1983
- async function Nn(e, t, n) {
1984
- let r = n?.wordIntervalMs ?? kn, i = n?.tokenIntervalMs ?? An, a = n?.signal, o = tn(e), s = new Set(o.filter((e) => e.type !== "text").map((e) => e.end)), c = Mn(a), l = "";
1985
- for (let n of jn(e)) if (a?.aborted || (l = e.slice(0, n), t(l), await c(s.has(n) ? i : r), a?.aborted)) return;
2064
+ async function Ln(e, t, n) {
2065
+ let r = n?.wordIntervalMs ?? Nn, i = n?.tokenIntervalMs ?? Pn, a = n?.signal, o = on(e), s = new Set(o.filter((e) => e.type !== "text").map((e) => e.end)), c = In(a), l = "";
2066
+ for (let n of Fn(e)) if (a?.aborted || (l = e.slice(0, n), t(l), await c(s.has(n) ? i : r), a?.aborted)) return;
1986
2067
  l !== e && t(e);
1987
2068
  }
1988
2069
  //#endregion
1989
2070
  //#region src/sessionToken.ts
1990
- function Pn(e) {
2071
+ function Rn(e) {
1991
2072
  let t = e.split(".");
1992
2073
  if (t.length !== 3 || t.some((e) => e === "")) return null;
1993
2074
  let n = t[1];
@@ -2001,60 +2082,60 @@ function Pn(e) {
2001
2082
  return null;
2002
2083
  }
2003
2084
  }
2004
- function Fn(e) {
2005
- let t = Pn(e)?.exp;
2085
+ function zn(e) {
2086
+ let t = Rn(e)?.exp;
2006
2087
  return typeof t == "number" ? t * 1e3 : null;
2007
2088
  }
2008
- function In(e, t = Date.now()) {
2009
- let n = Fn(e);
2089
+ function Bn(e, t = Date.now()) {
2090
+ let n = zn(e);
2010
2091
  return n !== null && n <= t;
2011
2092
  }
2012
- function Ln(e, t = Date.now()) {
2013
- let n = Pn(e);
2093
+ function Vn(e, t = Date.now()) {
2094
+ let n = Rn(e);
2014
2095
  return n?.exp == null ? null : n.iat != null && n.exp > n.iat ? t + (n.exp - n.iat) * 1e3 : n.exp * 1e3;
2015
2096
  }
2016
2097
  //#endregion
2017
2098
  //#region src/storage.ts
2018
- function Rn(e) {
2099
+ function Hn(e) {
2019
2100
  return `whoo-aiden-widget:conversation:${e}`;
2020
2101
  }
2021
- function zn(e) {
2102
+ function Un(e) {
2022
2103
  try {
2023
- return window.sessionStorage.getItem(Rn(e));
2104
+ return window.sessionStorage.getItem(Hn(e));
2024
2105
  } catch {
2025
2106
  return null;
2026
2107
  }
2027
2108
  }
2028
- function Bn(e, t) {
2109
+ function Wn(e, t) {
2029
2110
  try {
2030
- window.sessionStorage.setItem(Rn(e), t);
2111
+ window.sessionStorage.setItem(Hn(e), t);
2031
2112
  } catch {}
2032
2113
  }
2033
- function Vn(e) {
2114
+ function Gn(e) {
2034
2115
  return `whoo-aiden-widget:notice-agreed:${e}`;
2035
2116
  }
2036
- function Hn(e, t) {
2117
+ function Kn(e, t) {
2037
2118
  try {
2038
- return window.sessionStorage.getItem(Vn(e)) === t;
2119
+ return window.sessionStorage.getItem(Gn(e)) === t;
2039
2120
  } catch {
2040
2121
  return !1;
2041
2122
  }
2042
2123
  }
2043
- function Un(e, t) {
2124
+ function qn(e, t) {
2044
2125
  try {
2045
- window.sessionStorage.setItem(Vn(e), t);
2126
+ window.sessionStorage.setItem(Gn(e), t);
2046
2127
  } catch {}
2047
2128
  }
2048
- function Wn(e) {
2129
+ function Jn(e) {
2049
2130
  try {
2050
- window.sessionStorage.removeItem(Rn(e));
2131
+ window.sessionStorage.removeItem(Hn(e));
2051
2132
  } catch {}
2052
2133
  }
2053
2134
  //#endregion
2054
2135
  //#region src/theme.ts
2055
- var Gn = /^(inherit|initial|unset|revert|revert-layer)$|\bcurrentcolor\b|\b(var|env|attr|light-dark)\(/i;
2056
- function Kn(e) {
2057
- if (Gn.test(e.trim())) return null;
2136
+ var Yn = /^(inherit|initial|unset|revert|revert-layer)$|\bcurrentcolor\b|\b(var|env|attr|light-dark)\(/i;
2137
+ function Xn(e) {
2138
+ if (Yn.test(e.trim())) return null;
2058
2139
  let t = document.createElement("div");
2059
2140
  if (t.style.color = e, t.style.color === "") return null;
2060
2141
  let n = document.createElement("div");
@@ -2073,69 +2154,69 @@ function Kn(e) {
2073
2154
  translucent: a < 1
2074
2155
  };
2075
2156
  }
2076
- function q(e) {
2077
- return Kn(e)?.rgb ?? null;
2157
+ function J(e) {
2158
+ return Xn(e)?.rgb ?? null;
2078
2159
  }
2079
- function J([e, t, n]) {
2160
+ function Y([e, t, n]) {
2080
2161
  let r = (e) => {
2081
2162
  let t = e / 255;
2082
2163
  return t <= .03928 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
2083
2164
  };
2084
2165
  return .2126 * r(e) + .7152 * r(t) + .0722 * r(n);
2085
2166
  }
2086
- function qn(e, t) {
2167
+ function Zn(e, t) {
2087
2168
  let n = Math.max(e, t), r = Math.min(e, t);
2088
2169
  return (n + .05) / (r + .05);
2089
2170
  }
2090
- function Jn(e) {
2091
- let t = q(e);
2171
+ function Qn(e) {
2172
+ let t = J(e);
2092
2173
  if (!t) return console.warn(`[whoo-aiden-widget] Could not parse color "${e}" for contrast calculation; defaulting to white text.`), "#ffffff";
2093
- let n = J(t);
2094
- return qn(n, J([
2174
+ let n = Y(t);
2175
+ return Zn(n, Y([
2095
2176
  0,
2096
2177
  0,
2097
2178
  0
2098
- ])) >= qn(n, J([
2179
+ ])) >= Zn(n, Y([
2099
2180
  255,
2100
2181
  255,
2101
2182
  255
2102
2183
  ])) ? "#000000" : "#ffffff";
2103
2184
  }
2104
- function Yn(e, t) {
2105
- let n = q(e), r = q(t);
2106
- return !n || !r ? NaN : qn(J(n), J(r));
2185
+ function $n(e, t) {
2186
+ let n = J(e), r = J(t);
2187
+ return !n || !r ? NaN : Zn(Y(n), Y(r));
2107
2188
  }
2108
- var Y = i.primary, Xn = i.panel, Zn = i.assistantBubble, Qn = i.headerHover, $n = 4.5;
2109
- function er([e, t, n]) {
2189
+ var er = i.primary, tr = i.panel, nr = i.assistantBubble, rr = i.headerHover, ir = 4.5;
2190
+ function ar([e, t, n]) {
2110
2191
  return `#${[
2111
2192
  e,
2112
2193
  t,
2113
2194
  n
2114
2195
  ].map((e) => e.toString(16).padStart(2, "0")).join("")}`;
2115
2196
  }
2116
- function tr(e, t = Xn) {
2117
- let n = q(e), r = q(t);
2118
- if (!n || !r) return Y;
2119
- let i = J(r), a = (e) => qn(J(e), i) >= $n;
2120
- if (a(n)) return er(n);
2197
+ function or(e, t = tr) {
2198
+ let n = J(e), r = J(t);
2199
+ if (!n || !r) return er;
2200
+ let i = Y(r), a = (e) => Zn(Y(e), i) >= ir;
2201
+ if (a(n)) return ar(n);
2121
2202
  for (let e = .99; e > 0; e -= .01) {
2122
2203
  let t = n.map((t) => Math.round(t * e));
2123
- if (a(t)) return er(t);
2204
+ if (a(t)) return ar(t);
2124
2205
  }
2125
2206
  return "#000000";
2126
2207
  }
2127
- var nr = i.ink, rr = i.link;
2208
+ var sr = i.ink, cr = i.link;
2128
2209
  function X(e) {
2129
2210
  if (typeof e != "string" || !e) return null;
2130
- let t = Kn(e);
2131
- return t ? er(t.rgb) : null;
2211
+ let t = Xn(e);
2212
+ return t ? ar(t.rgb) : null;
2132
2213
  }
2133
- function ir(e) {
2214
+ function lr(e) {
2134
2215
  if (typeof e != "string" || !e) return null;
2135
- let t = Kn(e);
2136
- return t ? t.translucent ? e.trim() : er(t.rgb) : null;
2216
+ let t = Xn(e);
2217
+ return t ? t.translucent ? e.trim() : ar(t.rgb) : null;
2137
2218
  }
2138
- var ar = [
2219
+ var ur = [
2139
2220
  {
2140
2221
  role: "onPrimary",
2141
2222
  against: ["primary"],
@@ -2153,12 +2234,12 @@ var ar = [
2153
2234
  },
2154
2235
  {
2155
2236
  role: "link",
2156
- against: ["assistantBubble"],
2237
+ against: ["assistantBubble", "panel"],
2157
2238
  required: 4.5
2158
2239
  },
2159
2240
  {
2160
2241
  role: "muted",
2161
- against: ["assistantBubble"],
2242
+ against: ["assistantBubble", "panel"],
2162
2243
  required: 4.5
2163
2244
  },
2164
2245
  {
@@ -2188,7 +2269,7 @@ var ar = [
2188
2269
  }
2189
2270
  ];
2190
2271
  function Z({ color: e, inkColor: t, accentColor: n, overrides: a }) {
2191
- let o = typeof a == "object" && a && !Array.isArray(a) ? a : {}, s = (e) => ir(o[e]), c = X(e), l = s("primary"), u = l ?? c ?? Y, d = s("primaryText"), f = d ?? tr(u, Qn), p = s("onPrimary") ?? Jn(u), m = X(t), h = s("ink") ?? (m ? tr(m, Zn) : nr), g = X(n), _ = s("link") ?? (g ? tr(g, Zn) : rr), v = (e) => s(e) ?? i[e], y = {
2272
+ let o = typeof a == "object" && a && !Array.isArray(a) ? a : {}, s = (e) => lr(o[e]), c = X(e), l = s("primary"), u = l ?? c ?? er, d = s("primaryText"), f = d ?? or(u, rr), p = s("onPrimary") ?? Qn(u), m = X(t), h = s("ink") ?? (m ? or(m, nr) : sr), g = X(n), _ = s("link") ?? (g ? or(g, nr) : cr), v = (e) => s(e) ?? i[e], y = {
2192
2273
  primary: u,
2193
2274
  onPrimary: p,
2194
2275
  primaryText: f,
@@ -2206,9 +2287,9 @@ function Z({ color: e, inkColor: t, accentColor: n, overrides: a }) {
2206
2287
  inputBorder: v("inputBorder"),
2207
2288
  focusRing: v("focusRing")
2208
2289
  }, b = Object.fromEntries(r.map((e) => [e, s(e) !== null])), x = [];
2209
- for (let { role: e, against: t, required: n } of ar) for (let r of t) {
2290
+ for (let { role: e, against: t, required: n } of ur) for (let r of t) {
2210
2291
  if (!b[e] && !b[r]) continue;
2211
- let t = Yn(y[e], y[r]);
2292
+ let t = $n(y[e], y[r]);
2212
2293
  Number.isFinite(t) && t < n && x.push({
2213
2294
  role: e,
2214
2295
  against: r,
@@ -2237,62 +2318,62 @@ function Z({ color: e, inkColor: t, accentColor: n, overrides: a }) {
2237
2318
  function Q(e) {
2238
2319
  return typeof e == "string" ? `"${e}"` : `a ${typeof e} value`;
2239
2320
  }
2240
- function or(e, t, n = Y) {
2321
+ function dr(e, t, n = er) {
2241
2322
  let r = t;
2242
2323
  X(t) === null && (console.warn(`[whoo-aiden-widget] Could not use ${Q(t)} as the theme color; falling back to ${Q(n)}.`), r = n);
2243
2324
  let i = Z({ color: r });
2244
2325
  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);
2245
2326
  }
2246
- function sr(e, { inkColor: t, accentColor: n }) {
2327
+ function fr(e, { inkColor: t, accentColor: n }) {
2247
2328
  let r = Z({
2248
2329
  inkColor: t,
2249
2330
  accentColor: n
2250
2331
  });
2251
2332
  e.style.setProperty("--whoo-widget-ink", r.ink), e.style.setProperty("--whoo-widget-link-color", r.link);
2252
2333
  }
2253
- function cr(e, t) {
2334
+ function pr(e, t) {
2254
2335
  let n = Z({ overrides: t });
2255
2336
  for (let t of r) {
2256
2337
  let r = n.overridden.primary && (t === "onPrimary" || t === "primaryText");
2257
2338
  (n.overridden[t] || r) && e.style.setProperty(a[t], n.roles[t]);
2258
2339
  }
2259
2340
  }
2260
- function lr(e, t) {
2341
+ function mr(e, t) {
2261
2342
  e && X(e) === null && console.warn(`[whoo-aiden-widget] Could not use ${Q(e)} as the ${t}; using the default.`);
2262
2343
  }
2263
- function ur(e, t, n) {
2344
+ function hr(e, t, n) {
2264
2345
  for (let e of r) {
2265
2346
  let n = t[e];
2266
2347
  n && X(n) === null && console.warn(`[whoo-aiden-widget] Could not use ${Q(n)} as theme.colors.${e}; using the calculated color.`);
2267
2348
  }
2268
2349
  let i = t.primary;
2269
- typeof i == "string" && Kn(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.`), dr({
2350
+ typeof i == "string" && Xn(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.`), gr({
2270
2351
  color: e.color,
2271
2352
  inkColor: e.inkColor,
2272
2353
  accentColor: e.accentColor,
2273
2354
  overrides: t
2274
2355
  }, n);
2275
2356
  }
2276
- function dr(e, t) {
2357
+ function gr(e, t) {
2277
2358
  for (let n of Z(e).contrastWarnings) {
2278
2359
  let { role: e, against: r, value: i, ratio: a, required: o, overridden: s } = n, c = `${e}|${r}|${i}`;
2279
2360
  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.`));
2280
2361
  }
2281
2362
  }
2282
- function fr(e, t, n = /* @__PURE__ */ new Set()) {
2283
- or(e, t.color ?? Y), lr(t.inkColor, "ink color"), lr(t.accentColor, "accent color"), sr(e, {
2363
+ function _r(e, t, n = /* @__PURE__ */ new Set()) {
2364
+ dr(e, t.color ?? er), mr(t.inkColor, "ink color"), mr(t.accentColor, "accent color"), fr(e, {
2284
2365
  inkColor: t.inkColor,
2285
2366
  accentColor: t.accentColor
2286
2367
  });
2287
- let r = te(t.theme);
2288
- ur(t, r.colors, n), cr(e, r.colors), r.fontFamily && e.style.setProperty("--whoo-widget-font", r.fontFamily);
2368
+ let r = ae(t.theme);
2369
+ hr(t, r.colors, n), pr(e, r.colors), r.fontFamily && e.style.setProperty("--whoo-widget-font", r.fontFamily);
2289
2370
  }
2290
2371
  //#endregion
2291
2372
  //#region src/controller.ts
2292
- var pr = 8e3, mr = 3e3, hr = 15e3, gr = class extends Error {
2373
+ var vr = 8e3, yr = 3e3, br = 15e3, xr = class extends Error {
2293
2374
  name = "SessionUnavailableError";
2294
2375
  };
2295
- function _r(e, t) {
2376
+ function Sr(e, t) {
2296
2377
  return t ? new Promise((n, r) => {
2297
2378
  let i = () => r(new DOMException("Aborted", "AbortError"));
2298
2379
  if (t.aborted) return i();
@@ -2303,23 +2384,23 @@ function _r(e, t) {
2303
2384
  });
2304
2385
  }) : e;
2305
2386
  }
2306
- function vr(e, t) {
2307
- return e === "refused" ? new br(t) : new gr();
2387
+ function Cr(e, t) {
2388
+ return e === "refused" ? new Tr(t) : new xr();
2308
2389
  }
2309
- function yr(e) {
2390
+ function wr(e) {
2310
2391
  let t = e?.status;
2311
2392
  return t === 401 || t === 403 || t === 404;
2312
2393
  }
2313
- var br = class extends Error {
2394
+ var Tr = class extends Error {
2314
2395
  name = "SessionExpiredError";
2315
2396
  constructor(e) {
2316
2397
  super(e instanceof Error ? e.message : "The session has expired.");
2317
2398
  }
2318
2399
  };
2319
- function xr(e) {
2400
+ function Er(e) {
2320
2401
  return e?.status === 401;
2321
2402
  }
2322
- function Sr(e, t) {
2403
+ function Dr(e, t) {
2323
2404
  return new Promise((n) => {
2324
2405
  let r = setTimeout(n, t);
2325
2406
  e.then(() => {
@@ -2327,7 +2408,7 @@ function Sr(e, t) {
2327
2408
  });
2328
2409
  });
2329
2410
  }
2330
- var Cr = class {
2411
+ var Or = class {
2331
2412
  config;
2332
2413
  state;
2333
2414
  listeners = /* @__PURE__ */ new Set();
@@ -2341,6 +2422,7 @@ var Cr = class {
2341
2422
  storageIdentifier;
2342
2423
  activeRequestController = null;
2343
2424
  slowResponseTimer = null;
2425
+ announcementTimer = null;
2344
2426
  prefersReducedMotion;
2345
2427
  launcher;
2346
2428
  launcherIconUrl;
@@ -2348,6 +2430,9 @@ var Cr = class {
2348
2430
  emptyStateImageAlt;
2349
2431
  notice;
2350
2432
  requireNoticeAgreement;
2433
+ noticePlacement;
2434
+ subtitle;
2435
+ greetingStyle;
2351
2436
  showFeedback;
2352
2437
  text;
2353
2438
  language;
@@ -2356,14 +2441,14 @@ var Cr = class {
2356
2441
  dir;
2357
2442
  constructor(e) {
2358
2443
  this.config = e;
2359
- let t = te(e.theme).launcher, r = t.iconUrl ?? n(e.launcherIconUrl, "launcherIconUrl");
2444
+ let t = ae(e.theme).launcher, r = t.iconUrl ?? n(e.launcherIconUrl, "launcherIconUrl");
2360
2445
  this.launcher = {
2361
2446
  ...t,
2362
2447
  ...r ? { iconUrl: r } : {}
2363
- }, 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.showFeedback = e.showFeedback === !0, this.storageIdentifier = e.publishableKey ?? "session-token-mode", this.getSessionToken = m(e);
2364
- let { language: i, tag: a, dir: o } = kt(e.language, typeof document > "u" ? void 0 : document.documentElement.lang);
2365
- this.language = i, this.languageTag = a, this.dir = o, this.contentLanguage = Mt(e.contentLanguage, typeof document > "u" ? void 0 : document.documentElement.lang, e.language), this.text = {
2366
- ...Dt(i),
2448
+ }, 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 = k(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);
2449
+ let { language: i, tag: a, dir: o } = Nt(e.language, typeof document > "u" ? void 0 : document.documentElement.lang);
2450
+ this.language = i, this.languageTag = a, this.dir = o, this.contentLanguage = It(e.contentLanguage, typeof document > "u" ? void 0 : document.documentElement.lang, e.language), this.text = {
2451
+ ...jt(i),
2367
2452
  ...b(e.messages)
2368
2453
  }, this.prefersReducedMotion = typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, this.state = {
2369
2454
  isOpen: !1,
@@ -2380,7 +2465,7 @@ var Cr = class {
2380
2465
  announcement: null,
2381
2466
  announcementIsContent: !1,
2382
2467
  isSlowResponse: !1,
2383
- noticeAgreed: !this.requireNoticeAgreement || Hn(this.storageIdentifier, this.notice),
2468
+ noticeAgreed: !this.requireNoticeAgreement || Kn(this.storageIdentifier, this.notice),
2384
2469
  draft: ""
2385
2470
  };
2386
2471
  }
@@ -2390,6 +2475,20 @@ var Cr = class {
2390
2475
  subscribe(e) {
2391
2476
  return this.listeners.add(e), () => this.listeners.delete(e);
2392
2477
  }
2478
+ get resolvedAgentName() {
2479
+ return u(this.config.name) || this.state.agentName || "Aiden";
2480
+ }
2481
+ announce(e, t = !1, n = !1) {
2482
+ this.announcementTimer !== null && (clearTimeout(this.announcementTimer), this.announcementTimer = null), n && e !== null && this.state.announcement !== e ? this.setState({
2483
+ announcement: e,
2484
+ announcementIsContent: t
2485
+ }) : (this.state.announcement !== null && this.setState({ announcement: null }), e !== null && (this.announcementTimer = setTimeout(() => {
2486
+ this.announcementTimer = null, this.setState({
2487
+ announcement: e,
2488
+ announcementIsContent: t
2489
+ });
2490
+ }, 250)));
2491
+ }
2393
2492
  clearSlowResponse() {
2394
2493
  this.slowResponseTimer !== null && (clearTimeout(this.slowResponseTimer), this.slowResponseTimer = null), this.state.isSlowResponse && this.setState({ isSlowResponse: !1 });
2395
2494
  }
@@ -2412,12 +2511,12 @@ var Cr = class {
2412
2511
  let e = this.config.apiBaseUrl ?? "https://api.aidenvoice.com";
2413
2512
  try {
2414
2513
  if (this.config.sessionToken) {
2415
- if (In(this.config.sessionToken)) {
2514
+ if (Bn(this.config.sessionToken)) {
2416
2515
  if (!("token" in await this.renewToken())) throw Error("The sessionToken has expired.");
2417
- } else this.sessionToken = this.config.sessionToken, this.sessionTokenExpiresAt = Fn(this.config.sessionToken);
2516
+ } else this.sessionToken = this.config.sessionToken, this.sessionTokenExpiresAt = zn(this.config.sessionToken);
2418
2517
  } else if (this.config.publishableKey) {
2419
- let { token: t, primaryColor: n, name: r, accentColor: i, inkColor: a } = await Sn(e, this.config.publishableKey);
2420
- this.sessionToken = t, this.sessionTokenExpiresAt = Ln(t), this.setState({
2518
+ let { token: t, primaryColor: n, name: r, accentColor: i, inkColor: a } = await En(e, this.config.publishableKey);
2519
+ this.sessionToken = t, this.sessionTokenExpiresAt = Vn(t), this.setState({
2421
2520
  primaryColor: n,
2422
2521
  agentName: r,
2423
2522
  accentColor: i,
@@ -2428,13 +2527,13 @@ var Cr = class {
2428
2527
  console.error("[whoo-aiden-widget] initialization failed:", e), this.setState({ initError: e instanceof Error ? e.message : String(e) });
2429
2528
  return;
2430
2529
  }
2431
- this.conversationId = zn(this.storageIdentifier), this.config.sessionToken && await Sr(this.loadBranding(e), mr);
2530
+ this.conversationId = Un(this.storageIdentifier), this.config.sessionToken && await Dr(this.loadBranding(e), yr);
2432
2531
  }
2433
2532
  async loadBranding(e) {
2434
2533
  try {
2435
2534
  let t = this.config;
2436
2535
  if (X(t.color) && X(t.inkColor) && X(t.accentColor) && u(t.name)) return;
2437
- let { primaryColor: n, name: r, accentColor: i, inkColor: a } = await this.withSession((t) => wn(e, t));
2536
+ let { primaryColor: n, name: r, accentColor: i, inkColor: a } = await this.withSession((t) => On(e, t));
2438
2537
  this.setState({
2439
2538
  primaryColor: n,
2440
2539
  agentName: r,
@@ -2443,30 +2542,28 @@ var Cr = class {
2443
2542
  });
2444
2543
  } catch (e) {
2445
2544
  let t = e?.status;
2446
- (e instanceof br || 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 })));
2545
+ (e instanceof Tr || 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 })));
2447
2546
  }
2448
2547
  }
2449
2548
  open() {
2450
2549
  this.setState({ isOpen: !0 });
2451
2550
  }
2452
2551
  resetConversation() {
2453
- this.sendEpoch += 1, this.activeRequestController?.abort("reset"), this.activeRequestController = null, this.clearSlowResponse(), this.conversationId = null, Wn(this.storageIdentifier), this.setState({
2552
+ this.sendEpoch += 1, this.activeRequestController?.abort("reset"), this.activeRequestController = null, this.clearSlowResponse(), this.conversationId = null, Jn(this.storageIdentifier), this.setState({
2454
2553
  messages: [],
2455
2554
  messageFeedback: {},
2456
2555
  runtimeError: null,
2457
- isStreaming: !1,
2458
- announcement: this.text.conversationCleared,
2459
- announcementIsContent: !1
2460
- });
2556
+ isStreaming: !1
2557
+ }), this.announce(this.text.conversationCleared);
2461
2558
  }
2462
2559
  agreeToNotice() {
2463
- this.state.noticeAgreed || (Un(this.storageIdentifier, this.notice), this.setState({ noticeAgreed: !0 }));
2560
+ this.state.noticeAgreed || (qn(this.storageIdentifier, this.notice), this.setState({ noticeAgreed: !0 }));
2464
2561
  }
2465
2562
  setDraft(e) {
2466
2563
  this.setState({ draft: e });
2467
2564
  }
2468
2565
  close() {
2469
- this.activeRequestController?.abort("close"), this.activeRequestController = null, this.clearSlowResponse(), this.setState({ isOpen: !1 });
2566
+ this.activeRequestController?.abort("close"), this.activeRequestController = null, this.clearSlowResponse(), this.announce(null), this.setState({ isOpen: !1 });
2470
2567
  }
2471
2568
  async sendMessage(e) {
2472
2569
  if (!this.sessionToken || !this.state.noticeAgreed) return;
@@ -2488,9 +2585,8 @@ var Cr = class {
2488
2585
  a
2489
2586
  ],
2490
2587
  isStreaming: !0,
2491
- runtimeError: null,
2492
- announcement: null
2493
- });
2588
+ runtimeError: null
2589
+ }), this.announce(Rt(this.text.messageSent, { name: this.resolvedAgentName }), !1, !0);
2494
2590
  let o = a, s = (e) => {
2495
2591
  let t = o;
2496
2592
  o = {
@@ -2501,17 +2597,19 @@ var Cr = class {
2501
2597
  this.activeRequestController = l;
2502
2598
  let { signal: u } = l, d = !1;
2503
2599
  this.slowResponseTimer = setTimeout(() => {
2504
- this.slowResponseTimer = null, this.setState({ isSlowResponse: !0 });
2505
- }, pr);
2600
+ this.slowResponseTimer = null, this.setState({ isSlowResponse: !0 }), r() && this.announce(this.text.lookingItUp);
2601
+ }, vr);
2506
2602
  let f = !1, p = () => {
2507
2603
  this.state.draft === "" && (f = !0, this.setState({ draft: e }));
2508
- }, m = (e = this.text.genericError) => {
2509
- r() && (this.setState({ runtimeError: e }), p());
2510
- }, h = "";
2604
+ }, m = !1, h = (e) => {
2605
+ m = !0, this.announce(Mn(e), !0);
2606
+ }, g = (e = this.text.genericError) => {
2607
+ r() && (m || (m = !0, this.announce(null)), this.setState({ runtimeError: e }), p());
2608
+ }, _ = "";
2511
2609
  try {
2512
2610
  let { stream: n, first: i } = await this.withSession(async (n) => {
2513
2611
  d = !0;
2514
- let r = En(t, n, this.conversationId, e, u);
2612
+ let r = An(t, n, this.conversationId, e, u);
2515
2613
  return {
2516
2614
  stream: r,
2517
2615
  first: await r.next()
@@ -2519,25 +2617,19 @@ var Cr = class {
2519
2617
  }, u);
2520
2618
  for (let e = i; !e.done && !u.aborted && r(); e = await n.next()) {
2521
2619
  let t = e.value;
2522
- if (t.type === "conversation_id") this.conversationId = t.conversationId, Bn(this.storageIdentifier, t.conversationId);
2523
- else if (t.type === "delta") this.clearSlowResponse(), t.verbatim && !this.prefersReducedMotion ? (await Nn(t.delta, (e) => c(e), { signal: u }), h = t.delta) : t.verbatim ? (h = t.delta, c(h)) : (h += t.delta, c(h));
2524
- else if (t.type === "done") t.conversationId && (this.conversationId = t.conversationId, Bn(this.storageIdentifier, t.conversationId)), t.messageId && s({ id: t.messageId }), r() && this.setState({
2525
- announcement: On(h),
2526
- announcementIsContent: !0
2527
- });
2620
+ if (t.type === "conversation_id") this.conversationId = t.conversationId, Wn(this.storageIdentifier, t.conversationId);
2621
+ else if (t.type === "delta") this.clearSlowResponse(), t.verbatim && !this.prefersReducedMotion ? (await Ln(t.delta, (e) => c(e), { signal: u }), _ = t.delta) : t.verbatim ? (_ = t.delta, c(_)) : (_ += t.delta, c(_));
2622
+ else if (t.type === "done") t.conversationId && (this.conversationId = t.conversationId, Wn(this.storageIdentifier, t.conversationId)), t.messageId && s({ id: t.messageId }), r() && h(_);
2528
2623
  else if (t.type === "error") {
2529
- console.error("[whoo-aiden-widget] chat error:", t.error), h.trim() !== "" && r() && this.setState({
2530
- announcement: On(h),
2531
- announcementIsContent: !0
2532
- }), m(), l.abort();
2624
+ console.error("[whoo-aiden-widget] chat error:", t.error), _.trim() !== "" && r() && h(_), g(), l.abort();
2533
2625
  break;
2534
2626
  }
2535
2627
  }
2536
2628
  } catch (e) {
2537
- u.aborted ? u.reason === "close" && r() && !d && p() : e instanceof br ? (console.error("[whoo-aiden-widget] chat request failed: the session has expired.", e), m(this.text.sessionExpired)) : e instanceof gr ? (console.error("[whoo-aiden-widget] chat request failed: no session could be had."), m()) : (console.error("[whoo-aiden-widget] chat request failed:", e), m());
2629
+ u.aborted ? u.reason === "close" && r() && !d && p() : e instanceof Tr ? (console.error("[whoo-aiden-widget] chat request failed: the session has expired.", e), g(this.text.sessionExpired)) : e instanceof xr ? (console.error("[whoo-aiden-widget] chat request failed: no session could be had."), g()) : (console.error("[whoo-aiden-widget] chat request failed:", e), g());
2538
2630
  } finally {
2539
2631
  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;
2540
- r() ? (this.activeRequestController = null, this.clearSlowResponse(), this.setState({
2632
+ r() ? (this.activeRequestController = null, this.clearSlowResponse(), m || (!u.aborted && _.trim() !== "" ? h(_) : this.announce(null)), this.setState({
2541
2633
  isStreaming: !1,
2542
2634
  ...n ? { messages: t } : {}
2543
2635
  })) : n && this.setState({ messages: t });
@@ -2581,7 +2673,7 @@ var Cr = class {
2581
2673
  }
2582
2674
  } });
2583
2675
  try {
2584
- await this.withSession((a) => Tn(i, a, {
2676
+ await this.withSession((a) => kn(i, a, {
2585
2677
  messageId: e,
2586
2678
  rating: t,
2587
2679
  correction: n,
@@ -2607,7 +2699,7 @@ var Cr = class {
2607
2699
  }
2608
2700
  async currentToken(e) {
2609
2701
  let t = this.sessionToken, n = this.sessionTokenExpiresAt;
2610
- return t && (n === null || n - Date.now() > 6e4) ? { token: t } : _r(this.renewToken(), e);
2702
+ return t && (n === null || n - Date.now() > 6e4) ? { token: t } : Sr(this.renewToken(), e);
2611
2703
  }
2612
2704
  renewToken() {
2613
2705
  return this.tokenRenewal ??= this.fetchNewToken().finally(() => {
@@ -2618,7 +2710,7 @@ var Cr = class {
2618
2710
  let e = ++this.renewalGeneration, t, n = new Promise((e) => {
2619
2711
  t = setTimeout(() => {
2620
2712
  console.error("[whoo-aiden-widget] could not renew the session: it took too long."), e({ failure: "unavailable" });
2621
- }, hr);
2713
+ }, br);
2622
2714
  });
2623
2715
  try {
2624
2716
  return await Promise.race([this.obtainToken(e), n]);
@@ -2629,73 +2721,73 @@ var Cr = class {
2629
2721
  async obtainToken(e) {
2630
2722
  let t = this.config.apiBaseUrl ?? "https://api.aidenvoice.com", n;
2631
2723
  try {
2632
- if (this.config.publishableKey) n = (await Sn(t, this.config.publishableKey)).token;
2724
+ if (this.config.publishableKey) n = (await En(t, this.config.publishableKey)).token;
2633
2725
  else if (this.getSessionToken) n = await this.getSessionToken();
2634
2726
  else return { failure: "refused" };
2635
2727
  } catch (e) {
2636
- return console.error("[whoo-aiden-widget] could not renew the session:", e), { failure: this.config.publishableKey && yr(e) ? "refused" : "unavailable" };
2728
+ return console.error("[whoo-aiden-widget] could not renew the session:", e), { failure: this.config.publishableKey && wr(e) ? "refused" : "unavailable" };
2637
2729
  }
2638
- let r = typeof n == "string" ? Ln(n) : null;
2730
+ let r = typeof n == "string" ? Vn(n) : null;
2639
2731
  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 });
2640
2732
  }
2641
2733
  async withSession(e, t) {
2642
2734
  let n = await this.currentToken(t);
2643
- if (!("token" in n)) throw vr(n.failure);
2735
+ if (!("token" in n)) throw Cr(n.failure);
2644
2736
  let { token: r } = n;
2645
2737
  try {
2646
2738
  return await e(r);
2647
2739
  } catch (n) {
2648
- if (!xr(n)) throw n;
2649
- let i = this.sessionToken && this.sessionToken !== r ? { token: this.sessionToken } : await _r(this.renewToken(), t);
2650
- if (!("token" in i)) throw vr(i.failure, n);
2740
+ if (!Er(n)) throw n;
2741
+ let i = this.sessionToken && this.sessionToken !== r ? { token: this.sessionToken } : await Sr(this.renewToken(), t);
2742
+ if (!("token" in i)) throw Cr(i.failure, n);
2651
2743
  try {
2652
2744
  return await e(i.token);
2653
2745
  } catch (e) {
2654
- throw xr(e) ? new br(e) : e;
2746
+ throw Er(e) ? new Tr(e) : e;
2655
2747
  }
2656
2748
  }
2657
2749
  }
2658
- }, $ = 20, wr = 12, Tr = 300, Er = 352;
2659
- function Dr() {
2750
+ }, $ = 20, kr = 12, Ar = 300, jr = 352;
2751
+ function Mr() {
2660
2752
  try {
2661
2753
  return typeof CSS < "u" && CSS.supports?.("height", "100dvh") ? "dvh" : "vh";
2662
2754
  } catch {
2663
2755
  return "vh";
2664
2756
  }
2665
2757
  }
2666
- function Or(e, t) {
2667
- let { offsetX: n, offsetY: r, launcherSize: i, panelWidth: a, panelHeight: o } = ie(t.layout), s = (e) => typeof t.layout?.offset?.[e] == "number";
2758
+ function Nr(e, t) {
2759
+ let { offsetX: n, offsetY: r, launcherSize: i, panelWidth: a, panelHeight: o, cornerRadius: s } = ce(t.layout), c = (e) => typeof t.layout?.offset?.[e] == "number";
2668
2760
  if (typeof window < "u" && window.innerWidth > 0 && window.innerHeight > 0) {
2669
- let e = Math.max($, window.innerWidth - Tr), t = Math.max($, window.innerHeight - i - Er);
2670
- s("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.`), s("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.`);
2761
+ let e = Math.max($, window.innerWidth - Ar), t = Math.max($, window.innerHeight - i - jr);
2762
+ 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.`);
2671
2763
  }
2672
- let c = `100${Dr()}`, l = `min(${n}px, max(${$}px, calc(100vw - ${Tr}px)), calc(100vw - ${i}px))`, u = `min(${r}px, max(${$}px, calc(${c} - ${i + Er}px)), calc(${c} - ${i}px))`, d = `calc(${u} + ${i}px + ${wr}px)`, f = t.position === "bottom-left", p = (t, n) => e.style.setProperty(t, n);
2673
- p("--whoo-widget-inset-left", f ? l : "auto"), p("--whoo-widget-inset-right", f ? "auto" : l), p("--whoo-widget-inset-bottom", u), p("--whoo-widget-launcher-size", `${i}px`), p("--whoo-widget-panel-bottom", d), p("--whoo-widget-panel-width", `${a}px`), p("--whoo-widget-panel-height", `${o}px`), p("--whoo-widget-panel-max-width", `calc(100vw - ${l} - ${$}px)`), p("--whoo-widget-panel-max-height", `calc(${c} - ${d} - ${$}px)`);
2764
+ let l = `100${Mr()}`, u = `min(${n}px, max(${$}px, calc(100vw - ${Ar}px)), calc(100vw - ${i}px))`, d = `min(${r}px, max(${$}px, calc(${l} - ${i + jr}px)), calc(${l} - ${i}px))`, f = `calc(${d} + ${i}px + ${kr}px)`, p = t.position === "bottom-left", m = (t, n) => e.style.setProperty(t, n);
2765
+ 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`);
2674
2766
  }
2675
2767
  //#endregion
2676
2768
  //#region src/styles.css?inline
2677
- var kr = ":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);font-family:var(--whoo-widget-font,-apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif);color:inherit;border:none;border-radius:12px;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-title{color:var(--whoo-widget-ink,#111);overflow-wrap:anywhere;flex:auto;min-width:0;margin:0;font-size:15px;font-weight:600}.whoo-widget-header-actions{background: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}@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{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);unicode-bidi:plaintext;border-radius:6px;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{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;border-radius:6px;padding:8px 16px;font-weight:600;display:block}.whoo-widget-composer-send{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;border-radius:6px;padding:8px 16px}.whoo-widget-composer-send[aria-disabled=true],.whoo-widget-composer-input[aria-disabled=true]{opacity:.6;cursor:not-allowed}.whoo-widget-feedback{align-items:center;gap:6px;margin-top:4px;display:flex}.whoo-widget-feedback-buttons{gap:6px;display:flex}.whoo-widget-feedback-buttons button{cursor:pointer;color: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}}";
2769
+ var Pr = ":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}}";
2678
2770
  //#endregion
2679
2771
  //#region src/mount.tsx
2680
- function Ar(e) {
2772
+ function Fr(e) {
2681
2773
  let t = document.createElement("div");
2682
2774
  t.id = "whoo-aiden-widget-host", t.style.position = "relative", t.style.zIndex = String(c(e.zIndex));
2683
2775
  let n = t.attachShadow({ mode: "open" }), r = document.createElement("style");
2684
- r.textContent = kr, n.appendChild(r);
2776
+ r.textContent = Pr, n.appendChild(r);
2685
2777
  let i = document.createElement("div");
2686
2778
  n.appendChild(i);
2687
2779
  let a = /* @__PURE__ */ new Set();
2688
- fr(i, e, a), Or(i, e);
2689
- let o = new Cr(e);
2780
+ _r(i, e, a), Nr(i, e);
2781
+ let o = new Or(e);
2690
2782
  i.setAttribute("lang", o.languageTag), i.setAttribute("dir", o.dir);
2691
- let s = X(e.color) !== null, l = null, u = "", d = te(e.theme).colors, f = Object.keys(d).length > 0, p = {
2783
+ let s = X(e.color) !== null, l = null, u = "", d = ae(e.theme).colors, f = Object.keys(d).length > 0, p = {
2692
2784
  color: e.color,
2693
2785
  inkColor: e.inkColor,
2694
2786
  accentColor: e.accentColor
2695
2787
  };
2696
2788
  return o.subscribe((t) => {
2697
2789
  let n = !1;
2698
- !s && t.primaryColor && t.primaryColor !== l && (l = t.primaryColor, or(i, t.primaryColor, e.color), X(t.primaryColor) && (p = {
2790
+ !s && t.primaryColor && t.primaryColor !== l && (l = t.primaryColor, dr(i, t.primaryColor, e.color), X(t.primaryColor) && (p = {
2699
2791
  ...p,
2700
2792
  color: t.primaryColor
2701
2793
  }), n = !0);
@@ -2703,7 +2795,7 @@ function Ar(e) {
2703
2795
  if ((t.inkColor || t.accentColor) && r !== u) {
2704
2796
  u = r;
2705
2797
  let a = X(e.inkColor) ? e.inkColor : t.inkColor, o = X(e.accentColor) ? e.accentColor : t.accentColor;
2706
- sr(i, {
2798
+ fr(i, {
2707
2799
  inkColor: a,
2708
2800
  accentColor: o
2709
2801
  }), p = {
@@ -2712,18 +2804,18 @@ function Ar(e) {
2712
2804
  accentColor: o
2713
2805
  }, n = !0;
2714
2806
  }
2715
- n && (cr(i, d), f && dr({
2807
+ n && (pr(i, d), f && gr({
2716
2808
  ...p,
2717
2809
  overrides: d
2718
2810
  }, a));
2719
- }), o.init(), Re(/* @__PURE__ */ W(yn, { controller: o }), i), document.body.appendChild(t), { unmount() {
2720
- Re(null, i), t.remove();
2811
+ }), o.init(), He(/* @__PURE__ */ W(Cn, { controller: o }), i), document.body.appendChild(t), { unmount() {
2812
+ He(null, i), t.remove();
2721
2813
  } };
2722
2814
  }
2723
2815
  //#endregion
2724
2816
  //#region src/index.ts
2725
- function jr(e) {
2726
- return f(e), Ar(e);
2817
+ function Ir(e) {
2818
+ return f(e), Fr(e);
2727
2819
  }
2728
2820
  //#endregion
2729
- export { St as SUPPORTED_LANGUAGES, jr as init, Z as resolveTheme };
2821
+ export { Et as SUPPORTED_LANGUAGES, Ir as init, Z as resolveTheme };