deep-chat-dev 9.0.87 → 9.0.89
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 +3838 -3809
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.js +261 -248
- package/dist/services/serviceIOFactory.d.ts.map +1 -1
- 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
|
+
console.log("call"), console.log(_this33._downloadButton), console.log(n), _this33._downloadButton && n && (_this33._downloadButton.disabled = !1);
|
8133
|
+
}, 10);
|
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
|
@@ -8480,7 +8491,6 @@ var Do = /*#__PURE__*/function () {
|
|
8480
8491
|
_createClass(Do, null, [{
|
8481
8492
|
key: "create",
|
8482
8493
|
value: function create(e) {
|
8483
|
-
console.log("creating a new service");
|
8484
8494
|
var t = e.directConnection,
|
8485
8495
|
i = e.request,
|
8486
8496
|
n = e.demo,
|
@@ -8497,7 +8507,7 @@ var Do = /*#__PURE__*/function () {
|
|
8497
8507
|
if (t.azure.summarization) return new Ao(e);
|
8498
8508
|
if (t.azure.translation) return new Lo(e);
|
8499
8509
|
}
|
8500
|
-
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);
|
8501
8511
|
}
|
8502
8512
|
return i ? new Ie(e) : new Ie(e, void 0, n || !0);
|
8503
8513
|
}
|
@@ -8615,11 +8625,11 @@ var qt = /*#__PURE__*/function () {
|
|
8615
8625
|
}]);
|
8616
8626
|
return qt;
|
8617
8627
|
}();
|
8618
|
-
var
|
8619
|
-
function
|
8620
|
-
_classCallCheck(this,
|
8628
|
+
var Bo = /*#__PURE__*/function () {
|
8629
|
+
function Bo() {
|
8630
|
+
_classCallCheck(this, Bo);
|
8621
8631
|
}
|
8622
|
-
_createClass(
|
8632
|
+
_createClass(Bo, null, [{
|
8623
8633
|
key: "getText",
|
8624
8634
|
value: function getText(e, t) {
|
8625
8635
|
var i, n;
|
@@ -8634,9 +8644,9 @@ var Fo = /*#__PURE__*/function () {
|
|
8634
8644
|
return null;
|
8635
8645
|
}
|
8636
8646
|
}]);
|
8637
|
-
return
|
8647
|
+
return Bo;
|
8638
8648
|
}();
|
8639
|
-
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>";
|
8640
8650
|
var pe = /*#__PURE__*/function () {
|
8641
8651
|
function pe() {
|
8642
8652
|
_classCallCheck(this, pe);
|
@@ -8690,7 +8700,7 @@ var pe = /*#__PURE__*/function () {
|
|
8690
8700
|
t.classList.add("any-file-message-contents");
|
8691
8701
|
var i = document.createElement("div");
|
8692
8702
|
i.classList.add("any-file-message-icon-container");
|
8693
|
-
var n = U.createSVGElement(
|
8703
|
+
var n = U.createSVGElement(Fo);
|
8694
8704
|
n.classList.add("any-file-message-icon"), i.appendChild(n);
|
8695
8705
|
var r = document.createElement("div");
|
8696
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);
|
@@ -8718,23 +8728,23 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8718
8728
|
_inherits(fe, _Ve);
|
8719
8729
|
var _super36 = _createSuper(fe);
|
8720
8730
|
function fe(e, t, i) {
|
8721
|
-
var
|
8731
|
+
var _this36;
|
8722
8732
|
_classCallCheck(this, fe);
|
8723
8733
|
var a, l;
|
8724
|
-
|
8734
|
+
_this36 = _super36.call(this, e);
|
8725
8735
|
var n = t.permittedErrorPrefixes,
|
8726
8736
|
r = t.introPanelMarkUp,
|
8727
8737
|
o = t.demo;
|
8728
|
-
|
8729
|
-
return JSON.parse(JSON.stringify(
|
8730
|
-
}, e.clearMessages =
|
8731
|
-
|
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), {}, {
|
8732
8742
|
sendUpdate: !!d
|
8733
8743
|
}), !d);
|
8734
|
-
}, t.addMessage =
|
8735
|
-
|
8744
|
+
}, t.addMessage = _this36.addIOMessage.bind(_assertThisInitialized(_this36)), o && _this36.prepareDemo(o), e.textToSpeech && Lt.processConfig(e.textToSpeech, function (c) {
|
8745
|
+
_this36.textToSpeech = c;
|
8736
8746
|
});
|
8737
|
-
return
|
8747
|
+
return _this36;
|
8738
8748
|
}
|
8739
8749
|
_createClass(fe, [{
|
8740
8750
|
key: "prepareDemo",
|
@@ -8744,7 +8754,7 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8744
8754
|
}, {
|
8745
8755
|
key: "addSetupMessageIfNeeded",
|
8746
8756
|
value: function addSetupMessageIfNeeded(e, t) {
|
8747
|
-
var i =
|
8757
|
+
var i = Bo.getText(e, t);
|
8748
8758
|
if (i) {
|
8749
8759
|
var n = this.createAndAppendNewMessageElement(i, v.AI_ROLE);
|
8750
8760
|
this.applyCustomStyles(n, v.AI_ROLE, !1);
|
@@ -8752,24 +8762,27 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8752
8762
|
}
|
8753
8763
|
}, {
|
8754
8764
|
key: "addIntroductoryMessage",
|
8755
|
-
value: function addIntroductoryMessage(e) {
|
8756
|
-
var
|
8757
|
-
|
8758
|
-
|
8759
|
-
|
8760
|
-
|
8761
|
-
|
8762
|
-
|
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
|
+
}
|
8763
8776
|
}
|
8764
8777
|
}
|
8765
8778
|
}, {
|
8766
8779
|
key: "populateInitialMessages",
|
8767
8780
|
value: function populateInitialMessages(e) {
|
8768
|
-
var
|
8781
|
+
var _this37 = this;
|
8769
8782
|
e.forEach(function (t) {
|
8770
|
-
Ae.processInitialMessageFile(t),
|
8783
|
+
Ae.processInitialMessageFile(t), _this37.addNewMessage(t, !0);
|
8771
8784
|
}), setTimeout(function () {
|
8772
|
-
return ne.scrollToBottom(
|
8785
|
+
return ne.scrollToBottom(_this37.elementRef);
|
8773
8786
|
});
|
8774
8787
|
}
|
8775
8788
|
// this should not be activated by streamed messages
|
@@ -9219,11 +9232,11 @@ var we = /*#__PURE__*/function () {
|
|
9219
9232
|
}();
|
9220
9233
|
var $i = /*#__PURE__*/function () {
|
9221
9234
|
function $i(e, t) {
|
9222
|
-
var
|
9235
|
+
var _this38 = this;
|
9223
9236
|
_classCallCheck(this, $i);
|
9224
9237
|
var i;
|
9225
9238
|
this._isOpen = !0, this._styles = t, this.elementRef = $i.createElement((i = this._styles) == null ? void 0 : i.container), this.close(), setTimeout(function () {
|
9226
|
-
return
|
9239
|
+
return _this38.addWindowEvents(e);
|
9227
9240
|
});
|
9228
9241
|
}
|
9229
9242
|
_createClass($i, [{
|
@@ -9251,13 +9264,13 @@ var $i = /*#__PURE__*/function () {
|
|
9251
9264
|
}, {
|
9252
9265
|
key: "addWindowEvents",
|
9253
9266
|
value: function addWindowEvents(e) {
|
9254
|
-
var
|
9267
|
+
var _this39 = this;
|
9255
9268
|
window.addEventListener("click", function (t) {
|
9256
9269
|
var i;
|
9257
|
-
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();
|
9258
9271
|
}), window.addEventListener("keydown", function (t) {
|
9259
9272
|
var i, n, r;
|
9260
|
-
|
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));
|
9261
9274
|
});
|
9262
9275
|
}
|
9263
9276
|
}], [{
|
@@ -9273,15 +9286,15 @@ var We = /*#__PURE__*/function (_xt) {
|
|
9273
9286
|
_inherits(We, _xt);
|
9274
9287
|
var _super37 = _createSuper(We);
|
9275
9288
|
function We(e, t) {
|
9276
|
-
var
|
9289
|
+
var _this40;
|
9277
9290
|
_classCallCheck(this, We);
|
9278
9291
|
var n;
|
9279
|
-
|
9292
|
+
_this40 = _super37.call(this, We.createButtonElement(), void 0, {
|
9280
9293
|
styles: (n = t == null ? void 0 : t.button) == null ? void 0 : n.styles
|
9281
9294
|
});
|
9282
|
-
var i =
|
9283
|
-
|
9284
|
-
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;
|
9285
9298
|
}
|
9286
9299
|
_createClass(We, [{
|
9287
9300
|
key: "createInnerElements",
|
@@ -9308,9 +9321,9 @@ var We = /*#__PURE__*/function (_xt) {
|
|
9308
9321
|
}, {
|
9309
9322
|
key: "addContainerEvents",
|
9310
9323
|
value: function addContainerEvents(e) {
|
9311
|
-
var
|
9324
|
+
var _this41 = this;
|
9312
9325
|
e.addEventListener("click", function (t) {
|
9313
|
-
t.target.classList.contains("dropup-icon") ||
|
9326
|
+
t.target.classList.contains("dropup-icon") || _this41._menu.close();
|
9314
9327
|
});
|
9315
9328
|
}
|
9316
9329
|
}], [{
|
@@ -9445,10 +9458,10 @@ var Uo = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 24 24\"
|
|
9445
9458
|
var de = /*#__PURE__*/function () {
|
9446
9459
|
// prettier-ignore
|
9447
9460
|
function de(e, t, i, n) {
|
9448
|
-
var
|
9461
|
+
var _this42 = this;
|
9449
9462
|
_classCallCheck(this, de);
|
9450
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 () {
|
9451
|
-
|
9464
|
+
_this42._validationHandler = e._validationHandler;
|
9452
9465
|
});
|
9453
9466
|
}
|
9454
9467
|
_createClass(de, [{
|
@@ -9589,12 +9602,12 @@ var Ko = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9589
9602
|
_createClass(Se, [{
|
9590
9603
|
key: "createTimer",
|
9591
9604
|
value: function createTimer(e, t) {
|
9592
|
-
var
|
9605
|
+
var _this43 = this;
|
9593
9606
|
var i = 0;
|
9594
9607
|
var n = t !== void 0 && t < Se.TIMER_LIMIT_S ? t : Se.TIMER_LIMIT_S;
|
9595
9608
|
return setInterval(function () {
|
9596
9609
|
var a;
|
9597
|
-
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");
|
9598
9611
|
var r = Math.floor(i / 60),
|
9599
9612
|
o = (i % 60).toString().padStart(2, "0");
|
9600
9613
|
e.textContent = "".concat(r, ":").concat(o);
|
@@ -9614,7 +9627,7 @@ var Ko = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9614
9627
|
}, {
|
9615
9628
|
key: "addPlaceholderAudioAttachmentEvents",
|
9616
9629
|
value: function addPlaceholderAudioAttachmentEvents(e, t, i) {
|
9617
|
-
var
|
9630
|
+
var _this44 = this;
|
9618
9631
|
var n = function n() {
|
9619
9632
|
return e.replaceChildren(t);
|
9620
9633
|
};
|
@@ -9625,7 +9638,7 @@ var Ko = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9625
9638
|
e.addEventListener("mouseleave", r);
|
9626
9639
|
var o = function o() {
|
9627
9640
|
var a;
|
9628
|
-
return (a =
|
9641
|
+
return (a = _this44.stopPlaceholderCallback) == null ? void 0 : a.call(_this44);
|
9629
9642
|
};
|
9630
9643
|
e.addEventListener("click", o);
|
9631
9644
|
}
|
@@ -9750,7 +9763,7 @@ var Et = /*#__PURE__*/function () {
|
|
9750
9763
|
case 0:
|
9751
9764
|
_context87.next = 2;
|
9752
9765
|
return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
|
9753
|
-
var
|
9766
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee86(e) {
|
9754
9767
|
var t;
|
9755
9768
|
return _regeneratorRuntime().wrap(function _callee86$(_context86) {
|
9756
9769
|
while (1) switch (_context86.prev = _context86.next) {
|
@@ -9763,7 +9776,7 @@ var Et = /*#__PURE__*/function () {
|
|
9763
9776
|
}, _callee86);
|
9764
9777
|
}));
|
9765
9778
|
return function (_x155) {
|
9766
|
-
return
|
9779
|
+
return _ref11.apply(this, arguments);
|
9767
9780
|
};
|
9768
9781
|
}()));
|
9769
9782
|
case 2:
|
@@ -9820,20 +9833,20 @@ var ls = /*#__PURE__*/function () {
|
|
9820
9833
|
}, {
|
9821
9834
|
key: "addButtons",
|
9822
9835
|
value: function addButtons() {
|
9823
|
-
var
|
9836
|
+
var _this45 = this;
|
9824
9837
|
for (var _len2 = arguments.length, e = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
9825
9838
|
e[_key2] = arguments[_key2];
|
9826
9839
|
}
|
9827
9840
|
e.forEach(function (t) {
|
9828
|
-
return
|
9841
|
+
return _this45._buttonPanel.appendChild(t);
|
9829
9842
|
});
|
9830
9843
|
}
|
9831
9844
|
}, {
|
9832
9845
|
key: "close",
|
9833
9846
|
value: function close() {
|
9834
|
-
var
|
9847
|
+
var _this46 = this;
|
9835
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 () {
|
9836
|
-
|
9849
|
+
_this46._elementRef.style.display = "none", _this46._backgroundPanelRef.style.display = "none";
|
9837
9850
|
}, ae.MODAL_CLOSE_TIMEOUT_MS);
|
9838
9851
|
}
|
9839
9852
|
}, {
|
@@ -9849,10 +9862,10 @@ var ls = /*#__PURE__*/function () {
|
|
9849
9862
|
}, {
|
9850
9863
|
key: "addCloseButton",
|
9851
9864
|
value: function addCloseButton(e, t, i) {
|
9852
|
-
var
|
9865
|
+
var _this47 = this;
|
9853
9866
|
var n = t ? ae.createSVGButton(e) : ae.createTextButton(e);
|
9854
9867
|
return this.addButtons(n), n.onclick = function () {
|
9855
|
-
|
9868
|
+
_this47.close(), setTimeout(function () {
|
9856
9869
|
i == null || i();
|
9857
9870
|
}, 140);
|
9858
9871
|
}, n;
|
@@ -9860,10 +9873,10 @@ var ls = /*#__PURE__*/function () {
|
|
9860
9873
|
}, {
|
9861
9874
|
key: "addWindowEvents",
|
9862
9875
|
value: function addWindowEvents() {
|
9863
|
-
var
|
9876
|
+
var _this48 = this;
|
9864
9877
|
window.addEventListener("keydown", function (e) {
|
9865
9878
|
var t, i;
|
9866
|
-
|
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)));
|
9867
9880
|
});
|
9868
9881
|
}
|
9869
9882
|
}], [{
|
@@ -9924,13 +9937,13 @@ var ct = /*#__PURE__*/function (_xt2) {
|
|
9924
9937
|
var _super39 = _createSuper(ct);
|
9925
9938
|
// prettier-ignore
|
9926
9939
|
function ct(e, t, i, n, r, o) {
|
9927
|
-
var
|
9940
|
+
var _this49;
|
9928
9941
|
_classCallCheck(this, ct);
|
9929
9942
|
var l, c, d, u, p, h;
|
9930
|
-
|
9931
|
-
var a =
|
9932
|
-
|
9933
|
-
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;
|
9934
9947
|
}
|
9935
9948
|
_createClass(ct, [{
|
9936
9949
|
key: "createInnerElements",
|
@@ -10116,7 +10129,7 @@ var _e = /*#__PURE__*/function () {
|
|
10116
10129
|
value: function attach(e, t, i, n, r) {
|
10117
10130
|
var o = e.validateInput || Ae.processValidateInput(e);
|
10118
10131
|
e._validationHandler = /*#__PURE__*/function () {
|
10119
|
-
var
|
10132
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee90(a) {
|
10120
10133
|
var l;
|
10121
10134
|
return _regeneratorRuntime().wrap(function _callee90$(_context90) {
|
10122
10135
|
while (1) switch (_context90.prev = _context90.next) {
|
@@ -10136,7 +10149,7 @@ var _e = /*#__PURE__*/function () {
|
|
10136
10149
|
}, _callee90);
|
10137
10150
|
}));
|
10138
10151
|
return function (_x163) {
|
10139
|
-
return
|
10152
|
+
return _ref12.apply(this, arguments);
|
10140
10153
|
};
|
10141
10154
|
}();
|
10142
10155
|
}
|
@@ -10148,10 +10161,10 @@ var mt = /*#__PURE__*/function (_xt3) {
|
|
10148
10161
|
_inherits(mt, _xt3);
|
10149
10162
|
var _super40 = _createSuper(mt);
|
10150
10163
|
function mt(e) {
|
10151
|
-
var
|
10164
|
+
var _this50;
|
10152
10165
|
_classCallCheck(this, mt);
|
10153
|
-
(e == null ? void 0 : e.position) === "dropup-menu" && (e.position = "outside-right"),
|
10154
|
-
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;
|
10155
10168
|
}
|
10156
10169
|
_createClass(mt, [{
|
10157
10170
|
key: "createInnerElements",
|
@@ -10358,9 +10371,9 @@ var J = /*#__PURE__*/function () {
|
|
10358
10371
|
}, {
|
10359
10372
|
key: "keyDownWindow",
|
10360
10373
|
value: function keyDownWindow(e) {
|
10361
|
-
var
|
10374
|
+
var _this51 = this;
|
10362
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 () {
|
10363
|
-
J.KEY_DOWN_TIMEOUT = null,
|
10376
|
+
J.KEY_DOWN_TIMEOUT = null, _this51.resetRecording(e);
|
10364
10377
|
}, 500));
|
10365
10378
|
}
|
10366
10379
|
}, {
|
@@ -10528,10 +10541,10 @@ var dt = /*#__PURE__*/function () {
|
|
10528
10541
|
i += a;
|
10529
10542
|
} else if (o.textContent !== null) {
|
10530
10543
|
if (i + o.textContent.length > t) {
|
10531
|
-
var
|
10532
|
-
|
10544
|
+
var _a3 = document.createRange();
|
10545
|
+
_a3.setStart(o, t - i), _a3.collapse(!0);
|
10533
10546
|
var l = window.getSelection();
|
10534
|
-
return l == null || l.removeAllRanges(), l == null || l.addRange(
|
10547
|
+
return l == null || l.removeAllRanges(), l == null || l.addRange(_a3), e.focus(), -1;
|
10535
10548
|
}
|
10536
10549
|
i += o.textContent.length, n += o.textContent.length;
|
10537
10550
|
}
|
@@ -10762,7 +10775,7 @@ Object.defineProperty(ai, "__esModule", {
|
|
10762
10775
|
ai.Padding = void 0;
|
10763
10776
|
var sa = De,
|
10764
10777
|
Sn = je,
|
10765
|
-
|
10778
|
+
Fe = Pe;
|
10766
10779
|
var Ht = /*#__PURE__*/function () {
|
10767
10780
|
function Ht() {
|
10768
10781
|
_classCallCheck(this, Ht);
|
@@ -10775,11 +10788,11 @@ var Ht = /*#__PURE__*/function () {
|
|
10775
10788
|
r = t.value[n - 1],
|
10776
10789
|
o = t.selectionEnd === null ? n : t.selectionEnd,
|
10777
10790
|
a = t.value[o];
|
10778
|
-
|
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;
|
10779
10792
|
return;
|
10780
10793
|
}
|
10781
10794
|
var i = t.value[t.value.length - 1];
|
10782
|
-
|
10795
|
+
Fe.Text.isCharDefined(i) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), e.isCursorAtEnd = !0;
|
10783
10796
|
}
|
10784
10797
|
}, {
|
10785
10798
|
key: "setStateForGenericElement",
|
@@ -10792,12 +10805,12 @@ var Ht = /*#__PURE__*/function () {
|
|
10792
10805
|
c = (i = t.textContent) === null || i === void 0 ? void 0 : i[l - 1],
|
10793
10806
|
d = Sn.Cursor.getGenericElementCursorOffset(t, a, !1),
|
10794
10807
|
u = (n = t.textContent) === null || n === void 0 ? void 0 : n[d];
|
10795
|
-
|
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;
|
10796
10809
|
return;
|
10797
10810
|
}
|
10798
10811
|
}
|
10799
10812
|
var o = t.innerText.charAt(t.innerText.length - 1);
|
10800
|
-
|
10813
|
+
Fe.Text.isCharDefined(o) && (e.startPadding = " "), e.isCursorAtEnd = !0;
|
10801
10814
|
}
|
10802
10815
|
}, {
|
10803
10816
|
key: "setState",
|
@@ -10981,22 +10994,22 @@ var Gt = /*#__PURE__*/function (_aa$Speech) {
|
|
10981
10994
|
}, {
|
10982
10995
|
key: "setEvents",
|
10983
10996
|
value: function setEvents() {
|
10984
|
-
var
|
10997
|
+
var _this52 = this;
|
10985
10998
|
this._service && (this._service.onstart = function () {
|
10986
|
-
|
10999
|
+
_this52.setStateOnStart();
|
10987
11000
|
}, this._service.onerror = function (e) {
|
10988
|
-
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);
|
10989
11002
|
}, this._service.onaudioend = function () {
|
10990
|
-
|
11003
|
+
_this52.setStateOnStop();
|
10991
11004
|
}, this._service.onend = function () {
|
10992
|
-
|
11005
|
+
_this52._stopping = !1;
|
10993
11006
|
}, this._service.onresult = function (e) {
|
10994
|
-
if (_typeof(e.results) > "u" &&
|
10995
|
-
var
|
10996
|
-
t =
|
10997
|
-
i =
|
10998
|
-
n =
|
10999
|
-
|
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);
|
11000
11013
|
}
|
11001
11014
|
});
|
11002
11015
|
}
|
@@ -11216,10 +11229,10 @@ var Wt = /*#__PURE__*/function (_ua$Speech) {
|
|
11216
11229
|
_inherits(Wt, _ua$Speech);
|
11217
11230
|
var _super42 = _createSuper(Wt);
|
11218
11231
|
function Wt() {
|
11219
|
-
var
|
11232
|
+
var _this53;
|
11220
11233
|
_classCallCheck(this, Wt);
|
11221
|
-
|
11222
|
-
return
|
11234
|
+
_this53 = _super42.apply(this, arguments), _this53._newTextPadding = "";
|
11235
|
+
return _this53;
|
11223
11236
|
}
|
11224
11237
|
_createClass(Wt, [{
|
11225
11238
|
key: "start",
|
@@ -11347,12 +11360,12 @@ var Wt = /*#__PURE__*/function (_ua$Speech) {
|
|
11347
11360
|
}, {
|
11348
11361
|
key: "retrieveTokenInterval",
|
11349
11362
|
value: function retrieveTokenInterval(e) {
|
11350
|
-
var
|
11363
|
+
var _this54 = this;
|
11351
11364
|
this._retrieveTokenInterval = setInterval(function () {
|
11352
11365
|
e == null || e().then(function (t) {
|
11353
|
-
|
11366
|
+
_this54._service && (_this54._service.authorizationToken = (t == null ? void 0 : t.trim()) || "");
|
11354
11367
|
})["catch"](function (t) {
|
11355
|
-
|
11368
|
+
_this54.error(t);
|
11356
11369
|
});
|
11357
11370
|
}, 1e4);
|
11358
11371
|
}
|
@@ -11434,18 +11447,18 @@ var Kt = /*#__PURE__*/function (_mt) {
|
|
11434
11447
|
_inherits(Kt, _mt);
|
11435
11448
|
var _super43 = _createSuper(Kt);
|
11436
11449
|
function Kt(e, t, i) {
|
11437
|
-
var
|
11450
|
+
var _this55;
|
11438
11451
|
_classCallCheck(this, Kt);
|
11439
11452
|
var o;
|
11440
|
-
|
11453
|
+
_this55 = _super43.call(this, _typeof(e.speechToText) == "object" ? (o = e.speechToText) == null ? void 0 : o.button : {});
|
11441
11454
|
var _Kt$processConfigurat = Kt.processConfiguration(t, e.speechToText),
|
11442
11455
|
n = _Kt$processConfigurat.serviceName,
|
11443
11456
|
r = _Kt$processConfigurat.processedConfig;
|
11444
|
-
if (
|
11457
|
+
if (_this55._addErrorMessage = i, n === "webspeech" && !Ci.isWebSpeechSupported()) _this55.changeToUnsupported();else {
|
11445
11458
|
var a = !e.textInput || !e.textInput.disabled;
|
11446
|
-
|
11459
|
+
_this55.elementRef.onclick = _this55.buttonClick.bind(_assertThisInitialized(_this55), t, a, n, r);
|
11447
11460
|
}
|
11448
|
-
return
|
11461
|
+
return _this55;
|
11449
11462
|
}
|
11450
11463
|
// prettier-ignore
|
11451
11464
|
_createClass(Kt, [{
|
@@ -11526,11 +11539,11 @@ var fa = /*#__PURE__*/function (_mt2) {
|
|
11526
11539
|
_inherits(fa, _mt2);
|
11527
11540
|
var _super44 = _createSuper(fa);
|
11528
11541
|
function fa(e, t) {
|
11529
|
-
var
|
11542
|
+
var _this56;
|
11530
11543
|
_classCallCheck(this, fa);
|
11531
11544
|
var i, n;
|
11532
|
-
|
11533
|
-
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;
|
11534
11547
|
}
|
11535
11548
|
_createClass(fa, [{
|
11536
11549
|
key: "buttonClick",
|
@@ -11540,10 +11553,10 @@ var fa = /*#__PURE__*/function (_mt2) {
|
|
11540
11553
|
}, {
|
11541
11554
|
key: "stop",
|
11542
11555
|
value: function stop() {
|
11543
|
-
var
|
11556
|
+
var _this57 = this;
|
11544
11557
|
return new Promise(function (e) {
|
11545
11558
|
var t, i;
|
11546
|
-
|
11559
|
+
_this57.changeToDefault(), (t = _this57._mediaRecorder) == null || t.stop(), (i = _this57._mediaStream) == null || i.getTracks().forEach(function (n) {
|
11547
11560
|
return n.stop();
|
11548
11561
|
}), setTimeout(function () {
|
11549
11562
|
e();
|
@@ -11553,23 +11566,23 @@ var fa = /*#__PURE__*/function (_mt2) {
|
|
11553
11566
|
}, {
|
11554
11567
|
key: "record",
|
11555
11568
|
value: function record() {
|
11556
|
-
var
|
11569
|
+
var _this58 = this;
|
11557
11570
|
navigator.mediaDevices.getUserMedia({
|
11558
11571
|
audio: !0
|
11559
11572
|
}).then(function (e) {
|
11560
|
-
|
11561
|
-
|
11562
|
-
}),
|
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();
|
11563
11576
|
})["catch"](function (e) {
|
11564
|
-
console.error(e),
|
11577
|
+
console.error(e), _this58.stop();
|
11565
11578
|
})["finally"](function () {
|
11566
|
-
|
11579
|
+
_this58._waitingForBrowserApproval = !1;
|
11567
11580
|
});
|
11568
11581
|
}
|
11569
11582
|
}, {
|
11570
11583
|
key: "createFile",
|
11571
11584
|
value: function createFile(e) {
|
11572
|
-
var
|
11585
|
+
var _this59 = this;
|
11573
11586
|
var t = new Blob([e.data], {
|
11574
11587
|
type: "audio/".concat(this._extension)
|
11575
11588
|
}),
|
@@ -11579,49 +11592,49 @@ var fa = /*#__PURE__*/function (_mt2) {
|
|
11579
11592
|
}),
|
11580
11593
|
r = new FileReader();
|
11581
11594
|
r.readAsDataURL(n), r.onload = function (o) {
|
11582
|
-
|
11595
|
+
_this59._audioType.completePlaceholderAttachment(n, o.target.result);
|
11583
11596
|
};
|
11584
11597
|
}
|
11585
11598
|
}]);
|
11586
11599
|
return fa;
|
11587
11600
|
}(mt);
|
11588
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";
|
11589
|
-
var
|
11590
|
-
function
|
11591
|
-
_classCallCheck(this,
|
11602
|
+
var B = /*#__PURE__*/function () {
|
11603
|
+
function B() {
|
11604
|
+
_classCallCheck(this, B);
|
11592
11605
|
}
|
11593
|
-
_createClass(
|
11606
|
+
_createClass(B, null, [{
|
11594
11607
|
key: "setPropertyValueIfDoesNotExist",
|
11595
11608
|
value: function setPropertyValueIfDoesNotExist(e, t, i) {
|
11596
11609
|
var _e$n, _e$n2;
|
11597
11610
|
var n = t[0];
|
11598
|
-
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));
|
11599
11612
|
}
|
11600
11613
|
}, {
|
11601
11614
|
key: "setPropertyValue",
|
11602
11615
|
value: function setPropertyValue(e, t, i) {
|
11603
11616
|
var _e$n3;
|
11604
11617
|
var n = t[0];
|
11605
|
-
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));
|
11606
11619
|
}
|
11607
11620
|
}, {
|
11608
11621
|
key: "getObjectValue",
|
11609
11622
|
value: function getObjectValue(e, t) {
|
11610
11623
|
var i = t[0],
|
11611
11624
|
n = e[i];
|
11612
|
-
return n === void 0 || t.length === 1 ? n :
|
11625
|
+
return n === void 0 || t.length === 1 ? n : B.getObjectValue(n, t.slice(1));
|
11613
11626
|
}
|
11614
11627
|
}, {
|
11615
11628
|
key: "overwritePropertyObjectFromAnother",
|
11616
11629
|
value: function overwritePropertyObjectFromAnother(e, t, i) {
|
11617
|
-
var n =
|
11630
|
+
var n = B.getObjectValue(t, i);
|
11618
11631
|
if (n) {
|
11619
|
-
var r = _objectSpread(_objectSpread({}, n),
|
11620
|
-
|
11632
|
+
var r = _objectSpread(_objectSpread({}, n), B.getObjectValue(e, i) || {});
|
11633
|
+
B.setPropertyValue(e, i, r);
|
11621
11634
|
}
|
11622
11635
|
}
|
11623
11636
|
}]);
|
11624
|
-
return
|
11637
|
+
return B;
|
11625
11638
|
}();
|
11626
11639
|
var Te = /*#__PURE__*/function () {
|
11627
11640
|
function Te() {
|
@@ -11637,13 +11650,13 @@ var Te = /*#__PURE__*/function () {
|
|
11637
11650
|
value: function overwriteDefaultStyleWithSubmit(e, t) {
|
11638
11651
|
if (!e.submit) return;
|
11639
11652
|
var i = JSON.parse(JSON.stringify(e[t] || {}));
|
11640
|
-
|
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;
|
11641
11654
|
}
|
11642
11655
|
// prettier-ignore
|
11643
11656
|
}, {
|
11644
11657
|
key: "setUpDisabledButton",
|
11645
11658
|
value: function setUpDisabledButton(e) {
|
11646
|
-
|
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");
|
11647
11660
|
}
|
11648
11661
|
}, {
|
11649
11662
|
key: "process",
|
@@ -11659,19 +11672,19 @@ var mi = /*#__PURE__*/function (_xt4) {
|
|
11659
11672
|
var _super45 = _createSuper(k);
|
11660
11673
|
// prettier-ignore
|
11661
11674
|
function k(e, t, i, n, r) {
|
11662
|
-
var
|
11675
|
+
var _this60;
|
11663
11676
|
_classCallCheck(this, k);
|
11664
11677
|
var o = Te.process(e.submitButtonStyles);
|
11665
|
-
|
11678
|
+
_this60 = _super45.call(this, k.createButtonContainerElement(), o == null ? void 0 : o.position, o), _this60._isSVGLoadingIconOverriden = !1, _this60.status = {
|
11666
11679
|
requestInProgress: !1,
|
11667
11680
|
loadingActive: !1
|
11668
|
-
},
|
11681
|
+
}, _this60._messages = i, _this60._inputElementRef = t, _this60._fileAttachments = r, _this60._innerElements = _this60.createInnerElements(), _this60._abortStream = new AbortController(), _this60._stopClicked = {
|
11669
11682
|
listener: function listener() {}
|
11670
|
-
},
|
11683
|
+
}, _this60._serviceIO = n, _this60._alwaysEnabled = !!(o != null && o.alwaysEnabled), e.disableSubmitButton = _this60.disableSubmitButton.bind(_assertThisInitialized(_this60), n), _this60.attemptOverwriteLoadingStyle(e), setTimeout(function () {
|
11671
11684
|
var a;
|
11672
|
-
|
11685
|
+
_this60._validationHandler = e._validationHandler, _this60.assignHandlers(_this60._validationHandler), (a = _this60._validationHandler) == null || a.call(_assertThisInitialized(_this60));
|
11673
11686
|
});
|
11674
|
-
return
|
11687
|
+
return _this60;
|
11675
11688
|
}
|
11676
11689
|
// prettier-ignore
|
11677
11690
|
_createClass(k, [{
|
@@ -11760,7 +11773,7 @@ var mi = /*#__PURE__*/function (_xt4) {
|
|
11760
11773
|
key: "programmaticSubmit",
|
11761
11774
|
value: function () {
|
11762
11775
|
var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee96(e) {
|
11763
|
-
var
|
11776
|
+
var _this61 = this;
|
11764
11777
|
var t;
|
11765
11778
|
return _regeneratorRuntime().wrap(function _callee96$(_context96) {
|
11766
11779
|
while (1) switch (_context96.prev = _context96.next) {
|
@@ -11775,7 +11788,7 @@ var mi = /*#__PURE__*/function (_xt4) {
|
|
11775
11788
|
type: de.getTypeFromBlob(i)
|
11776
11789
|
};
|
11777
11790
|
})), setTimeout(function () {
|
11778
|
-
return
|
11791
|
+
return _this61.attemptSubmit(t, !0);
|
11779
11792
|
});
|
11780
11793
|
case 3:
|
11781
11794
|
case "end":
|
@@ -11819,7 +11832,7 @@ var mi = /*#__PURE__*/function (_xt4) {
|
|
11819
11832
|
return this.addNewMessage(e);
|
11820
11833
|
case 10:
|
11821
11834
|
this._serviceIO.isWebModel() || this._messages.addLoadingMessage();
|
11822
|
-
|
11835
|
+
Bi.clear(this._inputElementRef);
|
11823
11836
|
i = (o = e.files) == null ? void 0 : o.map(function (l) {
|
11824
11837
|
return l.file;
|
11825
11838
|
}), n = {
|
@@ -11844,12 +11857,12 @@ var mi = /*#__PURE__*/function (_xt4) {
|
|
11844
11857
|
}, {
|
11845
11858
|
key: "addNewMessage",
|
11846
11859
|
value: function () {
|
11847
|
-
var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee98(
|
11860
|
+
var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee98(_ref13) {
|
11848
11861
|
var e, t, i;
|
11849
11862
|
return _regeneratorRuntime().wrap(function _callee98$(_context98) {
|
11850
11863
|
while (1) switch (_context98.prev = _context98.next) {
|
11851
11864
|
case 0:
|
11852
|
-
e =
|
11865
|
+
e = _ref13.text, t = _ref13.files;
|
11853
11866
|
i = {
|
11854
11867
|
role: v.USER_ROLE
|
11855
11868
|
};
|
@@ -11953,14 +11966,14 @@ var Xi = /*#__PURE__*/function (_rt) {
|
|
11953
11966
|
var _super46 = _createSuper(Xi);
|
11954
11967
|
// prettier-ignore
|
11955
11968
|
function Xi(e, t, i, n) {
|
11956
|
-
var
|
11969
|
+
var _this62;
|
11957
11970
|
_classCallCheck(this, Xi);
|
11958
|
-
|
11959
|
-
var
|
11960
|
-
r =
|
11961
|
-
o =
|
11962
|
-
|
11963
|
-
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;
|
11964
11977
|
}
|
11965
11978
|
_createClass(Xi, [{
|
11966
11979
|
key: "addButtonsAndTheirEvents",
|
@@ -11979,38 +11992,38 @@ var Xi = /*#__PURE__*/function (_rt) {
|
|
11979
11992
|
}, {
|
11980
11993
|
key: "addButtonEvents",
|
11981
11994
|
value: function addButtonEvents(e, t, i, n) {
|
11982
|
-
var
|
11995
|
+
var _this63 = this;
|
11983
11996
|
e.onclick = function () {
|
11984
|
-
|
11997
|
+
_this63.capture();
|
11985
11998
|
}, t.addEventListener("click", this.stop.bind(this)), i.onclick = function () {
|
11986
|
-
var r =
|
11987
|
-
r && Et.addFilesToType([r], [n]),
|
11999
|
+
var r = _this63.getFile();
|
12000
|
+
r && Et.addFilesToType([r], [n]), _this63.stop(), _this63.close();
|
11988
12001
|
};
|
11989
12002
|
}
|
11990
12003
|
}, {
|
11991
12004
|
key: "stop",
|
11992
12005
|
value: function stop() {
|
11993
|
-
var
|
12006
|
+
var _this64 = this;
|
11994
12007
|
this._mediaStream && this._mediaStream.getTracks().forEach(function (e) {
|
11995
12008
|
return e.stop();
|
11996
12009
|
}), this._stopped = !0, setTimeout(function () {
|
11997
|
-
|
11998
|
-
var e =
|
11999
|
-
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);
|
12000
12013
|
}, rt.MODAL_CLOSE_TIMEOUT_MS);
|
12001
12014
|
}
|
12002
12015
|
}, {
|
12003
12016
|
key: "start",
|
12004
12017
|
value: function start() {
|
12005
|
-
var
|
12018
|
+
var _this65 = this;
|
12006
12019
|
this._dataURL = void 0, this._submitButton.classList.add("modal-svg-submit-disabled"), this._stopped = !1, navigator.mediaDevices.getUserMedia({
|
12007
12020
|
video: this._dimensions || !0
|
12008
12021
|
}).then(function (e) {
|
12009
|
-
if (
|
12022
|
+
if (_this65._mediaStream = e, !_this65.isOpen()) return _this65.stop();
|
12010
12023
|
var t = document.createElement("video");
|
12011
|
-
t.srcObject = e, t.play(), requestAnimationFrame(
|
12024
|
+
t.srcObject = e, t.play(), requestAnimationFrame(_this65.updateCanvas.bind(_this65, t, _this65._canvas));
|
12012
12025
|
})["catch"](function (e) {
|
12013
|
-
console.error(e),
|
12026
|
+
console.error(e), _this65.stop(), _this65.close();
|
12014
12027
|
});
|
12015
12028
|
}
|
12016
12029
|
}, {
|
@@ -12068,13 +12081,13 @@ var Jt = /*#__PURE__*/function (_xt5) {
|
|
12068
12081
|
_inherits(Jt, _xt5);
|
12069
12082
|
var _super47 = _createSuper(Jt);
|
12070
12083
|
function Jt(e, t, i) {
|
12071
|
-
var
|
12084
|
+
var _this66;
|
12072
12085
|
_classCallCheck(this, Jt);
|
12073
12086
|
var r;
|
12074
|
-
|
12075
|
-
var n =
|
12076
|
-
i &&
|
12077
|
-
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;
|
12078
12091
|
}
|
12079
12092
|
_createClass(Jt, [{
|
12080
12093
|
key: "createInnerElements",
|
@@ -12116,7 +12129,7 @@ var ut = /*#__PURE__*/function () {
|
|
12116
12129
|
function ut(e, t, i, n) {
|
12117
12130
|
_classCallCheck(this, ut);
|
12118
12131
|
this.elementRef = ut.createPanelElement(e.inputAreaStyle);
|
12119
|
-
var r = new
|
12132
|
+
var r = new Bi(e, i),
|
12120
12133
|
o = {},
|
12121
12134
|
a = this.createFileUploadComponents(e, i, n, o);
|
12122
12135
|
e.speechToText && !o.microphone && (o.microphone = {
|
@@ -12195,7 +12208,7 @@ var Qi = /*#__PURE__*/function () {
|
|
12195
12208
|
key: "createElements",
|
12196
12209
|
value: function createElements(e, t, i) {
|
12197
12210
|
var n = document.createElement("div");
|
12198
|
-
n.id = "chat-view"
|
12211
|
+
n.id = "chat-view";
|
12199
12212
|
var r = new fe(e, t, i);
|
12200
12213
|
t.websocket && Y.createConnection(t, r);
|
12201
12214
|
var o = new ut(e, r, t, n);
|
@@ -12221,22 +12234,22 @@ var b = /*#__PURE__*/function (_co) {
|
|
12221
12234
|
_inherits(b, _co);
|
12222
12235
|
var _super48 = _createSuper(b);
|
12223
12236
|
function b() {
|
12224
|
-
var
|
12237
|
+
var _this67;
|
12225
12238
|
_classCallCheck(this, b);
|
12226
|
-
|
12239
|
+
_this67 = _super48.call(this), _this67.getMessages = function () {
|
12227
12240
|
return [];
|
12228
|
-
},
|
12241
|
+
}, _this67.submitUserMessage = function () {
|
12229
12242
|
return console.warn("submitUserMessage failed - please wait for chat view to render before calling this property.");
|
12230
|
-
},
|
12243
|
+
}, _this67.addMessage = function () {
|
12231
12244
|
return console.warn("addMessage failed - please wait for chat view to render before calling this property.");
|
12232
|
-
},
|
12233
|
-
return Yt.focusFromParentElement(
|
12234
|
-
},
|
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({
|
12235
12248
|
mode: "open"
|
12236
|
-
}).appendChild(
|
12237
|
-
|
12249
|
+
}).appendChild(_this67._elementRef), bi.apply(Sa, _this67.shadowRoot), setTimeout(function () {
|
12250
|
+
_this67._hasBeenRendered || _this67.onRender();
|
12238
12251
|
}, 20);
|
12239
|
-
return
|
12252
|
+
return _this67;
|
12240
12253
|
}
|
12241
12254
|
_createClass(b, [{
|
12242
12255
|
key: "changeToChatView",
|