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