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