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