deep-chat-dev 9.0.80 → 9.0.82
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/custom-elements.json +2986 -2947
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.d.ts +1 -1
- package/dist/deepChat.d.ts.map +1 -1
- package/dist/deepChat.js +329 -311
- package/dist/types/messageFile.d.ts +1 -0
- package/dist/types/messageFile.d.ts.map +1 -1
- package/dist/utils/events/fireEvents.d.ts.map +1 -1
- package/dist/views/chat/messages/fileMessageUtils.d.ts +7 -1
- package/dist/views/chat/messages/fileMessageUtils.d.ts.map +1 -1
- package/dist/views/chat/messages/fileMessages.d.ts.map +1 -1
- package/dist/webModel/webModel.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/deepChat.js
CHANGED
@@ -337,7 +337,7 @@ var Pn = /*#__PURE__*/function () {
|
|
337
337
|
return ze;
|
338
338
|
}();
|
339
339
|
Pn.TEXT_INPUT_ID = "text-input";
|
340
|
-
var
|
340
|
+
var Fi = Pn;
|
341
341
|
var Yt = /*#__PURE__*/function () {
|
342
342
|
function Yt() {
|
343
343
|
_classCallCheck(this, Yt);
|
@@ -353,7 +353,7 @@ var Yt = /*#__PURE__*/function () {
|
|
353
353
|
}, {
|
354
354
|
key: "focusFromParentElement",
|
355
355
|
value: function focusFromParentElement(e) {
|
356
|
-
var t = e.querySelector("#".concat(
|
356
|
+
var t = e.querySelector("#".concat(Fi.TEXT_INPUT_ID));
|
357
357
|
t && Yt.focusEndOfInput(t);
|
358
358
|
}
|
359
359
|
}]);
|
@@ -415,12 +415,12 @@ var I = {
|
|
415
415
|
return jn;
|
416
416
|
}();
|
417
417
|
Dn.CODE_SNIPPET_GENERATION_JUMP = 0.5;
|
418
|
-
var
|
419
|
-
var
|
420
|
-
function
|
421
|
-
_classCallCheck(this,
|
418
|
+
var ne = Dn;
|
419
|
+
var Fn = /*#__PURE__*/function () {
|
420
|
+
function Bn() {
|
421
|
+
_classCallCheck(this, Bn);
|
422
422
|
}
|
423
|
-
_createClass(
|
423
|
+
_createClass(Bn, null, [{
|
424
424
|
key: "speak",
|
425
425
|
value: function speak(e, t) {
|
426
426
|
if (window.SpeechSynthesisUtterance) {
|
@@ -441,13 +441,13 @@ var Bn = /*#__PURE__*/function () {
|
|
441
441
|
n && (i.voice = n);
|
442
442
|
}
|
443
443
|
t(i);
|
444
|
-
},
|
444
|
+
}, Bn.LOAD_VOICES_MS);
|
445
445
|
}
|
446
446
|
}]);
|
447
|
-
return
|
447
|
+
return Bn;
|
448
448
|
}();
|
449
|
-
|
450
|
-
var Lt =
|
449
|
+
Fn.LOAD_VOICES_MS = 200;
|
450
|
+
var Lt = Fn;
|
451
451
|
var Ae = /*#__PURE__*/function () {
|
452
452
|
function Ae() {
|
453
453
|
_classCallCheck(this, Ae);
|
@@ -693,7 +693,7 @@ var ge = /*#__PURE__*/function () {
|
|
693
693
|
var o = i.getElementsByClassName(r);
|
694
694
|
Array.from(o || []).forEach(function (a) {
|
695
695
|
var l = ge.getProcessedStyles(t, a, r);
|
696
|
-
|
696
|
+
se.applyStylesToElement(a, l), ge.applyEvents(a, r);
|
697
697
|
});
|
698
698
|
});
|
699
699
|
var n = i.getElementsByClassName(bs);
|
@@ -704,11 +704,11 @@ var ge = /*#__PURE__*/function () {
|
|
704
704
|
}]);
|
705
705
|
return ge;
|
706
706
|
}();
|
707
|
-
var
|
708
|
-
function
|
709
|
-
_classCallCheck(this,
|
707
|
+
var se = /*#__PURE__*/function () {
|
708
|
+
function se() {
|
709
|
+
_classCallCheck(this, se);
|
710
710
|
}
|
711
|
-
_createClass(
|
711
|
+
_createClass(se, null, [{
|
712
712
|
key: "applyStylesToElement",
|
713
713
|
value: function applyStylesToElement(e, t) {
|
714
714
|
var i = M.processStateful(t, {}, {});
|
@@ -727,7 +727,7 @@ var ne = /*#__PURE__*/function () {
|
|
727
727
|
value: function applyClassUtilitiesToElement(e, t) {
|
728
728
|
var i = t.events,
|
729
729
|
n = t.styles;
|
730
|
-
i &&
|
730
|
+
i && se.applyEventsToElement(e, i), n && !ge.doesElementContainDeepChatClass(e) && se.applyStylesToElement(e, n);
|
731
731
|
}
|
732
732
|
}, {
|
733
733
|
key: "applyCustomClassUtilities",
|
@@ -735,17 +735,17 @@ var ne = /*#__PURE__*/function () {
|
|
735
735
|
Object.keys(e).forEach(function (i) {
|
736
736
|
var n = t.getElementsByClassName(i);
|
737
737
|
Array.from(n).forEach(function (r) {
|
738
|
-
e[i] &&
|
738
|
+
e[i] && se.applyClassUtilitiesToElement(r, e[i]);
|
739
739
|
});
|
740
740
|
});
|
741
741
|
}
|
742
742
|
}, {
|
743
743
|
key: "apply",
|
744
744
|
value: function apply(e, t) {
|
745
|
-
ge.applyDeepChatUtilities(e, e.htmlClassUtilities, t),
|
745
|
+
ge.applyDeepChatUtilities(e, e.htmlClassUtilities, t), se.applyCustomClassUtilities(e.htmlClassUtilities, t);
|
746
746
|
}
|
747
747
|
}]);
|
748
|
-
return
|
748
|
+
return se;
|
749
749
|
}();
|
750
750
|
var Je = /*#__PURE__*/function () {
|
751
751
|
function Je() {
|
@@ -767,7 +767,7 @@ var Je = /*#__PURE__*/function () {
|
|
767
767
|
value: function overwrite(e, t, i, n) {
|
768
768
|
var r = e.messages,
|
769
769
|
o = v.overwriteMessage(r, n, t, i, "html", "html-message");
|
770
|
-
return o && (o.bubbleElement.innerHTML = t,
|
770
|
+
return o && (o.bubbleElement.innerHTML = t, se.apply(e, o.outerContainer), Ae.flagHTMLUpdateClass(o.bubbleElement)), o;
|
771
771
|
}
|
772
772
|
}, {
|
773
773
|
key: "add",
|
@@ -779,7 +779,7 @@ var Je = /*#__PURE__*/function () {
|
|
779
779
|
if (l) return l;
|
780
780
|
}
|
781
781
|
var o = Je.createElements(e, t, i);
|
782
|
-
return v.fillEmptyMessageElement(o.bubbleElement, t),
|
782
|
+
return v.fillEmptyMessageElement(o.bubbleElement, t), se.apply(e, o.outerContainer), Ae.flagHTMLUpdateClass(o.bubbleElement), e.applyCustomStyles(o, i, !1, (a = e.messageStyles) == null ? void 0 : a.html), Je.addElement(e, o.outerContainer), o;
|
783
783
|
}
|
784
784
|
}]);
|
785
785
|
return Je;
|
@@ -840,7 +840,7 @@ var _s = /[&<>"]/,
|
|
840
840
|
function Cs(s) {
|
841
841
|
return Ts[s];
|
842
842
|
}
|
843
|
-
function
|
843
|
+
function B(s) {
|
844
844
|
return _s.test(s) ? s.replace(Ms, Cs) : s;
|
845
845
|
}
|
846
846
|
var f = {};
|
@@ -851,7 +851,7 @@ f.blockquote_close = function (s, e) {
|
|
851
851
|
return "</blockquote>" + Le(s, e);
|
852
852
|
};
|
853
853
|
f.code = function (s, e) {
|
854
|
-
return s[e].block ? "<pre><code>" +
|
854
|
+
return s[e].block ? "<pre><code>" + B(s[e].content) + "</code></pre>" + Le(s, e) : "<code>" + B(s[e].content) + "</code>";
|
855
855
|
};
|
856
856
|
f.fence = function (s, e, t, i, n) {
|
857
857
|
var r = s[e],
|
@@ -863,9 +863,9 @@ f.fence = function (s, e, t, i, n) {
|
|
863
863
|
u;
|
864
864
|
if (r.params) {
|
865
865
|
if (c = r.params.split(/\s+/g), d = c.join(" "), ys(n.rules.fence_custom, c[0])) return n.rules.fence_custom[c[0]](s, e, t, i, n);
|
866
|
-
l =
|
866
|
+
l = B(ke(ht(d))), o = ' class="' + a + l + '"';
|
867
867
|
}
|
868
|
-
return t.highlight ? u = t.highlight.apply(t.highlight, [r.content].concat(c)) ||
|
868
|
+
return t.highlight ? u = t.highlight.apply(t.highlight, [r.content].concat(c)) || B(r.content) : u = B(r.content), "<pre><code" + o + ">" + u + "</code></pre>" + Le(s, e);
|
869
869
|
};
|
870
870
|
f.fence_custom = {};
|
871
871
|
f.heading_open = function (s, e) {
|
@@ -905,17 +905,17 @@ f.paragraph_close = function (s, e) {
|
|
905
905
|
return (s[e].tight ? "" : "</p>") + (t ? Le(s, e) : "");
|
906
906
|
};
|
907
907
|
f.link_open = function (s, e, t) {
|
908
|
-
var i = s[e].title ? ' title="' +
|
908
|
+
var i = s[e].title ? ' title="' + B(ke(s[e].title)) + '"' : "",
|
909
909
|
n = t.linkTarget ? ' target="' + t.linkTarget + '"' : "";
|
910
|
-
return '<a href="' +
|
910
|
+
return '<a href="' + B(s[e].href) + '"' + i + n + ">";
|
911
911
|
};
|
912
912
|
f.link_close = function () {
|
913
913
|
return "</a>";
|
914
914
|
};
|
915
915
|
f.image = function (s, e, t) {
|
916
|
-
var i = ' src="' +
|
917
|
-
n = s[e].title ? ' title="' +
|
918
|
-
r = ' alt="' + (s[e].alt ?
|
916
|
+
var i = ' src="' + B(s[e].src) + '"',
|
917
|
+
n = s[e].title ? ' title="' + B(ke(s[e].title)) + '"' : "",
|
918
|
+
r = ' alt="' + (s[e].alt ? B(ke(ht(s[e].alt))) : "") + '"',
|
919
919
|
o = t.xhtmlOut ? " /" : "";
|
920
920
|
return "<img" + i + r + n + o + ">";
|
921
921
|
};
|
@@ -988,10 +988,10 @@ f.mark_close = function () {
|
|
988
988
|
return "</mark>";
|
989
989
|
};
|
990
990
|
f.sub = function (s, e) {
|
991
|
-
return "<sub>" +
|
991
|
+
return "<sub>" + B(s[e].content) + "</sub>";
|
992
992
|
};
|
993
993
|
f.sup = function (s, e) {
|
994
|
-
return "<sup>" +
|
994
|
+
return "<sup>" + B(s[e].content) + "</sup>";
|
995
995
|
};
|
996
996
|
f.hardbreak = function (s, e, t) {
|
997
997
|
return t.xhtmlOut ? "<br />\n" : "<br>\n";
|
@@ -1000,7 +1000,7 @@ f.softbreak = function (s, e, t) {
|
|
1000
1000
|
return t.breaks ? t.xhtmlOut ? "<br />\n" : "<br>\n" : "\n";
|
1001
1001
|
};
|
1002
1002
|
f.text = function (s, e) {
|
1003
|
-
return
|
1003
|
+
return B(s[e].content);
|
1004
1004
|
};
|
1005
1005
|
f.htmlblock = function (s, e) {
|
1006
1006
|
return s[e].content;
|
@@ -1009,7 +1009,7 @@ f.htmltag = function (s, e) {
|
|
1009
1009
|
return s[e].content;
|
1010
1010
|
};
|
1011
1011
|
f.abbr_open = function (s, e) {
|
1012
|
-
return '<abbr title="' +
|
1012
|
+
return '<abbr title="' + B(ke(s[e].title)) + '">';
|
1013
1013
|
};
|
1014
1014
|
f.abbr_close = function () {
|
1015
1015
|
return "</abbr>";
|
@@ -1062,14 +1062,14 @@ function Hn(s, e) {
|
|
1062
1062
|
var Le = f.getBreak = function (e, t) {
|
1063
1063
|
return t = Hn(e, t), t < e.length && e[t].type === "list_item_close" ? "" : "\n";
|
1064
1064
|
};
|
1065
|
-
function
|
1065
|
+
function Bi() {
|
1066
1066
|
this.rules = qn({}, f), this.getBreak = f.getBreak;
|
1067
1067
|
}
|
1068
|
-
|
1068
|
+
Bi.prototype.renderInline = function (s, e, t) {
|
1069
1069
|
for (var i = this.rules, n = s.length, r = 0, o = ""; n--;) o += i[s[r].type](s, r++, e, t, this);
|
1070
1070
|
return o;
|
1071
1071
|
};
|
1072
|
-
|
1072
|
+
Bi.prototype.render = function (s, e, t) {
|
1073
1073
|
for (var i = this.rules, n = s.length, r = -1, o = ""; ++r < n;) s[r].type === "inline" ? o += this.renderInline(s[r].children, e, t) : o += i[s[r].type](s, r, e, t, this);
|
1074
1074
|
return o;
|
1075
1075
|
};
|
@@ -1408,21 +1408,21 @@ function Ps(s) {
|
|
1408
1408
|
}
|
1409
1409
|
var Ds = /\+-|\.\.|\?\?\?\?|!!!!|,,|--/,
|
1410
1410
|
js = /\((c|tm|r|p)\)/ig,
|
1411
|
-
|
1411
|
+
Fs = {
|
1412
1412
|
c: "©",
|
1413
1413
|
r: "®",
|
1414
1414
|
p: "§",
|
1415
1415
|
tm: "™"
|
1416
1416
|
};
|
1417
|
-
function
|
1417
|
+
function Bs(s) {
|
1418
1418
|
return s.indexOf("(") < 0 ? s : s.replace(js, function (e, t) {
|
1419
|
-
return
|
1419
|
+
return Fs[t.toLowerCase()];
|
1420
1420
|
});
|
1421
1421
|
}
|
1422
1422
|
function zs(s) {
|
1423
1423
|
var e, t, i, n, r;
|
1424
1424
|
if (s.options.typographer) {
|
1425
|
-
for (r = s.tokens.length - 1; r >= 0; r--) if (s.tokens[r].type === "inline") for (n = s.tokens[r].children, e = n.length - 1; e >= 0; e--) t = n[e], t.type === "text" && (i = t.content, i =
|
1425
|
+
for (r = s.tokens.length - 1; r >= 0; r--) if (s.tokens[r].type === "inline") for (n = s.tokens[r].children, e = n.length - 1; e >= 0; e--) t = n[e], t.type === "text" && (i = t.content, i = Bs(i), Ds.test(i) && (i = i.replace(/\+-/g, "±").replace(/\.{2,}/g, "…").replace(/([?!])…/g, "$1..").replace(/([?!]){4,}/g, "$1$1$1").replace(/,{2,}/g, ",").replace(/(^|[^-])---([^-]|$)/mg, "$1—$2").replace(/(^|\s)--(\s|$)/mg, "$1–$2").replace(/(^|[^-\s])--([^-\s]|$)/mg, "$1–$2")), t.content = i);
|
1426
1426
|
}
|
1427
1427
|
}
|
1428
1428
|
var qs = /['"]/,
|
@@ -1432,7 +1432,7 @@ var qs = /['"]/,
|
|
1432
1432
|
function an(s, e) {
|
1433
1433
|
return e < 0 || e >= s.length ? !1 : !Us.test(s[e]);
|
1434
1434
|
}
|
1435
|
-
function
|
1435
|
+
function Fe(s, e, t) {
|
1436
1436
|
return s.substr(0, e) + t + s.substr(e + 1);
|
1437
1437
|
}
|
1438
1438
|
function Hs(s) {
|
@@ -1444,12 +1444,12 @@ function Hs(s) {
|
|
1444
1444
|
S.length = h + 1, i = t.content, r = 0, o = i.length;
|
1445
1445
|
e: for (; r < o && (rn.lastIndex = r, n = rn.exec(i), !!n);) {
|
1446
1446
|
if (l = !an(i, n.index - 1), r = n.index + 1, g = n[0] === "'", c = !an(i, r), !c && !l) {
|
1447
|
-
g && (t.content =
|
1447
|
+
g && (t.content = Fe(t.content, n.index, on));
|
1448
1448
|
continue;
|
1449
1449
|
}
|
1450
1450
|
if (u = !c, p = !l, p) {
|
1451
1451
|
for (h = S.length - 1; h >= 0 && (d = S[h], !(S[h].level < a)); h--) if (d.single === g && S[h].level === a) {
|
1452
|
-
d = S[h], g ? (E[d.token].content =
|
1452
|
+
d = S[h], g ? (E[d.token].content = Fe(E[d.token].content, d.pos, s.options.quotes[2]), t.content = Fe(t.content, n.index, s.options.quotes[3])) : (E[d.token].content = Fe(E[d.token].content, d.pos, s.options.quotes[0]), t.content = Fe(t.content, n.index, s.options.quotes[1])), S.length = h;
|
1453
1453
|
continue e;
|
1454
1454
|
}
|
1455
1455
|
}
|
@@ -1458,7 +1458,7 @@ function Hs(s) {
|
|
1458
1458
|
pos: n.index,
|
1459
1459
|
single: g,
|
1460
1460
|
level: a
|
1461
|
-
}) : p && g && (t.content =
|
1461
|
+
}) : p && g && (t.content = Fe(t.content, n.index, on));
|
1462
1462
|
}
|
1463
1463
|
}
|
1464
1464
|
}
|
@@ -1661,7 +1661,7 @@ function Ys(s, e, t, i) {
|
|
1661
1661
|
V,
|
1662
1662
|
Q,
|
1663
1663
|
ee = !0,
|
1664
|
-
|
1664
|
+
he,
|
1665
1665
|
q,
|
1666
1666
|
en,
|
1667
1667
|
gi;
|
@@ -1677,7 +1677,7 @@ function Ys(s, e, t, i) {
|
|
1677
1677
|
type: "bullet_list_open",
|
1678
1678
|
lines: V = [e, 0],
|
1679
1679
|
level: s.level++
|
1680
|
-
}), n = e, C = !1,
|
1680
|
+
}), n = e, C = !1, he = s.parser.ruler.getRules("list"); n < t && (S = s.skipSpaces(u), p = s.eMarks[n], S >= p ? h = 1 : h = S - u, h > 4 && (h = 1), h < 1 && (h = 1), r = u - s.bMarks[n] + h, s.tokens.push({
|
1681
1681
|
type: "list_item_open",
|
1682
1682
|
lines: Q = [e, 0],
|
1683
1683
|
level: s.level++
|
@@ -1685,7 +1685,7 @@ function Ys(s, e, t, i) {
|
|
1685
1685
|
type: "list_item_close",
|
1686
1686
|
level: --s.level
|
1687
1687
|
}), n = e = s.line, Q[1] = n, S = s.bMarks[e], !(n >= t || s.isEmpty(n) || s.tShift[n] < s.blkIndent));) {
|
1688
|
-
for (gi = !1, q = 0, en =
|
1688
|
+
for (gi = !1, q = 0, en = he.length; q < en; q++) if (he[q](s, n, t, !0)) {
|
1689
1689
|
gi = !0;
|
1690
1690
|
break;
|
1691
1691
|
}
|
@@ -2424,11 +2424,11 @@ var Ir = /[a-zA-Z_:][a-zA-Z0-9:._-]*/,
|
|
2424
2424
|
Pr = Zt(/(?:\s+attr_name(?:\s*=\s*attr_value)?)/)("attr_name", Ir)("attr_value", Nr)(),
|
2425
2425
|
Dr = Zt(/<[A-Za-z][A-Za-z0-9]*attribute*\s*\/?>/)("attribute", Pr)(),
|
2426
2426
|
jr = /<\/[A-Za-z][A-Za-z0-9]*\s*>/,
|
2427
|
-
|
2428
|
-
|
2427
|
+
Fr = /<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->/,
|
2428
|
+
Br = /<[?].*?[?]>/,
|
2429
2429
|
zr = /<![A-Z]+\s+[^>]*>/,
|
2430
2430
|
qr = /<!\[CDATA\[[\s\S]*?\]\]>/,
|
2431
|
-
Ur = Zt(/^(?:open_tag|close_tag|comment|processing|declaration|cdata)/)("open_tag", Dr)("close_tag", jr)("comment",
|
2431
|
+
Ur = Zt(/^(?:open_tag|close_tag|comment|processing|declaration|cdata)/)("open_tag", Dr)("close_tag", jr)("comment", Fr)("processing", Br)("declaration", zr)("cdata", qr)();
|
2432
2432
|
function Hr(s) {
|
2433
2433
|
var e = s | 32;
|
2434
2434
|
return e >= 97 && e <= 122;
|
@@ -2625,34 +2625,34 @@ var Yr = {
|
|
2625
2625
|
function Yn(s, e, t) {
|
2626
2626
|
this.src = e, this.env = t, this.options = s.options, this.tokens = [], this.inlineMode = !1, this.inline = s.inline, this.block = s.block, this.renderer = s.renderer, this.typographer = s.typographer;
|
2627
2627
|
}
|
2628
|
-
function
|
2629
|
-
typeof s != "string" && (e = s, s = "default"), e && e.linkify != null && console.warn("linkify option is removed. Use linkify plugin instead:\n\nimport Remarkable from 'remarkable';\nimport linkify from 'remarkable/linkify';\nnew Remarkable().use(linkify)\n"), this.inline = new Xt(), this.block = new zi(), this.core = new Kn(), this.renderer = new
|
2628
|
+
function ue(s, e) {
|
2629
|
+
typeof s != "string" && (e = s, s = "default"), e && e.linkify != null && console.warn("linkify option is removed. Use linkify plugin instead:\n\nimport Remarkable from 'remarkable';\nimport linkify from 'remarkable/linkify';\nnew Remarkable().use(linkify)\n"), this.inline = new Xt(), this.block = new zi(), this.core = new Kn(), this.renderer = new Bi(), this.ruler = new H(), this.options = {}, this.configure(Xr[s]), this.set(e || {});
|
2630
2630
|
}
|
2631
|
-
|
2631
|
+
ue.prototype.set = function (s) {
|
2632
2632
|
qn(this.options, s);
|
2633
2633
|
};
|
2634
|
-
|
2634
|
+
ue.prototype.configure = function (s) {
|
2635
2635
|
var e = this;
|
2636
2636
|
if (!s) throw new Error("Wrong `remarkable` preset, check name/content");
|
2637
2637
|
s.options && e.set(s.options), s.components && Object.keys(s.components).forEach(function (t) {
|
2638
2638
|
s.components[t].rules && e[t].ruler.enable(s.components[t].rules, !0);
|
2639
2639
|
});
|
2640
2640
|
};
|
2641
|
-
|
2641
|
+
ue.prototype.use = function (s, e) {
|
2642
2642
|
return s(this, e), this;
|
2643
2643
|
};
|
2644
|
-
|
2644
|
+
ue.prototype.parse = function (s, e) {
|
2645
2645
|
var t = new Yn(this, s, e);
|
2646
2646
|
return this.core.process(t), t.tokens;
|
2647
2647
|
};
|
2648
|
-
|
2648
|
+
ue.prototype.render = function (s, e) {
|
2649
2649
|
return e = e || {}, this.renderer.render(this.parse(s, e), this.options, e);
|
2650
2650
|
};
|
2651
|
-
|
2651
|
+
ue.prototype.parseInline = function (s, e) {
|
2652
2652
|
var t = new Yn(this, s, e);
|
2653
2653
|
return t.inlineMode = !0, this.core.process(t), t.tokens;
|
2654
2654
|
};
|
2655
|
-
|
2655
|
+
ue.prototype.renderInline = function (s, e) {
|
2656
2656
|
return e = e || {}, this.renderer.render(this.parseInline(s, e), this.options, e);
|
2657
2657
|
};
|
2658
2658
|
var Li = /*#__PURE__*/function () {
|
@@ -2663,7 +2663,7 @@ var Li = /*#__PURE__*/function () {
|
|
2663
2663
|
key: "createNew",
|
2664
2664
|
value: function createNew() {
|
2665
2665
|
var e = window.hljs;
|
2666
|
-
return e ? new
|
2666
|
+
return e ? new ue({
|
2667
2667
|
highlight: function highlight(t, i) {
|
2668
2668
|
if (i && e.getLanguage(i)) try {
|
2669
2669
|
return e.highlight(i, t).value;
|
@@ -2689,7 +2689,7 @@ var Li = /*#__PURE__*/function () {
|
|
2689
2689
|
// set target to open in a new tab
|
2690
2690
|
typographer: !0
|
2691
2691
|
// Enable smartypants and other sweet transforms
|
2692
|
-
}) : new
|
2692
|
+
}) : new ue({
|
2693
2693
|
highlight: function highlight(t) {
|
2694
2694
|
return t;
|
2695
2695
|
},
|
@@ -2700,6 +2700,71 @@ var Li = /*#__PURE__*/function () {
|
|
2700
2700
|
}]);
|
2701
2701
|
return Li;
|
2702
2702
|
}();
|
2703
|
+
var $n = /*#__PURE__*/function () {
|
2704
|
+
function Rt() {
|
2705
|
+
_classCallCheck(this, Rt);
|
2706
|
+
}
|
2707
|
+
_createClass(Rt, null, [{
|
2708
|
+
key: "addMessage",
|
2709
|
+
value: function addMessage(e, t, i, n) {
|
2710
|
+
var r;
|
2711
|
+
e.elementRef.appendChild(t.outerContainer), e.applyCustomStyles(t, n, !0, (r = e.messageStyles) == null ? void 0 : r[i]), e.elementRef.scrollTop = e.elementRef.scrollHeight;
|
2712
|
+
}
|
2713
|
+
}, {
|
2714
|
+
key: "wrapInLink",
|
2715
|
+
value: function wrapInLink(e, t) {
|
2716
|
+
var i = document.createElement("a");
|
2717
|
+
return i.href = t, i.target = "_blank", i.appendChild(e), i;
|
2718
|
+
}
|
2719
|
+
}, {
|
2720
|
+
key: "processContent",
|
2721
|
+
value: function processContent(e, t) {
|
2722
|
+
return !t || t.startsWith("data") ? e : Rt.wrapInLink(e, t);
|
2723
|
+
}
|
2724
|
+
}, {
|
2725
|
+
key: "waitToLoadThenScroll",
|
2726
|
+
value: function waitToLoadThenScroll(e) {
|
2727
|
+
setTimeout(function () {
|
2728
|
+
e.scrollTop = e.scrollHeight;
|
2729
|
+
}, 60);
|
2730
|
+
}
|
2731
|
+
}, {
|
2732
|
+
key: "scrollDownOnImageLoad",
|
2733
|
+
value: function scrollDownOnImageLoad(e, t) {
|
2734
|
+
if (e.startsWith("data")) Rt.waitToLoadThenScroll(t);else try {
|
2735
|
+
fetch(e, {
|
2736
|
+
mode: "no-cors"
|
2737
|
+
})["catch"](function () {})["finally"](function () {
|
2738
|
+
Rt.waitToLoadThenScroll(t);
|
2739
|
+
});
|
2740
|
+
} catch (_unused5) {
|
2741
|
+
t.scrollTop = t.scrollHeight;
|
2742
|
+
}
|
2743
|
+
}
|
2744
|
+
// The strategy is to emit the actual file reference in the `onNewMessage` event for the user to inspect it
|
2745
|
+
// But it is not actually used by anything in the chat, hence it is removed when adding a message
|
2746
|
+
// after the body has been stringified and parsed - the file reference will disappear, hence this readds it
|
2747
|
+
}, {
|
2748
|
+
key: "reAddFileRefToObject",
|
2749
|
+
value: function reAddFileRefToObject(e, t) {
|
2750
|
+
var i;
|
2751
|
+
(i = e.files) == null || i.forEach(function (n, r) {
|
2752
|
+
var o;
|
2753
|
+
n.ref && (o = t.message.files) != null && o[r] && (t.message.files[r].ref = n.ref);
|
2754
|
+
});
|
2755
|
+
}
|
2756
|
+
// the chat does not use the actual file
|
2757
|
+
}, {
|
2758
|
+
key: "removeFileRef",
|
2759
|
+
value: function removeFileRef(e) {
|
2760
|
+
var t = _objectSpread({}, e);
|
2761
|
+
return delete t.ref, t;
|
2762
|
+
}
|
2763
|
+
}]);
|
2764
|
+
return Rt;
|
2765
|
+
}();
|
2766
|
+
$n.DEFAULT_FILE_NAME = "file";
|
2767
|
+
var ie = $n;
|
2703
2768
|
var Ui = /*#__PURE__*/function () {
|
2704
2769
|
function Ui() {
|
2705
2770
|
_classCallCheck(this, Ui);
|
@@ -2711,7 +2776,7 @@ var Ui = /*#__PURE__*/function () {
|
|
2711
2776
|
message: t,
|
2712
2777
|
isInitial: i
|
2713
2778
|
}));
|
2714
|
-
e.onNewMessage(n), e.dispatchEvent(new CustomEvent("new-message", {
|
2779
|
+
ie.reAddFileRefToObject(t, n), e.onNewMessage(n), e.dispatchEvent(new CustomEvent("new-message", {
|
2715
2780
|
detail: n
|
2716
2781
|
}));
|
2717
2782
|
}
|
@@ -2780,11 +2845,11 @@ var P = /*#__PURE__*/function () {
|
|
2780
2845
|
}();
|
2781
2846
|
var Qr = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8c3ZnIGZpbGw9IiMwMDAwMDAiIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIAoJCXZpZXdCb3g9IjAgMCAzMiAzMiIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+Cgk8cGF0aCBkPSJNMjMsMzAuMzZIOWMtMi40MDQsMC00LjM2LTEuOTU2LTQuMzYtNC4zNlYxNWMwLTIuNDA0LDEuOTU2LTQuMzYsNC4zNi00LjM2aDMuNjU5CgkJYzAuMTY3LTEuNTY2LDEuNDE1LTIuODEzLDIuOTgxLTIuOTgxVjUuMzMzYy0xLjEzMS0wLjE3NC0yLTEuMTU0LTItMi4zMzNjMC0xLjMwMSwxLjA1OS0yLjM2LDIuMzYtMi4zNgoJCWMxLjMwMiwwLDIuMzYsMS4wNTksMi4zNiwyLjM2YzAsMS4xNzktMC44NjksMi4xNTktMiwyLjMzM1Y3LjY2YzEuNTY2LDAuMTY3LDIuODE0LDEuNDE1LDIuOTgxLDIuOTgxSDIzCgkJYzIuNDA0LDAsNC4zNiwxLjk1Niw0LjM2LDQuMzZ2MTFDMjcuMzYsMjguNDA0LDI1LjQwNCwzMC4zNiwyMywzMC4zNnogTTksMTEuMzZjLTIuMDA3LDAtMy42NCwxLjYzMy0zLjY0LDMuNjR2MTEKCQljMCwyLjAwNywxLjYzMywzLjY0LDMuNjQsMy42NGgxNGMyLjAwNywwLDMuNjQtMS42MzMsMy42NC0zLjY0VjE1YzAtMi4wMDctMS42MzMtMy42NC0zLjY0LTMuNjRIOXogTTEzLjM4NCwxMC42NGg1LjIzMQoJCUMxOC40MzksOS4zNTQsMTcuMzM0LDguMzYsMTYsOC4zNkMxNC42NjcsOC4zNiwxMy41NjEsOS4zNTQsMTMuMzg0LDEwLjY0eiBNMTYsMS4zNmMtMC45MDQsMC0xLjY0LDAuNzM2LTEuNjQsMS42NAoJCVMxNS4wOTYsNC42NCwxNiw0LjY0YzAuOTA0LDAsMS42NC0wLjczNiwxLjY0LTEuNjRTMTYuOTA0LDEuMzYsMTYsMS4zNnogTTIwLDI3LjM2aC04Yy0xLjMwMSwwLTIuMzYtMS4wNTktMi4zNi0yLjM2CgkJczEuMDU5LTIuMzYsMi4zNi0yLjM2aDhjMS4zMDIsMCwyLjM2LDEuMDU5LDIuMzYsMi4zNlMyMS4zMDIsMjcuMzYsMjAsMjcuMzZ6IE0xMiwyMy4zNmMtMC45MDQsMC0xLjY0LDAuNzM1LTEuNjQsMS42NAoJCXMwLjczNiwxLjY0LDEuNjQsMS42NGg4YzAuOTA0LDAsMS42NC0wLjczNSwxLjY0LTEuNjRzLTAuNzM1LTEuNjQtMS42NC0xLjY0SDEyeiBNMzEsMjMuODZoLTJjLTAuMTk5LDAtMC4zNi0wLjE2MS0wLjM2LTAuMzZWMTUKCQljMC0wLjE5OSwwLjE2MS0wLjM2LDAuMzYtMC4zNmgyYzAuMTk5LDAsMC4zNiwwLjE2MSwwLjM2LDAuMzZ2OC41QzMxLjM2LDIzLjY5OSwzMS4xOTksMjMuODYsMzEsMjMuODZ6IE0yOS4zNiwyMy4xNGgxLjI3OXYtNy43OAoJCUgyOS4zNlYyMy4xNHogTTMsMjMuODZIMWMtMC4xOTksMC0wLjM2LTAuMTYxLTAuMzYtMC4zNlYxNWMwLTAuMTk5LDAuMTYxLTAuMzYsMC4zNi0wLjM2aDJjMC4xOTksMCwwLjM2LDAuMTYxLDAuMzYsMC4zNnY4LjUKCQlDMy4zNiwyMy42OTksMy4xOTksMjMuODYsMywyMy44NnogTTEuMzYsMjMuMTRoMS4yOHYtNy43OEgxLjM2VjIzLjE0eiBNMjAsMjAuMzZjLTEuMzAyLDAtMi4zNi0xLjA1OS0yLjM2LTIuMzYKCQlzMS4wNTktMi4zNiwyLjM2LTIuMzZzMi4zNiwxLjA1OSwyLjM2LDIuMzZDMjIuMzYsMTkuMzAyLDIxLjMwMiwyMC4zNiwyMCwyMC4zNnogTTIwLDE2LjM2Yy0wLjkwNCwwLTEuNjQsMC43MzYtMS42NCwxLjY0CgkJczAuNzM1LDEuNjQsMS42NCwxLjY0czEuNjQtMC43MzUsMS42NC0xLjY0UzIwLjkwNCwxNi4zNiwyMCwxNi4zNnogTTEyLDIwLjM2Yy0xLjMwMSwwLTIuMzYtMS4wNTktMi4zNi0yLjM2czEuMDU5LTIuMzYsMi4zNi0yLjM2CgkJczIuMzYsMS4wNTksMi4zNiwyLjM2QzE0LjM2LDE5LjMwMiwxMy4zMDEsMjAuMzYsMTIsMjAuMzZ6IE0xMiwxNi4zNmMtMC45MDQsMC0xLjY0LDAuNzM2LTEuNjQsMS42NHMwLjczNiwxLjY0LDEuNjQsMS42NAoJCXMxLjY0LTAuNzM1LDEuNjQtMS42NFMxMi45MDQsMTYuMzYsMTIsMTYuMzZ6Ii8+Cgk8cmVjdCBzdHlsZT0iZmlsbDpub25lOyIgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIi8+Cjwvc3ZnPg==",
|
2782
2847
|
eo = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6CAMAAAC/MqoPAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADNQTFRF////9vX18vLy/Pz86enp4+Li2tnZ1tbWzczM+fn57Ozs4N/f09LS0M/P5uXl7+/v3dzcwtncCAAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAEgAAABIAEbJaz4AAAZNSURBVHja7d3bdtsqEABQYABZSLH9/3+ZpnUsIcF5iOM6PfElNoMHMfPQdq3GmL0GkLhEUqLaUExnOtOZznSmM53pTGc605nOdKYznelMZzrTmV4LXSqllKyJDkob26xWq8Zae/iH0QoWTm9d1xur4WuypQJtTd+5dqn0VjcxzNO5/57mEBvdLo8Oron6aseWOjYOFkVvjQs3DmgyONMuht52EfztP+4hdu0i6LCO808/M8c1lE/fuPGej41uUzgdtoO/75N+2ELJ9I3b3//hPXbiMenm3pR/Jt4USgcLBIp4Bh10gqKVhvLo0klCxeSky96nKcj3siw6pJIL4XsoiQ7apyvMY/V3HHrSRioLopvEhSpTCn2TPEuwKYMOIX0tAxRBf/Hpa+lfSqBv9gi1FPsNfTrMAiVmIE/vJhz61FGnQxRIEYE4vfNYdN8Rp6MlHaHotHTn8ejekaZPAjEmyvQWdZFTtYTpXqCGJ0zvcek9Yfoel76nS0ffv1NMp1ca+pkgyfRCGind4L7OWWc605l+cxjsyhqy9AGbPpClc1/nvl5VX0c/3Alk6RU3+Am7shNZ+h6bvidLr7jBB+zKBrL0irOOudmIUDzTmf5gIP+iEuXtRuTVaEmY/oZLfyNMrzjryPc0gerMTdpVg0tvjJUU6bLPcGOoUv46SLL6Wi8yhLf06C7TUyekI0efRaaYqdFltkeNpPumRPSMDxgBYvSM035FrKAmH72hRW99PrpvSdEHkTEGUvSsK3yKVDkuJ92RohcZaehzzirPpOg+J92Tolfc4Cumx5xVXpGiZ34+ICX6W84qv5GiR5NPbiIpOv6BCoSvSkTX+eiaGP092zINvBOj4x8mSf9FqejvNo/cvpOji19ZbmviL0GPLsYMFzgzCor0+Bv/ePDvSJKOb9dJ5UlnbnEHiHgzv6cdTpJOWuc/u3FEucLDOL75xGtBiefrcwgoC9NDSH/jkH6pAuXmBqPQ9HSUPVdZBH1GGOrMXAQdYxcKZfxAoK+KKBKFLosoEoX+u4giUehz8jlcnAuhp78I46yDYNAd+QLR6K+pr+yvxdBTHyVDubQh0UfSxaHSd0lbvNkVRE87JGOtc+PQd2QLQ6fHhJkKsSh6yg13tO08JPprsgrrXWH0dJd2vH1MLPprot4eXoujpzrdhngiD40ek2y92lggPcnWa8qN1Yz0BFuvZhRl0uOfR0v4Ewuli/Bg4Qr3lArqGdndQ3UPO1EunXYwnelMZzrTmc50pjOd6UxnOtOZznSmM53pTGf6kuj6oedFKV0s3fX6sX1S3bsi6a4PD7+/YAqYeBw6pIB/4qEgOqxdSPbGiim4NRRCbzs3Jj0L4UfXtQXQVRfn5IdA/Bw7RZzurEV6EtdsLeGXkIPuA+K1UoVeA0l62zmN/LqfSSft9KkepmoRuvi3nd5uKNFB9zbbXEANqdr941XO0NJx2v2jdJenpf+/3bvn0ts16ph+sd6hX7dPo2+2cZzE02Ia43bzDHqr+2Evnhz74ZHU30ffbKOeng1/NPV30Ns1gYQnSP2P6e65Pfxc6h02XZqXQCjhJ6kPL6bFo4NrGvAU4UII4SE2P1vQuZkuOxckVfehisF1MjUddN/MZBN+kvq5uf0O/xa66gyNS9ktMWlz44rO1Z8C19i5FPdHzPamXn+F3hryPfxMr78+4F+kq22kO6Rf6fUQt+puuustyWv4rbG3l/duztFB96GYoe1cTBdXMr+nw9qVM6ZfxOvzezff0nXi/ZOndvrR6Zvpm0c3h6nhdb+5iS7tsIim/qXZD9+97/Jf+rpZ5BET1ayv0GUzLhEuhBBjIy/RdVPgndutIRt9nt7p5cKFEEJ3Z+jQFDZL+XnMDXxHB73gxn5s9Kc3d3/pFciFkN/QTSXHJpX5l66gDrkQoP6hL3xsPw39la4qOiV8tH78XeSbue6N9mvWa6J/ybpc1CT1Wnh5Qq9meP8IOKH3ddH7E/ri1iYux/SXDrXR4UiPdck/wUpU+FtPf6/orja6O9KL3l56LOvVxe5Ib2qjN0d6Vbex4ghWlU3bPqI90If66MNng680FNpbJijH6kCvaF3uMzQ3+IrpFerV4Y9dffQdN3im10ivbuImhD3Qq5u4HdZkua8znelMZ/pS4z9CPVKkxowNxgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNy0wMy0yN1QxNTo0NToxNSswMDowMN1xSg4AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTctMDMtMjdUMTU6NDU6MTUrMDA6MDCsLPKyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAABJRU5ErkJggg==";
|
2783
|
-
var
|
2784
|
-
function
|
2785
|
-
_classCallCheck(this,
|
2848
|
+
var le = /*#__PURE__*/function () {
|
2849
|
+
function le() {
|
2850
|
+
_classCallCheck(this, le);
|
2786
2851
|
}
|
2787
|
-
_createClass(
|
2852
|
+
_createClass(le, null, [{
|
2788
2853
|
key: "applyCustomStylesToElements",
|
2789
2854
|
value: function applyCustomStylesToElements(e, t, i) {
|
2790
2855
|
Object.assign(e.style, i.container), Object.assign(t.style, i.avatar);
|
@@ -2793,10 +2858,10 @@ var ae = /*#__PURE__*/function () {
|
|
2793
2858
|
key: "applyCustomStyles",
|
2794
2859
|
value: function applyCustomStyles(e, t, i, n) {
|
2795
2860
|
var r, o, a, l;
|
2796
|
-
if ((r = i["default"]) != null && r.styles &&
|
2797
|
-
(a = i.ai) != null && a.styles &&
|
2861
|
+
if ((r = i["default"]) != null && r.styles && le.applyCustomStylesToElements(e, t, i["default"].styles), n === v.USER_ROLE) (o = i.user) != null && o.styles && le.applyCustomStylesToElements(e, t, i.user.styles);else {
|
2862
|
+
(a = i.ai) != null && a.styles && le.applyCustomStylesToElements(e, t, i.ai.styles);
|
2798
2863
|
var c = (l = i[n]) == null ? void 0 : l.styles;
|
2799
|
-
c &&
|
2864
|
+
c && le.applyCustomStylesToElements(e, t, c);
|
2800
2865
|
}
|
2801
2866
|
}
|
2802
2867
|
}, {
|
@@ -2806,7 +2871,7 @@ var ae = /*#__PURE__*/function () {
|
|
2806
2871
|
var i = document.createElement("img");
|
2807
2872
|
e === v.USER_ROLE ? i.src = ((r = t == null ? void 0 : t.user) == null ? void 0 : r.src) || ((o = t == null ? void 0 : t["default"]) == null ? void 0 : o.src) || eo : i.src = ((a = t == null ? void 0 : t[e]) == null ? void 0 : a.src) || ((l = t == null ? void 0 : t.ai) == null ? void 0 : l.src) || ((c = t == null ? void 0 : t["default"]) == null ? void 0 : c.src) || Qr, i.classList.add("avatar");
|
2808
2873
|
var n = document.createElement("div");
|
2809
|
-
return n.classList.add("avatar-container"), n.appendChild(i), t &&
|
2874
|
+
return n.classList.add("avatar-container"), n.appendChild(i), t && le.applyCustomStyles(n, i, t, e), n;
|
2810
2875
|
}
|
2811
2876
|
}, {
|
2812
2877
|
key: "getPosition",
|
@@ -2820,12 +2885,12 @@ var ae = /*#__PURE__*/function () {
|
|
2820
2885
|
key: "add",
|
2821
2886
|
value: function add(e, t, i) {
|
2822
2887
|
var n = typeof i == "boolean" ? void 0 : i,
|
2823
|
-
r =
|
2824
|
-
o =
|
2888
|
+
r = le.createAvatar(t, n),
|
2889
|
+
o = le.getPosition(t, n);
|
2825
2890
|
r.classList.add(o === "left" ? "left-item-position" : "right-item-position"), e.insertAdjacentElement(o === "left" ? "beforebegin" : "afterend", r);
|
2826
2891
|
}
|
2827
2892
|
}]);
|
2828
|
-
return
|
2893
|
+
return le;
|
2829
2894
|
}();
|
2830
2895
|
var He = /*#__PURE__*/function () {
|
2831
2896
|
function He() {
|
@@ -2904,7 +2969,7 @@ var Ve = /*#__PURE__*/function () {
|
|
2904
2969
|
var _this4 = this;
|
2905
2970
|
var i = this.createNewMessageElement(e, t);
|
2906
2971
|
return this.elementRef.appendChild(i.outerContainer), setTimeout(function () {
|
2907
|
-
return
|
2972
|
+
return ne.scrollToBottom(_this4.elementRef);
|
2908
2973
|
}), i;
|
2909
2974
|
}
|
2910
2975
|
}, {
|
@@ -2929,7 +2994,7 @@ var Ve = /*#__PURE__*/function () {
|
|
2929
2994
|
value:
|
2930
2995
|
// prettier-ignore
|
2931
2996
|
function addInnerContainerElements(e, t, i) {
|
2932
|
-
return e.classList.add("message-bubble", v.getRoleClass(i), i === v.USER_ROLE ? "user-message-text" : "ai-message-text"), this.renderText(e, t), this._avatars &&
|
2997
|
+
return e.classList.add("message-bubble", v.getRoleClass(i), i === v.USER_ROLE ? "user-message-text" : "ai-message-text"), this.renderText(e, t), this._avatars && le.add(e, i, this._avatars), this._names && He.add(e, i, this._names), {
|
2933
2998
|
bubbleElement: e
|
2934
2999
|
};
|
2935
3000
|
}
|
@@ -2944,7 +3009,7 @@ var Ve = /*#__PURE__*/function () {
|
|
2944
3009
|
value: function sendClientUpdate(e) {
|
2945
3010
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
2946
3011
|
var i;
|
2947
|
-
(i = this._onNewMessage) == null || i.call(this,
|
3012
|
+
(i = this._onNewMessage) == null || i.call(this, e, t);
|
2948
3013
|
}
|
2949
3014
|
}, {
|
2950
3015
|
key: "renderText",
|
@@ -3013,13 +3078,13 @@ var Hi = /*#__PURE__*/function () {
|
|
3013
3078
|
if (this._hasStreamEnded) return;
|
3014
3079
|
if ((e == null ? void 0 : e.text) === void 0 && (e == null ? void 0 : e.html) === void 0) return console.error(I.INVALID_STREAM_RESPONSE);
|
3015
3080
|
var t = (e == null ? void 0 : e.text) || (e == null ? void 0 : e.html) || "",
|
3016
|
-
i =
|
3081
|
+
i = ne.isScrollbarAtBottomOfElement(this._messages.elementRef),
|
3017
3082
|
n = (e == null ? void 0 : e.text) !== void 0 ? "text" : "html";
|
3018
3083
|
if (!this._elements && this._streamedContent === "") this.setInitialState(n, t, e == null ? void 0 : e.role);else {
|
3019
3084
|
if (this._streamType !== n) return console.error(I.INVALID_STREAM_MIX_RESPONSE);
|
3020
3085
|
this.updateBasedOnType(t, n, (r = this._elements) == null ? void 0 : r.bubbleElement, e == null ? void 0 : e.overwrite);
|
3021
3086
|
}
|
3022
|
-
i &&
|
3087
|
+
i && ne.scrollToBottom(this._messages.elementRef);
|
3023
3088
|
}
|
3024
3089
|
}, {
|
3025
3090
|
key: "setInitialState",
|
@@ -3053,7 +3118,7 @@ var Hi = /*#__PURE__*/function () {
|
|
3053
3118
|
var _this$_messages = this._messages,
|
3054
3119
|
e = _this$_messages.textElementsToText,
|
3055
3120
|
t = _this$_messages.elementRef;
|
3056
|
-
(i = v.getLastMessageBubbleElement(t)) != null && i.classList.contains(it.MESSAGE_CLASS) && (this._streamType === "text" ? (e[e.length - 1][1] = this._streamedContent, this._activeMessageContent && (this._activeMessageContent.text = this._streamedContent), this._messages.textToSpeech && Lt.speak(this._streamedContent, this._messages.textToSpeech)) : this._streamType === "html" && (this._streamedContent === it.HTML_CONTENT_PLACEHOLDER && (this._streamedContent = ((n = v.getLastMessageBubbleElement(this._messages.elementRef)) == null ? void 0 : n.innerHTML) || ""), this._elements &&
|
3121
|
+
(i = v.getLastMessageBubbleElement(t)) != null && i.classList.contains(it.MESSAGE_CLASS) && (this._streamType === "text" ? (e[e.length - 1][1] = this._streamedContent, this._activeMessageContent && (this._activeMessageContent.text = this._streamedContent), this._messages.textToSpeech && Lt.speak(this._streamedContent, this._messages.textToSpeech)) : this._streamType === "html" && (this._streamedContent === it.HTML_CONTENT_PLACEHOLDER && (this._streamedContent = ((n = v.getLastMessageBubbleElement(this._messages.elementRef)) == null ? void 0 : n.innerHTML) || ""), this._elements && se.apply(this._messages, this._elements.outerContainer), this._activeMessageContent && (this._activeMessageContent.html = this._streamedContent)), this._activeMessageContent && this._messages.sendClientUpdate(Ve.createMessageContent(this._activeMessageContent), !1), this._hasStreamEnded = !0);
|
3057
3122
|
}
|
3058
3123
|
}]);
|
3059
3124
|
return it;
|
@@ -3061,7 +3126,7 @@ var Hi = /*#__PURE__*/function () {
|
|
3061
3126
|
Hi.MESSAGE_CLASS = "streamed-message";
|
3062
3127
|
Hi.HTML_CONTENT_PLACEHOLDER = "htmlplaceholder";
|
3063
3128
|
var Ye = Hi;
|
3064
|
-
var
|
3129
|
+
var Zn = /*#__PURE__*/function () {
|
3065
3130
|
function nt() {
|
3066
3131
|
_classCallCheck(this, nt);
|
3067
3132
|
}
|
@@ -3184,8 +3249,8 @@ var $n = /*#__PURE__*/function () {
|
|
3184
3249
|
}]);
|
3185
3250
|
return nt;
|
3186
3251
|
}();
|
3187
|
-
|
3188
|
-
var _ =
|
3252
|
+
Zn.CONTENT_TYPE = "Content-Type";
|
3253
|
+
var _ = Zn;
|
3189
3254
|
function to(_x10, _x11) {
|
3190
3255
|
return _to.apply(this, arguments);
|
3191
3256
|
}
|
@@ -3324,7 +3389,7 @@ function ao(s, e) {
|
|
3324
3389
|
}
|
3325
3390
|
function _Q() {
|
3326
3391
|
_Q = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
3327
|
-
var ee,
|
3392
|
+
var ee, he, q;
|
3328
3393
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
3329
3394
|
while (1) switch (_context3.prev = _context3.next) {
|
3330
3395
|
case 0:
|
@@ -3336,12 +3401,12 @@ function ao(s, e) {
|
|
3336
3401
|
signal: g.signal
|
3337
3402
|
}));
|
3338
3403
|
case 4:
|
3339
|
-
|
3404
|
+
he = _context3.sent;
|
3340
3405
|
_context3.next = 7;
|
3341
|
-
return V(
|
3406
|
+
return V(he);
|
3342
3407
|
case 7:
|
3343
3408
|
_context3.next = 9;
|
3344
|
-
return to(
|
3409
|
+
return to(he.body, io(no(function (q) {
|
3345
3410
|
q ? h[fn] = q : delete h[fn];
|
3346
3411
|
}, function (q) {
|
3347
3412
|
E = q;
|
@@ -3376,7 +3441,7 @@ function lo(s) {
|
|
3376
3441
|
var e = s.headers.get("content-type");
|
3377
3442
|
if (!(e != null && e.startsWith(Ri))) throw new Error("Expected content-type to be ".concat(Ri, ", Actual: ").concat(e));
|
3378
3443
|
}
|
3379
|
-
var
|
3444
|
+
var Xn = /*#__PURE__*/function () {
|
3380
3445
|
function st() {
|
3381
3446
|
_classCallCheck(this, st);
|
3382
3447
|
}
|
@@ -3448,8 +3513,8 @@ var Zn = /*#__PURE__*/function () {
|
|
3448
3513
|
}]);
|
3449
3514
|
return st;
|
3450
3515
|
}();
|
3451
|
-
|
3452
|
-
var be =
|
3516
|
+
Xn.URL = "deep-chat-demo";
|
3517
|
+
var be = Xn;
|
3453
3518
|
var T = /*#__PURE__*/function () {
|
3454
3519
|
function T() {
|
3455
3520
|
_classCallCheck(this, T);
|
@@ -4712,7 +4777,7 @@ var U = /*#__PURE__*/function () {
|
|
4712
4777
|
}]);
|
4713
4778
|
return U;
|
4714
4779
|
}();
|
4715
|
-
var
|
4780
|
+
var Qn = /*#__PURE__*/function () {
|
4716
4781
|
function Ue() {
|
4717
4782
|
_classCallCheck(this, Ue);
|
4718
4783
|
}
|
@@ -4743,8 +4808,8 @@ var Xn = /*#__PURE__*/function () {
|
|
4743
4808
|
}]);
|
4744
4809
|
return Ue;
|
4745
4810
|
}();
|
4746
|
-
|
4747
|
-
var po =
|
4811
|
+
Qn.VISIBLE_ICON_ID = "visible-icon";
|
4812
|
+
var po = Qn;
|
4748
4813
|
var N = /*#__PURE__*/function () {
|
4749
4814
|
function N() {
|
4750
4815
|
_classCallCheck(this, N);
|
@@ -4905,7 +4970,7 @@ var Pt = /*#__PURE__*/function () {
|
|
4905
4970
|
}]);
|
4906
4971
|
return Pt;
|
4907
4972
|
}();
|
4908
|
-
var
|
4973
|
+
var es = /*#__PURE__*/function (_z) {
|
4909
4974
|
_inherits(Oi, _z);
|
4910
4975
|
var _super3 = _createSuper(Oi);
|
4911
4976
|
// prettier-ignore
|
@@ -4956,8 +5021,8 @@ var Qn = /*#__PURE__*/function (_z) {
|
|
4956
5021
|
}]);
|
4957
5022
|
return Oi;
|
4958
5023
|
}(z);
|
4959
|
-
|
4960
|
-
var Ne =
|
5024
|
+
es.URL_PREFIX = "https://api-inference.huggingface.co/models/";
|
5025
|
+
var Ne = es;
|
4961
5026
|
var bt = /*#__PURE__*/function (_Ne) {
|
4962
5027
|
_inherits(bt, _Ne);
|
4963
5028
|
var _super4 = _createSuper(bt);
|
@@ -5117,11 +5182,11 @@ var mo = /*#__PURE__*/function (_bt2) {
|
|
5117
5182
|
return mo;
|
5118
5183
|
}(bt);
|
5119
5184
|
var vt = "data:image/png;base64,";
|
5120
|
-
var
|
5121
|
-
function
|
5122
|
-
_classCallCheck(this,
|
5185
|
+
var re = /*#__PURE__*/function () {
|
5186
|
+
function re() {
|
5187
|
+
_classCallCheck(this, re);
|
5123
5188
|
}
|
5124
|
-
_createClass(
|
5189
|
+
_createClass(re, null, [{
|
5125
5190
|
key: "buildHeaders",
|
5126
5191
|
value: function buildHeaders(e) {
|
5127
5192
|
return {
|
@@ -5141,11 +5206,11 @@ var se = /*#__PURE__*/function () {
|
|
5141
5206
|
return {
|
5142
5207
|
url: "https://api.stability.ai/v1/engines/list",
|
5143
5208
|
method: "GET",
|
5144
|
-
handleVerificationResult:
|
5209
|
+
handleVerificationResult: re.handleVerificationResult
|
5145
5210
|
};
|
5146
5211
|
}
|
5147
5212
|
}]);
|
5148
|
-
return
|
5213
|
+
return re;
|
5149
5214
|
}();
|
5150
5215
|
var Qt = /*#__PURE__*/function (_z2) {
|
5151
5216
|
_inherits(Qt, _z2);
|
@@ -5176,7 +5241,7 @@ var Dt = /*#__PURE__*/function (_Qt) {
|
|
5176
5241
|
}
|
5177
5242
|
}
|
5178
5243
|
};
|
5179
|
-
_this11 = _super8.call(this, e,
|
5244
|
+
_this11 = _super8.call(this, e, re.buildKeyVerificationDetails(), re.buildHeaders, i, n), _this11.url = "https://api.stability.ai/v1/generation/esrgan-v1-x2plus/image-to-image/upscale", _this11.textInputPlaceholderText = "Describe image changes", _this11.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI</b></div>\n <div style=\"width: 100%; text-align: center; margin-left: -10px; margin-top: 5px\"><b>Image to Image Upscale</b></div>\n <p>Upload an image to generate a new one with higher resolution.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
5180
5245
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageUpscale;
|
5181
5246
|
_typeof(r) == "object" && (r.engine_id && (_this11.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/upscale")), Dt.cleanConfig(r), Object.assign(_this11.rawBody, r)), _this11.canSendMessage = Dt.canSendFileMessage;
|
5182
5247
|
return _this11;
|
@@ -5285,7 +5350,7 @@ var jt = /*#__PURE__*/function (_Qt2) {
|
|
5285
5350
|
}
|
5286
5351
|
}
|
5287
5352
|
};
|
5288
|
-
_this12 = _super9.call(this, e,
|
5353
|
+
_this12 = _super9.call(this, e, re.buildKeyVerificationDetails(), re.buildHeaders, i, n), _this12.url = "https://api.stability.ai/v1/generation/stable-diffusion-xl-1024-v1-0/image-to-image/masking", _this12._maskSource = "MASK_IMAGE_WHITE", _this12.textInputPlaceholderText = "Describe image changes", _this12.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI</b></div>\n <div style=\"width: 100%; text-align: center; margin-left: -10px; margin-top: 5px\"><b>Image to Image Masking</b></div>\n <p>Upload an image, its mask image to create a new one based on the changes you have described for the mask area.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
5289
5354
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageMasking;
|
5290
5355
|
_typeof(r) == "object" && (r.engine_id && (_this12.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/masking")), r.weight !== void 0 && r.weight !== null && (_this12._imageWeight = r.weight), r.mask_source !== void 0 && r.mask_source !== null && (_this12._maskSource = r.mask_source), jt.cleanConfig(r), Object.assign(_this12.rawBody, r)), _this12.canSendMessage = jt.canSendFileTextMessage;
|
5291
5356
|
return _this12;
|
@@ -5647,12 +5712,12 @@ var xo = /*#__PURE__*/function (_Ne5) {
|
|
5647
5712
|
}]);
|
5648
5713
|
return xo;
|
5649
5714
|
}(Ne);
|
5650
|
-
var
|
5651
|
-
_inherits(
|
5652
|
-
var _super15 = _createSuper(
|
5653
|
-
function
|
5715
|
+
var Ft = /*#__PURE__*/function (_Qt3) {
|
5716
|
+
_inherits(Ft, _Qt3);
|
5717
|
+
var _super15 = _createSuper(Ft);
|
5718
|
+
function Ft(e) {
|
5654
5719
|
var _this15;
|
5655
|
-
_classCallCheck(this,
|
5720
|
+
_classCallCheck(this, Ft);
|
5656
5721
|
var o;
|
5657
5722
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
5658
5723
|
i = t.stabilityAI,
|
@@ -5664,12 +5729,12 @@ var Bt = /*#__PURE__*/function (_Qt3) {
|
|
5664
5729
|
}
|
5665
5730
|
}
|
5666
5731
|
};
|
5667
|
-
_this15 = _super15.call(this, e,
|
5732
|
+
_this15 = _super15.call(this, e, re.buildKeyVerificationDetails(), re.buildHeaders, i, n), _this15.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/image-to-image", _this15.textInputPlaceholderText = "Describe image changes", _this15.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI: Image to Image</b></div>\n <p>Upload an image to create a new one with the changes you have described.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
5668
5733
|
var r = (o = t.stabilityAI) == null ? void 0 : o.imageToImage;
|
5669
|
-
_typeof(r) == "object" && (r.engine_id && (_this15.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/text-to-image")), r.weight !== void 0 && r.weight !== null && (_this15._imageWeight = r.weight),
|
5734
|
+
_typeof(r) == "object" && (r.engine_id && (_this15.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/text-to-image")), r.weight !== void 0 && r.weight !== null && (_this15._imageWeight = r.weight), Ft.cleanConfig(r), Object.assign(_this15.rawBody, r)), _this15.canSendMessage = Ft.canSendFileTextMessage;
|
5670
5735
|
return _this15;
|
5671
5736
|
}
|
5672
|
-
_createClass(
|
5737
|
+
_createClass(Ft, [{
|
5673
5738
|
key: "createFormDataBody",
|
5674
5739
|
value: function createFormDataBody(e, t, i) {
|
5675
5740
|
var n = new FormData();
|
@@ -5754,7 +5819,7 @@ var Bt = /*#__PURE__*/function (_Qt3) {
|
|
5754
5819
|
return !!(t != null && t[0]) && !!(e && e.trim() !== "");
|
5755
5820
|
}
|
5756
5821
|
}]);
|
5757
|
-
return
|
5822
|
+
return Ft;
|
5758
5823
|
}(Qt);
|
5759
5824
|
var Eo = /*#__PURE__*/function (_Ne6) {
|
5760
5825
|
_inherits(Eo, _Ne6);
|
@@ -5796,21 +5861,21 @@ var Eo = /*#__PURE__*/function (_Ne6) {
|
|
5796
5861
|
}]);
|
5797
5862
|
return Eo;
|
5798
5863
|
}(Ne);
|
5799
|
-
var
|
5800
|
-
_inherits(
|
5801
|
-
var _super17 = _createSuper(
|
5802
|
-
function
|
5864
|
+
var Bt = /*#__PURE__*/function (_Qt4) {
|
5865
|
+
_inherits(Bt, _Qt4);
|
5866
|
+
var _super17 = _createSuper(Bt);
|
5867
|
+
function Bt(e) {
|
5803
5868
|
var _this16;
|
5804
|
-
_classCallCheck(this,
|
5869
|
+
_classCallCheck(this, Bt);
|
5805
5870
|
var r;
|
5806
5871
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
5807
5872
|
i = t.stabilityAI;
|
5808
|
-
_this16 = _super17.call(this, e,
|
5873
|
+
_this16 = _super17.call(this, e, re.buildKeyVerificationDetails(), re.buildHeaders, i), _this16.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/text-to-image", _this16.textInputPlaceholderText = "Describe an image", _this16.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI: Text to Image</b></div>\n <p>Insert text to generate an image.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
5809
5874
|
var n = (r = t.stabilityAI) == null ? void 0 : r.textToImage;
|
5810
|
-
_typeof(n) == "object" && (n.engine_id && (_this16.url = "https://api.stability.ai/v1/generation/".concat(n.engine_id, "/text-to-image")), n.weight !== void 0 && n.weight !== null && (_this16._imageWeight = n.weight),
|
5875
|
+
_typeof(n) == "object" && (n.engine_id && (_this16.url = "https://api.stability.ai/v1/generation/".concat(n.engine_id, "/text-to-image")), n.weight !== void 0 && n.weight !== null && (_this16._imageWeight = n.weight), Bt.cleanConfig(n), Object.assign(_this16.rawBody, n)), _this16.canSendMessage = Bt.canSendTextMessage;
|
5811
5876
|
return _this16;
|
5812
5877
|
}
|
5813
|
-
_createClass(
|
5878
|
+
_createClass(Bt, [{
|
5814
5879
|
key: "preprocessBody",
|
5815
5880
|
value: function preprocessBody(e, t) {
|
5816
5881
|
var i = JSON.parse(JSON.stringify(e)),
|
@@ -5889,7 +5954,7 @@ var Ft = /*#__PURE__*/function (_Qt4) {
|
|
5889
5954
|
return !!(e && e.trim() !== "");
|
5890
5955
|
}
|
5891
5956
|
}]);
|
5892
|
-
return
|
5957
|
+
return Bt;
|
5893
5958
|
}(Qt);
|
5894
5959
|
var So = /*#__PURE__*/function (_Ne7) {
|
5895
5960
|
_inherits(So, _Ne7);
|
@@ -6940,35 +7005,35 @@ var Ki = /*#__PURE__*/function (_z7) {
|
|
6940
7005
|
}]);
|
6941
7006
|
return Ki;
|
6942
7007
|
}(z);
|
6943
|
-
var
|
6944
|
-
_inherits(
|
6945
|
-
var _super27 = _createSuper(
|
7008
|
+
var ts = /*#__PURE__*/function (_z8) {
|
7009
|
+
_inherits(ts, _z8);
|
7010
|
+
var _super27 = _createSuper(ts);
|
6946
7011
|
// prettier-ignore
|
6947
|
-
function
|
7012
|
+
function ts(e, t, i, n, r) {
|
6948
7013
|
var _this24;
|
6949
|
-
_classCallCheck(this,
|
7014
|
+
_classCallCheck(this, ts);
|
6950
7015
|
_this24 = _super27.call(this, e, $.buildSpeechKeyVerificationDetails(i), t, n, r), _this24.insertKeyPlaceholderText = "Azure Speech Subscription Key", _this24.getKeyLink =
|
6951
7016
|
// eslint-disable-next-line max-len
|
6952
7017
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal";
|
6953
7018
|
return _this24;
|
6954
7019
|
}
|
6955
|
-
return _createClass(
|
7020
|
+
return _createClass(ts);
|
6956
7021
|
}(z);
|
6957
|
-
var
|
6958
|
-
_inherits(
|
6959
|
-
var _super28 = _createSuper(
|
7022
|
+
var is = /*#__PURE__*/function (_ts) {
|
7023
|
+
_inherits(ns, _ts);
|
7024
|
+
var _super28 = _createSuper(ns);
|
6960
7025
|
// prettier-ignore
|
6961
|
-
function
|
7026
|
+
function ns(e) {
|
6962
7027
|
var _a$lang, _l$name, _c$gender;
|
6963
7028
|
var _this25;
|
6964
|
-
_classCallCheck(this,
|
7029
|
+
_classCallCheck(this, ns);
|
6965
7030
|
var n, r, o, a, l, c;
|
6966
7031
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.azure) == null ? void 0 : r.textToSpeech,
|
6967
7032
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
6968
|
-
_this25 = _super28.call(this, e, $.buildTextToSpeechHeaders.bind({}, (t == null ? void 0 : t.outputFormat) || "audio-16khz-128kbitrate-mono-mp3"), t.region, i), _this25.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Text To Speech</b></div>\n <p>Insert text to synthesize it to audio.\n <p>\n Click <a href=\"".concat(
|
7033
|
+
_this25 = _super28.call(this, e, $.buildTextToSpeechHeaders.bind({}, (t == null ? void 0 : t.outputFormat) || "audio-16khz-128kbitrate-mono-mp3"), t.region, i), _this25.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Text To Speech</b></div>\n <p>Insert text to synthesize it to audio.\n <p>\n Click <a href=\"".concat(ns.HELP_LINK, "\">here</a> for more info.\n </p>"), _this25.url = "", Object.assign(_this25.rawBody, t), (_a$lang = (a = _this25.rawBody).lang) !== null && _a$lang !== void 0 ? _a$lang : a.lang = "en-US", (_l$name = (l = _this25.rawBody).name) !== null && _l$name !== void 0 ? _l$name : l.name = "en-US-JennyNeural", (_c$gender = (c = _this25.rawBody).gender) !== null && _c$gender !== void 0 ? _c$gender : c.gender = "Female", _this25.url = "https://".concat(t.region, ".tts.speech.microsoft.com/cognitiveservices/v1");
|
6969
7034
|
return _this25;
|
6970
7035
|
}
|
6971
|
-
_createClass(
|
7036
|
+
_createClass(ns, [{
|
6972
7037
|
key: "preprocessBody",
|
6973
7038
|
value: function preprocessBody(e, t) {
|
6974
7039
|
var i = t[t.length - 1].text;
|
@@ -7031,14 +7096,14 @@ var ts = /*#__PURE__*/function (_es) {
|
|
7031
7096
|
return extractResultData;
|
7032
7097
|
}()
|
7033
7098
|
}]);
|
7034
|
-
return
|
7035
|
-
}(
|
7036
|
-
|
7099
|
+
return ns;
|
7100
|
+
}(ts);
|
7101
|
+
is.HELP_LINK =
|
7037
7102
|
// eslint-disable-next-line max-len
|
7038
7103
|
"https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest";
|
7039
|
-
var ko =
|
7040
|
-
var
|
7041
|
-
_inherits(Pi,
|
7104
|
+
var ko = is;
|
7105
|
+
var ss = /*#__PURE__*/function (_ts2) {
|
7106
|
+
_inherits(Pi, _ts2);
|
7042
7107
|
var _super29 = _createSuper(Pi);
|
7043
7108
|
function Pi(e) {
|
7044
7109
|
var _this26;
|
@@ -7124,11 +7189,11 @@ var ns = /*#__PURE__*/function (_es2) {
|
|
7124
7189
|
}
|
7125
7190
|
}]);
|
7126
7191
|
return Pi;
|
7127
|
-
}(
|
7128
|
-
|
7192
|
+
}(ts);
|
7193
|
+
ss.HELP_LINK =
|
7129
7194
|
// eslint-disable-next-line max-len
|
7130
7195
|
"https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest";
|
7131
|
-
var Io =
|
7196
|
+
var Io = ss;
|
7132
7197
|
var Lo = /*#__PURE__*/function (_z9) {
|
7133
7198
|
_inherits(Lo, _z9);
|
7134
7199
|
var _super30 = _createSuper(Lo);
|
@@ -7211,12 +7276,12 @@ var Lo = /*#__PURE__*/function (_z9) {
|
|
7211
7276
|
return Lo;
|
7212
7277
|
}(z);
|
7213
7278
|
var Ji = /*#__PURE__*/function (_z10) {
|
7214
|
-
_inherits(
|
7215
|
-
var _super31 = _createSuper(
|
7216
|
-
function
|
7279
|
+
_inherits(oe, _z10);
|
7280
|
+
var _super31 = _createSuper(oe);
|
7281
|
+
function oe(e) {
|
7217
7282
|
var _l$headers, _c$OpenAIBeta;
|
7218
7283
|
var _this28;
|
7219
|
-
_classCallCheck(this,
|
7284
|
+
_classCallCheck(this, oe);
|
7220
7285
|
var r, o, a, l, c;
|
7221
7286
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
7222
7287
|
i = t.openAI;
|
@@ -7231,7 +7296,7 @@ var Ji = /*#__PURE__*/function (_z10) {
|
|
7231
7296
|
(_l$headers = (l = _this28.requestSettings).headers) !== null && _l$headers !== void 0 ? _l$headers : l.headers = {}, (_c$OpenAIBeta = (c = _this28.requestSettings.headers)["OpenAI-Beta"]) !== null && _c$OpenAIBeta !== void 0 ? _c$OpenAIBeta : c["OpenAI-Beta"] = "assistants=v1", _this28.maxMessages = 1;
|
7232
7297
|
return _this28;
|
7233
7298
|
}
|
7234
|
-
_createClass(
|
7299
|
+
_createClass(oe, [{
|
7235
7300
|
key: "processMessages",
|
7236
7301
|
value: function processMessages(e, t) {
|
7237
7302
|
var i = this.totalMessagesMaxCharLength || -1;
|
@@ -7256,11 +7321,11 @@ var Ji = /*#__PURE__*/function (_z10) {
|
|
7256
7321
|
key: "callService",
|
7257
7322
|
value: function callService(e, t, i) {
|
7258
7323
|
if (this.sessionId) {
|
7259
|
-
this.url = "".concat(
|
7324
|
+
this.url = "".concat(oe.THREAD_PREFIX, "/").concat(this.sessionId, "/messages");
|
7260
7325
|
var n = this.processMessages(t, i)[0];
|
7261
7326
|
w.request(this, n, e);
|
7262
7327
|
} else {
|
7263
|
-
this.url = "".concat(
|
7328
|
+
this.url = "".concat(oe.THREAD_PREFIX, "/runs");
|
7264
7329
|
var _n2 = this.createNewThreadMessages(this.rawBody, t, i);
|
7265
7330
|
w.request(this, _n2, e);
|
7266
7331
|
}
|
@@ -7332,7 +7397,7 @@ var Ji = /*#__PURE__*/function (_z10) {
|
|
7332
7397
|
_context65.next = 4;
|
7333
7398
|
return this.assignThreadAndRun(e);
|
7334
7399
|
case 4:
|
7335
|
-
t = "".concat(
|
7400
|
+
t = "".concat(oe.THREAD_PREFIX, "/").concat(this.sessionId, "/runs/").concat(this.run_id), i = {
|
7336
7401
|
method: "GET",
|
7337
7402
|
headers: (n = this.requestSettings) == null ? void 0 : n.headers
|
7338
7403
|
};
|
@@ -7362,7 +7427,7 @@ var Ji = /*#__PURE__*/function (_z10) {
|
|
7362
7427
|
_context66.next = 8;
|
7363
7428
|
break;
|
7364
7429
|
}
|
7365
|
-
this.url = "".concat(
|
7430
|
+
this.url = "".concat(oe.THREAD_PREFIX, "/").concat(this.sessionId, "/runs");
|
7366
7431
|
_context66.next = 4;
|
7367
7432
|
return O.directFetch(this, JSON.parse(JSON.stringify(this.rawBody)), "POST");
|
7368
7433
|
case 4:
|
@@ -7397,14 +7462,14 @@ var Ji = /*#__PURE__*/function (_z10) {
|
|
7397
7462
|
break;
|
7398
7463
|
}
|
7399
7464
|
return _context67.abrupt("return", {
|
7400
|
-
timeoutMS:
|
7465
|
+
timeoutMS: oe.POLLING_TIMEOUT_MS
|
7401
7466
|
});
|
7402
7467
|
case 3:
|
7403
7468
|
if (!(t === "completed" && this.messages)) {
|
7404
7469
|
_context67.next = 10;
|
7405
7470
|
break;
|
7406
7471
|
}
|
7407
|
-
this.url = "".concat(
|
7472
|
+
this.url = "".concat(oe.THREAD_PREFIX, "/").concat(e.thread_id, "/messages");
|
7408
7473
|
_context67.next = 7;
|
7409
7474
|
return O.directFetch(this, {}, "GET");
|
7410
7475
|
case 7:
|
@@ -7475,14 +7540,14 @@ var Ji = /*#__PURE__*/function (_z10) {
|
|
7475
7540
|
output: r
|
7476
7541
|
};
|
7477
7542
|
});
|
7478
|
-
this.url = "".concat(
|
7543
|
+
this.url = "".concat(oe.THREAD_PREFIX, "/").concat(this.sessionId, "/runs/").concat(this.run_id, "/submit_tool_outputs");
|
7479
7544
|
_context68.next = 12;
|
7480
7545
|
return O.directFetch(this, {
|
7481
7546
|
tool_outputs: n
|
7482
7547
|
}, "POST");
|
7483
7548
|
case 12:
|
7484
7549
|
return _context68.abrupt("return", {
|
7485
|
-
timeoutMS:
|
7550
|
+
timeoutMS: oe.POLLING_TIMEOUT_MS
|
7486
7551
|
});
|
7487
7552
|
case 13:
|
7488
7553
|
case "end":
|
@@ -7496,7 +7561,7 @@ var Ji = /*#__PURE__*/function (_z10) {
|
|
7496
7561
|
return handleTools;
|
7497
7562
|
}()
|
7498
7563
|
}]);
|
7499
|
-
return
|
7564
|
+
return oe;
|
7500
7565
|
}(z);
|
7501
7566
|
Ji.THREAD_PREFIX = "https://api.openai.com/v1/threads";
|
7502
7567
|
Ji.POLLING_TIMEOUT_MS = 800;
|
@@ -7952,13 +8017,13 @@ var No = /*#__PURE__*/function (_Vi3) {
|
|
7952
8017
|
}(Vi);
|
7953
8018
|
var mn = {
|
7954
8019
|
model_list: [{
|
7955
|
-
model_url: "
|
8020
|
+
model_url: "https://huggingface.co/mlc-ai/mlc-chat-Llama-2-7b-chat-hf-q4f32_1/resolve/main/",
|
7956
8021
|
local_id: "Llama-2-7b-chat-hf-q4f32_1"
|
7957
8022
|
}, {
|
7958
8023
|
model_url: "https://huggingface.co/mlc-ai/mlc-chat-Llama-2-13b-chat-hf-q4f32_1/resolve/main/",
|
7959
8024
|
local_id: "Llama-2-13b-chat-hf-q4f32_1"
|
7960
8025
|
}, {
|
7961
|
-
model_url: "
|
8026
|
+
model_url: "https://huggingface.co/mlc-ai/mlc-chat-Llama-2-7b-chat-hf-q4f16_1/resolve/main/",
|
7962
8027
|
local_id: "Llama-2-7b-chat-hf-q4f16_1",
|
7963
8028
|
required_features: ["shader-f16"]
|
7964
8029
|
}, {
|
@@ -8205,32 +8270,30 @@ var mn = {
|
|
8205
8270
|
A.chat.setInitProgressCallback(t);
|
8206
8271
|
_context78.prev = 3;
|
8207
8272
|
_this$getConfig = this.getConfig(), n = _this$getConfig.model, r = _this$getConfig.pConfig;
|
8208
|
-
|
8209
|
-
console.log(r);
|
8210
|
-
_context78.next = 9;
|
8273
|
+
_context78.next = 7;
|
8211
8274
|
return A.chat.reload(n, {
|
8212
8275
|
conv_config: {
|
8213
8276
|
system: "keep responses to one sentence"
|
8214
8277
|
}
|
8215
8278
|
}, r);
|
8216
|
-
case
|
8217
|
-
_context78.next =
|
8279
|
+
case 7:
|
8280
|
+
_context78.next = 12;
|
8218
8281
|
break;
|
8219
|
-
case
|
8220
|
-
_context78.prev =
|
8282
|
+
case 9:
|
8283
|
+
_context78.prev = 9;
|
8221
8284
|
_context78.t0 = _context78["catch"](3);
|
8222
8285
|
return _context78.abrupt("return", this.unloadChat(_context78.t0));
|
8223
|
-
case
|
8286
|
+
case 12:
|
8224
8287
|
(i = this.addMessage) == null || i.call(this, {
|
8225
8288
|
html: "<div>Model loaded</div>",
|
8226
8289
|
overwrite: !0,
|
8227
8290
|
sendUpdate: !1
|
8228
8291
|
}), this._isModelLoaded = !0, this._isModelLoading = !1;
|
8229
|
-
case
|
8292
|
+
case 13:
|
8230
8293
|
case "end":
|
8231
8294
|
return _context78.stop();
|
8232
8295
|
}
|
8233
|
-
}, _callee78, this, [[3,
|
8296
|
+
}, _callee78, this, [[3, 9]]);
|
8234
8297
|
}));
|
8235
8298
|
function loadModel(_x138) {
|
8236
8299
|
return _loadModel.apply(this, arguments);
|
@@ -8369,7 +8432,6 @@ var mn = {
|
|
8369
8432
|
return _regeneratorRuntime().wrap(function _callee83$(_context83) {
|
8370
8433
|
while (1) switch (_context83.prev = _context83.next) {
|
8371
8434
|
case 0:
|
8372
|
-
console.trace();
|
8373
8435
|
(t = this.addMessage) == null || t.call(this, {
|
8374
8436
|
error: A.GENERIC_ERROR,
|
8375
8437
|
sendUpdate: !1
|
@@ -8379,14 +8441,14 @@ var mn = {
|
|
8379
8441
|
this._isModelLoading = !1;
|
8380
8442
|
_context83.t0 = A.chat;
|
8381
8443
|
if (!_context83.t0) {
|
8382
|
-
_context83.next =
|
8444
|
+
_context83.next = 9;
|
8383
8445
|
break;
|
8384
8446
|
}
|
8385
|
-
_context83.next =
|
8447
|
+
_context83.next = 8;
|
8386
8448
|
return A.chat.unload();
|
8387
|
-
case
|
8449
|
+
case 8:
|
8388
8450
|
A.chat = void 0;
|
8389
|
-
case
|
8451
|
+
case 9:
|
8390
8452
|
case "end":
|
8391
8453
|
return _context83.stop();
|
8392
8454
|
}
|
@@ -8434,14 +8496,14 @@ var Do = /*#__PURE__*/function () {
|
|
8434
8496
|
if (t.azure.summarization) return new Ao(e);
|
8435
8497
|
if (t.azure.translation) return new Lo(e);
|
8436
8498
|
}
|
8437
|
-
if (t.stabilityAI) return t.stabilityAI.imageToImage ? new
|
8499
|
+
if (t.stabilityAI) return t.stabilityAI.imageToImage ? new Ft(e) : t.stabilityAI.imageToImageUpscale ? new Dt(e) : t.stabilityAI.imageToImageMasking ? new jt(e) : new Bt(e);
|
8438
8500
|
}
|
8439
8501
|
return i ? new Ie(e) : new Ie(e, void 0, n || !0);
|
8440
8502
|
}
|
8441
8503
|
}]);
|
8442
8504
|
return Do;
|
8443
8505
|
}();
|
8444
|
-
var
|
8506
|
+
var rs = /*#__PURE__*/function () {
|
8445
8507
|
function Di() {
|
8446
8508
|
_classCallCheck(this, Di);
|
8447
8509
|
}
|
@@ -8459,12 +8521,12 @@ var ss = /*#__PURE__*/function () {
|
|
8459
8521
|
}]);
|
8460
8522
|
return Di;
|
8461
8523
|
}();
|
8462
|
-
|
8463
|
-
var jo =
|
8464
|
-
var
|
8465
|
-
_classCallCheck(this,
|
8524
|
+
rs.FONT_URL = "https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap";
|
8525
|
+
var jo = rs;
|
8526
|
+
var os = /*#__PURE__*/_createClass(function os() {
|
8527
|
+
_classCallCheck(this, os);
|
8466
8528
|
});
|
8467
|
-
|
8529
|
+
os.attibutes = {
|
8468
8530
|
string: function string(s) {
|
8469
8531
|
return s;
|
8470
8532
|
},
|
@@ -8489,7 +8551,7 @@ function y(s) {
|
|
8489
8551
|
Object.defineProperty(e, t, {});
|
8490
8552
|
var i = e.constructor,
|
8491
8553
|
n = t.toLocaleLowerCase();
|
8492
|
-
i._attributes_[n] =
|
8554
|
+
i._attributes_[n] = os.attibutes[s], i._attributeToProperty_[n] = t;
|
8493
8555
|
};
|
8494
8556
|
}
|
8495
8557
|
var Yi = /*#__PURE__*/function () {
|
@@ -8552,57 +8614,11 @@ var qt = /*#__PURE__*/function () {
|
|
8552
8614
|
}]);
|
8553
8615
|
return qt;
|
8554
8616
|
}();
|
8555
|
-
var
|
8556
|
-
function
|
8557
|
-
_classCallCheck(this,
|
8617
|
+
var Fo = /*#__PURE__*/function () {
|
8618
|
+
function Fo() {
|
8619
|
+
_classCallCheck(this, Fo);
|
8558
8620
|
}
|
8559
|
-
_createClass(
|
8560
|
-
key: "addMessage",
|
8561
|
-
value: function addMessage(e, t, i, n) {
|
8562
|
-
var r;
|
8563
|
-
e.elementRef.appendChild(t.outerContainer), e.applyCustomStyles(t, n, !0, (r = e.messageStyles) == null ? void 0 : r[i]), e.elementRef.scrollTop = e.elementRef.scrollHeight;
|
8564
|
-
}
|
8565
|
-
}, {
|
8566
|
-
key: "wrapInLink",
|
8567
|
-
value: function wrapInLink(e, t) {
|
8568
|
-
var i = document.createElement("a");
|
8569
|
-
return i.href = t, i.target = "_blank", i.appendChild(e), i;
|
8570
|
-
}
|
8571
|
-
}, {
|
8572
|
-
key: "processContent",
|
8573
|
-
value: function processContent(e, t) {
|
8574
|
-
return !t || t.startsWith("data") ? e : Rt.wrapInLink(e, t);
|
8575
|
-
}
|
8576
|
-
}, {
|
8577
|
-
key: "waitToLoadThenScroll",
|
8578
|
-
value: function waitToLoadThenScroll(e) {
|
8579
|
-
setTimeout(function () {
|
8580
|
-
e.scrollTop = e.scrollHeight;
|
8581
|
-
}, 60);
|
8582
|
-
}
|
8583
|
-
}, {
|
8584
|
-
key: "scrollDownOnImageLoad",
|
8585
|
-
value: function scrollDownOnImageLoad(e, t) {
|
8586
|
-
if (e.startsWith("data")) Rt.waitToLoadThenScroll(t);else try {
|
8587
|
-
fetch(e, {
|
8588
|
-
mode: "no-cors"
|
8589
|
-
})["catch"](function () {})["finally"](function () {
|
8590
|
-
Rt.waitToLoadThenScroll(t);
|
8591
|
-
});
|
8592
|
-
} catch (_unused5) {
|
8593
|
-
t.scrollTop = t.scrollHeight;
|
8594
|
-
}
|
8595
|
-
}
|
8596
|
-
}]);
|
8597
|
-
return Rt;
|
8598
|
-
}();
|
8599
|
-
os.DEFAULT_FILE_NAME = "file";
|
8600
|
-
var he = os;
|
8601
|
-
var Bo = /*#__PURE__*/function () {
|
8602
|
-
function Bo() {
|
8603
|
-
_classCallCheck(this, Bo);
|
8604
|
-
}
|
8605
|
-
_createClass(Bo, null, [{
|
8621
|
+
_createClass(Fo, null, [{
|
8606
8622
|
key: "getText",
|
8607
8623
|
value: function getText(e, t) {
|
8608
8624
|
var i, n;
|
@@ -8617,9 +8633,9 @@ var Bo = /*#__PURE__*/function () {
|
|
8617
8633
|
return null;
|
8618
8634
|
}
|
8619
8635
|
}]);
|
8620
|
-
return
|
8636
|
+
return Fo;
|
8621
8637
|
}();
|
8622
|
-
var
|
8638
|
+
var Bo = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" \n\t viewBox=\"50 30 420 450\" xml:space=\"preserve\">\n<g filter=\"brightness(0) saturate(100%) invert(16%) sepia(0%) saturate(1942%) hue-rotate(215deg) brightness(99%) contrast(93%)\">\n\t<g>\n\t\t<path d=\"M447.933,103.629c-0.034-3.076-1.224-6.09-3.485-8.352L352.683,3.511c-0.004-0.004-0.007-0.005-0.011-0.008\n\t\t\tC350.505,1.338,347.511,0,344.206,0H89.278C75.361,0,64.04,11.32,64.04,25.237v461.525c0,13.916,11.32,25.237,25.237,25.237\n\t\t\th333.444c13.916,0,25.237-11.32,25.237-25.237V103.753C447.96,103.709,447.937,103.672,447.933,103.629z M356.194,40.931\n\t\t\tl50.834,50.834h-49.572c-0.695,0-1.262-0.567-1.262-1.262V40.931z M423.983,486.763c0,0.695-0.566,1.261-1.261,1.261H89.278\n\t\t\tc-0.695,0-1.261-0.566-1.261-1.261V25.237c0-0.695,0.566-1.261,1.261-1.261h242.94v66.527c0,13.916,11.322,25.239,25.239,25.239\n\t\t\th66.527V486.763z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,164.014H149.912c-6.62,0-11.988,5.367-11.988,11.988c0,6.62,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.368,11.988-11.988C374.076,169.381,368.707,164.014,362.088,164.014z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,236.353H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.62,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.368,11.988-11.988C374.076,241.721,368.707,236.353,362.088,236.353z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,308.691H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.621,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.367,11.988-11.988C374.076,314.06,368.707,308.691,362.088,308.691z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M256,381.031H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.621,5.368,11.988,11.988,11.988H256\n\t\t\tc6.62,0,11.988-5.367,11.988-11.988C267.988,386.398,262.62,381.031,256,381.031z\"/>\n\t</g>\n</g>\n</svg>";
|
8623
8639
|
var pe = /*#__PURE__*/function () {
|
8624
8640
|
function pe() {
|
8625
8641
|
_classCallCheck(this, pe);
|
@@ -8628,7 +8644,7 @@ var pe = /*#__PURE__*/function () {
|
|
8628
8644
|
key: "createImage",
|
8629
8645
|
value: function createImage(e, t) {
|
8630
8646
|
var i = new Image();
|
8631
|
-
return i.src = e.src,
|
8647
|
+
return i.src = e.src, ie.scrollDownOnImageLoad(i.src, t), ie.processContent(i, i.src);
|
8632
8648
|
}
|
8633
8649
|
// WORK - should base64 images be clickable?
|
8634
8650
|
// WORK - image still does not scroll down when loaded
|
@@ -8641,7 +8657,7 @@ var pe = /*#__PURE__*/function () {
|
|
8641
8657
|
while (1) switch (_context84.prev = _context84.next) {
|
8642
8658
|
case 0:
|
8643
8659
|
n = pe.createImage(t, e.elementRef), r = e.createNewMessageElement("", i);
|
8644
|
-
r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("image-message"),
|
8660
|
+
r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("image-message"), ie.addMessage(e, r, "image", i);
|
8645
8661
|
case 2:
|
8646
8662
|
case "end":
|
8647
8663
|
return _context84.stop();
|
@@ -8664,7 +8680,7 @@ var pe = /*#__PURE__*/function () {
|
|
8664
8680
|
value: function addNewAudioMessage(e, t, i) {
|
8665
8681
|
var n = pe.createAudioElement(t, i),
|
8666
8682
|
r = e.createNewMessageElement("", i);
|
8667
|
-
r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("audio-message"),
|
8683
|
+
r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("audio-message"), ie.addMessage(e, r, "audio", i);
|
8668
8684
|
}
|
8669
8685
|
}, {
|
8670
8686
|
key: "createAnyFile",
|
@@ -8673,17 +8689,17 @@ var pe = /*#__PURE__*/function () {
|
|
8673
8689
|
t.classList.add("any-file-message-contents");
|
8674
8690
|
var i = document.createElement("div");
|
8675
8691
|
i.classList.add("any-file-message-icon-container");
|
8676
|
-
var n = U.createSVGElement(
|
8692
|
+
var n = U.createSVGElement(Bo);
|
8677
8693
|
n.classList.add("any-file-message-icon"), i.appendChild(n);
|
8678
8694
|
var r = document.createElement("div");
|
8679
|
-
return r.classList.add("any-file-message-text"), r.textContent = e.name ||
|
8695
|
+
return r.classList.add("any-file-message-text"), r.textContent = e.name || ie.DEFAULT_FILE_NAME, t.appendChild(i), t.appendChild(r), ie.processContent(t, e.src);
|
8680
8696
|
}
|
8681
8697
|
}, {
|
8682
8698
|
key: "addNewAnyFileMessage",
|
8683
8699
|
value: function addNewAnyFileMessage(e, t, i) {
|
8684
8700
|
var n = e.createNewMessageElement("", i),
|
8685
8701
|
r = pe.createAnyFile(t);
|
8686
|
-
n.bubbleElement.classList.add("any-file-message-bubble"), n.bubbleElement.appendChild(r),
|
8702
|
+
n.bubbleElement.classList.add("any-file-message-bubble"), n.bubbleElement.appendChild(r), ie.addMessage(e, n, "file", i);
|
8687
8703
|
}
|
8688
8704
|
// no overwrite previous message logic as it is complex to track which files are to be overwritten
|
8689
8705
|
}, {
|
@@ -8691,7 +8707,7 @@ var pe = /*#__PURE__*/function () {
|
|
8691
8707
|
value: function addMessages(e, t, i) {
|
8692
8708
|
t.forEach(function (n) {
|
8693
8709
|
var r, o;
|
8694
|
-
n.type === "audio" || (r = n.src) != null && r.startsWith("data:audio") ? pe.addNewAudioMessage(e, n, i) : n.type === "image" || (o = n.src) != null && o.startsWith("data:image") ? pe.addNewImageMessage(e, n, i) : pe.addNewAnyFileMessage(e, n, i);
|
8710
|
+
n.ref && (n = ie.removeFileRef(n)), n.type === "audio" || (r = n.src) != null && r.startsWith("data:audio") ? pe.addNewAudioMessage(e, n, i) : n.type === "image" || (o = n.src) != null && o.startsWith("data:image") ? pe.addNewImageMessage(e, n, i) : pe.addNewAnyFileMessage(e, n, i);
|
8695
8711
|
});
|
8696
8712
|
}
|
8697
8713
|
}]);
|
@@ -8710,7 +8726,7 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8710
8726
|
o = t.demo;
|
8711
8727
|
_this35._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, _this35._onClearMessages = Ui.onClearMessages.bind(_assertThisInitialized(_this35), e), _this35._displayLoadingMessage = fe.getDisplayLoadingMessage(e, t), _this35._permittedErrorPrefixes = n, _this35.addSetupMessageIfNeeded(e, t), _this35.populateIntroPanel(i, r, e.introPanelStyle), e.introMessage && _this35.addIntroductoryMessage(e.introMessage), e.initialMessages && _this35.populateInitialMessages(e.initialMessages), _this35._displayServiceErrorMessages = (l = e.errorMessages) == null ? void 0 : l.displayServiceErrorMessages, e.getMessages = function () {
|
8712
8728
|
return JSON.parse(JSON.stringify(_this35.messages));
|
8713
|
-
}, e.clearMessages = _this35.clearMessages.bind(_assertThisInitialized(_this35), t), e.refreshMessages = _this35.refreshTextMessages.bind(_assertThisInitialized(_this35)), e.scrollToBottom =
|
8729
|
+
}, e.clearMessages = _this35.clearMessages.bind(_assertThisInitialized(_this35), t), e.refreshMessages = _this35.refreshTextMessages.bind(_assertThisInitialized(_this35)), e.scrollToBottom = ne.scrollToBottom.bind(_assertThisInitialized(_this35), _this35.elementRef), e.addMessage = function (c, d) {
|
8714
8730
|
_this35.addNewMessage(_objectSpread(_objectSpread({}, c), {}, {
|
8715
8731
|
sendUpdate: !!d
|
8716
8732
|
}), !d);
|
@@ -8727,7 +8743,7 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8727
8743
|
}, {
|
8728
8744
|
key: "addSetupMessageIfNeeded",
|
8729
8745
|
value: function addSetupMessageIfNeeded(e, t) {
|
8730
|
-
var i =
|
8746
|
+
var i = Fo.getText(e, t);
|
8731
8747
|
if (i) {
|
8732
8748
|
var n = this.createAndAppendNewMessageElement(i, v.AI_ROLE);
|
8733
8749
|
this.applyCustomStyles(n, v.AI_ROLE, !1);
|
@@ -8752,7 +8768,7 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8752
8768
|
e.forEach(function (t) {
|
8753
8769
|
Ae.processInitialMessageFile(t), _this36.addNewMessage(t, !0);
|
8754
8770
|
}), setTimeout(function () {
|
8755
|
-
return
|
8771
|
+
return ne.scrollToBottom(_this36.elementRef);
|
8756
8772
|
});
|
8757
8773
|
}
|
8758
8774
|
// this should not be activated by streamed messages
|
@@ -8795,7 +8811,7 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8795
8811
|
var o = this.getPermittedMessage(t) || ((l = this._errorMessageOverrides) == null ? void 0 : l[e]) || ((c = this._errorMessageOverrides) == null ? void 0 : c["default"]) || "Error, please try again.";
|
8796
8812
|
this.renderText(r, o);
|
8797
8813
|
var a = P.extractParticularSharedStyles(["fontSize", "fontFamily"], (d = this.messageStyles) == null ? void 0 : d["default"]);
|
8798
|
-
P.applyCustomStylesToElements(i, !1, a), P.applyCustomStylesToElements(i, !1, (u = this.messageStyles) == null ? void 0 : u.error), this.elementRef.appendChild(n),
|
8814
|
+
P.applyCustomStylesToElements(i, !1, a), P.applyCustomStylesToElements(i, !1, (u = this.messageStyles) == null ? void 0 : u.error), this.elementRef.appendChild(n), ne.scrollToBottom(this.elementRef), this.textToSpeech && Lt.speak(o, this.textToSpeech);
|
8799
8815
|
}
|
8800
8816
|
}, {
|
8801
8817
|
key: "getPermittedMessage",
|
@@ -8832,12 +8848,12 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8832
8848
|
i = e.bubbleElement;
|
8833
8849
|
i.classList.add("loading-message-text");
|
8834
8850
|
var n = document.createElement("div");
|
8835
|
-
n.classList.add("dots-flashing"), i.appendChild(n), this.applyCustomStyles(e, v.AI_ROLE, !1, (r = this.messageStyles) == null ? void 0 : r.loading), Yi.set(i, this.messageStyles), this.elementRef.appendChild(t),
|
8851
|
+
n.classList.add("dots-flashing"), i.appendChild(n), this.applyCustomStyles(e, v.AI_ROLE, !1, (r = this.messageStyles) == null ? void 0 : r.loading), Yi.set(i, this.messageStyles), this.elementRef.appendChild(t), ne.scrollToBottom(this.elementRef);
|
8836
8852
|
}
|
8837
8853
|
}, {
|
8838
8854
|
key: "populateIntroPanel",
|
8839
8855
|
value: function populateIntroPanel(e, t, i) {
|
8840
|
-
(e || t) && (this._introPanel = new qt(e, t, i), this._introPanel._elementRef && (
|
8856
|
+
(e || t) && (this._introPanel = new qt(e, t, i), this._introPanel._elementRef && (se.apply(this, this._introPanel._elementRef), this.elementRef.appendChild(this._introPanel._elementRef)));
|
8841
8857
|
}
|
8842
8858
|
}, {
|
8843
8859
|
key: "addMultipleFiles",
|
@@ -8849,17 +8865,19 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8849
8865
|
return _context85.abrupt("return", Promise.all((e || []).map(function (t) {
|
8850
8866
|
return new Promise(function (i) {
|
8851
8867
|
if (!t.type || t.type === "any") {
|
8852
|
-
var n = t.file.name ||
|
8868
|
+
var n = t.file.name || ie.DEFAULT_FILE_NAME;
|
8853
8869
|
i({
|
8854
8870
|
name: n,
|
8855
|
-
type: "any"
|
8871
|
+
type: "any",
|
8872
|
+
ref: t.file
|
8856
8873
|
});
|
8857
8874
|
} else {
|
8858
8875
|
var _n3 = new FileReader();
|
8859
8876
|
_n3.readAsDataURL(t.file), _n3.onload = function () {
|
8860
8877
|
i({
|
8861
8878
|
src: _n3.result,
|
8862
|
-
type: t.type
|
8879
|
+
type: t.type,
|
8880
|
+
ref: t.file
|
8863
8881
|
});
|
8864
8882
|
};
|
8865
8883
|
}
|
@@ -9422,32 +9440,32 @@ var Uo = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 24 24\"
|
|
9422
9440
|
dropupText: "File"
|
9423
9441
|
}
|
9424
9442
|
};
|
9425
|
-
var
|
9443
|
+
var de = /*#__PURE__*/function () {
|
9426
9444
|
// prettier-ignore
|
9427
|
-
function
|
9445
|
+
function de(e, t, i, n) {
|
9428
9446
|
var _this41 = this;
|
9429
|
-
_classCallCheck(this,
|
9447
|
+
_classCallCheck(this, de);
|
9430
9448
|
this._attachments = [], this._fileCountLimit = 99, this._acceptedFormat = "", t.maxNumberOfFiles && (this._fileCountLimit = t.maxNumberOfFiles), this._toggleContainerDisplay = i, this._fileAttachmentsContainerRef = n, t.acceptedFormats && (this._acceptedFormat = t.acceptedFormats), setTimeout(function () {
|
9431
9449
|
_this41._validationHandler = e._validationHandler;
|
9432
9450
|
});
|
9433
9451
|
}
|
9434
|
-
_createClass(
|
9452
|
+
_createClass(de, [{
|
9435
9453
|
key: "attemptAddFile",
|
9436
9454
|
value: function attemptAddFile(e, t) {
|
9437
|
-
return
|
9455
|
+
return de.isFileTypeValid(e, this._acceptedFormat) ? (this.addAttachmentBasedOnType(e, t, !0), !0) : !1;
|
9438
9456
|
}
|
9439
9457
|
}, {
|
9440
9458
|
key: "addAttachmentBasedOnType",
|
9441
9459
|
value: function addAttachmentBasedOnType(e, t, i) {
|
9442
|
-
var n =
|
9460
|
+
var n = de.getTypeFromBlob(e);
|
9443
9461
|
if (n === "image") {
|
9444
|
-
var r =
|
9462
|
+
var r = de.createImageAttachment(t);
|
9445
9463
|
this.addFileAttachment(e, "image", r, i);
|
9446
9464
|
} else if (n === "audio") {
|
9447
9465
|
var _r2 = ji.createAudioAttachment(t);
|
9448
9466
|
this.addFileAttachment(e, "audio", _r2, i);
|
9449
9467
|
} else {
|
9450
|
-
var _r3 =
|
9468
|
+
var _r3 = de.createAnyFileAttachment(e.name);
|
9451
9469
|
this.addFileAttachment(e, "any", _r3, i);
|
9452
9470
|
}
|
9453
9471
|
}
|
@@ -9455,7 +9473,7 @@ var ce = /*#__PURE__*/function () {
|
|
9455
9473
|
key: "addFileAttachment",
|
9456
9474
|
value: function addFileAttachment(e, t, i, n) {
|
9457
9475
|
var a;
|
9458
|
-
var r =
|
9476
|
+
var r = de.createContainer(i);
|
9459
9477
|
if (this._attachments.length >= this._fileCountLimit) {
|
9460
9478
|
var l = this._attachments[this._attachments.length - 1].removeButton;
|
9461
9479
|
l == null || l.click();
|
@@ -9554,12 +9572,12 @@ var ce = /*#__PURE__*/function () {
|
|
9554
9572
|
return t.classList.add("file-attachment"), t.appendChild(e), t;
|
9555
9573
|
}
|
9556
9574
|
}]);
|
9557
|
-
return
|
9575
|
+
return de;
|
9558
9576
|
}();
|
9559
9577
|
var Ko = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <title>play</title>\n <path d=\"M5.92 24.096q0 1.088 0.928 1.728 0.512 0.288 1.088 0.288 0.448 0 0.896-0.224l16.16-8.064q0.48-0.256 0.8-0.736t0.288-1.088-0.288-1.056-0.8-0.736l-16.16-8.064q-0.448-0.224-0.896-0.224-0.544 0-1.088 0.288-0.928 0.608-0.928 1.728v16.16z\"></path>\n</svg>",
|
9560
9578
|
bn = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n<title>stop</title>\n<path d=\"M5.92 24.096q0 0.832 0.576 1.408t1.44 0.608h16.128q0.832 0 1.44-0.608t0.576-1.408v-16.16q0-0.832-0.576-1.44t-1.44-0.576h-16.128q-0.832 0-1.44 0.576t-0.576 1.44v16.16z\"></path>\n</svg>",
|
9561
|
-
as = /*#__PURE__*/function (
|
9562
|
-
_inherits(Se,
|
9579
|
+
as = /*#__PURE__*/function (_de) {
|
9580
|
+
_inherits(Se, _de);
|
9563
9581
|
var _super38 = _createSuper(Se);
|
9564
9582
|
// prettier-ignore
|
9565
9583
|
function Se(e, t, i, n) {
|
@@ -9641,7 +9659,7 @@ var Ko = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9641
9659
|
}, {
|
9642
9660
|
key: "addAudioElements",
|
9643
9661
|
value: function addAudioElements(e, t) {
|
9644
|
-
var i = e.parentElement ?
|
9662
|
+
var i = e.parentElement ? ne.cloneElement(e) : e,
|
9645
9663
|
n = document.createElement("audio");
|
9646
9664
|
n.src = t;
|
9647
9665
|
var r = U.createSVGElement(Ko);
|
@@ -9671,7 +9689,7 @@ var Ko = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9671
9689
|
}
|
9672
9690
|
}]);
|
9673
9691
|
return Se;
|
9674
|
-
}(
|
9692
|
+
}(de);
|
9675
9693
|
as.TIMER_LIMIT_S = 5999;
|
9676
9694
|
var ji = as;
|
9677
9695
|
var Jo = /*#__PURE__*/function () {
|
@@ -9683,7 +9701,7 @@ var Jo = /*#__PURE__*/function () {
|
|
9683
9701
|
value:
|
9684
9702
|
// prettier-ignore
|
9685
9703
|
function create(e, t, i, n, r) {
|
9686
|
-
return r === "audio" ? new ji(e, t, i, n) : new
|
9704
|
+
return r === "audio" ? new ji(e, t, i, n) : new de(e, t, i, n);
|
9687
9705
|
}
|
9688
9706
|
}]);
|
9689
9707
|
return Jo;
|
@@ -9788,11 +9806,11 @@ var Et = /*#__PURE__*/function () {
|
|
9788
9806
|
return Et;
|
9789
9807
|
}();
|
9790
9808
|
var ls = /*#__PURE__*/function () {
|
9791
|
-
function
|
9792
|
-
_classCallCheck(this,
|
9793
|
-
this._isOpen = !1, this._contentRef =
|
9809
|
+
function ae(e, t, i) {
|
9810
|
+
_classCallCheck(this, ae);
|
9811
|
+
this._isOpen = !1, this._contentRef = ae.createModalContent(t, i == null ? void 0 : i.backgroundColor), this._buttonPanel = ae.createButtonPanel(i == null ? void 0 : i.backgroundColor), this._elementRef = ae.createContainer(this._contentRef, i), this._elementRef.appendChild(this._buttonPanel), e.appendChild(this._elementRef), this._backgroundPanelRef = ae.createDarkBackgroundPanel(), e.appendChild(this._backgroundPanelRef), this.addWindowEvents();
|
9794
9812
|
}
|
9795
|
-
_createClass(
|
9813
|
+
_createClass(ae, [{
|
9796
9814
|
key: "isOpen",
|
9797
9815
|
value: function isOpen() {
|
9798
9816
|
return this._isOpen;
|
@@ -9814,7 +9832,7 @@ var ls = /*#__PURE__*/function () {
|
|
9814
9832
|
var _this45 = this;
|
9815
9833
|
this._elementRef.classList.remove("show-modal"), this._elementRef.classList.add("hide-modal"), this._backgroundPanelRef.classList.remove("show-modal-background"), this._backgroundPanelRef.classList.add("hide-modal-background"), this._isOpen = !1, setTimeout(function () {
|
9816
9834
|
_this45._elementRef.style.display = "none", _this45._backgroundPanelRef.style.display = "none";
|
9817
|
-
},
|
9835
|
+
}, ae.MODAL_CLOSE_TIMEOUT_MS);
|
9818
9836
|
}
|
9819
9837
|
}, {
|
9820
9838
|
key: "displayModalElements",
|
@@ -9830,7 +9848,7 @@ var ls = /*#__PURE__*/function () {
|
|
9830
9848
|
key: "addCloseButton",
|
9831
9849
|
value: function addCloseButton(e, t, i) {
|
9832
9850
|
var _this46 = this;
|
9833
|
-
var n = t ?
|
9851
|
+
var n = t ? ae.createSVGButton(e) : ae.createTextButton(e);
|
9834
9852
|
return this.addButtons(n), n.onclick = function () {
|
9835
9853
|
_this46.close(), setTimeout(function () {
|
9836
9854
|
i == null || i();
|
@@ -9890,12 +9908,12 @@ var ls = /*#__PURE__*/function () {
|
|
9890
9908
|
value: function createTextModalFunc(e, t, i) {
|
9891
9909
|
var n;
|
9892
9910
|
if (_typeof(t) == "object" && (n = t.files) != null && n.infoModal) {
|
9893
|
-
var r = new
|
9911
|
+
var r = new ae(e, ["modal-content"], t.files.infoModal.containerStyle);
|
9894
9912
|
return r.addCloseButton("OK", !1, i), r.openTextModal.bind(r, t.infoModalTextMarkUp || "");
|
9895
9913
|
}
|
9896
9914
|
}
|
9897
9915
|
}]);
|
9898
|
-
return
|
9916
|
+
return ae;
|
9899
9917
|
}();
|
9900
9918
|
ls.MODAL_CLOSE_TIMEOUT_MS = 190;
|
9901
9919
|
var rt = ls;
|
@@ -9968,15 +9986,15 @@ var ct = /*#__PURE__*/function (_xt2) {
|
|
9968
9986
|
}]);
|
9969
9987
|
return ct;
|
9970
9988
|
}(xt);
|
9971
|
-
var
|
9972
|
-
function
|
9973
|
-
_classCallCheck(this,
|
9989
|
+
var ce = /*#__PURE__*/function () {
|
9990
|
+
function ce() {
|
9991
|
+
_classCallCheck(this, ce);
|
9974
9992
|
}
|
9975
|
-
_createClass(
|
9993
|
+
_createClass(ce, null, [{
|
9976
9994
|
key: "create",
|
9977
9995
|
value: function create(e, t, i) {
|
9978
|
-
var n =
|
9979
|
-
|
9996
|
+
var n = ce.createElement(i);
|
9997
|
+
ce.addEvents(n, e, t), e.appendChild(n);
|
9980
9998
|
}
|
9981
9999
|
}, {
|
9982
10000
|
key: "createElement",
|
@@ -9988,13 +10006,13 @@ var le = /*#__PURE__*/function () {
|
|
9988
10006
|
key: "addEvents",
|
9989
10007
|
value: function addEvents(e, t, i) {
|
9990
10008
|
t.ondragenter = function (n) {
|
9991
|
-
n.preventDefault(),
|
10009
|
+
n.preventDefault(), ce.display(e);
|
9992
10010
|
}, e.ondragleave = function (n) {
|
9993
|
-
n.preventDefault(),
|
10011
|
+
n.preventDefault(), ce.hide(e);
|
9994
10012
|
}, e.ondragover = function (n) {
|
9995
10013
|
n.preventDefault();
|
9996
10014
|
}, e.ondrop = function (n) {
|
9997
|
-
n.preventDefault(),
|
10015
|
+
n.preventDefault(), ce.uploadFile(i, n), ce.hide(e);
|
9998
10016
|
};
|
9999
10017
|
}
|
10000
10018
|
}, {
|
@@ -10020,7 +10038,7 @@ var le = /*#__PURE__*/function () {
|
|
10020
10038
|
return t !== void 0 && t === !1 ? !1 : !!t || e.getNumberOfTypes() > 0;
|
10021
10039
|
}
|
10022
10040
|
}]);
|
10023
|
-
return
|
10041
|
+
return ce;
|
10024
10042
|
}();
|
10025
10043
|
var _e = /*#__PURE__*/function () {
|
10026
10044
|
function _e() {
|
@@ -10742,7 +10760,7 @@ Object.defineProperty(ai, "__esModule", {
|
|
10742
10760
|
ai.Padding = void 0;
|
10743
10761
|
var sa = De,
|
10744
10762
|
Sn = je,
|
10745
|
-
|
10763
|
+
Be = Pe;
|
10746
10764
|
var Ht = /*#__PURE__*/function () {
|
10747
10765
|
function Ht() {
|
10748
10766
|
_classCallCheck(this, Ht);
|
@@ -10755,11 +10773,11 @@ var Ht = /*#__PURE__*/function () {
|
|
10755
10773
|
r = t.value[n - 1],
|
10756
10774
|
o = t.selectionEnd === null ? n : t.selectionEnd,
|
10757
10775
|
a = t.value[o];
|
10758
|
-
|
10776
|
+
Be.Text.isCharDefined(r) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), Be.Text.isCharDefined(a) && (e.endPadding = " ", e.numberOfSpacesAfterNewText = 1), e.isCursorAtEnd = t.value.length === o;
|
10759
10777
|
return;
|
10760
10778
|
}
|
10761
10779
|
var i = t.value[t.value.length - 1];
|
10762
|
-
|
10780
|
+
Be.Text.isCharDefined(i) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), e.isCursorAtEnd = !0;
|
10763
10781
|
}
|
10764
10782
|
}, {
|
10765
10783
|
key: "setStateForGenericElement",
|
@@ -10772,12 +10790,12 @@ var Ht = /*#__PURE__*/function () {
|
|
10772
10790
|
c = (i = t.textContent) === null || i === void 0 ? void 0 : i[l - 1],
|
10773
10791
|
d = Sn.Cursor.getGenericElementCursorOffset(t, a, !1),
|
10774
10792
|
u = (n = t.textContent) === null || n === void 0 ? void 0 : n[d];
|
10775
|
-
|
10793
|
+
Be.Text.isCharDefined(c) && (e.startPadding = " "), Be.Text.isCharDefined(u) && (e.endPadding = " "), e.isCursorAtEnd = ((r = t.textContent) === null || r === void 0 ? void 0 : r.length) === d;
|
10776
10794
|
return;
|
10777
10795
|
}
|
10778
10796
|
}
|
10779
10797
|
var o = t.innerText.charAt(t.innerText.length - 1);
|
10780
|
-
|
10798
|
+
Be.Text.isCharDefined(o) && (e.startPadding = " "), e.isCursorAtEnd = !0;
|
10781
10799
|
}
|
10782
10800
|
}, {
|
10783
10801
|
key: "setState",
|
@@ -11566,42 +11584,42 @@ var fa = /*#__PURE__*/function (_mt2) {
|
|
11566
11584
|
return fa;
|
11567
11585
|
}(mt);
|
11568
11586
|
var ma = "<?xml version=\"1.0\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\" \"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">\n<svg xmlns=\"http://www.w3.org/2000/svg\" stroke=\"currentColor\" fill=\"none\" stroke-width=\"1\" viewBox=\"0 0 24 24\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <line x1=\"22\" y1=\"2\" x2=\"11\" y2=\"14\"></line>\n <polygon points=\"22 2 15 22 11 14 2 10 22 2\"></polygon>\n</svg>\n";
|
11569
|
-
var
|
11570
|
-
function
|
11571
|
-
_classCallCheck(this,
|
11587
|
+
var F = /*#__PURE__*/function () {
|
11588
|
+
function F() {
|
11589
|
+
_classCallCheck(this, F);
|
11572
11590
|
}
|
11573
|
-
_createClass(
|
11591
|
+
_createClass(F, null, [{
|
11574
11592
|
key: "setPropertyValueIfDoesNotExist",
|
11575
11593
|
value: function setPropertyValueIfDoesNotExist(e, t, i) {
|
11576
11594
|
var _e$n, _e$n2;
|
11577
11595
|
var n = t[0];
|
11578
|
-
t.length === 1 ? (_e$n = e[n]) !== null && _e$n !== void 0 ? _e$n : e[n] = i : ((_e$n2 = e[n]) !== null && _e$n2 !== void 0 ? _e$n2 : e[n] = {}, t.shift(),
|
11596
|
+
t.length === 1 ? (_e$n = e[n]) !== null && _e$n !== void 0 ? _e$n : e[n] = i : ((_e$n2 = e[n]) !== null && _e$n2 !== void 0 ? _e$n2 : e[n] = {}, t.shift(), F.setPropertyValueIfDoesNotExist(e[n], t, i));
|
11579
11597
|
}
|
11580
11598
|
}, {
|
11581
11599
|
key: "setPropertyValue",
|
11582
11600
|
value: function setPropertyValue(e, t, i) {
|
11583
11601
|
var _e$n3;
|
11584
11602
|
var n = t[0];
|
11585
|
-
t.length === 1 ? e[n] = i : ((_e$n3 = e[n]) !== null && _e$n3 !== void 0 ? _e$n3 : e[n] = {}, t.shift(),
|
11603
|
+
t.length === 1 ? e[n] = i : ((_e$n3 = e[n]) !== null && _e$n3 !== void 0 ? _e$n3 : e[n] = {}, t.shift(), F.setPropertyValue(e[n], t, i));
|
11586
11604
|
}
|
11587
11605
|
}, {
|
11588
11606
|
key: "getObjectValue",
|
11589
11607
|
value: function getObjectValue(e, t) {
|
11590
11608
|
var i = t[0],
|
11591
11609
|
n = e[i];
|
11592
|
-
return n === void 0 || t.length === 1 ? n :
|
11610
|
+
return n === void 0 || t.length === 1 ? n : F.getObjectValue(n, t.slice(1));
|
11593
11611
|
}
|
11594
11612
|
}, {
|
11595
11613
|
key: "overwritePropertyObjectFromAnother",
|
11596
11614
|
value: function overwritePropertyObjectFromAnother(e, t, i) {
|
11597
|
-
var n =
|
11615
|
+
var n = F.getObjectValue(t, i);
|
11598
11616
|
if (n) {
|
11599
|
-
var r = _objectSpread(_objectSpread({}, n),
|
11600
|
-
|
11617
|
+
var r = _objectSpread(_objectSpread({}, n), F.getObjectValue(e, i) || {});
|
11618
|
+
F.setPropertyValue(e, i, r);
|
11601
11619
|
}
|
11602
11620
|
}
|
11603
11621
|
}]);
|
11604
|
-
return
|
11622
|
+
return F;
|
11605
11623
|
}();
|
11606
11624
|
var Te = /*#__PURE__*/function () {
|
11607
11625
|
function Te() {
|
@@ -11617,13 +11635,13 @@ var Te = /*#__PURE__*/function () {
|
|
11617
11635
|
value: function overwriteDefaultStyleWithSubmit(e, t) {
|
11618
11636
|
if (!e.submit) return;
|
11619
11637
|
var i = JSON.parse(JSON.stringify(e[t] || {}));
|
11620
|
-
|
11638
|
+
F.overwritePropertyObjectFromAnother(i, e.submit, ["container", "default"]), F.overwritePropertyObjectFromAnother(i, e.submit, ["text", "styles", "default"]), F.overwritePropertyObjectFromAnother(i, e.submit, ["svg", "styles", "default"]), e[t] = i;
|
11621
11639
|
}
|
11622
11640
|
// prettier-ignore
|
11623
11641
|
}, {
|
11624
11642
|
key: "setUpDisabledButton",
|
11625
11643
|
value: function setUpDisabledButton(e) {
|
11626
|
-
|
11644
|
+
F.setPropertyValueIfDoesNotExist(e, ["submit", "container", "default", "backgroundColor"], ""), F.setPropertyValueIfDoesNotExist(e, ["disabled", "container", "default", "backgroundColor"], "unset"), F.setPropertyValueIfDoesNotExist(e.submit, ["svg", "styles", "default", "filter"], ""), F.setPropertyValueIfDoesNotExist(e.disabled, ["svg", "styles", "default", "filter"], "brightness(0) saturate(100%) invert(70%) sepia(0%) saturate(5564%) hue-rotate(207deg) brightness(100%) contrast(97%)"), Te.overwriteDefaultStyleWithSubmit(e, "disabled");
|
11627
11645
|
}
|
11628
11646
|
}, {
|
11629
11647
|
key: "process",
|
@@ -11752,7 +11770,7 @@ var mi = /*#__PURE__*/function (_xt4) {
|
|
11752
11770
|
e.files && (t.files = Array.from(e.files).map(function (i) {
|
11753
11771
|
return {
|
11754
11772
|
file: i,
|
11755
|
-
type:
|
11773
|
+
type: de.getTypeFromBlob(i)
|
11756
11774
|
};
|
11757
11775
|
})), setTimeout(function () {
|
11758
11776
|
return _this60.attemptSubmit(t, !0);
|
@@ -11799,7 +11817,7 @@ var mi = /*#__PURE__*/function (_xt4) {
|
|
11799
11817
|
return this.addNewMessage(e);
|
11800
11818
|
case 10:
|
11801
11819
|
this._serviceIO.isWebModel() || this._messages.addLoadingMessage();
|
11802
|
-
|
11820
|
+
Fi.clear(this._inputElementRef);
|
11803
11821
|
i = (o = e.files) == null ? void 0 : o.map(function (l) {
|
11804
11822
|
return l.file;
|
11805
11823
|
}), n = {
|
@@ -12096,7 +12114,7 @@ var ut = /*#__PURE__*/function () {
|
|
12096
12114
|
function ut(e, t, i, n) {
|
12097
12115
|
_classCallCheck(this, ut);
|
12098
12116
|
this.elementRef = ut.createPanelElement(e.inputAreaStyle);
|
12099
|
-
var r = new
|
12117
|
+
var r = new Fi(e, i),
|
12100
12118
|
o = {},
|
12101
12119
|
a = this.createFileUploadComponents(e, i, n, o);
|
12102
12120
|
e.speechToText && !o.microphone && (o.microphone = {
|
@@ -12126,7 +12144,7 @@ var ut = /*#__PURE__*/function () {
|
|
12126
12144
|
button: new fa(_d, t.recordAudio)
|
12127
12145
|
};
|
12128
12146
|
}
|
12129
|
-
return
|
12147
|
+
return ce.isEnabled(r, e.dragAndDrop) && ce.create(i, r, e.dragAndDrop), r;
|
12130
12148
|
}
|
12131
12149
|
// prettier-ignore
|
12132
12150
|
}], [{
|
@@ -12159,7 +12177,7 @@ var ut = /*#__PURE__*/function () {
|
|
12159
12177
|
}, {
|
12160
12178
|
key: "addElements",
|
12161
12179
|
value: function addElements(e, t, i, n, r, o) {
|
12162
|
-
|
12180
|
+
ne.addElements(e, t.elementRef);
|
12163
12181
|
var a = Ze.create(),
|
12164
12182
|
l = j.addButtons(a, i, n, o);
|
12165
12183
|
zo.set(t.inputElementRef, a, r.elementRef, l), Ze.add(e, a);
|
@@ -12179,7 +12197,7 @@ var Qi = /*#__PURE__*/function () {
|
|
12179
12197
|
var r = new fe(e, t, i);
|
12180
12198
|
t.websocket && Y.createConnection(t, r);
|
12181
12199
|
var o = new ut(e, r, t, n);
|
12182
|
-
return
|
12200
|
+
return ne.addElements(n, r.elementRef, o.elementRef), n;
|
12183
12201
|
}
|
12184
12202
|
}, {
|
12185
12203
|
key: "render",
|
@@ -12228,13 +12246,14 @@ var b = /*#__PURE__*/function (_co) {
|
|
12228
12246
|
key: "onRender",
|
12229
12247
|
value: function onRender() {
|
12230
12248
|
var _this$_activeService, _this$_childElement;
|
12231
|
-
(_this$_activeService = this._activeService) !== null && _this$_activeService !== void 0 ? _this$_activeService : this._activeService = Do.create(this), this._activeService && (this.auxiliaryStyle && !this._auxiliaryStyleApplied && (bi.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), bi.applyDefaultStyleToComponent(this.style, this.chatStyle), Ae.checkForContainerStyles(this, this._elementRef), this._activeService.key && this._activeService.validateConfigKey ? Ot.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : !(this._activeService instanceof z) || this._activeService.key ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], Qi.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof z && N.render(this._elementRef, this.changeToChatView.bind(this), this._activeService), this._hasBeenRendered = !0, Ui.onRender(this));
|
12249
|
+
console.log("render"), (_this$_activeService = this._activeService) !== null && _this$_activeService !== void 0 ? _this$_activeService : this._activeService = Do.create(this), this._activeService && (this.auxiliaryStyle && !this._auxiliaryStyleApplied && (bi.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), bi.applyDefaultStyleToComponent(this.style, this.chatStyle), Ae.checkForContainerStyles(this, this._elementRef), this._activeService.key && this._activeService.validateConfigKey ? Ot.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : !(this._activeService instanceof z) || this._activeService.key ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], Qi.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof z && N.render(this._elementRef, this.changeToChatView.bind(this), this._activeService), this._hasBeenRendered = !0, Ui.onRender(this));
|
12232
12250
|
}
|
12233
12251
|
}]);
|
12234
12252
|
return b;
|
12235
12253
|
}(co);
|
12236
12254
|
x([y("object")], b.prototype, "directConnection", 2);
|
12237
12255
|
x([y("object")], b.prototype, "request", 2);
|
12256
|
+
x([y("object")], b.prototype, "webModel", 2);
|
12238
12257
|
x([y("object")], b.prototype, "stream", 2);
|
12239
12258
|
x([y("object")], b.prototype, "requestBodyLimits", 2);
|
12240
12259
|
x([y("function")], b.prototype, "requestInterceptor", 2);
|
@@ -12269,7 +12288,6 @@ x([y("function")], b.prototype, "onNewMessage", 2);
|
|
12269
12288
|
x([y("function")], b.prototype, "onClearMessages", 2);
|
12270
12289
|
x([y("function")], b.prototype, "onComponentRender", 2);
|
12271
12290
|
x([y("object")], b.prototype, "demo", 2);
|
12272
|
-
x([y("object")], b.prototype, "webModel", 2);
|
12273
12291
|
x([y("object")], b.prototype, "_insertKeyViewStyles", 2);
|
12274
12292
|
customElements.define("deep-chat", b);
|
12275
12293
|
export { b as DeepChat };
|