@enegelai/bot-widget 1.2.3 → 1.2.4
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 +107 -106
- package/dist/index.es.js +194 -181
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var dt = Object.defineProperty;
|
|
2
2
|
var pt = (t, e, o) => e in t ? dt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
|
|
3
3
|
var $ = (t, e, o) => (pt(t, typeof e != "symbol" ? e + "" : e, o), o);
|
|
4
|
-
import { css as x, LitElement as le, html as c, svg as
|
|
5
|
-
import { property as l, customElement as k, queryAll as ht,
|
|
6
|
-
import { unsafeHTML as
|
|
4
|
+
import { css as x, LitElement as le, html as c, svg as He } from "lit";
|
|
5
|
+
import { property as l, customElement as k, queryAll as ht, query as ce, eventOptions as qe } from "lit/decorators.js";
|
|
6
|
+
import { unsafeHTML as N } 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,8 +21,8 @@ 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 ye } from "lit/directives/repeat.js";
|
|
25
|
+
import { when as R } from "lit/directives/when.js";
|
|
26
26
|
import { until as Ie } from "lit-html/directives/until.js";
|
|
27
27
|
import ut from "markdown-it";
|
|
28
28
|
import gt from "markdown-it-link-attributes";
|
|
@@ -46,7 +46,7 @@ const ie = class ie extends Event {
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
$(ie, "eventName", "lit-state-changed");
|
|
49
|
-
let
|
|
49
|
+
let B = ie;
|
|
50
50
|
const bt = (t, e) => e !== t && (e === e || t === t);
|
|
51
51
|
class X extends EventTarget {
|
|
52
52
|
constructor() {
|
|
@@ -116,10 +116,10 @@ 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.
|
|
@@ -132,10 +132,10 @@ class mt {
|
|
|
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
|
/**
|
|
@@ -156,7 +156,7 @@ const Fe = ({ finisher: t, descriptor: e }) => (o, a) => {
|
|
|
156
156
|
e !== void 0 && Object.defineProperty(o, a, e(a)), t == null || t(s, a);
|
|
157
157
|
}
|
|
158
158
|
};
|
|
159
|
-
function
|
|
159
|
+
function H(t) {
|
|
160
160
|
return Fe({
|
|
161
161
|
// @ts-ignore ctor is typof State and not typeof ReactiveElement
|
|
162
162
|
finisher: (e, o) => {
|
|
@@ -251,26 +251,26 @@ var Ue = { exports: {} };
|
|
|
251
251
|
function y(u, f, w) {
|
|
252
252
|
return i(u) || m.apply(this, arguments);
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function ue(u, f, w) {
|
|
255
255
|
var h = this, Oe;
|
|
256
256
|
f = f ?? "WARN";
|
|
257
257
|
var S = "loglevel";
|
|
258
258
|
typeof u == "string" ? S += ":" + u : typeof u == "symbol" && (S = void 0);
|
|
259
259
|
function it(d) {
|
|
260
|
-
var
|
|
260
|
+
var T = (r[d] || "silent").toUpperCase();
|
|
261
261
|
if (!(typeof window === o || !S)) {
|
|
262
262
|
try {
|
|
263
|
-
window.localStorage[S] =
|
|
263
|
+
window.localStorage[S] = T;
|
|
264
264
|
return;
|
|
265
265
|
} catch {
|
|
266
266
|
}
|
|
267
267
|
try {
|
|
268
|
-
window.document.cookie = encodeURIComponent(S) + "=" +
|
|
268
|
+
window.document.cookie = encodeURIComponent(S) + "=" + T + ";";
|
|
269
269
|
} catch {
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function Le() {
|
|
274
274
|
var d;
|
|
275
275
|
if (!(typeof window === o || !S)) {
|
|
276
276
|
try {
|
|
@@ -279,10 +279,10 @@ var Ue = { exports: {} };
|
|
|
279
279
|
}
|
|
280
280
|
if (typeof d === o)
|
|
281
281
|
try {
|
|
282
|
-
var
|
|
282
|
+
var T = window.document.cookie, Y = T.indexOf(
|
|
283
283
|
encodeURIComponent(S) + "="
|
|
284
284
|
);
|
|
285
|
-
Y !== -1 && (d = /^([^;]+)/.exec(
|
|
285
|
+
Y !== -1 && (d = /^([^;]+)/.exec(T.slice(Y))[1]);
|
|
286
286
|
} catch {
|
|
287
287
|
}
|
|
288
288
|
return h.levels[d] === void 0 && (d = void 0), d;
|
|
@@ -310,14 +310,14 @@ var Ue = { exports: {} };
|
|
|
310
310
|
SILENT: 5
|
|
311
311
|
}, h.methodFactory = w || y, h.getLevel = function() {
|
|
312
312
|
return Oe;
|
|
313
|
-
}, h.setLevel = function(d,
|
|
313
|
+
}, h.setLevel = function(d, T) {
|
|
314
314
|
if (typeof d == "string" && h.levels[d.toUpperCase()] !== void 0 && (d = h.levels[d.toUpperCase()]), typeof d == "number" && d >= 0 && d <= h.levels.SILENT) {
|
|
315
|
-
if (Oe = d,
|
|
315
|
+
if (Oe = d, T !== !1 && it(d), g.call(h, d, u), typeof console === o && d < h.levels.SILENT)
|
|
316
316
|
return "No console available for logging";
|
|
317
317
|
} else
|
|
318
318
|
throw "log.setLevel() called with invalid level: " + d;
|
|
319
319
|
}, h.setDefaultLevel = function(d) {
|
|
320
|
-
f = d,
|
|
320
|
+
f = d, Le() || h.setLevel(d, !1);
|
|
321
321
|
}, h.resetLevel = function() {
|
|
322
322
|
h.setLevel(f, !1), lt();
|
|
323
323
|
}, h.enableAll = function(d) {
|
|
@@ -325,15 +325,15 @@ var Ue = { exports: {} };
|
|
|
325
325
|
}, h.disableAll = function(d) {
|
|
326
326
|
h.setLevel(h.levels.SILENT, d);
|
|
327
327
|
};
|
|
328
|
-
var
|
|
329
|
-
|
|
328
|
+
var be = Le();
|
|
329
|
+
be == null && (be = f), h.setLevel(be, !1);
|
|
330
330
|
}
|
|
331
|
-
var M = new
|
|
331
|
+
var M = new ue(), ge = {};
|
|
332
332
|
M.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 = ge[f];
|
|
336
|
+
return w || (w = ge[f] = new ue(
|
|
337
337
|
f,
|
|
338
338
|
M.getLevel(),
|
|
339
339
|
M.methodFactory
|
|
@@ -343,12 +343,12 @@ var Ue = { exports: {} };
|
|
|
343
343
|
return M.noConflict = function() {
|
|
344
344
|
return typeof window !== o && window.log === M && (window.log = nt), M;
|
|
345
345
|
}, M.getLoggers = function() {
|
|
346
|
-
return
|
|
346
|
+
return ge;
|
|
347
347
|
}, M.default = M, M;
|
|
348
348
|
});
|
|
349
349
|
})(Ue);
|
|
350
350
|
var xt = Ue.exports;
|
|
351
|
-
const
|
|
351
|
+
const de = /* @__PURE__ */ wt(xt), kt = x`
|
|
352
352
|
:host {
|
|
353
353
|
}
|
|
354
354
|
.cb-wrapper {
|
|
@@ -503,26 +503,26 @@ var _t = Object.defineProperty, Ct = Object.getOwnPropertyDescriptor, $e = (t, e
|
|
|
503
503
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
504
504
|
return a && r && _t(e, o, r), r;
|
|
505
505
|
};
|
|
506
|
-
let
|
|
506
|
+
let W = class extends le {
|
|
507
507
|
constructor() {
|
|
508
508
|
super(...arguments), this.color = "primary", this.svg = "";
|
|
509
509
|
}
|
|
510
510
|
render() {
|
|
511
511
|
return c`<span class="cb-icon color-${this.color}" part="base"
|
|
512
|
-
>${
|
|
512
|
+
>${N(this.svg)}</span
|
|
513
513
|
>`;
|
|
514
514
|
}
|
|
515
515
|
};
|
|
516
|
-
|
|
516
|
+
W.styles = Ze;
|
|
517
517
|
$e([
|
|
518
518
|
l({ type: String })
|
|
519
|
-
],
|
|
519
|
+
], W.prototype, "color", 2);
|
|
520
520
|
$e([
|
|
521
521
|
l({ type: String })
|
|
522
|
-
],
|
|
523
|
-
|
|
522
|
+
], W.prototype, "svg", 2);
|
|
523
|
+
W = $e([
|
|
524
524
|
k("cb-icon")
|
|
525
|
-
],
|
|
525
|
+
], W);
|
|
526
526
|
let $t = (t) => crypto.getRandomValues(new Uint8Array(t)), jt = (t, e, o) => {
|
|
527
527
|
let a = (2 << Math.log(t.length - 1) / Math.LN2) - 1, r = -~(1.6 * a * e / t.length);
|
|
528
528
|
return (s = e) => {
|
|
@@ -536,7 +536,7 @@ let $t = (t) => crypto.getRandomValues(new Uint8Array(t)), jt = (t, e, o) => {
|
|
|
536
536
|
};
|
|
537
537
|
}, Mt = (t, e = 21) => jt(t, e, $t);
|
|
538
538
|
const St = Mt("1234567890abcdefghijklmnopqrstuvwxyz", 10);
|
|
539
|
-
function
|
|
539
|
+
function fe(t = 10) {
|
|
540
540
|
return St(t);
|
|
541
541
|
}
|
|
542
542
|
function At(t) {
|
|
@@ -559,9 +559,9 @@ function Ot(t = !0) {
|
|
|
559
559
|
}), o.click();
|
|
560
560
|
});
|
|
561
561
|
}
|
|
562
|
-
const _ =
|
|
562
|
+
const _ = de.noConflict();
|
|
563
563
|
_.setLevel("info");
|
|
564
|
-
class
|
|
564
|
+
class Lt {
|
|
565
565
|
constructor(e = {}) {
|
|
566
566
|
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
567
|
}
|
|
@@ -669,15 +669,15 @@ class Ht {
|
|
|
669
669
|
});
|
|
670
670
|
}*/
|
|
671
671
|
}
|
|
672
|
-
var
|
|
672
|
+
var Ht = Object.defineProperty, It = Object.getOwnPropertyDescriptor, I = (t, e, o, a) => {
|
|
673
673
|
for (var r = a > 1 ? void 0 : a ? It(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
674
674
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
675
|
-
return a && r &&
|
|
675
|
+
return a && r && Ht(e, o, r), r;
|
|
676
676
|
};
|
|
677
|
-
const j =
|
|
677
|
+
const j = de.noConflict();
|
|
678
678
|
j.setLevel("info");
|
|
679
679
|
const F = "cb_";
|
|
680
|
-
class
|
|
680
|
+
class L extends X {
|
|
681
681
|
constructor() {
|
|
682
682
|
super(...arguments), this.actionIdCounter = 0, this.wsClient = null, this.replyMessage = null;
|
|
683
683
|
}
|
|
@@ -689,7 +689,7 @@ class H extends X {
|
|
|
689
689
|
}
|
|
690
690
|
clearConversation() {
|
|
691
691
|
this.wsClient && (this.wsClient.stop().then(() => {
|
|
692
|
-
}), this.wsClient = null), this.conversationId =
|
|
692
|
+
}), this.wsClient = null), this.conversationId = fe(), this.connectWs = "false", this.messages = [], this.actions = [], this.addMessage({
|
|
693
693
|
author: "assistant",
|
|
694
694
|
type: "text",
|
|
695
695
|
data: {
|
|
@@ -743,7 +743,7 @@ class H extends X {
|
|
|
743
743
|
if (this.wsClient)
|
|
744
744
|
return this.wsClient;
|
|
745
745
|
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 j.info(`Initiating ws connection to ${o} ...`), this.wsClient = new
|
|
746
|
+
return j.info(`Initiating ws connection to ${o} ...`), this.wsClient = new Lt({
|
|
747
747
|
url: o,
|
|
748
748
|
orgId: this.setting.orgId,
|
|
749
749
|
botId: this.setting.botId,
|
|
@@ -822,7 +822,7 @@ class H extends X {
|
|
|
822
822
|
// TODO revisit below
|
|
823
823
|
formatMessage(e) {
|
|
824
824
|
var o;
|
|
825
|
-
return e.id || (e.id =
|
|
825
|
+
return e.id || (e.id = fe()), e.timestamp = Date.now(), e.author === "assistant" && (e.replyId = (o = this.messages[this.messages.length - 1]) == null ? void 0 : o.id), e;
|
|
826
826
|
}
|
|
827
827
|
// add message
|
|
828
828
|
addMessage(e) {
|
|
@@ -853,26 +853,26 @@ class H extends X {
|
|
|
853
853
|
}
|
|
854
854
|
I([
|
|
855
855
|
D({ prefix: F }),
|
|
856
|
-
|
|
857
|
-
],
|
|
856
|
+
H({ value: "en" })
|
|
857
|
+
], L.prototype, "language", 2);
|
|
858
858
|
I([
|
|
859
859
|
D({ prefix: F }),
|
|
860
|
-
|
|
861
|
-
],
|
|
860
|
+
H({ value: "light" })
|
|
861
|
+
], L.prototype, "theme", 2);
|
|
862
862
|
I([
|
|
863
863
|
D({ prefix: F }),
|
|
864
|
-
|
|
865
|
-
],
|
|
864
|
+
H({ value: "false" })
|
|
865
|
+
], L.prototype, "connectWs", 2);
|
|
866
866
|
I([
|
|
867
867
|
D({ prefix: F }),
|
|
868
|
-
|
|
869
|
-
],
|
|
868
|
+
H({ value: fe() })
|
|
869
|
+
], L.prototype, "conversationId", 2);
|
|
870
870
|
I([
|
|
871
871
|
D({ prefix: F }),
|
|
872
|
-
|
|
873
|
-
],
|
|
872
|
+
H({ type: Array, value: [] })
|
|
873
|
+
], L.prototype, "messages", 2);
|
|
874
874
|
I([
|
|
875
|
-
|
|
875
|
+
H({
|
|
876
876
|
type: Array,
|
|
877
877
|
value: []
|
|
878
878
|
/*value: [
|
|
@@ -892,16 +892,16 @@ I([
|
|
|
892
892
|
},
|
|
893
893
|
],*/
|
|
894
894
|
})
|
|
895
|
-
],
|
|
895
|
+
], L.prototype, "actions", 2);
|
|
896
896
|
I([
|
|
897
|
-
|
|
898
|
-
],
|
|
897
|
+
H({ type: Boolean, value: !1 })
|
|
898
|
+
], L.prototype, "botSettingsInitialized", 2);
|
|
899
899
|
I([
|
|
900
|
-
|
|
901
|
-
],
|
|
900
|
+
H({ type: Boolean, value: !1 })
|
|
901
|
+
], L.prototype, "disabled", 2);
|
|
902
902
|
I([
|
|
903
903
|
D({ prefix: F }),
|
|
904
|
-
|
|
904
|
+
H({
|
|
905
905
|
type: Object,
|
|
906
906
|
value: {
|
|
907
907
|
orgId: null,
|
|
@@ -910,8 +910,8 @@ I([
|
|
|
910
910
|
welcomeMessage: null
|
|
911
911
|
}
|
|
912
912
|
})
|
|
913
|
-
],
|
|
914
|
-
const p = new
|
|
913
|
+
], L.prototype, "setting", 2);
|
|
914
|
+
const p = new L(), Pt = x`
|
|
915
915
|
${O}
|
|
916
916
|
:host {
|
|
917
917
|
position: relative;
|
|
@@ -977,10 +977,10 @@ Tt([
|
|
|
977
977
|
l({ type: String })
|
|
978
978
|
], C.prototype, "lang", 2);
|
|
979
979
|
const je = '<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>';
|
|
980
|
-
var
|
|
981
|
-
for (var r = a > 1 ? void 0 : a ?
|
|
980
|
+
var Bt = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, Ne = (t, e, o, a) => {
|
|
981
|
+
for (var r = a > 1 ? void 0 : a ? Rt(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
982
982
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
983
|
-
return a && r &&
|
|
983
|
+
return a && r && Bt(e, o, r), r;
|
|
984
984
|
};
|
|
985
985
|
let te = class extends C {
|
|
986
986
|
constructor() {
|
|
@@ -1039,7 +1039,7 @@ var qt = Object.defineProperty, Dt = Object.getOwnPropertyDescriptor, Ft = (t, e
|
|
|
1039
1039
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
1040
1040
|
return a && r && qt(e, o, r), r;
|
|
1041
1041
|
};
|
|
1042
|
-
let
|
|
1042
|
+
let ve = class extends C {
|
|
1043
1043
|
constructor() {
|
|
1044
1044
|
super(...arguments), this.year = (/* @__PURE__ */ new Date()).getFullYear();
|
|
1045
1045
|
}
|
|
@@ -1074,10 +1074,10 @@ let fe = class extends C {
|
|
|
1074
1074
|
`;
|
|
1075
1075
|
}
|
|
1076
1076
|
};
|
|
1077
|
-
|
|
1078
|
-
|
|
1077
|
+
ve.styles = Vt;
|
|
1078
|
+
ve = Ft([
|
|
1079
1079
|
k("cb-footer")
|
|
1080
|
-
],
|
|
1080
|
+
], ve);
|
|
1081
1081
|
const Ut = x`
|
|
1082
1082
|
${O}
|
|
1083
1083
|
|
|
@@ -1179,12 +1179,12 @@ var Zt = Object.defineProperty, Nt = Object.getOwnPropertyDescriptor, Wt = (t, e
|
|
|
1179
1179
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
1180
1180
|
return a && r && Zt(e, o, r), r;
|
|
1181
1181
|
};
|
|
1182
|
-
let
|
|
1182
|
+
let we = class extends le {
|
|
1183
1183
|
render() {
|
|
1184
1184
|
return c` <div class="cb-thinking" style="color: rgb(34, 34, 34);"><span></span><span></span><span></span></div>`;
|
|
1185
1185
|
}
|
|
1186
1186
|
};
|
|
1187
|
-
|
|
1187
|
+
we.styles = x`
|
|
1188
1188
|
.cb-thinking {
|
|
1189
1189
|
text-align: center;
|
|
1190
1190
|
}
|
|
@@ -1222,9 +1222,9 @@ ve.styles = x`
|
|
|
1222
1222
|
}
|
|
1223
1223
|
}
|
|
1224
1224
|
`;
|
|
1225
|
-
|
|
1225
|
+
we = Wt([
|
|
1226
1226
|
k("cb-thinking")
|
|
1227
|
-
],
|
|
1227
|
+
], we);
|
|
1228
1228
|
var Kt = Object.defineProperty, Jt = Object.getOwnPropertyDescriptor, We = (t, e, o, a) => {
|
|
1229
1229
|
for (var r = a > 1 ? void 0 : a ? Jt(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
1230
1230
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
@@ -1296,7 +1296,7 @@ var Gt = Object.defineProperty, Xt = Object.getOwnPropertyDescriptor, Me = (t, e
|
|
|
1296
1296
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
1297
1297
|
return a && r && Gt(e, o, r), r;
|
|
1298
1298
|
};
|
|
1299
|
-
let
|
|
1299
|
+
let K = class extends le {
|
|
1300
1300
|
constructor() {
|
|
1301
1301
|
super(...arguments), this.url = "", this.inverse = !1;
|
|
1302
1302
|
}
|
|
@@ -1316,7 +1316,7 @@ let W = class extends le {
|
|
|
1316
1316
|
`;
|
|
1317
1317
|
}
|
|
1318
1318
|
};
|
|
1319
|
-
|
|
1319
|
+
K.styles = x`
|
|
1320
1320
|
:host {
|
|
1321
1321
|
--primary-color: var(--sl-color-primary-600);
|
|
1322
1322
|
}
|
|
@@ -1343,13 +1343,13 @@ W.styles = x`
|
|
|
1343
1343
|
`;
|
|
1344
1344
|
Me([
|
|
1345
1345
|
l({ type: String })
|
|
1346
|
-
],
|
|
1346
|
+
], K.prototype, "url", 2);
|
|
1347
1347
|
Me([
|
|
1348
1348
|
l({ type: Boolean })
|
|
1349
|
-
],
|
|
1350
|
-
|
|
1349
|
+
], K.prototype, "inverse", 2);
|
|
1350
|
+
K = Me([
|
|
1351
1351
|
k("cb-external-link")
|
|
1352
|
-
],
|
|
1352
|
+
], K);
|
|
1353
1353
|
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
1354
|
var no = Object.defineProperty, io = Object.getOwnPropertyDescriptor, Se = (t, e, o, a) => {
|
|
1355
1355
|
for (var r = a > 1 ? void 0 : a ? io(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
@@ -1365,7 +1365,7 @@ const Pe = {
|
|
|
1365
1365
|
doc: ao,
|
|
1366
1366
|
docx: so
|
|
1367
1367
|
};
|
|
1368
|
-
let
|
|
1368
|
+
let J = class extends C {
|
|
1369
1369
|
constructor() {
|
|
1370
1370
|
super(...arguments), this.filename = "", this.url = "";
|
|
1371
1371
|
}
|
|
@@ -1395,16 +1395,16 @@ let K = class extends C {
|
|
|
1395
1395
|
`;
|
|
1396
1396
|
}
|
|
1397
1397
|
};
|
|
1398
|
-
|
|
1398
|
+
J.styles = Yt;
|
|
1399
1399
|
Se([
|
|
1400
1400
|
l({ type: String })
|
|
1401
|
-
],
|
|
1401
|
+
], J.prototype, "filename", 2);
|
|
1402
1402
|
Se([
|
|
1403
1403
|
l({ type: String })
|
|
1404
|
-
],
|
|
1405
|
-
|
|
1404
|
+
], J.prototype, "url", 2);
|
|
1405
|
+
J = Se([
|
|
1406
1406
|
k("cb-file")
|
|
1407
|
-
],
|
|
1407
|
+
], J);
|
|
1408
1408
|
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
1409
|
pre code.hljs {
|
|
1410
1410
|
display: block;
|
|
@@ -2734,9 +2734,9 @@ function uo() {
|
|
|
2734
2734
|
}
|
|
2735
2735
|
async function ze(t) {
|
|
2736
2736
|
const e = uo();
|
|
2737
|
-
return c`${
|
|
2737
|
+
return c`${N(e.render(t))}`;
|
|
2738
2738
|
}
|
|
2739
|
-
var go = Object.defineProperty, bo = Object.getOwnPropertyDescriptor,
|
|
2739
|
+
var go = Object.defineProperty, bo = Object.getOwnPropertyDescriptor, pe = (t, e, o, a) => {
|
|
2740
2740
|
for (var r = a > 1 ? void 0 : a ? bo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
2741
2741
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
2742
2742
|
return a && r && go(e, o, r), r;
|
|
@@ -2785,12 +2785,12 @@ let V = class extends C {
|
|
|
2785
2785
|
});
|
|
2786
2786
|
}
|
|
2787
2787
|
render() {
|
|
2788
|
-
return
|
|
2788
|
+
return R(
|
|
2789
2789
|
this.message.data || this.message.isThinking,
|
|
2790
2790
|
() => c`
|
|
2791
2791
|
<div class="cb-message-row" part="cb-message-row">
|
|
2792
2792
|
<!-- message -->
|
|
2793
|
-
${
|
|
2793
|
+
${R(
|
|
2794
2794
|
this._isBot,
|
|
2795
2795
|
() => this.renderBotMessage(this.message),
|
|
2796
2796
|
() => this.renderUserMessage(this.message)
|
|
@@ -2827,7 +2827,7 @@ let V = class extends C {
|
|
|
2827
2827
|
renderMessageContent(t) {
|
|
2828
2828
|
var e;
|
|
2829
2829
|
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
|
-
${
|
|
2830
|
+
${R(
|
|
2831
2831
|
t.data.userName,
|
|
2832
2832
|
() => c`<div style="font-size: 12px; color:#9ca3af">${t.data.userName}</div>`,
|
|
2833
2833
|
() => null
|
|
@@ -2835,7 +2835,7 @@ let V = class extends C {
|
|
|
2835
2835
|
${Ie(
|
|
2836
2836
|
this._getMessageText(t).then((o) => c`${o}`)
|
|
2837
2837
|
)}
|
|
2838
|
-
</div>` : t.type === "file" ? c`${
|
|
2838
|
+
</div>` : t.type === "file" ? c`${ye(
|
|
2839
2839
|
t.data.files || [],
|
|
2840
2840
|
(o) => o.id,
|
|
2841
2841
|
(o) => c`<cb-file filename="${o.name}" url="${o.url}"></cb-file>`
|
|
@@ -2850,7 +2850,7 @@ let V = class extends C {
|
|
|
2850
2850
|
const e = t.data.userAvatar || "";
|
|
2851
2851
|
return c` <img src="${e}" style="width: 24px;height: 24px;" /> `;
|
|
2852
2852
|
}
|
|
2853
|
-
return t.author === "system" ?
|
|
2853
|
+
return t.author === "system" ? He`${N(p.setting.systemIconSvg)}` : He`${N(p.setting.botIconSvg)}`;
|
|
2854
2854
|
}
|
|
2855
2855
|
renderBotMessage(t) {
|
|
2856
2856
|
return c`
|
|
@@ -2866,52 +2866,53 @@ let V = class extends C {
|
|
|
2866
2866
|
<!--<sl-avatar class="avatar user-avatar small" label="User">
|
|
2867
2867
|
<cb-icon slot="icon" svg="${co}" color="white"></cb-icon>
|
|
2868
2868
|
</sl-avatar>-->
|
|
2869
|
-
<div class="avatar user-avatar">${
|
|
2869
|
+
<div class="avatar user-avatar">${N(p.setting.userIconSvg)}</div>
|
|
2870
2870
|
${this.renderMessage(t)}
|
|
2871
2871
|
</div>
|
|
2872
2872
|
`;
|
|
2873
2873
|
}
|
|
2874
2874
|
};
|
|
2875
2875
|
V.styles = ho;
|
|
2876
|
-
|
|
2876
|
+
pe([
|
|
2877
2877
|
l({ type: Object })
|
|
2878
2878
|
], V.prototype, "message", 2);
|
|
2879
|
-
|
|
2879
|
+
pe([
|
|
2880
2880
|
l({ type: String })
|
|
2881
2881
|
], V.prototype, "type", 2);
|
|
2882
|
-
|
|
2882
|
+
pe([
|
|
2883
2883
|
ht(".code-block-header__copy")
|
|
2884
2884
|
], V.prototype, "copyBtns", 2);
|
|
2885
|
-
V =
|
|
2885
|
+
V = pe([
|
|
2886
2886
|
k("cb-message")
|
|
2887
2887
|
], V);
|
|
2888
|
-
var mo = Object.defineProperty, yo = Object.getOwnPropertyDescriptor,
|
|
2888
|
+
var mo = Object.defineProperty, yo = Object.getOwnPropertyDescriptor, U = (t, e, o, a) => {
|
|
2889
2889
|
for (var r = a > 1 ? void 0 : a ? yo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
2890
2890
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
2891
2891
|
return a && r && mo(e, o, r), r;
|
|
2892
2892
|
};
|
|
2893
|
-
const Q =
|
|
2893
|
+
const Q = de.noConflict();
|
|
2894
2894
|
Q.setLevel("info");
|
|
2895
|
-
let
|
|
2895
|
+
let z = class extends C {
|
|
2896
2896
|
constructor() {
|
|
2897
2897
|
super(...arguments), this.messages = [], this.actions = [], this.calendlyInjected = !1, this.activeCalendlyAction = -1;
|
|
2898
2898
|
}
|
|
2899
2899
|
render() {
|
|
2900
2900
|
return c`
|
|
2901
2901
|
<div class="cb-message-list" part="cb-message-list">
|
|
2902
|
-
${
|
|
2902
|
+
${ye(
|
|
2903
2903
|
this.messages,
|
|
2904
2904
|
(t) => t.id + JSON.stringify(t.data),
|
|
2905
2905
|
(t) => c`<cb-message .message="${t}"></cb-message>`
|
|
2906
2906
|
)}
|
|
2907
2907
|
${this.renderActions()}
|
|
2908
|
+
<div id="cb-message-list-bottom-anchor"></div>
|
|
2908
2909
|
</div>
|
|
2909
2910
|
`;
|
|
2910
2911
|
}
|
|
2911
2912
|
renderActions() {
|
|
2912
2913
|
return !Array.isArray(this.actions) || this.actions.length <= 0 ? null : c`
|
|
2913
2914
|
<div class="cb-actions-list">
|
|
2914
|
-
${
|
|
2915
|
+
${ye(
|
|
2915
2916
|
this.actions,
|
|
2916
2917
|
(t) => t,
|
|
2917
2918
|
(t) => this.renderAction(t)
|
|
@@ -2919,6 +2920,9 @@ let R = class extends C {
|
|
|
2919
2920
|
</div>
|
|
2920
2921
|
`;
|
|
2921
2922
|
}
|
|
2923
|
+
scrollToBottom() {
|
|
2924
|
+
this._messageListBottomAnchor.scrollIntoView({ behavior: "smooth", block: "end", inline: "nearest" });
|
|
2925
|
+
}
|
|
2922
2926
|
renderAction(t) {
|
|
2923
2927
|
switch (t.type) {
|
|
2924
2928
|
case "calendlyMeeting":
|
|
@@ -2982,22 +2986,25 @@ let R = class extends C {
|
|
|
2982
2986
|
`;
|
|
2983
2987
|
}
|
|
2984
2988
|
};
|
|
2985
|
-
|
|
2986
|
-
|
|
2989
|
+
z.styles = Ut;
|
|
2990
|
+
U([
|
|
2987
2991
|
l({ type: Array })
|
|
2988
|
-
],
|
|
2989
|
-
|
|
2992
|
+
], z.prototype, "messages", 2);
|
|
2993
|
+
U([
|
|
2990
2994
|
l({ type: Array })
|
|
2991
|
-
],
|
|
2992
|
-
|
|
2995
|
+
], z.prototype, "actions", 2);
|
|
2996
|
+
U([
|
|
2997
|
+
ce("#cb-message-list-bottom-anchor")
|
|
2998
|
+
], z.prototype, "_messageListBottomAnchor", 2);
|
|
2999
|
+
U([
|
|
2993
3000
|
qe({ capture: !1, passive: !0 })
|
|
2994
|
-
],
|
|
2995
|
-
|
|
3001
|
+
], z.prototype, "invokeLinkAction", 1);
|
|
3002
|
+
U([
|
|
2996
3003
|
qe({ capture: !1, passive: !0 })
|
|
2997
|
-
],
|
|
2998
|
-
|
|
3004
|
+
], z.prototype, "invokeCalendlyAction", 1);
|
|
3005
|
+
z = U([
|
|
2999
3006
|
k("cb-message-list")
|
|
3000
|
-
],
|
|
3007
|
+
], z);
|
|
3001
3008
|
const fo = x`
|
|
3002
3009
|
${O}
|
|
3003
3010
|
|
|
@@ -3093,7 +3100,7 @@ let A = class extends C {
|
|
|
3093
3100
|
></sl-textarea>
|
|
3094
3101
|
|
|
3095
3102
|
<span class="cb-input-buttons">
|
|
3096
|
-
${
|
|
3103
|
+
${R(
|
|
3097
3104
|
this.enableFileUpload,
|
|
3098
3105
|
() => c`
|
|
3099
3106
|
<sl-button
|
|
@@ -3161,7 +3168,7 @@ P([
|
|
|
3161
3168
|
l({ type: String })
|
|
3162
3169
|
], A.prototype, "currentKey", 2);
|
|
3163
3170
|
P([
|
|
3164
|
-
|
|
3171
|
+
ce("sl-textarea")
|
|
3165
3172
|
], A.prototype, "inputElement", 2);
|
|
3166
3173
|
A = P([
|
|
3167
3174
|
k("cb-user-input")
|
|
@@ -3201,7 +3208,7 @@ const _o = x`
|
|
|
3201
3208
|
gap: 8px;
|
|
3202
3209
|
}
|
|
3203
3210
|
`;
|
|
3204
|
-
var Co = Object.defineProperty, $o = Object.getOwnPropertyDescriptor,
|
|
3211
|
+
var Co = Object.defineProperty, $o = Object.getOwnPropertyDescriptor, he = (t, e, o, a) => {
|
|
3205
3212
|
for (var r = a > 1 ? void 0 : a ? $o(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
3206
3213
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
3207
3214
|
return a && r && Co(e, o, r), r;
|
|
@@ -3251,16 +3258,16 @@ let q = class extends C {
|
|
|
3251
3258
|
}
|
|
3252
3259
|
};
|
|
3253
3260
|
q.styles = _o;
|
|
3254
|
-
|
|
3261
|
+
he([
|
|
3255
3262
|
l({ type: Boolean })
|
|
3256
3263
|
], q.prototype, "open", 2);
|
|
3257
|
-
|
|
3264
|
+
he([
|
|
3258
3265
|
l({ type: String, attribute: "label" })
|
|
3259
3266
|
], q.prototype, "label", 2);
|
|
3260
|
-
|
|
3267
|
+
he([
|
|
3261
3268
|
l({ type: Number })
|
|
3262
3269
|
], q.prototype, "zindex", 2);
|
|
3263
|
-
q =
|
|
3270
|
+
q = he([
|
|
3264
3271
|
k("cb-dialog")
|
|
3265
3272
|
], q);
|
|
3266
3273
|
var jo = Object.defineProperty, Mo = Object.getOwnPropertyDescriptor, Ke = (t, e, o, a) => {
|
|
@@ -3376,12 +3383,12 @@ const So = x`
|
|
|
3376
3383
|
grid-column-start: 2;
|
|
3377
3384
|
}
|
|
3378
3385
|
`;
|
|
3379
|
-
var Ao = Object.defineProperty, Oo = Object.getOwnPropertyDescriptor,
|
|
3386
|
+
var Ao = Object.defineProperty, Oo = Object.getOwnPropertyDescriptor, Z = (t, e, o, a) => {
|
|
3380
3387
|
for (var r = a > 1 ? void 0 : a ? Oo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
3381
3388
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
3382
3389
|
return a && r && Ao(e, o, r), r;
|
|
3383
3390
|
};
|
|
3384
|
-
let
|
|
3391
|
+
let E = class extends C {
|
|
3385
3392
|
constructor() {
|
|
3386
3393
|
super(...arguments), this.open = !1, this.clearMessageDialogOpen = !1, this.customRequest = !1;
|
|
3387
3394
|
}
|
|
@@ -3420,7 +3427,7 @@ let z = class extends C {
|
|
|
3420
3427
|
Enable it for your own backend.
|
|
3421
3428
|
</sl-switch>
|
|
3422
3429
|
</div> -->
|
|
3423
|
-
${
|
|
3430
|
+
${R(
|
|
3424
3431
|
this.customRequest,
|
|
3425
3432
|
() => null,
|
|
3426
3433
|
() => this.renderInternalServices()
|
|
@@ -3544,26 +3551,26 @@ let z = class extends C {
|
|
|
3544
3551
|
});
|
|
3545
3552
|
}
|
|
3546
3553
|
};
|
|
3547
|
-
|
|
3548
|
-
|
|
3554
|
+
E.styles = So;
|
|
3555
|
+
Z([
|
|
3549
3556
|
l({ type: Boolean })
|
|
3550
|
-
],
|
|
3551
|
-
|
|
3557
|
+
], E.prototype, "open", 2);
|
|
3558
|
+
Z([
|
|
3552
3559
|
l({ type: Object })
|
|
3553
|
-
],
|
|
3554
|
-
|
|
3560
|
+
], E.prototype, "setting", 2);
|
|
3561
|
+
Z([
|
|
3555
3562
|
l({ type: Boolean })
|
|
3556
|
-
],
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
],
|
|
3560
|
-
|
|
3563
|
+
], E.prototype, "clearMessageDialogOpen", 2);
|
|
3564
|
+
Z([
|
|
3565
|
+
ce("sl-dialog")
|
|
3566
|
+
], E.prototype, "dialog", 2);
|
|
3567
|
+
Z([
|
|
3561
3568
|
l({ type: Boolean })
|
|
3562
|
-
],
|
|
3563
|
-
|
|
3569
|
+
], E.prototype, "customRequest", 2);
|
|
3570
|
+
E = Z([
|
|
3564
3571
|
k("cb-setting")
|
|
3565
|
-
],
|
|
3566
|
-
const
|
|
3572
|
+
], E);
|
|
3573
|
+
const Lo = x`
|
|
3567
3574
|
${O}
|
|
3568
3575
|
:host {
|
|
3569
3576
|
--primary-color: var(--sl-color-primary-600);
|
|
@@ -3590,7 +3597,7 @@ const Ho = x`
|
|
|
3590
3597
|
|
|
3591
3598
|
transition: all 0.3s ease-in-out;
|
|
3592
3599
|
|
|
3593
|
-
z-index:
|
|
3600
|
+
z-index: 99;
|
|
3594
3601
|
}
|
|
3595
3602
|
|
|
3596
3603
|
.cb-anchor:hover {
|
|
@@ -3632,7 +3639,7 @@ const Ho = x`
|
|
|
3632
3639
|
.cb-anchor sl-popup {
|
|
3633
3640
|
--arrow-color: var(--sl-color-gray-300);
|
|
3634
3641
|
}
|
|
3635
|
-
`,
|
|
3642
|
+
`, 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>';
|
|
3636
3643
|
var Io = Object.defineProperty, Po = Object.getOwnPropertyDescriptor, Je = (t, e, o, a) => {
|
|
3637
3644
|
for (var r = a > 1 ? void 0 : a ? Po(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
3638
3645
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
@@ -3659,10 +3666,10 @@ let ae = class extends C {
|
|
|
3659
3666
|
<div class="cb-anchor ${this.open ? "open" : ""}" part="cb-anchor" @click=${this._clickHandler.bind(this)}>
|
|
3660
3667
|
<sl-popup placement="top-end" distance="16">
|
|
3661
3668
|
<sl-button slot="anchor" label="Start" size="large" variant="primary" class="icon anchor-button" circle>
|
|
3662
|
-
${
|
|
3669
|
+
${R(
|
|
3663
3670
|
this.open,
|
|
3664
3671
|
() => c`<cb-icon color="white" svg="${je}"></cb-icon>`,
|
|
3665
|
-
() => c`<cb-icon color="white" svg="${
|
|
3672
|
+
() => c`<cb-icon color="white" svg="${Ho}"></cb-icon>`
|
|
3666
3673
|
)}
|
|
3667
3674
|
</sl-button>
|
|
3668
3675
|
<div class="cb-engage-popup">Popup</div>
|
|
@@ -3671,7 +3678,7 @@ let ae = class extends C {
|
|
|
3671
3678
|
`;
|
|
3672
3679
|
}
|
|
3673
3680
|
};
|
|
3674
|
-
ae.styles =
|
|
3681
|
+
ae.styles = Lo;
|
|
3675
3682
|
Je([
|
|
3676
3683
|
l({ type: Boolean })
|
|
3677
3684
|
], ae.prototype, "open", 2);
|
|
@@ -3680,7 +3687,7 @@ ae = Je([
|
|
|
3680
3687
|
], ae);
|
|
3681
3688
|
const zo = x`
|
|
3682
3689
|
${O}
|
|
3683
|
-
`,
|
|
3690
|
+
`, xe = '<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>', Ye = '<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>', Ge = '<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>', Xe = '<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>';
|
|
3684
3691
|
var Eo = Object.defineProperty, To = Object.getOwnPropertyDescriptor, Qe = (t, e, o, a) => {
|
|
3685
3692
|
for (var r = a > 1 ? void 0 : a ? To(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
3686
3693
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
@@ -3689,11 +3696,11 @@ var Eo = Object.defineProperty, To = Object.getOwnPropertyDescriptor, Qe = (t, e
|
|
|
3689
3696
|
const Ee = {
|
|
3690
3697
|
error: {
|
|
3691
3698
|
variant: "danger",
|
|
3692
|
-
icon:
|
|
3699
|
+
icon: xe
|
|
3693
3700
|
},
|
|
3694
3701
|
danger: {
|
|
3695
3702
|
variant: "danger",
|
|
3696
|
-
icon:
|
|
3703
|
+
icon: xe
|
|
3697
3704
|
},
|
|
3698
3705
|
warning: {
|
|
3699
3706
|
variant: "warning",
|
|
@@ -3724,12 +3731,12 @@ Qe([
|
|
|
3724
3731
|
se = Qe([
|
|
3725
3732
|
k("cb-status-icon")
|
|
3726
3733
|
], se);
|
|
3727
|
-
var
|
|
3728
|
-
for (var r = a > 1 ? void 0 : a ?
|
|
3734
|
+
var Bo = Object.defineProperty, Ro = Object.getOwnPropertyDescriptor, Vo = (t, e, o, a) => {
|
|
3735
|
+
for (var r = a > 1 ? void 0 : a ? Ro(e, o) : e, s = t.length - 1, n; s >= 0; s--)
|
|
3729
3736
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
3730
|
-
return a && r &&
|
|
3737
|
+
return a && r && Bo(e, o, r), r;
|
|
3731
3738
|
};
|
|
3732
|
-
let
|
|
3739
|
+
let ke = class extends C {
|
|
3733
3740
|
render() {
|
|
3734
3741
|
return c` <sl-alert variant="danger" open>
|
|
3735
3742
|
<cb-status-icon status="error" slot="icon"></cb-status-icon>
|
|
@@ -3745,10 +3752,10 @@ let xe = class extends C {
|
|
|
3745
3752
|
this.emit("setting:show");
|
|
3746
3753
|
}
|
|
3747
3754
|
};
|
|
3748
|
-
|
|
3749
|
-
|
|
3755
|
+
ke.styles = zo;
|
|
3756
|
+
ke = Vo([
|
|
3750
3757
|
k("cb-auth-alert")
|
|
3751
|
-
],
|
|
3758
|
+
], ke);
|
|
3752
3759
|
class Te extends Error {
|
|
3753
3760
|
constructor(e, o, a) {
|
|
3754
3761
|
const r = e.status || e.status === 0 ? e.status : "", s = e.statusText || "", n = `${r} ${s}`.trim(), i = n ? `status code ${n}` : "an unknown error";
|
|
@@ -3818,7 +3825,7 @@ const ee = (t) => t !== null && typeof t == "object", G = (...t) => {
|
|
|
3818
3825
|
formData: "multipart/form-data",
|
|
3819
3826
|
arrayBuffer: "*/*",
|
|
3820
3827
|
blob: "*/*"
|
|
3821
|
-
},
|
|
3828
|
+
}, me = 2147483647, rt = Symbol("stop"), No = (t) => ot.includes(t) ? t.toUpperCase() : t, Wo = ["get", "put", "head", "delete", "options", "trace"], Ko = [408, 413, 429, 500, 502, 503, 504], at = [413, 429, 503], Be = {
|
|
3822
3829
|
limit: 2,
|
|
3823
3830
|
methods: Wo,
|
|
3824
3831
|
statusCodes: Ko,
|
|
@@ -3828,7 +3835,7 @@ const ee = (t) => t !== null && typeof t == "object", G = (...t) => {
|
|
|
3828
3835
|
}, Jo = (t = {}) => {
|
|
3829
3836
|
if (typeof t == "number")
|
|
3830
3837
|
return {
|
|
3831
|
-
...
|
|
3838
|
+
...Be,
|
|
3832
3839
|
limit: t
|
|
3833
3840
|
};
|
|
3834
3841
|
if (t.methods && !Array.isArray(t.methods))
|
|
@@ -3836,7 +3843,7 @@ const ee = (t) => t !== null && typeof t == "object", G = (...t) => {
|
|
|
3836
3843
|
if (t.statusCodes && !Array.isArray(t.statusCodes))
|
|
3837
3844
|
throw new Error("retry.statusCodes must be an array");
|
|
3838
3845
|
return {
|
|
3839
|
-
...
|
|
3846
|
+
...Be,
|
|
3840
3847
|
...t,
|
|
3841
3848
|
afterStatusCodes: at
|
|
3842
3849
|
};
|
|
@@ -3852,7 +3859,7 @@ async function Yo(t, e, o) {
|
|
|
3852
3859
|
});
|
|
3853
3860
|
}
|
|
3854
3861
|
const Go = !!globalThis.DOMException;
|
|
3855
|
-
function
|
|
3862
|
+
function Re(t) {
|
|
3856
3863
|
if (Go)
|
|
3857
3864
|
return new DOMException((t == null ? void 0 : t.reason) ?? "The operation was aborted.", "AbortError");
|
|
3858
3865
|
const e = new Error((t == null ? void 0 : t.reason) ?? "The operation was aborted.");
|
|
@@ -3862,13 +3869,13 @@ async function Xo(t, { signal: e }) {
|
|
|
3862
3869
|
return new Promise((o, a) => {
|
|
3863
3870
|
if (e) {
|
|
3864
3871
|
if (e.aborted) {
|
|
3865
|
-
a(
|
|
3872
|
+
a(Re(e));
|
|
3866
3873
|
return;
|
|
3867
3874
|
}
|
|
3868
3875
|
e.addEventListener("abort", r, { once: !0 });
|
|
3869
3876
|
}
|
|
3870
3877
|
function r() {
|
|
3871
|
-
a(
|
|
3878
|
+
a(Re(e)), clearTimeout(s);
|
|
3872
3879
|
}
|
|
3873
3880
|
const s = setTimeout(() => {
|
|
3874
3881
|
e == null || e.removeEventListener("abort", r), o();
|
|
@@ -3879,8 +3886,8 @@ class ne {
|
|
|
3879
3886
|
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
3880
3887
|
static create(e, o) {
|
|
3881
3888
|
const a = new ne(e, o), r = async () => {
|
|
3882
|
-
if (a._options.timeout >
|
|
3883
|
-
throw new RangeError(`The \`timeout\` option cannot be greater than ${
|
|
3889
|
+
if (a._options.timeout > me)
|
|
3890
|
+
throw new RangeError(`The \`timeout\` option cannot be greater than ${me}`);
|
|
3884
3891
|
await Promise.resolve();
|
|
3885
3892
|
let i = await a._fetch();
|
|
3886
3893
|
for (const g of a._options.hooks.afterResponse) {
|
|
@@ -4008,7 +4015,7 @@ class ne {
|
|
|
4008
4015
|
try {
|
|
4009
4016
|
return await e();
|
|
4010
4017
|
} catch (o) {
|
|
4011
|
-
const a = Math.min(this._calculateRetryDelay(o),
|
|
4018
|
+
const a = Math.min(this._calculateRetryDelay(o), me);
|
|
4012
4019
|
if (a !== 0 && this._retryCount > 0) {
|
|
4013
4020
|
await Xo(a, { signal: this._options.signal });
|
|
4014
4021
|
for (const r of this._options.hooks.beforeRetry)
|
|
@@ -4071,12 +4078,12 @@ class ne {
|
|
|
4071
4078
|
}
|
|
4072
4079
|
}
|
|
4073
4080
|
/*! MIT License © Sindre Sorhus */
|
|
4074
|
-
const
|
|
4081
|
+
const _e = (t) => {
|
|
4075
4082
|
const e = (o, a) => ne.create(o, G(t, a));
|
|
4076
4083
|
for (const o of ot)
|
|
4077
4084
|
e[o] = (a, r) => ne.create(a, G(t, r, { method: o }));
|
|
4078
|
-
return e.create = (o) =>
|
|
4079
|
-
}, Qo =
|
|
4085
|
+
return e.create = (o) => _e(G(o)), e.extend = (o) => _e(G(t, o)), e.stop = rt, e;
|
|
4086
|
+
}, Qo = _e(), er = Qo, st = er.extend({
|
|
4080
4087
|
hooks: {
|
|
4081
4088
|
beforeRequest: [
|
|
4082
4089
|
() => {
|
|
@@ -4125,7 +4132,7 @@ async function or(t, e) {
|
|
|
4125
4132
|
const Ve = {
|
|
4126
4133
|
error: {
|
|
4127
4134
|
variant: "danger",
|
|
4128
|
-
icon:
|
|
4135
|
+
icon: xe
|
|
4129
4136
|
},
|
|
4130
4137
|
warning: {
|
|
4131
4138
|
variant: "warning",
|
|
@@ -4213,8 +4220,8 @@ var ir = Object.defineProperty, lr = Object.getOwnPropertyDescriptor, v = (t, e,
|
|
|
4213
4220
|
(n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
|
|
4214
4221
|
return a && r && ir(e, o, r), r;
|
|
4215
4222
|
};
|
|
4216
|
-
const
|
|
4217
|
-
|
|
4223
|
+
const Ce = de.noConflict();
|
|
4224
|
+
Ce.setLevel("info");
|
|
4218
4225
|
let b = class extends C {
|
|
4219
4226
|
constructor() {
|
|
4220
4227
|
super(...arguments), this.store = new mt(this, p), this.displayLicense = !1, this.name = "ChatBot", this.orgId = "", this.botId = "", this.url = "ws://localhost:3070", this.welcomeMessage = "Hello! How can I help you today ?", this.logoSvg = ` <svg width="24" height="24" viewBox="0 0 40 40">
|
|
@@ -4225,6 +4232,7 @@ let b = class extends C {
|
|
|
4225
4232
|
</svg>
|
|
4226
4233
|
`, 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
4234
|
}
|
|
4235
|
+
//HTMLElement;
|
|
4228
4236
|
/**
|
|
4229
4237
|
* decodeStreamData
|
|
4230
4238
|
*/
|
|
@@ -4240,6 +4248,17 @@ let b = class extends C {
|
|
|
4240
4248
|
};
|
|
4241
4249
|
return p.addMessage(t), t;
|
|
4242
4250
|
}
|
|
4251
|
+
addTestMessage() {
|
|
4252
|
+
const t = {
|
|
4253
|
+
author: "assistant",
|
|
4254
|
+
type: "text",
|
|
4255
|
+
isThinking: !1,
|
|
4256
|
+
data: {
|
|
4257
|
+
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."
|
|
4258
|
+
}
|
|
4259
|
+
};
|
|
4260
|
+
return p.addMessage(t), t;
|
|
4261
|
+
}
|
|
4243
4262
|
render() {
|
|
4244
4263
|
return c`
|
|
4245
4264
|
<div class="cb-wrapper" style="${this.open ? "display:flex" : "display:none"}">
|
|
@@ -4251,7 +4270,7 @@ let b = class extends C {
|
|
|
4251
4270
|
`;
|
|
4252
4271
|
}
|
|
4253
4272
|
connectedCallback() {
|
|
4254
|
-
super.connectedCallback(),
|
|
4273
|
+
super.connectedCallback(), Ce.info("connectedCallback"), addEventListener("setting:show", () => {
|
|
4255
4274
|
this.showSetting = !0;
|
|
4256
4275
|
}), 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
4276
|
this.showSetting = !1;
|
|
@@ -4268,7 +4287,7 @@ let b = class extends C {
|
|
|
4268
4287
|
// Use to initialize
|
|
4269
4288
|
// This is also called when state changes - ??? - i.e. when message added to the array
|
|
4270
4289
|
updated(t) {
|
|
4271
|
-
super.updated(t), t.size > 0 && (
|
|
4290
|
+
super.updated(t), t.size > 0 && (Ce.info("updated,_changedProperties:", t), this._initSetting()), setTimeout(() => {
|
|
4272
4291
|
this._scrollToBottom();
|
|
4273
4292
|
}, 0);
|
|
4274
4293
|
}
|
|
@@ -4380,14 +4399,8 @@ let b = class extends C {
|
|
|
4380
4399
|
}
|
|
4381
4400
|
// scroll to bottom
|
|
4382
4401
|
_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
|
-
});
|
|
4402
|
+
var e;
|
|
4403
|
+
(e = this._messageList) == null || e.scrollToBottom();
|
|
4391
4404
|
}
|
|
4392
4405
|
};
|
|
4393
4406
|
b.styles = kt;
|
|
@@ -4446,7 +4459,7 @@ v([
|
|
|
4446
4459
|
l({ type: Boolean })
|
|
4447
4460
|
], b.prototype, "showAuthAlert", 2);
|
|
4448
4461
|
v([
|
|
4449
|
-
|
|
4462
|
+
ce("cb-message-list")
|
|
4450
4463
|
], b.prototype, "_messageList", 2);
|
|
4451
4464
|
b = v([
|
|
4452
4465
|
k("enegelai-bot")
|