@enegelai/bot-widget 1.2.3 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/enegelaibot.umd.js +371 -357
- package/dist/index.es.js +575 -509
- package/package.json +6 -6
package/dist/index.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { css as x, LitElement as
|
|
5
|
-
import { property as l, customElement as k, queryAll as
|
|
6
|
-
import { unsafeHTML as
|
|
1
|
+
var pt = Object.defineProperty;
|
|
2
|
+
var ht = (t, e, o) => e in t ? pt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
|
|
3
|
+
var j = (t, e, o) => (ht(t, typeof e != "symbol" ? e + "" : e, o), o);
|
|
4
|
+
import { css as x, LitElement as de, html as c, svg as ve } from "lit";
|
|
5
|
+
import { property as l, customElement as k, queryAll as ut, query as pe, eventOptions as qe } from "lit/decorators.js";
|
|
6
|
+
import { unsafeHTML as q } from "lit-html/directives/unsafe-html.js";
|
|
7
7
|
import "@shoelace-style/shoelace/dist/themes/light.css";
|
|
8
8
|
import "@shoelace-style/shoelace/dist/themes/dark.css";
|
|
9
9
|
import "@shoelace-style/shoelace/dist/components/button/button.js";
|
|
@@ -21,38 +21,38 @@ import "@shoelace-style/shoelace/dist/components/switch/switch.js";
|
|
|
21
21
|
import "@shoelace-style/shoelace/dist/components/tooltip/tooltip.js";
|
|
22
22
|
import "@shoelace-style/shoelace/dist/components/spinner/spinner.js";
|
|
23
23
|
import "@shoelace-style/shoelace/dist/components/alert/alert.js";
|
|
24
|
-
import { repeat as
|
|
25
|
-
import { when as
|
|
24
|
+
import { repeat as we } from "lit/directives/repeat.js";
|
|
25
|
+
import { when as D } from "lit/directives/when.js";
|
|
26
26
|
import { until as Ie } from "lit-html/directives/until.js";
|
|
27
|
-
import
|
|
28
|
-
import
|
|
27
|
+
import gt from "markdown-it";
|
|
28
|
+
import bt from "markdown-it-link-attributes";
|
|
29
29
|
import "@shoelace-style/shoelace/dist/components/popup/popup.js";
|
|
30
30
|
function De(t) {
|
|
31
31
|
return typeof t == "function" ? t() : t;
|
|
32
32
|
}
|
|
33
|
-
const
|
|
33
|
+
const ce = class ce extends Event {
|
|
34
34
|
/**
|
|
35
35
|
* @param {string} key of the state that has changed
|
|
36
36
|
* @param {unknown} value for the changed key
|
|
37
37
|
*/
|
|
38
38
|
constructor(o, a, r) {
|
|
39
|
-
super(
|
|
39
|
+
super(ce.eventName, {
|
|
40
40
|
cancelable: !1
|
|
41
41
|
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
j(this, "key");
|
|
43
|
+
j(this, "state");
|
|
44
|
+
j(this, "value");
|
|
45
45
|
this.key = o, this.value = a, this.state = r;
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
|
|
49
|
-
let
|
|
50
|
-
const
|
|
48
|
+
j(ce, "eventName", "lit-state-changed");
|
|
49
|
+
let B = ce;
|
|
50
|
+
const mt = (t, e) => e !== t && (e === e || t === t);
|
|
51
51
|
class X extends EventTarget {
|
|
52
52
|
constructor() {
|
|
53
53
|
super();
|
|
54
54
|
// hold a reference to hooks
|
|
55
|
-
|
|
55
|
+
j(this, "hookMap", /* @__PURE__ */ new Map());
|
|
56
56
|
this.constructor.finalize(), this.propertyMap && [...this.propertyMap].forEach(([o, a]) => {
|
|
57
57
|
if (a.initialValue !== void 0) {
|
|
58
58
|
const r = De(a.initialValue);
|
|
@@ -81,7 +81,7 @@ class X extends EventTarget {
|
|
|
81
81
|
Object.defineProperty(this.prototype, o, s);
|
|
82
82
|
}
|
|
83
83
|
static getPropertyDescriptor(o, a, r) {
|
|
84
|
-
const s = (r == null ? void 0 : r.hasChanged) ||
|
|
84
|
+
const s = (r == null ? void 0 : r.hasChanged) || mt;
|
|
85
85
|
return {
|
|
86
86
|
get() {
|
|
87
87
|
return this[a];
|
|
@@ -116,26 +116,26 @@ class X extends EventTarget {
|
|
|
116
116
|
const s = (n) => {
|
|
117
117
|
(!a || a.includes(n.key)) && o(n.key, n.value, this);
|
|
118
118
|
};
|
|
119
|
-
return this.addEventListener(
|
|
119
|
+
return this.addEventListener(B.eventName, s, r), () => this.removeEventListener(B.eventName, s);
|
|
120
120
|
}
|
|
121
121
|
dispatchStateEvent(o, a, r) {
|
|
122
|
-
this.dispatchEvent(new
|
|
122
|
+
this.dispatchEvent(new B(o, a, r));
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
// a map holding decorators definition.
|
|
126
|
-
|
|
127
|
-
class
|
|
126
|
+
j(X, "propertyMap"), j(X, "properties"), j(X, "finalized", !1);
|
|
127
|
+
class Fe {
|
|
128
128
|
constructor(e, o, a) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
j(this, "host");
|
|
130
|
+
j(this, "state");
|
|
131
|
+
j(this, "callback");
|
|
132
132
|
this.host = e, this.state = o, this.host.addController(this), this.callback = a || (() => this.host.requestUpdate());
|
|
133
133
|
}
|
|
134
134
|
hostConnected() {
|
|
135
|
-
this.state.addEventListener(
|
|
135
|
+
this.state.addEventListener(B.eventName, this.callback), this.callback();
|
|
136
136
|
}
|
|
137
137
|
hostDisconnected() {
|
|
138
|
-
this.state.removeEventListener(
|
|
138
|
+
this.state.removeEventListener(B.eventName, this.callback);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
/**
|
|
@@ -143,7 +143,7 @@ class mt {
|
|
|
143
143
|
* Copyright 2017 Google LLC
|
|
144
144
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
145
145
|
*/
|
|
146
|
-
const
|
|
146
|
+
const Ue = ({ finisher: t, descriptor: e }) => (o, a) => {
|
|
147
147
|
var r;
|
|
148
148
|
if (a === void 0) {
|
|
149
149
|
const s = (r = o.originalKey) !== null && r !== void 0 ? r : o.key, n = e != null ? { kind: "method", placement: "prototype", key: s, descriptor: e(o.key) } : { ...o, key: s };
|
|
@@ -157,7 +157,7 @@ const Fe = ({ finisher: t, descriptor: e }) => (o, a) => {
|
|
|
157
157
|
}
|
|
158
158
|
};
|
|
159
159
|
function L(t) {
|
|
160
|
-
return
|
|
160
|
+
return Ue({
|
|
161
161
|
// @ts-ignore ctor is typof State and not typeof ReactiveElement
|
|
162
162
|
finisher: (e, o) => {
|
|
163
163
|
if (Object.getOwnPropertyDescriptor(e.prototype, o))
|
|
@@ -179,8 +179,8 @@ new URL(window.location.href);
|
|
|
179
179
|
const ft = {
|
|
180
180
|
prefix: "_ls"
|
|
181
181
|
};
|
|
182
|
-
function
|
|
183
|
-
return t = { ...ft, ...t },
|
|
182
|
+
function R(t) {
|
|
183
|
+
return t = { ...ft, ...t }, Ue({
|
|
184
184
|
// @ts-ignore ctor is typof State and not typeof ReactiveElement
|
|
185
185
|
finisher: (e, o) => {
|
|
186
186
|
const a = Object.getOwnPropertyDescriptor(e.prototype, o);
|
|
@@ -205,7 +205,7 @@ var vt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
205
205
|
function wt(t) {
|
|
206
206
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
207
207
|
}
|
|
208
|
-
var
|
|
208
|
+
var Ze = { exports: {} };
|
|
209
209
|
(function(t) {
|
|
210
210
|
(function(e, o) {
|
|
211
211
|
t.exports ? t.exports = o() : e.log = o();
|
|
@@ -251,52 +251,52 @@ var Ue = { exports: {} };
|
|
|
251
251
|
function y(u, f, w) {
|
|
252
252
|
return i(u) || m.apply(this, arguments);
|
|
253
253
|
}
|
|
254
|
-
function
|
|
255
|
-
var h = this,
|
|
254
|
+
function be(u, f, w) {
|
|
255
|
+
var h = this, Le;
|
|
256
256
|
f = f ?? "WARN";
|
|
257
|
-
var
|
|
258
|
-
typeof u == "string" ?
|
|
259
|
-
function
|
|
260
|
-
var
|
|
261
|
-
if (!(typeof window === o || !
|
|
257
|
+
var A = "loglevel";
|
|
258
|
+
typeof u == "string" ? A += ":" + u : typeof u == "symbol" && (A = void 0);
|
|
259
|
+
function lt(p) {
|
|
260
|
+
var T = (r[p] || "silent").toUpperCase();
|
|
261
|
+
if (!(typeof window === o || !A)) {
|
|
262
262
|
try {
|
|
263
|
-
window.localStorage[
|
|
263
|
+
window.localStorage[A] = T;
|
|
264
264
|
return;
|
|
265
265
|
} catch {
|
|
266
266
|
}
|
|
267
267
|
try {
|
|
268
|
-
window.document.cookie = encodeURIComponent(
|
|
268
|
+
window.document.cookie = encodeURIComponent(A) + "=" + T + ";";
|
|
269
269
|
} catch {
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
function He() {
|
|
274
|
-
var
|
|
275
|
-
if (!(typeof window === o || !
|
|
274
|
+
var p;
|
|
275
|
+
if (!(typeof window === o || !A)) {
|
|
276
276
|
try {
|
|
277
|
-
|
|
277
|
+
p = window.localStorage[A];
|
|
278
278
|
} catch {
|
|
279
279
|
}
|
|
280
|
-
if (typeof
|
|
280
|
+
if (typeof p === o)
|
|
281
281
|
try {
|
|
282
|
-
var
|
|
283
|
-
encodeURIComponent(
|
|
282
|
+
var T = window.document.cookie, Y = T.indexOf(
|
|
283
|
+
encodeURIComponent(A) + "="
|
|
284
284
|
);
|
|
285
|
-
Y !== -1 && (
|
|
285
|
+
Y !== -1 && (p = /^([^;]+)/.exec(T.slice(Y))[1]);
|
|
286
286
|
} catch {
|
|
287
287
|
}
|
|
288
|
-
return h.levels[
|
|
288
|
+
return h.levels[p] === void 0 && (p = void 0), p;
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
|
-
function
|
|
292
|
-
if (!(typeof window === o || !
|
|
291
|
+
function ct() {
|
|
292
|
+
if (!(typeof window === o || !A)) {
|
|
293
293
|
try {
|
|
294
|
-
window.localStorage.removeItem(
|
|
294
|
+
window.localStorage.removeItem(A);
|
|
295
295
|
return;
|
|
296
296
|
} catch {
|
|
297
297
|
}
|
|
298
298
|
try {
|
|
299
|
-
window.document.cookie = encodeURIComponent(
|
|
299
|
+
window.document.cookie = encodeURIComponent(A) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
|
|
300
300
|
} catch {
|
|
301
301
|
}
|
|
302
302
|
}
|
|
@@ -309,46 +309,46 @@ var Ue = { exports: {} };
|
|
|
309
309
|
ERROR: 4,
|
|
310
310
|
SILENT: 5
|
|
311
311
|
}, h.methodFactory = w || y, h.getLevel = function() {
|
|
312
|
-
return
|
|
313
|
-
}, h.setLevel = function(
|
|
314
|
-
if (typeof
|
|
315
|
-
if (
|
|
312
|
+
return Le;
|
|
313
|
+
}, h.setLevel = function(p, T) {
|
|
314
|
+
if (typeof p == "string" && h.levels[p.toUpperCase()] !== void 0 && (p = h.levels[p.toUpperCase()]), typeof p == "number" && p >= 0 && p <= h.levels.SILENT) {
|
|
315
|
+
if (Le = p, T !== !1 && lt(p), g.call(h, p, u), typeof console === o && p < h.levels.SILENT)
|
|
316
316
|
return "No console available for logging";
|
|
317
317
|
} else
|
|
318
|
-
throw "log.setLevel() called with invalid level: " +
|
|
319
|
-
}, h.setDefaultLevel = function(
|
|
320
|
-
f =
|
|
318
|
+
throw "log.setLevel() called with invalid level: " + p;
|
|
319
|
+
}, h.setDefaultLevel = function(p) {
|
|
320
|
+
f = p, He() || h.setLevel(p, !1);
|
|
321
321
|
}, h.resetLevel = function() {
|
|
322
|
-
h.setLevel(f, !1),
|
|
323
|
-
}, h.enableAll = function(
|
|
324
|
-
h.setLevel(h.levels.TRACE,
|
|
325
|
-
}, h.disableAll = function(
|
|
326
|
-
h.setLevel(h.levels.SILENT,
|
|
322
|
+
h.setLevel(f, !1), ct();
|
|
323
|
+
}, h.enableAll = function(p) {
|
|
324
|
+
h.setLevel(h.levels.TRACE, p);
|
|
325
|
+
}, h.disableAll = function(p) {
|
|
326
|
+
h.setLevel(h.levels.SILENT, p);
|
|
327
327
|
};
|
|
328
|
-
var
|
|
329
|
-
|
|
328
|
+
var ye = He();
|
|
329
|
+
ye == null && (ye = f), h.setLevel(ye, !1);
|
|
330
330
|
}
|
|
331
|
-
var
|
|
332
|
-
|
|
331
|
+
var S = new be(), me = {};
|
|
332
|
+
S.getLogger = function(f) {
|
|
333
333
|
if (typeof f != "symbol" && typeof f != "string" || f === "")
|
|
334
334
|
throw new TypeError("You must supply a name when creating a logger.");
|
|
335
|
-
var w =
|
|
336
|
-
return w || (w =
|
|
335
|
+
var w = me[f];
|
|
336
|
+
return w || (w = me[f] = new be(
|
|
337
337
|
f,
|
|
338
|
-
|
|
339
|
-
|
|
338
|
+
S.getLevel(),
|
|
339
|
+
S.methodFactory
|
|
340
340
|
)), w;
|
|
341
341
|
};
|
|
342
|
-
var
|
|
343
|
-
return
|
|
344
|
-
return typeof window !== o && window.log ===
|
|
345
|
-
},
|
|
346
|
-
return
|
|
347
|
-
},
|
|
342
|
+
var it = typeof window !== o ? window.log : void 0;
|
|
343
|
+
return S.noConflict = function() {
|
|
344
|
+
return typeof window !== o && window.log === S && (window.log = it), S;
|
|
345
|
+
}, S.getLoggers = function() {
|
|
346
|
+
return me;
|
|
347
|
+
}, S.default = S, S;
|
|
348
348
|
});
|
|
349
|
-
})(
|
|
350
|
-
var xt =
|
|
351
|
-
const
|
|
349
|
+
})(Ze);
|
|
350
|
+
var xt = Ze.exports;
|
|
351
|
+
const he = /* @__PURE__ */ wt(xt), kt = x`
|
|
352
352
|
:host {
|
|
353
353
|
}
|
|
354
354
|
.cb-wrapper {
|
|
@@ -415,68 +415,75 @@ const ce = /* @__PURE__ */ wt(xt), kt = x`
|
|
|
415
415
|
border-radius: 0;
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
|
-
`,
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
418
|
+
`, I = x`
|
|
419
|
+
:host {
|
|
420
|
+
--primary-color: var(--sl-color-primary-600);
|
|
421
|
+
}
|
|
422
422
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
423
|
+
.link__item,
|
|
424
|
+
.link__item:visited,
|
|
425
|
+
.link__item:active {
|
|
426
|
+
color: var(--primary-color);
|
|
427
|
+
}
|
|
428
428
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
429
|
+
.link__item.inverse,
|
|
430
|
+
.link__item.inverse:visited,
|
|
431
|
+
.link__item.inverse:active {
|
|
432
|
+
color: white;
|
|
433
|
+
}
|
|
434
434
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
435
|
+
/*
|
|
436
|
+
sl-button.cb-icon {
|
|
437
|
+
display: flex;
|
|
438
|
+
justify-content: center;
|
|
439
|
+
align-items: center;
|
|
440
|
+
}
|
|
441
|
+
*/
|
|
442
|
+
sl-button {
|
|
443
|
+
display: flex;
|
|
444
|
+
justify-content: center;
|
|
445
|
+
align-items: center;
|
|
446
|
+
}
|
|
440
447
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
448
|
+
.color-white {
|
|
449
|
+
color: white;
|
|
450
|
+
}
|
|
444
451
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
452
|
+
.color-default {
|
|
453
|
+
color: var(--sl-color-neutral-600);
|
|
454
|
+
}
|
|
448
455
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
456
|
+
.color-primary {
|
|
457
|
+
color: var(--sl-color-primary-600);
|
|
458
|
+
}
|
|
452
459
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
460
|
+
.color-success,
|
|
461
|
+
.color-green {
|
|
462
|
+
color: var(--sl-color-success-600);
|
|
463
|
+
}
|
|
457
464
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
465
|
+
.color-warning {
|
|
466
|
+
color: var(--sl-color-warning-600);
|
|
467
|
+
}
|
|
461
468
|
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
469
|
+
.color-danger,
|
|
470
|
+
.color-error {
|
|
471
|
+
color: var(--sl-color-danger-600);
|
|
472
|
+
}
|
|
466
473
|
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
474
|
+
.color-default {
|
|
475
|
+
color: var(--sl-color-neutral-600);
|
|
476
|
+
}
|
|
470
477
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
478
|
+
.text-button {
|
|
479
|
+
cursor: pointer;
|
|
480
|
+
}
|
|
474
481
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
`,
|
|
479
|
-
${
|
|
482
|
+
.text-button:hover {
|
|
483
|
+
text-decoration: underline;
|
|
484
|
+
}
|
|
485
|
+
`, Ne = x`
|
|
486
|
+
${I}
|
|
480
487
|
|
|
481
488
|
:host {
|
|
482
489
|
display: inline-flex;
|
|
@@ -498,31 +505,31 @@ const ce = /* @__PURE__ */ wt(xt), kt = x`
|
|
|
498
505
|
color: white;
|
|
499
506
|
}
|
|
500
507
|
`;
|
|
501
|
-
var _t = Object.defineProperty, Ct = Object.getOwnPropertyDescriptor,
|
|
508
|
+
var _t = Object.defineProperty, Ct = Object.getOwnPropertyDescriptor, Me = (t, e, o, a) => {
|
|
502
509
|
for (var r = a > 1 ? void 0 : a ? Ct(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
503
510
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
504
511
|
return a && r && _t(e, o, r), r;
|
|
505
512
|
};
|
|
506
|
-
let
|
|
513
|
+
let W = class extends de {
|
|
507
514
|
constructor() {
|
|
508
515
|
super(...arguments), this.color = "primary", this.svg = "";
|
|
509
516
|
}
|
|
510
517
|
render() {
|
|
511
518
|
return c`<span class="cb-icon color-${this.color}" part="base"
|
|
512
|
-
>${
|
|
519
|
+
>${q(this.svg)}</span
|
|
513
520
|
>`;
|
|
514
521
|
}
|
|
515
522
|
};
|
|
516
|
-
|
|
517
|
-
|
|
523
|
+
W.styles = Ne;
|
|
524
|
+
Me([
|
|
518
525
|
l({ type: String })
|
|
519
|
-
],
|
|
520
|
-
|
|
526
|
+
], W.prototype, "color", 2);
|
|
527
|
+
Me([
|
|
521
528
|
l({ type: String })
|
|
522
|
-
],
|
|
523
|
-
|
|
529
|
+
], W.prototype, "svg", 2);
|
|
530
|
+
W = Me([
|
|
524
531
|
k("cb-icon")
|
|
525
|
-
],
|
|
532
|
+
], W);
|
|
526
533
|
let $t = (t) => crypto.getRandomValues(new Uint8Array(t)), jt = (t, e, o) => {
|
|
527
534
|
let a = (2 << Math.log(t.length - 1) / Math.LN2) - 1, r = -~(1.6 * a * e / t.length);
|
|
528
535
|
return (s = e) => {
|
|
@@ -536,7 +543,7 @@ let $t = (t) => crypto.getRandomValues(new Uint8Array(t)), jt = (t, e, o) => {
|
|
|
536
543
|
};
|
|
537
544
|
}, Mt = (t, e = 21) => jt(t, e, $t);
|
|
538
545
|
const St = Mt("1234567890abcdefghijklmnopqrstuvwxyz", 10);
|
|
539
|
-
function
|
|
546
|
+
function xe(t = 10) {
|
|
540
547
|
return St(t);
|
|
541
548
|
}
|
|
542
549
|
function At(t) {
|
|
@@ -559,9 +566,9 @@ function Ot(t = !0) {
|
|
|
559
566
|
}), o.click();
|
|
560
567
|
});
|
|
561
568
|
}
|
|
562
|
-
const _ =
|
|
569
|
+
const _ = he.noConflict();
|
|
563
570
|
_.setLevel("info");
|
|
564
|
-
class
|
|
571
|
+
class Lt {
|
|
565
572
|
constructor(e = {}) {
|
|
566
573
|
this.id = 0, this.url = (e == null ? void 0 : e.url) || null, this.orgId = (e == null ? void 0 : e.orgId) || null, this.botId = (e == null ? void 0 : e.botId) || null, this.convId = (e == null ? void 0 : e.convId) || null, this._options = e || {}, this._ws = null, this.started = !1, this.connected = !1, this.onMessage = (e == null ? void 0 : e.onMessage) || null, this.queue = [], this.pause = (o) => new Promise((a) => setTimeout(a, o)), _.info(`WSC: Created, url: ${this.url}`);
|
|
567
574
|
}
|
|
@@ -669,27 +676,27 @@ class Ht {
|
|
|
669
676
|
});
|
|
670
677
|
}*/
|
|
671
678
|
}
|
|
672
|
-
var
|
|
679
|
+
var Ht = Object.defineProperty, It = Object.getOwnPropertyDescriptor, H = (t, e, o, a) => {
|
|
673
680
|
for (var r = a > 1 ? void 0 : a ? It(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
674
681
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
675
|
-
return a && r &&
|
|
682
|
+
return a && r && Ht(e, o, r), r;
|
|
676
683
|
};
|
|
677
|
-
const
|
|
678
|
-
|
|
679
|
-
const
|
|
680
|
-
class
|
|
684
|
+
const $ = he.noConflict();
|
|
685
|
+
$.setLevel("info");
|
|
686
|
+
const V = "cb_";
|
|
687
|
+
class M extends X {
|
|
681
688
|
constructor() {
|
|
682
689
|
super(...arguments), this.actionIdCounter = 0, this.wsClient = null, this.replyMessage = null;
|
|
683
690
|
}
|
|
684
691
|
// this is called at startup
|
|
685
692
|
setSetting(e) {
|
|
686
|
-
|
|
687
|
-
|
|
693
|
+
$.info("appState: Startup: setSetting", e), this.setting = e, this.initBot().catch((o) => {
|
|
694
|
+
$.info(`Exception during bot initialization: ${o.message}`);
|
|
688
695
|
});
|
|
689
696
|
}
|
|
690
697
|
clearConversation() {
|
|
691
698
|
this.wsClient && (this.wsClient.stop().then(() => {
|
|
692
|
-
}), this.wsClient = null), this.conversationId =
|
|
699
|
+
}), this.wsClient = null), this.conversationId = xe(), this.connectWs = "false", this.messages = [], this.actions = [], this.addMessage({
|
|
693
700
|
author: "assistant",
|
|
694
701
|
type: "text",
|
|
695
702
|
data: {
|
|
@@ -708,7 +715,7 @@ class H extends X {
|
|
|
708
715
|
async initBot() {
|
|
709
716
|
if (!this.botSettingsInitialized) {
|
|
710
717
|
const o = `${this.setting.url.startsWith("localhost") ? "http" : "https"}://${this.setting.url}/api/bot/settings/${this.setting.orgId}/${this.setting.botId}`;
|
|
711
|
-
|
|
718
|
+
$.info(`Getting bot settings at ${o} ...`);
|
|
712
719
|
let a = null, r = null;
|
|
713
720
|
try {
|
|
714
721
|
a = await fetch(o, {
|
|
@@ -716,15 +723,17 @@ class H extends X {
|
|
|
716
723
|
"Access-Control-Allow-Origin": "null",
|
|
717
724
|
"X-Enegel-Signature": this.setting.botId
|
|
718
725
|
}
|
|
719
|
-
}), !a.ok || a.status !== 200 ?
|
|
726
|
+
}), !a.ok || a.status !== 200 ? $.error(`Failed to get bot ${this.setting.botId} settings: ${a.status} ${a.statusText}`) : r = await a.json();
|
|
720
727
|
} catch (s) {
|
|
721
|
-
|
|
728
|
+
$.error(`Failed to get bot ${this.setting.botId} settings: ${s.message}`), r = null;
|
|
722
729
|
}
|
|
723
730
|
if (this.botSettingsInitialized = !0, !r) {
|
|
724
|
-
|
|
731
|
+
$.error("No bot settings available - bot disabled"), this.disabled = !0;
|
|
725
732
|
return;
|
|
726
733
|
}
|
|
727
|
-
this.setting.welcomeMessage = (r == null ? void 0 : r.welcomeMessage) || "How can I help ?"
|
|
734
|
+
this.setting.welcomeMessage = (r == null ? void 0 : r.welcomeMessage) || "How can I help ?", this.setting.engageMessage = (r == null ? void 0 : r.engageMessage) || "How can I help ?", this.setting.engageTimeout = (r == null ? void 0 : r.engageTimeout) || 5, setTimeout(() => {
|
|
735
|
+
this.open || ($.info("Engaging User !"), this.engage = !0);
|
|
736
|
+
}, this.setting.engageTimeout * 1e3);
|
|
728
737
|
}
|
|
729
738
|
Array.isArray(this.messages) && this.messages.length <= 0 && this.addMessage({
|
|
730
739
|
author: "assistant",
|
|
@@ -732,8 +741,8 @@ class H extends X {
|
|
|
732
741
|
data: {
|
|
733
742
|
text: this.setting.welcomeMessage
|
|
734
743
|
}
|
|
735
|
-
}), this.connectWs === "true" && (
|
|
736
|
-
|
|
744
|
+
}), this.connectWs === "true" && ($.info("appState: connectWs is true"), this.getWsClient().catch((e) => {
|
|
745
|
+
$.error(`Exception during ws client startup: ${e.message}`);
|
|
737
746
|
}));
|
|
738
747
|
}
|
|
739
748
|
// Lazy initialization: avoid connecting until we actually need to send something
|
|
@@ -743,7 +752,7 @@ class H extends X {
|
|
|
743
752
|
if (this.wsClient)
|
|
744
753
|
return this.wsClient;
|
|
745
754
|
const o = `${this.setting.url.startsWith("localhost") ? "ws" : "wss"}://${this.setting.url}/api/bot/connect/${this.setting.orgId}/${this.setting.botId}/${this.conversationId}`;
|
|
746
|
-
return
|
|
755
|
+
return $.info(`Initiating ws connection to ${o} ...`), this.wsClient = new Lt({
|
|
747
756
|
url: o,
|
|
748
757
|
orgId: this.setting.orgId,
|
|
749
758
|
botId: this.setting.botId,
|
|
@@ -807,10 +816,10 @@ class H extends X {
|
|
|
807
816
|
}
|
|
808
817
|
}
|
|
809
818
|
async sendMessage(e) {
|
|
810
|
-
e = this.formatMessage(e),
|
|
819
|
+
e = this.formatMessage(e), $.info("Send Message:", e), this.messages = this.messages.concat([e]);
|
|
811
820
|
const o = await this.getWsClient();
|
|
812
821
|
if (!o) {
|
|
813
|
-
|
|
822
|
+
$.error("Error - failed to obtain ws client"), this.replyMessage = null;
|
|
814
823
|
return;
|
|
815
824
|
}
|
|
816
825
|
o.sendMessage({
|
|
@@ -822,7 +831,7 @@ class H extends X {
|
|
|
822
831
|
// TODO revisit below
|
|
823
832
|
formatMessage(e) {
|
|
824
833
|
var o;
|
|
825
|
-
return e.id || (e.id =
|
|
834
|
+
return e.id || (e.id = xe()), e.timestamp = Date.now(), e.author === "assistant" && (e.replyId = (o = this.messages[this.messages.length - 1]) == null ? void 0 : o.id), e;
|
|
826
835
|
}
|
|
827
836
|
// add message
|
|
828
837
|
addMessage(e) {
|
|
@@ -851,31 +860,36 @@ class H extends X {
|
|
|
851
860
|
this.messages = [];
|
|
852
861
|
}
|
|
853
862
|
}
|
|
854
|
-
|
|
855
|
-
|
|
863
|
+
H([
|
|
864
|
+
R({ prefix: V }),
|
|
856
865
|
L({ value: "en" })
|
|
857
|
-
],
|
|
858
|
-
|
|
859
|
-
|
|
866
|
+
], M.prototype, "language", 2);
|
|
867
|
+
H([
|
|
868
|
+
R({ prefix: V }),
|
|
860
869
|
L({ value: "light" })
|
|
861
|
-
],
|
|
862
|
-
|
|
863
|
-
|
|
870
|
+
], M.prototype, "theme", 2);
|
|
871
|
+
H([
|
|
872
|
+
R({ prefix: V }),
|
|
873
|
+
L({ type: Boolean, value: !1 })
|
|
874
|
+
], M.prototype, "open", 2);
|
|
875
|
+
H([
|
|
876
|
+
R({ prefix: V }),
|
|
864
877
|
L({ value: "false" })
|
|
865
|
-
],
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
L({ value:
|
|
869
|
-
],
|
|
870
|
-
|
|
871
|
-
|
|
878
|
+
], M.prototype, "connectWs", 2);
|
|
879
|
+
H([
|
|
880
|
+
R({ prefix: V }),
|
|
881
|
+
L({ value: xe() })
|
|
882
|
+
], M.prototype, "conversationId", 2);
|
|
883
|
+
H([
|
|
884
|
+
R({ prefix: V }),
|
|
872
885
|
L({ type: Array, value: [] })
|
|
873
|
-
],
|
|
874
|
-
|
|
886
|
+
], M.prototype, "messages", 2);
|
|
887
|
+
H([
|
|
875
888
|
L({
|
|
876
889
|
type: Array,
|
|
877
890
|
value: []
|
|
878
|
-
/*
|
|
891
|
+
/*
|
|
892
|
+
value: [
|
|
879
893
|
{
|
|
880
894
|
internalId: 1,
|
|
881
895
|
type: 'calendlyMeeting',
|
|
@@ -890,17 +904,41 @@ I([
|
|
|
890
904
|
url: 'https://signup.ticketspice.com/',
|
|
891
905
|
// TODO Any other properties
|
|
892
906
|
},
|
|
907
|
+
{
|
|
908
|
+
internalId: 3,
|
|
909
|
+
type: 'link',
|
|
910
|
+
title: 'Sign Up',
|
|
911
|
+
url: 'https://signup.ticketspice.com/',
|
|
912
|
+
// TODO Any other properties
|
|
913
|
+
},
|
|
914
|
+
{
|
|
915
|
+
internalId: 4,
|
|
916
|
+
type: 'calendlyMeeting',
|
|
917
|
+
title: 'Book 1:1 meeting',
|
|
918
|
+
url: 'https://calendly.com/slava-sayko/1-1-meeting-with-sales?hide_gdpr_banner=1',
|
|
919
|
+
// TODO Any other properties
|
|
920
|
+
},
|
|
921
|
+
{
|
|
922
|
+
internalId: 5,
|
|
923
|
+
type: 'calendlyMeeting',
|
|
924
|
+
title: 'Book 1:1 meeting',
|
|
925
|
+
url: 'https://calendly.com/slava-sayko/1-1-meeting-with-sales?hide_gdpr_banner=1',
|
|
926
|
+
// TODO Any other properties
|
|
927
|
+
},
|
|
893
928
|
],*/
|
|
894
929
|
})
|
|
895
|
-
],
|
|
896
|
-
|
|
930
|
+
], M.prototype, "actions", 2);
|
|
931
|
+
H([
|
|
897
932
|
L({ type: Boolean, value: !1 })
|
|
898
|
-
],
|
|
899
|
-
|
|
933
|
+
], M.prototype, "botSettingsInitialized", 2);
|
|
934
|
+
H([
|
|
900
935
|
L({ type: Boolean, value: !1 })
|
|
901
|
-
],
|
|
902
|
-
|
|
903
|
-
|
|
936
|
+
], M.prototype, "disabled", 2);
|
|
937
|
+
H([
|
|
938
|
+
L({ type: Boolean, value: !1 })
|
|
939
|
+
], M.prototype, "engage", 2);
|
|
940
|
+
H([
|
|
941
|
+
R({ prefix: V }),
|
|
904
942
|
L({
|
|
905
943
|
type: Object,
|
|
906
944
|
value: {
|
|
@@ -910,9 +948,9 @@ I([
|
|
|
910
948
|
welcomeMessage: null
|
|
911
949
|
}
|
|
912
950
|
})
|
|
913
|
-
],
|
|
914
|
-
const
|
|
915
|
-
${
|
|
951
|
+
], M.prototype, "setting", 2);
|
|
952
|
+
const d = new M(), Pt = x`
|
|
953
|
+
${I}
|
|
916
954
|
:host {
|
|
917
955
|
position: relative;
|
|
918
956
|
font-weight: bold;
|
|
@@ -952,13 +990,17 @@ const p = new H(), Pt = x`
|
|
|
952
990
|
font-size: 1.5rem;
|
|
953
991
|
color: white;
|
|
954
992
|
}
|
|
993
|
+
|
|
994
|
+
.cb-setting-button cb-icon {
|
|
995
|
+
display: inline;
|
|
996
|
+
}
|
|
955
997
|
`;
|
|
956
998
|
var zt = Object.defineProperty, Et = Object.getOwnPropertyDescriptor, Tt = (t, e, o, a) => {
|
|
957
999
|
for (var r = a > 1 ? void 0 : a ? Et(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
958
1000
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
959
1001
|
return a && r && zt(e, o, r), r;
|
|
960
1002
|
};
|
|
961
|
-
class C extends
|
|
1003
|
+
class C extends de {
|
|
962
1004
|
constructor() {
|
|
963
1005
|
super(...arguments), this.lang = "en";
|
|
964
1006
|
}
|
|
@@ -976,13 +1018,13 @@ class C extends le {
|
|
|
976
1018
|
Tt([
|
|
977
1019
|
l({ type: String })
|
|
978
1020
|
], C.prototype, "lang", 2);
|
|
979
|
-
const
|
|
980
|
-
var
|
|
981
|
-
for (var r = a > 1 ? void 0 : a ?
|
|
1021
|
+
const oe = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8L2.146 2.854Z"/></svg>';
|
|
1022
|
+
var Bt = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, We = (t, e, o, a) => {
|
|
1023
|
+
for (var r = a > 1 ? void 0 : a ? Rt(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
982
1024
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
983
|
-
return a && r &&
|
|
1025
|
+
return a && r && Bt(e, o, r), r;
|
|
984
1026
|
};
|
|
985
|
-
let
|
|
1027
|
+
let re = class extends C {
|
|
986
1028
|
constructor() {
|
|
987
1029
|
super(...arguments), this.title = "ChatBot";
|
|
988
1030
|
}
|
|
@@ -990,13 +1032,13 @@ let te = class extends C {
|
|
|
990
1032
|
return c` <header class="cb-header" part="header">
|
|
991
1033
|
<span class="left">
|
|
992
1034
|
<sl-button @click=${this._clickHandler} class="cb-setting-button" variant="text" circle>
|
|
993
|
-
<cb-icon color="white" svg="${
|
|
1035
|
+
<cb-icon color="white" svg="${d.setting.logoSvg}"></cb-icon>
|
|
994
1036
|
</sl-button>
|
|
995
1037
|
</span>
|
|
996
1038
|
<span class="center title">${this.title}</span>
|
|
997
1039
|
<span class="right">
|
|
998
1040
|
<sl-button @click=${this._clickCloseHandler} class="cb-setting-button" variant="text" circle>
|
|
999
|
-
<cb-icon color="white" svg="${
|
|
1041
|
+
<cb-icon color="white" svg="${oe}"></cb-icon>
|
|
1000
1042
|
</sl-button>
|
|
1001
1043
|
</span>
|
|
1002
1044
|
</header>`;
|
|
@@ -1012,15 +1054,15 @@ let te = class extends C {
|
|
|
1012
1054
|
});
|
|
1013
1055
|
}
|
|
1014
1056
|
};
|
|
1015
|
-
|
|
1016
|
-
|
|
1057
|
+
re.styles = Pt;
|
|
1058
|
+
We([
|
|
1017
1059
|
l({ type: String, attribute: "title" })
|
|
1018
|
-
],
|
|
1019
|
-
|
|
1060
|
+
], re.prototype, "title", 2);
|
|
1061
|
+
re = We([
|
|
1020
1062
|
k("cb-header")
|
|
1021
|
-
],
|
|
1063
|
+
], re);
|
|
1022
1064
|
const Vt = x`
|
|
1023
|
-
${
|
|
1065
|
+
${I}
|
|
1024
1066
|
.cb-footer {
|
|
1025
1067
|
line-height: 60px;
|
|
1026
1068
|
font-size: 16px;
|
|
@@ -1039,7 +1081,7 @@ var qt = Object.defineProperty, Dt = Object.getOwnPropertyDescriptor, Ft = (t, e
|
|
|
1039
1081
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
1040
1082
|
return a && r && qt(e, o, r), r;
|
|
1041
1083
|
};
|
|
1042
|
-
let
|
|
1084
|
+
let ke = class extends C {
|
|
1043
1085
|
constructor() {
|
|
1044
1086
|
super(...arguments), this.year = (/* @__PURE__ */ new Date()).getFullYear();
|
|
1045
1087
|
}
|
|
@@ -1074,12 +1116,12 @@ let fe = class extends C {
|
|
|
1074
1116
|
`;
|
|
1075
1117
|
}
|
|
1076
1118
|
};
|
|
1077
|
-
|
|
1078
|
-
|
|
1119
|
+
ke.styles = Vt;
|
|
1120
|
+
ke = Ft([
|
|
1079
1121
|
k("cb-footer")
|
|
1080
|
-
],
|
|
1122
|
+
], ke);
|
|
1081
1123
|
const Ut = x`
|
|
1082
|
-
${
|
|
1124
|
+
${I}
|
|
1083
1125
|
|
|
1084
1126
|
:host {
|
|
1085
1127
|
width: 100%;
|
|
@@ -1124,15 +1166,16 @@ const Ut = x`
|
|
|
1124
1166
|
|
|
1125
1167
|
.cb-actions-list {
|
|
1126
1168
|
margin: 10px 0px 0px 0px;
|
|
1127
|
-
padding:
|
|
1169
|
+
padding: 0px 0px;
|
|
1128
1170
|
//border-top: 1px solid rgba(0, 0, 0, 0.1);
|
|
1129
1171
|
display: flex;
|
|
1130
1172
|
justify-content: center;
|
|
1173
|
+
flex-wrap: wrap;
|
|
1131
1174
|
}
|
|
1132
1175
|
|
|
1133
1176
|
.cb-action {
|
|
1134
1177
|
padding: 6px 6px;
|
|
1135
|
-
margin: 1px
|
|
1178
|
+
margin: 1px 2px;
|
|
1136
1179
|
border-radius: 6px;
|
|
1137
1180
|
cursor: pointer;
|
|
1138
1181
|
color: rgba(255, 255, 255, 1);
|
|
@@ -1179,12 +1222,12 @@ var Zt = Object.defineProperty, Nt = Object.getOwnPropertyDescriptor, Wt = (t, e
|
|
|
1179
1222
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
1180
1223
|
return a && r && Zt(e, o, r), r;
|
|
1181
1224
|
};
|
|
1182
|
-
let
|
|
1225
|
+
let _e = class extends de {
|
|
1183
1226
|
render() {
|
|
1184
1227
|
return c` <div class="cb-thinking" style="color: rgb(34, 34, 34);"><span></span><span></span><span></span></div>`;
|
|
1185
1228
|
}
|
|
1186
1229
|
};
|
|
1187
|
-
|
|
1230
|
+
_e.styles = x`
|
|
1188
1231
|
.cb-thinking {
|
|
1189
1232
|
text-align: center;
|
|
1190
1233
|
}
|
|
@@ -1222,15 +1265,15 @@ ve.styles = x`
|
|
|
1222
1265
|
}
|
|
1223
1266
|
}
|
|
1224
1267
|
`;
|
|
1225
|
-
|
|
1268
|
+
_e = Wt([
|
|
1226
1269
|
k("cb-thinking")
|
|
1227
|
-
],
|
|
1228
|
-
var Kt = Object.defineProperty, Jt = Object.getOwnPropertyDescriptor,
|
|
1270
|
+
], _e);
|
|
1271
|
+
var Kt = Object.defineProperty, Jt = Object.getOwnPropertyDescriptor, Ke = (t, e, o, a) => {
|
|
1229
1272
|
for (var r = a > 1 ? void 0 : a ? Jt(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
1230
1273
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
1231
1274
|
return a && r && Kt(e, o, r), r;
|
|
1232
1275
|
};
|
|
1233
|
-
let
|
|
1276
|
+
let ae = class extends C {
|
|
1234
1277
|
constructor() {
|
|
1235
1278
|
super(...arguments), this.files = [];
|
|
1236
1279
|
}
|
|
@@ -1246,7 +1289,7 @@ let oe = class extends C {
|
|
|
1246
1289
|
</div>`;
|
|
1247
1290
|
}
|
|
1248
1291
|
};
|
|
1249
|
-
|
|
1292
|
+
ae.styles = x`
|
|
1250
1293
|
.cb-uploading {
|
|
1251
1294
|
text-align: left;
|
|
1252
1295
|
}
|
|
@@ -1264,14 +1307,14 @@ oe.styles = x`
|
|
|
1264
1307
|
margin-right: 5px;
|
|
1265
1308
|
}
|
|
1266
1309
|
`;
|
|
1267
|
-
|
|
1310
|
+
Ke([
|
|
1268
1311
|
l({ type: Array })
|
|
1269
|
-
],
|
|
1270
|
-
|
|
1312
|
+
], ae.prototype, "files", 2);
|
|
1313
|
+
ae = Ke([
|
|
1271
1314
|
k("cb-uploading")
|
|
1272
|
-
],
|
|
1315
|
+
], ae);
|
|
1273
1316
|
const Yt = x`
|
|
1274
|
-
${
|
|
1317
|
+
${I}
|
|
1275
1318
|
:host {
|
|
1276
1319
|
}
|
|
1277
1320
|
|
|
@@ -1291,12 +1334,12 @@ const Yt = x`
|
|
|
1291
1334
|
margin-right: 0.2em;
|
|
1292
1335
|
}
|
|
1293
1336
|
`;
|
|
1294
|
-
var Gt = Object.defineProperty, Xt = Object.getOwnPropertyDescriptor,
|
|
1337
|
+
var Gt = Object.defineProperty, Xt = Object.getOwnPropertyDescriptor, Se = (t, e, o, a) => {
|
|
1295
1338
|
for (var r = a > 1 ? void 0 : a ? Xt(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
1296
1339
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
1297
1340
|
return a && r && Gt(e, o, r), r;
|
|
1298
1341
|
};
|
|
1299
|
-
let
|
|
1342
|
+
let K = class extends de {
|
|
1300
1343
|
constructor() {
|
|
1301
1344
|
super(...arguments), this.url = "", this.inverse = !1;
|
|
1302
1345
|
}
|
|
@@ -1316,7 +1359,7 @@ let W = class extends le {
|
|
|
1316
1359
|
`;
|
|
1317
1360
|
}
|
|
1318
1361
|
};
|
|
1319
|
-
|
|
1362
|
+
K.styles = x`
|
|
1320
1363
|
:host {
|
|
1321
1364
|
--primary-color: var(--sl-color-primary-600);
|
|
1322
1365
|
}
|
|
@@ -1341,17 +1384,17 @@ W.styles = x`
|
|
|
1341
1384
|
text-decoration: underline;
|
|
1342
1385
|
}
|
|
1343
1386
|
`;
|
|
1344
|
-
|
|
1387
|
+
Se([
|
|
1345
1388
|
l({ type: String })
|
|
1346
|
-
],
|
|
1347
|
-
|
|
1389
|
+
], K.prototype, "url", 2);
|
|
1390
|
+
Se([
|
|
1348
1391
|
l({ type: Boolean })
|
|
1349
|
-
],
|
|
1350
|
-
|
|
1392
|
+
], K.prototype, "inverse", 2);
|
|
1393
|
+
K = Se([
|
|
1351
1394
|
k("cb-external-link")
|
|
1352
|
-
],
|
|
1395
|
+
], K);
|
|
1353
1396
|
const Qt = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-2v-1h2a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM1.928 15.849v-3.337h1.136v-.662H0v.662h1.134v3.337h.794Zm4.689-3.999h-.894L4.9 13.289h-.035l-.832-1.439h-.932l1.228 1.983l-1.24 2.016h.862l.853-1.415h.035l.85 1.415h.907l-1.253-1.992l1.274-2.007Zm1.93.662v3.337h-.794v-3.337H6.619v-.662h3.064v.662H8.546Z"/></svg>', eo = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM1.6 11.85H0v3.999h.791v-1.342h.803c.287 0 .531-.057.732-.173c.203-.117.358-.275.463-.474a1.42 1.42 0 0 0 .161-.677c0-.25-.053-.476-.158-.677a1.176 1.176 0 0 0-.46-.477c-.2-.12-.443-.179-.732-.179Zm.545 1.333a.795.795 0 0 1-.085.38a.574.574 0 0 1-.238.241a.794.794 0 0 1-.375.082H.788V12.48h.66c.218 0 .389.06.512.181c.123.122.185.296.185.522Zm1.217-1.333v3.999h1.46c.401 0 .734-.08.998-.237a1.45 1.45 0 0 0 .595-.689c.13-.3.196-.662.196-1.084c0-.42-.065-.778-.196-1.075a1.426 1.426 0 0 0-.589-.68c-.264-.156-.599-.234-1.005-.234H3.362Zm.791.645h.563c.248 0 .45.05.609.152a.89.89 0 0 1 .354.454c.079.201.118.452.118.753a2.3 2.3 0 0 1-.068.592a1.14 1.14 0 0 1-.196.422a.8.8 0 0 1-.334.252a1.298 1.298 0 0 1-.483.082h-.563v-2.707Zm3.743 1.763v1.591h-.79V11.85h2.548v.653H7.896v1.117h1.606v.638H7.896Z"/></svg>', to = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2H9v-1h3a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM.706 13.189v2.66H0V11.85h.806l1.14 2.596h.026l1.14-2.596h.8v3.999h-.716v-2.66h-.038l-.946 2.159h-.516l-.952-2.16H.706Zm3.919 2.66V11.85h1.459c.406 0 .741.078 1.005.234c.263.157.46.383.589.68c.13.297.196.655.196 1.075c0 .422-.066.784-.196 1.084c-.131.301-.33.53-.595.689c-.264.158-.597.237-1 .237H4.626Zm1.353-3.354h-.562v2.707h.562c.186 0 .347-.028.484-.082a.8.8 0 0 0 .334-.252a1.14 1.14 0 0 0 .196-.422c.045-.168.067-.365.067-.592a2.1 2.1 0 0 0-.117-.753a.89.89 0 0 0-.354-.454c-.159-.102-.362-.152-.61-.152Z"/></svg>', oo = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM3.517 14.841a1.13 1.13 0 0 0 .401.823c.13.108.289.192.478.252c.19.061.411.091.665.091c.338 0 .624-.053.859-.158c.236-.105.416-.252.539-.44c.125-.189.187-.408.187-.656c0-.224-.045-.41-.134-.56a1.001 1.001 0 0 0-.375-.357a2.027 2.027 0 0 0-.566-.21l-.621-.144a.97.97 0 0 1-.404-.176a.37.37 0 0 1-.144-.299c0-.156.062-.284.185-.384c.125-.101.296-.152.512-.152c.143 0 .266.023.37.068a.624.624 0 0 1 .246.181a.56.56 0 0 1 .12.258h.75a1.092 1.092 0 0 0-.2-.566a1.21 1.21 0 0 0-.5-.41a1.813 1.813 0 0 0-.78-.152c-.293 0-.551.05-.776.15c-.225.099-.4.24-.527.421c-.127.182-.19.395-.19.639c0 .201.04.376.122.524c.082.149.2.27.352.367c.152.095.332.167.539.213l.618.144c.207.049.361.113.463.193a.387.387 0 0 1 .152.326a.505.505 0 0 1-.085.29a.559.559 0 0 1-.255.193c-.111.047-.249.07-.413.07c-.117 0-.223-.013-.32-.04a.838.838 0 0 1-.248-.115a.578.578 0 0 1-.255-.384h-.765ZM.806 13.693c0-.248.034-.46.102-.633a.868.868 0 0 1 .302-.399a.814.814 0 0 1 .475-.137c.15 0 .283.032.398.097a.7.7 0 0 1 .272.26a.85.85 0 0 1 .12.381h.765v-.072a1.33 1.33 0 0 0-.466-.964a1.441 1.441 0 0 0-.489-.272a1.838 1.838 0 0 0-.606-.097c-.356 0-.66.074-.911.223c-.25.148-.44.359-.572.632c-.13.274-.196.6-.196.979v.498c0 .379.064.704.193.976c.131.271.322.48.572.626c.25.145.554.217.914.217c.293 0 .554-.055.785-.164c.23-.11.414-.26.55-.454a1.27 1.27 0 0 0 .226-.674v-.076h-.764a.799.799 0 0 1-.118.363a.7.7 0 0 1-.272.25a.874.874 0 0 1-.401.087a.845.845 0 0 1-.478-.132a.833.833 0 0 1-.299-.392a1.699 1.699 0 0 1-.102-.627v-.495Zm8.239 2.238h-.953l-1.338-3.999h.917l.896 3.138h.038l.888-3.138h.879l-1.327 4Z"/></svg>', ro = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM1.6 11.85H0v3.999h.791v-1.342h.803c.287 0 .531-.057.732-.173c.203-.117.358-.275.463-.474a1.42 1.42 0 0 0 .161-.677c0-.25-.053-.476-.158-.677a1.176 1.176 0 0 0-.46-.477c-.2-.12-.443-.179-.732-.179Zm.545 1.333a.795.795 0 0 1-.085.38a.574.574 0 0 1-.238.241a.794.794 0 0 1-.375.082H.788V12.48h.66c.218 0 .389.06.512.181c.123.122.185.296.185.522Zm2.817-1.333h-1.6v3.999h.791v-1.342h.803c.287 0 .531-.057.732-.173c.203-.117.358-.275.463-.474c.108-.201.161-.427.161-.677c0-.25-.052-.476-.158-.677a1.176 1.176 0 0 0-.46-.477c-.2-.12-.443-.179-.732-.179Zm.545 1.333a.795.795 0 0 1-.085.38a.574.574 0 0 1-.238.241a.793.793 0 0 1-.375.082H4.15V12.48h.66c.218 0 .389.06.512.181c.123.122.185.296.185.522Zm2.767-.67v3.336H7.48v-3.337H6.346v-.662h3.065v.662H8.274Z"/></svg>', ao = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2v-1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5Zm-7.839 9.166v.522c0 .256-.039.47-.117.641a.861.861 0 0 1-.322.387a.877.877 0 0 1-.469.126a.883.883 0 0 1-.471-.126a.868.868 0 0 1-.32-.386a1.55 1.55 0 0 1-.117-.642v-.522c0-.257.04-.471.117-.641a.868.868 0 0 1 .32-.387a.868.868 0 0 1 .471-.129c.176 0 .332.043.469.13a.861.861 0 0 1 .322.386c.078.17.117.384.117.641Zm.803.519v-.513c0-.377-.068-.7-.205-.972a1.46 1.46 0 0 0-.589-.63c-.254-.147-.56-.22-.917-.22c-.355 0-.662.073-.92.22a1.441 1.441 0 0 0-.589.627c-.136.271-.205.596-.205.975v.513c0 .375.069.7.205.973c.137.271.333.48.59.627c.257.144.564.216.92.216c.357 0 .662-.072.916-.216c.256-.147.452-.356.59-.627c.136-.274.204-.598.204-.973ZM0 11.926v4h1.459c.402 0 .735-.08.999-.238a1.45 1.45 0 0 0 .595-.689c.13-.3.196-.662.196-1.084c0-.42-.065-.778-.196-1.075a1.426 1.426 0 0 0-.59-.68c-.263-.156-.598-.234-1.004-.234H0Zm.791.645h.563c.248 0 .45.05.609.152a.89.89 0 0 1 .354.454c.079.201.118.452.118.753a2.3 2.3 0 0 1-.068.592a1.141 1.141 0 0 1-.196.422a.8.8 0 0 1-.334.252a1.298 1.298 0 0 1-.483.082H.79V12.57Zm7.422.483a1.732 1.732 0 0 0-.103.633v.495c0 .246.034.455.103.627a.834.834 0 0 0 .298.393a.845.845 0 0 0 .478.131a.868.868 0 0 0 .401-.088a.699.699 0 0 0 .273-.248a.8.8 0 0 0 .117-.364h.765v.076a1.268 1.268 0 0 1-.226.674c-.137.194-.32.345-.55.454a1.81 1.81 0 0 1-.786.164c-.36 0-.664-.072-.914-.216a1.424 1.424 0 0 1-.571-.627c-.13-.272-.194-.597-.194-.976v-.498c0-.379.066-.705.197-.978c.13-.274.321-.485.571-.633c.252-.149.556-.223.911-.223c.219 0 .421.032.607.097c.187.062.35.153.489.272a1.326 1.326 0 0 1 .466.964v.073H9.78a.85.85 0 0 0-.12-.38a.7.7 0 0 0-.273-.261a.802.802 0 0 0-.398-.097a.814.814 0 0 0-.475.138a.868.868 0 0 0-.301.398Z"/></svg>', so = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V11h-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5Zm-6.839 9.688v-.522a1.54 1.54 0 0 0-.117-.641a.861.861 0 0 0-.322-.387a.862.862 0 0 0-.469-.129a.868.868 0 0 0-.471.13a.868.868 0 0 0-.32.386a1.54 1.54 0 0 0-.117.641v.522c0 .256.04.47.117.641a.868.868 0 0 0 .32.387a.883.883 0 0 0 .471.126a.877.877 0 0 0 .469-.126a.861.861 0 0 0 .322-.386a1.55 1.55 0 0 0 .117-.642Zm.803-.516v.513c0 .375-.068.7-.205.973a1.47 1.47 0 0 1-.589.627c-.254.144-.56.216-.917.216a1.86 1.86 0 0 1-.92-.216a1.463 1.463 0 0 1-.589-.627a2.151 2.151 0 0 1-.205-.973v-.513c0-.379.069-.704.205-.975c.137-.274.333-.483.59-.627c.257-.147.564-.22.92-.22c.357 0 .662.073.916.22c.256.146.452.356.59.63c.136.271.204.595.204.972ZM1 15.925v-3.999h1.459c.406 0 .741.078 1.005.235c.264.156.46.382.589.68c.13.296.196.655.196 1.074c0 .422-.065.784-.196 1.084c-.131.301-.33.53-.595.689c-.264.158-.597.237-.999.237H1Zm1.354-3.354H1.79v2.707h.563c.185 0 .346-.028.483-.082a.8.8 0 0 0 .334-.252c.088-.114.153-.254.196-.422a2.3 2.3 0 0 0 .068-.592c0-.3-.04-.552-.118-.753a.89.89 0 0 0-.354-.454c-.158-.102-.361-.152-.61-.152Zm6.756 1.116c0-.248.034-.46.103-.633a.868.868 0 0 1 .301-.398a.814.814 0 0 1 .475-.138c.15 0 .283.032.398.097a.7.7 0 0 1 .273.26a.85.85 0 0 1 .12.381h.765v-.073a1.33 1.33 0 0 0-.466-.964a1.44 1.44 0 0 0-.49-.272a1.836 1.836 0 0 0-.606-.097c-.355 0-.66.074-.911.223c-.25.148-.44.359-.571.633c-.131.273-.197.6-.197.978v.498c0 .379.065.704.194.976c.13.271.321.48.571.627c.25.144.555.216.914.216c.293 0 .555-.054.785-.164c.23-.11.414-.26.551-.454a1.27 1.27 0 0 0 .226-.674v-.076h-.765a.8.8 0 0 1-.117.364a.699.699 0 0 1-.273.248a.874.874 0 0 1-.401.088a.845.845 0 0 1-.478-.131a.834.834 0 0 1-.298-.393a1.7 1.7 0 0 1-.103-.627v-.495Zm5.092-1.76h.894l-1.275 2.006l1.254 1.992h-.908l-.85-1.415h-.035l-.852 1.415h-.862l1.24-2.015l-1.228-1.984h.932l.832 1.439h.035l.823-1.439Z"/></svg>';
|
|
1354
|
-
var no = Object.defineProperty, io = Object.getOwnPropertyDescriptor,
|
|
1397
|
+
var no = Object.defineProperty, io = Object.getOwnPropertyDescriptor, Ae = (t, e, o, a) => {
|
|
1355
1398
|
for (var r = a > 1 ? void 0 : a ? io(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
1356
1399
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
1357
1400
|
return a && r && no(e, o, r), r;
|
|
@@ -1365,7 +1408,7 @@ const Pe = {
|
|
|
1365
1408
|
doc: ao,
|
|
1366
1409
|
docx: so
|
|
1367
1410
|
};
|
|
1368
|
-
let
|
|
1411
|
+
let J = class extends C {
|
|
1369
1412
|
constructor() {
|
|
1370
1413
|
super(...arguments), this.filename = "", this.url = "";
|
|
1371
1414
|
}
|
|
@@ -1395,16 +1438,16 @@ let K = class extends C {
|
|
|
1395
1438
|
`;
|
|
1396
1439
|
}
|
|
1397
1440
|
};
|
|
1398
|
-
|
|
1399
|
-
|
|
1441
|
+
J.styles = Yt;
|
|
1442
|
+
Ae([
|
|
1400
1443
|
l({ type: String })
|
|
1401
|
-
],
|
|
1402
|
-
|
|
1444
|
+
], J.prototype, "filename", 2);
|
|
1445
|
+
Ae([
|
|
1403
1446
|
l({ type: String })
|
|
1404
|
-
],
|
|
1405
|
-
|
|
1447
|
+
], J.prototype, "url", 2);
|
|
1448
|
+
J = Ae([
|
|
1406
1449
|
k("cb-file")
|
|
1407
|
-
],
|
|
1450
|
+
], J);
|
|
1408
1451
|
const lo = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6Z"/><path d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1ZM4.118 4L4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118ZM2.5 3h11V2h-11v1Z"/></g></svg>', co = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M8 8a3 3 0 1 0 0-6a3 3 0 0 0 0 6Zm2-3a2 2 0 1 1-4 0a2 2 0 0 1 4 0Zm4 8c0 1-1 1-1 1H3s-1 0-1-1s1-4 6-4s6 3 6 4Zm-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10c-2.29 0-3.516.68-4.168 1.332c-.678.678-.83 1.418-.832 1.664h10Z"/></svg>', po = x`
|
|
1409
1452
|
pre code.hljs {
|
|
1410
1453
|
display: block;
|
|
@@ -2571,7 +2614,7 @@ const lo = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="curr
|
|
|
2571
2614
|
background-color: #282c34;
|
|
2572
2615
|
}
|
|
2573
2616
|
`, ho = x`
|
|
2574
|
-
${
|
|
2617
|
+
${I}
|
|
2575
2618
|
${po}
|
|
2576
2619
|
|
|
2577
2620
|
.cb-message-row {
|
|
@@ -2727,21 +2770,21 @@ const lo = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="curr
|
|
|
2727
2770
|
}
|
|
2728
2771
|
`;
|
|
2729
2772
|
function uo() {
|
|
2730
|
-
const t = new
|
|
2773
|
+
const t = new gt({
|
|
2731
2774
|
linkify: !0
|
|
2732
2775
|
});
|
|
2733
|
-
return t.use(
|
|
2776
|
+
return t.use(bt, { attrs: { target: "_blank", rel: "noopener" } }), t;
|
|
2734
2777
|
}
|
|
2735
2778
|
async function ze(t) {
|
|
2736
2779
|
const e = uo();
|
|
2737
|
-
return c`${
|
|
2780
|
+
return c`${q(e.render(t))}`;
|
|
2738
2781
|
}
|
|
2739
|
-
var go = Object.defineProperty, bo = Object.getOwnPropertyDescriptor,
|
|
2782
|
+
var go = Object.defineProperty, bo = Object.getOwnPropertyDescriptor, ue = (t, e, o, a) => {
|
|
2740
2783
|
for (var r = a > 1 ? void 0 : a ? bo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
2741
2784
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
2742
2785
|
return a && r && go(e, o, r), r;
|
|
2743
2786
|
};
|
|
2744
|
-
let
|
|
2787
|
+
let F = class extends C {
|
|
2745
2788
|
constructor() {
|
|
2746
2789
|
super(...arguments), this.type = "assistant";
|
|
2747
2790
|
}
|
|
@@ -2785,12 +2828,12 @@ let V = class extends C {
|
|
|
2785
2828
|
});
|
|
2786
2829
|
}
|
|
2787
2830
|
render() {
|
|
2788
|
-
return
|
|
2831
|
+
return D(
|
|
2789
2832
|
this.message.data || this.message.isThinking,
|
|
2790
2833
|
() => c`
|
|
2791
2834
|
<div class="cb-message-row" part="cb-message-row">
|
|
2792
2835
|
<!-- message -->
|
|
2793
|
-
${
|
|
2836
|
+
${D(
|
|
2794
2837
|
this._isBot,
|
|
2795
2838
|
() => this.renderBotMessage(this.message),
|
|
2796
2839
|
() => this.renderUserMessage(this.message)
|
|
@@ -2827,7 +2870,7 @@ let V = class extends C {
|
|
|
2827
2870
|
renderMessageContent(t) {
|
|
2828
2871
|
var e;
|
|
2829
2872
|
return t.isThinking ? c`<cb-thinking></cb-thinking>` : t.isUploading ? c`<cb-uploading .files="${t.data.files || []}"></cb-uploading>` : t.type === "text" ? c`<div class="cb-message-text">
|
|
2830
|
-
${
|
|
2873
|
+
${D(
|
|
2831
2874
|
t.data.userName,
|
|
2832
2875
|
() => c`<div style="font-size: 12px; color:#9ca3af">${t.data.userName}</div>`,
|
|
2833
2876
|
() => null
|
|
@@ -2835,7 +2878,7 @@ let V = class extends C {
|
|
|
2835
2878
|
${Ie(
|
|
2836
2879
|
this._getMessageText(t).then((o) => c`${o}`)
|
|
2837
2880
|
)}
|
|
2838
|
-
</div>` : t.type === "file" ? c`${
|
|
2881
|
+
</div>` : t.type === "file" ? c`${we(
|
|
2839
2882
|
t.data.files || [],
|
|
2840
2883
|
(o) => o.id,
|
|
2841
2884
|
(o) => c`<cb-file filename="${o.name}" url="${o.url}"></cb-file>`
|
|
@@ -2850,7 +2893,7 @@ let V = class extends C {
|
|
|
2850
2893
|
const e = t.data.userAvatar || "";
|
|
2851
2894
|
return c` <img src="${e}" style="width: 24px;height: 24px;" /> `;
|
|
2852
2895
|
}
|
|
2853
|
-
return t.author === "system" ?
|
|
2896
|
+
return t.author === "system" ? ve`${q(d.setting.systemIconSvg)}` : ve`${q(d.setting.botIconSvg)}`;
|
|
2854
2897
|
}
|
|
2855
2898
|
renderBotMessage(t) {
|
|
2856
2899
|
return c`
|
|
@@ -2866,52 +2909,53 @@ let V = class extends C {
|
|
|
2866
2909
|
<!--<sl-avatar class="avatar user-avatar small" label="User">
|
|
2867
2910
|
<cb-icon slot="icon" svg="${co}" color="white"></cb-icon>
|
|
2868
2911
|
</sl-avatar>-->
|
|
2869
|
-
<div class="avatar user-avatar">${
|
|
2912
|
+
<div class="avatar user-avatar">${q(d.setting.userIconSvg)}</div>
|
|
2870
2913
|
${this.renderMessage(t)}
|
|
2871
2914
|
</div>
|
|
2872
2915
|
`;
|
|
2873
2916
|
}
|
|
2874
2917
|
};
|
|
2875
|
-
|
|
2876
|
-
|
|
2918
|
+
F.styles = ho;
|
|
2919
|
+
ue([
|
|
2877
2920
|
l({ type: Object })
|
|
2878
|
-
],
|
|
2879
|
-
|
|
2921
|
+
], F.prototype, "message", 2);
|
|
2922
|
+
ue([
|
|
2880
2923
|
l({ type: String })
|
|
2881
|
-
],
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
],
|
|
2885
|
-
|
|
2924
|
+
], F.prototype, "type", 2);
|
|
2925
|
+
ue([
|
|
2926
|
+
ut(".code-block-header__copy")
|
|
2927
|
+
], F.prototype, "copyBtns", 2);
|
|
2928
|
+
F = ue([
|
|
2886
2929
|
k("cb-message")
|
|
2887
|
-
],
|
|
2888
|
-
var mo = Object.defineProperty, yo = Object.getOwnPropertyDescriptor,
|
|
2930
|
+
], F);
|
|
2931
|
+
var mo = Object.defineProperty, yo = Object.getOwnPropertyDescriptor, Z = (t, e, o, a) => {
|
|
2889
2932
|
for (var r = a > 1 ? void 0 : a ? yo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
2890
2933
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
2891
2934
|
return a && r && mo(e, o, r), r;
|
|
2892
2935
|
};
|
|
2893
|
-
const Q =
|
|
2936
|
+
const Q = he.noConflict();
|
|
2894
2937
|
Q.setLevel("info");
|
|
2895
|
-
let
|
|
2938
|
+
let z = class extends C {
|
|
2896
2939
|
constructor() {
|
|
2897
2940
|
super(...arguments), this.messages = [], this.actions = [], this.calendlyInjected = !1, this.activeCalendlyAction = -1;
|
|
2898
2941
|
}
|
|
2899
2942
|
render() {
|
|
2900
2943
|
return c`
|
|
2901
2944
|
<div class="cb-message-list" part="cb-message-list">
|
|
2902
|
-
${
|
|
2945
|
+
${we(
|
|
2903
2946
|
this.messages,
|
|
2904
2947
|
(t) => t.id + JSON.stringify(t.data),
|
|
2905
2948
|
(t) => c`<cb-message .message="${t}"></cb-message>`
|
|
2906
2949
|
)}
|
|
2907
2950
|
${this.renderActions()}
|
|
2951
|
+
<div id="cb-message-list-bottom-anchor"></div>
|
|
2908
2952
|
</div>
|
|
2909
2953
|
`;
|
|
2910
2954
|
}
|
|
2911
2955
|
renderActions() {
|
|
2912
2956
|
return !Array.isArray(this.actions) || this.actions.length <= 0 ? null : c`
|
|
2913
2957
|
<div class="cb-actions-list">
|
|
2914
|
-
${
|
|
2958
|
+
${we(
|
|
2915
2959
|
this.actions,
|
|
2916
2960
|
(t) => t,
|
|
2917
2961
|
(t) => this.renderAction(t)
|
|
@@ -2919,6 +2963,9 @@ let R = class extends C {
|
|
|
2919
2963
|
</div>
|
|
2920
2964
|
`;
|
|
2921
2965
|
}
|
|
2966
|
+
scrollToBottom() {
|
|
2967
|
+
this._messageListBottomAnchor.scrollIntoView({ behavior: "smooth", block: "end", inline: "nearest" });
|
|
2968
|
+
}
|
|
2922
2969
|
renderAction(t) {
|
|
2923
2970
|
switch (t.type) {
|
|
2924
2971
|
case "calendlyMeeting":
|
|
@@ -2932,7 +2979,7 @@ let R = class extends C {
|
|
|
2932
2979
|
switch (Q.info("Got Calendly Event:", t.data), t.data.event) {
|
|
2933
2980
|
case "calendly.event_scheduled": {
|
|
2934
2981
|
const e = this.activeCalendlyAction;
|
|
2935
|
-
e >= 0 && (
|
|
2982
|
+
e >= 0 && (d.removeAction(e), d.addSystemMessage("Your meeting has been scheduled!"), this.activeCalendlyAction = -1);
|
|
2936
2983
|
}
|
|
2937
2984
|
}
|
|
2938
2985
|
}
|
|
@@ -2982,24 +3029,27 @@ let R = class extends C {
|
|
|
2982
3029
|
`;
|
|
2983
3030
|
}
|
|
2984
3031
|
};
|
|
2985
|
-
|
|
2986
|
-
|
|
3032
|
+
z.styles = Ut;
|
|
3033
|
+
Z([
|
|
2987
3034
|
l({ type: Array })
|
|
2988
|
-
],
|
|
2989
|
-
|
|
3035
|
+
], z.prototype, "messages", 2);
|
|
3036
|
+
Z([
|
|
2990
3037
|
l({ type: Array })
|
|
2991
|
-
],
|
|
2992
|
-
|
|
3038
|
+
], z.prototype, "actions", 2);
|
|
3039
|
+
Z([
|
|
3040
|
+
pe("#cb-message-list-bottom-anchor")
|
|
3041
|
+
], z.prototype, "_messageListBottomAnchor", 2);
|
|
3042
|
+
Z([
|
|
2993
3043
|
qe({ capture: !1, passive: !0 })
|
|
2994
|
-
],
|
|
2995
|
-
|
|
3044
|
+
], z.prototype, "invokeLinkAction", 1);
|
|
3045
|
+
Z([
|
|
2996
3046
|
qe({ capture: !1, passive: !0 })
|
|
2997
|
-
],
|
|
2998
|
-
|
|
3047
|
+
], z.prototype, "invokeCalendlyAction", 1);
|
|
3048
|
+
z = Z([
|
|
2999
3049
|
k("cb-message-list")
|
|
3000
|
-
],
|
|
3050
|
+
], z);
|
|
3001
3051
|
const fo = x`
|
|
3002
|
-
${
|
|
3052
|
+
${I}
|
|
3003
3053
|
|
|
3004
3054
|
:host {
|
|
3005
3055
|
width: 100%;
|
|
@@ -3047,7 +3097,7 @@ var xo = Object.defineProperty, ko = Object.getOwnPropertyDescriptor, P = (t, e,
|
|
|
3047
3097
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
3048
3098
|
return a && r && xo(e, o, r), r;
|
|
3049
3099
|
};
|
|
3050
|
-
let
|
|
3100
|
+
let O = class extends C {
|
|
3051
3101
|
constructor() {
|
|
3052
3102
|
super(...arguments), this.placeholder = "Type a message...", this.sendButtonLabel = "Send", this.enableFileUpload = !1, this.value = "", this.loading = !1, this.disabled = !1, this.currentKey = "";
|
|
3053
3103
|
}
|
|
@@ -3065,7 +3115,9 @@ let A = class extends C {
|
|
|
3065
3115
|
text: this.value
|
|
3066
3116
|
}
|
|
3067
3117
|
}
|
|
3068
|
-
}), this.value = "", this.inputElement.blur()
|
|
3118
|
+
}), this.value = "", this.inputElement.blur(), requestIdleCallback(() => {
|
|
3119
|
+
this.inputElement.focus();
|
|
3120
|
+
});
|
|
3069
3121
|
}
|
|
3070
3122
|
async _sendFileHandler() {
|
|
3071
3123
|
const t = await Ot();
|
|
@@ -3077,97 +3129,84 @@ let A = class extends C {
|
|
|
3077
3129
|
}
|
|
3078
3130
|
render() {
|
|
3079
3131
|
return c`
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3132
|
+
<div class="cb-user-input-wrapper" part="user-input-wrapper">
|
|
3133
|
+
<sl-textarea
|
|
3134
|
+
@sl-input=${this._inputChangeHandler}
|
|
3135
|
+
placeholder=${this.placeholder}
|
|
3136
|
+
class="cb-user-input"
|
|
3137
|
+
clearable="true"
|
|
3138
|
+
value=${this.value}
|
|
3139
|
+
rows="1"
|
|
3140
|
+
resize="auto"
|
|
3141
|
+
filled
|
|
3142
|
+
?disabled=${this.disabled}
|
|
3143
|
+
enterkeyhint="send"
|
|
3144
|
+
@keydown=${this._keyDownHandler}
|
|
3145
|
+
></sl-textarea>
|
|
3094
3146
|
|
|
3095
|
-
|
|
3096
|
-
|
|
3147
|
+
<span class="cb-input-buttons">
|
|
3148
|
+
${D(
|
|
3097
3149
|
this.enableFileUpload,
|
|
3098
3150
|
() => c`
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
variant="text"
|
|
3106
|
-
circle
|
|
3107
|
-
>
|
|
3108
|
-
<cb-icon svg="${wo}"></cb-icon>
|
|
3109
|
-
<!-- select file input -->
|
|
3110
|
-
<input
|
|
3111
|
-
type="file"
|
|
3112
|
-
id="file"
|
|
3113
|
-
name="file"
|
|
3114
|
-
class="file-input"
|
|
3115
|
-
/>
|
|
3116
|
-
</sl-button>
|
|
3117
|
-
`,
|
|
3151
|
+
<sl-button @click=${this._sendFileHandler} name="paperclip" label="Attachment" size="large" class="paperclip-button" variant="text" circle>
|
|
3152
|
+
<cb-icon svg="${wo}"></cb-icon>
|
|
3153
|
+
<!-- select file input -->
|
|
3154
|
+
<input type="file" id="file" name="file" class="file-input" />
|
|
3155
|
+
</sl-button>
|
|
3156
|
+
`,
|
|
3118
3157
|
() => c``
|
|
3119
3158
|
)}
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3159
|
+
<sl-button
|
|
3160
|
+
@click=${this._sendHandler}
|
|
3161
|
+
name="send"
|
|
3162
|
+
label="Send"
|
|
3163
|
+
size="small"
|
|
3164
|
+
class="send-button"
|
|
3165
|
+
variant="text"
|
|
3166
|
+
?disabled=${this.value.length === 0}
|
|
3167
|
+
?loading=${this.loading}
|
|
3168
|
+
circle
|
|
3169
|
+
>
|
|
3170
|
+
<cb-icon svg="${vo}"></cb-icon>
|
|
3171
|
+
</sl-button>
|
|
3172
|
+
</span>
|
|
3173
|
+
</div>
|
|
3174
|
+
`;
|
|
3136
3175
|
}
|
|
3137
3176
|
_keyDownHandler(t) {
|
|
3138
3177
|
t.key === "Enter" && !t.shiftKey && this._sendHandler();
|
|
3139
3178
|
}
|
|
3140
3179
|
};
|
|
3141
|
-
|
|
3180
|
+
O.styles = fo;
|
|
3142
3181
|
P([
|
|
3143
3182
|
l({ type: String, attribute: "placeholder" })
|
|
3144
|
-
],
|
|
3183
|
+
], O.prototype, "placeholder", 2);
|
|
3145
3184
|
P([
|
|
3146
3185
|
l({ type: String, attribute: "send-button-label" })
|
|
3147
|
-
],
|
|
3186
|
+
], O.prototype, "sendButtonLabel", 2);
|
|
3148
3187
|
P([
|
|
3149
3188
|
l({ type: Boolean, attribute: "enable-file-upload" })
|
|
3150
|
-
],
|
|
3189
|
+
], O.prototype, "enableFileUpload", 2);
|
|
3151
3190
|
P([
|
|
3152
3191
|
l({ type: String })
|
|
3153
|
-
],
|
|
3192
|
+
], O.prototype, "value", 2);
|
|
3154
3193
|
P([
|
|
3155
3194
|
l({ type: Boolean })
|
|
3156
|
-
],
|
|
3195
|
+
], O.prototype, "loading", 2);
|
|
3157
3196
|
P([
|
|
3158
3197
|
l({ type: Boolean })
|
|
3159
|
-
],
|
|
3198
|
+
], O.prototype, "disabled", 2);
|
|
3160
3199
|
P([
|
|
3161
3200
|
l({ type: String })
|
|
3162
|
-
],
|
|
3201
|
+
], O.prototype, "currentKey", 2);
|
|
3163
3202
|
P([
|
|
3164
|
-
|
|
3165
|
-
],
|
|
3166
|
-
|
|
3203
|
+
pe("sl-textarea")
|
|
3204
|
+
], O.prototype, "inputElement", 2);
|
|
3205
|
+
O = P([
|
|
3167
3206
|
k("cb-user-input")
|
|
3168
|
-
],
|
|
3207
|
+
], O);
|
|
3169
3208
|
const _o = x`
|
|
3170
|
-
${
|
|
3209
|
+
${I}
|
|
3171
3210
|
|
|
3172
3211
|
sl-dialog::part(base) {
|
|
3173
3212
|
z-index: 1000;
|
|
@@ -3201,12 +3240,12 @@ const _o = x`
|
|
|
3201
3240
|
gap: 8px;
|
|
3202
3241
|
}
|
|
3203
3242
|
`;
|
|
3204
|
-
var Co = Object.defineProperty, $o = Object.getOwnPropertyDescriptor,
|
|
3243
|
+
var Co = Object.defineProperty, $o = Object.getOwnPropertyDescriptor, ge = (t, e, o, a) => {
|
|
3205
3244
|
for (var r = a > 1 ? void 0 : a ? $o(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
3206
3245
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
3207
3246
|
return a && r && Co(e, o, r), r;
|
|
3208
3247
|
};
|
|
3209
|
-
let
|
|
3248
|
+
let U = class extends C {
|
|
3210
3249
|
constructor() {
|
|
3211
3250
|
super(...arguments), this.open = !1, this.label = "Dialog", this.zindex = 100;
|
|
3212
3251
|
}
|
|
@@ -3237,7 +3276,7 @@ let q = class extends C {
|
|
|
3237
3276
|
<cb-icon
|
|
3238
3277
|
color="default"
|
|
3239
3278
|
style="font-size: 1em;"
|
|
3240
|
-
svg="${
|
|
3279
|
+
svg="${oe}"
|
|
3241
3280
|
></cb-icon>
|
|
3242
3281
|
</sl-button>
|
|
3243
3282
|
</header>
|
|
@@ -3250,25 +3289,25 @@ let q = class extends C {
|
|
|
3250
3289
|
</sl-dialog>`;
|
|
3251
3290
|
}
|
|
3252
3291
|
};
|
|
3253
|
-
|
|
3254
|
-
|
|
3292
|
+
U.styles = _o;
|
|
3293
|
+
ge([
|
|
3255
3294
|
l({ type: Boolean })
|
|
3256
|
-
],
|
|
3257
|
-
|
|
3295
|
+
], U.prototype, "open", 2);
|
|
3296
|
+
ge([
|
|
3258
3297
|
l({ type: String, attribute: "label" })
|
|
3259
|
-
],
|
|
3260
|
-
|
|
3298
|
+
], U.prototype, "label", 2);
|
|
3299
|
+
ge([
|
|
3261
3300
|
l({ type: Number })
|
|
3262
|
-
],
|
|
3263
|
-
|
|
3301
|
+
], U.prototype, "zindex", 2);
|
|
3302
|
+
U = ge([
|
|
3264
3303
|
k("cb-dialog")
|
|
3265
|
-
],
|
|
3266
|
-
var jo = Object.defineProperty, Mo = Object.getOwnPropertyDescriptor,
|
|
3304
|
+
], U);
|
|
3305
|
+
var jo = Object.defineProperty, Mo = Object.getOwnPropertyDescriptor, Je = (t, e, o, a) => {
|
|
3267
3306
|
for (var r = a > 1 ? void 0 : a ? Mo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
3268
3307
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
3269
3308
|
return a && r && jo(e, o, r), r;
|
|
3270
3309
|
};
|
|
3271
|
-
let
|
|
3310
|
+
let se = class extends C {
|
|
3272
3311
|
constructor() {
|
|
3273
3312
|
super(...arguments), this.open = !1;
|
|
3274
3313
|
}
|
|
@@ -3302,7 +3341,7 @@ let re = class extends C {
|
|
|
3302
3341
|
this.emit("cancel");
|
|
3303
3342
|
}
|
|
3304
3343
|
};
|
|
3305
|
-
|
|
3344
|
+
se.styles = x`
|
|
3306
3345
|
.cb-clear-message-dialog {
|
|
3307
3346
|
}
|
|
3308
3347
|
|
|
@@ -3310,12 +3349,12 @@ re.styles = x`
|
|
|
3310
3349
|
z-index: 1000;
|
|
3311
3350
|
}
|
|
3312
3351
|
`;
|
|
3313
|
-
|
|
3352
|
+
Je([
|
|
3314
3353
|
l({ type: Boolean })
|
|
3315
|
-
],
|
|
3316
|
-
|
|
3354
|
+
], se.prototype, "open", 2);
|
|
3355
|
+
se = Je([
|
|
3317
3356
|
k("cb-clear-message-dialog")
|
|
3318
|
-
],
|
|
3357
|
+
], se);
|
|
3319
3358
|
const So = x`
|
|
3320
3359
|
:host {
|
|
3321
3360
|
// width: 380px;
|
|
@@ -3376,12 +3415,12 @@ const So = x`
|
|
|
3376
3415
|
grid-column-start: 2;
|
|
3377
3416
|
}
|
|
3378
3417
|
`;
|
|
3379
|
-
var Ao = Object.defineProperty, Oo = Object.getOwnPropertyDescriptor,
|
|
3418
|
+
var Ao = Object.defineProperty, Oo = Object.getOwnPropertyDescriptor, N = (t, e, o, a) => {
|
|
3380
3419
|
for (var r = a > 1 ? void 0 : a ? Oo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
3381
3420
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
3382
3421
|
return a && r && Ao(e, o, r), r;
|
|
3383
3422
|
};
|
|
3384
|
-
let
|
|
3423
|
+
let E = class extends C {
|
|
3385
3424
|
constructor() {
|
|
3386
3425
|
super(...arguments), this.open = !1, this.clearMessageDialogOpen = !1, this.customRequest = !1;
|
|
3387
3426
|
}
|
|
@@ -3420,7 +3459,7 @@ let z = class extends C {
|
|
|
3420
3459
|
Enable it for your own backend.
|
|
3421
3460
|
</sl-switch>
|
|
3422
3461
|
</div> -->
|
|
3423
|
-
${
|
|
3462
|
+
${D(
|
|
3424
3463
|
this.customRequest,
|
|
3425
3464
|
() => null,
|
|
3426
3465
|
() => this.renderInternalServices()
|
|
@@ -3544,27 +3583,27 @@ let z = class extends C {
|
|
|
3544
3583
|
});
|
|
3545
3584
|
}
|
|
3546
3585
|
};
|
|
3547
|
-
|
|
3548
|
-
|
|
3586
|
+
E.styles = So;
|
|
3587
|
+
N([
|
|
3549
3588
|
l({ type: Boolean })
|
|
3550
|
-
],
|
|
3551
|
-
|
|
3589
|
+
], E.prototype, "open", 2);
|
|
3590
|
+
N([
|
|
3552
3591
|
l({ type: Object })
|
|
3553
|
-
],
|
|
3554
|
-
|
|
3592
|
+
], E.prototype, "setting", 2);
|
|
3593
|
+
N([
|
|
3555
3594
|
l({ type: Boolean })
|
|
3556
|
-
],
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
],
|
|
3560
|
-
|
|
3595
|
+
], E.prototype, "clearMessageDialogOpen", 2);
|
|
3596
|
+
N([
|
|
3597
|
+
pe("sl-dialog")
|
|
3598
|
+
], E.prototype, "dialog", 2);
|
|
3599
|
+
N([
|
|
3561
3600
|
l({ type: Boolean })
|
|
3562
|
-
],
|
|
3563
|
-
|
|
3601
|
+
], E.prototype, "customRequest", 2);
|
|
3602
|
+
E = N([
|
|
3564
3603
|
k("cb-setting")
|
|
3565
|
-
],
|
|
3566
|
-
const
|
|
3567
|
-
${
|
|
3604
|
+
], E);
|
|
3605
|
+
const Lo = x`
|
|
3606
|
+
${I}
|
|
3568
3607
|
:host {
|
|
3569
3608
|
--primary-color: var(--sl-color-primary-600);
|
|
3570
3609
|
|
|
@@ -3590,7 +3629,7 @@ const Ho = x`
|
|
|
3590
3629
|
|
|
3591
3630
|
transition: all 0.3s ease-in-out;
|
|
3592
3631
|
|
|
3593
|
-
z-index:
|
|
3632
|
+
z-index: 99;
|
|
3594
3633
|
}
|
|
3595
3634
|
|
|
3596
3635
|
.cb-anchor:hover {
|
|
@@ -3608,11 +3647,11 @@ const Ho = x`
|
|
|
3608
3647
|
}
|
|
3609
3648
|
|
|
3610
3649
|
.cb-engage-popup {
|
|
3611
|
-
min-width:
|
|
3650
|
+
min-width: 250px;
|
|
3612
3651
|
min-height: 100px;
|
|
3613
|
-
color: rgb(
|
|
3652
|
+
color: var(--enegelai-bot-popup-color, rgb(0, 0, 0));
|
|
3614
3653
|
padding: 10px;
|
|
3615
|
-
background
|
|
3654
|
+
background: var(--enegelai-bot-popup-background, var(--sl-color-gray-50));
|
|
3616
3655
|
//border: 1px solid;
|
|
3617
3656
|
//border-color: var(--sl-color-gray-100);
|
|
3618
3657
|
border-radius: 6px;
|
|
@@ -3625,22 +3664,40 @@ const Ho = x`
|
|
|
3625
3664
|
font-stretch: normal;
|
|
3626
3665
|
font-variant: normal;
|
|
3627
3666
|
cursor: pointer;
|
|
3628
|
-
box-shadow: rgba(148, 149, 150, 0.
|
|
3629
|
-
|
|
3667
|
+
//box-shadow: rgba(148, 149, 150, 0.4) 20px 20px 20px 20px;
|
|
3668
|
+
box-shadow:
|
|
3669
|
+
0 4px 8px 0 rgba(0, 0, 0, 0.2),
|
|
3670
|
+
0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
|
3630
3671
|
}
|
|
3631
3672
|
|
|
3632
3673
|
.cb-anchor sl-popup {
|
|
3633
|
-
--arrow-color: var(--sl-color-gray-
|
|
3674
|
+
--arrow-color: var(--sl-color-gray-500);
|
|
3675
|
+
}
|
|
3676
|
+
|
|
3677
|
+
.cb-engage-popup-close {
|
|
3678
|
+
position: absolute;
|
|
3679
|
+
top: 0;
|
|
3680
|
+
right: 0;
|
|
3681
|
+
margin: 6px;
|
|
3682
|
+
color: var(--enegelai-bot-popup-close-color, var(--sl-color-gray-400));
|
|
3634
3683
|
}
|
|
3635
|
-
|
|
3636
|
-
|
|
3684
|
+
|
|
3685
|
+
.cb-engage-popup-content {
|
|
3686
|
+
padding: 2px;
|
|
3687
|
+
margin-top: 10px;
|
|
3688
|
+
display: flex;
|
|
3689
|
+
align-items: start;
|
|
3690
|
+
gap: 10px;
|
|
3691
|
+
}
|
|
3692
|
+
`, Ho = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M16 8c0 3.866-3.582 7-8 7a9.06 9.06 0 0 1-2.347-.306c-.584.296-1.925.864-4.181 1.234c-.2.032-.352-.176-.273-.362c.354-.836.674-1.95.77-2.966C.744 11.37 0 9.76 0 8c0-3.866 3.582-7 8-7s8 3.134 8 7zM5 8a1 1 0 1 0-2 0a1 1 0 0 0 2 0zm4 0a1 1 0 1 0-2 0a1 1 0 0 0 2 0zm3 1a1 1 0 1 0 0-2a1 1 0 0 0 0 2z"/></svg>';
|
|
3693
|
+
var Io = Object.defineProperty, Po = Object.getOwnPropertyDescriptor, Ye = (t, e, o, a) => {
|
|
3637
3694
|
for (var r = a > 1 ? void 0 : a ? Po(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
3638
3695
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
3639
3696
|
return a && r && Io(e, o, r), r;
|
|
3640
3697
|
};
|
|
3641
|
-
let
|
|
3698
|
+
let ne = class extends C {
|
|
3642
3699
|
constructor() {
|
|
3643
|
-
super(...arguments), this.open = !1;
|
|
3700
|
+
super(...arguments), this.store = new Fe(this, d), this.open = !1;
|
|
3644
3701
|
}
|
|
3645
3702
|
// handler click
|
|
3646
3703
|
_clickHandler() {
|
|
@@ -3651,37 +3708,43 @@ let ae = class extends C {
|
|
|
3651
3708
|
}
|
|
3652
3709
|
}), this.open = t;
|
|
3653
3710
|
}
|
|
3654
|
-
|
|
3655
|
-
console.log("
|
|
3711
|
+
_engageClickHandler(t) {
|
|
3712
|
+
console.log("engage close clicked!"), d.engage = !1, t.stopPropagation();
|
|
3656
3713
|
}
|
|
3657
3714
|
render() {
|
|
3658
3715
|
return c`
|
|
3659
3716
|
<div class="cb-anchor ${this.open ? "open" : ""}" part="cb-anchor" @click=${this._clickHandler.bind(this)}>
|
|
3660
|
-
<sl-popup placement="top-end" distance="16">
|
|
3717
|
+
<sl-popup placement="top-end" distance="16" ?active="${d.engage && !d.open}">
|
|
3661
3718
|
<sl-button slot="anchor" label="Start" size="large" variant="primary" class="icon anchor-button" circle>
|
|
3662
|
-
${
|
|
3719
|
+
${D(
|
|
3663
3720
|
this.open,
|
|
3664
|
-
() => c`<cb-icon color="white" svg="${
|
|
3665
|
-
() => c`<cb-icon color="white" svg="${
|
|
3721
|
+
() => c`<cb-icon color="white" svg="${oe}"></cb-icon>`,
|
|
3722
|
+
() => c`<cb-icon color="white" svg="${Ho}"></cb-icon>`
|
|
3666
3723
|
)}
|
|
3667
3724
|
</sl-button>
|
|
3668
|
-
<div class="cb-engage-popup">
|
|
3725
|
+
<div class="cb-engage-popup">
|
|
3726
|
+
<div class="cb-engage-popup-close" @click=${this._engageClickHandler.bind(this)}>${ve`${q(oe)}`}</div>
|
|
3727
|
+
<div class="cb-engage-popup-content">
|
|
3728
|
+
<cb-icon svg="${d.setting.logoSvg}"></cb-icon>
|
|
3729
|
+
<div>${d.setting.engageMessage}</div>
|
|
3730
|
+
</div>
|
|
3731
|
+
</div>
|
|
3669
3732
|
</sl-popup>
|
|
3670
3733
|
</div>
|
|
3671
3734
|
`;
|
|
3672
3735
|
}
|
|
3673
3736
|
};
|
|
3674
|
-
|
|
3675
|
-
|
|
3737
|
+
ne.styles = Lo;
|
|
3738
|
+
Ye([
|
|
3676
3739
|
l({ type: Boolean })
|
|
3677
|
-
],
|
|
3678
|
-
|
|
3740
|
+
], ne.prototype, "open", 2);
|
|
3741
|
+
ne = Ye([
|
|
3679
3742
|
k("cb-anchor")
|
|
3680
|
-
],
|
|
3743
|
+
], ne);
|
|
3681
3744
|
const zo = x`
|
|
3682
|
-
${
|
|
3683
|
-
`,
|
|
3684
|
-
var Eo = Object.defineProperty, To = Object.getOwnPropertyDescriptor,
|
|
3745
|
+
${I}
|
|
3746
|
+
`, Ce = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M4.54.146A.5.5 0 0 1 4.893 0h6.214a.5.5 0 0 1 .353.146l4.394 4.394a.5.5 0 0 1 .146.353v6.214a.5.5 0 0 1-.146.353l-4.394 4.394a.5.5 0 0 1-.353.146H4.893a.5.5 0 0 1-.353-.146L.146 11.46A.5.5 0 0 1 0 11.107V4.893a.5.5 0 0 1 .146-.353L4.54.146zM5.1 1L1 5.1v5.8L5.1 15h5.8l4.1-4.1V5.1L10.9 1H5.1z"/><path d="M7.002 11a1 1 0 1 1 2 0a1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 4.995z"/></g></svg>', Ge = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M7.938 2.016A.13.13 0 0 1 8.002 2a.13.13 0 0 1 .063.016a.146.146 0 0 1 .054.057l6.857 11.667c.036.06.035.124.002.183a.163.163 0 0 1-.054.06a.116.116 0 0 1-.066.017H1.146a.115.115 0 0 1-.066-.017a.163.163 0 0 1-.054-.06a.176.176 0 0 1 .002-.183L7.884 2.073a.147.147 0 0 1 .054-.057zm1.044-.45a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566z"/><path d="M7.002 12a1 1 0 1 1 2 0a1 1 0 0 1-2 0zM7.1 5.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995z"/></g></svg>', Xe = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M2.5 8a5.5 5.5 0 0 1 8.25-4.764a.5.5 0 0 0 .5-.866A6.5 6.5 0 1 0 14.5 8a.5.5 0 0 0-1 0a5.5 5.5 0 1 1-11 0z"/><path d="M15.354 3.354a.5.5 0 0 0-.708-.708L8 9.293L5.354 6.646a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0l7-7z"/></g></svg>', Qe = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/><path d="m8.93 6.588l-2.29.287l-.082.38l.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319c.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246c-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0a1 1 0 0 1 2 0z"/></g></svg>';
|
|
3747
|
+
var Eo = Object.defineProperty, To = Object.getOwnPropertyDescriptor, et = (t, e, o, a) => {
|
|
3685
3748
|
for (var r = a > 1 ? void 0 : a ? To(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
3686
3749
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
3687
3750
|
return a && r && Eo(e, o, r), r;
|
|
@@ -3689,26 +3752,26 @@ var Eo = Object.defineProperty, To = Object.getOwnPropertyDescriptor, Qe = (t, e
|
|
|
3689
3752
|
const Ee = {
|
|
3690
3753
|
error: {
|
|
3691
3754
|
variant: "danger",
|
|
3692
|
-
icon:
|
|
3755
|
+
icon: Ce
|
|
3693
3756
|
},
|
|
3694
3757
|
danger: {
|
|
3695
3758
|
variant: "danger",
|
|
3696
|
-
icon:
|
|
3759
|
+
icon: Ce
|
|
3697
3760
|
},
|
|
3698
3761
|
warning: {
|
|
3699
3762
|
variant: "warning",
|
|
3700
|
-
icon:
|
|
3763
|
+
icon: Ge
|
|
3701
3764
|
},
|
|
3702
3765
|
success: {
|
|
3703
3766
|
variant: "success",
|
|
3704
|
-
icon:
|
|
3767
|
+
icon: Xe
|
|
3705
3768
|
},
|
|
3706
3769
|
info: {
|
|
3707
3770
|
variant: "primary",
|
|
3708
|
-
icon:
|
|
3771
|
+
icon: Qe
|
|
3709
3772
|
}
|
|
3710
3773
|
};
|
|
3711
|
-
let
|
|
3774
|
+
let ie = class extends C {
|
|
3712
3775
|
constructor() {
|
|
3713
3776
|
super(...arguments), this.status = "info";
|
|
3714
3777
|
}
|
|
@@ -3717,19 +3780,19 @@ let se = class extends C {
|
|
|
3717
3780
|
return c`<cb-icon svg=${e} color="${t}"></cb-icon>`;
|
|
3718
3781
|
}
|
|
3719
3782
|
};
|
|
3720
|
-
|
|
3721
|
-
|
|
3783
|
+
ie.styles = Ne;
|
|
3784
|
+
et([
|
|
3722
3785
|
l({ type: String })
|
|
3723
|
-
],
|
|
3724
|
-
|
|
3786
|
+
], ie.prototype, "status", 2);
|
|
3787
|
+
ie = et([
|
|
3725
3788
|
k("cb-status-icon")
|
|
3726
|
-
],
|
|
3727
|
-
var
|
|
3728
|
-
for (var r = a > 1 ? void 0 : a ?
|
|
3789
|
+
], ie);
|
|
3790
|
+
var Bo = Object.defineProperty, Ro = Object.getOwnPropertyDescriptor, Vo = (t, e, o, a) => {
|
|
3791
|
+
for (var r = a > 1 ? void 0 : a ? Ro(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
3729
3792
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
3730
|
-
return a && r &&
|
|
3793
|
+
return a && r && Bo(e, o, r), r;
|
|
3731
3794
|
};
|
|
3732
|
-
let
|
|
3795
|
+
let $e = class extends C {
|
|
3733
3796
|
render() {
|
|
3734
3797
|
return c` <sl-alert variant="danger" open>
|
|
3735
3798
|
<cb-status-icon status="error" slot="icon"></cb-status-icon>
|
|
@@ -3745,10 +3808,10 @@ let xe = class extends C {
|
|
|
3745
3808
|
this.emit("setting:show");
|
|
3746
3809
|
}
|
|
3747
3810
|
};
|
|
3748
|
-
|
|
3749
|
-
|
|
3811
|
+
$e.styles = zo;
|
|
3812
|
+
$e = Vo([
|
|
3750
3813
|
k("cb-auth-alert")
|
|
3751
|
-
],
|
|
3814
|
+
], $e);
|
|
3752
3815
|
class Te extends Error {
|
|
3753
3816
|
constructor(e, o, a) {
|
|
3754
3817
|
const r = e.status || e.status === 0 ? e.status : "", s = e.statusText || "", n = `${r} ${s}`.trim(), i = n ? `status code ${n}` : "an unknown error";
|
|
@@ -3770,7 +3833,7 @@ class Te extends Error {
|
|
|
3770
3833
|
}), this.name = "HTTPError", this.response = e, this.request = o, this.options = a;
|
|
3771
3834
|
}
|
|
3772
3835
|
}
|
|
3773
|
-
class
|
|
3836
|
+
class tt extends Error {
|
|
3774
3837
|
constructor(e) {
|
|
3775
3838
|
super("Request timed out"), Object.defineProperty(this, "request", {
|
|
3776
3839
|
enumerable: !0,
|
|
@@ -3784,21 +3847,21 @@ const ee = (t) => t !== null && typeof t == "object", G = (...t) => {
|
|
|
3784
3847
|
for (const e of t)
|
|
3785
3848
|
if ((!ee(e) || Array.isArray(e)) && typeof e < "u")
|
|
3786
3849
|
throw new TypeError("The `options` argument must be an object");
|
|
3787
|
-
return
|
|
3788
|
-
},
|
|
3850
|
+
return Oe({}, ...t);
|
|
3851
|
+
}, ot = (t = {}, e = {}) => {
|
|
3789
3852
|
const o = new globalThis.Headers(t), a = e instanceof globalThis.Headers, r = new globalThis.Headers(e);
|
|
3790
3853
|
for (const [s, n] of r.entries())
|
|
3791
3854
|
a && n === "undefined" || n === void 0 ? o.delete(s) : o.set(s, n);
|
|
3792
3855
|
return o;
|
|
3793
|
-
},
|
|
3856
|
+
}, Oe = (...t) => {
|
|
3794
3857
|
let e = {}, o = {};
|
|
3795
3858
|
for (const a of t)
|
|
3796
3859
|
if (Array.isArray(a))
|
|
3797
3860
|
Array.isArray(e) || (e = []), e = [...e, ...a];
|
|
3798
3861
|
else if (ee(a)) {
|
|
3799
3862
|
for (let [r, s] of Object.entries(a))
|
|
3800
|
-
ee(s) && r in e && (s =
|
|
3801
|
-
ee(a.headers) && (o =
|
|
3863
|
+
ee(s) && r in e && (s = Oe(e[r], s)), e = { ...e, [r]: s };
|
|
3864
|
+
ee(a.headers) && (o = ot(o, a.headers), e.headers = o);
|
|
3802
3865
|
}
|
|
3803
3866
|
return e;
|
|
3804
3867
|
}, qo = (() => {
|
|
@@ -3812,23 +3875,23 @@ const ee = (t) => t !== null && typeof t == "object", G = (...t) => {
|
|
|
3812
3875
|
return t = !0, "half";
|
|
3813
3876
|
}
|
|
3814
3877
|
}).headers.has("Content-Type")), t && !e;
|
|
3815
|
-
})(), Do = typeof globalThis.AbortController == "function", Fo = typeof globalThis.ReadableStream == "function", Uo = typeof globalThis.FormData == "function",
|
|
3878
|
+
})(), Do = typeof globalThis.AbortController == "function", Fo = typeof globalThis.ReadableStream == "function", Uo = typeof globalThis.FormData == "function", rt = ["get", "post", "put", "patch", "head", "delete"], Zo = {
|
|
3816
3879
|
json: "application/json",
|
|
3817
3880
|
text: "text/*",
|
|
3818
3881
|
formData: "multipart/form-data",
|
|
3819
3882
|
arrayBuffer: "*/*",
|
|
3820
3883
|
blob: "*/*"
|
|
3821
|
-
},
|
|
3884
|
+
}, fe = 2147483647, at = Symbol("stop"), No = (t) => rt.includes(t) ? t.toUpperCase() : t, Wo = ["get", "put", "head", "delete", "options", "trace"], Ko = [408, 413, 429, 500, 502, 503, 504], st = [413, 429, 503], Be = {
|
|
3822
3885
|
limit: 2,
|
|
3823
3886
|
methods: Wo,
|
|
3824
3887
|
statusCodes: Ko,
|
|
3825
|
-
afterStatusCodes:
|
|
3888
|
+
afterStatusCodes: st,
|
|
3826
3889
|
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
3827
3890
|
backoffLimit: Number.POSITIVE_INFINITY
|
|
3828
3891
|
}, Jo = (t = {}) => {
|
|
3829
3892
|
if (typeof t == "number")
|
|
3830
3893
|
return {
|
|
3831
|
-
...
|
|
3894
|
+
...Be,
|
|
3832
3895
|
limit: t
|
|
3833
3896
|
};
|
|
3834
3897
|
if (t.methods && !Array.isArray(t.methods))
|
|
@@ -3836,15 +3899,15 @@ const ee = (t) => t !== null && typeof t == "object", G = (...t) => {
|
|
|
3836
3899
|
if (t.statusCodes && !Array.isArray(t.statusCodes))
|
|
3837
3900
|
throw new Error("retry.statusCodes must be an array");
|
|
3838
3901
|
return {
|
|
3839
|
-
...
|
|
3902
|
+
...Be,
|
|
3840
3903
|
...t,
|
|
3841
|
-
afterStatusCodes:
|
|
3904
|
+
afterStatusCodes: st
|
|
3842
3905
|
};
|
|
3843
3906
|
};
|
|
3844
3907
|
async function Yo(t, e, o) {
|
|
3845
3908
|
return new Promise((a, r) => {
|
|
3846
3909
|
const s = setTimeout(() => {
|
|
3847
|
-
e && e.abort(), r(new
|
|
3910
|
+
e && e.abort(), r(new tt(t));
|
|
3848
3911
|
}, o.timeout);
|
|
3849
3912
|
o.fetch(t).then(a).catch(r).then(() => {
|
|
3850
3913
|
clearTimeout(s);
|
|
@@ -3852,7 +3915,7 @@ async function Yo(t, e, o) {
|
|
|
3852
3915
|
});
|
|
3853
3916
|
}
|
|
3854
3917
|
const Go = !!globalThis.DOMException;
|
|
3855
|
-
function
|
|
3918
|
+
function Re(t) {
|
|
3856
3919
|
if (Go)
|
|
3857
3920
|
return new DOMException((t == null ? void 0 : t.reason) ?? "The operation was aborted.", "AbortError");
|
|
3858
3921
|
const e = new Error((t == null ? void 0 : t.reason) ?? "The operation was aborted.");
|
|
@@ -3862,25 +3925,25 @@ async function Xo(t, { signal: e }) {
|
|
|
3862
3925
|
return new Promise((o, a) => {
|
|
3863
3926
|
if (e) {
|
|
3864
3927
|
if (e.aborted) {
|
|
3865
|
-
a(
|
|
3928
|
+
a(Re(e));
|
|
3866
3929
|
return;
|
|
3867
3930
|
}
|
|
3868
3931
|
e.addEventListener("abort", r, { once: !0 });
|
|
3869
3932
|
}
|
|
3870
3933
|
function r() {
|
|
3871
|
-
a(
|
|
3934
|
+
a(Re(e)), clearTimeout(s);
|
|
3872
3935
|
}
|
|
3873
3936
|
const s = setTimeout(() => {
|
|
3874
3937
|
e == null || e.removeEventListener("abort", r), o();
|
|
3875
3938
|
}, t);
|
|
3876
3939
|
});
|
|
3877
3940
|
}
|
|
3878
|
-
class
|
|
3941
|
+
class le {
|
|
3879
3942
|
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
3880
3943
|
static create(e, o) {
|
|
3881
|
-
const a = new
|
|
3882
|
-
if (a._options.timeout >
|
|
3883
|
-
throw new RangeError(`The \`timeout\` option cannot be greater than ${
|
|
3944
|
+
const a = new le(e, o), r = async () => {
|
|
3945
|
+
if (a._options.timeout > fe)
|
|
3946
|
+
throw new RangeError(`The \`timeout\` option cannot be greater than ${fe}`);
|
|
3884
3947
|
await Promise.resolve();
|
|
3885
3948
|
let i = await a._fetch();
|
|
3886
3949
|
for (const g of a._options.hooks.afterResponse) {
|
|
@@ -3947,8 +4010,8 @@ class ne {
|
|
|
3947
4010
|
// TODO: credentials can be removed when the spec change is implemented in all browsers. Context: https://www.chromestatus.com/feature/4539473312350208
|
|
3948
4011
|
credentials: this._input.credentials || "same-origin",
|
|
3949
4012
|
...o,
|
|
3950
|
-
headers:
|
|
3951
|
-
hooks:
|
|
4013
|
+
headers: ot(this._input.headers, o.headers),
|
|
4014
|
+
hooks: Oe({
|
|
3952
4015
|
beforeRequest: [],
|
|
3953
4016
|
beforeRetry: [],
|
|
3954
4017
|
beforeError: [],
|
|
@@ -3984,7 +4047,7 @@ class ne {
|
|
|
3984
4047
|
this._options.json !== void 0 && (this._options.body = JSON.stringify(this._options.json), this.request.headers.set("content-type", this._options.headers.get("content-type") ?? "application/json"), this.request = new globalThis.Request(this.request, { body: this._options.body }));
|
|
3985
4048
|
}
|
|
3986
4049
|
_calculateRetryDelay(e) {
|
|
3987
|
-
if (this._retryCount++, this._retryCount < this._options.retry.limit && !(e instanceof
|
|
4050
|
+
if (this._retryCount++, this._retryCount < this._options.retry.limit && !(e instanceof tt)) {
|
|
3988
4051
|
if (e instanceof Te) {
|
|
3989
4052
|
if (!this._options.retry.statusCodes.includes(e.response.status))
|
|
3990
4053
|
return 0;
|
|
@@ -4008,7 +4071,7 @@ class ne {
|
|
|
4008
4071
|
try {
|
|
4009
4072
|
return await e();
|
|
4010
4073
|
} catch (o) {
|
|
4011
|
-
const a = Math.min(this._calculateRetryDelay(o),
|
|
4074
|
+
const a = Math.min(this._calculateRetryDelay(o), fe);
|
|
4012
4075
|
if (a !== 0 && this._retryCount > 0) {
|
|
4013
4076
|
await Xo(a, { signal: this._options.signal });
|
|
4014
4077
|
for (const r of this._options.hooks.beforeRetry)
|
|
@@ -4017,7 +4080,7 @@ class ne {
|
|
|
4017
4080
|
options: this._options,
|
|
4018
4081
|
error: o,
|
|
4019
4082
|
retryCount: this._retryCount
|
|
4020
|
-
}) ===
|
|
4083
|
+
}) === at)
|
|
4021
4084
|
return;
|
|
4022
4085
|
return this._retry(e);
|
|
4023
4086
|
}
|
|
@@ -4071,12 +4134,12 @@ class ne {
|
|
|
4071
4134
|
}
|
|
4072
4135
|
}
|
|
4073
4136
|
/*! MIT License © Sindre Sorhus */
|
|
4074
|
-
const
|
|
4075
|
-
const e = (o, a) =>
|
|
4076
|
-
for (const o of
|
|
4077
|
-
e[o] = (a, r) =>
|
|
4078
|
-
return e.create = (o) =>
|
|
4079
|
-
}, Qo =
|
|
4137
|
+
const je = (t) => {
|
|
4138
|
+
const e = (o, a) => le.create(o, G(t, a));
|
|
4139
|
+
for (const o of rt)
|
|
4140
|
+
e[o] = (a, r) => le.create(a, G(t, r, { method: o }));
|
|
4141
|
+
return e.create = (o) => je(G(o)), e.extend = (o) => je(G(t, o)), e.stop = at, e;
|
|
4142
|
+
}, Qo = je(), er = Qo, nt = er.extend({
|
|
4080
4143
|
hooks: {
|
|
4081
4144
|
beforeRequest: [
|
|
4082
4145
|
() => {
|
|
@@ -4109,7 +4172,7 @@ async function or(t, e) {
|
|
|
4109
4172
|
const o = new FormData();
|
|
4110
4173
|
for (let r = 0; r < e.length; r++)
|
|
4111
4174
|
o.append("files", e[r]);
|
|
4112
|
-
const a = await
|
|
4175
|
+
const a = await nt.post(t, {
|
|
4113
4176
|
body: o
|
|
4114
4177
|
});
|
|
4115
4178
|
try {
|
|
@@ -4125,19 +4188,19 @@ async function or(t, e) {
|
|
|
4125
4188
|
const Ve = {
|
|
4126
4189
|
error: {
|
|
4127
4190
|
variant: "danger",
|
|
4128
|
-
icon:
|
|
4191
|
+
icon: Ce
|
|
4129
4192
|
},
|
|
4130
4193
|
warning: {
|
|
4131
4194
|
variant: "warning",
|
|
4132
|
-
icon:
|
|
4195
|
+
icon: Ge
|
|
4133
4196
|
},
|
|
4134
4197
|
success: {
|
|
4135
4198
|
variant: "success",
|
|
4136
|
-
icon:
|
|
4199
|
+
icon: Xe
|
|
4137
4200
|
},
|
|
4138
4201
|
info: {
|
|
4139
4202
|
variant: "primary",
|
|
4140
|
-
icon:
|
|
4203
|
+
icon: Qe
|
|
4141
4204
|
}
|
|
4142
4205
|
};
|
|
4143
4206
|
function rr(t) {
|
|
@@ -4188,7 +4251,7 @@ async function nr(t) {
|
|
|
4188
4251
|
throw new Error("apiKey is required");
|
|
4189
4252
|
const e = t.options ?? {};
|
|
4190
4253
|
e.model || (e.model = "gpt-3.5-turbo");
|
|
4191
|
-
const o = await
|
|
4254
|
+
const o = await nt.post(t.url, {
|
|
4192
4255
|
json: {
|
|
4193
4256
|
messages: t.messages,
|
|
4194
4257
|
...t.options ?? {}
|
|
@@ -4213,11 +4276,11 @@ var ir = Object.defineProperty, lr = Object.getOwnPropertyDescriptor, v = (t, e,
|
|
|
4213
4276
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
4214
4277
|
return a && r && ir(e, o, r), r;
|
|
4215
4278
|
};
|
|
4216
|
-
const
|
|
4217
|
-
|
|
4279
|
+
const te = he.noConflict();
|
|
4280
|
+
te.setLevel("info");
|
|
4218
4281
|
let b = class extends C {
|
|
4219
4282
|
constructor() {
|
|
4220
|
-
super(...arguments), this.store = new
|
|
4283
|
+
super(...arguments), this.store = new Fe(this, d), this.displayLicense = !1, this.name = "ChatBot", this.orgId = "", this.botId = "", this.url = "ws://localhost:3070", this.logoSvg = ` <svg width="24" height="24" viewBox="0 0 40 40">
|
|
4221
4284
|
<path
|
|
4222
4285
|
d="M34.728 0.275L2.245 15.267c-3.748 1.749 -2.498 7.246 1.499 7.246h13.743v13.743c0 3.998 5.497 5.248 7.246 1.499l14.992 -32.483c1.249 -2.999 -1.999 -6.248 -4.998 -4.998z"
|
|
4223
4286
|
fill="#E24D42"
|
|
@@ -4225,6 +4288,7 @@ let b = class extends C {
|
|
|
4225
4288
|
</svg>
|
|
4226
4289
|
`, this.botIconSvg = '<svg fill="currentColor" width="24" height="24" viewBox="0 0 24 24"> <path d="M16 17V19H2V17S2 13 9 13 16 17 16 17M12.5 7.5A3.5 3.5 0 1 0 9 11A3.5 3.5 0 0 0 12.5 7.5M15.94 13A5.32 5.32 0 0 1 18 17V19H22V17S22 13.37 15.94 13M15 4A3.39 3.39 0 0 0 13.07 4.59A5 5 0 0 1 13.07 10.41A3.39 3.39 0 0 0 15 11A3.5 3.5 0 0 0 15 4Z" /></svg>', this.userIconSvg = '<svg fill="currentColor" viewBox="0 0 24 24" width="24" height="24"> <path d="M12 4a4 4 0 0 1 4 4a4 4 0 0 1-4 4a4 4 0 0 1-4-4a4 4 0 0 1 4-4m0 10c4.42 0 8 1.79 8 4v2H4v-2c0-2.21 3.58-4 8-4Z" /></svg>', this.systemIconSvg = '<svg fill="currentColor" width="24" height="24" viewBox="0 0 24 24"> <path d="M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z"/></svg>', this.stream = !1, this.customRequest = !1, this.enableFileUpload = !1, this.uploadFileUrl = "", this.open = !1, this.loading = !1, this.showSetting = !1, this.showAuthAlert = !1, this.fetchStream = tr;
|
|
4227
4290
|
}
|
|
4291
|
+
//HTMLElement;
|
|
4228
4292
|
/**
|
|
4229
4293
|
* decodeStreamData
|
|
4230
4294
|
*/
|
|
@@ -4238,28 +4302,39 @@ let b = class extends C {
|
|
|
4238
4302
|
isThinking: !0,
|
|
4239
4303
|
data: {}
|
|
4240
4304
|
};
|
|
4241
|
-
return
|
|
4305
|
+
return d.addMessage(t), t;
|
|
4306
|
+
}
|
|
4307
|
+
addTestMessage() {
|
|
4308
|
+
const t = {
|
|
4309
|
+
author: "assistant",
|
|
4310
|
+
type: "text",
|
|
4311
|
+
isThinking: !1,
|
|
4312
|
+
data: {
|
|
4313
|
+
text: "Long text.The element may not be scrolled completely to the top or bottom depending on the layout of other elements.The element may not be scrolled completely to the top or bottom depending on the layout of other elements."
|
|
4314
|
+
}
|
|
4315
|
+
};
|
|
4316
|
+
return d.addMessage(t), t;
|
|
4242
4317
|
}
|
|
4243
4318
|
render() {
|
|
4244
4319
|
return c`
|
|
4245
|
-
<div class="cb-wrapper" style="${
|
|
4320
|
+
<div class="cb-wrapper" style="${d.open ? "display:flex" : "display:none"}">
|
|
4246
4321
|
<cb-header title="${this.name}"></cb-header>
|
|
4247
|
-
<cb-message-list .messages=${
|
|
4322
|
+
<cb-message-list .messages=${d.messages} .actions=${d.actions}></cb-message-list>
|
|
4248
4323
|
<cb-user-input ?loading=${this.loading} ?disabled=${this.loading || this.showAuthAlert} ?enable-file-upload=${this.enableFileUpload}></cb-user-input>
|
|
4249
4324
|
</div>
|
|
4250
|
-
<cb-anchor ?open=${
|
|
4325
|
+
<cb-anchor ?open=${d.open}></cb-anchor>
|
|
4251
4326
|
`;
|
|
4252
4327
|
}
|
|
4253
4328
|
connectedCallback() {
|
|
4254
|
-
super.connectedCallback(),
|
|
4329
|
+
super.connectedCallback(), te.info("connectedCallback"), addEventListener("setting:show", () => {
|
|
4255
4330
|
this.showSetting = !0;
|
|
4256
4331
|
}), addEventListener("message:send", this._addMessageHandler.bind(this)), addEventListener("message:remove", this._deleteMessageHandler.bind(this)), addEventListener("setting:confirm", this._settingConfirmHandler.bind(this)), addEventListener("setting:hide", () => {
|
|
4257
4332
|
this.showSetting = !1;
|
|
4258
4333
|
}), addEventListener("chatbot:toggle", (t) => {
|
|
4259
4334
|
const e = t.detail;
|
|
4260
|
-
|
|
4335
|
+
d.open = e.open, d.engage = !1;
|
|
4261
4336
|
}), addEventListener("message:clear", () => {
|
|
4262
|
-
|
|
4337
|
+
d.clearMessages();
|
|
4263
4338
|
}), addEventListener("message:send:file", this._sendFileHandler.bind(this)), addEventListener("setting:show", () => {
|
|
4264
4339
|
this.showSetting = !0;
|
|
4265
4340
|
});
|
|
@@ -4268,20 +4343,20 @@ let b = class extends C {
|
|
|
4268
4343
|
// Use to initialize
|
|
4269
4344
|
// This is also called when state changes - ??? - i.e. when message added to the array
|
|
4270
4345
|
updated(t) {
|
|
4271
|
-
super.updated(t), t.size > 0 && (
|
|
4346
|
+
super.updated(t), te.info("updated,_changedProperties:", t), t.size > 0 && (te.info("updated,_changedProperties:", t), this._initSetting()), setTimeout(() => {
|
|
4272
4347
|
this._scrollToBottom();
|
|
4273
4348
|
}, 0);
|
|
4274
4349
|
}
|
|
4275
4350
|
// initialize setting
|
|
4276
4351
|
_initSetting() {
|
|
4277
|
-
const t =
|
|
4278
|
-
t.orgId = this.orgId, t.botId = this.botId, t.url = this.url, t.
|
|
4352
|
+
const t = d.setting;
|
|
4353
|
+
t.orgId = this.orgId, t.botId = this.botId, t.url = this.url, t.logoSvg = this.logoSvg, t.botIconSvg = this.botIconSvg, t.userIconSvg = this.userIconSvg, t.systemIconSvg = this.systemIconSvg, d.setSetting(t);
|
|
4279
4354
|
}
|
|
4280
4355
|
setLoading(t) {
|
|
4281
4356
|
this.loading = t;
|
|
4282
4357
|
}
|
|
4283
4358
|
clearConversation() {
|
|
4284
|
-
|
|
4359
|
+
d.clearConversation();
|
|
4285
4360
|
}
|
|
4286
4361
|
// check auth
|
|
4287
4362
|
_checkAuth() {
|
|
@@ -4289,13 +4364,13 @@ let b = class extends C {
|
|
|
4289
4364
|
// TODO Remove
|
|
4290
4365
|
async _sendToOpenai(t, e) {
|
|
4291
4366
|
let o = "";
|
|
4292
|
-
const a =
|
|
4367
|
+
const a = d.setting.openai.apiBase || "https://api.openai.com/v1", r = await nr({
|
|
4293
4368
|
url: `${a}/chat/completions`,
|
|
4294
|
-
apiKey:
|
|
4369
|
+
apiKey: d.setting.openai.apiKey,
|
|
4295
4370
|
messages: e,
|
|
4296
4371
|
options: {
|
|
4297
|
-
stream:
|
|
4298
|
-
model:
|
|
4372
|
+
stream: d.setting.stream,
|
|
4373
|
+
model: d.setting.openai.model
|
|
4299
4374
|
// temperature: 0.9,
|
|
4300
4375
|
},
|
|
4301
4376
|
onMessage: (s, n) => {
|
|
@@ -4305,11 +4380,11 @@ let b = class extends C {
|
|
|
4305
4380
|
return;
|
|
4306
4381
|
}
|
|
4307
4382
|
n && ((i = n.choices[0].delta) != null && i.content) && requestIdleCallback(() => {
|
|
4308
|
-
o += n.choices[0].delta.content,
|
|
4383
|
+
o += n.choices[0].delta.content, d.updateMessage(t, o);
|
|
4309
4384
|
});
|
|
4310
4385
|
}
|
|
4311
4386
|
});
|
|
4312
|
-
!
|
|
4387
|
+
!d.setting.stream && r && d.updateMessage(t, r.choices[0].message.content);
|
|
4313
4388
|
}
|
|
4314
4389
|
// TODO Remove
|
|
4315
4390
|
async _sendHandler(t) {
|
|
@@ -4320,7 +4395,7 @@ let b = class extends C {
|
|
|
4320
4395
|
isThinking: !0,
|
|
4321
4396
|
data: {}
|
|
4322
4397
|
};
|
|
4323
|
-
if (
|
|
4398
|
+
if (d.addMessage(e), this.customRequest)
|
|
4324
4399
|
await this.emit("chatbot:send", {
|
|
4325
4400
|
detail: {
|
|
4326
4401
|
newMessage: e,
|
|
@@ -4339,11 +4414,11 @@ let b = class extends C {
|
|
|
4339
4414
|
}
|
|
4340
4415
|
_addMessageHandler(t) {
|
|
4341
4416
|
const e = t.detail;
|
|
4342
|
-
|
|
4417
|
+
d.sendMessage(e);
|
|
4343
4418
|
}
|
|
4344
4419
|
_deleteMessageHandler(t) {
|
|
4345
4420
|
const e = t.detail;
|
|
4346
|
-
|
|
4421
|
+
d.removeMessage(e.id);
|
|
4347
4422
|
}
|
|
4348
4423
|
async _sendFileHandler(t) {
|
|
4349
4424
|
const e = t.detail, a = {
|
|
@@ -4360,11 +4435,11 @@ let b = class extends C {
|
|
|
4360
4435
|
}))
|
|
4361
4436
|
}
|
|
4362
4437
|
};
|
|
4363
|
-
if (
|
|
4438
|
+
if (d.addMessage(a), this.uploadFileUrl) {
|
|
4364
4439
|
const r = await or(this.uploadFileUrl, e.files);
|
|
4365
4440
|
r.code === 0 && r.data && (a.isUploading = !1, a.data = {
|
|
4366
4441
|
files: r.data
|
|
4367
|
-
},
|
|
4442
|
+
}, d.updateMessage(a));
|
|
4368
4443
|
}
|
|
4369
4444
|
this.emit("chatbot:file:send", {
|
|
4370
4445
|
detail: {
|
|
@@ -4376,18 +4451,12 @@ let b = class extends C {
|
|
|
4376
4451
|
// setting confirm handler
|
|
4377
4452
|
_settingConfirmHandler(t) {
|
|
4378
4453
|
const e = t.detail;
|
|
4379
|
-
|
|
4454
|
+
d.setSetting(e.setting), this.showSetting = !1, this._checkAuth();
|
|
4380
4455
|
}
|
|
4381
4456
|
// scroll to bottom
|
|
4382
4457
|
_scrollToBottom(t = !1) {
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
(e = this._messageList) == null || e.scrollTo({
|
|
4386
|
-
top: this._messageList.scrollHeight,
|
|
4387
|
-
behavior: "auto"
|
|
4388
|
-
//smooth ? 'smooth' : 'auto',
|
|
4389
|
-
});
|
|
4390
|
-
});
|
|
4458
|
+
var e;
|
|
4459
|
+
console.log("Scrolling to bottom ..."), (e = this._messageList) == null || e.scrollToBottom();
|
|
4391
4460
|
}
|
|
4392
4461
|
};
|
|
4393
4462
|
b.styles = kt;
|
|
@@ -4406,9 +4475,6 @@ v([
|
|
|
4406
4475
|
v([
|
|
4407
4476
|
l({ type: String, attribute: "url" })
|
|
4408
4477
|
], b.prototype, "url", 2);
|
|
4409
|
-
v([
|
|
4410
|
-
l({ type: String, attribute: "welcome-message" })
|
|
4411
|
-
], b.prototype, "welcomeMessage", 2);
|
|
4412
4478
|
v([
|
|
4413
4479
|
l({ type: String, attribute: "logo-svg" })
|
|
4414
4480
|
], b.prototype, "logoSvg", 2);
|
|
@@ -4446,7 +4512,7 @@ v([
|
|
|
4446
4512
|
l({ type: Boolean })
|
|
4447
4513
|
], b.prototype, "showAuthAlert", 2);
|
|
4448
4514
|
v([
|
|
4449
|
-
|
|
4515
|
+
pe("cb-message-list")
|
|
4450
4516
|
], b.prototype, "_messageList", 2);
|
|
4451
4517
|
b = v([
|
|
4452
4518
|
k("enegelai-bot")
|