deep-chat-dev 9.0.106 → 9.0.108
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 +2466 -2454
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.js +628 -562
- package/dist/services/openAI/openAIAssistantIO.d.ts +2 -0
- package/dist/services/openAI/openAIAssistantIO.d.ts.map +1 -1
- package/dist/types/openAIResult.d.ts +4 -1
- package/dist/types/openAIResult.d.ts.map +1 -1
- package/dist/views/chat/input/input.d.ts.map +1 -1
- package/dist/views/chat/input/validation/validationHandler.d.ts +0 -1
- package/dist/views/chat/input/validation/validationHandler.d.ts.map +1 -1
- package/dist/webModel/webModel.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/deepChat.js
CHANGED
@@ -864,17 +864,17 @@ function Ps(s) {
|
|
864
864
|
function z(s) {
|
865
865
|
return Rs.test(s) ? s.replace(Os, Ps) : s;
|
866
866
|
}
|
867
|
-
var
|
868
|
-
|
867
|
+
var m = {};
|
868
|
+
m.blockquote_open = function () {
|
869
869
|
return "<blockquote>\n";
|
870
870
|
};
|
871
|
-
|
871
|
+
m.blockquote_close = function (s, e) {
|
872
872
|
return "</blockquote>" + Re(s, e);
|
873
873
|
};
|
874
|
-
|
874
|
+
m.code = function (s, e) {
|
875
875
|
return s[e].block ? "<pre><code>" + z(s[e].content) + "</code></pre>" + Re(s, e) : "<code>" + z(s[e].content) + "</code>";
|
876
876
|
};
|
877
|
-
|
877
|
+
m.fence = function (s, e, t, i, n) {
|
878
878
|
var r = s[e],
|
879
879
|
o = "",
|
880
880
|
a = t.langPrefix,
|
@@ -888,203 +888,203 @@ f.fence = function (s, e, t, i, n) {
|
|
888
888
|
}
|
889
889
|
return t.highlight ? u = t.highlight.apply(t.highlight, [r.content].concat(c)) || z(r.content) : u = z(r.content), "<pre><code" + o + ">" + u + "</code></pre>" + Re(s, e);
|
890
890
|
};
|
891
|
-
|
892
|
-
|
891
|
+
m.fence_custom = {};
|
892
|
+
m.heading_open = function (s, e) {
|
893
893
|
return "<h" + s[e].hLevel + ">";
|
894
894
|
};
|
895
|
-
|
895
|
+
m.heading_close = function (s, e) {
|
896
896
|
return "</h" + s[e].hLevel + ">\n";
|
897
897
|
};
|
898
|
-
|
898
|
+
m.hr = function (s, e, t) {
|
899
899
|
return (t.xhtmlOut ? "<hr />" : "<hr>") + Re(s, e);
|
900
900
|
};
|
901
|
-
|
901
|
+
m.bullet_list_open = function () {
|
902
902
|
return "<ul>\n";
|
903
903
|
};
|
904
|
-
|
904
|
+
m.bullet_list_close = function (s, e) {
|
905
905
|
return "</ul>" + Re(s, e);
|
906
906
|
};
|
907
|
-
|
907
|
+
m.list_item_open = function () {
|
908
908
|
return "<li>";
|
909
909
|
};
|
910
|
-
|
910
|
+
m.list_item_close = function () {
|
911
911
|
return "</li>\n";
|
912
912
|
};
|
913
|
-
|
913
|
+
m.ordered_list_open = function (s, e) {
|
914
914
|
var t = s[e],
|
915
915
|
i = t.order > 1 ? ' start="' + t.order + '"' : "";
|
916
916
|
return "<ol" + i + ">\n";
|
917
917
|
};
|
918
|
-
|
918
|
+
m.ordered_list_close = function (s, e) {
|
919
919
|
return "</ol>" + Re(s, e);
|
920
920
|
};
|
921
|
-
|
921
|
+
m.paragraph_open = function (s, e) {
|
922
922
|
return s[e].tight ? "" : "<p>";
|
923
923
|
};
|
924
|
-
|
924
|
+
m.paragraph_close = function (s, e) {
|
925
925
|
var t = !(s[e].tight && e && s[e - 1].type === "inline" && !s[e - 1].content);
|
926
926
|
return (s[e].tight ? "" : "</p>") + (t ? Re(s, e) : "");
|
927
927
|
};
|
928
|
-
|
928
|
+
m.link_open = function (s, e, t) {
|
929
929
|
var i = s[e].title ? ' title="' + z(Ie(s[e].title)) + '"' : "",
|
930
930
|
n = t.linkTarget ? ' target="' + t.linkTarget + '"' : "";
|
931
931
|
return '<a href="' + z(s[e].href) + '"' + i + n + ">";
|
932
932
|
};
|
933
|
-
|
933
|
+
m.link_close = function () {
|
934
934
|
return "</a>";
|
935
935
|
};
|
936
|
-
|
936
|
+
m.image = function (s, e, t) {
|
937
937
|
var i = ' src="' + z(s[e].src) + '"',
|
938
938
|
n = s[e].title ? ' title="' + z(Ie(s[e].title)) + '"' : "",
|
939
939
|
r = ' alt="' + (s[e].alt ? z(Ie(ft(s[e].alt))) : "") + '"',
|
940
940
|
o = t.xhtmlOut ? " /" : "";
|
941
941
|
return "<img" + i + r + n + o + ">";
|
942
942
|
};
|
943
|
-
|
943
|
+
m.table_open = function () {
|
944
944
|
return "<table>\n";
|
945
945
|
};
|
946
|
-
|
946
|
+
m.table_close = function () {
|
947
947
|
return "</table>\n";
|
948
948
|
};
|
949
|
-
|
949
|
+
m.thead_open = function () {
|
950
950
|
return "<thead>\n";
|
951
951
|
};
|
952
|
-
|
952
|
+
m.thead_close = function () {
|
953
953
|
return "</thead>\n";
|
954
954
|
};
|
955
|
-
|
955
|
+
m.tbody_open = function () {
|
956
956
|
return "<tbody>\n";
|
957
957
|
};
|
958
|
-
|
958
|
+
m.tbody_close = function () {
|
959
959
|
return "</tbody>\n";
|
960
960
|
};
|
961
|
-
|
961
|
+
m.tr_open = function () {
|
962
962
|
return "<tr>";
|
963
963
|
};
|
964
|
-
|
964
|
+
m.tr_close = function () {
|
965
965
|
return "</tr>\n";
|
966
966
|
};
|
967
|
-
|
967
|
+
m.th_open = function (s, e) {
|
968
968
|
var t = s[e];
|
969
969
|
return "<th" + (t.align ? ' style="text-align:' + t.align + '"' : "") + ">";
|
970
970
|
};
|
971
|
-
|
971
|
+
m.th_close = function () {
|
972
972
|
return "</th>";
|
973
973
|
};
|
974
|
-
|
974
|
+
m.td_open = function (s, e) {
|
975
975
|
var t = s[e];
|
976
976
|
return "<td" + (t.align ? ' style="text-align:' + t.align + '"' : "") + ">";
|
977
977
|
};
|
978
|
-
|
978
|
+
m.td_close = function () {
|
979
979
|
return "</td>";
|
980
980
|
};
|
981
|
-
|
981
|
+
m.strong_open = function () {
|
982
982
|
return "<strong>";
|
983
983
|
};
|
984
|
-
|
984
|
+
m.strong_close = function () {
|
985
985
|
return "</strong>";
|
986
986
|
};
|
987
|
-
|
987
|
+
m.em_open = function () {
|
988
988
|
return "<em>";
|
989
989
|
};
|
990
|
-
|
990
|
+
m.em_close = function () {
|
991
991
|
return "</em>";
|
992
992
|
};
|
993
|
-
|
993
|
+
m.del_open = function () {
|
994
994
|
return "<del>";
|
995
995
|
};
|
996
|
-
|
996
|
+
m.del_close = function () {
|
997
997
|
return "</del>";
|
998
998
|
};
|
999
|
-
|
999
|
+
m.ins_open = function () {
|
1000
1000
|
return "<ins>";
|
1001
1001
|
};
|
1002
|
-
|
1002
|
+
m.ins_close = function () {
|
1003
1003
|
return "</ins>";
|
1004
1004
|
};
|
1005
|
-
|
1005
|
+
m.mark_open = function () {
|
1006
1006
|
return "<mark>";
|
1007
1007
|
};
|
1008
|
-
|
1008
|
+
m.mark_close = function () {
|
1009
1009
|
return "</mark>";
|
1010
1010
|
};
|
1011
|
-
|
1011
|
+
m.sub = function (s, e) {
|
1012
1012
|
return "<sub>" + z(s[e].content) + "</sub>";
|
1013
1013
|
};
|
1014
|
-
|
1014
|
+
m.sup = function (s, e) {
|
1015
1015
|
return "<sup>" + z(s[e].content) + "</sup>";
|
1016
1016
|
};
|
1017
|
-
|
1017
|
+
m.hardbreak = function (s, e, t) {
|
1018
1018
|
return t.xhtmlOut ? "<br />\n" : "<br>\n";
|
1019
1019
|
};
|
1020
|
-
|
1020
|
+
m.softbreak = function (s, e, t) {
|
1021
1021
|
return t.breaks ? t.xhtmlOut ? "<br />\n" : "<br>\n" : "\n";
|
1022
1022
|
};
|
1023
|
-
|
1023
|
+
m.text = function (s, e) {
|
1024
1024
|
return z(s[e].content);
|
1025
1025
|
};
|
1026
|
-
|
1026
|
+
m.htmlblock = function (s, e) {
|
1027
1027
|
return s[e].content;
|
1028
1028
|
};
|
1029
|
-
|
1029
|
+
m.htmltag = function (s, e) {
|
1030
1030
|
return s[e].content;
|
1031
1031
|
};
|
1032
|
-
|
1032
|
+
m.abbr_open = function (s, e) {
|
1033
1033
|
return '<abbr title="' + z(Ie(s[e].title)) + '">';
|
1034
1034
|
};
|
1035
|
-
|
1035
|
+
m.abbr_close = function () {
|
1036
1036
|
return "</abbr>";
|
1037
1037
|
};
|
1038
|
-
|
1038
|
+
m.footnote_ref = function (s, e) {
|
1039
1039
|
var t = Number(s[e].id + 1).toString(),
|
1040
1040
|
i = "fnref" + t;
|
1041
1041
|
return s[e].subId > 0 && (i += ":" + s[e].subId), '<sup class="footnote-ref"><a href="#fn' + t + '" id="' + i + '">[' + t + "]</a></sup>";
|
1042
1042
|
};
|
1043
|
-
|
1043
|
+
m.footnote_block_open = function (s, e, t) {
|
1044
1044
|
var i = t.xhtmlOut ? "<hr class=\"footnotes-sep\" />\n" : "<hr class=\"footnotes-sep\">\n";
|
1045
1045
|
return i + "<section class=\"footnotes\">\n<ol class=\"footnotes-list\">\n";
|
1046
1046
|
};
|
1047
|
-
|
1047
|
+
m.footnote_block_close = function () {
|
1048
1048
|
return "</ol>\n</section>\n";
|
1049
1049
|
};
|
1050
|
-
|
1050
|
+
m.footnote_open = function (s, e) {
|
1051
1051
|
var t = Number(s[e].id + 1).toString();
|
1052
1052
|
return '<li id="fn' + t + '" class="footnote-item">';
|
1053
1053
|
};
|
1054
|
-
|
1054
|
+
m.footnote_close = function () {
|
1055
1055
|
return "</li>\n";
|
1056
1056
|
};
|
1057
|
-
|
1057
|
+
m.footnote_anchor = function (s, e) {
|
1058
1058
|
var t = Number(s[e].id + 1).toString(),
|
1059
1059
|
i = "fnref" + t;
|
1060
1060
|
return s[e].subId > 0 && (i += ":" + s[e].subId), ' <a href="#' + i + '" class="footnote-backref">↩</a>';
|
1061
1061
|
};
|
1062
|
-
|
1062
|
+
m.dl_open = function () {
|
1063
1063
|
return "<dl>\n";
|
1064
1064
|
};
|
1065
|
-
|
1065
|
+
m.dt_open = function () {
|
1066
1066
|
return "<dt>";
|
1067
1067
|
};
|
1068
|
-
|
1068
|
+
m.dd_open = function () {
|
1069
1069
|
return "<dd>";
|
1070
1070
|
};
|
1071
|
-
|
1071
|
+
m.dl_close = function () {
|
1072
1072
|
return "</dl>\n";
|
1073
1073
|
};
|
1074
|
-
|
1074
|
+
m.dt_close = function () {
|
1075
1075
|
return "</dt>\n";
|
1076
1076
|
};
|
1077
|
-
|
1077
|
+
m.dd_close = function () {
|
1078
1078
|
return "</dd>\n";
|
1079
1079
|
};
|
1080
1080
|
function $n(s, e) {
|
1081
1081
|
return ++e >= s.length - 2 ? e : s[e].type === "paragraph_open" && s[e].tight && s[e + 1].type === "inline" && s[e + 1].content.length === 0 && s[e + 2].type === "paragraph_close" && s[e + 2].tight ? $n(s, e + 2) : e;
|
1082
1082
|
}
|
1083
|
-
var Re =
|
1083
|
+
var Re = m.getBreak = function (e, t) {
|
1084
1084
|
return t = $n(e, t), t < e.length && e[t].type === "list_item_close" ? "" : "\n";
|
1085
1085
|
};
|
1086
1086
|
function Gi() {
|
1087
|
-
this.rules = Kn({},
|
1087
|
+
this.rules = Kn({}, m), this.getBreak = m.getBreak;
|
1088
1088
|
}
|
1089
1089
|
Gi.prototype.renderInline = function (s, e, t) {
|
1090
1090
|
for (var i = this.rules, n = s.length, r = 0, o = ""; n--;) o += i[s[r].type](s, r++, e, t, this);
|
@@ -1292,13 +1292,13 @@ function Xn(s) {
|
|
1292
1292
|
return s.trim().replace(/\s+/g, " ").toUpperCase();
|
1293
1293
|
}
|
1294
1294
|
function Bs(s, e, t, i) {
|
1295
|
-
var n, r, o, a, l, c, d, u,
|
1295
|
+
var n, r, o, a, l, c, d, u, p;
|
1296
1296
|
if (s.charCodeAt(0) !== 91 || s.indexOf("]:") === -1 || (n = new Oe(s, e, t, i, []), r = mt(n, 0), r < 0 || s.charCodeAt(r + 1) !== 58)) return -1;
|
1297
1297
|
for (a = n.posMax, o = r + 2; o < a && (l = n.src.charCodeAt(o), !(l !== 32 && l !== 10)); o++);
|
1298
1298
|
if (!Yn(n, o)) return -1;
|
1299
1299
|
for (d = n.linkContent, o = n.pos, c = o, o = o + 1; o < a && (l = n.src.charCodeAt(o), !(l !== 32 && l !== 10)); o++);
|
1300
1300
|
for (o < a && c !== o && Zn(n, o) ? (u = n.linkContent, o = n.pos) : (u = "", o = c); o < a && n.src.charCodeAt(o) === 32;) o++;
|
1301
|
-
return o < a && n.src.charCodeAt(o) !== 10 ? -1 : (
|
1301
|
+
return o < a && n.src.charCodeAt(o) !== 10 ? -1 : (p = Xn(s.slice(1, r)), _typeof(i.references[p]) > "u" && (i.references[p] = {
|
1302
1302
|
title: u,
|
1303
1303
|
href: d
|
1304
1304
|
}), o);
|
@@ -1335,9 +1335,9 @@ function qs(s) {
|
|
1335
1335
|
c,
|
1336
1336
|
d = 0,
|
1337
1337
|
u = !1,
|
1338
|
-
|
1339
|
-
if (s.env.footnotes && (s.tokens = s.tokens.filter(function (
|
1340
|
-
return
|
1338
|
+
p = {};
|
1339
|
+
if (s.env.footnotes && (s.tokens = s.tokens.filter(function (h) {
|
1340
|
+
return h.type === "footnote_reference_open" ? (u = !0, l = [], c = h.label, !1) : h.type === "footnote_reference_close" ? (u = !1, p[":" + c] = l, !1) : (u && l.push(h), !u);
|
1341
1341
|
}), !!s.env.footnotes.list)) {
|
1342
1342
|
for (o = s.env.footnotes.list, s.tokens.push({
|
1343
1343
|
type: "footnote_block_open",
|
@@ -1360,7 +1360,7 @@ function qs(s) {
|
|
1360
1360
|
type: "paragraph_close",
|
1361
1361
|
tight: !1,
|
1362
1362
|
level: --d
|
1363
|
-
})) : o[e].label && (a =
|
1363
|
+
})) : o[e].label && (a = p[":" + o[e].label]), s.tokens = s.tokens.concat(a), s.tokens[s.tokens.length - 1].type === "paragraph_close" ? r = s.tokens.pop() : r = null, n = o[e].count > 0 ? o[e].count : 1, i = 0; i < n; i++) s.tokens.push({
|
1364
1364
|
type: "footnote_anchor",
|
1365
1365
|
id: e,
|
1366
1366
|
subId: i,
|
@@ -1393,15 +1393,15 @@ function Hs(s) {
|
|
1393
1393
|
c,
|
1394
1394
|
d,
|
1395
1395
|
u,
|
1396
|
-
|
1397
|
-
|
1396
|
+
p,
|
1397
|
+
h = s.tokens;
|
1398
1398
|
if (s.env.abbreviations) {
|
1399
|
-
for (s.env.abbrRegExp || (
|
1399
|
+
for (s.env.abbrRegExp || (p = "(^|[" + cn.split("").map(Si).join("") + "])(" + Object.keys(s.env.abbreviations).map(function (g) {
|
1400
1400
|
return g.substr(1);
|
1401
|
-
}).sort(function (g,
|
1402
|
-
return
|
1403
|
-
}).map(Si).join("|") + ")($|[" + cn.split("").map(Si).join("") + "])", s.env.abbrRegExp = new RegExp(
|
1404
|
-
for (n =
|
1401
|
+
}).sort(function (g, f) {
|
1402
|
+
return f.length - g.length;
|
1403
|
+
}).map(Si).join("|") + ")($|[" + cn.split("").map(Si).join("") + "])", s.env.abbrRegExp = new RegExp(p, "g")), d = s.env.abbrRegExp, t = 0, i = h.length; t < i; t++) if (h[t].type === "inline") {
|
1404
|
+
for (n = h[t].children, e = n.length - 1; e >= 0; e--) if (r = n[e], r.type === "text") {
|
1405
1405
|
for (l = 0, o = r.content, d.lastIndex = 0, c = r.level, a = []; u = d.exec(o);) d.lastIndex > l && a.push({
|
1406
1406
|
type: "text",
|
1407
1407
|
content: o.slice(l, u.index + u[1].length),
|
@@ -1422,7 +1422,7 @@ function Hs(s) {
|
|
1422
1422
|
type: "text",
|
1423
1423
|
content: o.slice(l),
|
1424
1424
|
level: c
|
1425
|
-
}),
|
1425
|
+
}), h[t].children = n = [].concat(n.slice(0, e), a, n.slice(e + 1)));
|
1426
1426
|
}
|
1427
1427
|
}
|
1428
1428
|
}
|
@@ -1457,20 +1457,20 @@ function ze(s, e, t) {
|
|
1457
1457
|
return s.substr(0, e) + t + s.substr(e + 1);
|
1458
1458
|
}
|
1459
1459
|
function Zs(s) {
|
1460
|
-
var e, t, i, n, r, o, a, l, c, d, u,
|
1460
|
+
var e, t, i, n, r, o, a, l, c, d, u, p, h, g, f, S, w;
|
1461
1461
|
if (s.options.typographer) {
|
1462
|
-
for (w = [],
|
1463
|
-
for (S = s.tokens[
|
1464
|
-
for (a = S[e].level,
|
1465
|
-
w.length =
|
1462
|
+
for (w = [], f = s.tokens.length - 1; f >= 0; f--) if (s.tokens[f].type === "inline") {
|
1463
|
+
for (S = s.tokens[f].children, w.length = 0, e = 0; e < S.length; e++) if (t = S[e], !(t.type !== "text" || $s.test(t.text))) {
|
1464
|
+
for (a = S[e].level, h = w.length - 1; h >= 0 && !(w[h].level <= a); h--);
|
1465
|
+
w.length = h + 1, i = t.content, r = 0, o = i.length;
|
1466
1466
|
e: for (; r < o && (dn.lastIndex = r, n = dn.exec(i), !!n);) {
|
1467
1467
|
if (l = !hn(i, n.index - 1), r = n.index + 1, g = n[0] === "'", c = !hn(i, r), !c && !l) {
|
1468
1468
|
g && (t.content = ze(t.content, n.index, un));
|
1469
1469
|
continue;
|
1470
1470
|
}
|
1471
|
-
if (u = !c,
|
1472
|
-
for (
|
1473
|
-
d = w[
|
1471
|
+
if (u = !c, p = !l, p) {
|
1472
|
+
for (h = w.length - 1; h >= 0 && (d = w[h], !(w[h].level < a)); h--) if (d.single === g && w[h].level === a) {
|
1473
|
+
d = w[h], g ? (S[d.token].content = ze(S[d.token].content, d.pos, s.options.quotes[2]), t.content = ze(t.content, n.index, s.options.quotes[3])) : (S[d.token].content = ze(S[d.token].content, d.pos, s.options.quotes[0]), t.content = ze(t.content, n.index, s.options.quotes[1])), w.length = h;
|
1474
1474
|
continue e;
|
1475
1475
|
}
|
1476
1476
|
}
|
@@ -1479,7 +1479,7 @@ function Zs(s) {
|
|
1479
1479
|
pos: n.index,
|
1480
1480
|
single: g,
|
1481
1481
|
level: a
|
1482
|
-
}) :
|
1482
|
+
}) : p && g && (t.content = ze(t.content, n.index, un));
|
1483
1483
|
}
|
1484
1484
|
}
|
1485
1485
|
}
|
@@ -1591,20 +1591,20 @@ function er(s, e, t, i) {
|
|
1591
1591
|
c,
|
1592
1592
|
d,
|
1593
1593
|
u,
|
1594
|
-
h,
|
1595
1594
|
p,
|
1595
|
+
h,
|
1596
1596
|
g,
|
1597
|
-
|
1597
|
+
f = s.bMarks[e] + s.tShift[e],
|
1598
1598
|
S = s.eMarks[e];
|
1599
|
-
if (
|
1599
|
+
if (f > S || s.src.charCodeAt(f++) !== 62 || s.level >= s.options.maxNesting) return !1;
|
1600
1600
|
if (i) return !0;
|
1601
|
-
for (s.src.charCodeAt(
|
1602
|
-
if (s.src.charCodeAt(
|
1603
|
-
s.src.charCodeAt(
|
1601
|
+
for (s.src.charCodeAt(f) === 32 && f++, l = s.blkIndent, s.blkIndent = 0, a = [s.bMarks[e]], s.bMarks[e] = f, f = f < S ? s.skipSpaces(f) : f, r = f >= S, o = [s.tShift[e]], s.tShift[e] = f - s.bMarks[e], u = s.parser.ruler.getRules("blockquote"), n = e + 1; n < t && (f = s.bMarks[n] + s.tShift[n], S = s.eMarks[n], !(f >= S)); n++) {
|
1602
|
+
if (s.src.charCodeAt(f++) === 62) {
|
1603
|
+
s.src.charCodeAt(f) === 32 && f++, a.push(s.bMarks[n]), s.bMarks[n] = f, f = f < S ? s.skipSpaces(f) : f, r = f >= S, o.push(s.tShift[n]), s.tShift[n] = f - s.bMarks[n];
|
1604
1604
|
continue;
|
1605
1605
|
}
|
1606
1606
|
if (r) break;
|
1607
|
-
for (g = !1,
|
1607
|
+
for (g = !1, p = 0, h = u.length; p < h; p++) if (u[p](s, n, t, !0)) {
|
1608
1608
|
g = !0;
|
1609
1609
|
break;
|
1610
1610
|
}
|
@@ -1618,7 +1618,7 @@ function er(s, e, t, i) {
|
|
1618
1618
|
}), s.parser.tokenize(s, e, n), s.tokens.push({
|
1619
1619
|
type: "blockquote_close",
|
1620
1620
|
level: --s.level
|
1621
|
-
}), s.parentType = c, d[1] = s.line,
|
1621
|
+
}), s.parentType = c, d[1] = s.line, p = 0; p < o.length; p++) s.bMarks[p + e] = a[p], s.tShift[p + e] = o[p];
|
1622
1622
|
return s.blkIndent = l, !0;
|
1623
1623
|
}
|
1624
1624
|
function tr(s, e, t, i) {
|
@@ -1671,10 +1671,10 @@ function nr(s, e, t, i) {
|
|
1671
1671
|
c,
|
1672
1672
|
d,
|
1673
1673
|
u,
|
1674
|
-
h,
|
1675
1674
|
p,
|
1675
|
+
h,
|
1676
1676
|
g,
|
1677
|
-
|
1677
|
+
f,
|
1678
1678
|
S,
|
1679
1679
|
w,
|
1680
1680
|
G,
|
@@ -1688,7 +1688,7 @@ function nr(s, e, t, i) {
|
|
1688
1688
|
xi;
|
1689
1689
|
if ((u = fn(s, e)) >= 0) S = !0;else if ((u = pn(s, e)) >= 0) S = !1;else return !1;
|
1690
1690
|
if (s.level >= s.options.maxNesting) return !1;
|
1691
|
-
if (
|
1691
|
+
if (f = s.src.charCodeAt(u - 1), i) return !0;
|
1692
1692
|
for (G = s.tokens.length, S ? (d = s.bMarks[e] + s.tShift[e], g = Number(s.src.substr(d, u - d - 1)), s.tokens.push({
|
1693
1693
|
type: "ordered_list_open",
|
1694
1694
|
order: g,
|
@@ -1698,7 +1698,7 @@ function nr(s, e, t, i) {
|
|
1698
1698
|
type: "bullet_list_open",
|
1699
1699
|
lines: V = [e, 0],
|
1700
1700
|
level: s.level++
|
1701
|
-
}), n = e, A = !1, Q = s.parser.ruler.getRules("list"); n < t && (w = s.skipSpaces(u),
|
1701
|
+
}), n = e, A = !1, Q = s.parser.ruler.getRules("list"); n < t && (w = s.skipSpaces(u), p = s.eMarks[n], w >= p ? h = 1 : h = w - u, h > 4 && (h = 1), h < 1 && (h = 1), r = u - s.bMarks[n] + h, s.tokens.push({
|
1702
1702
|
type: "list_item_open",
|
1703
1703
|
lines: X = [e, 0],
|
1704
1704
|
level: s.level++
|
@@ -1714,7 +1714,7 @@ function nr(s, e, t, i) {
|
|
1714
1714
|
if (S) {
|
1715
1715
|
if (u = fn(s, n), u < 0) break;
|
1716
1716
|
} else if (u = pn(s, n), u < 0) break;
|
1717
|
-
if (
|
1717
|
+
if (f !== s.src.charCodeAt(u - 1)) break;
|
1718
1718
|
}
|
1719
1719
|
return s.tokens.push({
|
1720
1720
|
type: S ? "ordered_list_close" : "bullet_list_close",
|
@@ -1831,21 +1831,21 @@ function _i(s, e) {
|
|
1831
1831
|
return s.src.substr(t, i - t);
|
1832
1832
|
}
|
1833
1833
|
function ur(s, e, t, i) {
|
1834
|
-
var n, r, o, a, l, c, d, u,
|
1834
|
+
var n, r, o, a, l, c, d, u, p, h, g;
|
1835
1835
|
if (e + 2 > t || (l = e + 1, s.tShift[l] < s.blkIndent) || (o = s.bMarks[l] + s.tShift[l], o >= s.eMarks[l]) || (n = s.src.charCodeAt(o), n !== 124 && n !== 45 && n !== 58) || (r = _i(s, e + 1), !/^[-:| ]+$/.test(r)) || (c = r.split("|"), c <= 2)) return !1;
|
1836
1836
|
for (u = [], a = 0; a < c.length; a++) {
|
1837
|
-
if (
|
1837
|
+
if (p = c[a].trim(), !p) {
|
1838
1838
|
if (a === 0 || a === c.length - 1) continue;
|
1839
1839
|
return !1;
|
1840
1840
|
}
|
1841
|
-
if (!/^:?-+:?$/.test(
|
1842
|
-
|
1841
|
+
if (!/^:?-+:?$/.test(p)) return !1;
|
1842
|
+
p.charCodeAt(p.length - 1) === 58 ? u.push(p.charCodeAt(0) === 58 ? "center" : "right") : p.charCodeAt(0) === 58 ? u.push("left") : u.push("");
|
1843
1843
|
}
|
1844
1844
|
if (r = _i(s, e).trim(), r.indexOf("|") === -1 || (c = r.replace(/^\||\|$/g, "").split("|"), u.length !== c.length)) return !1;
|
1845
1845
|
if (i) return !0;
|
1846
1846
|
for (s.tokens.push({
|
1847
1847
|
type: "table_open",
|
1848
|
-
lines:
|
1848
|
+
lines: h = [e, 0],
|
1849
1849
|
level: s.level++
|
1850
1850
|
}), s.tokens.push({
|
1851
1851
|
type: "thead_open",
|
@@ -1908,7 +1908,7 @@ function ur(s, e, t, i) {
|
|
1908
1908
|
}), s.tokens.push({
|
1909
1909
|
type: "table_close",
|
1910
1910
|
level: --s.level
|
1911
|
-
}),
|
1911
|
+
}), h[1] = g[1] = l, s.line = l, !0;
|
1912
1912
|
}
|
1913
1913
|
function It(s, e) {
|
1914
1914
|
var t,
|
@@ -1924,7 +1924,7 @@ function hr(s, e) {
|
|
1924
1924
|
for (t = e + 2, i = s.tokens.length - 2; t < i; t++) s.tokens[t].level === n && s.tokens[t].type === "paragraph_open" && (s.tokens[t + 2].tight = !0, s.tokens[t].tight = !0, t += 2);
|
1925
1925
|
}
|
1926
1926
|
function pr(s, e, t, i) {
|
1927
|
-
var n, r, o, a, l, c, d, u,
|
1927
|
+
var n, r, o, a, l, c, d, u, p, h, g, f, S, w;
|
1928
1928
|
if (i) return s.ddIndent < 0 ? !1 : It(s, e) >= 0;
|
1929
1929
|
if (d = e + 1, s.isEmpty(d) && ++d > t || s.tShift[d] < s.blkIndent || (n = It(s, d), n < 0) || s.level >= s.options.maxNesting) return !1;
|
1930
1930
|
c = s.tokens.length, s.tokens.push({
|
@@ -1951,7 +1951,7 @@ function pr(s, e, t, i) {
|
|
1951
1951
|
type: "dd_open",
|
1952
1952
|
lines: a = [d, 0],
|
1953
1953
|
level: s.level++
|
1954
|
-
}),
|
1954
|
+
}), f = s.tight, p = s.ddIndent, u = s.blkIndent, g = s.tShift[r], h = s.parentType, s.blkIndent = s.ddIndent = s.tShift[r] + 2, s.tShift[r] = n - s.bMarks[r], s.tight = !0, s.parentType = "deflist", s.parser.tokenize(s, r, t, !0), (!s.tight || S) && (w = !1), S = s.line - r > 1 && s.isEmpty(s.line - 1), s.tShift[r] = g, s.tight = f, s.parentType = h, s.blkIndent = u, s.ddIndent = p, s.tokens.push({
|
1955
1955
|
type: "dd_close",
|
1956
1956
|
level: --s.level
|
1957
1957
|
}), a[1] = d = s.line, d >= t || s.tShift[d] < s.blkIndent) break e;
|
@@ -2328,21 +2328,21 @@ function Lr(s, e) {
|
|
2328
2328
|
c,
|
2329
2329
|
d = !1,
|
2330
2330
|
u = s.pos,
|
2331
|
-
|
2332
|
-
|
2333
|
-
g = s.src.charCodeAt(
|
2334
|
-
if (g === 33 && (d = !0, g = s.src.charCodeAt(++
|
2335
|
-
if (a = i + 1, a <
|
2336
|
-
for (a++; a <
|
2337
|
-
if (a >=
|
2338
|
-
for (
|
2339
|
-
if (a <
|
2340
|
-
if (a >=
|
2331
|
+
p = s.posMax,
|
2332
|
+
h = s.pos,
|
2333
|
+
g = s.src.charCodeAt(h);
|
2334
|
+
if (g === 33 && (d = !0, g = s.src.charCodeAt(++h)), g !== 91 || s.level >= s.options.maxNesting || (t = h + 1, i = mt(s, h), i < 0)) return !1;
|
2335
|
+
if (a = i + 1, a < p && s.src.charCodeAt(a) === 40) {
|
2336
|
+
for (a++; a < p && (c = s.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);
|
2337
|
+
if (a >= p) return !1;
|
2338
|
+
for (h = a, Yn(s, a) ? (r = s.linkContent, a = s.pos) : r = "", h = a; a < p && (c = s.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);
|
2339
|
+
if (a < p && h !== a && Zn(s, a)) for (o = s.linkContent, a = s.pos; a < p && (c = s.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);else o = "";
|
2340
|
+
if (a >= p || s.src.charCodeAt(a) !== 41) return s.pos = u, !1;
|
2341
2341
|
a++;
|
2342
2342
|
} else {
|
2343
2343
|
if (s.linkLevel > 0) return !1;
|
2344
|
-
for (; a <
|
2345
|
-
if (a <
|
2344
|
+
for (; a < p && (c = s.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);
|
2345
|
+
if (a < p && s.src.charCodeAt(a) === 91 && (h = a + 1, a = mt(s, a), a >= 0 ? n = s.src.slice(h, a++) : a = h - 1), n || (_typeof(n) > "u" && (a = i + 1), n = s.src.slice(t, i)), l = s.env.references[Xn(n)], !l) return s.pos = u, !1;
|
2346
2346
|
r = l.href, o = l.title;
|
2347
2347
|
}
|
2348
2348
|
return e || (s.pos = t, s.posMax = i, d ? s.push({
|
@@ -2359,7 +2359,7 @@ function Lr(s, e) {
|
|
2359
2359
|
}), s.linkLevel++, s.parser.tokenize(s), s.linkLevel--, s.push({
|
2360
2360
|
type: "link_close",
|
2361
2361
|
level: --s.level
|
2362
|
-
}))), s.pos = a, s.posMax =
|
2362
|
+
}))), s.pos = a, s.posMax = p, !0;
|
2363
2363
|
}
|
2364
2364
|
function Rr(s, e) {
|
2365
2365
|
var t,
|
@@ -3300,29 +3300,29 @@ function co(_x10, _x11) {
|
|
3300
3300
|
return _co.apply(this, arguments);
|
3301
3301
|
}
|
3302
3302
|
function _co() {
|
3303
|
-
_co = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3303
|
+
_co = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee104(s, e) {
|
3304
3304
|
var t, i;
|
3305
|
-
return _regeneratorRuntime().wrap(function
|
3306
|
-
while (1) switch (
|
3305
|
+
return _regeneratorRuntime().wrap(function _callee104$(_context104) {
|
3306
|
+
while (1) switch (_context104.prev = _context104.next) {
|
3307
3307
|
case 0:
|
3308
3308
|
t = s.getReader();
|
3309
3309
|
case 1:
|
3310
|
-
|
3310
|
+
_context104.next = 3;
|
3311
3311
|
return t.read();
|
3312
3312
|
case 3:
|
3313
|
-
if ((i =
|
3314
|
-
|
3313
|
+
if ((i = _context104.sent).done) {
|
3314
|
+
_context104.next = 7;
|
3315
3315
|
break;
|
3316
3316
|
}
|
3317
3317
|
e(i.value);
|
3318
3318
|
case 5:
|
3319
|
-
|
3319
|
+
_context104.next = 1;
|
3320
3320
|
break;
|
3321
3321
|
case 7:
|
3322
3322
|
case "end":
|
3323
|
-
return
|
3323
|
+
return _context104.stop();
|
3324
3324
|
}
|
3325
|
-
},
|
3325
|
+
}, _callee104);
|
3326
3326
|
}));
|
3327
3327
|
return _co.apply(this, arguments);
|
3328
3328
|
}
|
@@ -3411,18 +3411,18 @@ function go(s, e) {
|
|
3411
3411
|
l = e.openWhenHidden,
|
3412
3412
|
c = e.fetch,
|
3413
3413
|
d = fo(e, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
3414
|
-
return new Promise(function (u,
|
3415
|
-
var
|
3416
|
-
|
3414
|
+
return new Promise(function (u, p) {
|
3415
|
+
var h = Object.assign({}, i);
|
3416
|
+
h.accept || (h.accept = Di);
|
3417
3417
|
var g;
|
3418
|
-
function
|
3418
|
+
function f() {
|
3419
3419
|
g.abort(), document.hidden || X();
|
3420
3420
|
}
|
3421
|
-
l || document.addEventListener("visibilitychange",
|
3421
|
+
l || document.addEventListener("visibilitychange", f);
|
3422
3422
|
var S = mo,
|
3423
3423
|
w = 0;
|
3424
3424
|
function G() {
|
3425
|
-
document.removeEventListener("visibilitychange",
|
3425
|
+
document.removeEventListener("visibilitychange", f), window.clearTimeout(w), g.abort();
|
3426
3426
|
}
|
3427
3427
|
t == null || t.addEventListener("abort", function () {
|
3428
3428
|
G(), u();
|
@@ -3442,7 +3442,7 @@ function go(s, e) {
|
|
3442
3442
|
_context3.prev = 1;
|
3443
3443
|
_context3.next = 4;
|
3444
3444
|
return A(s, Object.assign(Object.assign({}, d), {
|
3445
|
-
headers:
|
3445
|
+
headers: h,
|
3446
3446
|
signal: g.signal
|
3447
3447
|
}));
|
3448
3448
|
case 4:
|
@@ -3452,7 +3452,7 @@ function go(s, e) {
|
|
3452
3452
|
case 7:
|
3453
3453
|
_context3.next = 9;
|
3454
3454
|
return co(Q.body, uo(ho(function (N) {
|
3455
|
-
N ?
|
3455
|
+
N ? h[yn] = N : delete h[yn];
|
3456
3456
|
}, function (N) {
|
3457
3457
|
S = N;
|
3458
3458
|
}, r)));
|
@@ -3469,7 +3469,7 @@ function go(s, e) {
|
|
3469
3469
|
N = (oe = a == null ? void 0 : a(_context3.t0)) !== null && oe !== void 0 ? oe : S;
|
3470
3470
|
window.clearTimeout(w), w = window.setTimeout(X, N);
|
3471
3471
|
} catch (N) {
|
3472
|
-
G(),
|
3472
|
+
G(), p(N);
|
3473
3473
|
}
|
3474
3474
|
case 17:
|
3475
3475
|
case "end":
|
@@ -3570,9 +3570,9 @@ var I = /*#__PURE__*/function () {
|
|
3570
3570
|
function () {
|
3571
3571
|
var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(e, t, i) {
|
3572
3572
|
var n,
|
3573
|
-
|
3573
|
+
h,
|
3574
3574
|
g,
|
3575
|
-
|
3575
|
+
f,
|
3576
3576
|
S,
|
3577
3577
|
w,
|
3578
3578
|
G,
|
@@ -3585,7 +3585,7 @@ var I = /*#__PURE__*/function () {
|
|
3585
3585
|
c,
|
3586
3586
|
d,
|
3587
3587
|
u,
|
3588
|
-
|
3588
|
+
p,
|
3589
3589
|
_args7 = arguments;
|
3590
3590
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
3591
3591
|
while (1) switch (_context7.prev = _context7.next) {
|
@@ -3593,7 +3593,7 @@ var I = /*#__PURE__*/function () {
|
|
3593
3593
|
n = _args7.length > 3 && _args7[3] !== undefined ? _args7[3] : !0;
|
3594
3594
|
r = {
|
3595
3595
|
body: t,
|
3596
|
-
headers: (
|
3596
|
+
headers: (h = e.requestSettings) == null ? void 0 : h.headers
|
3597
3597
|
};
|
3598
3598
|
_context7.next = 4;
|
3599
3599
|
return E.processRequestInterceptor(e.deepChat, r);
|
@@ -3618,13 +3618,13 @@ var I = /*#__PURE__*/function () {
|
|
3618
3618
|
}
|
3619
3619
|
return _context7.abrupt("return", Ae.stream(e, o, i));
|
3620
3620
|
case 16:
|
3621
|
-
if (!(((
|
3621
|
+
if (!(((f = e.requestSettings) == null ? void 0 : f.url) === ve.URL)) {
|
3622
3622
|
_context7.next = 18;
|
3623
3623
|
break;
|
3624
3624
|
}
|
3625
3625
|
return _context7.abrupt("return", ve.requestStream(i, e.streamHandlers));
|
3626
3626
|
case 18:
|
3627
|
-
|
3627
|
+
p = new Ze(i);
|
3628
3628
|
go(((S = e.requestSettings) == null ? void 0 : S.url) || e.url || "", {
|
3629
3629
|
method: ((w = e.requestSettings) == null ? void 0 : w.method) || "POST",
|
3630
3630
|
headers: a,
|
@@ -3677,7 +3677,7 @@ var I = /*#__PURE__*/function () {
|
|
3677
3677
|
case 7:
|
3678
3678
|
N = _context6.t0;
|
3679
3679
|
(oe = e.extractResultData) == null || oe.call(e, N).then(function (Be) {
|
3680
|
-
|
3680
|
+
p.upsertStreamedMessage(Be);
|
3681
3681
|
})["catch"](function (Be) {
|
3682
3682
|
return E.displayError(i, Be);
|
3683
3683
|
});
|
@@ -3692,7 +3692,7 @@ var I = /*#__PURE__*/function () {
|
|
3692
3692
|
throw d(), A;
|
3693
3693
|
},
|
3694
3694
|
onclose: function onclose() {
|
3695
|
-
|
3695
|
+
p.finaliseStreamedMessage(), d();
|
3696
3696
|
},
|
3697
3697
|
signal: u.signal
|
3698
3698
|
})["catch"](function (A) {
|
@@ -3772,7 +3772,7 @@ var Ae = /*#__PURE__*/function () {
|
|
3772
3772
|
n = !0;
|
3773
3773
|
r = /*#__PURE__*/function () {
|
3774
3774
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(c) {
|
3775
|
-
var u,
|
3775
|
+
var u, p, d;
|
3776
3776
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
3777
3777
|
while (1) switch (_context8.prev = _context8.next) {
|
3778
3778
|
case 0:
|
@@ -3784,7 +3784,7 @@ var Ae = /*#__PURE__*/function () {
|
|
3784
3784
|
case 2:
|
3785
3785
|
n = !1;
|
3786
3786
|
_context8.next = 5;
|
3787
|
-
return (
|
3787
|
+
return (p = (u = e.deepChat).responseInterceptor) == null ? void 0 : p.call(u, c);
|
3788
3788
|
case 5:
|
3789
3789
|
_context8.t0 = _context8.sent;
|
3790
3790
|
if (_context8.t0) {
|
@@ -3822,7 +3822,7 @@ var Ae = /*#__PURE__*/function () {
|
|
3822
3822
|
}, {
|
3823
3823
|
key: "stream",
|
3824
3824
|
value: function stream(e, t, i) {
|
3825
|
-
var u,
|
3825
|
+
var u, p;
|
3826
3826
|
var n = !0,
|
3827
3827
|
r = !1;
|
3828
3828
|
var o = new Ze(i),
|
@@ -3832,14 +3832,14 @@ var Ae = /*#__PURE__*/function () {
|
|
3832
3832
|
l = function l() {
|
3833
3833
|
n && (o.finaliseStreamedMessage(), e.streamHandlers.onClose(), n = !1);
|
3834
3834
|
},
|
3835
|
-
c = function c(
|
3836
|
-
n && (!
|
3835
|
+
c = function c(h) {
|
3836
|
+
n && (!h || _typeof(h) != "object" || typeof h.error != "string" && typeof h.html != "string" && typeof h.text != "string" ? console.error(C.INVALID_RESPONSE(h, "server", !1)) : h.error ? (console.error(h.error), o.finaliseStreamedMessage(), e.streamHandlers.onClose(), i.addNewErrorMessage("service", h.error), n = !1) : o.upsertStreamedMessage(h));
|
3837
3837
|
};
|
3838
3838
|
e.streamHandlers.abortStream.abort = function () {
|
3839
3839
|
o.finaliseStreamedMessage(), e.streamHandlers.onClose(), n = !1;
|
3840
3840
|
};
|
3841
3841
|
var d = Ae.generateOptionalSignals();
|
3842
|
-
(
|
3842
|
+
(p = (u = e.requestSettings).handler) == null || p.call(u, t, _objectSpread(_objectSpread({}, d), {}, {
|
3843
3843
|
onOpen: a,
|
3844
3844
|
onResponse: c,
|
3845
3845
|
onClose: l,
|
@@ -3866,7 +3866,7 @@ var Ae = /*#__PURE__*/function () {
|
|
3866
3866
|
},
|
3867
3867
|
o = /*#__PURE__*/function () {
|
3868
3868
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(d) {
|
3869
|
-
var
|
3869
|
+
var p, h, u;
|
3870
3870
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
3871
3871
|
while (1) switch (_context10.prev = _context10.next) {
|
3872
3872
|
case 0:
|
@@ -3877,7 +3877,7 @@ var Ae = /*#__PURE__*/function () {
|
|
3877
3877
|
return _context10.abrupt("return");
|
3878
3878
|
case 2:
|
3879
3879
|
_context10.next = 4;
|
3880
|
-
return (
|
3880
|
+
return (h = (p = e.deepChat).responseInterceptor) == null ? void 0 : h.call(p, d);
|
3881
3881
|
case 4:
|
3882
3882
|
_context10.t0 = _context10.sent;
|
3883
3883
|
if (_context10.t0) {
|
@@ -3933,8 +3933,8 @@ var _ = /*#__PURE__*/function () {
|
|
3933
3933
|
function () {
|
3934
3934
|
var _request3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(e, t, i) {
|
3935
3935
|
var n,
|
3936
|
-
h,
|
3937
3936
|
p,
|
3937
|
+
h,
|
3938
3938
|
g,
|
3939
3939
|
r,
|
3940
3940
|
_yield$E$processReque2,
|
@@ -3951,7 +3951,7 @@ var _ = /*#__PURE__*/function () {
|
|
3951
3951
|
n = _args12.length > 3 && _args12[3] !== undefined ? _args12[3] : !0;
|
3952
3952
|
r = {
|
3953
3953
|
body: t,
|
3954
|
-
headers: (
|
3954
|
+
headers: (p = e.requestSettings) == null ? void 0 : p.headers
|
3955
3955
|
};
|
3956
3956
|
_context12.next = 4;
|
3957
3957
|
return E.processRequestInterceptor(e.deepChat, r);
|
@@ -3967,7 +3967,7 @@ var _ = /*#__PURE__*/function () {
|
|
3967
3967
|
}
|
3968
3968
|
return _context12.abrupt("return", E.onInterceptorError(i, l, c));
|
3969
3969
|
case 11:
|
3970
|
-
if (!((
|
3970
|
+
if (!((h = e.requestSettings) != null && h.handler)) {
|
3971
3971
|
_context12.next = 13;
|
3972
3972
|
break;
|
3973
3973
|
}
|
@@ -3981,12 +3981,12 @@ var _ = /*#__PURE__*/function () {
|
|
3981
3981
|
case 15:
|
3982
3982
|
d = !0;
|
3983
3983
|
u = E.fetch.bind(this, e, a, n);
|
3984
|
-
u(o).then(function (
|
3985
|
-
return d = !!
|
3986
|
-
}).then(function (
|
3987
|
-
return E.processResponseByType(
|
3984
|
+
u(o).then(function (f) {
|
3985
|
+
return d = !!f.ok, f;
|
3986
|
+
}).then(function (f) {
|
3987
|
+
return E.processResponseByType(f);
|
3988
3988
|
}).then( /*#__PURE__*/function () {
|
3989
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(
|
3989
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(f) {
|
3990
3990
|
var G, A, S, w;
|
3991
3991
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
3992
3992
|
while (1) switch (_context11.prev = _context11.next) {
|
@@ -3998,14 +3998,14 @@ var _ = /*#__PURE__*/function () {
|
|
3998
3998
|
return _context11.abrupt("return");
|
3999
3999
|
case 2:
|
4000
4000
|
_context11.next = 4;
|
4001
|
-
return (A = (G = e.deepChat).responseInterceptor) == null ? void 0 : A.call(G,
|
4001
|
+
return (A = (G = e.deepChat).responseInterceptor) == null ? void 0 : A.call(G, f);
|
4002
4002
|
case 4:
|
4003
4003
|
_context11.t0 = _context11.sent;
|
4004
4004
|
if (_context11.t0) {
|
4005
4005
|
_context11.next = 7;
|
4006
4006
|
break;
|
4007
4007
|
}
|
4008
|
-
_context11.t0 =
|
4008
|
+
_context11.t0 = f;
|
4009
4009
|
case 7:
|
4010
4010
|
S = _context11.t0;
|
4011
4011
|
_context11.next = 10;
|
@@ -4016,13 +4016,13 @@ var _ = /*#__PURE__*/function () {
|
|
4016
4016
|
_context11.next = 13;
|
4017
4017
|
break;
|
4018
4018
|
}
|
4019
|
-
throw
|
4019
|
+
throw f;
|
4020
4020
|
case 13:
|
4021
4021
|
if (!(!w || _typeof(w) != "object")) {
|
4022
4022
|
_context11.next = 15;
|
4023
4023
|
break;
|
4024
4024
|
}
|
4025
|
-
throw Error(C.INVALID_RESPONSE(
|
4025
|
+
throw Error(C.INVALID_RESPONSE(f, "response", !!e.deepChat.responseInterceptor, S));
|
4026
4026
|
case 15:
|
4027
4027
|
w.makingAnotherRequest || (I.isSimulation(e.deepChat.stream) ? I.simulate(i, e.streamHandlers, w) : (i.addNewMessage(w), c()));
|
4028
4028
|
case 16:
|
@@ -4034,8 +4034,8 @@ var _ = /*#__PURE__*/function () {
|
|
4034
4034
|
return function (_x23) {
|
4035
4035
|
return _ref4.apply(this, arguments);
|
4036
4036
|
};
|
4037
|
-
}())["catch"](function (
|
4038
|
-
E.displayError(i,
|
4037
|
+
}())["catch"](function (f) {
|
4038
|
+
E.displayError(i, f), c();
|
4039
4039
|
});
|
4040
4040
|
case 18:
|
4041
4041
|
case "end":
|
@@ -4104,9 +4104,9 @@ var _ = /*#__PURE__*/function () {
|
|
4104
4104
|
value: function () {
|
4105
4105
|
var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(e, t, i) {
|
4106
4106
|
var n,
|
4107
|
-
|
4107
|
+
h,
|
4108
4108
|
g,
|
4109
|
-
|
4109
|
+
f,
|
4110
4110
|
r,
|
4111
4111
|
_yield$E$processReque3,
|
4112
4112
|
o,
|
@@ -4115,7 +4115,7 @@ var _ = /*#__PURE__*/function () {
|
|
4115
4115
|
c,
|
4116
4116
|
d,
|
4117
4117
|
u,
|
4118
|
-
|
4118
|
+
p,
|
4119
4119
|
_args14 = arguments;
|
4120
4120
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
4121
4121
|
while (1) switch (_context14.prev = _context14.next) {
|
@@ -4123,7 +4123,7 @@ var _ = /*#__PURE__*/function () {
|
|
4123
4123
|
n = _args14.length > 3 && _args14[3] !== undefined ? _args14[3] : !0;
|
4124
4124
|
r = {
|
4125
4125
|
body: t,
|
4126
|
-
headers: (
|
4126
|
+
headers: (h = e.requestSettings) == null ? void 0 : h.headers
|
4127
4127
|
};
|
4128
4128
|
_context14.next = 4;
|
4129
4129
|
return E.processRequestInterceptor(e.deepChat, r);
|
@@ -4138,12 +4138,12 @@ var _ = /*#__PURE__*/function () {
|
|
4138
4138
|
}
|
4139
4139
|
return _context14.abrupt("return", E.onInterceptorError(i, l));
|
4140
4140
|
case 10:
|
4141
|
-
c = ((g = e.requestSettings) == null ? void 0 : g.url) || e.url || "", d = ((
|
4141
|
+
c = ((g = e.requestSettings) == null ? void 0 : g.url) || e.url || "", d = ((f = e.requestSettings) == null ? void 0 : f.method) || "POST", u = n ? JSON.stringify(o) : o, p = {
|
4142
4142
|
method: d,
|
4143
4143
|
body: u,
|
4144
4144
|
headers: a
|
4145
4145
|
};
|
4146
|
-
e.requestSettings.credentials && (
|
4146
|
+
e.requestSettings.credentials && (p.credentials = e.requestSettings.credentials), _.executePollRequest(e, c, p, i);
|
4147
4147
|
case 12:
|
4148
4148
|
case "end":
|
4149
4149
|
return _context14.stop();
|
@@ -4426,12 +4426,12 @@ var L = /*#__PURE__*/function () {
|
|
4426
4426
|
}, {
|
4427
4427
|
key: "processMicrophone",
|
4428
4428
|
value: function processMicrophone(e, t, i, n) {
|
4429
|
-
var _l$files,
|
4430
|
-
var a, l, c, d, u,
|
4429
|
+
var _l$files, _p$maxNumberOfFiles;
|
4430
|
+
var a, l, c, d, u, p;
|
4431
4431
|
var o = _objectSpread({
|
4432
4432
|
acceptedFormats: "audio/*"
|
4433
4433
|
}, ((a = e.fileTypes.audio) == null ? void 0 : a.files) || {});
|
4434
|
-
i && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.recordAudio = L.parseConfig(e.requestSettings, o, t, i), _typeof(i) == "object" && i.files && ((_l$files = (l = e.recordAudio).files) !== null && _l$files !== void 0 ? _l$files : l.files = {}, e.recordAudio.files.format = (c = i.files) == null ? void 0 : c.format, e.recordAudio.files.maxDurationSeconds = (d = i.files) == null ? void 0 : d.maxDurationSeconds, (u = e.fileTypes.audio) != null && u.files && ((
|
4434
|
+
i && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.recordAudio = L.parseConfig(e.requestSettings, o, t, i), _typeof(i) == "object" && i.files && ((_l$files = (l = e.recordAudio).files) !== null && _l$files !== void 0 ? _l$files : l.files = {}, e.recordAudio.files.format = (c = i.files) == null ? void 0 : c.format, e.recordAudio.files.maxDurationSeconds = (d = i.files) == null ? void 0 : d.maxDurationSeconds, (u = e.fileTypes.audio) != null && u.files && ((_p$maxNumberOfFiles = (p = e.fileTypes.audio.files).maxNumberOfFiles) !== null && _p$maxNumberOfFiles !== void 0 ? _p$maxNumberOfFiles : p.maxNumberOfFiles = i.files.maxNumberOfFiles))) : n || (e.fileTypes.audio = L.parseConfig(e.requestSettings, o, t, i)));
|
4435
4435
|
}
|
4436
4436
|
// prettier-ignore
|
4437
4437
|
}, {
|
@@ -5303,32 +5303,32 @@ var En = {
|
|
5303
5303
|
value: function () {
|
5304
5304
|
var _loadModel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(e, t) {
|
5305
5305
|
var _this12 = this;
|
5306
|
-
var o, a, l, c, d, i, n, r, _this$getConfig,
|
5306
|
+
var o, a, l, c, d, u, p, i, n, r, _this$getConfig, h, g, f, _h;
|
5307
5307
|
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
5308
5308
|
while (1) switch (_context25.prev = _context25.next) {
|
5309
5309
|
case 0:
|
5310
5310
|
this.scrollToTop(), M.chat = e, this._isModelLoading = !0;
|
5311
5311
|
i = ((o = this._webModel.introMessage) == null ? void 0 : o.displayed) === !1;
|
5312
|
-
n = function n(
|
5313
|
-
var
|
5314
|
-
(
|
5315
|
-
html: "<div>".concat(
|
5312
|
+
n = function n(h) {
|
5313
|
+
var g;
|
5314
|
+
(g = _this12._messages) == null || g.addNewMessage({
|
5315
|
+
html: "<div>".concat(h.text, "</div>"),
|
5316
5316
|
overwrite: !0,
|
5317
5317
|
sendUpdate: !1
|
5318
5318
|
}), i && (setTimeout(function () {
|
5319
|
-
var
|
5320
|
-
return Y.scrollToBottom((
|
5319
|
+
var f;
|
5320
|
+
return Y.scrollToBottom((f = _this12._messages) == null ? void 0 : f.elementRef);
|
5321
5321
|
}), i = !1);
|
5322
5322
|
};
|
5323
5323
|
M.chat.setInitProgressCallback(n);
|
5324
5324
|
_context25.prev = 4;
|
5325
|
-
_this$getConfig = this.getConfig(),
|
5326
|
-
this._webModel.instruction && (
|
5325
|
+
_this$getConfig = this.getConfig(), h = _this$getConfig.model, g = _this$getConfig.appConfig, f = {};
|
5326
|
+
this._webModel.instruction && (f.conv_config = {
|
5327
5327
|
system: this._webModel.instruction
|
5328
5328
|
});
|
5329
|
-
this._conversationHistory.length > 0 && (
|
5329
|
+
this._conversationHistory.length > 0 && (f.conversation_history = this._conversationHistory);
|
5330
5330
|
_context25.next = 10;
|
5331
|
-
return M.chat.reload(
|
5331
|
+
return M.chat.reload(h, f, g, t);
|
5332
5332
|
case 10:
|
5333
5333
|
r = _context25.sent;
|
5334
5334
|
_context25.next = 16;
|
@@ -5338,10 +5338,10 @@ var En = {
|
|
5338
5338
|
_context25.t0 = _context25["catch"](4);
|
5339
5339
|
return _context25.abrupt("return", this.unloadChat(_context25.t0));
|
5340
5340
|
case 16:
|
5341
|
-
if ((a = this._webModel.introMessage) != null &&
|
5342
|
-
|
5343
|
-
(
|
5344
|
-
html:
|
5341
|
+
if ((l = (a = this.deepChat)._validationHandler) == null || l.call(a), (c = this._webModel.introMessage) != null && c.removeAfterLoad) this._webModel.introMessage.displayed === !1 ? (u = this._messages) == null || u.removeLastMessage() : (p = this._removeIntro) == null || p.call(this);else {
|
5342
|
+
_h = xn.setUpAfterLoad(r, this._webModel.introMessage, this._chatEl, !!this._webModel.worker);
|
5343
|
+
(d = this._messages) == null || d.addNewMessage({
|
5344
|
+
html: _h,
|
5345
5345
|
overwrite: !0,
|
5346
5346
|
sendUpdate: !1
|
5347
5347
|
});
|
@@ -8196,7 +8196,7 @@ var Qi = /*#__PURE__*/function (_U10) {
|
|
8196
8196
|
key: "extractPollResultData",
|
8197
8197
|
value: function () {
|
8198
8198
|
var _extractPollResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee79(e) {
|
8199
|
-
var r, t, i, n;
|
8199
|
+
var r, o, t, i, l, c, d, u, n;
|
8200
8200
|
return _regeneratorRuntime().wrap(function _callee79$(_context79) {
|
8201
8201
|
while (1) switch (_context79.prev = _context79.next) {
|
8202
8202
|
case 0:
|
@@ -8210,32 +8210,56 @@ var Qi = /*#__PURE__*/function (_U10) {
|
|
8210
8210
|
});
|
8211
8211
|
case 3:
|
8212
8212
|
if (!(t === "completed" && this.messages)) {
|
8213
|
-
_context79.next =
|
8213
|
+
_context79.next = 19;
|
8214
8214
|
break;
|
8215
8215
|
}
|
8216
8216
|
this.url = "".concat(ae.THREAD_PREFIX, "/").concat(e.thread_id, "/messages");
|
8217
8217
|
_context79.next = 7;
|
8218
8218
|
return O.directFetch(this, {}, "GET");
|
8219
8219
|
case 7:
|
8220
|
-
|
8221
|
-
|
8220
|
+
l = _context79.sent.data[0];
|
8221
|
+
c = l.content.find(function (p) {
|
8222
|
+
return !!p.text;
|
8223
|
+
});
|
8224
|
+
d = l.content.filter(function (p) {
|
8225
|
+
var h;
|
8226
|
+
return (h = p.image_file) == null ? void 0 : h.file_id;
|
8227
|
+
}).map(function (p) {
|
8228
|
+
var h;
|
8229
|
+
return (h = p.image_file) == null ? void 0 : h.file_id;
|
8230
|
+
});
|
8231
|
+
if (!(d && d.length > 0)) {
|
8232
|
+
_context79.next = 16;
|
8233
|
+
break;
|
8234
|
+
}
|
8235
|
+
_context79.next = 13;
|
8236
|
+
return this.getFiles(d);
|
8237
|
+
case 13:
|
8238
|
+
_context79.t0 = _context79.sent;
|
8239
|
+
_context79.next = 17;
|
8240
|
+
break;
|
8241
|
+
case 16:
|
8242
|
+
_context79.t0 = void 0;
|
8243
|
+
case 17:
|
8244
|
+
u = _context79.t0;
|
8222
8245
|
return _context79.abrupt("return", {
|
8223
|
-
text:
|
8224
|
-
_sessionId:
|
8246
|
+
text: ((r = c == null ? void 0 : c.text) == null ? void 0 : r.value) || "",
|
8247
|
+
_sessionId: this.sessionId,
|
8248
|
+
files: u
|
8225
8249
|
});
|
8226
|
-
case
|
8227
|
-
n = (
|
8250
|
+
case 19:
|
8251
|
+
n = (o = i == null ? void 0 : i.submit_tool_outputs) == null ? void 0 : o.tool_calls;
|
8228
8252
|
if (!(t === "requires_action" && n)) {
|
8229
|
-
_context79.next =
|
8253
|
+
_context79.next = 24;
|
8230
8254
|
break;
|
8231
8255
|
}
|
8232
|
-
_context79.next =
|
8256
|
+
_context79.next = 23;
|
8233
8257
|
return this.handleTools(n);
|
8234
|
-
case
|
8258
|
+
case 23:
|
8235
8259
|
return _context79.abrupt("return", _context79.sent);
|
8236
|
-
case
|
8260
|
+
case 24:
|
8237
8261
|
throw Error("Thread run status: ".concat(t));
|
8238
|
-
case
|
8262
|
+
case 25:
|
8239
8263
|
case "end":
|
8240
8264
|
return _context79.stop();
|
8241
8265
|
}
|
@@ -8245,17 +8269,60 @@ var Qi = /*#__PURE__*/function (_U10) {
|
|
8245
8269
|
return _extractPollResultData5.apply(this, arguments);
|
8246
8270
|
}
|
8247
8271
|
return extractPollResultData;
|
8272
|
+
}()
|
8273
|
+
}, {
|
8274
|
+
key: "getFiles",
|
8275
|
+
value: function () {
|
8276
|
+
var _getFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee80(e) {
|
8277
|
+
var _this35 = this;
|
8278
|
+
var t, n;
|
8279
|
+
return _regeneratorRuntime().wrap(function _callee80$(_context80) {
|
8280
|
+
while (1) switch (_context80.prev = _context80.next) {
|
8281
|
+
case 0:
|
8282
|
+
t = e.map(function (r) {
|
8283
|
+
return _this35.url = "https://api.openai.com/v1/files/".concat(r, "/content"), new Promise(function (o) {
|
8284
|
+
o(O.directFetch(_this35, void 0, "GET", !1));
|
8285
|
+
});
|
8286
|
+
});
|
8287
|
+
_context80.next = 3;
|
8288
|
+
return Promise.all(t);
|
8289
|
+
case 3:
|
8290
|
+
n = _context80.sent.map(function (r) {
|
8291
|
+
return new Promise(function (o) {
|
8292
|
+
var a = new FileReader();
|
8293
|
+
a.readAsDataURL(r), a.onload = function (l) {
|
8294
|
+
o({
|
8295
|
+
src: l.target.result,
|
8296
|
+
type: "image"
|
8297
|
+
});
|
8298
|
+
};
|
8299
|
+
});
|
8300
|
+
});
|
8301
|
+
_context80.next = 6;
|
8302
|
+
return Promise.all(n);
|
8303
|
+
case 6:
|
8304
|
+
return _context80.abrupt("return", _context80.sent);
|
8305
|
+
case 7:
|
8306
|
+
case "end":
|
8307
|
+
return _context80.stop();
|
8308
|
+
}
|
8309
|
+
}, _callee80);
|
8310
|
+
}));
|
8311
|
+
function getFiles(_x146) {
|
8312
|
+
return _getFiles.apply(this, arguments);
|
8313
|
+
}
|
8314
|
+
return getFiles;
|
8248
8315
|
}() // prettier-ignore
|
8249
8316
|
}, {
|
8250
8317
|
key: "handleTools",
|
8251
8318
|
value: function () {
|
8252
|
-
var _handleTools = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8319
|
+
var _handleTools = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee81(e) {
|
8253
8320
|
var t, i, n;
|
8254
|
-
return _regeneratorRuntime().wrap(function
|
8255
|
-
while (1) switch (
|
8321
|
+
return _regeneratorRuntime().wrap(function _callee81$(_context81) {
|
8322
|
+
while (1) switch (_context81.prev = _context81.next) {
|
8256
8323
|
case 0:
|
8257
8324
|
if (this._functionHandler) {
|
8258
|
-
|
8325
|
+
_context81.next = 2;
|
8259
8326
|
break;
|
8260
8327
|
}
|
8261
8328
|
throw Error("Please define the `function_handler` property inside the [openAI](https://deepchat.dev/docs/directConnection/openAI#Assistant) object.");
|
@@ -8266,14 +8333,14 @@ var Qi = /*#__PURE__*/function (_U10) {
|
|
8266
8333
|
arguments: r["function"].arguments
|
8267
8334
|
};
|
8268
8335
|
});
|
8269
|
-
|
8336
|
+
_context81.next = 5;
|
8270
8337
|
return this._functionHandler(t);
|
8271
8338
|
case 5:
|
8272
|
-
i =
|
8339
|
+
i = _context81.sent;
|
8273
8340
|
if (!(!Array.isArray(i) || i.find(function (r) {
|
8274
8341
|
return typeof r != "string";
|
8275
8342
|
}) || e.length !== i.length)) {
|
8276
|
-
|
8343
|
+
_context81.next = 8;
|
8277
8344
|
break;
|
8278
8345
|
}
|
8279
8346
|
throw Error("Response must contain an array of strings for each individual function/tool_call, see https://deepchat.dev/docs/directConnection/OpenAI/#assistant-functions.");
|
@@ -8285,21 +8352,21 @@ var Qi = /*#__PURE__*/function (_U10) {
|
|
8285
8352
|
};
|
8286
8353
|
});
|
8287
8354
|
this.url = "".concat(ae.THREAD_PREFIX, "/").concat(this.sessionId, "/runs/").concat(this.run_id, "/submit_tool_outputs");
|
8288
|
-
|
8355
|
+
_context81.next = 12;
|
8289
8356
|
return O.directFetch(this, {
|
8290
8357
|
tool_outputs: n
|
8291
8358
|
}, "POST");
|
8292
8359
|
case 12:
|
8293
|
-
return
|
8360
|
+
return _context81.abrupt("return", {
|
8294
8361
|
timeoutMS: ae.POLLING_TIMEOUT_MS
|
8295
8362
|
});
|
8296
8363
|
case 13:
|
8297
8364
|
case "end":
|
8298
|
-
return
|
8365
|
+
return _context81.stop();
|
8299
8366
|
}
|
8300
|
-
},
|
8367
|
+
}, _callee81, this);
|
8301
8368
|
}));
|
8302
|
-
function handleTools(
|
8369
|
+
function handleTools(_x147) {
|
8303
8370
|
return _handleTools.apply(this, arguments);
|
8304
8371
|
}
|
8305
8372
|
return handleTools;
|
@@ -8314,7 +8381,7 @@ var ri = /*#__PURE__*/function (_U11) {
|
|
8314
8381
|
_inherits(Se, _U11);
|
8315
8382
|
var _super33 = _createSuper(Se);
|
8316
8383
|
function Se(e) {
|
8317
|
-
var
|
8384
|
+
var _this36;
|
8318
8385
|
_classCallCheck(this, Se);
|
8319
8386
|
var o;
|
8320
8387
|
var t = e.directConnection,
|
@@ -8327,19 +8394,19 @@ var ri = /*#__PURE__*/function (_U11) {
|
|
8327
8394
|
}
|
8328
8395
|
}
|
8329
8396
|
};
|
8330
|
-
|
8397
|
+
_this36 = _super33.call(this, e, O.buildKeyVerificationDetails(), O.buildHeaders, i, n), _this36.insertKeyPlaceholderText = "OpenAI API Key", _this36.getKeyLink = "https://platform.openai.com/account/api-keys", _this36.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI DALL\xB7E</b></div>\n <p><b>Insert text</b> to generate an image.</p>\n <p><b>Upload 1</b> PNG image to generate its variation and optionally insert text to specify the change.</p>\n <p><b>Upload 2</b> PNG images where the second is a copy of the first with a transparent area where the edit should\n take place and text to specify the edit.</p>\n <p>Click <a href=\"https://platform.openai.com/docs/guides/images/introduction\">here</a> for more info.</p>", _this36.url = "", _this36.permittedErrorPrefixes = ["Incorrect", "Invalid input image"];
|
8331
8398
|
var r = (o = t == null ? void 0 : t.openAI) == null ? void 0 : o.images;
|
8332
|
-
if (
|
8399
|
+
if (_this36.camera) {
|
8333
8400
|
var a = _typeof(r) == "object" && r.size ? Number.parseInt(r.size) : 1024;
|
8334
|
-
|
8401
|
+
_this36.camera.files = {
|
8335
8402
|
dimensions: {
|
8336
8403
|
width: a,
|
8337
8404
|
height: a
|
8338
8405
|
}
|
8339
8406
|
};
|
8340
8407
|
}
|
8341
|
-
_typeof(r) == "object" && Object.assign(
|
8342
|
-
return
|
8408
|
+
_typeof(r) == "object" && Object.assign(_this36.rawBody, r), _this36.canSendMessage = Se.canFileSendMessage;
|
8409
|
+
return _this36;
|
8343
8410
|
}
|
8344
8411
|
_createClass(Se, [{
|
8345
8412
|
key: "preprocessBody",
|
@@ -8364,27 +8431,27 @@ var ri = /*#__PURE__*/function (_U11) {
|
|
8364
8431
|
}, {
|
8365
8432
|
key: "callServiceAPI",
|
8366
8433
|
value: function () {
|
8367
|
-
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8434
|
+
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee82(e, t, i) {
|
8368
8435
|
var n, r;
|
8369
|
-
return _regeneratorRuntime().wrap(function
|
8370
|
-
while (1) switch (
|
8436
|
+
return _regeneratorRuntime().wrap(function _callee82$(_context82) {
|
8437
|
+
while (1) switch (_context82.prev = _context82.next) {
|
8371
8438
|
case 0:
|
8372
8439
|
if ((n = this.requestSettings) != null && n.headers) {
|
8373
|
-
|
8440
|
+
_context82.next = 2;
|
8374
8441
|
break;
|
8375
8442
|
}
|
8376
8443
|
throw new Error("Request settings have not been set up");
|
8377
8444
|
case 2:
|
8378
8445
|
if (!(i != null && i[0])) {
|
8379
|
-
|
8446
|
+
_context82.next = 6;
|
8380
8447
|
break;
|
8381
8448
|
}
|
8382
8449
|
this.callApiWithImage(e, t, i);
|
8383
|
-
|
8450
|
+
_context82.next = 11;
|
8384
8451
|
break;
|
8385
8452
|
case 6:
|
8386
8453
|
if (this.requestSettings) {
|
8387
|
-
|
8454
|
+
_context82.next = 8;
|
8388
8455
|
break;
|
8389
8456
|
}
|
8390
8457
|
throw new Error("Request settings have not been set up");
|
@@ -8394,11 +8461,11 @@ var ri = /*#__PURE__*/function (_U11) {
|
|
8394
8461
|
_.request(this, r, e);
|
8395
8462
|
case 11:
|
8396
8463
|
case "end":
|
8397
|
-
return
|
8464
|
+
return _context82.stop();
|
8398
8465
|
}
|
8399
|
-
},
|
8466
|
+
}, _callee82, this);
|
8400
8467
|
}));
|
8401
|
-
function callServiceAPI(
|
8468
|
+
function callServiceAPI(_x148, _x149, _x150) {
|
8402
8469
|
return _callServiceAPI19.apply(this, arguments);
|
8403
8470
|
}
|
8404
8471
|
return callServiceAPI;
|
@@ -8406,17 +8473,17 @@ var ri = /*#__PURE__*/function (_U11) {
|
|
8406
8473
|
}, {
|
8407
8474
|
key: "extractResultData",
|
8408
8475
|
value: function () {
|
8409
|
-
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8410
|
-
return _regeneratorRuntime().wrap(function
|
8411
|
-
while (1) switch (
|
8476
|
+
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee83(e) {
|
8477
|
+
return _regeneratorRuntime().wrap(function _callee83$(_context83) {
|
8478
|
+
while (1) switch (_context83.prev = _context83.next) {
|
8412
8479
|
case 0:
|
8413
8480
|
if (!e.error) {
|
8414
|
-
|
8481
|
+
_context83.next = 2;
|
8415
8482
|
break;
|
8416
8483
|
}
|
8417
8484
|
throw e.error.message;
|
8418
8485
|
case 2:
|
8419
|
-
return
|
8486
|
+
return _context83.abrupt("return", {
|
8420
8487
|
files: e.data.map(function (i) {
|
8421
8488
|
return i.url ? {
|
8422
8489
|
src: i.url,
|
@@ -8429,11 +8496,11 @@ var ri = /*#__PURE__*/function (_U11) {
|
|
8429
8496
|
});
|
8430
8497
|
case 3:
|
8431
8498
|
case "end":
|
8432
|
-
return
|
8499
|
+
return _context83.stop();
|
8433
8500
|
}
|
8434
|
-
},
|
8501
|
+
}, _callee83);
|
8435
8502
|
}));
|
8436
|
-
function extractResultData(
|
8503
|
+
function extractResultData(_x151) {
|
8437
8504
|
return _extractResultData22.apply(this, arguments);
|
8438
8505
|
}
|
8439
8506
|
return extractResultData;
|
@@ -8470,22 +8537,22 @@ var dt = /*#__PURE__*/function (_U12) {
|
|
8470
8537
|
_inherits(dt, _U12);
|
8471
8538
|
var _super34 = _createSuper(dt);
|
8472
8539
|
function dt(e) {
|
8473
|
-
var
|
8474
|
-
var
|
8540
|
+
var _this37$maxMessages, _l$model;
|
8541
|
+
var _this37;
|
8475
8542
|
_classCallCheck(this, dt);
|
8476
8543
|
var r, o, a, l;
|
8477
8544
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
8478
8545
|
i = t.openAI;
|
8479
|
-
|
8546
|
+
_this37 = _super34.call(this, e, O.buildKeyVerificationDetails(), O.buildHeaders, i), _this37.insertKeyPlaceholderText = "OpenAI API Key", _this37.getKeyLink = "https://platform.openai.com/account/api-keys", _this37.url = "https://api.openai.com/v1/chat/completions", _this37.permittedErrorPrefixes = ["Incorrect"], _this37._systemMessage = dt.generateSystemMessage("You are a helpful assistant.");
|
8480
8547
|
var n = (r = t.openAI) == null ? void 0 : r.chat;
|
8481
8548
|
if (_typeof(n) == "object") {
|
8482
|
-
n.system_prompt && (
|
8549
|
+
n.system_prompt && (_this37._systemMessage = dt.generateSystemMessage(n.system_prompt));
|
8483
8550
|
var _ref10 = (a = (o = e.directConnection) == null ? void 0 : o.openAI) == null ? void 0 : a.chat,
|
8484
8551
|
c = _ref10.function_handler;
|
8485
|
-
c && (
|
8552
|
+
c && (_this37._functionHandler = c), _this37.cleanConfig(n), Object.assign(_this37.rawBody, n);
|
8486
8553
|
}
|
8487
|
-
(
|
8488
|
-
return
|
8554
|
+
(_this37$maxMessages = _this37.maxMessages) !== null && _this37$maxMessages !== void 0 ? _this37$maxMessages : _this37.maxMessages = -1, (_l$model = (l = _this37.rawBody).model) !== null && _l$model !== void 0 ? _l$model : l.model = "gpt-3.5-turbo";
|
8555
|
+
return _this37;
|
8489
8556
|
}
|
8490
8557
|
_createClass(dt, [{
|
8491
8558
|
key: "cleanConfig",
|
@@ -8512,13 +8579,13 @@ var dt = /*#__PURE__*/function (_U12) {
|
|
8512
8579
|
}, {
|
8513
8580
|
key: "callServiceAPI",
|
8514
8581
|
value: function () {
|
8515
|
-
var _callServiceAPI20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8582
|
+
var _callServiceAPI20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee84(e, t) {
|
8516
8583
|
var i, n;
|
8517
|
-
return _regeneratorRuntime().wrap(function
|
8518
|
-
while (1) switch (
|
8584
|
+
return _regeneratorRuntime().wrap(function _callee84$(_context84) {
|
8585
|
+
while (1) switch (_context84.prev = _context84.next) {
|
8519
8586
|
case 0:
|
8520
8587
|
if (this.requestSettings) {
|
8521
|
-
|
8588
|
+
_context84.next = 2;
|
8522
8589
|
break;
|
8523
8590
|
}
|
8524
8591
|
throw new Error("Request settings have not been set up");
|
@@ -8527,11 +8594,11 @@ var dt = /*#__PURE__*/function (_U12) {
|
|
8527
8594
|
n && (_typeof(n) != "object" || !n.simulation) || i.stream ? (i.stream = !0, I.request(this, i, e)) : _.request(this, i, e);
|
8528
8595
|
case 4:
|
8529
8596
|
case "end":
|
8530
|
-
return
|
8597
|
+
return _context84.stop();
|
8531
8598
|
}
|
8532
|
-
},
|
8599
|
+
}, _callee84, this);
|
8533
8600
|
}));
|
8534
|
-
function callServiceAPI(
|
8601
|
+
function callServiceAPI(_x152, _x153) {
|
8535
8602
|
return _callServiceAPI20.apply(this, arguments);
|
8536
8603
|
}
|
8537
8604
|
return callServiceAPI;
|
@@ -8539,17 +8606,17 @@ var dt = /*#__PURE__*/function (_U12) {
|
|
8539
8606
|
}, {
|
8540
8607
|
key: "extractResultData",
|
8541
8608
|
value: function () {
|
8542
|
-
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8543
|
-
return _regeneratorRuntime().wrap(function
|
8544
|
-
while (1) switch (
|
8609
|
+
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee85(e, t, i) {
|
8610
|
+
return _regeneratorRuntime().wrap(function _callee85$(_context85) {
|
8611
|
+
while (1) switch (_context85.prev = _context85.next) {
|
8545
8612
|
case 0:
|
8546
8613
|
if (!e.error) {
|
8547
|
-
|
8614
|
+
_context85.next = 2;
|
8548
8615
|
break;
|
8549
8616
|
}
|
8550
8617
|
throw e.error.message;
|
8551
8618
|
case 2:
|
8552
|
-
return
|
8619
|
+
return _context85.abrupt("return", e.choices[0].delta ? {
|
8553
8620
|
text: e.choices[0].delta.content || ""
|
8554
8621
|
} : e.choices[0].message ? e.choices[0].message.tool_calls ? this.handleTools(e.choices[0].message, t, i) : {
|
8555
8622
|
text: e.choices[0].message.content
|
@@ -8558,11 +8625,11 @@ var dt = /*#__PURE__*/function (_U12) {
|
|
8558
8625
|
});
|
8559
8626
|
case 3:
|
8560
8627
|
case "end":
|
8561
|
-
return
|
8628
|
+
return _context85.stop();
|
8562
8629
|
}
|
8563
|
-
},
|
8630
|
+
}, _callee85, this);
|
8564
8631
|
}));
|
8565
|
-
function extractResultData(
|
8632
|
+
function extractResultData(_x154, _x155, _x156) {
|
8566
8633
|
return _extractResultData23.apply(this, arguments);
|
8567
8634
|
}
|
8568
8635
|
return extractResultData;
|
@@ -8570,13 +8637,13 @@ var dt = /*#__PURE__*/function (_U12) {
|
|
8570
8637
|
}, {
|
8571
8638
|
key: "handleTools",
|
8572
8639
|
value: function () {
|
8573
|
-
var _handleTools2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8640
|
+
var _handleTools2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee86(e, t, i) {
|
8574
8641
|
var a, n, r, o, l;
|
8575
|
-
return _regeneratorRuntime().wrap(function
|
8576
|
-
while (1) switch (
|
8642
|
+
return _regeneratorRuntime().wrap(function _callee86$(_context86) {
|
8643
|
+
while (1) switch (_context86.prev = _context86.next) {
|
8577
8644
|
case 0:
|
8578
8645
|
if (!(!e.tool_calls || !t || !i || !this._functionHandler)) {
|
8579
|
-
|
8646
|
+
_context86.next = 2;
|
8580
8647
|
break;
|
8581
8648
|
}
|
8582
8649
|
throw Error("Please define the `function_handler` property inside the [openAI](https://deepchat.dev/docs/directConnection/openAI#Chat) object.");
|
@@ -8588,27 +8655,27 @@ var dt = /*#__PURE__*/function (_U12) {
|
|
8588
8655
|
arguments: l["function"].arguments
|
8589
8656
|
};
|
8590
8657
|
});
|
8591
|
-
|
8658
|
+
_context86.next = 6;
|
8592
8659
|
return (a = this._functionHandler) == null ? void 0 : a.call(this, r);
|
8593
8660
|
case 6:
|
8594
|
-
o =
|
8661
|
+
o = _context86.sent;
|
8595
8662
|
if (!o.text) {
|
8596
|
-
|
8663
|
+
_context86.next = 9;
|
8597
8664
|
break;
|
8598
8665
|
}
|
8599
|
-
return
|
8666
|
+
return _context86.abrupt("return", {
|
8600
8667
|
text: o.text
|
8601
8668
|
});
|
8602
8669
|
case 9:
|
8603
8670
|
if (!(n.messages.push(e), Array.isArray(o) && !o.find(function (l) {
|
8604
8671
|
return typeof l != "string";
|
8605
8672
|
}) || r.length === o.length)) {
|
8606
|
-
|
8673
|
+
_context86.next = 17;
|
8607
8674
|
break;
|
8608
8675
|
}
|
8609
8676
|
o.forEach(function (c, d) {
|
8610
|
-
var
|
8611
|
-
var u = (
|
8677
|
+
var p;
|
8678
|
+
var u = (p = e.tool_calls) == null ? void 0 : p[d];
|
8612
8679
|
n == null || n.messages.push({
|
8613
8680
|
role: "tool",
|
8614
8681
|
tool_call_id: u == null ? void 0 : u.id,
|
@@ -8616,30 +8683,30 @@ var dt = /*#__PURE__*/function (_U12) {
|
|
8616
8683
|
content: c.response
|
8617
8684
|
});
|
8618
8685
|
}), delete n.tools, delete n.tool_choice;
|
8619
|
-
|
8686
|
+
_context86.next = 13;
|
8620
8687
|
return t == null ? void 0 : t(n).then(function (c) {
|
8621
8688
|
return E.processResponseByType(c);
|
8622
8689
|
});
|
8623
8690
|
case 13:
|
8624
|
-
l =
|
8691
|
+
l = _context86.sent;
|
8625
8692
|
if (!l.error) {
|
8626
|
-
|
8693
|
+
_context86.next = 16;
|
8627
8694
|
break;
|
8628
8695
|
}
|
8629
8696
|
throw l.error.message;
|
8630
8697
|
case 16:
|
8631
|
-
return
|
8698
|
+
return _context86.abrupt("return", {
|
8632
8699
|
text: l.choices[0].message.content || ""
|
8633
8700
|
});
|
8634
8701
|
case 17:
|
8635
8702
|
throw Error("Response object must either be {response: string}[] for each individual function or {text: string} for a direct response, see https://deepchat.dev/docs/directConnection/OpenAI#FunctionHandler.");
|
8636
8703
|
case 18:
|
8637
8704
|
case "end":
|
8638
|
-
return
|
8705
|
+
return _context86.stop();
|
8639
8706
|
}
|
8640
|
-
},
|
8707
|
+
}, _callee86, this);
|
8641
8708
|
}));
|
8642
|
-
function handleTools(
|
8709
|
+
function handleTools(_x157, _x158, _x159) {
|
8643
8710
|
return _handleTools2.apply(this, arguments);
|
8644
8711
|
}
|
8645
8712
|
return handleTools;
|
@@ -8678,15 +8745,15 @@ var qo = /*#__PURE__*/function (_Yi3) {
|
|
8678
8745
|
_inherits(qo, _Yi3);
|
8679
8746
|
var _super35 = _createSuper(qo);
|
8680
8747
|
function qo(e) {
|
8681
|
-
var
|
8682
|
-
var
|
8748
|
+
var _this38$maxMessages;
|
8749
|
+
var _this38;
|
8683
8750
|
_classCallCheck(this, qo);
|
8684
8751
|
var r;
|
8685
8752
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
8686
8753
|
i = (r = t.cohere) == null ? void 0 : r.chat,
|
8687
8754
|
n = t.cohere;
|
8688
|
-
|
8689
|
-
return
|
8755
|
+
_this38 = _super35.call(this, e, "https://api.cohere.ai/v1/chat", "Ask me anything!", i, n), _typeof(i) == "object" && Object.assign(_this38.rawBody, i), (_this38$maxMessages = _this38.maxMessages) !== null && _this38$maxMessages !== void 0 ? _this38$maxMessages : _this38.maxMessages = -1;
|
8756
|
+
return _this38;
|
8690
8757
|
}
|
8691
8758
|
_createClass(qo, [{
|
8692
8759
|
key: "preprocessBody",
|
@@ -8705,13 +8772,13 @@ var qo = /*#__PURE__*/function (_Yi3) {
|
|
8705
8772
|
}, {
|
8706
8773
|
key: "callServiceAPI",
|
8707
8774
|
value: function () {
|
8708
|
-
var _callServiceAPI21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8775
|
+
var _callServiceAPI21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee87(e, t) {
|
8709
8776
|
var i;
|
8710
|
-
return _regeneratorRuntime().wrap(function
|
8711
|
-
while (1) switch (
|
8777
|
+
return _regeneratorRuntime().wrap(function _callee87$(_context87) {
|
8778
|
+
while (1) switch (_context87.prev = _context87.next) {
|
8712
8779
|
case 0:
|
8713
8780
|
if (this.requestSettings) {
|
8714
|
-
|
8781
|
+
_context87.next = 2;
|
8715
8782
|
break;
|
8716
8783
|
}
|
8717
8784
|
throw new Error("Request settings have not been set up");
|
@@ -8720,11 +8787,11 @@ var qo = /*#__PURE__*/function (_Yi3) {
|
|
8720
8787
|
_.request(this, i, e);
|
8721
8788
|
case 4:
|
8722
8789
|
case "end":
|
8723
|
-
return
|
8790
|
+
return _context87.stop();
|
8724
8791
|
}
|
8725
|
-
},
|
8792
|
+
}, _callee87, this);
|
8726
8793
|
}));
|
8727
|
-
function callServiceAPI(
|
8794
|
+
function callServiceAPI(_x160, _x161) {
|
8728
8795
|
return _callServiceAPI21.apply(this, arguments);
|
8729
8796
|
}
|
8730
8797
|
return callServiceAPI;
|
@@ -8732,26 +8799,26 @@ var qo = /*#__PURE__*/function (_Yi3) {
|
|
8732
8799
|
}, {
|
8733
8800
|
key: "extractResultData",
|
8734
8801
|
value: function () {
|
8735
|
-
var _extractResultData24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8736
|
-
return _regeneratorRuntime().wrap(function
|
8737
|
-
while (1) switch (
|
8802
|
+
var _extractResultData24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee88(e) {
|
8803
|
+
return _regeneratorRuntime().wrap(function _callee88$(_context88) {
|
8804
|
+
while (1) switch (_context88.prev = _context88.next) {
|
8738
8805
|
case 0:
|
8739
8806
|
if (!e.message) {
|
8740
|
-
|
8807
|
+
_context88.next = 2;
|
8741
8808
|
break;
|
8742
8809
|
}
|
8743
8810
|
throw e.message;
|
8744
8811
|
case 2:
|
8745
|
-
return
|
8812
|
+
return _context88.abrupt("return", {
|
8746
8813
|
text: e.text
|
8747
8814
|
});
|
8748
8815
|
case 3:
|
8749
8816
|
case "end":
|
8750
|
-
return
|
8817
|
+
return _context88.stop();
|
8751
8818
|
}
|
8752
|
-
},
|
8819
|
+
}, _callee88);
|
8753
8820
|
}));
|
8754
|
-
function extractResultData(
|
8821
|
+
function extractResultData(_x162) {
|
8755
8822
|
return _extractResultData24.apply(this, arguments);
|
8756
8823
|
}
|
8757
8824
|
return extractResultData;
|
@@ -8939,20 +9006,20 @@ var fe = /*#__PURE__*/function () {
|
|
8939
9006
|
}, {
|
8940
9007
|
key: "addNewImageMessage",
|
8941
9008
|
value: function () {
|
8942
|
-
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9009
|
+
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee89(e, t, i) {
|
8943
9010
|
var n, r;
|
8944
|
-
return _regeneratorRuntime().wrap(function
|
8945
|
-
while (1) switch (
|
9011
|
+
return _regeneratorRuntime().wrap(function _callee89$(_context89) {
|
9012
|
+
while (1) switch (_context89.prev = _context89.next) {
|
8946
9013
|
case 0:
|
8947
9014
|
n = fe.createImage(t, e.elementRef), r = e.createNewMessageElement("", i);
|
8948
9015
|
r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("image-message"), ne.addMessage(e, r, "image", i);
|
8949
9016
|
case 2:
|
8950
9017
|
case "end":
|
8951
|
-
return
|
9018
|
+
return _context89.stop();
|
8952
9019
|
}
|
8953
|
-
},
|
9020
|
+
}, _callee89);
|
8954
9021
|
}));
|
8955
|
-
function addNewImageMessage(
|
9022
|
+
function addNewImageMessage(_x163, _x164, _x165) {
|
8956
9023
|
return _addNewImageMessage.apply(this, arguments);
|
8957
9024
|
}
|
8958
9025
|
return addNewImageMessage;
|
@@ -9005,23 +9072,23 @@ var me = /*#__PURE__*/function (_Ke) {
|
|
9005
9072
|
_inherits(me, _Ke);
|
9006
9073
|
var _super36 = _createSuper(me);
|
9007
9074
|
function me(e, t, i) {
|
9008
|
-
var
|
9075
|
+
var _this39;
|
9009
9076
|
_classCallCheck(this, me);
|
9010
9077
|
var a, l;
|
9011
|
-
|
9078
|
+
_this39 = _super36.call(this, e);
|
9012
9079
|
var n = t.permittedErrorPrefixes,
|
9013
9080
|
r = t.introPanelMarkUp,
|
9014
9081
|
o = t.demo;
|
9015
|
-
|
9016
|
-
return JSON.parse(JSON.stringify(
|
9017
|
-
}, e.clearMessages =
|
9018
|
-
|
9082
|
+
_this39._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, _this39._onClearMessages = jt.onClearMessages.bind(_assertThisInitialized(_this39), e), _this39._onError = jt.onError.bind(_assertThisInitialized(_this39), e), _this39._displayLoadingMessage = me.getDisplayLoadingMessage(e, t), _this39._permittedErrorPrefixes = n, _this39.addSetupMessageIfNeeded(e, t) || _this39.populateIntroPanel(i, r, e.introPanelStyle), _this39.addIntroductoryMessage(e, t), e.initialMessages && _this39.populateInitialMessages(e.initialMessages), _this39._displayServiceErrorMessages = (l = e.errorMessages) == null ? void 0 : l.displayServiceErrorMessages, e.getMessages = function () {
|
9083
|
+
return JSON.parse(JSON.stringify(_this39.messages));
|
9084
|
+
}, e.clearMessages = _this39.clearMessages.bind(_assertThisInitialized(_this39), t), e.refreshMessages = _this39.refreshTextMessages.bind(_assertThisInitialized(_this39)), e.scrollToBottom = Y.scrollToBottom.bind(_assertThisInitialized(_this39), _this39.elementRef), e._addMessage = function (c, d) {
|
9085
|
+
_this39.addNewMessage(_objectSpread(_objectSpread({}, c), {}, {
|
9019
9086
|
sendUpdate: !!d
|
9020
9087
|
}), !d);
|
9021
|
-
}, t.isWebModel() && t.setUpMessages(_assertThisInitialized(
|
9022
|
-
|
9088
|
+
}, t.isWebModel() && t.setUpMessages(_assertThisInitialized(_this39)), o && _this39.prepareDemo(o), e.textToSpeech && Nt.processConfig(e.textToSpeech, function (c) {
|
9089
|
+
_this39.textToSpeech = c;
|
9023
9090
|
});
|
9024
|
-
return
|
9091
|
+
return _this39;
|
9025
9092
|
}
|
9026
9093
|
_createClass(me, [{
|
9027
9094
|
key: "prepareDemo",
|
@@ -9060,11 +9127,11 @@ var me = /*#__PURE__*/function (_Ke) {
|
|
9060
9127
|
}, {
|
9061
9128
|
key: "populateInitialMessages",
|
9062
9129
|
value: function populateInitialMessages(e) {
|
9063
|
-
var
|
9130
|
+
var _this40 = this;
|
9064
9131
|
e.forEach(function (t) {
|
9065
|
-
ke.processInitialMessageFile(t),
|
9132
|
+
ke.processInitialMessageFile(t), _this40.addNewMessage(t, !0);
|
9066
9133
|
}), setTimeout(function () {
|
9067
|
-
return Y.scrollToBottom(
|
9134
|
+
return Y.scrollToBottom(_this40.elementRef);
|
9068
9135
|
}, 0);
|
9069
9136
|
}
|
9070
9137
|
// this should not be activated by streamed messages
|
@@ -9106,7 +9173,7 @@ var me = /*#__PURE__*/function (_Ke) {
|
|
9106
9173
|
}, {
|
9107
9174
|
key: "addNewErrorMessage",
|
9108
9175
|
value: function addNewErrorMessage(e, t) {
|
9109
|
-
var l, c, d, u,
|
9176
|
+
var l, c, d, u, p;
|
9110
9177
|
this.removeMessageOnError();
|
9111
9178
|
var i = me.createBaseElements(),
|
9112
9179
|
n = i.outerContainer,
|
@@ -9115,7 +9182,7 @@ var me = /*#__PURE__*/function (_Ke) {
|
|
9115
9182
|
var o = this.getPermittedMessage(t) || ((l = this._errorMessageOverrides) == null ? void 0 : l[e]) || ((c = this._errorMessageOverrides) == null ? void 0 : c["default"]) || "Error, please try again.";
|
9116
9183
|
this.renderText(r, o);
|
9117
9184
|
var a = D.extractParticularSharedStyles(["fontSize", "fontFamily"], (d = this.messageStyles) == null ? void 0 : d["default"]);
|
9118
|
-
D.applyCustomStylesToElements(i, !1, a), D.applyCustomStylesToElements(i, !1, (u = this.messageStyles) == null ? void 0 : u.error), this.elementRef.appendChild(n), Y.scrollToBottom(this.elementRef), this.textToSpeech && Nt.speak(o, this.textToSpeech), (
|
9185
|
+
D.applyCustomStylesToElements(i, !1, a), D.applyCustomStylesToElements(i, !1, (u = this.messageStyles) == null ? void 0 : u.error), this.elementRef.appendChild(n), Y.scrollToBottom(this.elementRef), this.textToSpeech && Nt.speak(o, this.textToSpeech), (p = this._onError) == null || p.call(this, o);
|
9119
9186
|
}
|
9120
9187
|
}, {
|
9121
9188
|
key: "getPermittedMessage",
|
@@ -9162,11 +9229,11 @@ var me = /*#__PURE__*/function (_Ke) {
|
|
9162
9229
|
}, {
|
9163
9230
|
key: "addMultipleFiles",
|
9164
9231
|
value: function () {
|
9165
|
-
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9166
|
-
return _regeneratorRuntime().wrap(function
|
9167
|
-
while (1) switch (
|
9232
|
+
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee90(e) {
|
9233
|
+
return _regeneratorRuntime().wrap(function _callee90$(_context90) {
|
9234
|
+
while (1) switch (_context90.prev = _context90.next) {
|
9168
9235
|
case 0:
|
9169
|
-
return
|
9236
|
+
return _context90.abrupt("return", Promise.all((e || []).map(function (t) {
|
9170
9237
|
return new Promise(function (i) {
|
9171
9238
|
if (!t.type || t.type === "any") {
|
9172
9239
|
var n = t.file.name || ne.DEFAULT_FILE_NAME;
|
@@ -9189,11 +9256,11 @@ var me = /*#__PURE__*/function (_Ke) {
|
|
9189
9256
|
})));
|
9190
9257
|
case 1:
|
9191
9258
|
case "end":
|
9192
|
-
return
|
9259
|
+
return _context90.stop();
|
9193
9260
|
}
|
9194
|
-
},
|
9261
|
+
}, _callee90);
|
9195
9262
|
}));
|
9196
|
-
function addMultipleFiles(
|
9263
|
+
function addMultipleFiles(_x166) {
|
9197
9264
|
return _addMultipleFiles.apply(this, arguments);
|
9198
9265
|
}
|
9199
9266
|
return addMultipleFiles;
|
@@ -9515,11 +9582,11 @@ var _e = /*#__PURE__*/function () {
|
|
9515
9582
|
}();
|
9516
9583
|
var tn = /*#__PURE__*/function () {
|
9517
9584
|
function tn(e, t) {
|
9518
|
-
var
|
9585
|
+
var _this41 = this;
|
9519
9586
|
_classCallCheck(this, tn);
|
9520
9587
|
var i;
|
9521
9588
|
this._isOpen = !0, this._styles = t, this.elementRef = tn.createElement((i = this._styles) == null ? void 0 : i.container), this.close(), setTimeout(function () {
|
9522
|
-
return
|
9589
|
+
return _this41.addWindowEvents(e);
|
9523
9590
|
});
|
9524
9591
|
}
|
9525
9592
|
_createClass(tn, [{
|
@@ -9575,15 +9642,15 @@ var Je = /*#__PURE__*/function (_wt) {
|
|
9575
9642
|
_inherits(Je, _wt);
|
9576
9643
|
var _super37 = _createSuper(Je);
|
9577
9644
|
function Je(e, t) {
|
9578
|
-
var
|
9645
|
+
var _this42;
|
9579
9646
|
_classCallCheck(this, Je);
|
9580
9647
|
var n;
|
9581
|
-
|
9648
|
+
_this42 = _super37.call(this, Je.createButtonElement(), void 0, {
|
9582
9649
|
styles: (n = t == null ? void 0 : t.button) == null ? void 0 : n.styles
|
9583
9650
|
});
|
9584
|
-
var i =
|
9585
|
-
|
9586
|
-
return
|
9651
|
+
var i = _this42.createInnerElements(_this42._customStyles);
|
9652
|
+
_this42._menu = new tn(e, t == null ? void 0 : t.menu), _this42.addClickEvent(), _this42.buttonContainer = Je.createButtonContainer(), _this42.elementRef.appendChild(i.styles), _this42.buttonContainer.appendChild(_this42.elementRef), _this42.elementRef.classList.add("dropup-icon", "upload-file-button"), _this42.buttonContainer.appendChild(_this42._menu.elementRef), _this42.reapplyStateStyle("styles"), _this42.addContainerEvents(e);
|
9653
|
+
return _this42;
|
9587
9654
|
}
|
9588
9655
|
_createClass(Je, [{
|
9589
9656
|
key: "createInnerElements",
|
@@ -9610,9 +9677,9 @@ var Je = /*#__PURE__*/function (_wt) {
|
|
9610
9677
|
}, {
|
9611
9678
|
key: "addContainerEvents",
|
9612
9679
|
value: function addContainerEvents(e) {
|
9613
|
-
var
|
9680
|
+
var _this43 = this;
|
9614
9681
|
e.addEventListener("click", function (t) {
|
9615
|
-
t.target.classList.contains("dropup-icon") ||
|
9682
|
+
t.target.classList.contains("dropup-icon") || _this43._menu.close();
|
9616
9683
|
});
|
9617
9684
|
}
|
9618
9685
|
}], [{
|
@@ -9747,10 +9814,10 @@ var $o = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 24 24\"
|
|
9747
9814
|
var ue = /*#__PURE__*/function () {
|
9748
9815
|
// prettier-ignore
|
9749
9816
|
function ue(e, t, i, n) {
|
9750
|
-
var
|
9817
|
+
var _this44 = this;
|
9751
9818
|
_classCallCheck(this, ue);
|
9752
9819
|
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 () {
|
9753
|
-
|
9820
|
+
_this44._validationHandler = e._validationHandler;
|
9754
9821
|
});
|
9755
9822
|
}
|
9756
9823
|
_createClass(ue, [{
|
@@ -9891,12 +9958,12 @@ var ea = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9891
9958
|
_createClass(we, [{
|
9892
9959
|
key: "createTimer",
|
9893
9960
|
value: function createTimer(e, t) {
|
9894
|
-
var
|
9961
|
+
var _this45 = this;
|
9895
9962
|
var i = 0;
|
9896
9963
|
var n = t !== void 0 && t < we.TIMER_LIMIT_S ? t : we.TIMER_LIMIT_S;
|
9897
9964
|
return setInterval(function () {
|
9898
9965
|
var a;
|
9899
|
-
i += 1, i === n && ((a =
|
9966
|
+
i += 1, i === n && ((a = _this45.stopPlaceholderCallback) == null || a.call(_this45), _this45.clearTimer()), i === 600 && e.classList.add("audio-placeholder-text-4-digits");
|
9900
9967
|
var r = Math.floor(i / 60),
|
9901
9968
|
o = (i % 60).toString().padStart(2, "0");
|
9902
9969
|
e.textContent = "".concat(r, ":").concat(o);
|
@@ -9916,7 +9983,7 @@ var ea = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9916
9983
|
}, {
|
9917
9984
|
key: "addPlaceholderAudioAttachmentEvents",
|
9918
9985
|
value: function addPlaceholderAudioAttachmentEvents(e, t, i) {
|
9919
|
-
var
|
9986
|
+
var _this46 = this;
|
9920
9987
|
var n = function n() {
|
9921
9988
|
return e.replaceChildren(t);
|
9922
9989
|
};
|
@@ -9927,7 +9994,7 @@ var ea = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9927
9994
|
e.addEventListener("mouseleave", r);
|
9928
9995
|
var o = function o() {
|
9929
9996
|
var a;
|
9930
|
-
return (a =
|
9997
|
+
return (a = _this46.stopPlaceholderCallback) == null ? void 0 : a.call(_this46);
|
9931
9998
|
};
|
9932
9999
|
e.addEventListener("click", o);
|
9933
10000
|
}
|
@@ -10046,33 +10113,33 @@ var _t = /*#__PURE__*/function () {
|
|
10046
10113
|
}, {
|
10047
10114
|
key: "completePlaceholders",
|
10048
10115
|
value: function () {
|
10049
|
-
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
10050
|
-
return _regeneratorRuntime().wrap(function
|
10051
|
-
while (1) switch (
|
10116
|
+
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee92() {
|
10117
|
+
return _regeneratorRuntime().wrap(function _callee92$(_context92) {
|
10118
|
+
while (1) switch (_context92.prev = _context92.next) {
|
10052
10119
|
case 0:
|
10053
|
-
|
10120
|
+
_context92.next = 2;
|
10054
10121
|
return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
|
10055
|
-
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
10122
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee91(e) {
|
10056
10123
|
var t;
|
10057
|
-
return _regeneratorRuntime().wrap(function
|
10058
|
-
while (1) switch (
|
10124
|
+
return _regeneratorRuntime().wrap(function _callee91$(_context91) {
|
10125
|
+
while (1) switch (_context91.prev = _context91.next) {
|
10059
10126
|
case 0:
|
10060
|
-
return
|
10127
|
+
return _context91.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
|
10061
10128
|
case 1:
|
10062
10129
|
case "end":
|
10063
|
-
return
|
10130
|
+
return _context91.stop();
|
10064
10131
|
}
|
10065
|
-
},
|
10132
|
+
}, _callee91);
|
10066
10133
|
}));
|
10067
|
-
return function (
|
10134
|
+
return function (_x167) {
|
10068
10135
|
return _ref11.apply(this, arguments);
|
10069
10136
|
};
|
10070
10137
|
}()));
|
10071
10138
|
case 2:
|
10072
10139
|
case "end":
|
10073
|
-
return
|
10140
|
+
return _context92.stop();
|
10074
10141
|
}
|
10075
|
-
},
|
10142
|
+
}, _callee92, this);
|
10076
10143
|
}));
|
10077
10144
|
function completePlaceholders() {
|
10078
10145
|
return _completePlaceholders.apply(this, arguments);
|
@@ -10122,20 +10189,20 @@ var fs = /*#__PURE__*/function () {
|
|
10122
10189
|
}, {
|
10123
10190
|
key: "addButtons",
|
10124
10191
|
value: function addButtons() {
|
10125
|
-
var
|
10192
|
+
var _this47 = this;
|
10126
10193
|
for (var _len2 = arguments.length, e = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
10127
10194
|
e[_key2] = arguments[_key2];
|
10128
10195
|
}
|
10129
10196
|
e.forEach(function (t) {
|
10130
|
-
return
|
10197
|
+
return _this47._buttonPanel.appendChild(t);
|
10131
10198
|
});
|
10132
10199
|
}
|
10133
10200
|
}, {
|
10134
10201
|
key: "close",
|
10135
10202
|
value: function close() {
|
10136
|
-
var
|
10203
|
+
var _this48 = this;
|
10137
10204
|
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 () {
|
10138
|
-
|
10205
|
+
_this48._elementRef.style.display = "none", _this48._backgroundPanelRef.style.display = "none";
|
10139
10206
|
}, le.MODAL_CLOSE_TIMEOUT_MS);
|
10140
10207
|
}
|
10141
10208
|
}, {
|
@@ -10151,10 +10218,10 @@ var fs = /*#__PURE__*/function () {
|
|
10151
10218
|
}, {
|
10152
10219
|
key: "addCloseButton",
|
10153
10220
|
value: function addCloseButton(e, t, i) {
|
10154
|
-
var
|
10221
|
+
var _this49 = this;
|
10155
10222
|
var n = t ? le.createSVGButton(e) : le.createTextButton(e);
|
10156
10223
|
return this.addButtons(n), n.onclick = function () {
|
10157
|
-
|
10224
|
+
_this49.close(), setTimeout(function () {
|
10158
10225
|
i == null || i();
|
10159
10226
|
}, 140);
|
10160
10227
|
}, n;
|
@@ -10228,13 +10295,13 @@ var ut = /*#__PURE__*/function (_wt2) {
|
|
10228
10295
|
var _super39 = _createSuper(ut);
|
10229
10296
|
// prettier-ignore
|
10230
10297
|
function ut(e, t, i, n, r, o) {
|
10231
|
-
var
|
10298
|
+
var _this50;
|
10232
10299
|
_classCallCheck(this, ut);
|
10233
|
-
var l, c, d, u,
|
10234
|
-
|
10235
|
-
var a =
|
10236
|
-
|
10237
|
-
return
|
10300
|
+
var l, c, d, u, p, h;
|
10301
|
+
_this50 = _super39.call(this, ut.createButtonElement(), (l = i.button) == null ? void 0 : l.position, i.button, o);
|
10302
|
+
var a = _this50.createInnerElements(n, r, _this50._customStyles);
|
10303
|
+
_this50._inputElement = ut.createInputElement((c = i == null ? void 0 : i.files) == null ? void 0 : c.acceptedFormats), _this50.addClickEvent(e, i), _this50.elementRef.replaceChildren(a.styles), _this50.reapplyStateStyle("styles"), _this50._fileAttachmentsType = t, _this50._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;
|
10304
|
+
return _this50;
|
10238
10305
|
}
|
10239
10306
|
_createClass(ut, [{
|
10240
10307
|
key: "createInnerElements",
|
@@ -10362,26 +10429,26 @@ var Me = /*#__PURE__*/function () {
|
|
10362
10429
|
}, {
|
10363
10430
|
key: "useValidationFunc",
|
10364
10431
|
value: function () {
|
10365
|
-
var _useValidationFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
10432
|
+
var _useValidationFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee93(e, t, i, n) {
|
10366
10433
|
var r, o, a, l;
|
10367
|
-
return _regeneratorRuntime().wrap(function
|
10368
|
-
while (1) switch (
|
10434
|
+
return _regeneratorRuntime().wrap(function _callee93$(_context93) {
|
10435
|
+
while (1) switch (_context93.prev = _context93.next) {
|
10369
10436
|
case 0:
|
10370
10437
|
r = t.inputElementRef, o = r.classList.contains("text-input-placeholder") ? "" : r.textContent;
|
10371
|
-
|
10438
|
+
_context93.next = 3;
|
10372
10439
|
return i.completePlaceholders();
|
10373
10440
|
case 3:
|
10374
10441
|
a = i.getAllFileData(), l = a == null ? void 0 : a.map(function (c) {
|
10375
10442
|
return c.file;
|
10376
10443
|
});
|
10377
|
-
return
|
10444
|
+
return _context93.abrupt("return", Me.validate(e, n, o, l));
|
10378
10445
|
case 5:
|
10379
10446
|
case "end":
|
10380
|
-
return
|
10447
|
+
return _context93.stop();
|
10381
10448
|
}
|
10382
|
-
},
|
10449
|
+
}, _callee93);
|
10383
10450
|
}));
|
10384
|
-
function useValidationFunc(
|
10451
|
+
function useValidationFunc(_x168, _x169, _x170, _x171) {
|
10385
10452
|
return _useValidationFunc.apply(this, arguments);
|
10386
10453
|
}
|
10387
10454
|
return useValidationFunc;
|
@@ -10389,22 +10456,22 @@ var Me = /*#__PURE__*/function () {
|
|
10389
10456
|
}, {
|
10390
10457
|
key: "useValidationFuncProgrammatic",
|
10391
10458
|
value: function () {
|
10392
|
-
var _useValidationFuncProgrammatic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
10459
|
+
var _useValidationFuncProgrammatic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee94(e, t, i) {
|
10393
10460
|
var r, n;
|
10394
|
-
return _regeneratorRuntime().wrap(function
|
10395
|
-
while (1) switch (
|
10461
|
+
return _regeneratorRuntime().wrap(function _callee94$(_context94) {
|
10462
|
+
while (1) switch (_context94.prev = _context94.next) {
|
10396
10463
|
case 0:
|
10397
10464
|
n = (r = t.files) == null ? void 0 : r.map(function (o) {
|
10398
10465
|
return o.file;
|
10399
10466
|
});
|
10400
|
-
return
|
10467
|
+
return _context94.abrupt("return", Me.validate(e, i, t.text, n, !0));
|
10401
10468
|
case 2:
|
10402
10469
|
case "end":
|
10403
|
-
return
|
10470
|
+
return _context94.stop();
|
10404
10471
|
}
|
10405
|
-
},
|
10472
|
+
}, _callee94);
|
10406
10473
|
}));
|
10407
|
-
function useValidationFuncProgrammatic(
|
10474
|
+
function useValidationFuncProgrammatic(_x172, _x173, _x174) {
|
10408
10475
|
return _useValidationFuncProgrammatic.apply(this, arguments);
|
10409
10476
|
}
|
10410
10477
|
return useValidationFuncProgrammatic;
|
@@ -10420,26 +10487,26 @@ var Me = /*#__PURE__*/function () {
|
|
10420
10487
|
value: function attach(e, t, i, n, r) {
|
10421
10488
|
var o = e.validateInput || ke.processValidateInput(e);
|
10422
10489
|
e._validationHandler = /*#__PURE__*/function () {
|
10423
|
-
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
10490
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee95(a) {
|
10424
10491
|
var l;
|
10425
|
-
return _regeneratorRuntime().wrap(function
|
10426
|
-
while (1) switch (
|
10492
|
+
return _regeneratorRuntime().wrap(function _callee95$(_context95) {
|
10493
|
+
while (1) switch (_context95.prev = _context95.next) {
|
10427
10494
|
case 0:
|
10428
10495
|
if (!(r.status.loadingActive || r.status.requestInProgress || t.isSubmitProgrammaticallyDisabled === !0 || !Me.validateWebsocket(t, r))) {
|
10429
|
-
|
10496
|
+
_context95.next = 2;
|
10430
10497
|
break;
|
10431
10498
|
}
|
10432
|
-
return
|
10499
|
+
return _context95.abrupt("return", !1);
|
10433
10500
|
case 2:
|
10434
10501
|
l = o || t.canSendMessage;
|
10435
|
-
return
|
10502
|
+
return _context95.abrupt("return", l ? a ? Me.useValidationFuncProgrammatic(l, a, r) : Me.useValidationFunc(l, i, n, r) : null);
|
10436
10503
|
case 4:
|
10437
10504
|
case "end":
|
10438
|
-
return
|
10505
|
+
return _context95.stop();
|
10439
10506
|
}
|
10440
|
-
},
|
10507
|
+
}, _callee95);
|
10441
10508
|
}));
|
10442
|
-
return function (
|
10509
|
+
return function (_x175) {
|
10443
10510
|
return _ref12.apply(this, arguments);
|
10444
10511
|
};
|
10445
10512
|
}();
|
@@ -10452,10 +10519,10 @@ var bt = /*#__PURE__*/function (_wt3) {
|
|
10452
10519
|
_inherits(bt, _wt3);
|
10453
10520
|
var _super40 = _createSuper(bt);
|
10454
10521
|
function bt(e) {
|
10455
|
-
var
|
10522
|
+
var _this51;
|
10456
10523
|
_classCallCheck(this, bt);
|
10457
|
-
(e == null ? void 0 : e.position) === "dropup-menu" && (e.position = "outside-right"),
|
10458
|
-
return
|
10524
|
+
(e == null ? void 0 : e.position) === "dropup-menu" && (e.position = "outside-right"), _this51 = _super40.call(this, bt.createMicrophoneElement(), e == null ? void 0 : e.position, e), _this51.isActive = !1, _this51._innerElements = _this51.createInnerElements(_this51._customStyles), _this51.changeToDefault();
|
10525
|
+
return _this51;
|
10459
10526
|
}
|
10460
10527
|
_createClass(bt, [{
|
10461
10528
|
key: "createInnerElements",
|
@@ -10662,9 +10729,9 @@ var J = /*#__PURE__*/function () {
|
|
10662
10729
|
}, {
|
10663
10730
|
key: "keyDownWindow",
|
10664
10731
|
value: function keyDownWindow(e) {
|
10665
|
-
var
|
10732
|
+
var _this52 = this;
|
10666
10733
|
e.element && J.getElementIfFocusedOnAvailable(e.element, document.activeElement) && (J.KEY_DOWN_TIMEOUT !== null && clearTimeout(J.KEY_DOWN_TIMEOUT), J.KEY_DOWN_TIMEOUT = setTimeout(function () {
|
10667
|
-
J.KEY_DOWN_TIMEOUT = null,
|
10734
|
+
J.KEY_DOWN_TIMEOUT = null, _this52.resetRecording(e);
|
10668
10735
|
}, 500));
|
10669
10736
|
}
|
10670
10737
|
}, {
|
@@ -10969,31 +11036,31 @@ var K = /*#__PURE__*/function () {
|
|
10969
11036
|
if (!c || !n || !i) return;
|
10970
11037
|
var d = ((o = c.settings) === null || o === void 0 ? void 0 : o.caseSensitive) === !0 ? t : t.toLowerCase(),
|
10971
11038
|
u = Cn.Text.breakupIntoWordsArr(d),
|
10972
|
-
|
10973
|
-
if (c.commandMode &&
|
11039
|
+
p = ((a = c.settings) === null || a === void 0 ? void 0 : a.substrings) === !1 ? K.checkIfMatchesWord : K.checkIfMatchesSubstring;
|
11040
|
+
if (c.commandMode && p(c.commandMode, d, u)) return e.setInterimColorToFinal(), setTimeout(function () {
|
10974
11041
|
return K.toggleCommandModeOn(e);
|
10975
11042
|
}), {
|
10976
11043
|
doNotProcessTranscription: !1
|
10977
11044
|
};
|
10978
11045
|
if (!(c.commandMode && !e.isWaitingForCommand)) {
|
10979
|
-
if (c.stop &&
|
11046
|
+
if (c.stop && p(c.stop, d, u)) return K.toggleCommandModeOff(e), setTimeout(function () {
|
10980
11047
|
return e.stop();
|
10981
11048
|
}), {
|
10982
11049
|
doNotProcessTranscription: !1
|
10983
11050
|
};
|
10984
|
-
if (c.pause &&
|
10985
|
-
var
|
10986
|
-
e.isPaused = !0, (
|
11051
|
+
if (c.pause && p(c.pause, d, u)) return K.toggleCommandModeOff(e), e.setInterimColorToFinal(), setTimeout(function () {
|
11052
|
+
var h;
|
11053
|
+
e.isPaused = !0, (h = e.onPauseTrigger) === null || h === void 0 || h.call(e, !0);
|
10987
11054
|
}), {
|
10988
11055
|
doNotProcessTranscription: !1
|
10989
11056
|
};
|
10990
|
-
if (c.resume &&
|
11057
|
+
if (c.resume && p(c.resume, d, u)) return e.isPaused = !1, (l = e.onPauseTrigger) === null || l === void 0 || l.call(e, !1), K.toggleCommandModeOff(e), e.resetRecording(i), {
|
10991
11058
|
doNotProcessTranscription: !0
|
10992
11059
|
};
|
10993
|
-
if (c.reset &&
|
11060
|
+
if (c.reset && p(c.reset, d, u)) return r !== void 0 && K.setText(e, i, r, n), {
|
10994
11061
|
doNotProcessTranscription: !0
|
10995
11062
|
};
|
10996
|
-
if (c.removeAllText &&
|
11063
|
+
if (c.removeAllText && p(c.removeAllText, d, u)) return K.setText(e, i, "", n), {
|
10997
11064
|
doNotProcessTranscription: !0
|
10998
11065
|
};
|
10999
11066
|
}
|
@@ -11285,22 +11352,22 @@ var Jt = /*#__PURE__*/function (_fa$Speech) {
|
|
11285
11352
|
}, {
|
11286
11353
|
key: "setEvents",
|
11287
11354
|
value: function setEvents() {
|
11288
|
-
var
|
11355
|
+
var _this53 = this;
|
11289
11356
|
this._service && (this._service.onstart = function () {
|
11290
|
-
|
11357
|
+
_this53.setStateOnStart();
|
11291
11358
|
}, this._service.onerror = function (e) {
|
11292
|
-
Nn.Browser.IS_SAFARI() && e.message === "Another request is started" || e.error === "aborted" &&
|
11359
|
+
Nn.Browser.IS_SAFARI() && e.message === "Another request is started" || e.error === "aborted" && _this53.isRestarting || e.error !== "no-speech" && _this53.error(e.message || e.error);
|
11293
11360
|
}, this._service.onaudioend = function () {
|
11294
|
-
|
11361
|
+
_this53.setStateOnStop();
|
11295
11362
|
}, this._service.onend = function () {
|
11296
|
-
|
11363
|
+
_this53._stopping = !1;
|
11297
11364
|
}, this._service.onresult = function (e) {
|
11298
|
-
if (_typeof(e.results) > "u" &&
|
11299
|
-
var
|
11300
|
-
t =
|
11301
|
-
_i17 =
|
11302
|
-
n =
|
11303
|
-
|
11365
|
+
if (_typeof(e.results) > "u" && _this53._service) _this53._service.onend = null, _this53._service.stop();else if (_this53._extractText && !_this53._stopping) {
|
11366
|
+
var _this53$_extractText = _this53._extractText(e, _this53.finalTranscript, _this53._translations),
|
11367
|
+
t = _this53$_extractText.interimTranscript,
|
11368
|
+
_i17 = _this53$_extractText.finalTranscript,
|
11369
|
+
n = _this53$_extractText.newText;
|
11370
|
+
_this53.updateElements(t, _i17, n);
|
11304
11371
|
}
|
11305
11372
|
});
|
11306
11373
|
}
|
@@ -11395,26 +11462,26 @@ var $t = /*#__PURE__*/function () {
|
|
11395
11462
|
}, {
|
11396
11463
|
key: "getNewSpeechConfig",
|
11397
11464
|
value: function () {
|
11398
|
-
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11399
|
-
return _regeneratorRuntime().wrap(function
|
11400
|
-
while (1) switch (
|
11465
|
+
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee96(e, t) {
|
11466
|
+
return _regeneratorRuntime().wrap(function _callee96$(_context96) {
|
11467
|
+
while (1) switch (_context96.prev = _context96.next) {
|
11401
11468
|
case 0:
|
11402
11469
|
if (!t.region) {
|
11403
|
-
|
11470
|
+
_context96.next = 2;
|
11404
11471
|
break;
|
11405
11472
|
}
|
11406
|
-
return
|
11473
|
+
return _context96.abrupt("return", t.subscriptionKey ? e.fromSubscription(t.subscriptionKey.trim(), t.region.trim()) : t.token ? e.fromAuthorizationToken(t.token.trim(), t.region.trim()) : t.retrieveToken ? t.retrieveToken().then(function (i) {
|
11407
11474
|
return t.region ? e.fromAuthorizationToken((i == null ? void 0 : i.trim()) || "", t.region.trim()) : null;
|
11408
11475
|
})["catch"](function (i) {
|
11409
11476
|
return console.error(i), null;
|
11410
11477
|
}) : null);
|
11411
11478
|
case 2:
|
11412
11479
|
case "end":
|
11413
|
-
return
|
11480
|
+
return _context96.stop();
|
11414
11481
|
}
|
11415
|
-
},
|
11482
|
+
}, _callee96);
|
11416
11483
|
}));
|
11417
|
-
function getNewSpeechConfig(
|
11484
|
+
function getNewSpeechConfig(_x176, _x177) {
|
11418
11485
|
return _getNewSpeechConfig.apply(this, arguments);
|
11419
11486
|
}
|
11420
11487
|
return getNewSpeechConfig;
|
@@ -11427,23 +11494,23 @@ var $t = /*#__PURE__*/function () {
|
|
11427
11494
|
}, {
|
11428
11495
|
key: "get",
|
11429
11496
|
value: function () {
|
11430
|
-
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11497
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee97(e, t) {
|
11431
11498
|
var i;
|
11432
|
-
return _regeneratorRuntime().wrap(function
|
11433
|
-
while (1) switch (
|
11499
|
+
return _regeneratorRuntime().wrap(function _callee97$(_context97) {
|
11500
|
+
while (1) switch (_context97.prev = _context97.next) {
|
11434
11501
|
case 0:
|
11435
|
-
|
11502
|
+
_context97.next = 2;
|
11436
11503
|
return $t.getNewSpeechConfig(e, t);
|
11437
11504
|
case 2:
|
11438
|
-
i =
|
11439
|
-
return
|
11505
|
+
i = _context97.sent;
|
11506
|
+
return _context97.abrupt("return", (i && $t.process(i, t), i));
|
11440
11507
|
case 4:
|
11441
11508
|
case "end":
|
11442
|
-
return
|
11509
|
+
return _context97.stop();
|
11443
11510
|
}
|
11444
|
-
},
|
11511
|
+
}, _callee97);
|
11445
11512
|
}));
|
11446
|
-
function get(
|
11513
|
+
function get(_x178, _x179) {
|
11447
11514
|
return _get.apply(this, arguments);
|
11448
11515
|
}
|
11449
11516
|
return get;
|
@@ -11520,10 +11587,10 @@ var Yt = /*#__PURE__*/function (_va$Speech) {
|
|
11520
11587
|
_inherits(Yt, _va$Speech);
|
11521
11588
|
var _super42 = _createSuper(Yt);
|
11522
11589
|
function Yt() {
|
11523
|
-
var
|
11590
|
+
var _this54;
|
11524
11591
|
_classCallCheck(this, Yt);
|
11525
|
-
|
11526
|
-
return
|
11592
|
+
_this54 = _super42.apply(this, arguments), _this54._newTextPadding = "";
|
11593
|
+
return _this54;
|
11527
11594
|
}
|
11528
11595
|
_createClass(Yt, [{
|
11529
11596
|
key: "start",
|
@@ -11533,28 +11600,28 @@ var Yt = /*#__PURE__*/function (_va$Speech) {
|
|
11533
11600
|
}, {
|
11534
11601
|
key: "startAsync",
|
11535
11602
|
value: function () {
|
11536
|
-
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11603
|
+
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee98(e) {
|
11537
11604
|
var t;
|
11538
|
-
return _regeneratorRuntime().wrap(function
|
11539
|
-
while (1) switch (
|
11605
|
+
return _regeneratorRuntime().wrap(function _callee98$(_context98) {
|
11606
|
+
while (1) switch (_context98.prev = _context98.next) {
|
11540
11607
|
case 0:
|
11541
|
-
|
11542
|
-
if (!
|
11543
|
-
|
11608
|
+
_context98.t0 = this.validate(e);
|
11609
|
+
if (!_context98.t0) {
|
11610
|
+
_context98.next = 6;
|
11544
11611
|
break;
|
11545
11612
|
}
|
11546
|
-
|
11613
|
+
_context98.next = 4;
|
11547
11614
|
return this.instantiateService(e);
|
11548
11615
|
case 4:
|
11549
11616
|
this._translations = e == null ? void 0 : e.translations;
|
11550
11617
|
(t = this._service) === null || t === void 0 || t.startContinuousRecognitionAsync(function () {}, this.error);
|
11551
11618
|
case 6:
|
11552
11619
|
case "end":
|
11553
|
-
return
|
11620
|
+
return _context98.stop();
|
11554
11621
|
}
|
11555
|
-
},
|
11622
|
+
}, _callee98, this);
|
11556
11623
|
}));
|
11557
|
-
function startAsync(
|
11624
|
+
function startAsync(_x180) {
|
11558
11625
|
return _startAsync.apply(this, arguments);
|
11559
11626
|
}
|
11560
11627
|
return startAsync;
|
@@ -11567,28 +11634,28 @@ var Yt = /*#__PURE__*/function (_va$Speech) {
|
|
11567
11634
|
}, {
|
11568
11635
|
key: "instantiateService",
|
11569
11636
|
value: function () {
|
11570
|
-
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11637
|
+
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee99(e) {
|
11571
11638
|
var t, i, n, r;
|
11572
|
-
return _regeneratorRuntime().wrap(function
|
11573
|
-
while (1) switch (
|
11639
|
+
return _regeneratorRuntime().wrap(function _callee99$(_context99) {
|
11640
|
+
while (1) switch (_context99.prev = _context99.next) {
|
11574
11641
|
case 0:
|
11575
11642
|
t = Yt.getAPI();
|
11576
11643
|
i = t.AudioConfig.fromDefaultMicrophoneInput();
|
11577
|
-
|
11644
|
+
_context99.next = 4;
|
11578
11645
|
return Dn.AzureSpeechConfig.get(t.SpeechConfig, e);
|
11579
11646
|
case 4:
|
11580
|
-
n =
|
11647
|
+
n = _context99.sent;
|
11581
11648
|
if (n) {
|
11582
11649
|
r = new t.SpeechRecognizer(n, i);
|
11583
11650
|
this.setEvents(r), this._service = r, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
|
11584
11651
|
} else this.error("Unable to contact Azure server");
|
11585
11652
|
case 6:
|
11586
11653
|
case "end":
|
11587
|
-
return
|
11654
|
+
return _context99.stop();
|
11588
11655
|
}
|
11589
|
-
},
|
11656
|
+
}, _callee99, this);
|
11590
11657
|
}));
|
11591
|
-
function instantiateService(
|
11658
|
+
function instantiateService(_x181) {
|
11592
11659
|
return _instantiateService.apply(this, arguments);
|
11593
11660
|
}
|
11594
11661
|
return instantiateService;
|
@@ -11651,12 +11718,12 @@ var Yt = /*#__PURE__*/function (_va$Speech) {
|
|
11651
11718
|
}, {
|
11652
11719
|
key: "retrieveTokenInterval",
|
11653
11720
|
value: function retrieveTokenInterval(e) {
|
11654
|
-
var
|
11721
|
+
var _this55 = this;
|
11655
11722
|
this._retrieveTokenInterval = setInterval(function () {
|
11656
11723
|
e == null || e().then(function (t) {
|
11657
|
-
|
11724
|
+
_this55._service && (_this55._service.authorizationToken = (t == null ? void 0 : t.trim()) || "");
|
11658
11725
|
})["catch"](function (t) {
|
11659
|
-
|
11726
|
+
_this55.error(t);
|
11660
11727
|
});
|
11661
11728
|
}, 1e4);
|
11662
11729
|
}
|
@@ -11738,18 +11805,18 @@ var Zt = /*#__PURE__*/function (_bt) {
|
|
11738
11805
|
_inherits(Zt, _bt);
|
11739
11806
|
var _super43 = _createSuper(Zt);
|
11740
11807
|
function Zt(e, t, i) {
|
11741
|
-
var
|
11808
|
+
var _this56;
|
11742
11809
|
_classCallCheck(this, Zt);
|
11743
11810
|
var o;
|
11744
|
-
|
11811
|
+
_this56 = _super43.call(this, _typeof(e.speechToText) == "object" ? (o = e.speechToText) == null ? void 0 : o.button : {});
|
11745
11812
|
var _Zt$processConfigurat = Zt.processConfiguration(t, e.speechToText),
|
11746
11813
|
n = _Zt$processConfigurat.serviceName,
|
11747
11814
|
r = _Zt$processConfigurat.processedConfig;
|
11748
|
-
if (
|
11815
|
+
if (_this56._addErrorMessage = i, n === "webspeech" && !Li.isWebSpeechSupported()) _this56.changeToUnsupported();else {
|
11749
11816
|
var a = !e.textInput || !e.textInput.disabled;
|
11750
|
-
|
11817
|
+
_this56.elementRef.onclick = _this56.buttonClick.bind(_assertThisInitialized(_this56), t, a, n, r);
|
11751
11818
|
}
|
11752
|
-
return
|
11819
|
+
return _this56;
|
11753
11820
|
}
|
11754
11821
|
// prettier-ignore
|
11755
11822
|
_createClass(Zt, [{
|
@@ -11830,11 +11897,11 @@ var Ea = /*#__PURE__*/function (_bt2) {
|
|
11830
11897
|
_inherits(Ea, _bt2);
|
11831
11898
|
var _super44 = _createSuper(Ea);
|
11832
11899
|
function Ea(e, t) {
|
11833
|
-
var
|
11900
|
+
var _this57;
|
11834
11901
|
_classCallCheck(this, Ea);
|
11835
11902
|
var i, n;
|
11836
|
-
|
11837
|
-
return
|
11903
|
+
_this57 = _super44.call(this, t.button), _this57._waitingForBrowserApproval = !1, _this57._audioType = e, _this57._extension = ((i = t.files) == null ? void 0 : i.format) || "mp3", _this57._maxDurationSeconds = (n = t.files) == null ? void 0 : n.maxDurationSeconds, _this57.elementRef.onclick = _this57.buttonClick.bind(_assertThisInitialized(_this57));
|
11904
|
+
return _this57;
|
11838
11905
|
}
|
11839
11906
|
_createClass(Ea, [{
|
11840
11907
|
key: "buttonClick",
|
@@ -11844,10 +11911,10 @@ var Ea = /*#__PURE__*/function (_bt2) {
|
|
11844
11911
|
}, {
|
11845
11912
|
key: "stop",
|
11846
11913
|
value: function stop() {
|
11847
|
-
var
|
11914
|
+
var _this58 = this;
|
11848
11915
|
return new Promise(function (e) {
|
11849
11916
|
var t, i;
|
11850
|
-
|
11917
|
+
_this58.changeToDefault(), (t = _this58._mediaRecorder) == null || t.stop(), (i = _this58._mediaStream) == null || i.getTracks().forEach(function (n) {
|
11851
11918
|
return n.stop();
|
11852
11919
|
}), setTimeout(function () {
|
11853
11920
|
e();
|
@@ -11857,23 +11924,23 @@ var Ea = /*#__PURE__*/function (_bt2) {
|
|
11857
11924
|
}, {
|
11858
11925
|
key: "record",
|
11859
11926
|
value: function record() {
|
11860
|
-
var
|
11927
|
+
var _this59 = this;
|
11861
11928
|
navigator.mediaDevices.getUserMedia({
|
11862
11929
|
audio: !0
|
11863
11930
|
}).then(function (e) {
|
11864
|
-
|
11865
|
-
|
11866
|
-
}),
|
11931
|
+
_this59.changeToActive(), _this59._mediaRecorder = new MediaRecorder(e), _this59._audioType.addPlaceholderAttachment(_this59.stop.bind(_this59), _this59._maxDurationSeconds), _this59._mediaStream = e, _this59._mediaRecorder.addEventListener("dataavailable", function (t) {
|
11932
|
+
_this59.createFile(t);
|
11933
|
+
}), _this59._mediaRecorder.start();
|
11867
11934
|
})["catch"](function (e) {
|
11868
|
-
console.error(e),
|
11935
|
+
console.error(e), _this59.stop();
|
11869
11936
|
})["finally"](function () {
|
11870
|
-
|
11937
|
+
_this59._waitingForBrowserApproval = !1;
|
11871
11938
|
});
|
11872
11939
|
}
|
11873
11940
|
}, {
|
11874
11941
|
key: "createFile",
|
11875
11942
|
value: function createFile(e) {
|
11876
|
-
var
|
11943
|
+
var _this60 = this;
|
11877
11944
|
var t = new Blob([e.data], {
|
11878
11945
|
type: "audio/".concat(this._extension)
|
11879
11946
|
}),
|
@@ -11883,7 +11950,7 @@ var Ea = /*#__PURE__*/function (_bt2) {
|
|
11883
11950
|
}),
|
11884
11951
|
r = new FileReader();
|
11885
11952
|
r.readAsDataURL(n), r.onload = function (o) {
|
11886
|
-
|
11953
|
+
_this60._audioType.completePlaceholderAttachment(n, o.target.result);
|
11887
11954
|
};
|
11888
11955
|
}
|
11889
11956
|
}]);
|
@@ -11963,19 +12030,19 @@ var yi = /*#__PURE__*/function (_wt4) {
|
|
11963
12030
|
var _super45 = _createSuper(k);
|
11964
12031
|
// prettier-ignore
|
11965
12032
|
function k(e, t, i, n, r) {
|
11966
|
-
var
|
12033
|
+
var _this61;
|
11967
12034
|
_classCallCheck(this, k);
|
11968
12035
|
var o = Ce.process(e.submitButtonStyles);
|
11969
|
-
|
12036
|
+
_this61 = _super45.call(this, k.createButtonContainerElement(), o == null ? void 0 : o.position, o), _this61._isSVGLoadingIconOverriden = !1, _this61.status = {
|
11970
12037
|
requestInProgress: !1,
|
11971
12038
|
loadingActive: !1
|
11972
|
-
},
|
12039
|
+
}, _this61._messages = i, _this61._inputElementRef = t, _this61._fileAttachments = r, _this61._innerElements = _this61.createInnerElements(), _this61._abortStream = new AbortController(), _this61._stopClicked = {
|
11973
12040
|
listener: function listener() {}
|
11974
|
-
},
|
12041
|
+
}, _this61._serviceIO = n, _this61._alwaysEnabled = !!(o != null && o.alwaysEnabled), e.disableSubmitButton = _this61.disableSubmitButton.bind(_assertThisInitialized(_this61), n), _this61.attemptOverwriteLoadingStyle(e), setTimeout(function () {
|
11975
12042
|
var a;
|
11976
|
-
|
12043
|
+
_this61._validationHandler = e._validationHandler, _this61.assignHandlers(_this61._validationHandler), (a = _this61._validationHandler) == null || a.call(_assertThisInitialized(_this61));
|
11977
12044
|
});
|
11978
|
-
return
|
12045
|
+
return _this61;
|
11979
12046
|
}
|
11980
12047
|
// prettier-ignore
|
11981
12048
|
_createClass(k, [{
|
@@ -12030,12 +12097,12 @@ var yi = /*#__PURE__*/function (_wt4) {
|
|
12030
12097
|
}, {
|
12031
12098
|
key: "submitFromInput",
|
12032
12099
|
value: function () {
|
12033
|
-
var _submitFromInput = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12100
|
+
var _submitFromInput = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee100() {
|
12034
12101
|
var t, e, _i18;
|
12035
|
-
return _regeneratorRuntime().wrap(function
|
12036
|
-
while (1) switch (
|
12102
|
+
return _regeneratorRuntime().wrap(function _callee100$(_context100) {
|
12103
|
+
while (1) switch (_context100.prev = _context100.next) {
|
12037
12104
|
case 0:
|
12038
|
-
|
12105
|
+
_context100.next = 2;
|
12039
12106
|
return this._fileAttachments.completePlaceholders();
|
12040
12107
|
case 2:
|
12041
12108
|
e = this._fileAttachments.getAllFileData();
|
@@ -12051,9 +12118,9 @@ var yi = /*#__PURE__*/function (_wt4) {
|
|
12051
12118
|
}
|
12052
12119
|
case 4:
|
12053
12120
|
case "end":
|
12054
|
-
return
|
12121
|
+
return _context100.stop();
|
12055
12122
|
}
|
12056
|
-
},
|
12123
|
+
}, _callee100, this);
|
12057
12124
|
}));
|
12058
12125
|
function submitFromInput() {
|
12059
12126
|
return _submitFromInput.apply(this, arguments);
|
@@ -12063,11 +12130,11 @@ var yi = /*#__PURE__*/function (_wt4) {
|
|
12063
12130
|
}, {
|
12064
12131
|
key: "programmaticSubmit",
|
12065
12132
|
value: function () {
|
12066
|
-
var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12067
|
-
var
|
12133
|
+
var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee101(e) {
|
12134
|
+
var _this62 = this;
|
12068
12135
|
var t;
|
12069
|
-
return _regeneratorRuntime().wrap(function
|
12070
|
-
while (1) switch (
|
12136
|
+
return _regeneratorRuntime().wrap(function _callee101$(_context101) {
|
12137
|
+
while (1) switch (_context101.prev = _context101.next) {
|
12071
12138
|
case 0:
|
12072
12139
|
typeof e == "string" && (e = ke.processSubmitUserMessage(e));
|
12073
12140
|
t = {
|
@@ -12079,15 +12146,15 @@ var yi = /*#__PURE__*/function (_wt4) {
|
|
12079
12146
|
type: ue.getTypeFromBlob(i)
|
12080
12147
|
};
|
12081
12148
|
})), setTimeout(function () {
|
12082
|
-
return
|
12149
|
+
return _this62.attemptSubmit(t, !0);
|
12083
12150
|
});
|
12084
12151
|
case 3:
|
12085
12152
|
case "end":
|
12086
|
-
return
|
12153
|
+
return _context101.stop();
|
12087
12154
|
}
|
12088
|
-
},
|
12155
|
+
}, _callee101);
|
12089
12156
|
}));
|
12090
|
-
function programmaticSubmit(
|
12157
|
+
function programmaticSubmit(_x182) {
|
12091
12158
|
return _programmaticSubmit.apply(this, arguments);
|
12092
12159
|
}
|
12093
12160
|
return programmaticSubmit;
|
@@ -12095,31 +12162,31 @@ var yi = /*#__PURE__*/function (_wt4) {
|
|
12095
12162
|
}, {
|
12096
12163
|
key: "attemptSubmit",
|
12097
12164
|
value: function () {
|
12098
|
-
var _attemptSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12165
|
+
var _attemptSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee102(e) {
|
12099
12166
|
var t,
|
12100
12167
|
r,
|
12101
12168
|
o,
|
12102
12169
|
a,
|
12103
12170
|
i,
|
12104
12171
|
n,
|
12105
|
-
|
12106
|
-
return _regeneratorRuntime().wrap(function
|
12107
|
-
while (1) switch (
|
12172
|
+
_args102 = arguments;
|
12173
|
+
return _regeneratorRuntime().wrap(function _callee102$(_context102) {
|
12174
|
+
while (1) switch (_context102.prev = _context102.next) {
|
12108
12175
|
case 0:
|
12109
|
-
t =
|
12110
|
-
|
12176
|
+
t = _args102.length > 1 && _args102[1] !== undefined ? _args102[1] : !1;
|
12177
|
+
_context102.next = 3;
|
12111
12178
|
return (r = this._validationHandler) == null ? void 0 : r.call(this, t ? e : void 0);
|
12112
12179
|
case 3:
|
12113
|
-
|
12114
|
-
|
12115
|
-
if (!(
|
12116
|
-
|
12180
|
+
_context102.t0 = _context102.sent;
|
12181
|
+
_context102.t1 = !1;
|
12182
|
+
if (!(_context102.t0 === _context102.t1)) {
|
12183
|
+
_context102.next = 7;
|
12117
12184
|
break;
|
12118
12185
|
}
|
12119
|
-
return
|
12186
|
+
return _context102.abrupt("return");
|
12120
12187
|
case 7:
|
12121
12188
|
this.changeToLoadingIcon();
|
12122
|
-
|
12189
|
+
_context102.next = 10;
|
12123
12190
|
return this.addNewMessage(e);
|
12124
12191
|
case 10:
|
12125
12192
|
this._serviceIO.isWebModel() || this._messages.addLoadingMessage();
|
@@ -12130,17 +12197,17 @@ var yi = /*#__PURE__*/function (_wt4) {
|
|
12130
12197
|
text: e.text === "" ? void 0 : e.text,
|
12131
12198
|
files: i
|
12132
12199
|
};
|
12133
|
-
|
12200
|
+
_context102.next = 15;
|
12134
12201
|
return this._serviceIO.callAPI(n, this._messages);
|
12135
12202
|
case 15:
|
12136
12203
|
(a = this._fileAttachments) == null || a.removeAllFiles();
|
12137
12204
|
case 16:
|
12138
12205
|
case "end":
|
12139
|
-
return
|
12206
|
+
return _context102.stop();
|
12140
12207
|
}
|
12141
|
-
},
|
12208
|
+
}, _callee102, this);
|
12142
12209
|
}));
|
12143
|
-
function attemptSubmit(
|
12210
|
+
function attemptSubmit(_x183) {
|
12144
12211
|
return _attemptSubmit.apply(this, arguments);
|
12145
12212
|
}
|
12146
12213
|
return attemptSubmit;
|
@@ -12148,35 +12215,35 @@ var yi = /*#__PURE__*/function (_wt4) {
|
|
12148
12215
|
}, {
|
12149
12216
|
key: "addNewMessage",
|
12150
12217
|
value: function () {
|
12151
|
-
var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12218
|
+
var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee103(_ref13) {
|
12152
12219
|
var e, t, i;
|
12153
|
-
return _regeneratorRuntime().wrap(function
|
12154
|
-
while (1) switch (
|
12220
|
+
return _regeneratorRuntime().wrap(function _callee103$(_context103) {
|
12221
|
+
while (1) switch (_context103.prev = _context103.next) {
|
12155
12222
|
case 0:
|
12156
12223
|
e = _ref13.text, t = _ref13.files;
|
12157
12224
|
i = {
|
12158
12225
|
role: v.USER_ROLE
|
12159
12226
|
};
|
12160
12227
|
e && (i.text = e);
|
12161
|
-
|
12162
|
-
if (!
|
12163
|
-
|
12228
|
+
_context103.t0 = t;
|
12229
|
+
if (!_context103.t0) {
|
12230
|
+
_context103.next = 8;
|
12164
12231
|
break;
|
12165
12232
|
}
|
12166
|
-
|
12233
|
+
_context103.next = 7;
|
12167
12234
|
return this._messages.addMultipleFiles(t);
|
12168
12235
|
case 7:
|
12169
|
-
i.files =
|
12236
|
+
i.files = _context103.sent;
|
12170
12237
|
case 8:
|
12171
12238
|
this._serviceIO.sessionId && (i._sessionId = this._serviceIO.sessionId);
|
12172
12239
|
Object.keys(i).length > 0 && this._messages.addNewMessage(i);
|
12173
12240
|
case 10:
|
12174
12241
|
case "end":
|
12175
|
-
return
|
12242
|
+
return _context103.stop();
|
12176
12243
|
}
|
12177
|
-
},
|
12244
|
+
}, _callee103, this);
|
12178
12245
|
}));
|
12179
|
-
function addNewMessage(
|
12246
|
+
function addNewMessage(_x184) {
|
12180
12247
|
return _addNewMessage.apply(this, arguments);
|
12181
12248
|
}
|
12182
12249
|
return addNewMessage;
|
@@ -12257,14 +12324,14 @@ var sn = /*#__PURE__*/function (_at) {
|
|
12257
12324
|
var _super46 = _createSuper(sn);
|
12258
12325
|
// prettier-ignore
|
12259
12326
|
function sn(e, t, i, n) {
|
12260
|
-
var
|
12327
|
+
var _this63;
|
12261
12328
|
_classCallCheck(this, sn);
|
12262
|
-
|
12263
|
-
var
|
12264
|
-
r =
|
12265
|
-
o =
|
12266
|
-
|
12267
|
-
return
|
12329
|
+
_this63 = _super46.call(this, e, ["modal-content", "modal-camera-content"], i), _this63._stopped = !1, _this63._format = "image/png", _this63._canvas = document.createElement("canvas"), _this63._canvas.classList.add("camera-modal-canvas");
|
12330
|
+
var _this63$addButtonsAnd = _this63.addButtonsAndTheirEvents(t),
|
12331
|
+
r = _this63$addButtonsAnd.captureButton,
|
12332
|
+
o = _this63$addButtonsAnd.submitButton;
|
12333
|
+
_this63._captureButton = r, _this63._submitButton = o, _this63._captureIcon = _this63._captureButton.children[0], _this63._refreshIcon = q.createSVGElement(_a), _this63._refreshIcon.classList.add("modal-svg-button-icon", "modal-svg-refresh-icon"), (n == null ? void 0 : n.format) === "jpeg" && (_this63._format = "image/jpeg"), n != null && n.dimensions && (_this63._dimensions = n.dimensions), _this63._contentRef.appendChild(_this63._canvas), _this63.extensionCloseCallback = _this63.stop;
|
12334
|
+
return _this63;
|
12268
12335
|
}
|
12269
12336
|
_createClass(sn, [{
|
12270
12337
|
key: "addButtonsAndTheirEvents",
|
@@ -12283,38 +12350,38 @@ var sn = /*#__PURE__*/function (_at) {
|
|
12283
12350
|
}, {
|
12284
12351
|
key: "addButtonEvents",
|
12285
12352
|
value: function addButtonEvents(e, t, i, n) {
|
12286
|
-
var
|
12353
|
+
var _this64 = this;
|
12287
12354
|
e.onclick = function () {
|
12288
|
-
|
12355
|
+
_this64.capture();
|
12289
12356
|
}, t.addEventListener("click", this.stop.bind(this)), i.onclick = function () {
|
12290
|
-
var r =
|
12291
|
-
r && _t.addFilesToType([r], [n]),
|
12357
|
+
var r = _this64.getFile();
|
12358
|
+
r && _t.addFilesToType([r], [n]), _this64.stop(), _this64.close();
|
12292
12359
|
};
|
12293
12360
|
}
|
12294
12361
|
}, {
|
12295
12362
|
key: "stop",
|
12296
12363
|
value: function stop() {
|
12297
|
-
var
|
12364
|
+
var _this65 = this;
|
12298
12365
|
this._mediaStream && this._mediaStream.getTracks().forEach(function (e) {
|
12299
12366
|
return e.stop();
|
12300
12367
|
}), this._stopped = !0, setTimeout(function () {
|
12301
|
-
|
12302
|
-
var e =
|
12303
|
-
e == null || e.clearRect(0, 0,
|
12368
|
+
_this65._captureButton.replaceChildren(_this65._captureIcon), _this65._captureButton.classList.replace("modal-svg-refresh-button", "modal-svg-camera-button");
|
12369
|
+
var e = _this65._canvas.getContext("2d");
|
12370
|
+
e == null || e.clearRect(0, 0, _this65._canvas.width, _this65._canvas.height);
|
12304
12371
|
}, at.MODAL_CLOSE_TIMEOUT_MS);
|
12305
12372
|
}
|
12306
12373
|
}, {
|
12307
12374
|
key: "start",
|
12308
12375
|
value: function start() {
|
12309
|
-
var
|
12376
|
+
var _this66 = this;
|
12310
12377
|
this._dataURL = void 0, this._submitButton.classList.add("modal-svg-submit-disabled"), this._stopped = !1, navigator.mediaDevices.getUserMedia({
|
12311
12378
|
video: this._dimensions || !0
|
12312
12379
|
}).then(function (e) {
|
12313
|
-
if (
|
12380
|
+
if (_this66._mediaStream = e, !_this66.isOpen()) return _this66.stop();
|
12314
12381
|
var t = document.createElement("video");
|
12315
|
-
t.srcObject = e, t.play(), requestAnimationFrame(
|
12382
|
+
t.srcObject = e, t.play(), requestAnimationFrame(_this66.updateCanvas.bind(_this66, t, _this66._canvas));
|
12316
12383
|
})["catch"](function (e) {
|
12317
|
-
console.error(e),
|
12384
|
+
console.error(e), _this66.stop(), _this66.close();
|
12318
12385
|
});
|
12319
12386
|
}
|
12320
12387
|
}, {
|
@@ -12372,13 +12439,13 @@ var Xt = /*#__PURE__*/function (_wt5) {
|
|
12372
12439
|
_inherits(Xt, _wt5);
|
12373
12440
|
var _super47 = _createSuper(Xt);
|
12374
12441
|
function Xt(e, t, i) {
|
12375
|
-
var
|
12442
|
+
var _this67;
|
12376
12443
|
_classCallCheck(this, Xt);
|
12377
12444
|
var r;
|
12378
|
-
|
12379
|
-
var n =
|
12380
|
-
i &&
|
12381
|
-
return
|
12445
|
+
_this67 = _super47.call(this, Xt.createButtonElement(), (r = i == null ? void 0 : i.button) == null ? void 0 : r.position, (i == null ? void 0 : i.button) || {}, "Photo");
|
12446
|
+
var n = _this67.createInnerElements(_this67._customStyles);
|
12447
|
+
i && _this67.addClickEvent(e, t, i.modalContainerStyle, i.files), _this67.elementRef.classList.add("upload-file-button"), _this67.elementRef.appendChild(n.styles), _this67.reapplyStateStyle("styles");
|
12448
|
+
return _this67;
|
12382
12449
|
}
|
12383
12450
|
_createClass(Xt, [{
|
12384
12451
|
key: "createInnerElements",
|
@@ -12416,7 +12483,6 @@ var Xt = /*#__PURE__*/function (_wt5) {
|
|
12416
12483
|
return Xt;
|
12417
12484
|
}(wt);
|
12418
12485
|
var pt = /*#__PURE__*/function () {
|
12419
|
-
// prettier-ignore
|
12420
12486
|
function pt(e, t, i, n) {
|
12421
12487
|
_classCallCheck(this, pt);
|
12422
12488
|
this.elementRef = pt.createPanelElement(e.inputAreaStyle);
|
@@ -12470,10 +12536,10 @@ var pt = /*#__PURE__*/function () {
|
|
12470
12536
|
_Qo$a = Qo[a],
|
12471
12537
|
d = _Qo$a.id,
|
12472
12538
|
u = _Qo$a.svgString,
|
12473
|
-
|
12474
|
-
|
12539
|
+
p = _Qo$a.dropupText,
|
12540
|
+
h = new ut(n, c, l, d, u, p);
|
12475
12541
|
r[a] = {
|
12476
|
-
button:
|
12542
|
+
button: h,
|
12477
12543
|
fileType: c
|
12478
12544
|
};
|
12479
12545
|
}
|
@@ -12525,22 +12591,22 @@ var b = /*#__PURE__*/function (_vo) {
|
|
12525
12591
|
_inherits(b, _vo);
|
12526
12592
|
var _super48 = _createSuper(b);
|
12527
12593
|
function b() {
|
12528
|
-
var
|
12594
|
+
var _this68;
|
12529
12595
|
_classCallCheck(this, b);
|
12530
|
-
|
12596
|
+
_this68 = _super48.call(this), _this68.getMessages = function () {
|
12531
12597
|
return [];
|
12532
|
-
},
|
12598
|
+
}, _this68.submitUserMessage = function () {
|
12533
12599
|
return console.warn("submitUserMessage failed - please wait for chat view to render before calling this property.");
|
12534
|
-
},
|
12535
|
-
return Qt.focusFromParentElement(
|
12536
|
-
},
|
12600
|
+
}, _this68.focusInput = function () {
|
12601
|
+
return Qt.focusFromParentElement(_this68._elementRef);
|
12602
|
+
}, _this68.refreshMessages = function () {}, _this68.clearMessages = function () {}, _this68.scrollToBottom = function () {}, _this68.disableSubmitButton = function () {}, _this68._hasBeenRendered = !1, _this68._auxiliaryStyleApplied = !1, _this68._addMessage = function () {
|
12537
12603
|
return console.warn("addMessage failed - please wait for chat view to render before calling this property.");
|
12538
|
-
}, Go.appendStyleSheetToHead(),
|
12604
|
+
}, Go.appendStyleSheetToHead(), _this68._elementRef = document.createElement("div"), _this68._elementRef.id = "container", _this68.attachShadow({
|
12539
12605
|
mode: "open"
|
12540
|
-
}).appendChild(
|
12541
|
-
|
12606
|
+
}).appendChild(_this68._elementRef), Ei.apply(ka, _this68.shadowRoot), setTimeout(function () {
|
12607
|
+
_this68._hasBeenRendered || _this68.onRender();
|
12542
12608
|
}, 20);
|
12543
|
-
return
|
12609
|
+
return _this68;
|
12544
12610
|
}
|
12545
12611
|
_createClass(b, [{
|
12546
12612
|
key: "changeToChatView",
|