deep-chat-dev 9.0.86 → 9.0.88
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 +6290 -6261
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.js +261 -247
- package/dist/types/webModel/webModel.d.ts +1 -1
- package/dist/types/webModel/webModel.d.ts.map +1 -1
- package/dist/views/chat/chatView.d.ts.map +1 -1
- package/dist/views/chat/messages/messages.d.ts.map +1 -1
- package/dist/views/chat/messages/messagesBase.d.ts.map +1 -1
- package/dist/webModel/webModel.d.ts +7 -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 Bi = 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(Bi.TEXT_INPUT_ID));
|
357
357
|
t && Yt.focusEndOfInput(t);
|
358
358
|
}
|
359
359
|
}]);
|
@@ -416,11 +416,11 @@ var I = {
|
|
416
416
|
}();
|
417
417
|
Dn.CODE_SNIPPET_GENERATION_JUMP = 0.5;
|
418
418
|
var ne = Dn;
|
419
|
-
var
|
420
|
-
function
|
421
|
-
_classCallCheck(this,
|
419
|
+
var Bn = /*#__PURE__*/function () {
|
420
|
+
function Fn() {
|
421
|
+
_classCallCheck(this, Fn);
|
422
422
|
}
|
423
|
-
_createClass(
|
423
|
+
_createClass(Fn, null, [{
|
424
424
|
key: "speak",
|
425
425
|
value: function speak(e, t) {
|
426
426
|
if (window.SpeechSynthesisUtterance) {
|
@@ -441,13 +441,13 @@ var Fn = /*#__PURE__*/function () {
|
|
441
441
|
n && (i.voice = n);
|
442
442
|
}
|
443
443
|
t(i);
|
444
|
-
},
|
444
|
+
}, Fn.LOAD_VOICES_MS);
|
445
445
|
}
|
446
446
|
}]);
|
447
|
-
return
|
447
|
+
return Fn;
|
448
448
|
}();
|
449
|
-
|
450
|
-
var Lt =
|
449
|
+
Bn.LOAD_VOICES_MS = 200;
|
450
|
+
var Lt = Bn;
|
451
451
|
var Ae = /*#__PURE__*/function () {
|
452
452
|
function Ae() {
|
453
453
|
_classCallCheck(this, Ae);
|
@@ -840,7 +840,7 @@ var _s = /[&<>"]/,
|
|
840
840
|
function Cs(s) {
|
841
841
|
return Ts[s];
|
842
842
|
}
|
843
|
-
function
|
843
|
+
function F(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>" + F(s[e].content) + "</code></pre>" + Le(s, e) : "<code>" + F(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 = F(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)) || F(r.content) : u = F(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="' + F(ke(s[e].title)) + '"' : "",
|
909
909
|
n = t.linkTarget ? ' target="' + t.linkTarget + '"' : "";
|
910
|
-
return '<a href="' +
|
910
|
+
return '<a href="' + F(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="' + F(s[e].src) + '"',
|
917
|
+
n = s[e].title ? ' title="' + F(ke(s[e].title)) + '"' : "",
|
918
|
+
r = ' alt="' + (s[e].alt ? F(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>" + F(s[e].content) + "</sub>";
|
992
992
|
};
|
993
993
|
f.sup = function (s, e) {
|
994
|
-
return "<sup>" +
|
994
|
+
return "<sup>" + F(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 F(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="' + F(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 Fi() {
|
1066
1066
|
this.rules = qn({}, f), this.getBreak = f.getBreak;
|
1067
1067
|
}
|
1068
|
-
|
1068
|
+
Fi.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
|
+
Fi.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
|
+
Bs = {
|
1412
1412
|
c: "©",
|
1413
1413
|
r: "®",
|
1414
1414
|
p: "§",
|
1415
1415
|
tm: "™"
|
1416
1416
|
};
|
1417
|
-
function
|
1417
|
+
function Fs(s) {
|
1418
1418
|
return s.indexOf("(") < 0 ? s : s.replace(js, function (e, t) {
|
1419
|
-
return
|
1419
|
+
return Bs[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 = Fs(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 Be(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 = Be(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 = Be(E[d.token].content, d.pos, s.options.quotes[2]), t.content = Be(t.content, n.index, s.options.quotes[3])) : (E[d.token].content = Be(E[d.token].content, d.pos, s.options.quotes[0]), t.content = Be(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 = Be(t.content, n.index, on));
|
1462
1462
|
}
|
1463
1463
|
}
|
1464
1464
|
}
|
@@ -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
|
+
Br = /<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->/,
|
2428
|
+
Fr = /<[?].*?[?]>/,
|
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", Br)("processing", Fr)("declaration", zr)("cdata", qr)();
|
2432
2432
|
function Hr(s) {
|
2433
2433
|
var e = s | 32;
|
2434
2434
|
return e >= 97 && e <= 122;
|
@@ -2626,7 +2626,7 @@ 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
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
|
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 Fi(), 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);
|
@@ -2978,7 +2978,7 @@ var Ve = /*#__PURE__*/function () {
|
|
2978
2978
|
var n;
|
2979
2979
|
(n = this._introPanel) == null || n.hide();
|
2980
2980
|
var i = this.messageElementRefs[this.messageElementRefs.length - 1];
|
2981
|
-
return Ve.isTemporaryElement(i) && (
|
2981
|
+
return Ve.isTemporaryElement(i) && (i.outerContainer.remove(), this.messageElementRefs.pop()), this.createMessageElements(e, t);
|
2982
2982
|
}
|
2983
2983
|
}, {
|
2984
2984
|
key: "createMessageElements",
|
@@ -5712,12 +5712,12 @@ var xo = /*#__PURE__*/function (_Ne5) {
|
|
5712
5712
|
}]);
|
5713
5713
|
return xo;
|
5714
5714
|
}(Ne);
|
5715
|
-
var
|
5716
|
-
_inherits(
|
5717
|
-
var _super15 = _createSuper(
|
5718
|
-
function
|
5715
|
+
var Bt = /*#__PURE__*/function (_Qt3) {
|
5716
|
+
_inherits(Bt, _Qt3);
|
5717
|
+
var _super15 = _createSuper(Bt);
|
5718
|
+
function Bt(e) {
|
5719
5719
|
var _this15;
|
5720
|
-
_classCallCheck(this,
|
5720
|
+
_classCallCheck(this, Bt);
|
5721
5721
|
var o;
|
5722
5722
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
5723
5723
|
i = t.stabilityAI,
|
@@ -5731,10 +5731,10 @@ var Ft = /*#__PURE__*/function (_Qt3) {
|
|
5731
5731
|
};
|
5732
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>";
|
5733
5733
|
var r = (o = t.stabilityAI) == null ? void 0 : o.imageToImage;
|
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),
|
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), Bt.cleanConfig(r), Object.assign(_this15.rawBody, r)), _this15.canSendMessage = Bt.canSendFileTextMessage;
|
5735
5735
|
return _this15;
|
5736
5736
|
}
|
5737
|
-
_createClass(
|
5737
|
+
_createClass(Bt, [{
|
5738
5738
|
key: "createFormDataBody",
|
5739
5739
|
value: function createFormDataBody(e, t, i) {
|
5740
5740
|
var n = new FormData();
|
@@ -5819,7 +5819,7 @@ var Ft = /*#__PURE__*/function (_Qt3) {
|
|
5819
5819
|
return !!(t != null && t[0]) && !!(e && e.trim() !== "");
|
5820
5820
|
}
|
5821
5821
|
}]);
|
5822
|
-
return
|
5822
|
+
return Bt;
|
5823
5823
|
}(Qt);
|
5824
5824
|
var Eo = /*#__PURE__*/function (_Ne6) {
|
5825
5825
|
_inherits(Eo, _Ne6);
|
@@ -5861,21 +5861,21 @@ var Eo = /*#__PURE__*/function (_Ne6) {
|
|
5861
5861
|
}]);
|
5862
5862
|
return Eo;
|
5863
5863
|
}(Ne);
|
5864
|
-
var
|
5865
|
-
_inherits(
|
5866
|
-
var _super17 = _createSuper(
|
5867
|
-
function
|
5864
|
+
var Ft = /*#__PURE__*/function (_Qt4) {
|
5865
|
+
_inherits(Ft, _Qt4);
|
5866
|
+
var _super17 = _createSuper(Ft);
|
5867
|
+
function Ft(e) {
|
5868
5868
|
var _this16;
|
5869
|
-
_classCallCheck(this,
|
5869
|
+
_classCallCheck(this, Ft);
|
5870
5870
|
var r;
|
5871
5871
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
5872
5872
|
i = t.stabilityAI;
|
5873
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>";
|
5874
5874
|
var n = (r = t.stabilityAI) == null ? void 0 : r.textToImage;
|
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),
|
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), Ft.cleanConfig(n), Object.assign(_this16.rawBody, n)), _this16.canSendMessage = Ft.canSendTextMessage;
|
5876
5876
|
return _this16;
|
5877
5877
|
}
|
5878
|
-
_createClass(
|
5878
|
+
_createClass(Ft, [{
|
5879
5879
|
key: "preprocessBody",
|
5880
5880
|
value: function preprocessBody(e, t) {
|
5881
5881
|
var i = JSON.parse(JSON.stringify(e)),
|
@@ -5954,7 +5954,7 @@ var Bt = /*#__PURE__*/function (_Qt4) {
|
|
5954
5954
|
return !!(e && e.trim() !== "");
|
5955
5955
|
}
|
5956
5956
|
}]);
|
5957
|
-
return
|
5957
|
+
return Ft;
|
5958
5958
|
}(Qt);
|
5959
5959
|
var So = /*#__PURE__*/function (_Ne7) {
|
5960
5960
|
_inherits(So, _Ne7);
|
@@ -8117,7 +8117,7 @@ var mn = {
|
|
8117
8117
|
function A(e) {
|
8118
8118
|
var _this32;
|
8119
8119
|
_classCallCheck(this, A);
|
8120
|
-
_this32 = _super35.call(this, e), _this32._isModelLoaded = !1, _this32._isModelLoading = !1, _this32._loadOnFirstMessage = !1, _this32.permittedErrorPrefixes = [A.MULTIPLE_MODELS_ERROR, A.WEB_LLM_NOT_FOUND_ERROR, A.GENERIC_ERROR], _this32.webModel = {}, _typeof(e.webModel) == "object" && (_this32.webModel = e.webModel),
|
8120
|
+
_this32 = _super35.call(this, e), _this32._isModelLoaded = !1, _this32._isModelLoading = !1, _this32._loadOnFirstMessage = !1, _this32.permittedErrorPrefixes = [A.MULTIPLE_MODELS_ERROR, A.WEB_LLM_NOT_FOUND_ERROR, A.GENERIC_ERROR], _this32.webModel = {}, _typeof(e.webModel) == "object" && (_this32.webModel = e.webModel), _this32.findModelInWindow(e), _this32.canSendMessage = _this32.canSubmit.bind(_assertThisInitialized(_this32));
|
8121
8121
|
return _this32;
|
8122
8122
|
}
|
8123
8123
|
_createClass(A, [{
|
@@ -8126,10 +8126,12 @@ var mn = {
|
|
8126
8126
|
var _this33 = this;
|
8127
8127
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
8128
8128
|
var i;
|
8129
|
-
window.webLLM
|
8130
|
-
var n =
|
8131
|
-
|
8132
|
-
|
8129
|
+
if (window.webLLM && !e.introMessage) {
|
8130
|
+
var n = this.shouldAddInitialMessage(e.introMessage);
|
8131
|
+
this.configureInit(n), setTimeout(function () {
|
8132
|
+
_this33._downloadButton && n && (_this33._downloadButton.disabled = !1);
|
8133
|
+
}, 2);
|
8134
|
+
} else t > 5 ? ((i = this.addMessage) == null || i.call(this, {
|
8133
8135
|
error: A.WEB_LLM_NOT_FOUND_ERROR,
|
8134
8136
|
sendUpdate: !1
|
8135
8137
|
}), console.error("The WebLLM module is either not in the project or not been attached to the window object. Please see the following guide:"), console.error("Hello World")) : setTimeout(function () {
|
@@ -8137,21 +8139,30 @@ var mn = {
|
|
8137
8139
|
}, 1e3);
|
8138
8140
|
}
|
8139
8141
|
}, {
|
8140
|
-
key: "
|
8141
|
-
value: function
|
8142
|
-
var
|
8143
|
-
|
8144
|
-
|
8145
|
-
|
8146
|
-
|
8147
|
-
|
8148
|
-
|
8142
|
+
key: "shouldAddInitialMessage",
|
8143
|
+
value: function shouldAddInitialMessage(e) {
|
8144
|
+
var t;
|
8145
|
+
return !e && this.webModel && ((t = this.webModel.introMessage) == null ? void 0 : t.displayed) !== !1;
|
8146
|
+
}
|
8147
|
+
}, {
|
8148
|
+
key: "getIntroMessage",
|
8149
|
+
value: function getIntroMessage(_ref10) {
|
8150
|
+
var _this34 = this;
|
8151
|
+
var e = _ref10.shadowRoot,
|
8152
|
+
t = _ref10.introMessage;
|
8153
|
+
if (!this.shouldAddInitialMessage(t) || !e) return;
|
8154
|
+
var i = this.webModel.introMessage,
|
8155
|
+
n = (i == null ? void 0 : i.downloadClass) || A.DOWNLOAD_BUTTON_CLASS,
|
8156
|
+
r = "\n Download a web model that will run entirely on your browser.\n <br/> <button disabled style=\"margin-top: 10px; margin-bottom: 5px; margin-left: 1px\"\n class=\"".concat(n, " deep-chat-button\">Download</button>"),
|
8157
|
+
o = (i == null ? void 0 : i.html) || "<div>".concat(r, "</div>");
|
8158
|
+
return setTimeout(function () {
|
8159
|
+
var a;
|
8160
|
+
_this34._downloadButton = (a = e.children[0]) == null ? void 0 : a.getElementsByClassName(n)[0], _this34._downloadButton && (_this34._downloadButton.onclick = _this34.init.bind(_this34));
|
8161
|
+
}), {
|
8149
8162
|
role: v.AI_ROLE,
|
8150
|
-
html:
|
8163
|
+
html: o,
|
8151
8164
|
sendUpdate: !1
|
8152
|
-
}
|
8153
|
-
var o = (l = e.children[0]) == null ? void 0 : l.getElementsByClassName(i)[0];
|
8154
|
-
return o && (o.onclick = this.init.bind(this)), console.log("adding"), !0;
|
8165
|
+
};
|
8155
8166
|
}
|
8156
8167
|
}, {
|
8157
8168
|
key: "configureInit",
|
@@ -8253,7 +8264,7 @@ var mn = {
|
|
8253
8264
|
key: "loadModel",
|
8254
8265
|
value: function () {
|
8255
8266
|
var _loadModel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee78(e) {
|
8256
|
-
var
|
8267
|
+
var _this35 = this;
|
8257
8268
|
var i, t, _this$getConfig, n, r;
|
8258
8269
|
return _regeneratorRuntime().wrap(function _callee78$(_context78) {
|
8259
8270
|
while (1) switch (_context78.prev = _context78.next) {
|
@@ -8261,7 +8272,7 @@ var mn = {
|
|
8261
8272
|
A.chat = e, this._isModelLoading = !0;
|
8262
8273
|
t = function t(n) {
|
8263
8274
|
var r;
|
8264
|
-
(r =
|
8275
|
+
(r = _this35.addMessage) == null || r.call(_this35, {
|
8265
8276
|
html: "<div>".concat(n.text, "</div>"),
|
8266
8277
|
overwrite: !0,
|
8267
8278
|
sendUpdate: !1
|
@@ -8496,7 +8507,7 @@ var Do = /*#__PURE__*/function () {
|
|
8496
8507
|
if (t.azure.summarization) return new Ao(e);
|
8497
8508
|
if (t.azure.translation) return new Lo(e);
|
8498
8509
|
}
|
8499
|
-
if (t.stabilityAI) return t.stabilityAI.imageToImage ? new
|
8510
|
+
if (t.stabilityAI) return t.stabilityAI.imageToImage ? new Bt(e) : t.stabilityAI.imageToImageUpscale ? new Dt(e) : t.stabilityAI.imageToImageMasking ? new jt(e) : new Ft(e);
|
8500
8511
|
}
|
8501
8512
|
return i ? new Ie(e) : new Ie(e, void 0, n || !0);
|
8502
8513
|
}
|
@@ -8614,11 +8625,11 @@ var qt = /*#__PURE__*/function () {
|
|
8614
8625
|
}]);
|
8615
8626
|
return qt;
|
8616
8627
|
}();
|
8617
|
-
var
|
8618
|
-
function
|
8619
|
-
_classCallCheck(this,
|
8628
|
+
var Bo = /*#__PURE__*/function () {
|
8629
|
+
function Bo() {
|
8630
|
+
_classCallCheck(this, Bo);
|
8620
8631
|
}
|
8621
|
-
_createClass(
|
8632
|
+
_createClass(Bo, null, [{
|
8622
8633
|
key: "getText",
|
8623
8634
|
value: function getText(e, t) {
|
8624
8635
|
var i, n;
|
@@ -8633,9 +8644,9 @@ var Fo = /*#__PURE__*/function () {
|
|
8633
8644
|
return null;
|
8634
8645
|
}
|
8635
8646
|
}]);
|
8636
|
-
return
|
8647
|
+
return Bo;
|
8637
8648
|
}();
|
8638
|
-
var
|
8649
|
+
var Fo = "<?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>";
|
8639
8650
|
var pe = /*#__PURE__*/function () {
|
8640
8651
|
function pe() {
|
8641
8652
|
_classCallCheck(this, pe);
|
@@ -8689,7 +8700,7 @@ var pe = /*#__PURE__*/function () {
|
|
8689
8700
|
t.classList.add("any-file-message-contents");
|
8690
8701
|
var i = document.createElement("div");
|
8691
8702
|
i.classList.add("any-file-message-icon-container");
|
8692
|
-
var n = U.createSVGElement(
|
8703
|
+
var n = U.createSVGElement(Fo);
|
8693
8704
|
n.classList.add("any-file-message-icon"), i.appendChild(n);
|
8694
8705
|
var r = document.createElement("div");
|
8695
8706
|
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);
|
@@ -8717,23 +8728,23 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8717
8728
|
_inherits(fe, _Ve);
|
8718
8729
|
var _super36 = _createSuper(fe);
|
8719
8730
|
function fe(e, t, i) {
|
8720
|
-
var
|
8731
|
+
var _this36;
|
8721
8732
|
_classCallCheck(this, fe);
|
8722
8733
|
var a, l;
|
8723
|
-
|
8734
|
+
_this36 = _super36.call(this, e);
|
8724
8735
|
var n = t.permittedErrorPrefixes,
|
8725
8736
|
r = t.introPanelMarkUp,
|
8726
8737
|
o = t.demo;
|
8727
|
-
|
8728
|
-
return JSON.parse(JSON.stringify(
|
8729
|
-
}, e.clearMessages =
|
8730
|
-
|
8738
|
+
_this36._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, _this36._onClearMessages = Ui.onClearMessages.bind(_assertThisInitialized(_this36), e), _this36._displayLoadingMessage = fe.getDisplayLoadingMessage(e, t), _this36._permittedErrorPrefixes = n, _this36.addSetupMessageIfNeeded(e, t), _this36.populateIntroPanel(i, r, e.introPanelStyle), _this36.addIntroductoryMessage(e, t), e.initialMessages && _this36.populateInitialMessages(e.initialMessages), _this36._displayServiceErrorMessages = (l = e.errorMessages) == null ? void 0 : l.displayServiceErrorMessages, e.getMessages = function () {
|
8739
|
+
return JSON.parse(JSON.stringify(_this36.messages));
|
8740
|
+
}, e.clearMessages = _this36.clearMessages.bind(_assertThisInitialized(_this36), t), e.refreshMessages = _this36.refreshTextMessages.bind(_assertThisInitialized(_this36)), e.scrollToBottom = ne.scrollToBottom.bind(_assertThisInitialized(_this36), _this36.elementRef), e.addMessage = function (c, d) {
|
8741
|
+
_this36.addNewMessage(_objectSpread(_objectSpread({}, c), {}, {
|
8731
8742
|
sendUpdate: !!d
|
8732
8743
|
}), !d);
|
8733
|
-
}, t.addMessage =
|
8734
|
-
|
8744
|
+
}, t.addMessage = _this36.addIOMessage.bind(_assertThisInitialized(_this36)), o && _this36.prepareDemo(o), e.textToSpeech && Lt.processConfig(e.textToSpeech, function (c) {
|
8745
|
+
_this36.textToSpeech = c;
|
8735
8746
|
});
|
8736
|
-
return
|
8747
|
+
return _this36;
|
8737
8748
|
}
|
8738
8749
|
_createClass(fe, [{
|
8739
8750
|
key: "prepareDemo",
|
@@ -8743,7 +8754,7 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8743
8754
|
}, {
|
8744
8755
|
key: "addSetupMessageIfNeeded",
|
8745
8756
|
value: function addSetupMessageIfNeeded(e, t) {
|
8746
|
-
var i =
|
8757
|
+
var i = Bo.getText(e, t);
|
8747
8758
|
if (i) {
|
8748
8759
|
var n = this.createAndAppendNewMessageElement(i, v.AI_ROLE);
|
8749
8760
|
this.applyCustomStyles(n, v.AI_ROLE, !1);
|
@@ -8751,24 +8762,27 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8751
8762
|
}
|
8752
8763
|
}, {
|
8753
8764
|
key: "addIntroductoryMessage",
|
8754
|
-
value: function addIntroductoryMessage(e) {
|
8755
|
-
var
|
8756
|
-
|
8757
|
-
|
8758
|
-
|
8759
|
-
|
8760
|
-
|
8761
|
-
|
8765
|
+
value: function addIntroductoryMessage(e, t) {
|
8766
|
+
var _this$_introMessage;
|
8767
|
+
var i, n, r, o;
|
8768
|
+
if (e != null && e.shadowRoot && t && (this._introMessage = e.introMessage, t.isWebModel() && ((_this$_introMessage = this._introMessage) !== null && _this$_introMessage !== void 0 ? _this$_introMessage : this._introMessage = t.getIntroMessage(e))), this._introMessage) {
|
8769
|
+
if ((i = this._introMessage) != null && i.text) {
|
8770
|
+
var a = this.createAndAppendNewMessageElement(this._introMessage.text, v.AI_ROLE);
|
8771
|
+
this.applyCustomStyles(a, v.AI_ROLE, !1, (n = this.messageStyles) == null ? void 0 : n.intro);
|
8772
|
+
} else if ((r = this._introMessage) != null && r.html) {
|
8773
|
+
var _a2 = Je.add(this, this._introMessage.html, v.AI_ROLE, this.messageElementRefs);
|
8774
|
+
this.applyCustomStyles(_a2, v.AI_ROLE, !1, (o = this.messageStyles) == null ? void 0 : o.intro);
|
8775
|
+
}
|
8762
8776
|
}
|
8763
8777
|
}
|
8764
8778
|
}, {
|
8765
8779
|
key: "populateInitialMessages",
|
8766
8780
|
value: function populateInitialMessages(e) {
|
8767
|
-
var
|
8781
|
+
var _this37 = this;
|
8768
8782
|
e.forEach(function (t) {
|
8769
|
-
Ae.processInitialMessageFile(t),
|
8783
|
+
Ae.processInitialMessageFile(t), _this37.addNewMessage(t, !0);
|
8770
8784
|
}), setTimeout(function () {
|
8771
|
-
return ne.scrollToBottom(
|
8785
|
+
return ne.scrollToBottom(_this37.elementRef);
|
8772
8786
|
});
|
8773
8787
|
}
|
8774
8788
|
// this should not be activated by streamed messages
|
@@ -9218,11 +9232,11 @@ var we = /*#__PURE__*/function () {
|
|
9218
9232
|
}();
|
9219
9233
|
var $i = /*#__PURE__*/function () {
|
9220
9234
|
function $i(e, t) {
|
9221
|
-
var
|
9235
|
+
var _this38 = this;
|
9222
9236
|
_classCallCheck(this, $i);
|
9223
9237
|
var i;
|
9224
9238
|
this._isOpen = !0, this._styles = t, this.elementRef = $i.createElement((i = this._styles) == null ? void 0 : i.container), this.close(), setTimeout(function () {
|
9225
|
-
return
|
9239
|
+
return _this38.addWindowEvents(e);
|
9226
9240
|
});
|
9227
9241
|
}
|
9228
9242
|
_createClass($i, [{
|
@@ -9250,13 +9264,13 @@ var $i = /*#__PURE__*/function () {
|
|
9250
9264
|
}, {
|
9251
9265
|
key: "addWindowEvents",
|
9252
9266
|
value: function addWindowEvents(e) {
|
9253
|
-
var
|
9267
|
+
var _this39 = this;
|
9254
9268
|
window.addEventListener("click", function (t) {
|
9255
9269
|
var i;
|
9256
|
-
e.parentElement !== ((i = t.target.shadowRoot) == null ? void 0 : i.children[0]) &&
|
9270
|
+
e.parentElement !== ((i = t.target.shadowRoot) == null ? void 0 : i.children[0]) && _this39.close();
|
9257
9271
|
}), window.addEventListener("keydown", function (t) {
|
9258
9272
|
var i, n, r;
|
9259
|
-
|
9273
|
+
_this39._isOpen && (t.key === R.ESCAPE ? (_this39.close(), (i = _this39.highlightedItem) == null || i.dispatchEvent(new MouseEvent("mouseleave"))) : t.key === R.ENTER ? ((n = _this39.highlightedItem) == null || n.click(), (r = _this39.highlightedItem) == null || r.dispatchEvent(new MouseEvent("mouseleave"))) : t.key === R.ARROW_DOWN ? ft.focusSiblingItem(_this39.highlightedItem || _this39.elementRef.children[_this39.elementRef.children.length - 1], _this39.elementRef, !0) : t.key === R.ARROW_UP && ft.focusSiblingItem(_this39.highlightedItem || _this39.elementRef.children[0], _this39.elementRef, !1));
|
9260
9274
|
});
|
9261
9275
|
}
|
9262
9276
|
}], [{
|
@@ -9272,15 +9286,15 @@ var We = /*#__PURE__*/function (_xt) {
|
|
9272
9286
|
_inherits(We, _xt);
|
9273
9287
|
var _super37 = _createSuper(We);
|
9274
9288
|
function We(e, t) {
|
9275
|
-
var
|
9289
|
+
var _this40;
|
9276
9290
|
_classCallCheck(this, We);
|
9277
9291
|
var n;
|
9278
|
-
|
9292
|
+
_this40 = _super37.call(this, We.createButtonElement(), void 0, {
|
9279
9293
|
styles: (n = t == null ? void 0 : t.button) == null ? void 0 : n.styles
|
9280
9294
|
});
|
9281
|
-
var i =
|
9282
|
-
|
9283
|
-
return
|
9295
|
+
var i = _this40.createInnerElements(_this40._customStyles);
|
9296
|
+
_this40._menu = new $i(e, t == null ? void 0 : t.menu), _this40.addClickEvent(), _this40.buttonContainer = We.createButtonContainer(), _this40.elementRef.appendChild(i.styles), _this40.buttonContainer.appendChild(_this40.elementRef), _this40.elementRef.classList.add("dropup-icon", "upload-file-button"), _this40.buttonContainer.appendChild(_this40._menu.elementRef), _this40.reapplyStateStyle("styles"), _this40.addContainerEvents(e);
|
9297
|
+
return _this40;
|
9284
9298
|
}
|
9285
9299
|
_createClass(We, [{
|
9286
9300
|
key: "createInnerElements",
|
@@ -9307,9 +9321,9 @@ var We = /*#__PURE__*/function (_xt) {
|
|
9307
9321
|
}, {
|
9308
9322
|
key: "addContainerEvents",
|
9309
9323
|
value: function addContainerEvents(e) {
|
9310
|
-
var
|
9324
|
+
var _this41 = this;
|
9311
9325
|
e.addEventListener("click", function (t) {
|
9312
|
-
t.target.classList.contains("dropup-icon") ||
|
9326
|
+
t.target.classList.contains("dropup-icon") || _this41._menu.close();
|
9313
9327
|
});
|
9314
9328
|
}
|
9315
9329
|
}], [{
|
@@ -9444,10 +9458,10 @@ var Uo = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 24 24\"
|
|
9444
9458
|
var de = /*#__PURE__*/function () {
|
9445
9459
|
// prettier-ignore
|
9446
9460
|
function de(e, t, i, n) {
|
9447
|
-
var
|
9461
|
+
var _this42 = this;
|
9448
9462
|
_classCallCheck(this, de);
|
9449
9463
|
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 () {
|
9450
|
-
|
9464
|
+
_this42._validationHandler = e._validationHandler;
|
9451
9465
|
});
|
9452
9466
|
}
|
9453
9467
|
_createClass(de, [{
|
@@ -9588,12 +9602,12 @@ var Ko = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9588
9602
|
_createClass(Se, [{
|
9589
9603
|
key: "createTimer",
|
9590
9604
|
value: function createTimer(e, t) {
|
9591
|
-
var
|
9605
|
+
var _this43 = this;
|
9592
9606
|
var i = 0;
|
9593
9607
|
var n = t !== void 0 && t < Se.TIMER_LIMIT_S ? t : Se.TIMER_LIMIT_S;
|
9594
9608
|
return setInterval(function () {
|
9595
9609
|
var a;
|
9596
|
-
i += 1, i === n && ((a =
|
9610
|
+
i += 1, i === n && ((a = _this43.stopPlaceholderCallback) == null || a.call(_this43), _this43.clearTimer()), i === 600 && e.classList.add("audio-placeholder-text-4-digits");
|
9597
9611
|
var r = Math.floor(i / 60),
|
9598
9612
|
o = (i % 60).toString().padStart(2, "0");
|
9599
9613
|
e.textContent = "".concat(r, ":").concat(o);
|
@@ -9613,7 +9627,7 @@ var Ko = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9613
9627
|
}, {
|
9614
9628
|
key: "addPlaceholderAudioAttachmentEvents",
|
9615
9629
|
value: function addPlaceholderAudioAttachmentEvents(e, t, i) {
|
9616
|
-
var
|
9630
|
+
var _this44 = this;
|
9617
9631
|
var n = function n() {
|
9618
9632
|
return e.replaceChildren(t);
|
9619
9633
|
};
|
@@ -9624,7 +9638,7 @@ var Ko = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9624
9638
|
e.addEventListener("mouseleave", r);
|
9625
9639
|
var o = function o() {
|
9626
9640
|
var a;
|
9627
|
-
return (a =
|
9641
|
+
return (a = _this44.stopPlaceholderCallback) == null ? void 0 : a.call(_this44);
|
9628
9642
|
};
|
9629
9643
|
e.addEventListener("click", o);
|
9630
9644
|
}
|
@@ -9749,7 +9763,7 @@ var Et = /*#__PURE__*/function () {
|
|
9749
9763
|
case 0:
|
9750
9764
|
_context87.next = 2;
|
9751
9765
|
return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
|
9752
|
-
var
|
9766
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee86(e) {
|
9753
9767
|
var t;
|
9754
9768
|
return _regeneratorRuntime().wrap(function _callee86$(_context86) {
|
9755
9769
|
while (1) switch (_context86.prev = _context86.next) {
|
@@ -9762,7 +9776,7 @@ var Et = /*#__PURE__*/function () {
|
|
9762
9776
|
}, _callee86);
|
9763
9777
|
}));
|
9764
9778
|
return function (_x155) {
|
9765
|
-
return
|
9779
|
+
return _ref11.apply(this, arguments);
|
9766
9780
|
};
|
9767
9781
|
}()));
|
9768
9782
|
case 2:
|
@@ -9819,20 +9833,20 @@ var ls = /*#__PURE__*/function () {
|
|
9819
9833
|
}, {
|
9820
9834
|
key: "addButtons",
|
9821
9835
|
value: function addButtons() {
|
9822
|
-
var
|
9836
|
+
var _this45 = this;
|
9823
9837
|
for (var _len2 = arguments.length, e = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
9824
9838
|
e[_key2] = arguments[_key2];
|
9825
9839
|
}
|
9826
9840
|
e.forEach(function (t) {
|
9827
|
-
return
|
9841
|
+
return _this45._buttonPanel.appendChild(t);
|
9828
9842
|
});
|
9829
9843
|
}
|
9830
9844
|
}, {
|
9831
9845
|
key: "close",
|
9832
9846
|
value: function close() {
|
9833
|
-
var
|
9847
|
+
var _this46 = this;
|
9834
9848
|
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 () {
|
9835
|
-
|
9849
|
+
_this46._elementRef.style.display = "none", _this46._backgroundPanelRef.style.display = "none";
|
9836
9850
|
}, ae.MODAL_CLOSE_TIMEOUT_MS);
|
9837
9851
|
}
|
9838
9852
|
}, {
|
@@ -9848,10 +9862,10 @@ var ls = /*#__PURE__*/function () {
|
|
9848
9862
|
}, {
|
9849
9863
|
key: "addCloseButton",
|
9850
9864
|
value: function addCloseButton(e, t, i) {
|
9851
|
-
var
|
9865
|
+
var _this47 = this;
|
9852
9866
|
var n = t ? ae.createSVGButton(e) : ae.createTextButton(e);
|
9853
9867
|
return this.addButtons(n), n.onclick = function () {
|
9854
|
-
|
9868
|
+
_this47.close(), setTimeout(function () {
|
9855
9869
|
i == null || i();
|
9856
9870
|
}, 140);
|
9857
9871
|
}, n;
|
@@ -9859,10 +9873,10 @@ var ls = /*#__PURE__*/function () {
|
|
9859
9873
|
}, {
|
9860
9874
|
key: "addWindowEvents",
|
9861
9875
|
value: function addWindowEvents() {
|
9862
|
-
var
|
9876
|
+
var _this48 = this;
|
9863
9877
|
window.addEventListener("keydown", function (e) {
|
9864
9878
|
var t, i;
|
9865
|
-
|
9879
|
+
_this48._isOpen && (e.key === R.ESCAPE ? (_this48.close(), (t = _this48.extensionCloseCallback) == null || t.call(_this48)) : e.key === R.ENTER && (_this48.close(), (i = _this48.extensionCloseCallback) == null || i.call(_this48)));
|
9866
9880
|
});
|
9867
9881
|
}
|
9868
9882
|
}], [{
|
@@ -9923,13 +9937,13 @@ var ct = /*#__PURE__*/function (_xt2) {
|
|
9923
9937
|
var _super39 = _createSuper(ct);
|
9924
9938
|
// prettier-ignore
|
9925
9939
|
function ct(e, t, i, n, r, o) {
|
9926
|
-
var
|
9940
|
+
var _this49;
|
9927
9941
|
_classCallCheck(this, ct);
|
9928
9942
|
var l, c, d, u, p, h;
|
9929
|
-
|
9930
|
-
var a =
|
9931
|
-
|
9932
|
-
return
|
9943
|
+
_this49 = _super39.call(this, ct.createButtonElement(), (l = i.button) == null ? void 0 : l.position, i.button, o);
|
9944
|
+
var a = _this49.createInnerElements(n, r, _this49._customStyles);
|
9945
|
+
_this49._inputElement = ct.createInputElement((c = i == null ? void 0 : i.files) == null ? void 0 : c.acceptedFormats), _this49.addClickEvent(e, i), _this49.elementRef.replaceChildren(a.styles), _this49.reapplyStateStyle("styles"), _this49._fileAttachmentsType = t, _this49._openModalOnce = ((u = (d = i.files) == null ? void 0 : d.infoModal) == null ? void 0 : u.openModalOnce) === !1 || (h = (p = i.files) == null ? void 0 : p.infoModal) == null ? void 0 : h.openModalOnce;
|
9946
|
+
return _this49;
|
9933
9947
|
}
|
9934
9948
|
_createClass(ct, [{
|
9935
9949
|
key: "createInnerElements",
|
@@ -10115,7 +10129,7 @@ var _e = /*#__PURE__*/function () {
|
|
10115
10129
|
value: function attach(e, t, i, n, r) {
|
10116
10130
|
var o = e.validateInput || Ae.processValidateInput(e);
|
10117
10131
|
e._validationHandler = /*#__PURE__*/function () {
|
10118
|
-
var
|
10132
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee90(a) {
|
10119
10133
|
var l;
|
10120
10134
|
return _regeneratorRuntime().wrap(function _callee90$(_context90) {
|
10121
10135
|
while (1) switch (_context90.prev = _context90.next) {
|
@@ -10135,7 +10149,7 @@ var _e = /*#__PURE__*/function () {
|
|
10135
10149
|
}, _callee90);
|
10136
10150
|
}));
|
10137
10151
|
return function (_x163) {
|
10138
|
-
return
|
10152
|
+
return _ref12.apply(this, arguments);
|
10139
10153
|
};
|
10140
10154
|
}();
|
10141
10155
|
}
|
@@ -10147,10 +10161,10 @@ var mt = /*#__PURE__*/function (_xt3) {
|
|
10147
10161
|
_inherits(mt, _xt3);
|
10148
10162
|
var _super40 = _createSuper(mt);
|
10149
10163
|
function mt(e) {
|
10150
|
-
var
|
10164
|
+
var _this50;
|
10151
10165
|
_classCallCheck(this, mt);
|
10152
|
-
(e == null ? void 0 : e.position) === "dropup-menu" && (e.position = "outside-right"),
|
10153
|
-
return
|
10166
|
+
(e == null ? void 0 : e.position) === "dropup-menu" && (e.position = "outside-right"), _this50 = _super40.call(this, mt.createMicrophoneElement(), e == null ? void 0 : e.position, e), _this50.isActive = !1, _this50._innerElements = _this50.createInnerElements(_this50._customStyles), _this50.changeToDefault();
|
10167
|
+
return _this50;
|
10154
10168
|
}
|
10155
10169
|
_createClass(mt, [{
|
10156
10170
|
key: "createInnerElements",
|
@@ -10357,9 +10371,9 @@ var J = /*#__PURE__*/function () {
|
|
10357
10371
|
}, {
|
10358
10372
|
key: "keyDownWindow",
|
10359
10373
|
value: function keyDownWindow(e) {
|
10360
|
-
var
|
10374
|
+
var _this51 = this;
|
10361
10375
|
e.element && J.getElementIfFocusedOnAvailable(e.element, document.activeElement) && (J.KEY_DOWN_TIMEOUT !== null && clearTimeout(J.KEY_DOWN_TIMEOUT), J.KEY_DOWN_TIMEOUT = setTimeout(function () {
|
10362
|
-
J.KEY_DOWN_TIMEOUT = null,
|
10376
|
+
J.KEY_DOWN_TIMEOUT = null, _this51.resetRecording(e);
|
10363
10377
|
}, 500));
|
10364
10378
|
}
|
10365
10379
|
}, {
|
@@ -10527,10 +10541,10 @@ var dt = /*#__PURE__*/function () {
|
|
10527
10541
|
i += a;
|
10528
10542
|
} else if (o.textContent !== null) {
|
10529
10543
|
if (i + o.textContent.length > t) {
|
10530
|
-
var
|
10531
|
-
|
10544
|
+
var _a3 = document.createRange();
|
10545
|
+
_a3.setStart(o, t - i), _a3.collapse(!0);
|
10532
10546
|
var l = window.getSelection();
|
10533
|
-
return l == null || l.removeAllRanges(), l == null || l.addRange(
|
10547
|
+
return l == null || l.removeAllRanges(), l == null || l.addRange(_a3), e.focus(), -1;
|
10534
10548
|
}
|
10535
10549
|
i += o.textContent.length, n += o.textContent.length;
|
10536
10550
|
}
|
@@ -10761,7 +10775,7 @@ Object.defineProperty(ai, "__esModule", {
|
|
10761
10775
|
ai.Padding = void 0;
|
10762
10776
|
var sa = De,
|
10763
10777
|
Sn = je,
|
10764
|
-
|
10778
|
+
Fe = Pe;
|
10765
10779
|
var Ht = /*#__PURE__*/function () {
|
10766
10780
|
function Ht() {
|
10767
10781
|
_classCallCheck(this, Ht);
|
@@ -10774,11 +10788,11 @@ var Ht = /*#__PURE__*/function () {
|
|
10774
10788
|
r = t.value[n - 1],
|
10775
10789
|
o = t.selectionEnd === null ? n : t.selectionEnd,
|
10776
10790
|
a = t.value[o];
|
10777
|
-
|
10791
|
+
Fe.Text.isCharDefined(r) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), Fe.Text.isCharDefined(a) && (e.endPadding = " ", e.numberOfSpacesAfterNewText = 1), e.isCursorAtEnd = t.value.length === o;
|
10778
10792
|
return;
|
10779
10793
|
}
|
10780
10794
|
var i = t.value[t.value.length - 1];
|
10781
|
-
|
10795
|
+
Fe.Text.isCharDefined(i) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), e.isCursorAtEnd = !0;
|
10782
10796
|
}
|
10783
10797
|
}, {
|
10784
10798
|
key: "setStateForGenericElement",
|
@@ -10791,12 +10805,12 @@ var Ht = /*#__PURE__*/function () {
|
|
10791
10805
|
c = (i = t.textContent) === null || i === void 0 ? void 0 : i[l - 1],
|
10792
10806
|
d = Sn.Cursor.getGenericElementCursorOffset(t, a, !1),
|
10793
10807
|
u = (n = t.textContent) === null || n === void 0 ? void 0 : n[d];
|
10794
|
-
|
10808
|
+
Fe.Text.isCharDefined(c) && (e.startPadding = " "), Fe.Text.isCharDefined(u) && (e.endPadding = " "), e.isCursorAtEnd = ((r = t.textContent) === null || r === void 0 ? void 0 : r.length) === d;
|
10795
10809
|
return;
|
10796
10810
|
}
|
10797
10811
|
}
|
10798
10812
|
var o = t.innerText.charAt(t.innerText.length - 1);
|
10799
|
-
|
10813
|
+
Fe.Text.isCharDefined(o) && (e.startPadding = " "), e.isCursorAtEnd = !0;
|
10800
10814
|
}
|
10801
10815
|
}, {
|
10802
10816
|
key: "setState",
|
@@ -10980,22 +10994,22 @@ var Gt = /*#__PURE__*/function (_aa$Speech) {
|
|
10980
10994
|
}, {
|
10981
10995
|
key: "setEvents",
|
10982
10996
|
value: function setEvents() {
|
10983
|
-
var
|
10997
|
+
var _this52 = this;
|
10984
10998
|
this._service && (this._service.onstart = function () {
|
10985
|
-
|
10999
|
+
_this52.setStateOnStart();
|
10986
11000
|
}, this._service.onerror = function (e) {
|
10987
|
-
An.Browser.IS_SAFARI() && e.message === "Another request is started" || e.error === "aborted" &&
|
11001
|
+
An.Browser.IS_SAFARI() && e.message === "Another request is started" || e.error === "aborted" && _this52.isRestarting || e.error !== "no-speech" && _this52.error(e.message || e.error);
|
10988
11002
|
}, this._service.onaudioend = function () {
|
10989
|
-
|
11003
|
+
_this52.setStateOnStop();
|
10990
11004
|
}, this._service.onend = function () {
|
10991
|
-
|
11005
|
+
_this52._stopping = !1;
|
10992
11006
|
}, this._service.onresult = function (e) {
|
10993
|
-
if (_typeof(e.results) > "u" &&
|
10994
|
-
var
|
10995
|
-
t =
|
10996
|
-
i =
|
10997
|
-
n =
|
10998
|
-
|
11007
|
+
if (_typeof(e.results) > "u" && _this52._service) _this52._service.onend = null, _this52._service.stop();else if (_this52._extractText && !_this52._stopping) {
|
11008
|
+
var _this52$_extractText = _this52._extractText(e, _this52.finalTranscript, _this52._translations),
|
11009
|
+
t = _this52$_extractText.interimTranscript,
|
11010
|
+
i = _this52$_extractText.finalTranscript,
|
11011
|
+
n = _this52$_extractText.newText;
|
11012
|
+
_this52.updateElements(t, i, n);
|
10999
11013
|
}
|
11000
11014
|
});
|
11001
11015
|
}
|
@@ -11215,10 +11229,10 @@ var Wt = /*#__PURE__*/function (_ua$Speech) {
|
|
11215
11229
|
_inherits(Wt, _ua$Speech);
|
11216
11230
|
var _super42 = _createSuper(Wt);
|
11217
11231
|
function Wt() {
|
11218
|
-
var
|
11232
|
+
var _this53;
|
11219
11233
|
_classCallCheck(this, Wt);
|
11220
|
-
|
11221
|
-
return
|
11234
|
+
_this53 = _super42.apply(this, arguments), _this53._newTextPadding = "";
|
11235
|
+
return _this53;
|
11222
11236
|
}
|
11223
11237
|
_createClass(Wt, [{
|
11224
11238
|
key: "start",
|
@@ -11346,12 +11360,12 @@ var Wt = /*#__PURE__*/function (_ua$Speech) {
|
|
11346
11360
|
}, {
|
11347
11361
|
key: "retrieveTokenInterval",
|
11348
11362
|
value: function retrieveTokenInterval(e) {
|
11349
|
-
var
|
11363
|
+
var _this54 = this;
|
11350
11364
|
this._retrieveTokenInterval = setInterval(function () {
|
11351
11365
|
e == null || e().then(function (t) {
|
11352
|
-
|
11366
|
+
_this54._service && (_this54._service.authorizationToken = (t == null ? void 0 : t.trim()) || "");
|
11353
11367
|
})["catch"](function (t) {
|
11354
|
-
|
11368
|
+
_this54.error(t);
|
11355
11369
|
});
|
11356
11370
|
}, 1e4);
|
11357
11371
|
}
|
@@ -11433,18 +11447,18 @@ var Kt = /*#__PURE__*/function (_mt) {
|
|
11433
11447
|
_inherits(Kt, _mt);
|
11434
11448
|
var _super43 = _createSuper(Kt);
|
11435
11449
|
function Kt(e, t, i) {
|
11436
|
-
var
|
11450
|
+
var _this55;
|
11437
11451
|
_classCallCheck(this, Kt);
|
11438
11452
|
var o;
|
11439
|
-
|
11453
|
+
_this55 = _super43.call(this, _typeof(e.speechToText) == "object" ? (o = e.speechToText) == null ? void 0 : o.button : {});
|
11440
11454
|
var _Kt$processConfigurat = Kt.processConfiguration(t, e.speechToText),
|
11441
11455
|
n = _Kt$processConfigurat.serviceName,
|
11442
11456
|
r = _Kt$processConfigurat.processedConfig;
|
11443
|
-
if (
|
11457
|
+
if (_this55._addErrorMessage = i, n === "webspeech" && !Ci.isWebSpeechSupported()) _this55.changeToUnsupported();else {
|
11444
11458
|
var a = !e.textInput || !e.textInput.disabled;
|
11445
|
-
|
11459
|
+
_this55.elementRef.onclick = _this55.buttonClick.bind(_assertThisInitialized(_this55), t, a, n, r);
|
11446
11460
|
}
|
11447
|
-
return
|
11461
|
+
return _this55;
|
11448
11462
|
}
|
11449
11463
|
// prettier-ignore
|
11450
11464
|
_createClass(Kt, [{
|
@@ -11525,11 +11539,11 @@ var fa = /*#__PURE__*/function (_mt2) {
|
|
11525
11539
|
_inherits(fa, _mt2);
|
11526
11540
|
var _super44 = _createSuper(fa);
|
11527
11541
|
function fa(e, t) {
|
11528
|
-
var
|
11542
|
+
var _this56;
|
11529
11543
|
_classCallCheck(this, fa);
|
11530
11544
|
var i, n;
|
11531
|
-
|
11532
|
-
return
|
11545
|
+
_this56 = _super44.call(this, t.button), _this56._waitingForBrowserApproval = !1, _this56._audioType = e, _this56._extension = ((i = t.files) == null ? void 0 : i.format) || "mp3", _this56._maxDurationSeconds = (n = t.files) == null ? void 0 : n.maxDurationSeconds, _this56.elementRef.onclick = _this56.buttonClick.bind(_assertThisInitialized(_this56));
|
11546
|
+
return _this56;
|
11533
11547
|
}
|
11534
11548
|
_createClass(fa, [{
|
11535
11549
|
key: "buttonClick",
|
@@ -11539,10 +11553,10 @@ var fa = /*#__PURE__*/function (_mt2) {
|
|
11539
11553
|
}, {
|
11540
11554
|
key: "stop",
|
11541
11555
|
value: function stop() {
|
11542
|
-
var
|
11556
|
+
var _this57 = this;
|
11543
11557
|
return new Promise(function (e) {
|
11544
11558
|
var t, i;
|
11545
|
-
|
11559
|
+
_this57.changeToDefault(), (t = _this57._mediaRecorder) == null || t.stop(), (i = _this57._mediaStream) == null || i.getTracks().forEach(function (n) {
|
11546
11560
|
return n.stop();
|
11547
11561
|
}), setTimeout(function () {
|
11548
11562
|
e();
|
@@ -11552,23 +11566,23 @@ var fa = /*#__PURE__*/function (_mt2) {
|
|
11552
11566
|
}, {
|
11553
11567
|
key: "record",
|
11554
11568
|
value: function record() {
|
11555
|
-
var
|
11569
|
+
var _this58 = this;
|
11556
11570
|
navigator.mediaDevices.getUserMedia({
|
11557
11571
|
audio: !0
|
11558
11572
|
}).then(function (e) {
|
11559
|
-
|
11560
|
-
|
11561
|
-
}),
|
11573
|
+
_this58.changeToActive(), _this58._mediaRecorder = new MediaRecorder(e), _this58._audioType.addPlaceholderAttachment(_this58.stop.bind(_this58), _this58._maxDurationSeconds), _this58._mediaStream = e, _this58._mediaRecorder.addEventListener("dataavailable", function (t) {
|
11574
|
+
_this58.createFile(t);
|
11575
|
+
}), _this58._mediaRecorder.start();
|
11562
11576
|
})["catch"](function (e) {
|
11563
|
-
console.error(e),
|
11577
|
+
console.error(e), _this58.stop();
|
11564
11578
|
})["finally"](function () {
|
11565
|
-
|
11579
|
+
_this58._waitingForBrowserApproval = !1;
|
11566
11580
|
});
|
11567
11581
|
}
|
11568
11582
|
}, {
|
11569
11583
|
key: "createFile",
|
11570
11584
|
value: function createFile(e) {
|
11571
|
-
var
|
11585
|
+
var _this59 = this;
|
11572
11586
|
var t = new Blob([e.data], {
|
11573
11587
|
type: "audio/".concat(this._extension)
|
11574
11588
|
}),
|
@@ -11578,49 +11592,49 @@ var fa = /*#__PURE__*/function (_mt2) {
|
|
11578
11592
|
}),
|
11579
11593
|
r = new FileReader();
|
11580
11594
|
r.readAsDataURL(n), r.onload = function (o) {
|
11581
|
-
|
11595
|
+
_this59._audioType.completePlaceholderAttachment(n, o.target.result);
|
11582
11596
|
};
|
11583
11597
|
}
|
11584
11598
|
}]);
|
11585
11599
|
return fa;
|
11586
11600
|
}(mt);
|
11587
11601
|
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";
|
11588
|
-
var
|
11589
|
-
function
|
11590
|
-
_classCallCheck(this,
|
11602
|
+
var B = /*#__PURE__*/function () {
|
11603
|
+
function B() {
|
11604
|
+
_classCallCheck(this, B);
|
11591
11605
|
}
|
11592
|
-
_createClass(
|
11606
|
+
_createClass(B, null, [{
|
11593
11607
|
key: "setPropertyValueIfDoesNotExist",
|
11594
11608
|
value: function setPropertyValueIfDoesNotExist(e, t, i) {
|
11595
11609
|
var _e$n, _e$n2;
|
11596
11610
|
var n = t[0];
|
11597
|
-
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(),
|
11611
|
+
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(), B.setPropertyValueIfDoesNotExist(e[n], t, i));
|
11598
11612
|
}
|
11599
11613
|
}, {
|
11600
11614
|
key: "setPropertyValue",
|
11601
11615
|
value: function setPropertyValue(e, t, i) {
|
11602
11616
|
var _e$n3;
|
11603
11617
|
var n = t[0];
|
11604
|
-
t.length === 1 ? e[n] = i : ((_e$n3 = e[n]) !== null && _e$n3 !== void 0 ? _e$n3 : e[n] = {}, t.shift(),
|
11618
|
+
t.length === 1 ? e[n] = i : ((_e$n3 = e[n]) !== null && _e$n3 !== void 0 ? _e$n3 : e[n] = {}, t.shift(), B.setPropertyValue(e[n], t, i));
|
11605
11619
|
}
|
11606
11620
|
}, {
|
11607
11621
|
key: "getObjectValue",
|
11608
11622
|
value: function getObjectValue(e, t) {
|
11609
11623
|
var i = t[0],
|
11610
11624
|
n = e[i];
|
11611
|
-
return n === void 0 || t.length === 1 ? n :
|
11625
|
+
return n === void 0 || t.length === 1 ? n : B.getObjectValue(n, t.slice(1));
|
11612
11626
|
}
|
11613
11627
|
}, {
|
11614
11628
|
key: "overwritePropertyObjectFromAnother",
|
11615
11629
|
value: function overwritePropertyObjectFromAnother(e, t, i) {
|
11616
|
-
var n =
|
11630
|
+
var n = B.getObjectValue(t, i);
|
11617
11631
|
if (n) {
|
11618
|
-
var r = _objectSpread(_objectSpread({}, n),
|
11619
|
-
|
11632
|
+
var r = _objectSpread(_objectSpread({}, n), B.getObjectValue(e, i) || {});
|
11633
|
+
B.setPropertyValue(e, i, r);
|
11620
11634
|
}
|
11621
11635
|
}
|
11622
11636
|
}]);
|
11623
|
-
return
|
11637
|
+
return B;
|
11624
11638
|
}();
|
11625
11639
|
var Te = /*#__PURE__*/function () {
|
11626
11640
|
function Te() {
|
@@ -11636,13 +11650,13 @@ var Te = /*#__PURE__*/function () {
|
|
11636
11650
|
value: function overwriteDefaultStyleWithSubmit(e, t) {
|
11637
11651
|
if (!e.submit) return;
|
11638
11652
|
var i = JSON.parse(JSON.stringify(e[t] || {}));
|
11639
|
-
|
11653
|
+
B.overwritePropertyObjectFromAnother(i, e.submit, ["container", "default"]), B.overwritePropertyObjectFromAnother(i, e.submit, ["text", "styles", "default"]), B.overwritePropertyObjectFromAnother(i, e.submit, ["svg", "styles", "default"]), e[t] = i;
|
11640
11654
|
}
|
11641
11655
|
// prettier-ignore
|
11642
11656
|
}, {
|
11643
11657
|
key: "setUpDisabledButton",
|
11644
11658
|
value: function setUpDisabledButton(e) {
|
11645
|
-
|
11659
|
+
B.setPropertyValueIfDoesNotExist(e, ["submit", "container", "default", "backgroundColor"], ""), B.setPropertyValueIfDoesNotExist(e, ["disabled", "container", "default", "backgroundColor"], "unset"), B.setPropertyValueIfDoesNotExist(e.submit, ["svg", "styles", "default", "filter"], ""), B.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");
|
11646
11660
|
}
|
11647
11661
|
}, {
|
11648
11662
|
key: "process",
|
@@ -11658,19 +11672,19 @@ var mi = /*#__PURE__*/function (_xt4) {
|
|
11658
11672
|
var _super45 = _createSuper(k);
|
11659
11673
|
// prettier-ignore
|
11660
11674
|
function k(e, t, i, n, r) {
|
11661
|
-
var
|
11675
|
+
var _this60;
|
11662
11676
|
_classCallCheck(this, k);
|
11663
11677
|
var o = Te.process(e.submitButtonStyles);
|
11664
|
-
|
11678
|
+
_this60 = _super45.call(this, k.createButtonContainerElement(), o == null ? void 0 : o.position, o), _this60._isSVGLoadingIconOverriden = !1, _this60.status = {
|
11665
11679
|
requestInProgress: !1,
|
11666
11680
|
loadingActive: !1
|
11667
|
-
},
|
11681
|
+
}, _this60._messages = i, _this60._inputElementRef = t, _this60._fileAttachments = r, _this60._innerElements = _this60.createInnerElements(), _this60._abortStream = new AbortController(), _this60._stopClicked = {
|
11668
11682
|
listener: function listener() {}
|
11669
|
-
},
|
11683
|
+
}, _this60._serviceIO = n, _this60._alwaysEnabled = !!(o != null && o.alwaysEnabled), e.disableSubmitButton = _this60.disableSubmitButton.bind(_assertThisInitialized(_this60), n), _this60.attemptOverwriteLoadingStyle(e), setTimeout(function () {
|
11670
11684
|
var a;
|
11671
|
-
|
11685
|
+
_this60._validationHandler = e._validationHandler, _this60.assignHandlers(_this60._validationHandler), (a = _this60._validationHandler) == null || a.call(_assertThisInitialized(_this60));
|
11672
11686
|
});
|
11673
|
-
return
|
11687
|
+
return _this60;
|
11674
11688
|
}
|
11675
11689
|
// prettier-ignore
|
11676
11690
|
_createClass(k, [{
|
@@ -11759,7 +11773,7 @@ var mi = /*#__PURE__*/function (_xt4) {
|
|
11759
11773
|
key: "programmaticSubmit",
|
11760
11774
|
value: function () {
|
11761
11775
|
var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee96(e) {
|
11762
|
-
var
|
11776
|
+
var _this61 = this;
|
11763
11777
|
var t;
|
11764
11778
|
return _regeneratorRuntime().wrap(function _callee96$(_context96) {
|
11765
11779
|
while (1) switch (_context96.prev = _context96.next) {
|
@@ -11774,7 +11788,7 @@ var mi = /*#__PURE__*/function (_xt4) {
|
|
11774
11788
|
type: de.getTypeFromBlob(i)
|
11775
11789
|
};
|
11776
11790
|
})), setTimeout(function () {
|
11777
|
-
return
|
11791
|
+
return _this61.attemptSubmit(t, !0);
|
11778
11792
|
});
|
11779
11793
|
case 3:
|
11780
11794
|
case "end":
|
@@ -11818,7 +11832,7 @@ var mi = /*#__PURE__*/function (_xt4) {
|
|
11818
11832
|
return this.addNewMessage(e);
|
11819
11833
|
case 10:
|
11820
11834
|
this._serviceIO.isWebModel() || this._messages.addLoadingMessage();
|
11821
|
-
|
11835
|
+
Bi.clear(this._inputElementRef);
|
11822
11836
|
i = (o = e.files) == null ? void 0 : o.map(function (l) {
|
11823
11837
|
return l.file;
|
11824
11838
|
}), n = {
|
@@ -11843,12 +11857,12 @@ var mi = /*#__PURE__*/function (_xt4) {
|
|
11843
11857
|
}, {
|
11844
11858
|
key: "addNewMessage",
|
11845
11859
|
value: function () {
|
11846
|
-
var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee98(
|
11860
|
+
var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee98(_ref13) {
|
11847
11861
|
var e, t, i;
|
11848
11862
|
return _regeneratorRuntime().wrap(function _callee98$(_context98) {
|
11849
11863
|
while (1) switch (_context98.prev = _context98.next) {
|
11850
11864
|
case 0:
|
11851
|
-
e =
|
11865
|
+
e = _ref13.text, t = _ref13.files;
|
11852
11866
|
i = {
|
11853
11867
|
role: v.USER_ROLE
|
11854
11868
|
};
|
@@ -11952,14 +11966,14 @@ var Xi = /*#__PURE__*/function (_rt) {
|
|
11952
11966
|
var _super46 = _createSuper(Xi);
|
11953
11967
|
// prettier-ignore
|
11954
11968
|
function Xi(e, t, i, n) {
|
11955
|
-
var
|
11969
|
+
var _this62;
|
11956
11970
|
_classCallCheck(this, Xi);
|
11957
|
-
|
11958
|
-
var
|
11959
|
-
r =
|
11960
|
-
o =
|
11961
|
-
|
11962
|
-
return
|
11971
|
+
_this62 = _super46.call(this, e, ["modal-content", "modal-camera-content"], i), _this62._stopped = !1, _this62._format = "image/png", _this62._canvas = document.createElement("canvas"), _this62._canvas.classList.add("camera-modal-canvas");
|
11972
|
+
var _this62$addButtonsAnd = _this62.addButtonsAndTheirEvents(t),
|
11973
|
+
r = _this62$addButtonsAnd.captureButton,
|
11974
|
+
o = _this62$addButtonsAnd.submitButton;
|
11975
|
+
_this62._captureButton = r, _this62._submitButton = o, _this62._captureIcon = _this62._captureButton.children[0], _this62._refreshIcon = U.createSVGElement(ba), _this62._refreshIcon.classList.add("modal-svg-button-icon", "modal-svg-refresh-icon"), (n == null ? void 0 : n.format) === "jpeg" && (_this62._format = "image/jpeg"), n != null && n.dimensions && (_this62._dimensions = n.dimensions), _this62._contentRef.appendChild(_this62._canvas), _this62.extensionCloseCallback = _this62.stop;
|
11976
|
+
return _this62;
|
11963
11977
|
}
|
11964
11978
|
_createClass(Xi, [{
|
11965
11979
|
key: "addButtonsAndTheirEvents",
|
@@ -11978,38 +11992,38 @@ var Xi = /*#__PURE__*/function (_rt) {
|
|
11978
11992
|
}, {
|
11979
11993
|
key: "addButtonEvents",
|
11980
11994
|
value: function addButtonEvents(e, t, i, n) {
|
11981
|
-
var
|
11995
|
+
var _this63 = this;
|
11982
11996
|
e.onclick = function () {
|
11983
|
-
|
11997
|
+
_this63.capture();
|
11984
11998
|
}, t.addEventListener("click", this.stop.bind(this)), i.onclick = function () {
|
11985
|
-
var r =
|
11986
|
-
r && Et.addFilesToType([r], [n]),
|
11999
|
+
var r = _this63.getFile();
|
12000
|
+
r && Et.addFilesToType([r], [n]), _this63.stop(), _this63.close();
|
11987
12001
|
};
|
11988
12002
|
}
|
11989
12003
|
}, {
|
11990
12004
|
key: "stop",
|
11991
12005
|
value: function stop() {
|
11992
|
-
var
|
12006
|
+
var _this64 = this;
|
11993
12007
|
this._mediaStream && this._mediaStream.getTracks().forEach(function (e) {
|
11994
12008
|
return e.stop();
|
11995
12009
|
}), this._stopped = !0, setTimeout(function () {
|
11996
|
-
|
11997
|
-
var e =
|
11998
|
-
e == null || e.clearRect(0, 0,
|
12010
|
+
_this64._captureButton.replaceChildren(_this64._captureIcon), _this64._captureButton.classList.replace("modal-svg-refresh-button", "modal-svg-camera-button");
|
12011
|
+
var e = _this64._canvas.getContext("2d");
|
12012
|
+
e == null || e.clearRect(0, 0, _this64._canvas.width, _this64._canvas.height);
|
11999
12013
|
}, rt.MODAL_CLOSE_TIMEOUT_MS);
|
12000
12014
|
}
|
12001
12015
|
}, {
|
12002
12016
|
key: "start",
|
12003
12017
|
value: function start() {
|
12004
|
-
var
|
12018
|
+
var _this65 = this;
|
12005
12019
|
this._dataURL = void 0, this._submitButton.classList.add("modal-svg-submit-disabled"), this._stopped = !1, navigator.mediaDevices.getUserMedia({
|
12006
12020
|
video: this._dimensions || !0
|
12007
12021
|
}).then(function (e) {
|
12008
|
-
if (
|
12022
|
+
if (_this65._mediaStream = e, !_this65.isOpen()) return _this65.stop();
|
12009
12023
|
var t = document.createElement("video");
|
12010
|
-
t.srcObject = e, t.play(), requestAnimationFrame(
|
12024
|
+
t.srcObject = e, t.play(), requestAnimationFrame(_this65.updateCanvas.bind(_this65, t, _this65._canvas));
|
12011
12025
|
})["catch"](function (e) {
|
12012
|
-
console.error(e),
|
12026
|
+
console.error(e), _this65.stop(), _this65.close();
|
12013
12027
|
});
|
12014
12028
|
}
|
12015
12029
|
}, {
|
@@ -12067,13 +12081,13 @@ var Jt = /*#__PURE__*/function (_xt5) {
|
|
12067
12081
|
_inherits(Jt, _xt5);
|
12068
12082
|
var _super47 = _createSuper(Jt);
|
12069
12083
|
function Jt(e, t, i) {
|
12070
|
-
var
|
12084
|
+
var _this66;
|
12071
12085
|
_classCallCheck(this, Jt);
|
12072
12086
|
var r;
|
12073
|
-
|
12074
|
-
var n =
|
12075
|
-
i &&
|
12076
|
-
return
|
12087
|
+
_this66 = _super47.call(this, Jt.createButtonElement(), (r = i == null ? void 0 : i.button) == null ? void 0 : r.position, (i == null ? void 0 : i.button) || {}, "Photo");
|
12088
|
+
var n = _this66.createInnerElements(_this66._customStyles);
|
12089
|
+
i && _this66.addClickEvent(e, t, i.modalContainerStyle, i.files), _this66.elementRef.classList.add("upload-file-button"), _this66.elementRef.appendChild(n.styles), _this66.reapplyStateStyle("styles");
|
12090
|
+
return _this66;
|
12077
12091
|
}
|
12078
12092
|
_createClass(Jt, [{
|
12079
12093
|
key: "createInnerElements",
|
@@ -12115,7 +12129,7 @@ var ut = /*#__PURE__*/function () {
|
|
12115
12129
|
function ut(e, t, i, n) {
|
12116
12130
|
_classCallCheck(this, ut);
|
12117
12131
|
this.elementRef = ut.createPanelElement(e.inputAreaStyle);
|
12118
|
-
var r = new
|
12132
|
+
var r = new Bi(e, i),
|
12119
12133
|
o = {},
|
12120
12134
|
a = this.createFileUploadComponents(e, i, n, o);
|
12121
12135
|
e.speechToText && !o.microphone && (o.microphone = {
|
@@ -12194,7 +12208,7 @@ var Qi = /*#__PURE__*/function () {
|
|
12194
12208
|
key: "createElements",
|
12195
12209
|
value: function createElements(e, t, i) {
|
12196
12210
|
var n = document.createElement("div");
|
12197
|
-
n.id = "chat-view"
|
12211
|
+
n.id = "chat-view";
|
12198
12212
|
var r = new fe(e, t, i);
|
12199
12213
|
t.websocket && Y.createConnection(t, r);
|
12200
12214
|
var o = new ut(e, r, t, n);
|
@@ -12220,22 +12234,22 @@ var b = /*#__PURE__*/function (_co) {
|
|
12220
12234
|
_inherits(b, _co);
|
12221
12235
|
var _super48 = _createSuper(b);
|
12222
12236
|
function b() {
|
12223
|
-
var
|
12237
|
+
var _this67;
|
12224
12238
|
_classCallCheck(this, b);
|
12225
|
-
|
12239
|
+
_this67 = _super48.call(this), _this67.getMessages = function () {
|
12226
12240
|
return [];
|
12227
|
-
},
|
12241
|
+
}, _this67.submitUserMessage = function () {
|
12228
12242
|
return console.warn("submitUserMessage failed - please wait for chat view to render before calling this property.");
|
12229
|
-
},
|
12243
|
+
}, _this67.addMessage = function () {
|
12230
12244
|
return console.warn("addMessage failed - please wait for chat view to render before calling this property.");
|
12231
|
-
},
|
12232
|
-
return Yt.focusFromParentElement(
|
12233
|
-
},
|
12245
|
+
}, _this67.focusInput = function () {
|
12246
|
+
return Yt.focusFromParentElement(_this67._elementRef);
|
12247
|
+
}, _this67.refreshMessages = function () {}, _this67.clearMessages = function () {}, _this67.scrollToBottom = function () {}, _this67.disableSubmitButton = function () {}, _this67.onNewMessage = function () {}, _this67.onClearMessages = function () {}, _this67.onComponentRender = function () {}, _this67._hasBeenRendered = !1, _this67._auxiliaryStyleApplied = !1, jo.appendStyleSheetToHead(), _this67._elementRef = document.createElement("div"), _this67._elementRef.id = "container", _this67.attachShadow({
|
12234
12248
|
mode: "open"
|
12235
|
-
}).appendChild(
|
12236
|
-
|
12249
|
+
}).appendChild(_this67._elementRef), bi.apply(Sa, _this67.shadowRoot), setTimeout(function () {
|
12250
|
+
_this67._hasBeenRendered || _this67.onRender();
|
12237
12251
|
}, 20);
|
12238
|
-
return
|
12252
|
+
return _this67;
|
12239
12253
|
}
|
12240
12254
|
_createClass(b, [{
|
12241
12255
|
key: "changeToChatView",
|