@aiden-voice/widget 0.9.0 → 0.10.0

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