deep-chat-dev 9.0.122 → 9.0.123
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/README.md +3 -3
- package/custom-elements.json +2357 -2325
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.js +760 -747
- package/dist/types/stream.d.ts +4 -3
- package/dist/types/stream.d.ts.map +1 -1
- package/dist/utils/HTTP/customHandler.d.ts.map +1 -1
- package/dist/utils/HTTP/websocket.d.ts +7 -0
- package/dist/utils/HTTP/websocket.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/deepChat.js
CHANGED
@@ -241,28 +241,28 @@ var ws = /*#__PURE__*/function () {
|
|
241
241
|
return ws;
|
242
242
|
}();
|
243
243
|
var Gn = /*#__PURE__*/function () {
|
244
|
-
function
|
244
|
+
function Ve(e, t) {
|
245
245
|
var _this = this;
|
246
|
-
_classCallCheck(this,
|
246
|
+
_classCallCheck(this, Ve);
|
247
247
|
var n;
|
248
|
-
var i =
|
249
|
-
this.elementRef =
|
248
|
+
var i = Ve.processConfig(t, e.textInput);
|
249
|
+
this.elementRef = Ve.createContainerElement((n = i == null ? void 0 : i.styles) == null ? void 0 : n.container), this.inputElementRef = this.createInputElement(i), this._config = i, this.elementRef.appendChild(this.inputElementRef), setTimeout(function () {
|
250
250
|
var r;
|
251
251
|
Ss.add(_this.inputElementRef, (r = e.textInput) == null ? void 0 : r.characterLimit, e._validationHandler);
|
252
252
|
});
|
253
253
|
}
|
254
|
-
_createClass(
|
254
|
+
_createClass(Ve, [{
|
255
255
|
key: "createInputElement",
|
256
256
|
value: function createInputElement(e) {
|
257
257
|
var i, n, r;
|
258
258
|
var t = document.createElement("div");
|
259
|
-
return t.id =
|
259
|
+
return t.id = Ve.TEXT_INPUT_ID, t.classList.add("text-input-styling", "text-input-placeholder"), t.innerText = ((i = e == null ? void 0 : e.placeholder) == null ? void 0 : i.text) || "Ask me anything!", be.IS_CHROMIUM && Ve.preventAutomaticScrollUpOnNewLine(t), typeof (e == null ? void 0 : e.disabled) == "boolean" && e.disabled === !0 ? (t.contentEditable = "false", t.classList.add("text-input-disabled")) : (t.contentEditable = "true", this.addEventListeners(t, e)), Object.assign(t.style, (n = e == null ? void 0 : e.styles) == null ? void 0 : n.text), Object.assign(t.style, (r = e == null ? void 0 : e.placeholder) == null ? void 0 : r.style), t;
|
260
260
|
}
|
261
261
|
}, {
|
262
262
|
key: "removeTextIfPlaceholder",
|
263
263
|
value: function removeTextIfPlaceholder() {
|
264
264
|
var e, t, i, n;
|
265
|
-
this.inputElementRef.classList.contains("text-input-placeholder") && !this.inputElementRef.classList.contains("text-input-disabled") && ((e = this._config.placeholder) != null && e.style && (T.unsetStyle(this.inputElementRef, (t = this._config.placeholder) == null ? void 0 : t.style), Object.assign(this.inputElementRef.style, (n = (i = this._config) == null ? void 0 : i.styles) == null ? void 0 : n.text)),
|
265
|
+
this.inputElementRef.classList.contains("text-input-placeholder") && !this.inputElementRef.classList.contains("text-input-disabled") && ((e = this._config.placeholder) != null && e.style && (T.unsetStyle(this.inputElementRef, (t = this._config.placeholder) == null ? void 0 : t.style), Object.assign(this.inputElementRef.style, (n = (i = this._config) == null ? void 0 : i.styles) == null ? void 0 : n.text)), Ve.clear(this.inputElementRef), this.inputElementRef.classList.remove("text-input-placeholder"));
|
266
266
|
}
|
267
267
|
}, {
|
268
268
|
key: "addEventListeners",
|
@@ -334,7 +334,7 @@ var Gn = /*#__PURE__*/function () {
|
|
334
334
|
return t.id = "text-input-container", Object.assign(t.style, e), t;
|
335
335
|
}
|
336
336
|
}]);
|
337
|
-
return
|
337
|
+
return Ve;
|
338
338
|
}();
|
339
339
|
Gn.TEXT_INPUT_ID = "text-input";
|
340
340
|
var Gi = Gn;
|
@@ -882,11 +882,11 @@ var oe = /*#__PURE__*/function () {
|
|
882
882
|
}]);
|
883
883
|
return oe;
|
884
884
|
}();
|
885
|
-
var
|
886
|
-
function
|
887
|
-
_classCallCheck(this,
|
885
|
+
var Qe = /*#__PURE__*/function () {
|
886
|
+
function Qe() {
|
887
|
+
_classCallCheck(this, Qe);
|
888
888
|
}
|
889
|
-
_createClass(
|
889
|
+
_createClass(Qe, null, [{
|
890
890
|
key: "addElement",
|
891
891
|
value: function addElement(e, t) {
|
892
892
|
e.elementRef.appendChild(t), e.elementRef.scrollTop = e.elementRef.scrollHeight;
|
@@ -914,11 +914,11 @@ var Xe = /*#__PURE__*/function () {
|
|
914
914
|
if (l) return l;
|
915
915
|
r.status = !1;
|
916
916
|
}
|
917
|
-
var o =
|
918
|
-
return b.fillEmptyMessageElement(o.bubbleElement, t), oe.apply(e, o.outerContainer), Re.flagHTMLUpdateClass(o.bubbleElement), e.applyCustomStyles(o, i, !1, (a = e.messageStyles) == null ? void 0 : a.html),
|
917
|
+
var o = Qe.createElements(e, t, i);
|
918
|
+
return b.fillEmptyMessageElement(o.bubbleElement, t), oe.apply(e, o.outerContainer), Re.flagHTMLUpdateClass(o.bubbleElement), e.applyCustomStyles(o, i, !1, (a = e.messageStyles) == null ? void 0 : a.html), Qe.addElement(e, o.outerContainer), o;
|
919
919
|
}
|
920
920
|
}]);
|
921
|
-
return
|
921
|
+
return Qe;
|
922
922
|
}();
|
923
923
|
var Rt;
|
924
924
|
function Zn(s) {
|
@@ -976,7 +976,7 @@ var Fs = /[&<>"]/,
|
|
976
976
|
function qs(s) {
|
977
977
|
return Us[s];
|
978
978
|
}
|
979
|
-
function
|
979
|
+
function U(s) {
|
980
980
|
return Fs.test(s) ? s.replace(zs, qs) : s;
|
981
981
|
}
|
982
982
|
var m = {};
|
@@ -984,10 +984,10 @@ m.blockquote_open = function () {
|
|
984
984
|
return "<blockquote>\n";
|
985
985
|
};
|
986
986
|
m.blockquote_close = function (s, e) {
|
987
|
-
return "</blockquote>" +
|
987
|
+
return "</blockquote>" + De(s, e);
|
988
988
|
};
|
989
989
|
m.code = function (s, e) {
|
990
|
-
return s[e].block ? "<pre><code>" +
|
990
|
+
return s[e].block ? "<pre><code>" + U(s[e].content) + "</code></pre>" + De(s, e) : "<code>" + U(s[e].content) + "</code>";
|
991
991
|
};
|
992
992
|
m.fence = function (s, e, t, i, n) {
|
993
993
|
var r = s[e],
|
@@ -999,9 +999,9 @@ m.fence = function (s, e, t, i, n) {
|
|
999
999
|
u;
|
1000
1000
|
if (r.params) {
|
1001
1001
|
if (c = r.params.split(/\s+/g), d = c.join(" "), Os(n.rules.fence_custom, c[0])) return n.rules.fence_custom[c[0]](s, e, t, i, n);
|
1002
|
-
l =
|
1002
|
+
l = U(Ne(gt(d))), o = ' class="' + a + l + '"';
|
1003
1003
|
}
|
1004
|
-
return t.highlight ? u = t.highlight.apply(t.highlight, [r.content].concat(c)) ||
|
1004
|
+
return t.highlight ? u = t.highlight.apply(t.highlight, [r.content].concat(c)) || U(r.content) : u = U(r.content), "<pre><code" + o + ">" + u + "</code></pre>" + De(s, e);
|
1005
1005
|
};
|
1006
1006
|
m.fence_custom = {};
|
1007
1007
|
m.heading_open = function (s, e) {
|
@@ -1011,13 +1011,13 @@ m.heading_close = function (s, e) {
|
|
1011
1011
|
return "</h" + s[e].hLevel + ">\n";
|
1012
1012
|
};
|
1013
1013
|
m.hr = function (s, e, t) {
|
1014
|
-
return (t.xhtmlOut ? "<hr />" : "<hr>") +
|
1014
|
+
return (t.xhtmlOut ? "<hr />" : "<hr>") + De(s, e);
|
1015
1015
|
};
|
1016
1016
|
m.bullet_list_open = function () {
|
1017
1017
|
return "<ul>\n";
|
1018
1018
|
};
|
1019
1019
|
m.bullet_list_close = function (s, e) {
|
1020
|
-
return "</ul>" +
|
1020
|
+
return "</ul>" + De(s, e);
|
1021
1021
|
};
|
1022
1022
|
m.list_item_open = function () {
|
1023
1023
|
return "<li>";
|
@@ -1031,27 +1031,27 @@ m.ordered_list_open = function (s, e) {
|
|
1031
1031
|
return "<ol" + i + ">\n";
|
1032
1032
|
};
|
1033
1033
|
m.ordered_list_close = function (s, e) {
|
1034
|
-
return "</ol>" +
|
1034
|
+
return "</ol>" + De(s, e);
|
1035
1035
|
};
|
1036
1036
|
m.paragraph_open = function (s, e) {
|
1037
1037
|
return s[e].tight ? "" : "<p>";
|
1038
1038
|
};
|
1039
1039
|
m.paragraph_close = function (s, e) {
|
1040
1040
|
var t = !(s[e].tight && e && s[e - 1].type === "inline" && !s[e - 1].content);
|
1041
|
-
return (s[e].tight ? "" : "</p>") + (t ?
|
1041
|
+
return (s[e].tight ? "" : "</p>") + (t ? De(s, e) : "");
|
1042
1042
|
};
|
1043
1043
|
m.link_open = function (s, e, t) {
|
1044
|
-
var i = s[e].title ? ' title="' +
|
1044
|
+
var i = s[e].title ? ' title="' + U(Ne(s[e].title)) + '"' : "",
|
1045
1045
|
n = t.linkTarget ? ' target="' + t.linkTarget + '"' : "";
|
1046
|
-
return '<a href="' +
|
1046
|
+
return '<a href="' + U(s[e].href) + '"' + i + n + ">";
|
1047
1047
|
};
|
1048
1048
|
m.link_close = function () {
|
1049
1049
|
return "</a>";
|
1050
1050
|
};
|
1051
1051
|
m.image = function (s, e, t) {
|
1052
|
-
var i = ' src="' +
|
1053
|
-
n = s[e].title ? ' title="' +
|
1054
|
-
r = ' alt="' + (s[e].alt ?
|
1052
|
+
var i = ' src="' + U(s[e].src) + '"',
|
1053
|
+
n = s[e].title ? ' title="' + U(Ne(s[e].title)) + '"' : "",
|
1054
|
+
r = ' alt="' + (s[e].alt ? U(Ne(gt(s[e].alt))) : "") + '"',
|
1055
1055
|
o = t.xhtmlOut ? " /" : "";
|
1056
1056
|
return "<img" + i + r + n + o + ">";
|
1057
1057
|
};
|
@@ -1124,10 +1124,10 @@ m.mark_close = function () {
|
|
1124
1124
|
return "</mark>";
|
1125
1125
|
};
|
1126
1126
|
m.sub = function (s, e) {
|
1127
|
-
return "<sub>" +
|
1127
|
+
return "<sub>" + U(s[e].content) + "</sub>";
|
1128
1128
|
};
|
1129
1129
|
m.sup = function (s, e) {
|
1130
|
-
return "<sup>" +
|
1130
|
+
return "<sup>" + U(s[e].content) + "</sup>";
|
1131
1131
|
};
|
1132
1132
|
m.hardbreak = function (s, e, t) {
|
1133
1133
|
return t.xhtmlOut ? "<br />\n" : "<br>\n";
|
@@ -1136,7 +1136,7 @@ m.softbreak = function (s, e, t) {
|
|
1136
1136
|
return t.breaks ? t.xhtmlOut ? "<br />\n" : "<br>\n" : "\n";
|
1137
1137
|
};
|
1138
1138
|
m.text = function (s, e) {
|
1139
|
-
return
|
1139
|
+
return U(s[e].content);
|
1140
1140
|
};
|
1141
1141
|
m.htmlblock = function (s, e) {
|
1142
1142
|
return s[e].content;
|
@@ -1145,7 +1145,7 @@ m.htmltag = function (s, e) {
|
|
1145
1145
|
return s[e].content;
|
1146
1146
|
};
|
1147
1147
|
m.abbr_open = function (s, e) {
|
1148
|
-
return '<abbr title="' +
|
1148
|
+
return '<abbr title="' + U(Ne(s[e].title)) + '">';
|
1149
1149
|
};
|
1150
1150
|
m.abbr_close = function () {
|
1151
1151
|
return "</abbr>";
|
@@ -1195,7 +1195,7 @@ m.dd_close = function () {
|
|
1195
1195
|
function es(s, e) {
|
1196
1196
|
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 ? es(s, e + 2) : e;
|
1197
1197
|
}
|
1198
|
-
var
|
1198
|
+
var De = m.getBreak = function (e, t) {
|
1199
1199
|
return t = es(e, t), t < e.length && e[t].type === "list_item_close" ? "" : "\n";
|
1200
1200
|
};
|
1201
1201
|
function Wi() {
|
@@ -1209,14 +1209,14 @@ Wi.prototype.render = function (s, e, t) {
|
|
1209
1209
|
for (var i = this.rules, n = s.length, r = -1, o = ""; ++r < n;) s[r].type === "inline" ? o += this.renderInline(s[r].children, e, t) : o += i[s[r].type](s, r, e, t, this);
|
1210
1210
|
return o;
|
1211
1211
|
};
|
1212
|
-
function
|
1212
|
+
function V() {
|
1213
1213
|
this.__rules__ = [], this.__cache__ = null;
|
1214
1214
|
}
|
1215
|
-
|
1215
|
+
V.prototype.__find__ = function (s) {
|
1216
1216
|
for (var e = this.__rules__.length, t = -1; e--;) if (this.__rules__[++t].name === s) return t;
|
1217
1217
|
return -1;
|
1218
1218
|
};
|
1219
|
-
|
1219
|
+
V.prototype.__compile__ = function () {
|
1220
1220
|
var s = this,
|
1221
1221
|
e = [""];
|
1222
1222
|
s.__rules__.forEach(function (t) {
|
@@ -1229,13 +1229,13 @@ G.prototype.__compile__ = function () {
|
|
1229
1229
|
});
|
1230
1230
|
});
|
1231
1231
|
};
|
1232
|
-
|
1232
|
+
V.prototype.at = function (s, e, t) {
|
1233
1233
|
var i = this.__find__(s),
|
1234
1234
|
n = t || {};
|
1235
1235
|
if (i === -1) throw new Error("Parser rule not found: " + s);
|
1236
1236
|
this.__rules__[i].fn = e, this.__rules__[i].alt = n.alt || [], this.__cache__ = null;
|
1237
1237
|
};
|
1238
|
-
|
1238
|
+
V.prototype.before = function (s, e, t, i) {
|
1239
1239
|
var n = this.__find__(s),
|
1240
1240
|
r = i || {};
|
1241
1241
|
if (n === -1) throw new Error("Parser rule not found: " + s);
|
@@ -1246,7 +1246,7 @@ G.prototype.before = function (s, e, t, i) {
|
|
1246
1246
|
alt: r.alt || []
|
1247
1247
|
}), this.__cache__ = null;
|
1248
1248
|
};
|
1249
|
-
|
1249
|
+
V.prototype.after = function (s, e, t, i) {
|
1250
1250
|
var n = this.__find__(s),
|
1251
1251
|
r = i || {};
|
1252
1252
|
if (n === -1) throw new Error("Parser rule not found: " + s);
|
@@ -1257,7 +1257,7 @@ G.prototype.after = function (s, e, t, i) {
|
|
1257
1257
|
alt: r.alt || []
|
1258
1258
|
}), this.__cache__ = null;
|
1259
1259
|
};
|
1260
|
-
|
1260
|
+
V.prototype.push = function (s, e, t) {
|
1261
1261
|
var i = t || {};
|
1262
1262
|
this.__rules__.push({
|
1263
1263
|
name: s,
|
@@ -1266,7 +1266,7 @@ G.prototype.push = function (s, e, t) {
|
|
1266
1266
|
alt: i.alt || []
|
1267
1267
|
}), this.__cache__ = null;
|
1268
1268
|
};
|
1269
|
-
|
1269
|
+
V.prototype.enable = function (s, e) {
|
1270
1270
|
s = Array.isArray(s) ? s : [s], e && this.__rules__.forEach(function (t) {
|
1271
1271
|
t.enabled = !1;
|
1272
1272
|
}), s.forEach(function (t) {
|
@@ -1275,14 +1275,14 @@ G.prototype.enable = function (s, e) {
|
|
1275
1275
|
this.__rules__[i].enabled = !0;
|
1276
1276
|
}, this), this.__cache__ = null;
|
1277
1277
|
};
|
1278
|
-
|
1278
|
+
V.prototype.disable = function (s) {
|
1279
1279
|
s = Array.isArray(s) ? s : [s], s.forEach(function (e) {
|
1280
1280
|
var t = this.__find__(e);
|
1281
1281
|
if (t < 0) throw new Error("Rules manager: invalid rule name " + e);
|
1282
1282
|
this.__rules__[t].enabled = !1;
|
1283
1283
|
}, this), this.__cache__ = null;
|
1284
1284
|
};
|
1285
|
-
|
1285
|
+
V.prototype.getRules = function (s) {
|
1286
1286
|
return this.__cache__ === null && this.__compile__(), this.__cache__[s] || [];
|
1287
1287
|
};
|
1288
1288
|
function Hs(s) {
|
@@ -1294,24 +1294,24 @@ function Hs(s) {
|
|
1294
1294
|
children: []
|
1295
1295
|
}) : s.block.parse(s.src, s.options, s.env, s.tokens);
|
1296
1296
|
}
|
1297
|
-
function
|
1297
|
+
function je(s, e, t, i, n) {
|
1298
1298
|
this.src = s, this.env = i, this.options = t, this.parser = e, this.tokens = n, this.pos = 0, this.posMax = this.src.length, this.level = 0, this.pending = "", this.pendingLevel = 0, this.cache = [], this.isInLabel = !1, this.linkLevel = 0, this.linkContent = "", this.labelUnmatchedScopes = 0;
|
1299
1299
|
}
|
1300
|
-
|
1300
|
+
je.prototype.pushPending = function () {
|
1301
1301
|
this.tokens.push({
|
1302
1302
|
type: "text",
|
1303
1303
|
content: this.pending,
|
1304
1304
|
level: this.pendingLevel
|
1305
1305
|
}), this.pending = "";
|
1306
1306
|
};
|
1307
|
-
|
1307
|
+
je.prototype.push = function (s) {
|
1308
1308
|
this.pending && this.pushPending(), this.tokens.push(s), this.pendingLevel = this.level;
|
1309
1309
|
};
|
1310
|
-
|
1310
|
+
je.prototype.cacheSet = function (s, e) {
|
1311
1311
|
for (var t = this.cache.length; t <= s; t++) this.cache.push(0);
|
1312
1312
|
this.cache[s] = e;
|
1313
1313
|
};
|
1314
|
-
|
1314
|
+
je.prototype.cacheGet = function (s) {
|
1315
1315
|
return s < this.cache.length ? this.cache[s] : 0;
|
1316
1316
|
};
|
1317
1317
|
function bt(s, e) {
|
@@ -1335,7 +1335,7 @@ function bt(s, e) {
|
|
1335
1335
|
}
|
1336
1336
|
function Gs(s, e, t, i) {
|
1337
1337
|
var n, r, o, a, l, c;
|
1338
|
-
if (s.charCodeAt(0) !== 42 || s.charCodeAt(1) !== 91 || s.indexOf("]:") === -1 || (n = new
|
1338
|
+
if (s.charCodeAt(0) !== 42 || s.charCodeAt(1) !== 91 || s.indexOf("]:") === -1 || (n = new je(s, e, t, i, []), r = bt(n, 1), r < 0 || s.charCodeAt(r + 1) !== 58)) return -1;
|
1339
1339
|
for (a = n.posMax, o = r + 2; o < a && n.src.charCodeAt(o) !== 10; o++);
|
1340
1340
|
return l = s.slice(2, r), c = s.slice(r + 2, o).trim(), c.length === 0 ? -1 : (i.abbreviations || (i.abbreviations = {}), _typeof(i.abbreviations[":" + l]) > "u" && (i.abbreviations[":" + l] = c), o);
|
1341
1341
|
}
|
@@ -1408,7 +1408,7 @@ function ns(s) {
|
|
1408
1408
|
}
|
1409
1409
|
function Ws(s, e, t, i) {
|
1410
1410
|
var n, r, o, a, l, c, d, u, h;
|
1411
|
-
if (s.charCodeAt(0) !== 91 || s.indexOf("]:") === -1 || (n = new
|
1411
|
+
if (s.charCodeAt(0) !== 91 || s.indexOf("]:") === -1 || (n = new je(s, e, t, i, []), r = bt(n, 0), r < 0 || s.charCodeAt(r + 1) !== 58)) return -1;
|
1412
1412
|
for (a = n.posMax, o = r + 2; o < a && (l = n.src.charCodeAt(o), !(l !== 32 && l !== 10)); o++);
|
1413
1413
|
if (!ts(n, o)) return -1;
|
1414
1414
|
for (d = n.linkContent, o = n.pos, c = o, o = o + 1; o < a && (l = n.src.charCodeAt(o), !(l !== 32 && l !== 10)); o++);
|
@@ -1568,7 +1568,7 @@ var ir = /['"]/,
|
|
1568
1568
|
function mn(s, e) {
|
1569
1569
|
return e < 0 || e >= s.length ? !1 : !nr.test(s[e]);
|
1570
1570
|
}
|
1571
|
-
function
|
1571
|
+
function He(s, e, t) {
|
1572
1572
|
return s.substr(0, e) + t + s.substr(e + 1);
|
1573
1573
|
}
|
1574
1574
|
function sr(s) {
|
@@ -1580,12 +1580,12 @@ function sr(s) {
|
|
1580
1580
|
S.length = p + 1, i = t.content, r = 0, o = i.length;
|
1581
1581
|
e: for (; r < o && (pn.lastIndex = r, n = pn.exec(i), !!n);) {
|
1582
1582
|
if (l = !mn(i, n.index - 1), r = n.index + 1, g = n[0] === "'", c = !mn(i, r), !c && !l) {
|
1583
|
-
g && (t.content =
|
1583
|
+
g && (t.content = He(t.content, n.index, fn));
|
1584
1584
|
continue;
|
1585
1585
|
}
|
1586
1586
|
if (u = !c, h = !l, h) {
|
1587
1587
|
for (p = S.length - 1; p >= 0 && (d = S[p], !(S[p].level < a)); p--) if (d.single === g && S[p].level === a) {
|
1588
|
-
d = S[p], g ? (E[d.token].content =
|
1588
|
+
d = S[p], g ? (E[d.token].content = He(E[d.token].content, d.pos, s.options.quotes[2]), t.content = He(t.content, n.index, s.options.quotes[3])) : (E[d.token].content = He(E[d.token].content, d.pos, s.options.quotes[0]), t.content = He(t.content, n.index, s.options.quotes[1])), S.length = p;
|
1589
1589
|
continue e;
|
1590
1590
|
}
|
1591
1591
|
}
|
@@ -1594,7 +1594,7 @@ function sr(s) {
|
|
1594
1594
|
pos: n.index,
|
1595
1595
|
single: g,
|
1596
1596
|
level: a
|
1597
|
-
}) : h && g && (t.content =
|
1597
|
+
}) : h && g && (t.content = He(t.content, n.index, fn));
|
1598
1598
|
}
|
1599
1599
|
}
|
1600
1600
|
}
|
@@ -1602,14 +1602,14 @@ function sr(s) {
|
|
1602
1602
|
}
|
1603
1603
|
var Ti = [["block", Hs], ["abbr", Vs], ["references", Js], ["inline", $s], ["footnote_tail", Ks], ["abbr2", Ys], ["replacements", tr], ["smartquotes", sr]];
|
1604
1604
|
function ss() {
|
1605
|
-
this.options = {}, this.ruler = new
|
1605
|
+
this.options = {}, this.ruler = new V();
|
1606
1606
|
for (var s = 0; s < Ti.length; s++) this.ruler.push(Ti[s][0], Ti[s][1]);
|
1607
1607
|
}
|
1608
1608
|
ss.prototype.process = function (s) {
|
1609
1609
|
var e, t, i;
|
1610
1610
|
for (i = this.ruler.getRules(""), e = 0, t = i.length; e < t; e++) i[e](s);
|
1611
1611
|
};
|
1612
|
-
function
|
1612
|
+
function Be(s, e, t, i, n) {
|
1613
1613
|
var r, o, a, l, c, d, u;
|
1614
1614
|
for (this.src = s, this.parser = e, this.options = t, this.env = i, this.tokens = n, this.bMarks = [], this.eMarks = [], this.tShift = [], this.blkIndent = 0, this.line = 0, this.lineMax = 0, this.tight = !1, this.parentType = "root", this.ddIndent = -1, this.level = 0, this.result = "", o = this.src, d = 0, u = !1, a = l = d = 0, c = o.length; l < c; l++) {
|
1615
1615
|
if (r = o.charCodeAt(l), !u) if (r === 32) {
|
@@ -1620,27 +1620,27 @@ function je(s, e, t, i, n) {
|
|
1620
1620
|
}
|
1621
1621
|
this.bMarks.push(o.length), this.eMarks.push(o.length), this.tShift.push(0), this.lineMax = this.bMarks.length - 1;
|
1622
1622
|
}
|
1623
|
-
|
1623
|
+
Be.prototype.isEmpty = function (e) {
|
1624
1624
|
return this.bMarks[e] + this.tShift[e] >= this.eMarks[e];
|
1625
1625
|
};
|
1626
|
-
|
1626
|
+
Be.prototype.skipEmptyLines = function (e) {
|
1627
1627
|
for (var t = this.lineMax; e < t && !(this.bMarks[e] + this.tShift[e] < this.eMarks[e]); e++);
|
1628
1628
|
return e;
|
1629
1629
|
};
|
1630
|
-
|
1630
|
+
Be.prototype.skipSpaces = function (e) {
|
1631
1631
|
for (var t = this.src.length; e < t && this.src.charCodeAt(e) === 32; e++);
|
1632
1632
|
return e;
|
1633
1633
|
};
|
1634
|
-
|
1634
|
+
Be.prototype.skipChars = function (e, t) {
|
1635
1635
|
for (var i = this.src.length; e < i && this.src.charCodeAt(e) === t; e++);
|
1636
1636
|
return e;
|
1637
1637
|
};
|
1638
|
-
|
1638
|
+
Be.prototype.skipCharsBack = function (e, t, i) {
|
1639
1639
|
if (e <= i) return e;
|
1640
1640
|
for (; e > i;) if (t !== this.src.charCodeAt(--e)) return e + 1;
|
1641
1641
|
return e;
|
1642
1642
|
};
|
1643
|
-
|
1643
|
+
Be.prototype.getLines = function (e, t, i, n) {
|
1644
1644
|
var r,
|
1645
1645
|
o,
|
1646
1646
|
a,
|
@@ -1792,28 +1792,28 @@ function dr(s, e, t, i) {
|
|
1792
1792
|
f,
|
1793
1793
|
E,
|
1794
1794
|
S,
|
1795
|
-
V,
|
1796
|
-
A,
|
1797
1795
|
W,
|
1796
|
+
A,
|
1797
|
+
J,
|
1798
1798
|
Q,
|
1799
1799
|
le = !0,
|
1800
|
-
|
1800
|
+
H,
|
1801
1801
|
O,
|
1802
1802
|
Ee,
|
1803
1803
|
Si;
|
1804
1804
|
if ((u = bn(s, e)) >= 0) E = !0;else if ((u = gn(s, e)) >= 0) E = !1;else return !1;
|
1805
1805
|
if (s.level >= s.options.maxNesting) return !1;
|
1806
1806
|
if (f = s.src.charCodeAt(u - 1), i) return !0;
|
1807
|
-
for (
|
1807
|
+
for (W = s.tokens.length, E ? (d = s.bMarks[e] + s.tShift[e], g = Number(s.src.substr(d, u - d - 1)), s.tokens.push({
|
1808
1808
|
type: "ordered_list_open",
|
1809
1809
|
order: g,
|
1810
|
-
lines:
|
1810
|
+
lines: J = [e, 0],
|
1811
1811
|
level: s.level++
|
1812
1812
|
})) : s.tokens.push({
|
1813
1813
|
type: "bullet_list_open",
|
1814
|
-
lines:
|
1814
|
+
lines: J = [e, 0],
|
1815
1815
|
level: s.level++
|
1816
|
-
}), n = e, A = !1,
|
1816
|
+
}), n = e, A = !1, H = s.parser.ruler.getRules("list"); n < t && (S = s.skipSpaces(u), h = s.eMarks[n], S >= h ? p = 1 : p = S - u, p > 4 && (p = 1), p < 1 && (p = 1), r = u - s.bMarks[n] + p, s.tokens.push({
|
1817
1817
|
type: "list_item_open",
|
1818
1818
|
lines: Q = [e, 0],
|
1819
1819
|
level: s.level++
|
@@ -1821,7 +1821,7 @@ function dr(s, e, t, i) {
|
|
1821
1821
|
type: "list_item_close",
|
1822
1822
|
level: --s.level
|
1823
1823
|
}), n = e = s.line, Q[1] = n, S = s.bMarks[e], !(n >= t || s.isEmpty(n) || s.tShift[n] < s.blkIndent));) {
|
1824
|
-
for (Si = !1, O = 0, Ee =
|
1824
|
+
for (Si = !1, O = 0, Ee = H.length; O < Ee; O++) if (H[O](s, n, t, !0)) {
|
1825
1825
|
Si = !0;
|
1826
1826
|
break;
|
1827
1827
|
}
|
@@ -1834,7 +1834,7 @@ function dr(s, e, t, i) {
|
|
1834
1834
|
return s.tokens.push({
|
1835
1835
|
type: E ? "ordered_list_close" : "bullet_list_close",
|
1836
1836
|
level: --s.level
|
1837
|
-
}),
|
1837
|
+
}), J[1] = n, s.line = n, le && cr(s, W), !0;
|
1838
1838
|
}
|
1839
1839
|
function ur(s, e, t, i) {
|
1840
1840
|
var n,
|
@@ -2116,7 +2116,7 @@ function Er(s, e) {
|
|
2116
2116
|
}
|
2117
2117
|
var Ot = [["code", rr], ["fences", or, ["paragraph", "blockquote", "list"]], ["blockquote", ar, ["paragraph", "blockquote", "list"]], ["hr", lr, ["paragraph", "blockquote", "list"]], ["list", dr, ["paragraph", "blockquote"]], ["footnote", ur, ["paragraph"]], ["heading", hr, ["paragraph", "blockquote"]], ["lheading", pr], ["htmlblock", br, ["paragraph", "blockquote"]], ["table", vr, ["paragraph"]], ["deflist", xr, ["paragraph"]], ["paragraph", Er]];
|
2118
2118
|
function Ji() {
|
2119
|
-
this.ruler = new
|
2119
|
+
this.ruler = new V();
|
2120
2120
|
for (var s = 0; s < Ot.length; s++) this.ruler.push(Ot[s][0], Ot[s][1], {
|
2121
2121
|
alt: (Ot[s][2] || []).slice()
|
2122
2122
|
});
|
@@ -2141,7 +2141,7 @@ Ji.prototype.parse = function (s, e, t, i) {
|
|
2141
2141
|
s = s.replace(wr, " "), s = s.replace(Sr, "\n"), s.indexOf(" ") >= 0 && (s = s.replace(_r, function (a, l) {
|
2142
2142
|
var c;
|
2143
2143
|
return s.charCodeAt(l) === 10 ? (r = l + 1, o = 0, a) : (c = " ".slice((l - r - o) % 4), o = l - r + 1, c);
|
2144
|
-
})), n = new
|
2144
|
+
})), n = new Be(s, this, e, t, i), this.tokenize(n, n.line, n.lineMax);
|
2145
2145
|
};
|
2146
2146
|
function Mr(s) {
|
2147
2147
|
switch (s) {
|
@@ -2601,7 +2601,7 @@ function lo(s, e) {
|
|
2601
2601
|
}
|
2602
2602
|
var Ai = [["text", Tr], ["newline", Cr], ["escape", Ar], ["backticks", kr], ["del", Ir], ["ins", Lr], ["mark", Rr], ["emphasis", Nr], ["sub", Pr], ["sup", jr], ["links", Br], ["footnote_inline", Fr], ["footnote_ref", zr], ["autolink", Gr], ["htmltag", ro], ["entity", lo]];
|
2603
2603
|
function si() {
|
2604
|
-
this.ruler = new
|
2604
|
+
this.ruler = new V();
|
2605
2605
|
for (var s = 0; s < Ai.length; s++) this.ruler.push(Ai[s][0], Ai[s][1]);
|
2606
2606
|
this.validateLink = co;
|
2607
2607
|
}
|
@@ -2633,7 +2633,7 @@ si.prototype.tokenize = function (s) {
|
|
2633
2633
|
s.pending && s.pushPending();
|
2634
2634
|
};
|
2635
2635
|
si.prototype.parse = function (s, e, t, i) {
|
2636
|
-
var n = new
|
2636
|
+
var n = new je(s, this, e, t, i);
|
2637
2637
|
this.tokenize(n);
|
2638
2638
|
};
|
2639
2639
|
function co(s) {
|
@@ -2759,7 +2759,7 @@ function os(s, e, t) {
|
|
2759
2759
|
this.src = e, this.env = t, this.options = s.options, this.tokens = [], this.inlineMode = !1, this.inline = s.inline, this.block = s.block, this.renderer = s.renderer, this.typographer = s.typographer;
|
2760
2760
|
}
|
2761
2761
|
function he(s, e) {
|
2762
|
-
typeof s != "string" && (e = s, s = "default"), e && e.linkify != null && console.warn("linkify option is removed. Use linkify plugin instead:\n\nimport Remarkable from 'remarkable';\nimport linkify from 'remarkable/linkify';\nnew Remarkable().use(linkify)\n"), this.inline = new si(), this.block = new Ji(), this.core = new ss(), this.renderer = new Wi(), this.ruler = new
|
2762
|
+
typeof s != "string" && (e = s, s = "default"), e && e.linkify != null && console.warn("linkify option is removed. Use linkify plugin instead:\n\nimport Remarkable from 'remarkable';\nimport linkify from 'remarkable/linkify';\nnew Remarkable().use(linkify)\n"), this.inline = new si(), this.block = new Ji(), this.core = new ss(), this.renderer = new Wi(), this.ruler = new V(), this.options = {}, this.configure(fo[s]), this.set(e || {});
|
2763
2763
|
}
|
2764
2764
|
he.prototype.set = function (s) {
|
2765
2765
|
Xn(this.options, s);
|
@@ -2842,10 +2842,10 @@ var vt = /*#__PURE__*/function () {
|
|
2842
2842
|
return vt;
|
2843
2843
|
}();
|
2844
2844
|
var as = /*#__PURE__*/function () {
|
2845
|
-
function
|
2846
|
-
_classCallCheck(this,
|
2845
|
+
function We() {
|
2846
|
+
_classCallCheck(this, We);
|
2847
2847
|
}
|
2848
|
-
_createClass(
|
2848
|
+
_createClass(We, null, [{
|
2849
2849
|
key: "addMessage",
|
2850
2850
|
value: function addMessage(e, t, i, n) {
|
2851
2851
|
var r;
|
@@ -2855,7 +2855,7 @@ var as = /*#__PURE__*/function () {
|
|
2855
2855
|
key: "wrapInLink",
|
2856
2856
|
value: function wrapInLink(e, t, i) {
|
2857
2857
|
var n = document.createElement("a");
|
2858
|
-
return n.href = t, n.download = i ||
|
2858
|
+
return n.href = t, n.download = i || We.DEFAULT_FILE_NAME, n.target = "_blank", n.appendChild(e), n;
|
2859
2859
|
}
|
2860
2860
|
}, {
|
2861
2861
|
key: "isNonLinkableDataUrl",
|
@@ -2865,7 +2865,7 @@ var as = /*#__PURE__*/function () {
|
|
2865
2865
|
}, {
|
2866
2866
|
key: "processContent",
|
2867
2867
|
value: function processContent(e, t, i, n) {
|
2868
|
-
return !i ||
|
2868
|
+
return !i || We.isNonLinkableDataUrl(e, i) ? t : We.wrapInLink(t, i, n);
|
2869
2869
|
}
|
2870
2870
|
}, {
|
2871
2871
|
key: "waitToLoadThenScroll",
|
@@ -2877,11 +2877,11 @@ var as = /*#__PURE__*/function () {
|
|
2877
2877
|
}, {
|
2878
2878
|
key: "scrollDownOnImageLoad",
|
2879
2879
|
value: function scrollDownOnImageLoad(e, t) {
|
2880
|
-
if (e.startsWith("data"))
|
2880
|
+
if (e.startsWith("data")) We.waitToLoadThenScroll(t);else try {
|
2881
2881
|
fetch(e, {
|
2882
2882
|
mode: "no-cors"
|
2883
2883
|
})["catch"](function () {})["finally"](function () {
|
2884
|
-
|
2884
|
+
We.waitToLoadThenScroll(t);
|
2885
2885
|
});
|
2886
2886
|
} catch (_unused5) {
|
2887
2887
|
t.scrollTop = t.scrollHeight;
|
@@ -2907,7 +2907,7 @@ var as = /*#__PURE__*/function () {
|
|
2907
2907
|
return delete t.ref, t;
|
2908
2908
|
}
|
2909
2909
|
}]);
|
2910
|
-
return
|
2910
|
+
return We;
|
2911
2911
|
}();
|
2912
2912
|
as.DEFAULT_FILE_NAME = "file";
|
2913
2913
|
var re = as;
|
@@ -3002,15 +3002,15 @@ var D = /*#__PURE__*/function () {
|
|
3002
3002
|
}]);
|
3003
3003
|
return D;
|
3004
3004
|
}();
|
3005
|
-
var
|
3006
|
-
function
|
3005
|
+
var Ye = /*#__PURE__*/function () {
|
3006
|
+
function Ye(e) {
|
3007
3007
|
var _this3 = this;
|
3008
|
-
_classCallCheck(this,
|
3009
|
-
this.messageElementRefs = [], this.messages = [], this.htmlClassUtilities = {}, this.textElementsToText = [], this.elementRef =
|
3008
|
+
_classCallCheck(this, Ye);
|
3009
|
+
this.messageElementRefs = [], this.messages = [], this.htmlClassUtilities = {}, this.textElementsToText = [], this.elementRef = Ye.createContainerElement(), this.messageStyles = e.messageStyles, this._remarkable = vt.createNew(), this._avatars = e.avatars, this._names = e.names, this._onNewMessage = Ft.onNewMessage.bind(this, e), e.htmlClassUtilities && (this.htmlClassUtilities = e.htmlClassUtilities), setTimeout(function () {
|
3010
3010
|
_this3.submitUserMessage = e.submitUserMessage;
|
3011
3011
|
});
|
3012
3012
|
}
|
3013
|
-
_createClass(
|
3013
|
+
_createClass(Ye, [{
|
3014
3014
|
key: "addNewTextMessage",
|
3015
3015
|
value: function addNewTextMessage(e, t, i) {
|
3016
3016
|
if (i != null && i.status) {
|
@@ -3047,12 +3047,12 @@ var Ke = /*#__PURE__*/function () {
|
|
3047
3047
|
var n;
|
3048
3048
|
(n = this._introPanel) == null || n.hide();
|
3049
3049
|
var i = this.messageElementRefs[this.messageElementRefs.length - 1];
|
3050
|
-
return
|
3050
|
+
return Ye.isTemporaryElement(i) && (i.outerContainer.remove(), this.messageElementRefs.pop()), this.createMessageElements(e, t);
|
3051
3051
|
}
|
3052
3052
|
}, {
|
3053
3053
|
key: "createMessageElements",
|
3054
3054
|
value: function createMessageElements(e, t) {
|
3055
|
-
var i =
|
3055
|
+
var i = Ye.createBaseElements(),
|
3056
3056
|
n = i.outerContainer,
|
3057
3057
|
r = i.innerContainer,
|
3058
3058
|
o = i.bubbleElement;
|
@@ -3144,7 +3144,7 @@ var Ke = /*#__PURE__*/function () {
|
|
3144
3144
|
return t && (a.text = t), i && (a.files = i), n && (a.html = n), !t && !i && !n && (a.text = ""), r && (a._sessionId = r), a;
|
3145
3145
|
}
|
3146
3146
|
}]);
|
3147
|
-
return
|
3147
|
+
return Ye;
|
3148
3148
|
}();
|
3149
3149
|
var Ki = /*#__PURE__*/function () {
|
3150
3150
|
// used for extracting at end and for isStreaming
|
@@ -3171,7 +3171,7 @@ var Ki = /*#__PURE__*/function () {
|
|
3171
3171
|
key: "setInitialState",
|
3172
3172
|
value: function setInitialState(e, t, i) {
|
3173
3173
|
var _i8;
|
3174
|
-
this._streamType = e, (_i8 = i) !== null && _i8 !== void 0 ? _i8 : i = b.AI_ROLE, this._elements = e === "text" ? this._messages.addNewTextMessage(t, i) :
|
3174
|
+
this._streamType = e, (_i8 = i) !== null && _i8 !== void 0 ? _i8 : i = b.AI_ROLE, this._elements = e === "text" ? this._messages.addNewTextMessage(t, i) : Qe.add(this._messages, t, i, this._messages.messageElementRefs), this._elements.bubbleElement.classList.add(ot.MESSAGE_CLASS), this._streamedContent = t, this._activeMessageRole = i;
|
3175
3175
|
}
|
3176
3176
|
}, {
|
3177
3177
|
key: "updateBasedOnType",
|
@@ -3205,14 +3205,14 @@ var Ki = /*#__PURE__*/function () {
|
|
3205
3205
|
var n = {
|
3206
3206
|
role: this._activeMessageRole || b.AI_ROLE
|
3207
3207
|
};
|
3208
|
-
this._streamType === "text" ? (e[e.length - 1][1] = this._streamedContent, n.text = this._streamedContent, this._messages.textToSpeech && jt.speak(this._streamedContent, this._messages.textToSpeech)) : this._streamType === "html" && (this._streamedContent === ot.HTML_CONTENT_PLACEHOLDER && (this._streamedContent = ((o = b.getLastMessageBubbleElement(t)) == null ? void 0 : o.innerHTML) || ""), this._elements && oe.apply(this._messages, this._elements.outerContainer), n.html = this._streamedContent), n && (this._messages.messages.push(n), this._messages.sendClientUpdate(
|
3208
|
+
this._streamType === "text" ? (e[e.length - 1][1] = this._streamedContent, n.text = this._streamedContent, this._messages.textToSpeech && jt.speak(this._streamedContent, this._messages.textToSpeech)) : this._streamType === "html" && (this._streamedContent === ot.HTML_CONTENT_PLACEHOLDER && (this._streamedContent = ((o = b.getLastMessageBubbleElement(t)) == null ? void 0 : o.innerHTML) || ""), this._elements && oe.apply(this._messages, this._elements.outerContainer), n.html = this._streamedContent), n && (this._messages.messages.push(n), this._messages.sendClientUpdate(Ye.createMessageContent(n), !1)), this._hasStreamEnded = !0;
|
3209
3209
|
}
|
3210
3210
|
}]);
|
3211
3211
|
return ot;
|
3212
3212
|
}();
|
3213
3213
|
Ki.MESSAGE_CLASS = "streamed-message";
|
3214
3214
|
Ki.HTML_CONTENT_PLACEHOLDER = "htmlplaceholder";
|
3215
|
-
var
|
3215
|
+
var Oe = Ki;
|
3216
3216
|
var ls = /*#__PURE__*/function () {
|
3217
3217
|
function at() {
|
3218
3218
|
_classCallCheck(this, at);
|
@@ -3468,20 +3468,20 @@ function Eo(s, e) {
|
|
3468
3468
|
l || document.addEventListener("visibilitychange", f);
|
3469
3469
|
var E = xo,
|
3470
3470
|
S = 0;
|
3471
|
-
function
|
3471
|
+
function W() {
|
3472
3472
|
document.removeEventListener("visibilitychange", f), window.clearTimeout(S), g.abort();
|
3473
3473
|
}
|
3474
3474
|
t == null || t.addEventListener("abort", function () {
|
3475
|
-
|
3475
|
+
W(), u();
|
3476
3476
|
});
|
3477
3477
|
var A = c !== null && c !== void 0 ? c : window.fetch,
|
3478
|
-
|
3478
|
+
J = n !== null && n !== void 0 ? n : _o;
|
3479
3479
|
function Q() {
|
3480
3480
|
return _Q.apply(this, arguments);
|
3481
3481
|
}
|
3482
3482
|
function _Q() {
|
3483
3483
|
_Q = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
3484
|
-
var le,
|
3484
|
+
var le, H, O;
|
3485
3485
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
3486
3486
|
while (1) switch (_context3.prev = _context3.next) {
|
3487
3487
|
case 0:
|
@@ -3493,19 +3493,19 @@ function Eo(s, e) {
|
|
3493
3493
|
signal: g.signal
|
3494
3494
|
}));
|
3495
3495
|
case 4:
|
3496
|
-
|
3496
|
+
H = _context3.sent;
|
3497
3497
|
_context3.next = 7;
|
3498
|
-
return
|
3498
|
+
return J(H);
|
3499
3499
|
case 7:
|
3500
3500
|
_context3.next = 9;
|
3501
|
-
return mo(
|
3501
|
+
return mo(H.body, go(bo(function (O) {
|
3502
3502
|
O ? p[_n] = O : delete p[_n];
|
3503
3503
|
}, function (O) {
|
3504
3504
|
E = O;
|
3505
3505
|
}, r)));
|
3506
3506
|
case 9:
|
3507
3507
|
o == null || o();
|
3508
|
-
|
3508
|
+
W();
|
3509
3509
|
u();
|
3510
3510
|
_context3.next = 17;
|
3511
3511
|
break;
|
@@ -3516,7 +3516,7 @@ function Eo(s, e) {
|
|
3516
3516
|
O = (le = a == null ? void 0 : a(_context3.t0)) !== null && le !== void 0 ? le : E;
|
3517
3517
|
window.clearTimeout(S), S = window.setTimeout(Q, O);
|
3518
3518
|
} catch (O) {
|
3519
|
-
|
3519
|
+
W(), h(O);
|
3520
3520
|
}
|
3521
3521
|
case 17:
|
3522
3522
|
case "end":
|
@@ -3533,80 +3533,6 @@ function _o(s) {
|
|
3533
3533
|
var e = s.headers.get("content-type");
|
3534
3534
|
if (!(e != null && e.startsWith(Bi))) throw new Error("Expected content-type to be ".concat(Bi, ", Actual: ").concat(e));
|
3535
3535
|
}
|
3536
|
-
var cs = /*#__PURE__*/function () {
|
3537
|
-
function lt() {
|
3538
|
-
_classCallCheck(this, lt);
|
3539
|
-
}
|
3540
|
-
_createClass(lt, null, [{
|
3541
|
-
key: "generateResponse",
|
3542
|
-
value: function generateResponse(e) {
|
3543
|
-
var t = e.messages[e.messages.length - 1];
|
3544
|
-
if (t.files && t.files.length > 0) {
|
3545
|
-
if (t.files.length > 1) return "These are interesting files!";
|
3546
|
-
var i = t.files[0];
|
3547
|
-
return i.src && i.src.startsWith("data:image/gif") ? "That is a nice gif!" : i.type === "image" ? "That is a nice image!" : i.type === "audio" ? "I like the sound of that!" : "That is an interesting file!";
|
3548
|
-
}
|
3549
|
-
if (t.text) {
|
3550
|
-
if (t.text.charAt(t.text.length - 1) === "?") return "I'm sorry but I can't answer that question...";
|
3551
|
-
if (t.text.includes("updog")) return "What's updog?";
|
3552
|
-
}
|
3553
|
-
return "Hi there! This is a demo response!";
|
3554
|
-
}
|
3555
|
-
}, {
|
3556
|
-
key: "getCustomResponse",
|
3557
|
-
value: function getCustomResponse(e, t) {
|
3558
|
-
return typeof e == "function" ? e(t) : e;
|
3559
|
-
}
|
3560
|
-
}, {
|
3561
|
-
key: "getResponse",
|
3562
|
-
value: function getResponse(e) {
|
3563
|
-
return e.customDemoResponse ? lt.getCustomResponse(e.customDemoResponse, e.messages[e.messages.length - 1]) : {
|
3564
|
-
text: lt.generateResponse(e)
|
3565
|
-
};
|
3566
|
-
}
|
3567
|
-
// timeout is used to simulate a timeout for a response to come back
|
3568
|
-
}, {
|
3569
|
-
key: "request",
|
3570
|
-
value: function request(e, t) {
|
3571
|
-
var i = lt.getResponse(t);
|
3572
|
-
setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
3573
|
-
var r, o, n;
|
3574
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
3575
|
-
while (1) switch (_context4.prev = _context4.next) {
|
3576
|
-
case 0:
|
3577
|
-
_context4.next = 2;
|
3578
|
-
return (o = (r = e.deepChat).responseInterceptor) == null ? void 0 : o.call(r, i);
|
3579
|
-
case 2:
|
3580
|
-
_context4.t0 = _context4.sent;
|
3581
|
-
if (_context4.t0) {
|
3582
|
-
_context4.next = 5;
|
3583
|
-
break;
|
3584
|
-
}
|
3585
|
-
_context4.t0 = i;
|
3586
|
-
case 5:
|
3587
|
-
n = _context4.t0;
|
3588
|
-
n.error ? (t.addNewErrorMessage("service", n.error), e.completionsHandlers.onFinish()) : I.isSimulation(e.deepChat.stream) ? I.simulate(t, e.streamHandlers, n) : (t.addNewMessage(n), e.completionsHandlers.onFinish());
|
3589
|
-
case 7:
|
3590
|
-
case "end":
|
3591
|
-
return _context4.stop();
|
3592
|
-
}
|
3593
|
-
}, _callee4);
|
3594
|
-
})), 400);
|
3595
|
-
}
|
3596
|
-
// timeout is used to simulate a timeout for a response to come back
|
3597
|
-
}, {
|
3598
|
-
key: "requestStream",
|
3599
|
-
value: function requestStream(e, t) {
|
3600
|
-
setTimeout(function () {
|
3601
|
-
var i = lt.getResponse(e);
|
3602
|
-
I.simulate(e, t, i);
|
3603
|
-
}, 400);
|
3604
|
-
}
|
3605
|
-
}]);
|
3606
|
-
return lt;
|
3607
|
-
}();
|
3608
|
-
cs.URL = "deep-chat-demo";
|
3609
|
-
var ye = cs;
|
3610
3536
|
var I = /*#__PURE__*/function () {
|
3611
3537
|
function I() {
|
3612
3538
|
_classCallCheck(this, I);
|
@@ -3615,14 +3541,14 @@ var I = /*#__PURE__*/function () {
|
|
3615
3541
|
key: "request",
|
3616
3542
|
value: // prettier-ignore
|
3617
3543
|
function () {
|
3618
|
-
var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3544
|
+
var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(e, t, i) {
|
3619
3545
|
var n,
|
3620
3546
|
p,
|
3621
3547
|
g,
|
3622
3548
|
f,
|
3623
3549
|
E,
|
3624
3550
|
S,
|
3625
|
-
|
3551
|
+
W,
|
3626
3552
|
r,
|
3627
3553
|
_yield$_$processReque,
|
3628
3554
|
o,
|
@@ -3633,19 +3559,19 @@ var I = /*#__PURE__*/function () {
|
|
3633
3559
|
d,
|
3634
3560
|
u,
|
3635
3561
|
h,
|
3636
|
-
|
3637
|
-
return _regeneratorRuntime().wrap(function
|
3638
|
-
while (1) switch (
|
3562
|
+
_args6 = arguments;
|
3563
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
3564
|
+
while (1) switch (_context6.prev = _context6.next) {
|
3639
3565
|
case 0:
|
3640
|
-
n =
|
3566
|
+
n = _args6.length > 3 && _args6[3] !== undefined ? _args6[3] : !0;
|
3641
3567
|
r = {
|
3642
3568
|
body: t,
|
3643
3569
|
headers: (p = e.requestSettings) == null ? void 0 : p.headers
|
3644
3570
|
};
|
3645
|
-
|
3571
|
+
_context6.next = 4;
|
3646
3572
|
return _.processRequestInterceptor(e.deepChat, r);
|
3647
3573
|
case 4:
|
3648
|
-
_yield$_$processReque =
|
3574
|
+
_yield$_$processReque = _context6.sent;
|
3649
3575
|
o = _yield$_$processReque.body;
|
3650
3576
|
a = _yield$_$processReque.headers;
|
3651
3577
|
l = _yield$_$processReque.error;
|
@@ -3654,79 +3580,79 @@ var I = /*#__PURE__*/function () {
|
|
3654
3580
|
d = _e$streamHandlers.onClose;
|
3655
3581
|
u = _e$streamHandlers.abortStream;
|
3656
3582
|
if (!l) {
|
3657
|
-
|
3583
|
+
_context6.next = 14;
|
3658
3584
|
break;
|
3659
3585
|
}
|
3660
|
-
return
|
3586
|
+
return _context6.abrupt("return", _.onInterceptorError(i, l, d));
|
3661
3587
|
case 14:
|
3662
3588
|
if (!((g = e.requestSettings) != null && g.handler)) {
|
3663
|
-
|
3589
|
+
_context6.next = 16;
|
3664
3590
|
break;
|
3665
3591
|
}
|
3666
|
-
return
|
3592
|
+
return _context6.abrupt("return", Le.stream(e, o, i));
|
3667
3593
|
case 16:
|
3668
3594
|
if (!(((f = e.requestSettings) == null ? void 0 : f.url) === ye.URL)) {
|
3669
|
-
|
3595
|
+
_context6.next = 18;
|
3670
3596
|
break;
|
3671
3597
|
}
|
3672
|
-
return
|
3598
|
+
return _context6.abrupt("return", ye.requestStream(i, e.streamHandlers));
|
3673
3599
|
case 18:
|
3674
|
-
h = new
|
3600
|
+
h = new Oe(i);
|
3675
3601
|
Eo(((E = e.requestSettings) == null ? void 0 : E.url) || e.url || "", {
|
3676
3602
|
method: ((S = e.requestSettings) == null ? void 0 : S.method) || "POST",
|
3677
3603
|
headers: a,
|
3678
|
-
credentials: (
|
3604
|
+
credentials: (W = e.requestSettings) == null ? void 0 : W.credentials,
|
3679
3605
|
body: n ? JSON.stringify(o) : o,
|
3680
3606
|
openWhenHidden: !0,
|
3681
3607
|
// keep stream open when browser tab not open
|
3682
3608
|
onopen: function onopen(A) {
|
3683
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3684
|
-
return _regeneratorRuntime().wrap(function
|
3685
|
-
while (1) switch (
|
3609
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
3610
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
3611
|
+
while (1) switch (_context4.prev = _context4.next) {
|
3686
3612
|
case 0:
|
3687
3613
|
if (!A.ok) {
|
3688
|
-
|
3614
|
+
_context4.next = 2;
|
3689
3615
|
break;
|
3690
3616
|
}
|
3691
|
-
return
|
3617
|
+
return _context4.abrupt("return", c());
|
3692
3618
|
case 2:
|
3693
|
-
|
3619
|
+
_context4.next = 4;
|
3694
3620
|
return _.processResponseByType(A);
|
3695
3621
|
case 4:
|
3696
|
-
throw
|
3622
|
+
throw _context4.sent;
|
3697
3623
|
case 5:
|
3698
3624
|
case "end":
|
3699
|
-
return
|
3625
|
+
return _context4.stop();
|
3700
3626
|
}
|
3701
|
-
},
|
3627
|
+
}, _callee4);
|
3702
3628
|
}))();
|
3703
3629
|
},
|
3704
3630
|
onmessage: function onmessage(A) {
|
3705
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3706
|
-
var
|
3707
|
-
return _regeneratorRuntime().wrap(function
|
3708
|
-
while (1) switch (
|
3631
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
3632
|
+
var J, Q, le, H, O;
|
3633
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
3634
|
+
while (1) switch (_context5.prev = _context5.next) {
|
3709
3635
|
case 0:
|
3710
3636
|
if (!(JSON.stringify(A.data) !== JSON.stringify("[DONE]"))) {
|
3711
|
-
|
3637
|
+
_context5.next = 9;
|
3712
3638
|
break;
|
3713
3639
|
}
|
3714
3640
|
try {
|
3715
|
-
|
3641
|
+
H = JSON.parse(A.data);
|
3716
3642
|
} catch (_unused6) {
|
3717
|
-
|
3643
|
+
H = {};
|
3718
3644
|
}
|
3719
|
-
|
3720
|
-
return (Q = (
|
3645
|
+
_context5.next = 4;
|
3646
|
+
return (Q = (J = e.deepChat).responseInterceptor) == null ? void 0 : Q.call(J, H);
|
3721
3647
|
case 4:
|
3722
|
-
|
3723
|
-
if (
|
3724
|
-
|
3648
|
+
_context5.t0 = _context5.sent;
|
3649
|
+
if (_context5.t0) {
|
3650
|
+
_context5.next = 7;
|
3725
3651
|
break;
|
3726
3652
|
}
|
3727
|
-
|
3653
|
+
_context5.t0 = H;
|
3728
3654
|
case 7:
|
3729
|
-
O =
|
3655
|
+
O = _context5.t0;
|
3730
3656
|
(le = e.extractResultData) == null || le.call(e, O).then(function (Ee) {
|
3731
3657
|
h.upsertStreamedMessage(Ee);
|
3732
3658
|
})["catch"](function (Ee) {
|
@@ -3734,9 +3660,9 @@ var I = /*#__PURE__*/function () {
|
|
3734
3660
|
});
|
3735
3661
|
case 9:
|
3736
3662
|
case "end":
|
3737
|
-
return
|
3663
|
+
return _context5.stop();
|
3738
3664
|
}
|
3739
|
-
},
|
3665
|
+
}, _callee5);
|
3740
3666
|
}))();
|
3741
3667
|
},
|
3742
3668
|
onerror: function onerror(A) {
|
@@ -3747,8 +3673,8 @@ var I = /*#__PURE__*/function () {
|
|
3747
3673
|
},
|
3748
3674
|
signal: u.signal
|
3749
3675
|
})["catch"](function (A) {
|
3750
|
-
var
|
3751
|
-
(
|
3676
|
+
var J;
|
3677
|
+
(J = e.extractResultData) == null || J.call(e, A).then(function () {
|
3752
3678
|
_.displayError(i, A);
|
3753
3679
|
})["catch"](function (Q) {
|
3754
3680
|
_.displayError(i, Q);
|
@@ -3756,9 +3682,9 @@ var I = /*#__PURE__*/function () {
|
|
3756
3682
|
});
|
3757
3683
|
case 20:
|
3758
3684
|
case "end":
|
3759
|
-
return
|
3685
|
+
return _context6.stop();
|
3760
3686
|
}
|
3761
|
-
},
|
3687
|
+
}, _callee6);
|
3762
3688
|
}));
|
3763
3689
|
function request(_x12, _x13, _x14) {
|
3764
3690
|
return _request.apply(this, arguments);
|
@@ -3775,7 +3701,7 @@ var I = /*#__PURE__*/function () {
|
|
3775
3701
|
}, i), !1), i.text) {
|
3776
3702
|
t.onOpen();
|
3777
3703
|
var r = i.text.split("");
|
3778
|
-
I.populateMessages(r, new
|
3704
|
+
I.populateMessages(r, new Oe(e), n);
|
3779
3705
|
}
|
3780
3706
|
}
|
3781
3707
|
}, {
|
@@ -3801,12 +3727,272 @@ var I = /*#__PURE__*/function () {
|
|
3801
3727
|
return _typeof(e) == "object" && !!e.simulation;
|
3802
3728
|
}
|
3803
3729
|
}, {
|
3804
|
-
key: "abort",
|
3805
|
-
value: function abort(e, t, i) {
|
3806
|
-
clearTimeout(e), t.finaliseStreamedMessage(), i();
|
3730
|
+
key: "abort",
|
3731
|
+
value: function abort(e, t, i) {
|
3732
|
+
clearTimeout(e), t.finaliseStreamedMessage(), i();
|
3733
|
+
}
|
3734
|
+
}]);
|
3735
|
+
return I;
|
3736
|
+
}();
|
3737
|
+
var cs = /*#__PURE__*/function () {
|
3738
|
+
function lt() {
|
3739
|
+
_classCallCheck(this, lt);
|
3740
|
+
}
|
3741
|
+
_createClass(lt, null, [{
|
3742
|
+
key: "generateResponse",
|
3743
|
+
value: function generateResponse(e) {
|
3744
|
+
var t = e.messages[e.messages.length - 1];
|
3745
|
+
if (t.files && t.files.length > 0) {
|
3746
|
+
if (t.files.length > 1) return "These are interesting files!";
|
3747
|
+
var i = t.files[0];
|
3748
|
+
return i.src && i.src.startsWith("data:image/gif") ? "That is a nice gif!" : i.type === "image" ? "That is a nice image!" : i.type === "audio" ? "I like the sound of that!" : "That is an interesting file!";
|
3749
|
+
}
|
3750
|
+
if (t.text) {
|
3751
|
+
if (t.text.charAt(t.text.length - 1) === "?") return "I'm sorry but I can't answer that question...";
|
3752
|
+
if (t.text.includes("updog")) return "What's updog?";
|
3753
|
+
}
|
3754
|
+
return "Hi there! This is a demo response!";
|
3755
|
+
}
|
3756
|
+
}, {
|
3757
|
+
key: "getCustomResponse",
|
3758
|
+
value: function getCustomResponse(e, t) {
|
3759
|
+
return typeof e == "function" ? e(t) : e;
|
3760
|
+
}
|
3761
|
+
}, {
|
3762
|
+
key: "getResponse",
|
3763
|
+
value: function getResponse(e) {
|
3764
|
+
return e.customDemoResponse ? lt.getCustomResponse(e.customDemoResponse, e.messages[e.messages.length - 1]) : {
|
3765
|
+
text: lt.generateResponse(e)
|
3766
|
+
};
|
3767
|
+
}
|
3768
|
+
// timeout is used to simulate a timeout for a response to come back
|
3769
|
+
}, {
|
3770
|
+
key: "request",
|
3771
|
+
value: function request(e, t) {
|
3772
|
+
var i = lt.getResponse(t);
|
3773
|
+
setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
3774
|
+
var r, o, n;
|
3775
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
3776
|
+
while (1) switch (_context7.prev = _context7.next) {
|
3777
|
+
case 0:
|
3778
|
+
_context7.next = 2;
|
3779
|
+
return (o = (r = e.deepChat).responseInterceptor) == null ? void 0 : o.call(r, i);
|
3780
|
+
case 2:
|
3781
|
+
_context7.t0 = _context7.sent;
|
3782
|
+
if (_context7.t0) {
|
3783
|
+
_context7.next = 5;
|
3784
|
+
break;
|
3785
|
+
}
|
3786
|
+
_context7.t0 = i;
|
3787
|
+
case 5:
|
3788
|
+
n = _context7.t0;
|
3789
|
+
n.error ? (t.addNewErrorMessage("service", n.error), e.completionsHandlers.onFinish()) : I.isSimulation(e.deepChat.stream) ? I.simulate(t, e.streamHandlers, n) : (t.addNewMessage(n), e.completionsHandlers.onFinish());
|
3790
|
+
case 7:
|
3791
|
+
case "end":
|
3792
|
+
return _context7.stop();
|
3793
|
+
}
|
3794
|
+
}, _callee7);
|
3795
|
+
})), 400);
|
3796
|
+
}
|
3797
|
+
// timeout is used to simulate a timeout for a response to come back
|
3798
|
+
}, {
|
3799
|
+
key: "requestStream",
|
3800
|
+
value: function requestStream(e, t) {
|
3801
|
+
setTimeout(function () {
|
3802
|
+
var i = lt.getResponse(e);
|
3803
|
+
I.simulate(e, t, i);
|
3804
|
+
}, 400);
|
3805
|
+
}
|
3806
|
+
}]);
|
3807
|
+
return lt;
|
3808
|
+
}();
|
3809
|
+
cs.URL = "deep-chat-demo";
|
3810
|
+
var ye = cs;
|
3811
|
+
var F = /*#__PURE__*/function () {
|
3812
|
+
function F() {
|
3813
|
+
_classCallCheck(this, F);
|
3814
|
+
}
|
3815
|
+
_createClass(F, null, [{
|
3816
|
+
key: "setup",
|
3817
|
+
value: function setup(e) {
|
3818
|
+
e.requestSettings.url !== ye.URL && (e.permittedErrorPrefixes = ["Connection error", "Error in server message"], e.websocket = "pending");
|
3819
|
+
}
|
3820
|
+
}, {
|
3821
|
+
key: "createConnection",
|
3822
|
+
value: function createConnection(e, t) {
|
3823
|
+
if (!document.body.contains(e.deepChat)) return;
|
3824
|
+
var i = e.requestSettings.websocket;
|
3825
|
+
if (i) {
|
3826
|
+
if (e.requestSettings.handler) return Le.websocket(e, t);
|
3827
|
+
try {
|
3828
|
+
var n = typeof i != "boolean" ? i : void 0,
|
3829
|
+
r = new WebSocket(e.requestSettings.url || "", n);
|
3830
|
+
e.websocket = r, e.websocket.onopen = function () {
|
3831
|
+
var o, a;
|
3832
|
+
t.removeError(), e.websocket && _typeof(e.websocket) == "object" && F.assignListeners(e, r, t), (a = (o = e.deepChat)._validationHandler) == null || a.call(o);
|
3833
|
+
}, e.websocket.onerror = function (o) {
|
3834
|
+
console.error(o), F.retryConnection(e, t);
|
3835
|
+
};
|
3836
|
+
} catch (n) {
|
3837
|
+
console.error(n), F.retryConnection(e, t);
|
3838
|
+
}
|
3839
|
+
}
|
3840
|
+
}
|
3841
|
+
}, {
|
3842
|
+
key: "retryConnection",
|
3843
|
+
value: function retryConnection(e, t) {
|
3844
|
+
var i, n;
|
3845
|
+
(n = (i = e.deepChat)._validationHandler) == null || n.call(i), document.body.contains(e.deepChat) && (e.websocket = "pending", t.isLastMessageError() || t.addNewErrorMessage("service", "Connection error"), setTimeout(function () {
|
3846
|
+
F.createConnection(e, t);
|
3847
|
+
}, 5e3));
|
3848
|
+
}
|
3849
|
+
}, {
|
3850
|
+
key: "assignListeners",
|
3851
|
+
value: function assignListeners(e, t, i) {
|
3852
|
+
var n = {};
|
3853
|
+
t.onmessage = /*#__PURE__*/function () {
|
3854
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(r) {
|
3855
|
+
var o, a, l, c, d;
|
3856
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
3857
|
+
while (1) switch (_context8.prev = _context8.next) {
|
3858
|
+
case 0:
|
3859
|
+
if (!e.extractResultData) {
|
3860
|
+
_context8.next = 20;
|
3861
|
+
break;
|
3862
|
+
}
|
3863
|
+
_context8.prev = 1;
|
3864
|
+
l = JSON.parse(r.data);
|
3865
|
+
_context8.next = 5;
|
3866
|
+
return (a = (o = e.deepChat).responseInterceptor) == null ? void 0 : a.call(o, l);
|
3867
|
+
case 5:
|
3868
|
+
_context8.t0 = _context8.sent;
|
3869
|
+
if (_context8.t0) {
|
3870
|
+
_context8.next = 8;
|
3871
|
+
break;
|
3872
|
+
}
|
3873
|
+
_context8.t0 = l;
|
3874
|
+
case 8:
|
3875
|
+
c = _context8.t0;
|
3876
|
+
_context8.next = 11;
|
3877
|
+
return e.extractResultData(c);
|
3878
|
+
case 11:
|
3879
|
+
d = _context8.sent;
|
3880
|
+
if (!(!d || _typeof(d) != "object")) {
|
3881
|
+
_context8.next = 14;
|
3882
|
+
break;
|
3883
|
+
}
|
3884
|
+
throw Error(C.INVALID_RESPONSE(l, "server", !!e.deepChat.responseInterceptor, c));
|
3885
|
+
case 14:
|
3886
|
+
I.isSimulation(e.deepChat.stream) ? F.stream(e, i, l, n) : i.addNewMessage(d);
|
3887
|
+
_context8.next = 20;
|
3888
|
+
break;
|
3889
|
+
case 17:
|
3890
|
+
_context8.prev = 17;
|
3891
|
+
_context8.t1 = _context8["catch"](1);
|
3892
|
+
_.displayError(i, _context8.t1, "Error in server message");
|
3893
|
+
case 20:
|
3894
|
+
case "end":
|
3895
|
+
return _context8.stop();
|
3896
|
+
}
|
3897
|
+
}, _callee8, null, [[1, 17]]);
|
3898
|
+
}));
|
3899
|
+
return function (_x15) {
|
3900
|
+
return _ref2.apply(this, arguments);
|
3901
|
+
};
|
3902
|
+
}(), t.onclose = function () {
|
3903
|
+
console.error("Connection closed"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error"), e.deepChat.stream && e.streamHandlers.abortStream.abort(), F.createConnection(e, i);
|
3904
|
+
};
|
3905
|
+
}
|
3906
|
+
}, {
|
3907
|
+
key: "sendWebsocket",
|
3908
|
+
value: function () {
|
3909
|
+
var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(e, t, i) {
|
3910
|
+
var n,
|
3911
|
+
d,
|
3912
|
+
u,
|
3913
|
+
r,
|
3914
|
+
o,
|
3915
|
+
_yield$_$processReque2,
|
3916
|
+
a,
|
3917
|
+
l,
|
3918
|
+
c,
|
3919
|
+
_args9 = arguments;
|
3920
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
3921
|
+
while (1) switch (_context9.prev = _context9.next) {
|
3922
|
+
case 0:
|
3923
|
+
n = _args9.length > 3 && _args9[3] !== undefined ? _args9[3] : !0;
|
3924
|
+
r = e.websocket;
|
3925
|
+
if (!(!r || r === "pending")) {
|
3926
|
+
_context9.next = 4;
|
3927
|
+
break;
|
3928
|
+
}
|
3929
|
+
return _context9.abrupt("return");
|
3930
|
+
case 4:
|
3931
|
+
o = {
|
3932
|
+
body: t,
|
3933
|
+
headers: (d = e.requestSettings) == null ? void 0 : d.headers
|
3934
|
+
};
|
3935
|
+
_context9.next = 7;
|
3936
|
+
return _.processRequestInterceptor(e.deepChat, o);
|
3937
|
+
case 7:
|
3938
|
+
_yield$_$processReque2 = _context9.sent;
|
3939
|
+
a = _yield$_$processReque2.body;
|
3940
|
+
l = _yield$_$processReque2.error;
|
3941
|
+
if (!l) {
|
3942
|
+
_context9.next = 12;
|
3943
|
+
break;
|
3944
|
+
}
|
3945
|
+
return _context9.abrupt("return", i.addNewErrorMessage("service", l));
|
3946
|
+
case 12:
|
3947
|
+
if (F.isWebSocket(r)) {
|
3948
|
+
_context9.next = 14;
|
3949
|
+
break;
|
3950
|
+
}
|
3951
|
+
return _context9.abrupt("return", r.newUserMessage.listener(a));
|
3952
|
+
case 14:
|
3953
|
+
c = n ? JSON.stringify(a) : a;
|
3954
|
+
if (!(((u = e.requestSettings) == null ? void 0 : u.url) === ye.URL)) {
|
3955
|
+
_context9.next = 17;
|
3956
|
+
break;
|
3957
|
+
}
|
3958
|
+
return _context9.abrupt("return", ye.request(e, i));
|
3959
|
+
case 17:
|
3960
|
+
r.readyState === void 0 || r.readyState !== r.OPEN ? (console.error("Connection is not open"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error")) : (r.send(JSON.stringify(c)), e.completionsHandlers.onFinish());
|
3961
|
+
case 18:
|
3962
|
+
case "end":
|
3963
|
+
return _context9.stop();
|
3964
|
+
}
|
3965
|
+
}, _callee9);
|
3966
|
+
}));
|
3967
|
+
function sendWebsocket(_x16, _x17, _x18) {
|
3968
|
+
return _sendWebsocket.apply(this, arguments);
|
3969
|
+
}
|
3970
|
+
return sendWebsocket;
|
3971
|
+
}()
|
3972
|
+
}, {
|
3973
|
+
key: "canSendMessage",
|
3974
|
+
value: function canSendMessage(e) {
|
3975
|
+
return e ? e === "pending" ? !1 : F.isWebSocket(e) ? e.readyState !== void 0 && e.readyState === e.OPEN : e.isOpen : !0;
|
3976
|
+
}
|
3977
|
+
// if false then it is the internal websocket handler
|
3978
|
+
}, {
|
3979
|
+
key: "isWebSocket",
|
3980
|
+
value: function isWebSocket(e) {
|
3981
|
+
return e.send !== void 0;
|
3982
|
+
}
|
3983
|
+
}, {
|
3984
|
+
key: "stream",
|
3985
|
+
value: function stream(e, t, i, n) {
|
3986
|
+
var r = e.deepChat.stream.simulation;
|
3987
|
+
if (typeof r == "string") {
|
3988
|
+
var _n$o;
|
3989
|
+
var o = i.role || b.AI_ROLE,
|
3990
|
+
a = n[o];
|
3991
|
+
a && i.text === r ? (a.finaliseStreamedMessage(), delete n[o]) : ((_n$o = n[o]) !== null && _n$o !== void 0 ? _n$o : n[o] = new Oe(t), n[o].upsertStreamedMessage(i));
|
3992
|
+
} else I.simulate(t, e.streamHandlers, i);
|
3807
3993
|
}
|
3808
3994
|
}]);
|
3809
|
-
return
|
3995
|
+
return F;
|
3810
3996
|
}();
|
3811
3997
|
var Le = /*#__PURE__*/function () {
|
3812
3998
|
function Le() {
|
@@ -3815,45 +4001,45 @@ var Le = /*#__PURE__*/function () {
|
|
3815
4001
|
_createClass(Le, null, [{
|
3816
4002
|
key: "request",
|
3817
4003
|
value: function () {
|
3818
|
-
var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4004
|
+
var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(e, t, i) {
|
3819
4005
|
var a, l, n, r, o;
|
3820
|
-
return _regeneratorRuntime().wrap(function
|
3821
|
-
while (1) switch (
|
4006
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
4007
|
+
while (1) switch (_context11.prev = _context11.next) {
|
3822
4008
|
case 0:
|
3823
4009
|
n = !0;
|
3824
4010
|
r = /*#__PURE__*/function () {
|
3825
|
-
var
|
4011
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(c) {
|
3826
4012
|
var u, h, d;
|
3827
|
-
return _regeneratorRuntime().wrap(function
|
3828
|
-
while (1) switch (
|
4013
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
4014
|
+
while (1) switch (_context10.prev = _context10.next) {
|
3829
4015
|
case 0:
|
3830
4016
|
if (n) {
|
3831
|
-
|
4017
|
+
_context10.next = 2;
|
3832
4018
|
break;
|
3833
4019
|
}
|
3834
|
-
return
|
4020
|
+
return _context10.abrupt("return");
|
3835
4021
|
case 2:
|
3836
4022
|
n = !1;
|
3837
|
-
|
4023
|
+
_context10.next = 5;
|
3838
4024
|
return (h = (u = e.deepChat).responseInterceptor) == null ? void 0 : h.call(u, c);
|
3839
4025
|
case 5:
|
3840
|
-
|
3841
|
-
if (
|
3842
|
-
|
4026
|
+
_context10.t0 = _context10.sent;
|
4027
|
+
if (_context10.t0) {
|
4028
|
+
_context10.next = 8;
|
3843
4029
|
break;
|
3844
4030
|
}
|
3845
|
-
|
4031
|
+
_context10.t0 = c;
|
3846
4032
|
case 8:
|
3847
|
-
d =
|
4033
|
+
d = _context10.t0;
|
3848
4034
|
_.validateResponseFormat(d) ? typeof d.error == "string" ? (console.error(d.error), i.addNewErrorMessage("service", d.error), e.completionsHandlers.onFinish()) : I.isSimulation(e.deepChat.stream) ? I.simulate(i, e.streamHandlers, d) : (i.addNewMessage(d), e.completionsHandlers.onFinish()) : (console.error(C.INVALID_RESPONSE(c, "server", !!e.deepChat.responseInterceptor, d)), i.addNewErrorMessage("service", "Error in server message"), e.completionsHandlers.onFinish());
|
3849
4035
|
case 10:
|
3850
4036
|
case "end":
|
3851
|
-
return
|
4037
|
+
return _context10.stop();
|
3852
4038
|
}
|
3853
|
-
},
|
4039
|
+
}, _callee10);
|
3854
4040
|
}));
|
3855
|
-
return function r(
|
3856
|
-
return
|
4041
|
+
return function r(_x22) {
|
4042
|
+
return _ref3.apply(this, arguments);
|
3857
4043
|
};
|
3858
4044
|
}(), o = Le.generateOptionalSignals();
|
3859
4045
|
(l = (a = e.requestSettings).handler) == null || l.call(a, t, _objectSpread(_objectSpread({}, o), {}, {
|
@@ -3861,11 +4047,11 @@ var Le = /*#__PURE__*/function () {
|
|
3861
4047
|
}));
|
3862
4048
|
case 3:
|
3863
4049
|
case "end":
|
3864
|
-
return
|
4050
|
+
return _context11.stop();
|
3865
4051
|
}
|
3866
|
-
},
|
4052
|
+
}, _callee11);
|
3867
4053
|
}));
|
3868
|
-
function request(
|
4054
|
+
function request(_x19, _x20, _x21) {
|
3869
4055
|
return _request2.apply(this, arguments);
|
3870
4056
|
}
|
3871
4057
|
return request;
|
@@ -3876,7 +4062,7 @@ var Le = /*#__PURE__*/function () {
|
|
3876
4062
|
var u, h;
|
3877
4063
|
var n = !0,
|
3878
4064
|
r = !1;
|
3879
|
-
var o = new
|
4065
|
+
var o = new Oe(i),
|
3880
4066
|
a = function a() {
|
3881
4067
|
r || !n || (e.streamHandlers.onOpen(), r = !0);
|
3882
4068
|
},
|
@@ -3906,7 +4092,8 @@ var Le = /*#__PURE__*/function () {
|
|
3906
4092
|
isOpen: !1,
|
3907
4093
|
newUserMessage: {
|
3908
4094
|
listener: function listener() {}
|
3909
|
-
}
|
4095
|
+
},
|
4096
|
+
roleToStream: {}
|
3910
4097
|
};
|
3911
4098
|
e.websocket = i;
|
3912
4099
|
var n = function n() {
|
@@ -3916,37 +4103,37 @@ var Le = /*#__PURE__*/function () {
|
|
3916
4103
|
i.isOpen = !1;
|
3917
4104
|
},
|
3918
4105
|
o = /*#__PURE__*/function () {
|
3919
|
-
var
|
4106
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(d) {
|
3920
4107
|
var h, p, u;
|
3921
|
-
return _regeneratorRuntime().wrap(function
|
3922
|
-
while (1) switch (
|
4108
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
4109
|
+
while (1) switch (_context12.prev = _context12.next) {
|
3923
4110
|
case 0:
|
3924
4111
|
if (i.isOpen) {
|
3925
|
-
|
4112
|
+
_context12.next = 2;
|
3926
4113
|
break;
|
3927
4114
|
}
|
3928
|
-
return
|
4115
|
+
return _context12.abrupt("return");
|
3929
4116
|
case 2:
|
3930
|
-
|
4117
|
+
_context12.next = 4;
|
3931
4118
|
return (p = (h = e.deepChat).responseInterceptor) == null ? void 0 : p.call(h, d);
|
3932
4119
|
case 4:
|
3933
|
-
|
3934
|
-
if (
|
3935
|
-
|
4120
|
+
_context12.t0 = _context12.sent;
|
4121
|
+
if (_context12.t0) {
|
4122
|
+
_context12.next = 7;
|
3936
4123
|
break;
|
3937
4124
|
}
|
3938
|
-
|
4125
|
+
_context12.t0 = d;
|
3939
4126
|
case 7:
|
3940
|
-
u =
|
3941
|
-
_.validateResponseFormat(u) ? typeof u.error == "string" ? (console.error(u.error), t.isLastMessageError() || t.addNewErrorMessage("service", u.error)) : e.deepChat.stream ?
|
4127
|
+
u = _context12.t0;
|
4128
|
+
_.validateResponseFormat(u) ? typeof u.error == "string" ? (console.error(u.error), t.isLastMessageError() || t.addNewErrorMessage("service", u.error)) : I.isSimulation(e.deepChat.stream) ? F.stream(e, t, d, i.roleToStream) : t.addNewMessage(u) : (console.error(C.INVALID_RESPONSE(d, "server", !!e.deepChat.responseInterceptor, u)), t.addNewErrorMessage("service", "Error in server message"));
|
3942
4129
|
case 9:
|
3943
4130
|
case "end":
|
3944
|
-
return
|
4131
|
+
return _context12.stop();
|
3945
4132
|
}
|
3946
|
-
},
|
4133
|
+
}, _callee12);
|
3947
4134
|
}));
|
3948
|
-
return function o(
|
3949
|
-
return
|
4135
|
+
return function o(_x23) {
|
4136
|
+
return _ref4.apply(this, arguments);
|
3950
4137
|
};
|
3951
4138
|
}(),
|
3952
4139
|
a = Le.generateOptionalSignals();
|
@@ -3982,53 +4169,53 @@ var w = /*#__PURE__*/function () {
|
|
3982
4169
|
key: "request",
|
3983
4170
|
value: // prettier-ignore
|
3984
4171
|
function () {
|
3985
|
-
var _request3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4172
|
+
var _request3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(e, t, i) {
|
3986
4173
|
var n,
|
3987
4174
|
h,
|
3988
4175
|
p,
|
3989
4176
|
g,
|
3990
4177
|
r,
|
3991
|
-
_yield$_$
|
4178
|
+
_yield$_$processReque3,
|
3992
4179
|
o,
|
3993
4180
|
a,
|
3994
4181
|
l,
|
3995
4182
|
c,
|
3996
4183
|
d,
|
3997
4184
|
u,
|
3998
|
-
|
3999
|
-
return _regeneratorRuntime().wrap(function
|
4000
|
-
while (1) switch (
|
4185
|
+
_args14 = arguments;
|
4186
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
4187
|
+
while (1) switch (_context14.prev = _context14.next) {
|
4001
4188
|
case 0:
|
4002
|
-
n =
|
4189
|
+
n = _args14.length > 3 && _args14[3] !== undefined ? _args14[3] : !0;
|
4003
4190
|
r = {
|
4004
4191
|
body: t,
|
4005
4192
|
headers: (h = e.requestSettings) == null ? void 0 : h.headers
|
4006
4193
|
};
|
4007
|
-
|
4194
|
+
_context14.next = 4;
|
4008
4195
|
return _.processRequestInterceptor(e.deepChat, r);
|
4009
4196
|
case 4:
|
4010
|
-
_yield$_$
|
4011
|
-
o = _yield$_$
|
4012
|
-
a = _yield$_$
|
4013
|
-
l = _yield$_$
|
4197
|
+
_yield$_$processReque3 = _context14.sent;
|
4198
|
+
o = _yield$_$processReque3.body;
|
4199
|
+
a = _yield$_$processReque3.headers;
|
4200
|
+
l = _yield$_$processReque3.error;
|
4014
4201
|
c = e.completionsHandlers.onFinish;
|
4015
4202
|
if (!l) {
|
4016
|
-
|
4203
|
+
_context14.next = 11;
|
4017
4204
|
break;
|
4018
4205
|
}
|
4019
|
-
return
|
4206
|
+
return _context14.abrupt("return", _.onInterceptorError(i, l, c));
|
4020
4207
|
case 11:
|
4021
4208
|
if (!((p = e.requestSettings) != null && p.handler)) {
|
4022
|
-
|
4209
|
+
_context14.next = 13;
|
4023
4210
|
break;
|
4024
4211
|
}
|
4025
|
-
return
|
4212
|
+
return _context14.abrupt("return", Le.request(e, o, i));
|
4026
4213
|
case 13:
|
4027
4214
|
if (!(((g = e.requestSettings) == null ? void 0 : g.url) === ye.URL)) {
|
4028
|
-
|
4215
|
+
_context14.next = 15;
|
4029
4216
|
break;
|
4030
4217
|
}
|
4031
|
-
return
|
4218
|
+
return _context14.abrupt("return", ye.request(e, i));
|
4032
4219
|
case 15:
|
4033
4220
|
d = !0;
|
4034
4221
|
u = _.fetch.bind(this, e, a, n);
|
@@ -4037,40 +4224,40 @@ var w = /*#__PURE__*/function () {
|
|
4037
4224
|
}).then(function (f) {
|
4038
4225
|
return _.processResponseByType(f);
|
4039
4226
|
}).then( /*#__PURE__*/function () {
|
4040
|
-
var
|
4041
|
-
var
|
4042
|
-
return _regeneratorRuntime().wrap(function
|
4043
|
-
while (1) switch (
|
4227
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(f) {
|
4228
|
+
var W, A, E, S;
|
4229
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
4230
|
+
while (1) switch (_context13.prev = _context13.next) {
|
4044
4231
|
case 0:
|
4045
4232
|
if (e.extractResultData) {
|
4046
|
-
|
4233
|
+
_context13.next = 2;
|
4047
4234
|
break;
|
4048
4235
|
}
|
4049
|
-
return
|
4236
|
+
return _context13.abrupt("return");
|
4050
4237
|
case 2:
|
4051
|
-
|
4052
|
-
return (A = (
|
4238
|
+
_context13.next = 4;
|
4239
|
+
return (A = (W = e.deepChat).responseInterceptor) == null ? void 0 : A.call(W, f);
|
4053
4240
|
case 4:
|
4054
|
-
|
4055
|
-
if (
|
4056
|
-
|
4241
|
+
_context13.t0 = _context13.sent;
|
4242
|
+
if (_context13.t0) {
|
4243
|
+
_context13.next = 7;
|
4057
4244
|
break;
|
4058
4245
|
}
|
4059
|
-
|
4246
|
+
_context13.t0 = f;
|
4060
4247
|
case 7:
|
4061
|
-
E =
|
4062
|
-
|
4248
|
+
E = _context13.t0;
|
4249
|
+
_context13.next = 10;
|
4063
4250
|
return e.extractResultData(E, u, o);
|
4064
4251
|
case 10:
|
4065
|
-
S =
|
4252
|
+
S = _context13.sent;
|
4066
4253
|
if (d) {
|
4067
|
-
|
4254
|
+
_context13.next = 13;
|
4068
4255
|
break;
|
4069
4256
|
}
|
4070
4257
|
throw f;
|
4071
4258
|
case 13:
|
4072
4259
|
if (!(!S || _typeof(S) != "object")) {
|
4073
|
-
|
4260
|
+
_context13.next = 15;
|
4074
4261
|
break;
|
4075
4262
|
}
|
4076
4263
|
throw Error(C.INVALID_RESPONSE(f, "response", !!e.deepChat.responseInterceptor, E));
|
@@ -4078,23 +4265,23 @@ var w = /*#__PURE__*/function () {
|
|
4078
4265
|
S.makingAnotherRequest || (I.isSimulation(e.deepChat.stream) ? I.simulate(i, e.streamHandlers, S) : (i.addNewMessage(S), c()));
|
4079
4266
|
case 16:
|
4080
4267
|
case "end":
|
4081
|
-
return
|
4268
|
+
return _context13.stop();
|
4082
4269
|
}
|
4083
|
-
},
|
4270
|
+
}, _callee13);
|
4084
4271
|
}));
|
4085
|
-
return function (
|
4086
|
-
return
|
4272
|
+
return function (_x27) {
|
4273
|
+
return _ref5.apply(this, arguments);
|
4087
4274
|
};
|
4088
4275
|
}())["catch"](function (f) {
|
4089
4276
|
_.displayError(i, f), c();
|
4090
4277
|
});
|
4091
4278
|
case 18:
|
4092
4279
|
case "end":
|
4093
|
-
return
|
4280
|
+
return _context14.stop();
|
4094
4281
|
}
|
4095
|
-
},
|
4282
|
+
}, _callee14, this);
|
4096
4283
|
}));
|
4097
|
-
function request(
|
4284
|
+
function request(_x24, _x25, _x26) {
|
4098
4285
|
return _request3.apply(this, arguments);
|
4099
4286
|
}
|
4100
4287
|
return request;
|
@@ -4106,44 +4293,44 @@ var w = /*#__PURE__*/function () {
|
|
4106
4293
|
fetch(t, i).then(function (o) {
|
4107
4294
|
return o.json();
|
4108
4295
|
}).then( /*#__PURE__*/function () {
|
4109
|
-
var
|
4296
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(o) {
|
4110
4297
|
var l, c, a;
|
4111
|
-
return _regeneratorRuntime().wrap(function
|
4112
|
-
while (1) switch (
|
4298
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
4299
|
+
while (1) switch (_context15.prev = _context15.next) {
|
4113
4300
|
case 0:
|
4114
4301
|
if (e.extractPollResultData) {
|
4115
|
-
|
4302
|
+
_context15.next = 2;
|
4116
4303
|
break;
|
4117
4304
|
}
|
4118
|
-
return
|
4305
|
+
return _context15.abrupt("return");
|
4119
4306
|
case 2:
|
4120
|
-
|
4121
|
-
|
4307
|
+
_context15.t0 = e;
|
4308
|
+
_context15.next = 5;
|
4122
4309
|
return (c = (l = e.deepChat).responseInterceptor) == null ? void 0 : c.call(l, o);
|
4123
4310
|
case 5:
|
4124
|
-
|
4125
|
-
if (
|
4126
|
-
|
4311
|
+
_context15.t1 = _context15.sent;
|
4312
|
+
if (_context15.t1) {
|
4313
|
+
_context15.next = 8;
|
4127
4314
|
break;
|
4128
4315
|
}
|
4129
|
-
|
4316
|
+
_context15.t1 = o;
|
4130
4317
|
case 8:
|
4131
|
-
|
4132
|
-
|
4133
|
-
return
|
4318
|
+
_context15.t2 = _context15.t1;
|
4319
|
+
_context15.next = 11;
|
4320
|
+
return _context15.t0.extractPollResultData.call(_context15.t0, _context15.t2);
|
4134
4321
|
case 11:
|
4135
|
-
a =
|
4322
|
+
a = _context15.sent;
|
4136
4323
|
a.timeoutMS ? setTimeout(function () {
|
4137
4324
|
w.executePollRequest(e, t, i, n);
|
4138
4325
|
}, a.timeoutMS) : I.isSimulation(e.deepChat.stream) ? I.simulate(n, e.streamHandlers, a) : (n.addNewMessage(a), r());
|
4139
4326
|
case 13:
|
4140
4327
|
case "end":
|
4141
|
-
return
|
4328
|
+
return _context15.stop();
|
4142
4329
|
}
|
4143
|
-
},
|
4330
|
+
}, _callee15);
|
4144
4331
|
}));
|
4145
|
-
return function (
|
4146
|
-
return
|
4332
|
+
return function (_x28) {
|
4333
|
+
return _ref6.apply(this, arguments);
|
4147
4334
|
};
|
4148
4335
|
}())["catch"](function (o) {
|
4149
4336
|
_.displayError(n, o), r();
|
@@ -4153,13 +4340,13 @@ var w = /*#__PURE__*/function () {
|
|
4153
4340
|
}, {
|
4154
4341
|
key: "poll",
|
4155
4342
|
value: function () {
|
4156
|
-
var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4343
|
+
var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(e, t, i) {
|
4157
4344
|
var n,
|
4158
4345
|
p,
|
4159
4346
|
g,
|
4160
4347
|
f,
|
4161
4348
|
r,
|
4162
|
-
_yield$_$
|
4349
|
+
_yield$_$processReque4,
|
4163
4350
|
o,
|
4164
4351
|
a,
|
4165
4352
|
l,
|
@@ -4167,27 +4354,27 @@ var w = /*#__PURE__*/function () {
|
|
4167
4354
|
d,
|
4168
4355
|
u,
|
4169
4356
|
h,
|
4170
|
-
|
4171
|
-
return _regeneratorRuntime().wrap(function
|
4172
|
-
while (1) switch (
|
4357
|
+
_args16 = arguments;
|
4358
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
4359
|
+
while (1) switch (_context16.prev = _context16.next) {
|
4173
4360
|
case 0:
|
4174
|
-
n =
|
4361
|
+
n = _args16.length > 3 && _args16[3] !== undefined ? _args16[3] : !0;
|
4175
4362
|
r = {
|
4176
4363
|
body: t,
|
4177
4364
|
headers: (p = e.requestSettings) == null ? void 0 : p.headers
|
4178
4365
|
};
|
4179
|
-
|
4366
|
+
_context16.next = 4;
|
4180
4367
|
return _.processRequestInterceptor(e.deepChat, r);
|
4181
4368
|
case 4:
|
4182
|
-
_yield$_$
|
4183
|
-
o = _yield$_$
|
4184
|
-
a = _yield$_$
|
4185
|
-
l = _yield$_$
|
4369
|
+
_yield$_$processReque4 = _context16.sent;
|
4370
|
+
o = _yield$_$processReque4.body;
|
4371
|
+
a = _yield$_$processReque4.headers;
|
4372
|
+
l = _yield$_$processReque4.error;
|
4186
4373
|
if (!l) {
|
4187
|
-
|
4374
|
+
_context16.next = 10;
|
4188
4375
|
break;
|
4189
4376
|
}
|
4190
|
-
return
|
4377
|
+
return _context16.abrupt("return", _.onInterceptorError(i, l));
|
4191
4378
|
case 10:
|
4192
4379
|
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, h = {
|
4193
4380
|
method: d,
|
@@ -4197,11 +4384,11 @@ var w = /*#__PURE__*/function () {
|
|
4197
4384
|
e.requestSettings.credentials && (h.credentials = e.requestSettings.credentials), w.executePollRequest(e, c, h, i);
|
4198
4385
|
case 12:
|
4199
4386
|
case "end":
|
4200
|
-
return
|
4387
|
+
return _context16.stop();
|
4201
4388
|
}
|
4202
|
-
},
|
4389
|
+
}, _callee16);
|
4203
4390
|
}));
|
4204
|
-
function poll(
|
4391
|
+
function poll(_x29, _x30, _x31) {
|
4205
4392
|
return _poll.apply(this, arguments);
|
4206
4393
|
}
|
4207
4394
|
return poll;
|
@@ -4262,180 +4449,6 @@ var et = /*#__PURE__*/function () {
|
|
4262
4449
|
}]);
|
4263
4450
|
return et;
|
4264
4451
|
}();
|
4265
|
-
var Y = /*#__PURE__*/function () {
|
4266
|
-
function Y() {
|
4267
|
-
_classCallCheck(this, Y);
|
4268
|
-
}
|
4269
|
-
_createClass(Y, null, [{
|
4270
|
-
key: "setup",
|
4271
|
-
value: function setup(e) {
|
4272
|
-
e.requestSettings.url !== ye.URL && (e.permittedErrorPrefixes = ["Connection error", "Error in server message"], e.websocket = "pending");
|
4273
|
-
}
|
4274
|
-
}, {
|
4275
|
-
key: "createConnection",
|
4276
|
-
value: function createConnection(e, t) {
|
4277
|
-
if (!document.body.contains(e.deepChat)) return;
|
4278
|
-
var i = e.requestSettings.websocket;
|
4279
|
-
if (i) {
|
4280
|
-
if (e.requestSettings.handler) return Le.websocket(e, t);
|
4281
|
-
try {
|
4282
|
-
var n = typeof i != "boolean" ? i : void 0,
|
4283
|
-
r = new WebSocket(e.requestSettings.url || "", n);
|
4284
|
-
e.websocket = r, e.websocket.onopen = function () {
|
4285
|
-
var o, a;
|
4286
|
-
t.removeError(), e.websocket && _typeof(e.websocket) == "object" && Y.assignListeners(e, r, t), (a = (o = e.deepChat)._validationHandler) == null || a.call(o);
|
4287
|
-
}, e.websocket.onerror = function (o) {
|
4288
|
-
console.error(o), Y.retryConnection(e, t);
|
4289
|
-
};
|
4290
|
-
} catch (n) {
|
4291
|
-
console.error(n), Y.retryConnection(e, t);
|
4292
|
-
}
|
4293
|
-
}
|
4294
|
-
}
|
4295
|
-
}, {
|
4296
|
-
key: "retryConnection",
|
4297
|
-
value: function retryConnection(e, t) {
|
4298
|
-
var i, n;
|
4299
|
-
(n = (i = e.deepChat)._validationHandler) == null || n.call(i), document.body.contains(e.deepChat) && (e.websocket = "pending", t.isLastMessageError() || t.addNewErrorMessage("service", "Connection error"), setTimeout(function () {
|
4300
|
-
Y.createConnection(e, t);
|
4301
|
-
}, 5e3));
|
4302
|
-
}
|
4303
|
-
}, {
|
4304
|
-
key: "assignListeners",
|
4305
|
-
value: function assignListeners(e, t, i) {
|
4306
|
-
t.onmessage = /*#__PURE__*/function () {
|
4307
|
-
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(n) {
|
4308
|
-
var r, o, a, l, c;
|
4309
|
-
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
4310
|
-
while (1) switch (_context15.prev = _context15.next) {
|
4311
|
-
case 0:
|
4312
|
-
if (!e.extractResultData) {
|
4313
|
-
_context15.next = 20;
|
4314
|
-
break;
|
4315
|
-
}
|
4316
|
-
_context15.prev = 1;
|
4317
|
-
a = JSON.parse(n.data);
|
4318
|
-
_context15.next = 5;
|
4319
|
-
return (o = (r = e.deepChat).responseInterceptor) == null ? void 0 : o.call(r, a);
|
4320
|
-
case 5:
|
4321
|
-
_context15.t0 = _context15.sent;
|
4322
|
-
if (_context15.t0) {
|
4323
|
-
_context15.next = 8;
|
4324
|
-
break;
|
4325
|
-
}
|
4326
|
-
_context15.t0 = a;
|
4327
|
-
case 8:
|
4328
|
-
l = _context15.t0;
|
4329
|
-
_context15.next = 11;
|
4330
|
-
return e.extractResultData(l);
|
4331
|
-
case 11:
|
4332
|
-
c = _context15.sent;
|
4333
|
-
if (!(!c || _typeof(c) != "object")) {
|
4334
|
-
_context15.next = 14;
|
4335
|
-
break;
|
4336
|
-
}
|
4337
|
-
throw Error(C.INVALID_RESPONSE(a, "server", !!e.deepChat.responseInterceptor, l));
|
4338
|
-
case 14:
|
4339
|
-
I.isSimulation(e.deepChat.stream) ? I.simulate(i, e.streamHandlers, c) : i.addNewMessage(c);
|
4340
|
-
_context15.next = 20;
|
4341
|
-
break;
|
4342
|
-
case 17:
|
4343
|
-
_context15.prev = 17;
|
4344
|
-
_context15.t1 = _context15["catch"](1);
|
4345
|
-
_.displayError(i, _context15.t1, "Error in server message");
|
4346
|
-
case 20:
|
4347
|
-
case "end":
|
4348
|
-
return _context15.stop();
|
4349
|
-
}
|
4350
|
-
}, _callee15, null, [[1, 17]]);
|
4351
|
-
}));
|
4352
|
-
return function (_x28) {
|
4353
|
-
return _ref6.apply(this, arguments);
|
4354
|
-
};
|
4355
|
-
}(), t.onclose = function () {
|
4356
|
-
console.error("Connection closed"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error"), e.deepChat.stream && e.streamHandlers.abortStream.abort(), Y.createConnection(e, i);
|
4357
|
-
};
|
4358
|
-
}
|
4359
|
-
}, {
|
4360
|
-
key: "sendWebsocket",
|
4361
|
-
value: function () {
|
4362
|
-
var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(e, t, i) {
|
4363
|
-
var n,
|
4364
|
-
d,
|
4365
|
-
u,
|
4366
|
-
r,
|
4367
|
-
o,
|
4368
|
-
_yield$_$processReque4,
|
4369
|
-
a,
|
4370
|
-
l,
|
4371
|
-
c,
|
4372
|
-
_args16 = arguments;
|
4373
|
-
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
4374
|
-
while (1) switch (_context16.prev = _context16.next) {
|
4375
|
-
case 0:
|
4376
|
-
n = _args16.length > 3 && _args16[3] !== undefined ? _args16[3] : !0;
|
4377
|
-
r = e.websocket;
|
4378
|
-
if (!(!r || r === "pending")) {
|
4379
|
-
_context16.next = 4;
|
4380
|
-
break;
|
4381
|
-
}
|
4382
|
-
return _context16.abrupt("return");
|
4383
|
-
case 4:
|
4384
|
-
o = {
|
4385
|
-
body: t,
|
4386
|
-
headers: (d = e.requestSettings) == null ? void 0 : d.headers
|
4387
|
-
};
|
4388
|
-
_context16.next = 7;
|
4389
|
-
return _.processRequestInterceptor(e.deepChat, o);
|
4390
|
-
case 7:
|
4391
|
-
_yield$_$processReque4 = _context16.sent;
|
4392
|
-
a = _yield$_$processReque4.body;
|
4393
|
-
l = _yield$_$processReque4.error;
|
4394
|
-
if (!l) {
|
4395
|
-
_context16.next = 12;
|
4396
|
-
break;
|
4397
|
-
}
|
4398
|
-
return _context16.abrupt("return", i.addNewErrorMessage("service", l));
|
4399
|
-
case 12:
|
4400
|
-
if (Y.isWebSocket(r)) {
|
4401
|
-
_context16.next = 14;
|
4402
|
-
break;
|
4403
|
-
}
|
4404
|
-
return _context16.abrupt("return", r.newUserMessage.listener(a));
|
4405
|
-
case 14:
|
4406
|
-
c = n ? JSON.stringify(a) : a;
|
4407
|
-
if (!(((u = e.requestSettings) == null ? void 0 : u.url) === ye.URL)) {
|
4408
|
-
_context16.next = 17;
|
4409
|
-
break;
|
4410
|
-
}
|
4411
|
-
return _context16.abrupt("return", ye.request(e, i));
|
4412
|
-
case 17:
|
4413
|
-
r.readyState === void 0 || r.readyState !== r.OPEN ? (console.error("Connection is not open"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error")) : (r.send(JSON.stringify(c)), e.completionsHandlers.onFinish());
|
4414
|
-
case 18:
|
4415
|
-
case "end":
|
4416
|
-
return _context16.stop();
|
4417
|
-
}
|
4418
|
-
}, _callee16);
|
4419
|
-
}));
|
4420
|
-
function sendWebsocket(_x29, _x30, _x31) {
|
4421
|
-
return _sendWebsocket.apply(this, arguments);
|
4422
|
-
}
|
4423
|
-
return sendWebsocket;
|
4424
|
-
}()
|
4425
|
-
}, {
|
4426
|
-
key: "canSendMessage",
|
4427
|
-
value: function canSendMessage(e) {
|
4428
|
-
return e ? e === "pending" ? !1 : Y.isWebSocket(e) ? e.readyState !== void 0 && e.readyState === e.OPEN : e.isOpen : !0;
|
4429
|
-
}
|
4430
|
-
// if false then it is the internal websocket handler
|
4431
|
-
}, {
|
4432
|
-
key: "isWebSocket",
|
4433
|
-
value: function isWebSocket(e) {
|
4434
|
-
return e.send !== void 0;
|
4435
|
-
}
|
4436
|
-
}]);
|
4437
|
-
return Y;
|
4438
|
-
}();
|
4439
4452
|
var L = /*#__PURE__*/function () {
|
4440
4453
|
function L() {
|
4441
4454
|
_classCallCheck(this, L);
|
@@ -4544,14 +4557,14 @@ var L = /*#__PURE__*/function () {
|
|
4544
4557
|
}]);
|
4545
4558
|
return L;
|
4546
4559
|
}();
|
4547
|
-
var
|
4548
|
-
function
|
4560
|
+
var Pe = /*#__PURE__*/function () {
|
4561
|
+
function Pe(e, t, i) {
|
4549
4562
|
var _a$url;
|
4550
|
-
_classCallCheck(this,
|
4563
|
+
_classCallCheck(this, Pe);
|
4551
4564
|
var n, r, o, a;
|
4552
|
-
this.rawBody = {}, this.validateConfigKey = !1, this.canSendMessage =
|
4565
|
+
this.rawBody = {}, this.validateConfigKey = !1, this.canSendMessage = Pe.canSendMessage, this.requestSettings = {}, this.fileTypes = {}, this.completionsHandlers = {}, this.streamHandlers = {}, this.deepChat = e, this.demo = i, Object.assign(this.rawBody, (n = e.request) == null ? void 0 : n.additionalBodyProps), this.totalMessagesMaxCharLength = (r = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : r.totalMessagesMaxCharLength, this.maxMessages = (o = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : o.maxMessages, L.set(e, this, t), e.request && (this.requestSettings = e.request), this.demo && ((_a$url = (a = this.requestSettings).url) !== null && _a$url !== void 0 ? _a$url : a.url = ye.URL), this.requestSettings.websocket && F.setup(this);
|
4553
4566
|
}
|
4554
|
-
_createClass(
|
4567
|
+
_createClass(Pe, [{
|
4555
4568
|
key: "verifyKey",
|
4556
4569
|
value: function verifyKey(e, t) {}
|
4557
4570
|
}, {
|
@@ -4626,7 +4639,7 @@ var Oe = /*#__PURE__*/function () {
|
|
4626
4639
|
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
4627
4640
|
while (1) switch (_context19.prev = _context19.next) {
|
4628
4641
|
case 0:
|
4629
|
-
n =
|
4642
|
+
n = Pe.createCustomFormDataBody(this.rawBody, t, i), r = this.requestSettings, o = this.getServiceIOByType(i[0]);
|
4630
4643
|
this.requestSettings = (o == null ? void 0 : o.request) || this.requestSettings;
|
4631
4644
|
_context19.next = 4;
|
4632
4645
|
return this.request(n, e, !1);
|
@@ -4681,7 +4694,7 @@ var Oe = /*#__PURE__*/function () {
|
|
4681
4694
|
n = _objectSpread({
|
4682
4695
|
messages: i
|
4683
4696
|
}, this.rawBody);
|
4684
|
-
|
4697
|
+
F.sendWebsocket(this, n, t, !1);
|
4685
4698
|
} else this.callServiceAPI(t, i, e.files);
|
4686
4699
|
case 4:
|
4687
4700
|
case "end":
|
@@ -4761,19 +4774,19 @@ var Oe = /*#__PURE__*/function () {
|
|
4761
4774
|
return o.text && (delete o.files, n.append("message".concat(r += 1), JSON.stringify(o))), n;
|
4762
4775
|
}
|
4763
4776
|
}]);
|
4764
|
-
return
|
4777
|
+
return Pe;
|
4765
4778
|
}();
|
4766
|
-
var
|
4767
|
-
_inherits(
|
4779
|
+
var q = /*#__PURE__*/function (_Pe) {
|
4780
|
+
_inherits(q, _Pe);
|
4768
4781
|
// prettier-ignore
|
4769
|
-
function
|
4782
|
+
function q(e, t, i, n, r) {
|
4770
4783
|
var _this6;
|
4771
|
-
_classCallCheck(this,
|
4784
|
+
_classCallCheck(this, q);
|
4772
4785
|
var o;
|
4773
|
-
_this6 = _callSuper(this,
|
4786
|
+
_this6 = _callSuper(this, q, [e, r]), _this6.insertKeyPlaceholderText = "API Key", _this6.keyHelpUrl = "", Object.assign(_this6.rawBody, (o = e.request) == null ? void 0 : o.additionalBodyProps), _this6.keyVerificationDetails = t, _this6.buildHeadersFunc = i, n && _this6.setApiKeyProperties(n), _this6.requestSettings = _this6.buildRequestSettings(_this6.key || "", e.request);
|
4774
4787
|
return _this6;
|
4775
4788
|
}
|
4776
|
-
_createClass(
|
4789
|
+
_createClass(q, [{
|
4777
4790
|
key: "setApiKeyProperties",
|
4778
4791
|
value: function setApiKeyProperties(e) {
|
4779
4792
|
this.key = e.key, e.validateKeyProperty && (this.validateConfigKey = e.validateKeyProperty);
|
@@ -4809,8 +4822,8 @@ var U = /*#__PURE__*/function (_Oe) {
|
|
4809
4822
|
return !0;
|
4810
4823
|
}
|
4811
4824
|
}]);
|
4812
|
-
return
|
4813
|
-
}(
|
4825
|
+
return q;
|
4826
|
+
}(Pe);
|
4814
4827
|
var zt = /*#__PURE__*/function () {
|
4815
4828
|
function zt() {
|
4816
4829
|
_classCallCheck(this, zt);
|
@@ -4831,18 +4844,18 @@ var zt = /*#__PURE__*/function () {
|
|
4831
4844
|
return zt;
|
4832
4845
|
}();
|
4833
4846
|
var Yi = /*#__PURE__*/function (_HTMLElement) {
|
4834
|
-
_inherits(
|
4847
|
+
_inherits(Je, _HTMLElement);
|
4835
4848
|
// If this is not working, try using propertyName directly
|
4836
|
-
function
|
4849
|
+
function Je() {
|
4837
4850
|
var _this7;
|
4838
|
-
_classCallCheck(this,
|
4839
|
-
_this7 = _callSuper(this,
|
4840
|
-
var t =
|
4851
|
+
_classCallCheck(this, Je);
|
4852
|
+
_this7 = _callSuper(this, Je), _this7._waitingToRender_ = !1, _this7._propUpdated_ = !1, Object.keys(Je._attributeToProperty_).forEach(function (e) {
|
4853
|
+
var t = Je._attributeToProperty_[e];
|
4841
4854
|
_this7.constructPropertyAccessors(t), _this7.hasOwnProperty(e) || _this7.constructPropertyAccessors(t, e);
|
4842
4855
|
});
|
4843
4856
|
return _this7;
|
4844
4857
|
}
|
4845
|
-
_createClass(
|
4858
|
+
_createClass(Je, [{
|
4846
4859
|
key: "constructPropertyAccessors",
|
4847
4860
|
value:
|
4848
4861
|
// need to be called here as accessors need to be set for the class instance
|
@@ -4861,8 +4874,8 @@ var Yi = /*#__PURE__*/function (_HTMLElement) {
|
|
4861
4874
|
key: "attributeChangedCallback",
|
4862
4875
|
value: function attributeChangedCallback(e, t, i) {
|
4863
4876
|
if (t === i) return;
|
4864
|
-
var n =
|
4865
|
-
r =
|
4877
|
+
var n = Je._attributes_[e](i),
|
4878
|
+
r = Je._attributeToProperty_[e];
|
4866
4879
|
this[r] = n;
|
4867
4880
|
}
|
4868
4881
|
}, {
|
@@ -4871,43 +4884,43 @@ var Yi = /*#__PURE__*/function (_HTMLElement) {
|
|
4871
4884
|
}], [{
|
4872
4885
|
key: "observedAttributes",
|
4873
4886
|
get: function get() {
|
4874
|
-
return Object.keys(
|
4887
|
+
return Object.keys(Je._attributes_) || [];
|
4875
4888
|
}
|
4876
4889
|
}]);
|
4877
|
-
return
|
4890
|
+
return Je;
|
4878
4891
|
}( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
|
4879
4892
|
Yi._attributes_ = {};
|
4880
4893
|
Yi._attributeToProperty_ = {};
|
4881
4894
|
var So = Yi;
|
4882
4895
|
var wo = "<?xml version=\"1.0\" standalone=\"no\"?>\n<svg version=\"1.1\"\n\txmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n\txmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"0.9em\" height=\"0.9em\"\n\tviewBox=\"0 0 1200 1200\" enable-background=\"new 0 0 1200 1200\">\n\t\t<path d=\"\n\t\t\tM669.727,273.516c-22.891-2.476-46.15-3.895-69.727-4.248c-103.025,0.457-209.823,25.517-310.913,73.536\n\t\t\tc-75.058,37.122-148.173,89.529-211.67,154.174C46.232,529.978,6.431,577.76,0,628.74c0.76,44.162,48.153,98.67,77.417,131.764\n\t\t\tc59.543,62.106,130.754,113.013,211.67,154.174c2.75,1.335,5.51,2.654,8.276,3.955l-75.072,131.102l102.005,60.286l551.416-960.033\n\t\t\tl-98.186-60.008L669.727,273.516z M902.563,338.995l-74.927,129.857c34.47,44.782,54.932,100.006,54.932,159.888\n\t\t\tc0,149.257-126.522,270.264-282.642,270.264c-6.749,0-13.29-0.728-19.922-1.172l-49.585,85.84c22.868,2.449,45.99,4.233,69.58,4.541\n\t\t\tc103.123-0.463,209.861-25.812,310.84-73.535c75.058-37.122,148.246-89.529,211.743-154.174\n\t\t\tc31.186-32.999,70.985-80.782,77.417-131.764c-0.76-44.161-48.153-98.669-77.417-131.763\n\t\t\tc-59.543-62.106-130.827-113.013-211.743-154.175C908.108,341.478,905.312,340.287,902.563,338.995L902.563,338.995z\n\t\t\tM599.927,358.478c6.846,0,13.638,0.274,20.361,0.732l-58.081,100.561c-81.514,16.526-142.676,85.88-142.676,168.897\n\t\t\tc0,20.854,3.841,40.819,10.913,59.325c0.008,0.021-0.008,0.053,0,0.074l-58.228,100.854\n\t\t\tc-34.551-44.823-54.932-100.229-54.932-160.182C317.285,479.484,443.808,358.477,599.927,358.478L599.927,358.478z M768.896,570.513\n\t\t\tL638.013,797.271c81.076-16.837,141.797-85.875,141.797-168.603C779.81,608.194,775.724,588.729,768.896,570.513L768.896,570.513z\"\n\t\t\t/>\n</svg>\n",
|
4883
4896
|
Mo = "<?xml version=\"1.0\" standalone=\"no\"?>\n<svg version=\"1.1\"\n\txmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n\txmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"0.9em\" height=\"0.9em\"\n\tviewBox=\"0 0 1200 1200\" enable-background=\"new 0 0 1200 1200\">\n\t\t<path id=\"path6686\" inkscape:connector-curvature=\"0\" d=\"M779.843,599.925c0,95.331-80.664,172.612-180.169,172.612\n\t\t\tc-99.504,0-180.168-77.281-180.168-172.612c0-95.332,80.664-172.612,180.168-172.612\n\t\t\tC699.179,427.312,779.843,504.594,779.843,599.925z M600,240.521c-103.025,0.457-209.814,25.538-310.904,73.557\n\t\t\tc-75.058,37.122-148.206,89.496-211.702,154.141C46.208,501.218,6.431,549,0,599.981c0.76,44.161,48.13,98.669,77.394,131.763\n\t\t\tc59.543,62.106,130.786,113.018,211.702,154.179c94.271,45.751,198.616,72.092,310.904,73.557\n\t\t\tc103.123-0.464,209.888-25.834,310.866-73.557c75.058-37.122,148.243-89.534,211.74-154.179\n\t\t\tc31.185-32.999,70.962-80.782,77.394-131.763c-0.76-44.161-48.13-98.671-77.394-131.764\n\t\t\tc-59.543-62.106-130.824-112.979-211.74-154.141C816.644,268.36,712.042,242.2,600,240.521z M599.924,329.769\n\t\t\tc156.119,0,282.675,120.994,282.675,270.251c0,149.256-126.556,270.25-282.675,270.25S317.249,749.275,317.249,600.02\n\t\t\tC317.249,450.763,443.805,329.769,599.924,329.769L599.924,329.769z\"/>\n</svg>\n";
|
4884
|
-
var
|
4885
|
-
function
|
4886
|
-
_classCallCheck(this,
|
4897
|
+
var G = /*#__PURE__*/function () {
|
4898
|
+
function G() {
|
4899
|
+
_classCallCheck(this, G);
|
4887
4900
|
}
|
4888
|
-
_createClass(
|
4901
|
+
_createClass(G, null, [{
|
4889
4902
|
key: "createSVGElement",
|
4890
4903
|
value: function createSVGElement(e) {
|
4891
4904
|
return new DOMParser().parseFromString(e, "image/svg+xml").documentElement;
|
4892
4905
|
}
|
4893
4906
|
}]);
|
4894
|
-
return
|
4907
|
+
return G;
|
4895
4908
|
}();
|
4896
4909
|
var ds = /*#__PURE__*/function () {
|
4897
|
-
function
|
4898
|
-
_classCallCheck(this,
|
4910
|
+
function $e() {
|
4911
|
+
_classCallCheck(this, $e);
|
4899
4912
|
}
|
4900
|
-
_createClass(
|
4913
|
+
_createClass($e, null, [{
|
4901
4914
|
key: "changeVisibility",
|
4902
4915
|
value:
|
4903
4916
|
// prettier-ignore
|
4904
4917
|
function changeVisibility(e, t, i, n) {
|
4905
|
-
n.target.id ===
|
4918
|
+
n.target.id === $e.VISIBLE_ICON_ID ? (t.style.display = "none", i.style.display = "block", e.type = "password") : (t.style.display = "block", i.style.display = "none", e.type = "text");
|
4906
4919
|
}
|
4907
4920
|
}, {
|
4908
4921
|
key: "createIconElement",
|
4909
4922
|
value: function createIconElement(e, t) {
|
4910
|
-
var i =
|
4923
|
+
var i = G.createSVGElement(e);
|
4911
4924
|
return i.id = t, i.classList.add("visibility-icon"), i;
|
4912
4925
|
}
|
4913
4926
|
// prettier-ignore
|
@@ -4916,13 +4929,13 @@ var ds = /*#__PURE__*/function () {
|
|
4916
4929
|
value: function create(e) {
|
4917
4930
|
var t = document.createElement("div");
|
4918
4931
|
t.id = "visibility-icon-container";
|
4919
|
-
var i =
|
4932
|
+
var i = $e.createIconElement(Mo, $e.VISIBLE_ICON_ID);
|
4920
4933
|
i.style.display = "none", t.appendChild(i);
|
4921
|
-
var n =
|
4922
|
-
return t.appendChild(n), t.onclick =
|
4934
|
+
var n = $e.createIconElement(wo, "not-visible-icon");
|
4935
|
+
return t.appendChild(n), t.onclick = $e.changeVisibility.bind(this, e, i, n), t;
|
4923
4936
|
}
|
4924
4937
|
}]);
|
4925
|
-
return
|
4938
|
+
return $e;
|
4926
4939
|
}();
|
4927
4940
|
ds.VISIBLE_ICON_ID = "visible-icon";
|
4928
4941
|
var To = ds;
|
@@ -5250,8 +5263,8 @@ var wn = {
|
|
5250
5263
|
}],
|
5251
5264
|
use_web_worker: !0
|
5252
5265
|
},
|
5253
|
-
it = /*#__PURE__*/function (
|
5254
|
-
_inherits(M,
|
5266
|
+
it = /*#__PURE__*/function (_Pe2) {
|
5267
|
+
_inherits(M, _Pe2);
|
5255
5268
|
function M(e) {
|
5256
5269
|
var _this8;
|
5257
5270
|
_classCallCheck(this, M);
|
@@ -5539,7 +5552,7 @@ var wn = {
|
|
5539
5552
|
this.streamHandlers.abortStream.abort = function () {
|
5540
5553
|
i.interruptGenerate();
|
5541
5554
|
}, this.streamHandlers.onOpen();
|
5542
|
-
n = new
|
5555
|
+
n = new Oe(e);
|
5543
5556
|
_context29.next = 4;
|
5544
5557
|
return i.generate(t, /*#__PURE__*/function () {
|
5545
5558
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(r, o) {
|
@@ -5783,7 +5796,7 @@ var wn = {
|
|
5783
5796
|
}
|
5784
5797
|
}]);
|
5785
5798
|
return M;
|
5786
|
-
}(
|
5799
|
+
}(Pe);
|
5787
5800
|
it.GENERIC_ERROR = "Error, please check the [troubleshooting](https://deepchat.dev/docs/webModel#troubleshooting) section of documentation for help.";
|
5788
5801
|
it.MULTIPLE_MODELS_ERROR = "Cannot run multiple web models";
|
5789
5802
|
it.WEB_LLM_NOT_FOUND_ERROR = "WebLLM module not found";
|
@@ -5822,8 +5835,8 @@ var Ut = /*#__PURE__*/function () {
|
|
5822
5835
|
}]);
|
5823
5836
|
return Ut;
|
5824
5837
|
}();
|
5825
|
-
var us = /*#__PURE__*/function (
|
5826
|
-
_inherits(Fi,
|
5838
|
+
var us = /*#__PURE__*/function (_q) {
|
5839
|
+
_inherits(Fi, _q);
|
5827
5840
|
// prettier-ignore
|
5828
5841
|
function Fi(e, t, i, n, r, o) {
|
5829
5842
|
var _this14;
|
@@ -5871,11 +5884,11 @@ var us = /*#__PURE__*/function (_U) {
|
|
5871
5884
|
}()
|
5872
5885
|
}]);
|
5873
5886
|
return Fi;
|
5874
|
-
}(
|
5887
|
+
}(q);
|
5875
5888
|
us.URL_PREFIX = "https://api-inference.huggingface.co/models/";
|
5876
|
-
var
|
5877
|
-
var St = /*#__PURE__*/function (
|
5878
|
-
_inherits(St,
|
5889
|
+
var Fe = us;
|
5890
|
+
var St = /*#__PURE__*/function (_Fe) {
|
5891
|
+
_inherits(St, _Fe);
|
5879
5892
|
// prettier-ignore
|
5880
5893
|
function St(e, t, i, n, r, o) {
|
5881
5894
|
var _this15;
|
@@ -5927,7 +5940,7 @@ var St = /*#__PURE__*/function (_Be) {
|
|
5927
5940
|
}
|
5928
5941
|
}]);
|
5929
5942
|
return St;
|
5930
|
-
}(
|
5943
|
+
}(Fe);
|
5931
5944
|
var Co = /*#__PURE__*/function (_St) {
|
5932
5945
|
_inherits(Co, _St);
|
5933
5946
|
// prettier-ignore
|
@@ -6060,8 +6073,8 @@ var ae = /*#__PURE__*/function () {
|
|
6060
6073
|
}]);
|
6061
6074
|
return ae;
|
6062
6075
|
}();
|
6063
|
-
var ri = /*#__PURE__*/function (
|
6064
|
-
_inherits(ri,
|
6076
|
+
var ri = /*#__PURE__*/function (_q2) {
|
6077
|
+
_inherits(ri, _q2);
|
6065
6078
|
// prettier-ignore
|
6066
6079
|
function ri(e, t, i, n, r) {
|
6067
6080
|
var _this16;
|
@@ -6070,7 +6083,7 @@ var ri = /*#__PURE__*/function (_U2) {
|
|
6070
6083
|
return _this16;
|
6071
6084
|
}
|
6072
6085
|
return _createClass(ri);
|
6073
|
-
}(
|
6086
|
+
}(q);
|
6074
6087
|
var qt = /*#__PURE__*/function (_ri) {
|
6075
6088
|
_inherits(qt, _ri);
|
6076
6089
|
function qt(e) {
|
@@ -6336,8 +6349,8 @@ var ko = /*#__PURE__*/function (_St3) {
|
|
6336
6349
|
}]);
|
6337
6350
|
return ko;
|
6338
6351
|
}(St);
|
6339
|
-
var Io = /*#__PURE__*/function (
|
6340
|
-
_inherits(Io,
|
6352
|
+
var Io = /*#__PURE__*/function (_Fe2) {
|
6353
|
+
_inherits(Io, _Fe2);
|
6341
6354
|
function Io(e) {
|
6342
6355
|
_classCallCheck(this, Io);
|
6343
6356
|
var n, r, o;
|
@@ -6374,9 +6387,9 @@ var Io = /*#__PURE__*/function (_Be2) {
|
|
6374
6387
|
}()
|
6375
6388
|
}]);
|
6376
6389
|
return Io;
|
6377
|
-
}(
|
6378
|
-
var Lo = /*#__PURE__*/function (
|
6379
|
-
_inherits(Lo,
|
6390
|
+
}(Fe);
|
6391
|
+
var Lo = /*#__PURE__*/function (_Fe3) {
|
6392
|
+
_inherits(Lo, _Fe3);
|
6380
6393
|
function Lo(e) {
|
6381
6394
|
var _this19;
|
6382
6395
|
_classCallCheck(this, Lo);
|
@@ -6429,9 +6442,9 @@ var Lo = /*#__PURE__*/function (_Be3) {
|
|
6429
6442
|
}()
|
6430
6443
|
}]);
|
6431
6444
|
return Lo;
|
6432
|
-
}(
|
6433
|
-
var Ro = /*#__PURE__*/function (
|
6434
|
-
_inherits(Ro,
|
6445
|
+
}(Fe);
|
6446
|
+
var Ro = /*#__PURE__*/function (_Fe4) {
|
6447
|
+
_inherits(Ro, _Fe4);
|
6435
6448
|
function Ro(e) {
|
6436
6449
|
_classCallCheck(this, Ro);
|
6437
6450
|
var n, r, o;
|
@@ -6468,9 +6481,9 @@ var Ro = /*#__PURE__*/function (_Be4) {
|
|
6468
6481
|
}()
|
6469
6482
|
}]);
|
6470
6483
|
return Ro;
|
6471
|
-
}(
|
6472
|
-
var No = /*#__PURE__*/function (
|
6473
|
-
_inherits(No,
|
6484
|
+
}(Fe);
|
6485
|
+
var No = /*#__PURE__*/function (_Fe5) {
|
6486
|
+
_inherits(No, _Fe5);
|
6474
6487
|
function No(e) {
|
6475
6488
|
var _this20$maxMessages;
|
6476
6489
|
var _this20;
|
@@ -6551,7 +6564,7 @@ var No = /*#__PURE__*/function (_Be5) {
|
|
6551
6564
|
}()
|
6552
6565
|
}]);
|
6553
6566
|
return No;
|
6554
|
-
}(
|
6567
|
+
}(Fe);
|
6555
6568
|
var Gt = /*#__PURE__*/function (_ri3) {
|
6556
6569
|
_inherits(Gt, _ri3);
|
6557
6570
|
function Gt(e) {
|
@@ -6660,8 +6673,8 @@ var Gt = /*#__PURE__*/function (_ri3) {
|
|
6660
6673
|
}]);
|
6661
6674
|
return Gt;
|
6662
6675
|
}(ri);
|
6663
|
-
var Oo = /*#__PURE__*/function (
|
6664
|
-
_inherits(Oo,
|
6676
|
+
var Oo = /*#__PURE__*/function (_Fe6) {
|
6677
|
+
_inherits(Oo, _Fe6);
|
6665
6678
|
function Oo(e) {
|
6666
6679
|
_classCallCheck(this, Oo);
|
6667
6680
|
var n, r, o;
|
@@ -6698,7 +6711,7 @@ var Oo = /*#__PURE__*/function (_Be6) {
|
|
6698
6711
|
}()
|
6699
6712
|
}]);
|
6700
6713
|
return Oo;
|
6701
|
-
}(
|
6714
|
+
}(Fe);
|
6702
6715
|
var Vt = /*#__PURE__*/function (_ri4) {
|
6703
6716
|
_inherits(Vt, _ri4);
|
6704
6717
|
function Vt(e) {
|
@@ -6793,8 +6806,8 @@ var Vt = /*#__PURE__*/function (_ri4) {
|
|
6793
6806
|
}]);
|
6794
6807
|
return Vt;
|
6795
6808
|
}(ri);
|
6796
|
-
var Po = /*#__PURE__*/function (
|
6797
|
-
_inherits(Po,
|
6809
|
+
var Po = /*#__PURE__*/function (_Fe7) {
|
6810
|
+
_inherits(Po, _Fe7);
|
6798
6811
|
function Po(e) {
|
6799
6812
|
var _this23;
|
6800
6813
|
_classCallCheck(this, Po);
|
@@ -6833,7 +6846,7 @@ var Po = /*#__PURE__*/function (_Be7) {
|
|
6833
6846
|
}()
|
6834
6847
|
}]);
|
6835
6848
|
return Po;
|
6836
|
-
}(
|
6849
|
+
}(Fe);
|
6837
6850
|
var Wt = /*#__PURE__*/function () {
|
6838
6851
|
function Wt() {
|
6839
6852
|
_classCallCheck(this, Wt);
|
@@ -6869,8 +6882,8 @@ var Wt = /*#__PURE__*/function () {
|
|
6869
6882
|
}]);
|
6870
6883
|
return Wt;
|
6871
6884
|
}();
|
6872
|
-
var Xi = /*#__PURE__*/function (
|
6873
|
-
_inherits(Xi,
|
6885
|
+
var Xi = /*#__PURE__*/function (_q3) {
|
6886
|
+
_inherits(Xi, _q3);
|
6874
6887
|
function Xi(e, t, i, n, r) {
|
6875
6888
|
var _this24;
|
6876
6889
|
_classCallCheck(this, Xi);
|
@@ -6878,7 +6891,7 @@ var Xi = /*#__PURE__*/function (_U3) {
|
|
6878
6891
|
return _this24;
|
6879
6892
|
}
|
6880
6893
|
return _createClass(Xi);
|
6881
|
-
}(
|
6894
|
+
}(q);
|
6882
6895
|
var Do = /*#__PURE__*/function (_Xi) {
|
6883
6896
|
_inherits(Do, _Xi);
|
6884
6897
|
function Do(e) {
|
@@ -7098,8 +7111,8 @@ var N = /*#__PURE__*/function () {
|
|
7098
7111
|
}]);
|
7099
7112
|
return N;
|
7100
7113
|
}();
|
7101
|
-
var Qi = /*#__PURE__*/function (
|
7102
|
-
_inherits(zi,
|
7114
|
+
var Qi = /*#__PURE__*/function (_q4) {
|
7115
|
+
_inherits(zi, _q4);
|
7103
7116
|
function zi(e) {
|
7104
7117
|
var _o$model, _a$voice;
|
7105
7118
|
var _this25;
|
@@ -7193,12 +7206,12 @@ var Qi = /*#__PURE__*/function (_U4) {
|
|
7193
7206
|
}()
|
7194
7207
|
}]);
|
7195
7208
|
return zi;
|
7196
|
-
}(
|
7209
|
+
}(q);
|
7197
7210
|
Qi.DEFAULT_MODEL = "tts-1";
|
7198
7211
|
Qi.DEFAULT_VOIDE = "alloy";
|
7199
7212
|
var Bo = Qi;
|
7200
|
-
var oi = /*#__PURE__*/function (
|
7201
|
-
_inherits(we,
|
7213
|
+
var oi = /*#__PURE__*/function (_q5) {
|
7214
|
+
_inherits(we, _q5);
|
7202
7215
|
function we(e) {
|
7203
7216
|
var _o$model2;
|
7204
7217
|
var _this26;
|
@@ -7308,7 +7321,7 @@ var oi = /*#__PURE__*/function (_U5) {
|
|
7308
7321
|
}
|
7309
7322
|
}]);
|
7310
7323
|
return we;
|
7311
|
-
}(
|
7324
|
+
}(q);
|
7312
7325
|
oi.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions";
|
7313
7326
|
oi.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations";
|
7314
7327
|
oi.DEFAULT_MODEL = "whisper-1";
|
@@ -7415,8 +7428,8 @@ var X = /*#__PURE__*/function () {
|
|
7415
7428
|
}]);
|
7416
7429
|
return X;
|
7417
7430
|
}();
|
7418
|
-
var zo = /*#__PURE__*/function (
|
7419
|
-
_inherits(zo,
|
7431
|
+
var zo = /*#__PURE__*/function (_q6) {
|
7432
|
+
_inherits(zo, _q6);
|
7420
7433
|
// prettier-ignore
|
7421
7434
|
function zo(e, t, i, n, r) {
|
7422
7435
|
var _this27;
|
@@ -7427,7 +7440,7 @@ var zo = /*#__PURE__*/function (_U6) {
|
|
7427
7440
|
return _this27;
|
7428
7441
|
}
|
7429
7442
|
return _createClass(zo);
|
7430
|
-
}(
|
7443
|
+
}(q);
|
7431
7444
|
var Uo = /*#__PURE__*/function (_zo) {
|
7432
7445
|
_inherits(Uo, _zo);
|
7433
7446
|
function Uo(e) {
|
@@ -7688,8 +7701,8 @@ var ut = /*#__PURE__*/function () {
|
|
7688
7701
|
}]);
|
7689
7702
|
return ut;
|
7690
7703
|
}();
|
7691
|
-
var en = /*#__PURE__*/function (
|
7692
|
-
_inherits(en,
|
7704
|
+
var en = /*#__PURE__*/function (_q7) {
|
7705
|
+
_inherits(en, _q7);
|
7693
7706
|
function en(e) {
|
7694
7707
|
var _this29;
|
7695
7708
|
_classCallCheck(this, en);
|
@@ -7772,9 +7785,9 @@ var en = /*#__PURE__*/function (_U7) {
|
|
7772
7785
|
}
|
7773
7786
|
}]);
|
7774
7787
|
return en;
|
7775
|
-
}(
|
7776
|
-
var hs = /*#__PURE__*/function (
|
7777
|
-
_inherits(hs,
|
7788
|
+
}(q);
|
7789
|
+
var hs = /*#__PURE__*/function (_q8) {
|
7790
|
+
_inherits(hs, _q8);
|
7778
7791
|
// prettier-ignore
|
7779
7792
|
function hs(e, t, i, n, r) {
|
7780
7793
|
var _this30;
|
@@ -7785,7 +7798,7 @@ var hs = /*#__PURE__*/function (_U8) {
|
|
7785
7798
|
return _this30;
|
7786
7799
|
}
|
7787
7800
|
return _createClass(hs);
|
7788
|
-
}(
|
7801
|
+
}(q);
|
7789
7802
|
var ps = /*#__PURE__*/function (_hs) {
|
7790
7803
|
_inherits(fs, _hs);
|
7791
7804
|
// prettier-ignore
|
@@ -7959,8 +7972,8 @@ ms.HELP_LINK =
|
|
7959
7972
|
// eslint-disable-next-line max-len
|
7960
7973
|
"https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest";
|
7961
7974
|
var Ho = ms;
|
7962
|
-
var Go = /*#__PURE__*/function (
|
7963
|
-
_inherits(Go,
|
7975
|
+
var Go = /*#__PURE__*/function (_q9) {
|
7976
|
+
_inherits(Go, _q9);
|
7964
7977
|
// prettier-ignore
|
7965
7978
|
function Go(e) {
|
7966
7979
|
var _this33;
|
@@ -8038,7 +8051,7 @@ var Go = /*#__PURE__*/function (_U9) {
|
|
8038
8051
|
}()
|
8039
8052
|
}]);
|
8040
8053
|
return Go;
|
8041
|
-
}(
|
8054
|
+
}(q);
|
8042
8055
|
var ge = /*#__PURE__*/function () {
|
8043
8056
|
function ge() {
|
8044
8057
|
_classCallCheck(this, ge);
|
@@ -8245,8 +8258,8 @@ var ge = /*#__PURE__*/function () {
|
|
8245
8258
|
}]);
|
8246
8259
|
return ge;
|
8247
8260
|
}();
|
8248
|
-
var ai = /*#__PURE__*/function (
|
8249
|
-
_inherits(se,
|
8261
|
+
var ai = /*#__PURE__*/function (_q10) {
|
8262
|
+
_inherits(se, _q10);
|
8250
8263
|
function se(e) {
|
8251
8264
|
var _c$headers, _d$OpenAIBeta;
|
8252
8265
|
var _this34;
|
@@ -8613,13 +8626,13 @@ var ai = /*#__PURE__*/function (_U10) {
|
|
8613
8626
|
}()
|
8614
8627
|
}]);
|
8615
8628
|
return se;
|
8616
|
-
}(
|
8629
|
+
}(q);
|
8617
8630
|
ai.THREAD_PREFIX = "https://api.openai.com/v1/threads";
|
8618
8631
|
ai.NEW_ASSISTANT_URL = "https://api.openai.com/v1/assistants";
|
8619
8632
|
ai.POLLING_TIMEOUT_MS = 800;
|
8620
8633
|
var Vo = ai;
|
8621
|
-
var li = /*#__PURE__*/function (
|
8622
|
-
_inherits(Me,
|
8634
|
+
var li = /*#__PURE__*/function (_q11) {
|
8635
|
+
_inherits(Me, _q11);
|
8623
8636
|
function Me(e) {
|
8624
8637
|
var _this35;
|
8625
8638
|
_classCallCheck(this, Me);
|
@@ -8768,13 +8781,13 @@ var li = /*#__PURE__*/function (_U11) {
|
|
8768
8781
|
}
|
8769
8782
|
}]);
|
8770
8783
|
return Me;
|
8771
|
-
}(
|
8784
|
+
}(q);
|
8772
8785
|
li.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations";
|
8773
8786
|
li.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations";
|
8774
8787
|
li.IMAGE_EDIT_URL = "https://api.openai.com/v1/images/edits";
|
8775
8788
|
var Wo = li;
|
8776
|
-
var ht = /*#__PURE__*/function (
|
8777
|
-
_inherits(ht,
|
8789
|
+
var ht = /*#__PURE__*/function (_q12) {
|
8790
|
+
_inherits(ht, _q12);
|
8778
8791
|
function ht(e) {
|
8779
8792
|
var _this36$maxMessages, _l$model;
|
8780
8793
|
var _this36;
|
@@ -9001,7 +9014,7 @@ var ht = /*#__PURE__*/function (_U12) {
|
|
9001
9014
|
}
|
9002
9015
|
}]);
|
9003
9016
|
return ht;
|
9004
|
-
}(
|
9017
|
+
}(q);
|
9005
9018
|
var Jo = /*#__PURE__*/function (_Xi3) {
|
9006
9019
|
_inherits(Jo, _Xi3);
|
9007
9020
|
function Jo(e) {
|
@@ -9113,7 +9126,7 @@ var $o = /*#__PURE__*/function () {
|
|
9113
9126
|
}
|
9114
9127
|
if (t.stabilityAI) return t.stabilityAI.imageToImage ? new Gt(e) : t.stabilityAI.imageToImageUpscale ? new qt(e) : t.stabilityAI.imageToImageMasking ? new Ht(e) : new Vt(e);
|
9115
9128
|
}
|
9116
|
-
return i ? new
|
9129
|
+
return i ? new Pe(e) : new Pe(e, void 0, n || !0);
|
9117
9130
|
}
|
9118
9131
|
}]);
|
9119
9132
|
return $o;
|
@@ -9301,7 +9314,7 @@ var fe = /*#__PURE__*/function () {
|
|
9301
9314
|
t.classList.add("any-file-message-contents");
|
9302
9315
|
var i = document.createElement("div");
|
9303
9316
|
i.classList.add("any-file-message-icon-container");
|
9304
|
-
var n =
|
9317
|
+
var n = G.createSVGElement(Zo);
|
9305
9318
|
n.classList.add("any-file-message-icon"), i.appendChild(n);
|
9306
9319
|
var r = document.createElement("div");
|
9307
9320
|
return r.classList.add("any-file-message-text"), r.textContent = e.name || re.DEFAULT_FILE_NAME, t.appendChild(i), t.appendChild(r), re.processContent("any", t, e.src, r.textContent);
|
@@ -9325,8 +9338,8 @@ var fe = /*#__PURE__*/function () {
|
|
9325
9338
|
}]);
|
9326
9339
|
return fe;
|
9327
9340
|
}();
|
9328
|
-
var me = /*#__PURE__*/function (
|
9329
|
-
_inherits(me,
|
9341
|
+
var me = /*#__PURE__*/function (_Ye) {
|
9342
|
+
_inherits(me, _Ye);
|
9330
9343
|
function me(e, t, i) {
|
9331
9344
|
var _this38;
|
9332
9345
|
_classCallCheck(this, me);
|
@@ -9371,7 +9384,7 @@ var me = /*#__PURE__*/function (_Ke) {
|
|
9371
9384
|
var i = this._introMessage;
|
9372
9385
|
if (t != null && t.isWebModel() && ((_i12 = i) !== null && _i12 !== void 0 ? _i12 : i = t.getIntroMessage(i)), i) {
|
9373
9386
|
var r;
|
9374
|
-
i != null && i.text ? r = this.createAndAppendNewMessageElement(i.text, b.AI_ROLE) : i != null && i.html && (r =
|
9387
|
+
i != null && i.text ? r = this.createAndAppendNewMessageElement(i.text, b.AI_ROLE) : i != null && i.html && (r = Qe.add(this, i.html, b.AI_ROLE, this.messageElementRefs)), r && (this.applyCustomStyles(r, b.AI_ROLE, !1, (n = this.messageStyles) == null ? void 0 : n.intro), r.outerContainer.classList.add("deep-chat-intro"));
|
9375
9388
|
}
|
9376
9389
|
}
|
9377
9390
|
}, {
|
@@ -9400,7 +9413,7 @@ var me = /*#__PURE__*/function (_Ke) {
|
|
9400
9413
|
status: e.overwrite
|
9401
9414
|
};
|
9402
9415
|
if (!e.ignoreText && i.text !== void 0 && e.text !== null && (this.addNewTextMessage(i.text, i.role, n), !t && this.textToSpeech && i.role !== b.USER_ROLE && jt.speak(i.text, this.textToSpeech)), i.files && Array.isArray(i.files) && fe.addMessages(this, i.files, i.role), i.html !== void 0 && i.html !== null) {
|
9403
|
-
var r =
|
9416
|
+
var r = Qe.add(this, i.html, i.role, this.messageElementRefs, n);
|
9404
9417
|
ve.isElementTemporary(r) && delete i.html;
|
9405
9418
|
}
|
9406
9419
|
this.isValidMessageContent(i) && this.updateStateOnMessage(i, e.overwrite, e.sendUpdate, t);
|
@@ -9423,7 +9436,7 @@ var me = /*#__PURE__*/function (_Ke) {
|
|
9423
9436
|
value: function removeMessageOnError() {
|
9424
9437
|
var e = this.messageElementRefs[this.messageElementRefs.length - 1],
|
9425
9438
|
t = e == null ? void 0 : e.bubbleElement;
|
9426
|
-
(t != null && t.classList.contains(
|
9439
|
+
(t != null && t.classList.contains(Oe.MESSAGE_CLASS) && t.textContent === "" || me.isTemporaryElement(e)) && this.removeLastMessage();
|
9427
9440
|
}
|
9428
9441
|
// prettier-ignore
|
9429
9442
|
}, {
|
@@ -9522,7 +9535,7 @@ var me = /*#__PURE__*/function (_Ke) {
|
|
9522
9535
|
var i = [];
|
9523
9536
|
this.messageElementRefs.forEach(function (o) {
|
9524
9537
|
var a = o.bubbleElement.classList;
|
9525
|
-
a.contains("loading-message-text") || a.contains(
|
9538
|
+
a.contains("loading-message-text") || a.contains(Oe.MESSAGE_CLASS) ? i.push(o) : o.outerContainer.remove();
|
9526
9539
|
}), Array.from(this.elementRef.children).forEach(function (o) {
|
9527
9540
|
var l;
|
9528
9541
|
var a = (l = o.children[0]) == null ? void 0 : l.children[0];
|
@@ -9542,12 +9555,12 @@ var me = /*#__PURE__*/function (_Ke) {
|
|
9542
9555
|
}
|
9543
9556
|
}]);
|
9544
9557
|
return me;
|
9545
|
-
}(
|
9558
|
+
}(Ye);
|
9546
9559
|
var Mt = /*#__PURE__*/function () {
|
9547
|
-
function
|
9548
|
-
_classCallCheck(this,
|
9560
|
+
function $() {
|
9561
|
+
_classCallCheck(this, $);
|
9549
9562
|
}
|
9550
|
-
_createClass(
|
9563
|
+
_createClass($, null, [{
|
9551
9564
|
key: "adjustInputPadding",
|
9552
9565
|
value: function adjustInputPadding(e, t) {
|
9553
9566
|
t["inside-left"].length > 0 && e.classList.add("text-input-inner-left-adjustment"), t["inside-right"].length > 0 && e.classList.add("text-input-inner-right-adjustment");
|
@@ -9555,7 +9568,7 @@ var Mt = /*#__PURE__*/function () {
|
|
9555
9568
|
}, {
|
9556
9569
|
key: "adjustForOutsideButton",
|
9557
9570
|
value: function adjustForOutsideButton(e, t, i) {
|
9558
|
-
i["outside-right"].length === 0 && i["outside-left"].length > 0 ? (e[0].classList.add(
|
9571
|
+
i["outside-right"].length === 0 && i["outside-left"].length > 0 ? (e[0].classList.add($.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS), t.classList.add($.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS)) : i["outside-left"].length === 0 && i["outside-right"].length > 0 && (e[3].classList.add($.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS), t.classList.add($.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS));
|
9559
9572
|
}
|
9560
9573
|
// when submit is the only button
|
9561
9574
|
// when submit button is outside by itself - we increase the height for a better look
|
@@ -9563,10 +9576,10 @@ var Mt = /*#__PURE__*/function () {
|
|
9563
9576
|
key: "adjustOutsideSubmit",
|
9564
9577
|
value: function adjustOutsideSubmit(e, t, i) {
|
9565
9578
|
if (!(i["inside-left"].length > 0 || i["inside-right"].length > 0)) {
|
9566
|
-
if (i["outside-right"].length === 0 && i["outside-left"].length > 0) return e[0].classList.add(
|
9579
|
+
if (i["outside-right"].length === 0 && i["outside-left"].length > 0) return e[0].classList.add($.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), t.classList.add($.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), i["outside-left"].map(function (n) {
|
9567
9580
|
return n.button.elementRef.classList.add("submit-button-enlarged");
|
9568
9581
|
});
|
9569
|
-
if (i["outside-left"].length === 0 && i["outside-right"].length > 0) return e[3].classList.add(
|
9582
|
+
if (i["outside-left"].length === 0 && i["outside-right"].length > 0) return e[3].classList.add($.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), t.classList.add($.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), i["outside-right"].map(function (n) {
|
9570
9583
|
return n.button.elementRef.classList.add("submit-button-enlarged");
|
9571
9584
|
});
|
9572
9585
|
}
|
@@ -9574,10 +9587,10 @@ var Mt = /*#__PURE__*/function () {
|
|
9574
9587
|
}, {
|
9575
9588
|
key: "set",
|
9576
9589
|
value: function set(e, t, i, n) {
|
9577
|
-
|
9590
|
+
!!$.adjustOutsideSubmit(t, i, n) || $.adjustForOutsideButton(t, i, n), $.adjustInputPadding(e, n);
|
9578
9591
|
}
|
9579
9592
|
}]);
|
9580
|
-
return
|
9593
|
+
return $;
|
9581
9594
|
}();
|
9582
9595
|
Mt.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS = "text-input-container-left-adjustment";
|
9583
9596
|
Mt.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS = "text-input-container-right-adjustment";
|
@@ -9632,7 +9645,7 @@ var j = /*#__PURE__*/function () {
|
|
9632
9645
|
}, {
|
9633
9646
|
key: "createElement",
|
9634
9647
|
value: function createElement(e, t) {
|
9635
|
-
return t ? j.createTextElement(e) :
|
9648
|
+
return t ? j.createTextElement(e) : G.createSVGElement(e);
|
9636
9649
|
}
|
9637
9650
|
}, {
|
9638
9651
|
key: "createCustomElement",
|
@@ -9888,24 +9901,24 @@ var nn = /*#__PURE__*/function () {
|
|
9888
9901
|
}]);
|
9889
9902
|
return nn;
|
9890
9903
|
}();
|
9891
|
-
var
|
9892
|
-
_inherits(
|
9893
|
-
function
|
9904
|
+
var Ze = /*#__PURE__*/function (_Tt) {
|
9905
|
+
_inherits(Ze, _Tt);
|
9906
|
+
function Ze(e, t) {
|
9894
9907
|
var _this41;
|
9895
|
-
_classCallCheck(this,
|
9908
|
+
_classCallCheck(this, Ze);
|
9896
9909
|
var n;
|
9897
|
-
_this41 = _callSuper(this,
|
9910
|
+
_this41 = _callSuper(this, Ze, [Ze.createButtonElement(), void 0, {
|
9898
9911
|
styles: (n = t == null ? void 0 : t.button) == null ? void 0 : n.styles
|
9899
9912
|
}]);
|
9900
9913
|
var i = _this41.createInnerElements(_this41._customStyles);
|
9901
|
-
_this41._menu = new nn(e, t == null ? void 0 : t.menu), _this41.addClickEvent(), _this41.buttonContainer =
|
9914
|
+
_this41._menu = new nn(e, t == null ? void 0 : t.menu), _this41.addClickEvent(), _this41.buttonContainer = Ze.createButtonContainer(), _this41.elementRef.appendChild(i.styles), _this41.buttonContainer.appendChild(_this41.elementRef), _this41.elementRef.classList.add("dropup-icon", "upload-file-button"), _this41.elementRef.children[0].id = "dropup-icon", _this41.buttonContainer.appendChild(_this41._menu.elementRef), _this41.reapplyStateStyle("styles"), _this41.addContainerEvents(e);
|
9902
9915
|
return _this41;
|
9903
9916
|
}
|
9904
|
-
_createClass(
|
9917
|
+
_createClass(Ze, [{
|
9905
9918
|
key: "createInnerElements",
|
9906
9919
|
value: function createInnerElements(e) {
|
9907
9920
|
return {
|
9908
|
-
styles: this.createInnerElement(
|
9921
|
+
styles: this.createInnerElement(Ze.createSVGIconElement(), "styles", e)
|
9909
9922
|
};
|
9910
9923
|
}
|
9911
9924
|
}, {
|
@@ -9940,7 +9953,7 @@ var Ye = /*#__PURE__*/function (_Tt) {
|
|
9940
9953
|
}, {
|
9941
9954
|
key: "createSVGIconElement",
|
9942
9955
|
value: function createSVGIconElement() {
|
9943
|
-
return
|
9956
|
+
return G.createSVGElement(Qo);
|
9944
9957
|
}
|
9945
9958
|
}, {
|
9946
9959
|
key: "createButtonContainer",
|
@@ -9955,7 +9968,7 @@ var Ye = /*#__PURE__*/function (_Tt) {
|
|
9955
9968
|
return (i = t == null ? void 0 : t.button) != null && i.position ? (n = t == null ? void 0 : t.button) == null ? void 0 : n.position : e["outside-left"].length > 0 && e["outside-right"].length === 0 ? "outside-right" : "outside-left";
|
9956
9969
|
}
|
9957
9970
|
}]);
|
9958
|
-
return
|
9971
|
+
return Ze;
|
9959
9972
|
}(Tt);
|
9960
9973
|
var B = /*#__PURE__*/function () {
|
9961
9974
|
function B() {
|
@@ -9966,7 +9979,7 @@ var B = /*#__PURE__*/function () {
|
|
9966
9979
|
value:
|
9967
9980
|
// prettier-ignore
|
9968
9981
|
function addToDropup(e, t, i, n) {
|
9969
|
-
var r = new
|
9982
|
+
var r = new Ze(i, n);
|
9970
9983
|
Mn.forEach(function (a) {
|
9971
9984
|
var l = t["dropup-menu"].findIndex(function (d) {
|
9972
9985
|
return d.buttonType === a;
|
@@ -9974,7 +9987,7 @@ var B = /*#__PURE__*/function () {
|
|
9974
9987
|
c = t["dropup-menu"][l];
|
9975
9988
|
c && (r.addItem(c.button), t["dropup-menu"].splice(l, 1));
|
9976
9989
|
});
|
9977
|
-
var o =
|
9990
|
+
var o = Ze.getPosition(t, n);
|
9978
9991
|
tt.addButton(e, r.buttonContainer, o), t[o].push({});
|
9979
9992
|
}
|
9980
9993
|
}, {
|
@@ -10224,7 +10237,7 @@ var ra = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
10224
10237
|
i.classList.add("audio-placeholder-text-3-digits");
|
10225
10238
|
var n = document.createElement("div");
|
10226
10239
|
n.classList.add("file-attachment-text-container", "audio-placeholder-text-3-digits-container"), n.appendChild(i);
|
10227
|
-
var r =
|
10240
|
+
var r = G.createSVGElement(Tn);
|
10228
10241
|
return r.classList.add("attachment-icon", "stop-icon", "not-removable-attachment-icon"), i.textContent = "0:00", this._activePlaceholderTimer = this.createTimer(i, e), t.appendChild(n), this.addPlaceholderAudioAttachmentEvents(t, r, n), t;
|
10229
10242
|
}
|
10230
10243
|
}, {
|
@@ -10280,9 +10293,9 @@ var ra = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
10280
10293
|
var i = e.parentElement ? Z.cloneElement(e) : e,
|
10281
10294
|
n = document.createElement("audio");
|
10282
10295
|
n.src = t;
|
10283
|
-
var r =
|
10296
|
+
var r = G.createSVGElement(ra);
|
10284
10297
|
r.classList.add("attachment-icon", "play-icon");
|
10285
|
-
var o =
|
10298
|
+
var o = G.createSVGElement(Tn);
|
10286
10299
|
o.classList.add("attachment-icon", "stop-icon"), i.replaceChildren(r), n.onplay = function () {
|
10287
10300
|
i.replaceChildren(o);
|
10288
10301
|
}, n.onpause = function () {
|
@@ -10520,7 +10533,7 @@ var ys = /*#__PURE__*/function () {
|
|
10520
10533
|
value: function createSVGButton(e) {
|
10521
10534
|
var t = document.createElement("div");
|
10522
10535
|
t.classList.add("modal-button", "modal-svg-button");
|
10523
|
-
var i =
|
10536
|
+
var i = G.createSVGElement(e);
|
10524
10537
|
return i.classList.add("modal-svg-button-icon"), t.appendChild(i), t;
|
10525
10538
|
}
|
10526
10539
|
}, {
|
@@ -10599,7 +10612,7 @@ var pt = /*#__PURE__*/function (_Tt2) {
|
|
10599
10612
|
}, {
|
10600
10613
|
key: "createSVGIconElement",
|
10601
10614
|
value: function createSVGIconElement(e, t) {
|
10602
|
-
var i =
|
10615
|
+
var i = G.createSVGElement(t);
|
10603
10616
|
return i.id = e, i;
|
10604
10617
|
}
|
10605
10618
|
}]);
|
@@ -10725,7 +10738,7 @@ var Ae = /*#__PURE__*/function () {
|
|
10725
10738
|
}, {
|
10726
10739
|
key: "validateWebsocket",
|
10727
10740
|
value: function validateWebsocket(e, t) {
|
10728
|
-
return e.websocket && !
|
10741
|
+
return e.websocket && !F.canSendMessage(e.websocket) ? (t.changeToDisabledIcon(), !1) : !0;
|
10729
10742
|
}
|
10730
10743
|
// prettier-ignore
|
10731
10744
|
}, {
|
@@ -10831,7 +10844,7 @@ var xt = /*#__PURE__*/function (_Tt3) {
|
|
10831
10844
|
}, {
|
10832
10845
|
key: "createSVGIconElement",
|
10833
10846
|
value: function createSVGIconElement() {
|
10834
|
-
var e =
|
10847
|
+
var e = G.createSVGElement(aa);
|
10835
10848
|
return e.id = "microphone-icon", e;
|
10836
10849
|
}
|
10837
10850
|
}]);
|
@@ -10841,11 +10854,11 @@ var xs = {},
|
|
10841
10854
|
ci = {},
|
10842
10855
|
di = {},
|
10843
10856
|
At = {},
|
10844
|
-
|
10845
|
-
Object.defineProperty(
|
10857
|
+
ze = {};
|
10858
|
+
Object.defineProperty(ze, "__esModule", {
|
10846
10859
|
value: !0
|
10847
10860
|
});
|
10848
|
-
|
10861
|
+
ze.Text = void 0;
|
10849
10862
|
var xe = /*#__PURE__*/function () {
|
10850
10863
|
function xe() {
|
10851
10864
|
_classCallCheck(this, xe);
|
@@ -10876,7 +10889,7 @@ var xe = /*#__PURE__*/function () {
|
|
10876
10889
|
}]);
|
10877
10890
|
return xe;
|
10878
10891
|
}();
|
10879
|
-
|
10892
|
+
ze.Text = xe;
|
10880
10893
|
xe.FIRST_CHAR_REGEX = /\S/;
|
10881
10894
|
xe.DOUBLE_LINE = /\n\n/g;
|
10882
10895
|
xe.ONE_LINE = /\n/g;
|
@@ -10884,7 +10897,7 @@ Object.defineProperty(At, "__esModule", {
|
|
10884
10897
|
value: !0
|
10885
10898
|
});
|
10886
10899
|
At.Translate = void 0;
|
10887
|
-
var la =
|
10900
|
+
var la = ze;
|
10888
10901
|
var ca = /*#__PURE__*/function () {
|
10889
10902
|
function ca() {
|
10890
10903
|
_classCallCheck(this, ca);
|
@@ -10960,11 +10973,11 @@ Object.defineProperty(ui, "__esModule", {
|
|
10960
10973
|
value: !0
|
10961
10974
|
});
|
10962
10975
|
ui.EventListeners = void 0;
|
10963
|
-
var
|
10964
|
-
function
|
10965
|
-
_classCallCheck(this,
|
10976
|
+
var Y = /*#__PURE__*/function () {
|
10977
|
+
function Y() {
|
10978
|
+
_classCallCheck(this, Y);
|
10966
10979
|
}
|
10967
|
-
_createClass(
|
10980
|
+
_createClass(Y, null, [{
|
10968
10981
|
key: "getElementIfFocusedOnAvailable",
|
10969
10982
|
value: function getElementIfFocusedOnAvailable(e, t) {
|
10970
10983
|
return Array.isArray(e) ? e.find(function (i) {
|
@@ -10975,14 +10988,14 @@ var K = /*#__PURE__*/function () {
|
|
10975
10988
|
key: "keyDownWindow",
|
10976
10989
|
value: function keyDownWindow(e) {
|
10977
10990
|
var _this51 = this;
|
10978
|
-
e.element &&
|
10979
|
-
|
10991
|
+
e.element && Y.getElementIfFocusedOnAvailable(e.element, document.activeElement) && (Y.KEY_DOWN_TIMEOUT !== null && clearTimeout(Y.KEY_DOWN_TIMEOUT), Y.KEY_DOWN_TIMEOUT = setTimeout(function () {
|
10992
|
+
Y.KEY_DOWN_TIMEOUT = null, _this51.resetRecording(e);
|
10980
10993
|
}, 500));
|
10981
10994
|
}
|
10982
10995
|
}, {
|
10983
10996
|
key: "mouseDownWindow",
|
10984
10997
|
value: function mouseDownWindow(e, t) {
|
10985
|
-
this.mouseDownElement =
|
10998
|
+
this.mouseDownElement = Y.getElementIfFocusedOnAvailable(e, t.target);
|
10986
10999
|
}
|
10987
11000
|
}, {
|
10988
11001
|
key: "mouseUpWindow",
|
@@ -10993,7 +11006,7 @@ var K = /*#__PURE__*/function () {
|
|
10993
11006
|
key: "add",
|
10994
11007
|
value: function add(e, t) {
|
10995
11008
|
var i = (t == null ? void 0 : t.insertInCursorLocation) === void 0 || (t == null ? void 0 : t.insertInCursorLocation);
|
10996
|
-
t != null && t.element && i && (e.mouseDownEvent =
|
11009
|
+
t != null && t.element && i && (e.mouseDownEvent = Y.mouseDownWindow.bind(e, t.element), document.addEventListener("mousedown", e.mouseDownEvent), e.mouseUpEvent = Y.mouseUpWindow.bind(e, t), document.addEventListener("mouseup", e.mouseUpEvent), e.keyDownEvent = Y.keyDownWindow.bind(e, t), document.addEventListener("keydown", e.keyDownEvent));
|
10997
11010
|
}
|
10998
11011
|
}, {
|
10999
11012
|
key: "remove",
|
@@ -11001,10 +11014,10 @@ var K = /*#__PURE__*/function () {
|
|
11001
11014
|
document.removeEventListener("mousedown", e.mouseDownEvent), document.removeEventListener("mouseup", e.mouseUpEvent), document.removeEventListener("keydown", e.keyDownEvent);
|
11002
11015
|
}
|
11003
11016
|
}]);
|
11004
|
-
return
|
11017
|
+
return Y;
|
11005
11018
|
}();
|
11006
|
-
ui.EventListeners =
|
11007
|
-
|
11019
|
+
ui.EventListeners = Y;
|
11020
|
+
Y.KEY_DOWN_TIMEOUT = null;
|
11008
11021
|
var hi = {};
|
11009
11022
|
Object.defineProperty(hi, "__esModule", {
|
11010
11023
|
value: !0
|
@@ -11069,11 +11082,11 @@ var sn = /*#__PURE__*/function () {
|
|
11069
11082
|
return sn;
|
11070
11083
|
}();
|
11071
11084
|
Lt.AutoScroll = sn;
|
11072
|
-
var
|
11073
|
-
Object.defineProperty(
|
11085
|
+
var Ue = {};
|
11086
|
+
Object.defineProperty(Ue, "__esModule", {
|
11074
11087
|
value: !0
|
11075
11088
|
});
|
11076
|
-
|
11089
|
+
Ue.Elements = void 0;
|
11077
11090
|
var ha = /*#__PURE__*/function () {
|
11078
11091
|
function ha() {
|
11079
11092
|
_classCallCheck(this, ha);
|
@@ -11121,12 +11134,12 @@ var ha = /*#__PURE__*/function () {
|
|
11121
11134
|
}]);
|
11122
11135
|
return ha;
|
11123
11136
|
}();
|
11124
|
-
|
11125
|
-
var
|
11126
|
-
Object.defineProperty(
|
11137
|
+
Ue.Elements = ha;
|
11138
|
+
var qe = {};
|
11139
|
+
Object.defineProperty(qe, "__esModule", {
|
11127
11140
|
value: !0
|
11128
11141
|
});
|
11129
|
-
|
11142
|
+
qe.Cursor = void 0;
|
11130
11143
|
var ft = /*#__PURE__*/function () {
|
11131
11144
|
function ft() {
|
11132
11145
|
_classCallCheck(this, ft);
|
@@ -11208,21 +11221,21 @@ var ft = /*#__PURE__*/function () {
|
|
11208
11221
|
}]);
|
11209
11222
|
return ft;
|
11210
11223
|
}();
|
11211
|
-
|
11224
|
+
qe.Cursor = ft;
|
11212
11225
|
Object.defineProperty(It, "__esModule", {
|
11213
11226
|
value: !0
|
11214
11227
|
});
|
11215
11228
|
It.CommandUtils = void 0;
|
11216
11229
|
var An = Lt,
|
11217
|
-
pa =
|
11230
|
+
pa = Ue,
|
11218
11231
|
fa = nt,
|
11219
|
-
kn =
|
11220
|
-
In =
|
11221
|
-
var
|
11222
|
-
function
|
11223
|
-
_classCallCheck(this,
|
11232
|
+
kn = qe,
|
11233
|
+
In = ze;
|
11234
|
+
var K = /*#__PURE__*/function () {
|
11235
|
+
function K() {
|
11236
|
+
_classCallCheck(this, K);
|
11224
11237
|
}
|
11225
|
-
_createClass(
|
11238
|
+
_createClass(K, null, [{
|
11226
11239
|
key: "processCommand",
|
11227
11240
|
value: function processCommand(e, t) {
|
11228
11241
|
return (!t || !t.caseSensitive) && (e = e.toLowerCase()), (t == null ? void 0 : t.substrings) === !1 ? In.Text.breakupIntoWordsArr(e) : e;
|
@@ -11233,7 +11246,7 @@ var $ = /*#__PURE__*/function () {
|
|
11233
11246
|
var t;
|
11234
11247
|
return ((t = e.settings) === null || t === void 0 ? void 0 : t.caseSensitive) === !0 ? e : Object.keys(e).reduce(function (n, r) {
|
11235
11248
|
var o = e[r];
|
11236
|
-
return n[r] = typeof o == "string" ?
|
11249
|
+
return n[r] = typeof o == "string" ? K.processCommand(o, e.settings) : o, n;
|
11237
11250
|
}, {});
|
11238
11251
|
}
|
11239
11252
|
}, {
|
@@ -11251,7 +11264,7 @@ var $ = /*#__PURE__*/function () {
|
|
11251
11264
|
}, {
|
11252
11265
|
key: "setText",
|
11253
11266
|
value: function setText(e, t, i, n) {
|
11254
|
-
|
11267
|
+
K.toggleCommandModeOff(e), pa.Elements.isPrimitiveElement(n) ? (n.value = i, e.isTargetInShadow || kn.Cursor.setOffsetForPrimitive(n, i.length, !0), fa.Browser.IS_SAFARI() && e.autoScroll && An.AutoScroll.scrollSafariPrimitiveToEnd(n)) : (n.textContent = i, e.isTargetInShadow || kn.Cursor.focusEndOfGeneric(n), setTimeout(function () {
|
11255
11268
|
return An.AutoScroll.scrollGeneric(e, n);
|
11256
11269
|
})), e.resetRecording(t);
|
11257
11270
|
}
|
@@ -11281,46 +11294,46 @@ var $ = /*#__PURE__*/function () {
|
|
11281
11294
|
if (!c || !n || !i) return;
|
11282
11295
|
var d = ((o = c.settings) === null || o === void 0 ? void 0 : o.caseSensitive) === !0 ? t : t.toLowerCase(),
|
11283
11296
|
u = In.Text.breakupIntoWordsArr(d),
|
11284
|
-
h = ((a = c.settings) === null || a === void 0 ? void 0 : a.substrings) === !1 ?
|
11297
|
+
h = ((a = c.settings) === null || a === void 0 ? void 0 : a.substrings) === !1 ? K.checkIfMatchesWord : K.checkIfMatchesSubstring;
|
11285
11298
|
if (c.commandMode && h(c.commandMode, d, u)) return e.setInterimColorToFinal(), setTimeout(function () {
|
11286
|
-
return
|
11299
|
+
return K.toggleCommandModeOn(e);
|
11287
11300
|
}), {
|
11288
11301
|
doNotProcessTranscription: !1
|
11289
11302
|
};
|
11290
11303
|
if (!(c.commandMode && !e.isWaitingForCommand)) {
|
11291
|
-
if (c.stop && h(c.stop, d, u)) return
|
11304
|
+
if (c.stop && h(c.stop, d, u)) return K.toggleCommandModeOff(e), setTimeout(function () {
|
11292
11305
|
return e.stop();
|
11293
11306
|
}), {
|
11294
11307
|
doNotProcessTranscription: !1
|
11295
11308
|
};
|
11296
|
-
if (c.pause && h(c.pause, d, u)) return
|
11309
|
+
if (c.pause && h(c.pause, d, u)) return K.toggleCommandModeOff(e), e.setInterimColorToFinal(), setTimeout(function () {
|
11297
11310
|
var p;
|
11298
11311
|
e.isPaused = !0, (p = e.onPauseTrigger) === null || p === void 0 || p.call(e, !0);
|
11299
11312
|
}), {
|
11300
11313
|
doNotProcessTranscription: !1
|
11301
11314
|
};
|
11302
|
-
if (c.resume && h(c.resume, d, u)) return e.isPaused = !1, (l = e.onPauseTrigger) === null || l === void 0 || l.call(e, !1),
|
11315
|
+
if (c.resume && h(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), {
|
11303
11316
|
doNotProcessTranscription: !0
|
11304
11317
|
};
|
11305
|
-
if (c.reset && h(c.reset, d, u)) return r !== void 0 &&
|
11318
|
+
if (c.reset && h(c.reset, d, u)) return r !== void 0 && K.setText(e, i, r, n), {
|
11306
11319
|
doNotProcessTranscription: !0
|
11307
11320
|
};
|
11308
|
-
if (c.removeAllText && h(c.removeAllText, d, u)) return
|
11321
|
+
if (c.removeAllText && h(c.removeAllText, d, u)) return K.setText(e, i, "", n), {
|
11309
11322
|
doNotProcessTranscription: !0
|
11310
11323
|
};
|
11311
11324
|
}
|
11312
11325
|
}
|
11313
11326
|
}]);
|
11314
|
-
return
|
11327
|
+
return K;
|
11315
11328
|
}();
|
11316
|
-
It.CommandUtils =
|
11329
|
+
It.CommandUtils = K;
|
11317
11330
|
var pi = {};
|
11318
11331
|
Object.defineProperty(pi, "__esModule", {
|
11319
11332
|
value: !0
|
11320
11333
|
});
|
11321
11334
|
pi.Highlight = void 0;
|
11322
|
-
var ma =
|
11323
|
-
st =
|
11335
|
+
var ma = Ue,
|
11336
|
+
st = qe;
|
11324
11337
|
var $t = /*#__PURE__*/function () {
|
11325
11338
|
function $t() {
|
11326
11339
|
_classCallCheck(this, $t);
|
@@ -11376,9 +11389,9 @@ Object.defineProperty(fi, "__esModule", {
|
|
11376
11389
|
value: !0
|
11377
11390
|
});
|
11378
11391
|
fi.Padding = void 0;
|
11379
|
-
var ga =
|
11380
|
-
Ln =
|
11381
|
-
|
11392
|
+
var ga = Ue,
|
11393
|
+
Ln = qe,
|
11394
|
+
Ge = ze;
|
11382
11395
|
var Kt = /*#__PURE__*/function () {
|
11383
11396
|
function Kt() {
|
11384
11397
|
_classCallCheck(this, Kt);
|
@@ -11391,11 +11404,11 @@ var Kt = /*#__PURE__*/function () {
|
|
11391
11404
|
r = t.value[n - 1],
|
11392
11405
|
o = t.selectionEnd === null ? n : t.selectionEnd,
|
11393
11406
|
a = t.value[o];
|
11394
|
-
|
11407
|
+
Ge.Text.isCharDefined(r) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), Ge.Text.isCharDefined(a) && (e.endPadding = " ", e.numberOfSpacesAfterNewText = 1), e.isCursorAtEnd = t.value.length === o;
|
11395
11408
|
return;
|
11396
11409
|
}
|
11397
11410
|
var i = t.value[t.value.length - 1];
|
11398
|
-
|
11411
|
+
Ge.Text.isCharDefined(i) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), e.isCursorAtEnd = !0;
|
11399
11412
|
}
|
11400
11413
|
}, {
|
11401
11414
|
key: "setStateForGenericElement",
|
@@ -11408,12 +11421,12 @@ var Kt = /*#__PURE__*/function () {
|
|
11408
11421
|
c = (i = t.textContent) === null || i === void 0 ? void 0 : i[l - 1],
|
11409
11422
|
d = Ln.Cursor.getGenericElementCursorOffset(t, a, !1),
|
11410
11423
|
u = (n = t.textContent) === null || n === void 0 ? void 0 : n[d];
|
11411
|
-
|
11424
|
+
Ge.Text.isCharDefined(c) && (e.startPadding = " "), Ge.Text.isCharDefined(u) && (e.endPadding = " "), e.isCursorAtEnd = ((r = t.textContent) === null || r === void 0 ? void 0 : r.length) === d;
|
11412
11425
|
return;
|
11413
11426
|
}
|
11414
11427
|
}
|
11415
11428
|
var o = t.innerText.charAt(t.innerText.length - 1);
|
11416
|
-
|
11429
|
+
Ge.Text.isCharDefined(o) && (e.startPadding = " "), e.isCursorAtEnd = !0;
|
11417
11430
|
}
|
11418
11431
|
}, {
|
11419
11432
|
key: "setState",
|
@@ -11447,11 +11460,11 @@ var Rn = ui,
|
|
11447
11460
|
Nn = It,
|
11448
11461
|
Pt = Lt,
|
11449
11462
|
ki = pi,
|
11450
|
-
ie =
|
11463
|
+
ie = Ue,
|
11451
11464
|
Ii = fi,
|
11452
11465
|
On = nt,
|
11453
|
-
Pn =
|
11454
|
-
Li =
|
11466
|
+
Pn = qe,
|
11467
|
+
Li = ze;
|
11455
11468
|
var va = /*#__PURE__*/function () {
|
11456
11469
|
function va() {
|
11457
11470
|
_classCallCheck(this, va);
|
@@ -11640,22 +11653,22 @@ Object.defineProperty(mi, "__esModule", {
|
|
11640
11653
|
value: !0
|
11641
11654
|
});
|
11642
11655
|
mi.GlobalState = void 0;
|
11643
|
-
var
|
11644
|
-
function
|
11645
|
-
_classCallCheck(this,
|
11656
|
+
var Xe = /*#__PURE__*/function () {
|
11657
|
+
function Xe() {
|
11658
|
+
_classCallCheck(this, Xe);
|
11646
11659
|
}
|
11647
|
-
_createClass(
|
11660
|
+
_createClass(Xe, null, [{
|
11648
11661
|
key: "doubleClickDetector",
|
11649
11662
|
value: function doubleClickDetector() {
|
11650
|
-
return
|
11651
|
-
|
11663
|
+
return Xe.doubleClickPending ? !0 : (Xe.doubleClickPending = !0, setTimeout(function () {
|
11664
|
+
Xe.doubleClickPending = !1;
|
11652
11665
|
}, 300), !1);
|
11653
11666
|
}
|
11654
11667
|
}]);
|
11655
|
-
return
|
11668
|
+
return Xe;
|
11656
11669
|
}();
|
11657
|
-
mi.GlobalState =
|
11658
|
-
|
11670
|
+
mi.GlobalState = Xe;
|
11671
|
+
Xe.doubleClickPending = !1;
|
11659
11672
|
var gi = {},
|
11660
11673
|
bi = {};
|
11661
11674
|
Object.defineProperty(bi, "__esModule", {
|
@@ -12002,21 +12015,21 @@ var Un = ci,
|
|
12002
12015
|
wa = It,
|
12003
12016
|
ee = mi,
|
12004
12017
|
Ma = gi;
|
12005
|
-
var
|
12006
|
-
function
|
12007
|
-
_classCallCheck(this,
|
12018
|
+
var Ke = /*#__PURE__*/function () {
|
12019
|
+
function Ke() {
|
12020
|
+
_classCallCheck(this, Ke);
|
12008
12021
|
}
|
12009
|
-
_createClass(
|
12022
|
+
_createClass(Ke, null, [{
|
12010
12023
|
key: "toggle",
|
12011
12024
|
value: function toggle(e, t) {
|
12012
12025
|
var i, n;
|
12013
12026
|
var r = e.toLocaleLowerCase().trim();
|
12014
|
-
!((i = ee.GlobalState.service) === null || i === void 0) && i.recognizing ? this.stop() : r === "webspeech" ?
|
12027
|
+
!((i = ee.GlobalState.service) === null || i === void 0) && i.recognizing ? this.stop() : r === "webspeech" ? Ke.startWebSpeech(t) : r === "azure" ? Ke.startAzure(t) : (console.error("service not found - must be either 'webspeech' or 'azure'"), (n = t == null ? void 0 : t.onError) === null || n === void 0 || n.call(t, "service not found - must be either 'webspeech' or 'azure'"));
|
12015
12028
|
}
|
12016
12029
|
}, {
|
12017
12030
|
key: "startWebSpeech",
|
12018
12031
|
value: function startWebSpeech(e) {
|
12019
|
-
|
12032
|
+
Ke.stop() || (ee.GlobalState.service = new Un.WebSpeech(), ee.GlobalState.service.start(e));
|
12020
12033
|
}
|
12021
12034
|
}, {
|
12022
12035
|
key: "isWebSpeechSupported",
|
@@ -12027,7 +12040,7 @@ var $e = /*#__PURE__*/function () {
|
|
12027
12040
|
key: "startAzure",
|
12028
12041
|
value: function startAzure(e) {
|
12029
12042
|
var t;
|
12030
|
-
|
12043
|
+
Ke.stop() || !((t = ee.GlobalState.service) === null || t === void 0) && t.cannotBeStopped || (ee.GlobalState.service = new Ma.Azure(), ee.GlobalState.service.start(e));
|
12031
12044
|
}
|
12032
12045
|
}, {
|
12033
12046
|
key: "stop",
|
@@ -12041,9 +12054,9 @@ var $e = /*#__PURE__*/function () {
|
|
12041
12054
|
ee.GlobalState.service && wa.CommandUtils.toggleCommandModeOff(ee.GlobalState.service);
|
12042
12055
|
}
|
12043
12056
|
}]);
|
12044
|
-
return
|
12057
|
+
return Ke;
|
12045
12058
|
}();
|
12046
|
-
var Oi = xs["default"] =
|
12059
|
+
var Oi = xs["default"] = Ke;
|
12047
12060
|
var Qt = /*#__PURE__*/function (_xt) {
|
12048
12061
|
_inherits(Qt, _xt);
|
12049
12062
|
function Qt(e, t, i) {
|
@@ -12198,42 +12211,42 @@ var Ta = /*#__PURE__*/function (_xt2) {
|
|
12198
12211
|
return Ta;
|
12199
12212
|
}(xt);
|
12200
12213
|
var Ca = "<?xml version=\"1.0\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\" \"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">\n<svg xmlns=\"http://www.w3.org/2000/svg\" stroke=\"currentColor\" fill=\"none\" stroke-width=\"1\" viewBox=\"0 0 24 24\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <line x1=\"22\" y1=\"2\" x2=\"11\" y2=\"14\"></line>\n <polygon points=\"22 2 15 22 11 14 2 10 22 2\"></polygon>\n</svg>\n";
|
12201
|
-
var
|
12202
|
-
function
|
12203
|
-
_classCallCheck(this,
|
12214
|
+
var z = /*#__PURE__*/function () {
|
12215
|
+
function z() {
|
12216
|
+
_classCallCheck(this, z);
|
12204
12217
|
}
|
12205
|
-
_createClass(
|
12218
|
+
_createClass(z, null, [{
|
12206
12219
|
key: "setPropertyValueIfDoesNotExist",
|
12207
12220
|
value: function setPropertyValueIfDoesNotExist(e, t, i) {
|
12208
12221
|
var _e$n, _e$n2;
|
12209
12222
|
var n = t[0];
|
12210
|
-
t.length === 1 ? (_e$n = e[n]) !== null && _e$n !== void 0 ? _e$n : e[n] = i : ((_e$n2 = e[n]) !== null && _e$n2 !== void 0 ? _e$n2 : e[n] = {}, t.shift(),
|
12223
|
+
t.length === 1 ? (_e$n = e[n]) !== null && _e$n !== void 0 ? _e$n : e[n] = i : ((_e$n2 = e[n]) !== null && _e$n2 !== void 0 ? _e$n2 : e[n] = {}, t.shift(), z.setPropertyValueIfDoesNotExist(e[n], t, i));
|
12211
12224
|
}
|
12212
12225
|
}, {
|
12213
12226
|
key: "setPropertyValue",
|
12214
12227
|
value: function setPropertyValue(e, t, i) {
|
12215
12228
|
var _e$n3;
|
12216
12229
|
var n = t[0];
|
12217
|
-
t.length === 1 ? e[n] = i : ((_e$n3 = e[n]) !== null && _e$n3 !== void 0 ? _e$n3 : e[n] = {}, t.shift(),
|
12230
|
+
t.length === 1 ? e[n] = i : ((_e$n3 = e[n]) !== null && _e$n3 !== void 0 ? _e$n3 : e[n] = {}, t.shift(), z.setPropertyValue(e[n], t, i));
|
12218
12231
|
}
|
12219
12232
|
}, {
|
12220
12233
|
key: "getObjectValue",
|
12221
12234
|
value: function getObjectValue(e, t) {
|
12222
12235
|
var i = t[0],
|
12223
12236
|
n = e[i];
|
12224
|
-
return n === void 0 || t.length === 1 ? n :
|
12237
|
+
return n === void 0 || t.length === 1 ? n : z.getObjectValue(n, t.slice(1));
|
12225
12238
|
}
|
12226
12239
|
}, {
|
12227
12240
|
key: "overwritePropertyObjectFromAnother",
|
12228
12241
|
value: function overwritePropertyObjectFromAnother(e, t, i) {
|
12229
|
-
var n =
|
12242
|
+
var n = z.getObjectValue(t, i);
|
12230
12243
|
if (n) {
|
12231
|
-
var r = _objectSpread(_objectSpread({}, n),
|
12232
|
-
|
12244
|
+
var r = _objectSpread(_objectSpread({}, n), z.getObjectValue(e, i) || {});
|
12245
|
+
z.setPropertyValue(e, i, r);
|
12233
12246
|
}
|
12234
12247
|
}
|
12235
12248
|
}]);
|
12236
|
-
return
|
12249
|
+
return z;
|
12237
12250
|
}();
|
12238
12251
|
var Ie = /*#__PURE__*/function () {
|
12239
12252
|
function Ie() {
|
@@ -12249,13 +12262,13 @@ var Ie = /*#__PURE__*/function () {
|
|
12249
12262
|
value: function overwriteDefaultStyleWithSubmit(e, t) {
|
12250
12263
|
if (!e.submit) return;
|
12251
12264
|
var i = JSON.parse(JSON.stringify(e[t] || {}));
|
12252
|
-
|
12265
|
+
z.overwritePropertyObjectFromAnother(i, e.submit, ["container", "default"]), z.overwritePropertyObjectFromAnother(i, e.submit, ["text", "styles", "default"]), z.overwritePropertyObjectFromAnother(i, e.submit, ["svg", "styles", "default"]), e[t] = i;
|
12253
12266
|
}
|
12254
12267
|
// prettier-ignore
|
12255
12268
|
}, {
|
12256
12269
|
key: "setUpDisabledButton",
|
12257
12270
|
value: function setUpDisabledButton(e) {
|
12258
|
-
|
12271
|
+
z.setPropertyValueIfDoesNotExist(e, ["submit", "container", "default", "backgroundColor"], ""), z.setPropertyValueIfDoesNotExist(e, ["disabled", "container", "default", "backgroundColor"], "unset"), z.setPropertyValueIfDoesNotExist(e.submit, ["svg", "styles", "default", "filter"], ""), z.setPropertyValueIfDoesNotExist(e.disabled, ["svg", "styles", "default", "filter"], "brightness(0) saturate(100%) invert(70%) sepia(0%) saturate(5564%) hue-rotate(207deg) brightness(100%) contrast(97%)"), Ie.overwriteDefaultStyleWithSubmit(e, "disabled");
|
12259
12272
|
}
|
12260
12273
|
}, {
|
12261
12274
|
key: "process",
|
@@ -12533,7 +12546,7 @@ var _i = /*#__PURE__*/function (_Tt4) {
|
|
12533
12546
|
}, {
|
12534
12547
|
key: "createSubmitIconElement",
|
12535
12548
|
value: function createSubmitIconElement() {
|
12536
|
-
var e =
|
12549
|
+
var e = G.createSVGElement(Ca);
|
12537
12550
|
return e.id = "submit-icon", e;
|
12538
12551
|
}
|
12539
12552
|
}, {
|
@@ -12569,7 +12582,7 @@ var rn = /*#__PURE__*/function (_ct) {
|
|
12569
12582
|
var _this62$addButtonsAnd = _this62.addButtonsAndTheirEvents(t),
|
12570
12583
|
r = _this62$addButtonsAnd.captureButton,
|
12571
12584
|
o = _this62$addButtonsAnd.submitButton;
|
12572
|
-
_this62._captureButton = r, _this62._submitButton = o, _this62._captureIcon = _this62._captureButton.children[0], _this62._refreshIcon =
|
12585
|
+
_this62._captureButton = r, _this62._submitButton = o, _this62._captureIcon = _this62._captureButton.children[0], _this62._refreshIcon = G.createSVGElement(ka), _this62._refreshIcon.classList.add("modal-svg-button-icon", "modal-svg-refresh-icon"), (n == null ? void 0 : n.format) === "jpeg" && (_this62._format = "image/jpeg"), n != null && n.dimensions && (_this62._dimensions = n.dimensions), _this62._contentRef.appendChild(_this62._canvas), _this62.extensionCloseCallback = _this62.stop;
|
12573
12586
|
return _this62;
|
12574
12587
|
}
|
12575
12588
|
_createClass(rn, [{
|
@@ -12714,7 +12727,7 @@ var ei = /*#__PURE__*/function (_Tt5) {
|
|
12714
12727
|
}, {
|
12715
12728
|
key: "createSVGIconElement",
|
12716
12729
|
value: function createSVGIconElement() {
|
12717
|
-
var e =
|
12730
|
+
var e = G.createSVGElement(Na);
|
12718
12731
|
return e.id = "camera-icon", e;
|
12719
12732
|
}
|
12720
12733
|
}]);
|
@@ -12805,7 +12818,7 @@ var on = /*#__PURE__*/function () {
|
|
12805
12818
|
var n = document.createElement("div");
|
12806
12819
|
n.id = "chat-view";
|
12807
12820
|
var r = new me(e, t, i);
|
12808
|
-
t.websocket &&
|
12821
|
+
t.websocket && F.createConnection(t, r);
|
12809
12822
|
var o = new mt(e, r, t, n);
|
12810
12823
|
return Z.addElements(n, r.elementRef, o.elementRef), n;
|
12811
12824
|
}
|
@@ -12855,7 +12868,7 @@ var v = /*#__PURE__*/function (_So) {
|
|
12855
12868
|
key: "onRender",
|
12856
12869
|
value: function onRender() {
|
12857
12870
|
var _this$_childElement;
|
12858
|
-
(!this._activeService || this._activeService.demo) && (this._activeService = $o.create(this)), this.auxiliaryStyle && !this._auxiliaryStyleApplied && (wi.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), wi.applyDefaultStyleToComponent(this.style, this.chatStyle), Re.checkForContainerStyles(this, this._elementRef), this._activeService.key && this._activeService.validateConfigKey ? Bt.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : !(this._activeService instanceof
|
12871
|
+
(!this._activeService || this._activeService.demo) && (this._activeService = $o.create(this)), this.auxiliaryStyle && !this._auxiliaryStyleApplied && (wi.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), wi.applyDefaultStyleToComponent(this.style, this.chatStyle), Re.checkForContainerStyles(this, this._elementRef), this._activeService.key && this._activeService.validateConfigKey ? Bt.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : !(this._activeService instanceof q) || this._activeService.key ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], on.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof q && P.render(this._elementRef, this.changeToChatView.bind(this), this._activeService), this._hasBeenRendered = !0, Ft.onRender(this);
|
12859
12872
|
}
|
12860
12873
|
}, {
|
12861
12874
|
key: "disconnectedCallback",
|