deep-chat-dev 9.0.89 → 9.0.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +6183 -6156
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.js +359 -352
- package/dist/views/chat/messages/messages.d.ts.map +1 -1
- package/dist/webModel/webModel.d.ts +2 -0
- package/dist/webModel/webModel.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/deepChat.js
CHANGED
@@ -241,28 +241,28 @@ var ps = /*#__PURE__*/function () {
|
|
241
241
|
return ps;
|
242
242
|
}();
|
243
243
|
var Pn = /*#__PURE__*/function () {
|
244
|
-
function
|
244
|
+
function qe(e, t) {
|
245
245
|
var _this = this;
|
246
|
-
_classCallCheck(this,
|
246
|
+
_classCallCheck(this, qe);
|
247
247
|
var n;
|
248
|
-
var i =
|
249
|
-
this.elementRef =
|
248
|
+
var i = qe.processConfig(t, e.textInput);
|
249
|
+
this.elementRef = qe.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
|
hs.add(_this.inputElementRef, (r = e.textInput) == null ? void 0 : r.characterLimit, e._validationHandler);
|
252
252
|
});
|
253
253
|
}
|
254
|
-
_createClass(
|
254
|
+
_createClass(qe, [{
|
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 = qe.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!", me.IS_CHROMIUM && qe.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 && (M.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 && (M.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)), qe.clear(this.inputElementRef), this.inputElementRef.classList.remove("text-input-placeholder"));
|
266
266
|
}
|
267
267
|
}, {
|
268
268
|
key: "addEventListeners",
|
@@ -334,7 +334,7 @@ var Pn = /*#__PURE__*/function () {
|
|
334
334
|
return t.id = "text-input-container", Object.assign(t.style, e), t;
|
335
335
|
}
|
336
336
|
}]);
|
337
|
-
return
|
337
|
+
return qe;
|
338
338
|
}();
|
339
339
|
Pn.TEXT_INPUT_ID = "text-input";
|
340
340
|
var Bi = Pn;
|
@@ -747,11 +747,11 @@ var se = /*#__PURE__*/function () {
|
|
747
747
|
}]);
|
748
748
|
return se;
|
749
749
|
}();
|
750
|
-
var
|
751
|
-
function
|
752
|
-
_classCallCheck(this,
|
750
|
+
var Ye = /*#__PURE__*/function () {
|
751
|
+
function Ye() {
|
752
|
+
_classCallCheck(this, Ye);
|
753
753
|
}
|
754
|
-
_createClass(
|
754
|
+
_createClass(Ye, null, [{
|
755
755
|
key: "addElement",
|
756
756
|
value: function addElement(e, t) {
|
757
757
|
e.elementRef.appendChild(t), e.elementRef.scrollTop = e.elementRef.scrollHeight;
|
@@ -778,11 +778,11 @@ var Je = /*#__PURE__*/function () {
|
|
778
778
|
var l = this.overwrite(e, t, i, n);
|
779
779
|
if (l) return l;
|
780
780
|
}
|
781
|
-
var o =
|
782
|
-
return v.fillEmptyMessageElement(o.bubbleElement, t), se.apply(e, o.outerContainer), Ae.flagHTMLUpdateClass(o.bubbleElement), e.applyCustomStyles(o, i, !1, (a = e.messageStyles) == null ? void 0 : a.html),
|
781
|
+
var o = Ye.createElements(e, t, i);
|
782
|
+
return v.fillEmptyMessageElement(o.bubbleElement, t), se.apply(e, o.outerContainer), Ae.flagHTMLUpdateClass(o.bubbleElement), e.applyCustomStyles(o, i, !1, (a = e.messageStyles) == null ? void 0 : a.html), Ye.addElement(e, o.outerContainer), o;
|
783
783
|
}
|
784
784
|
}]);
|
785
|
-
return
|
785
|
+
return Ye;
|
786
786
|
}();
|
787
787
|
var Tt;
|
788
788
|
function zn(s) {
|
@@ -1432,7 +1432,7 @@ var qs = /['"]/,
|
|
1432
1432
|
function an(s, e) {
|
1433
1433
|
return e < 0 || e >= s.length ? !1 : !Us.test(s[e]);
|
1434
1434
|
}
|
1435
|
-
function
|
1435
|
+
function Fe(s, e, t) {
|
1436
1436
|
return s.substr(0, e) + t + s.substr(e + 1);
|
1437
1437
|
}
|
1438
1438
|
function Hs(s) {
|
@@ -1444,12 +1444,12 @@ function Hs(s) {
|
|
1444
1444
|
S.length = h + 1, i = t.content, r = 0, o = i.length;
|
1445
1445
|
e: for (; r < o && (rn.lastIndex = r, n = rn.exec(i), !!n);) {
|
1446
1446
|
if (l = !an(i, n.index - 1), r = n.index + 1, g = n[0] === "'", c = !an(i, r), !c && !l) {
|
1447
|
-
g && (t.content =
|
1447
|
+
g && (t.content = Fe(t.content, n.index, on));
|
1448
1448
|
continue;
|
1449
1449
|
}
|
1450
1450
|
if (u = !c, p = !l, p) {
|
1451
1451
|
for (h = S.length - 1; h >= 0 && (d = S[h], !(S[h].level < a)); h--) if (d.single === g && S[h].level === a) {
|
1452
|
-
d = S[h], g ? (E[d.token].content =
|
1452
|
+
d = S[h], g ? (E[d.token].content = Fe(E[d.token].content, d.pos, s.options.quotes[2]), t.content = Fe(t.content, n.index, s.options.quotes[3])) : (E[d.token].content = Fe(E[d.token].content, d.pos, s.options.quotes[0]), t.content = Fe(t.content, n.index, s.options.quotes[1])), S.length = h;
|
1453
1453
|
continue e;
|
1454
1454
|
}
|
1455
1455
|
}
|
@@ -1458,7 +1458,7 @@ function Hs(s) {
|
|
1458
1458
|
pos: n.index,
|
1459
1459
|
single: g,
|
1460
1460
|
level: a
|
1461
|
-
}) : p && g && (t.content =
|
1461
|
+
}) : p && g && (t.content = Fe(t.content, n.index, on));
|
1462
1462
|
}
|
1463
1463
|
}
|
1464
1464
|
}
|
@@ -1657,7 +1657,7 @@ function Ys(s, e, t, i) {
|
|
1657
1657
|
E,
|
1658
1658
|
S,
|
1659
1659
|
G,
|
1660
|
-
|
1660
|
+
A,
|
1661
1661
|
V,
|
1662
1662
|
Q,
|
1663
1663
|
ee = !0,
|
@@ -1677,11 +1677,11 @@ function Ys(s, e, t, i) {
|
|
1677
1677
|
type: "bullet_list_open",
|
1678
1678
|
lines: V = [e, 0],
|
1679
1679
|
level: s.level++
|
1680
|
-
}), n = e,
|
1680
|
+
}), n = e, A = !1, he = s.parser.ruler.getRules("list"); n < t && (S = s.skipSpaces(u), p = s.eMarks[n], S >= p ? h = 1 : h = S - u, h > 4 && (h = 1), h < 1 && (h = 1), r = u - s.bMarks[n] + h, s.tokens.push({
|
1681
1681
|
type: "list_item_open",
|
1682
1682
|
lines: Q = [e, 0],
|
1683
1683
|
level: s.level++
|
1684
|
-
}), a = s.blkIndent, l = s.tight, o = s.tShift[e], c = s.parentType, s.tShift[e] = S - s.bMarks[e], s.blkIndent = r, s.tight = !0, s.parentType = "list", s.parser.tokenize(s, e, t, !0), (!s.tight ||
|
1684
|
+
}), a = s.blkIndent, l = s.tight, o = s.tShift[e], c = s.parentType, s.tShift[e] = S - s.bMarks[e], s.blkIndent = r, s.tight = !0, s.parentType = "list", s.parser.tokenize(s, e, t, !0), (!s.tight || A) && (ee = !1), A = s.line - e > 1 && s.isEmpty(s.line - 1), s.blkIndent = a, s.tShift[e] = o, s.tight = l, s.parentType = c, s.tokens.push({
|
1685
1685
|
type: "list_item_close",
|
1686
1686
|
level: --s.level
|
1687
1687
|
}), n = e = s.line, Q[1] = n, S = s.bMarks[e], !(n >= t || s.isEmpty(n) || s.tShift[n] < s.blkIndent));) {
|
@@ -2892,11 +2892,11 @@ var le = /*#__PURE__*/function () {
|
|
2892
2892
|
}]);
|
2893
2893
|
return le;
|
2894
2894
|
}();
|
2895
|
-
var
|
2896
|
-
function
|
2897
|
-
_classCallCheck(this,
|
2895
|
+
var Ge = /*#__PURE__*/function () {
|
2896
|
+
function Ge() {
|
2897
|
+
_classCallCheck(this, Ge);
|
2898
2898
|
}
|
2899
|
-
_createClass(
|
2899
|
+
_createClass(Ge, null, [{
|
2900
2900
|
key: "getPosition",
|
2901
2901
|
value: function getPosition(e, t) {
|
2902
2902
|
var _i5, _i6, _i7;
|
@@ -2920,28 +2920,28 @@ var He = /*#__PURE__*/function () {
|
|
2920
2920
|
key: "createName",
|
2921
2921
|
value: function createName(e, t) {
|
2922
2922
|
var i = document.createElement("div");
|
2923
|
-
return i.classList.add("name"), i.textContent =
|
2923
|
+
return i.classList.add("name"), i.textContent = Ge.getNameText(e, t), Ge.applyStyle(i, e, t), i;
|
2924
2924
|
}
|
2925
2925
|
}, {
|
2926
2926
|
key: "add",
|
2927
2927
|
value: function add(e, t, i) {
|
2928
2928
|
var n = typeof i == "boolean" ? {} : i,
|
2929
|
-
r =
|
2930
|
-
o =
|
2929
|
+
r = Ge.createName(t, n),
|
2930
|
+
o = Ge.getPosition(t, n);
|
2931
2931
|
r.classList.add(o === "left" ? "left-item-position" : "right-item-position"), e.insertAdjacentElement(o === "left" ? "beforebegin" : "afterend", r);
|
2932
2932
|
}
|
2933
2933
|
}]);
|
2934
|
-
return
|
2934
|
+
return Ge;
|
2935
2935
|
}();
|
2936
|
-
var
|
2937
|
-
function
|
2936
|
+
var We = /*#__PURE__*/function () {
|
2937
|
+
function We(e) {
|
2938
2938
|
var _this3 = this;
|
2939
|
-
_classCallCheck(this,
|
2940
|
-
this.messageElementRefs = [], this.messages = [], this.htmlClassUtilities = {}, this.textElementsToText = [], this.elementRef =
|
2939
|
+
_classCallCheck(this, We);
|
2940
|
+
this.messageElementRefs = [], this.messages = [], this.htmlClassUtilities = {}, this.textElementsToText = [], this.elementRef = We.createContainerElement(), this.messageStyles = e.messageStyles, this._remarkable = Li.createNew(), this._avatars = e.avatars, this._names = e.names, this._onNewMessage = Ui.onNewMessage.bind(this, e), e.htmlClassUtilities && (this.htmlClassUtilities = e.htmlClassUtilities), setTimeout(function () {
|
2941
2941
|
_this3.submitUserMessage = e.submitUserMessage;
|
2942
2942
|
});
|
2943
2943
|
}
|
2944
|
-
_createClass(
|
2944
|
+
_createClass(We, [{
|
2945
2945
|
key: "addNewTextMessage",
|
2946
2946
|
value: function addNewTextMessage(e, t) {
|
2947
2947
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
|
@@ -2978,12 +2978,12 @@ var Ve = /*#__PURE__*/function () {
|
|
2978
2978
|
var n;
|
2979
2979
|
(n = this._introPanel) == null || n.hide();
|
2980
2980
|
var i = this.messageElementRefs[this.messageElementRefs.length - 1];
|
2981
|
-
return
|
2981
|
+
return We.isTemporaryElement(i) && (i.outerContainer.remove(), this.messageElementRefs.pop()), this.createMessageElements(e, t);
|
2982
2982
|
}
|
2983
2983
|
}, {
|
2984
2984
|
key: "createMessageElements",
|
2985
2985
|
value: function createMessageElements(e, t) {
|
2986
|
-
var i =
|
2986
|
+
var i = We.createBaseElements(),
|
2987
2987
|
n = i.outerContainer,
|
2988
2988
|
r = i.innerContainer,
|
2989
2989
|
o = i.bubbleElement;
|
@@ -2994,7 +2994,7 @@ var Ve = /*#__PURE__*/function () {
|
|
2994
2994
|
value:
|
2995
2995
|
// prettier-ignore
|
2996
2996
|
function addInnerContainerElements(e, t, i) {
|
2997
|
-
return e.classList.add("message-bubble", v.getRoleClass(i), i === v.USER_ROLE ? "user-message-text" : "ai-message-text"), this.renderText(e, t), this._avatars && le.add(e, i, this._avatars), this._names &&
|
2997
|
+
return e.classList.add("message-bubble", v.getRoleClass(i), i === v.USER_ROLE ? "user-message-text" : "ai-message-text"), this.renderText(e, t), this._avatars && le.add(e, i, this._avatars), this._names && Ge.add(e, i, this._names), {
|
2998
2998
|
bubbleElement: e
|
2999
2999
|
};
|
3000
3000
|
}
|
@@ -3063,7 +3063,7 @@ var Ve = /*#__PURE__*/function () {
|
|
3063
3063
|
return t && (a.text = t), i && (a.files = i), n && (a.html = n), !t && !i && !n && (a.text = ""), r && (a._sessionId = r), a;
|
3064
3064
|
}
|
3065
3065
|
}]);
|
3066
|
-
return
|
3066
|
+
return We;
|
3067
3067
|
}();
|
3068
3068
|
var Hi = /*#__PURE__*/function () {
|
3069
3069
|
// used for extracting at end and for isStreaming
|
@@ -3090,7 +3090,7 @@ var Hi = /*#__PURE__*/function () {
|
|
3090
3090
|
key: "setInitialState",
|
3091
3091
|
value: function setInitialState(e, t, i) {
|
3092
3092
|
var _i8;
|
3093
|
-
this._streamType = e, (_i8 = i) !== null && _i8 !== void 0 ? _i8 : i = v.AI_ROLE, this._elements = e === "text" ? this._messages.addNewTextMessage(t, i) :
|
3093
|
+
this._streamType = e, (_i8 = i) !== null && _i8 !== void 0 ? _i8 : i = v.AI_ROLE, this._elements = e === "text" ? this._messages.addNewTextMessage(t, i) : Ye.add(this._messages, t, i, this._messages.messageElementRefs), this._activeMessageContent = this._messages.messages[this._messages.messages.length - 1], this._elements.bubbleElement.classList.add(it.MESSAGE_CLASS), this._streamedContent = t;
|
3094
3094
|
}
|
3095
3095
|
}, {
|
3096
3096
|
key: "updateBasedOnType",
|
@@ -3118,14 +3118,14 @@ var Hi = /*#__PURE__*/function () {
|
|
3118
3118
|
var _this$_messages = this._messages,
|
3119
3119
|
e = _this$_messages.textElementsToText,
|
3120
3120
|
t = _this$_messages.elementRef;
|
3121
|
-
(i = v.getLastMessageBubbleElement(t)) != null && i.classList.contains(it.MESSAGE_CLASS) && (this._streamType === "text" ? (e[e.length - 1][1] = this._streamedContent, this._activeMessageContent && (this._activeMessageContent.text = this._streamedContent), this._messages.textToSpeech && Lt.speak(this._streamedContent, this._messages.textToSpeech)) : this._streamType === "html" && (this._streamedContent === it.HTML_CONTENT_PLACEHOLDER && (this._streamedContent = ((n = v.getLastMessageBubbleElement(this._messages.elementRef)) == null ? void 0 : n.innerHTML) || ""), this._elements && se.apply(this._messages, this._elements.outerContainer), this._activeMessageContent && (this._activeMessageContent.html = this._streamedContent)), this._activeMessageContent && this._messages.sendClientUpdate(
|
3121
|
+
(i = v.getLastMessageBubbleElement(t)) != null && i.classList.contains(it.MESSAGE_CLASS) && (this._streamType === "text" ? (e[e.length - 1][1] = this._streamedContent, this._activeMessageContent && (this._activeMessageContent.text = this._streamedContent), this._messages.textToSpeech && Lt.speak(this._streamedContent, this._messages.textToSpeech)) : this._streamType === "html" && (this._streamedContent === it.HTML_CONTENT_PLACEHOLDER && (this._streamedContent = ((n = v.getLastMessageBubbleElement(this._messages.elementRef)) == null ? void 0 : n.innerHTML) || ""), this._elements && se.apply(this._messages, this._elements.outerContainer), this._activeMessageContent && (this._activeMessageContent.html = this._streamedContent)), this._activeMessageContent && this._messages.sendClientUpdate(We.createMessageContent(this._activeMessageContent), !1), this._hasStreamEnded = !0);
|
3122
3122
|
}
|
3123
3123
|
}]);
|
3124
3124
|
return it;
|
3125
3125
|
}();
|
3126
3126
|
Hi.MESSAGE_CLASS = "streamed-message";
|
3127
3127
|
Hi.HTML_CONTENT_PLACEHOLDER = "htmlplaceholder";
|
3128
|
-
var
|
3128
|
+
var $e = Hi;
|
3129
3129
|
var Zn = /*#__PURE__*/function () {
|
3130
3130
|
function nt() {
|
3131
3131
|
_classCallCheck(this, nt);
|
@@ -3382,7 +3382,7 @@ function ao(s, e) {
|
|
3382
3382
|
t == null || t.addEventListener("abort", function () {
|
3383
3383
|
G(), u();
|
3384
3384
|
});
|
3385
|
-
var
|
3385
|
+
var A = c !== null && c !== void 0 ? c : window.fetch,
|
3386
3386
|
V = n !== null && n !== void 0 ? n : lo;
|
3387
3387
|
function Q() {
|
3388
3388
|
return _Q.apply(this, arguments);
|
@@ -3396,7 +3396,7 @@ function ao(s, e) {
|
|
3396
3396
|
g = new AbortController();
|
3397
3397
|
_context3.prev = 1;
|
3398
3398
|
_context3.next = 4;
|
3399
|
-
return
|
3399
|
+
return A(s, Object.assign(Object.assign({}, d), {
|
3400
3400
|
headers: h,
|
3401
3401
|
signal: g.signal
|
3402
3402
|
}));
|
@@ -3493,7 +3493,7 @@ var Xn = /*#__PURE__*/function () {
|
|
3493
3493
|
_context4.t0 = i;
|
3494
3494
|
case 5:
|
3495
3495
|
n = _context4.t0;
|
3496
|
-
n.error ? (t.addNewErrorMessage("service", n.error), e.completionsHandlers.onFinish()) :
|
3496
|
+
n.error ? (t.addNewErrorMessage("service", n.error), e.completionsHandlers.onFinish()) : C.isSimulation(e.deepChat.stream) ? C.simulate(t, e.streamHandlers, n) : (t.addNewMessage(n), e.completionsHandlers.onFinish());
|
3497
3497
|
case 7:
|
3498
3498
|
case "end":
|
3499
3499
|
return _context4.stop();
|
@@ -3507,7 +3507,7 @@ var Xn = /*#__PURE__*/function () {
|
|
3507
3507
|
value: function requestStream(e, t) {
|
3508
3508
|
setTimeout(function () {
|
3509
3509
|
var i = st.getResponse(e);
|
3510
|
-
|
3510
|
+
C.simulate(e, t, i);
|
3511
3511
|
}, 400);
|
3512
3512
|
}
|
3513
3513
|
}]);
|
@@ -3515,11 +3515,11 @@ var Xn = /*#__PURE__*/function () {
|
|
3515
3515
|
}();
|
3516
3516
|
Xn.URL = "deep-chat-demo";
|
3517
3517
|
var be = Xn;
|
3518
|
-
var
|
3519
|
-
function
|
3520
|
-
_classCallCheck(this,
|
3518
|
+
var C = /*#__PURE__*/function () {
|
3519
|
+
function C() {
|
3520
|
+
_classCallCheck(this, C);
|
3521
3521
|
}
|
3522
|
-
_createClass(
|
3522
|
+
_createClass(C, null, [{
|
3523
3523
|
key: "request",
|
3524
3524
|
value: // prettier-ignore
|
3525
3525
|
function () {
|
@@ -3565,7 +3565,7 @@ var T = /*#__PURE__*/function () {
|
|
3565
3565
|
_context6.next = 14;
|
3566
3566
|
break;
|
3567
3567
|
}
|
3568
|
-
return _context6.abrupt("return",
|
3568
|
+
return _context6.abrupt("return", C.onInterceptorError(i, l, d));
|
3569
3569
|
case 14:
|
3570
3570
|
if (!((g = e.requestSettings) != null && g.handler)) {
|
3571
3571
|
_context6.next = 16;
|
@@ -3579,7 +3579,7 @@ var T = /*#__PURE__*/function () {
|
|
3579
3579
|
}
|
3580
3580
|
return _context6.abrupt("return", be.requestStream(i, e.streamHandlers));
|
3581
3581
|
case 18:
|
3582
|
-
p = new
|
3582
|
+
p = new $e(i);
|
3583
3583
|
ao(((E = e.requestSettings) == null ? void 0 : E.url) || e.url || "", {
|
3584
3584
|
method: ((S = e.requestSettings) == null ? void 0 : S.method) || "POST",
|
3585
3585
|
headers: a,
|
@@ -3587,19 +3587,19 @@ var T = /*#__PURE__*/function () {
|
|
3587
3587
|
body: n ? JSON.stringify(o) : o,
|
3588
3588
|
openWhenHidden: !0,
|
3589
3589
|
// keep stream open when browser tab not open
|
3590
|
-
onopen: function onopen(
|
3590
|
+
onopen: function onopen(A) {
|
3591
3591
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
3592
3592
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
3593
3593
|
while (1) switch (_context5.prev = _context5.next) {
|
3594
3594
|
case 0:
|
3595
|
-
if (!
|
3595
|
+
if (!A.ok) {
|
3596
3596
|
_context5.next = 2;
|
3597
3597
|
break;
|
3598
3598
|
}
|
3599
3599
|
return _context5.abrupt("return", c());
|
3600
3600
|
case 2:
|
3601
3601
|
_context5.next = 4;
|
3602
|
-
return _.processResponseByType(
|
3602
|
+
return _.processResponseByType(A);
|
3603
3603
|
case 4:
|
3604
3604
|
throw _context5.sent;
|
3605
3605
|
case 5:
|
@@ -3609,10 +3609,10 @@ var T = /*#__PURE__*/function () {
|
|
3609
3609
|
}, _callee5);
|
3610
3610
|
}))();
|
3611
3611
|
},
|
3612
|
-
onmessage: function onmessage(
|
3612
|
+
onmessage: function onmessage(A) {
|
3613
3613
|
var V;
|
3614
|
-
if (JSON.stringify(
|
3615
|
-
var Q = JSON.parse(
|
3614
|
+
if (JSON.stringify(A.data) !== JSON.stringify("[DONE]")) {
|
3615
|
+
var Q = JSON.parse(A.data);
|
3616
3616
|
(V = e.extractResultData) == null || V.call(e, Q).then(function (ee) {
|
3617
3617
|
p.upsertStreamedMessage(ee);
|
3618
3618
|
})["catch"](function (ee) {
|
@@ -3620,17 +3620,17 @@ var T = /*#__PURE__*/function () {
|
|
3620
3620
|
});
|
3621
3621
|
}
|
3622
3622
|
},
|
3623
|
-
onerror: function onerror(
|
3624
|
-
throw d(),
|
3623
|
+
onerror: function onerror(A) {
|
3624
|
+
throw d(), A;
|
3625
3625
|
},
|
3626
3626
|
onclose: function onclose() {
|
3627
3627
|
p.finaliseStreamedMessage(), d();
|
3628
3628
|
},
|
3629
3629
|
signal: u.signal
|
3630
|
-
})["catch"](function (
|
3630
|
+
})["catch"](function (A) {
|
3631
3631
|
var V;
|
3632
|
-
(V = e.extractResultData) == null || V.call(e,
|
3633
|
-
_.displayError(i,
|
3632
|
+
(V = e.extractResultData) == null || V.call(e, A).then(function () {
|
3633
|
+
_.displayError(i, A);
|
3634
3634
|
})["catch"](function (Q) {
|
3635
3635
|
_.displayError(i, Q);
|
3636
3636
|
});
|
@@ -3661,7 +3661,7 @@ var T = /*#__PURE__*/function () {
|
|
3661
3661
|
}, i), !1), i.text) {
|
3662
3662
|
t.onOpen();
|
3663
3663
|
var r = i.text.split("");
|
3664
|
-
|
3664
|
+
C.populateMessages(r, new $e(e), n);
|
3665
3665
|
}
|
3666
3666
|
}
|
3667
3667
|
}, {
|
@@ -3674,10 +3674,10 @@ var T = /*#__PURE__*/function () {
|
|
3674
3674
|
text: r
|
3675
3675
|
});
|
3676
3676
|
var o = setTimeout(function () {
|
3677
|
-
|
3677
|
+
C.populateMessages(e, t, i, n + 1);
|
3678
3678
|
}, i.simulationInterim || 6);
|
3679
3679
|
i.abortStream.abort = function () {
|
3680
|
-
|
3680
|
+
C.abort(o, t, i.onClose);
|
3681
3681
|
};
|
3682
3682
|
} else t.finaliseStreamedMessage(), i.onClose();
|
3683
3683
|
}
|
@@ -3692,7 +3692,7 @@ var T = /*#__PURE__*/function () {
|
|
3692
3692
|
clearTimeout(e), t.finaliseStreamedMessage(), i();
|
3693
3693
|
}
|
3694
3694
|
}]);
|
3695
|
-
return
|
3695
|
+
return C;
|
3696
3696
|
}();
|
3697
3697
|
var Ce = /*#__PURE__*/function () {
|
3698
3698
|
function Ce() {
|
@@ -3731,7 +3731,7 @@ var Ce = /*#__PURE__*/function () {
|
|
3731
3731
|
_context7.t0 = c;
|
3732
3732
|
case 8:
|
3733
3733
|
d = _context7.t0;
|
3734
|
-
_.validateResponseFormat(d) ? typeof d.error == "string" ? (console.error(d.error), i.addNewErrorMessage("service", d.error), e.completionsHandlers.onFinish()) :
|
3734
|
+
_.validateResponseFormat(d) ? typeof d.error == "string" ? (console.error(d.error), i.addNewErrorMessage("service", d.error), e.completionsHandlers.onFinish()) : C.isSimulation(e.deepChat.stream) ? C.simulate(i, e.streamHandlers, d) : (i.addNewMessage(d), e.completionsHandlers.onFinish()) : (console.error(I.INVALID_RESPONSE(c, "server", !!e.deepChat.responseInterceptor, d)), i.addNewErrorMessage("service", "Error in server message"), e.completionsHandlers.onFinish());
|
3735
3735
|
case 10:
|
3736
3736
|
case "end":
|
3737
3737
|
return _context7.stop();
|
@@ -3762,7 +3762,7 @@ var Ce = /*#__PURE__*/function () {
|
|
3762
3762
|
var u, p;
|
3763
3763
|
var n = !0,
|
3764
3764
|
r = !1;
|
3765
|
-
var o = new
|
3765
|
+
var o = new $e(i),
|
3766
3766
|
a = function a() {
|
3767
3767
|
r || !n || (e.streamHandlers.onOpen(), r = !0);
|
3768
3768
|
},
|
@@ -3824,7 +3824,7 @@ var Ce = /*#__PURE__*/function () {
|
|
3824
3824
|
_context9.t0 = d;
|
3825
3825
|
case 7:
|
3826
3826
|
u = _context9.t0;
|
3827
|
-
_.validateResponseFormat(u) ? typeof u.error == "string" ? (console.error(u.error), t.isLastMessageError() || t.addNewErrorMessage("service", u.error)) : e.deepChat.stream ?
|
3827
|
+
_.validateResponseFormat(u) ? typeof u.error == "string" ? (console.error(u.error), t.isLastMessageError() || t.addNewErrorMessage("service", u.error)) : e.deepChat.stream ? C.simulate(t, e.streamHandlers, u) : t.addNewMessage(u) : (console.error(I.INVALID_RESPONSE(d, "server", !!e.deepChat.responseInterceptor, u)), t.addNewErrorMessage("service", "Error in server message"));
|
3828
3828
|
case 9:
|
3829
3829
|
case "end":
|
3830
3830
|
return _context9.stop();
|
@@ -3924,7 +3924,7 @@ var w = /*#__PURE__*/function () {
|
|
3924
3924
|
return _.processResponseByType(m);
|
3925
3925
|
}).then( /*#__PURE__*/function () {
|
3926
3926
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(m) {
|
3927
|
-
var G,
|
3927
|
+
var G, A, E, S;
|
3928
3928
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
3929
3929
|
while (1) switch (_context10.prev = _context10.next) {
|
3930
3930
|
case 0:
|
@@ -3935,7 +3935,7 @@ var w = /*#__PURE__*/function () {
|
|
3935
3935
|
return _context10.abrupt("return");
|
3936
3936
|
case 2:
|
3937
3937
|
_context10.next = 4;
|
3938
|
-
return (
|
3938
|
+
return (A = (G = e.deepChat).responseInterceptor) == null ? void 0 : A.call(G, m);
|
3939
3939
|
case 4:
|
3940
3940
|
_context10.t0 = _context10.sent;
|
3941
3941
|
if (_context10.t0) {
|
@@ -3961,7 +3961,7 @@ var w = /*#__PURE__*/function () {
|
|
3961
3961
|
}
|
3962
3962
|
throw Error(I.INVALID_RESPONSE(m, "response", !!e.deepChat.responseInterceptor, E));
|
3963
3963
|
case 15:
|
3964
|
-
S.makingAnotherRequest || (
|
3964
|
+
S.makingAnotherRequest || (C.isSimulation(e.deepChat.stream) ? C.simulate(i, e.streamHandlers, S) : (i.addNewMessage(S), c()));
|
3965
3965
|
case 16:
|
3966
3966
|
case "end":
|
3967
3967
|
return _context10.stop();
|
@@ -4021,7 +4021,7 @@ var w = /*#__PURE__*/function () {
|
|
4021
4021
|
a = _context12.sent;
|
4022
4022
|
a.timeoutMS ? setTimeout(function () {
|
4023
4023
|
w.executePollRequest(e, t, i, n);
|
4024
|
-
}, a.timeoutMS) :
|
4024
|
+
}, a.timeoutMS) : C.isSimulation(e.deepChat.stream) ? C.simulate(n, e.streamHandlers, a) : (n.addNewMessage(a), r());
|
4025
4025
|
case 13:
|
4026
4026
|
case "end":
|
4027
4027
|
return _context12.stop();
|
@@ -4117,11 +4117,11 @@ var w = /*#__PURE__*/function () {
|
|
4117
4117
|
}]);
|
4118
4118
|
return w;
|
4119
4119
|
}();
|
4120
|
-
var
|
4121
|
-
function
|
4122
|
-
_classCallCheck(this,
|
4120
|
+
var Ze = /*#__PURE__*/function () {
|
4121
|
+
function Ze() {
|
4122
|
+
_classCallCheck(this, Ze);
|
4123
4123
|
}
|
4124
|
-
_createClass(
|
4124
|
+
_createClass(Ze, null, [{
|
4125
4125
|
key: "getCharacterLimitMessages",
|
4126
4126
|
value: function getCharacterLimitMessages(e, t) {
|
4127
4127
|
var r;
|
@@ -4149,10 +4149,10 @@ var $e = /*#__PURE__*/function () {
|
|
4149
4149
|
}, {
|
4150
4150
|
key: "processMessages",
|
4151
4151
|
value: function processMessages(e, t, i) {
|
4152
|
-
return t !== void 0 ? t > 0 && (e =
|
4152
|
+
return t !== void 0 ? t > 0 && (e = Ze.getMaxMessages(e, t)) : e = [e[e.length - 1]], e = JSON.parse(JSON.stringify(e)), i === void 0 ? e : Ze.getCharacterLimitMessages(e, i);
|
4153
4153
|
}
|
4154
4154
|
}]);
|
4155
|
-
return
|
4155
|
+
return Ze;
|
4156
4156
|
}();
|
4157
4157
|
var Y = /*#__PURE__*/function () {
|
4158
4158
|
function Y() {
|
@@ -4228,7 +4228,7 @@ var Y = /*#__PURE__*/function () {
|
|
4228
4228
|
}
|
4229
4229
|
throw Error(I.INVALID_RESPONSE(a, "server", !!e.deepChat.responseInterceptor, l));
|
4230
4230
|
case 14:
|
4231
|
-
|
4231
|
+
C.isSimulation(e.deepChat.stream) ? C.simulate(i, e.streamHandlers, c) : i.addNewMessage(c);
|
4232
4232
|
_context14.next = 20;
|
4233
4233
|
break;
|
4234
4234
|
case 17:
|
@@ -4469,7 +4469,7 @@ var Ie = /*#__PURE__*/function () {
|
|
4469
4469
|
case 0:
|
4470
4470
|
i = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : !0;
|
4471
4471
|
n = this.deepChat.stream;
|
4472
|
-
return _context16.abrupt("return", n && !
|
4472
|
+
return _context16.abrupt("return", n && !C.isSimulation(n) ? C.request(this, e, t) : w.request(this, e, t, i));
|
4473
4473
|
case 3:
|
4474
4474
|
case "end":
|
4475
4475
|
return _context16.stop();
|
@@ -4568,7 +4568,7 @@ var Ie = /*#__PURE__*/function () {
|
|
4568
4568
|
}
|
4569
4569
|
throw new Error("Request settings have not been set up");
|
4570
4570
|
case 2:
|
4571
|
-
i =
|
4571
|
+
i = Ze.processMessages(t.messages, this.maxMessages, this.totalMessagesMaxCharLength);
|
4572
4572
|
if (this.requestSettings.websocket) {
|
4573
4573
|
n = _objectSpread({
|
4574
4574
|
messages: i
|
@@ -4714,19 +4714,19 @@ var Nt = /*#__PURE__*/function () {
|
|
4714
4714
|
return Nt;
|
4715
4715
|
}();
|
4716
4716
|
var Gi = /*#__PURE__*/function (_HTMLElement) {
|
4717
|
-
_inherits(
|
4718
|
-
var _super2 = _createSuper(
|
4717
|
+
_inherits(Ue, _HTMLElement);
|
4718
|
+
var _super2 = _createSuper(Ue);
|
4719
4719
|
// If this is not working, try using propertyName directly
|
4720
|
-
function
|
4720
|
+
function Ue() {
|
4721
4721
|
var _this7;
|
4722
|
-
_classCallCheck(this,
|
4723
|
-
_this7 = _super2.call(this), _this7._waitingToRender_ = !1, _this7._propUpdated_ = !1, Object.keys(
|
4724
|
-
var t =
|
4722
|
+
_classCallCheck(this, Ue);
|
4723
|
+
_this7 = _super2.call(this), _this7._waitingToRender_ = !1, _this7._propUpdated_ = !1, Object.keys(Ue._attributeToProperty_).forEach(function (e) {
|
4724
|
+
var t = Ue._attributeToProperty_[e];
|
4725
4725
|
_this7.constructPropertyAccessors(t), _this7.hasOwnProperty(e) || _this7.constructPropertyAccessors(t, e);
|
4726
4726
|
});
|
4727
4727
|
return _this7;
|
4728
4728
|
}
|
4729
|
-
_createClass(
|
4729
|
+
_createClass(Ue, [{
|
4730
4730
|
key: "constructPropertyAccessors",
|
4731
4731
|
value:
|
4732
4732
|
// need to be called here as accessors need to be set for the class instance
|
@@ -4745,8 +4745,8 @@ var Gi = /*#__PURE__*/function (_HTMLElement) {
|
|
4745
4745
|
key: "attributeChangedCallback",
|
4746
4746
|
value: function attributeChangedCallback(e, t, i) {
|
4747
4747
|
if (t === i) return;
|
4748
|
-
var n =
|
4749
|
-
r =
|
4748
|
+
var n = Ue._attributes_[e](i),
|
4749
|
+
r = Ue._attributeToProperty_[e];
|
4750
4750
|
this[r] = n;
|
4751
4751
|
}
|
4752
4752
|
}, {
|
@@ -4755,10 +4755,10 @@ var Gi = /*#__PURE__*/function (_HTMLElement) {
|
|
4755
4755
|
}], [{
|
4756
4756
|
key: "observedAttributes",
|
4757
4757
|
get: function get() {
|
4758
|
-
return Object.keys(
|
4758
|
+
return Object.keys(Ue._attributes_) || [];
|
4759
4759
|
}
|
4760
4760
|
}]);
|
4761
|
-
return
|
4761
|
+
return Ue;
|
4762
4762
|
}( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
|
4763
4763
|
Gi._attributes_ = {};
|
4764
4764
|
Gi._attributeToProperty_ = {};
|
@@ -4778,15 +4778,15 @@ var U = /*#__PURE__*/function () {
|
|
4778
4778
|
return U;
|
4779
4779
|
}();
|
4780
4780
|
var Qn = /*#__PURE__*/function () {
|
4781
|
-
function
|
4782
|
-
_classCallCheck(this,
|
4781
|
+
function He() {
|
4782
|
+
_classCallCheck(this, He);
|
4783
4783
|
}
|
4784
|
-
_createClass(
|
4784
|
+
_createClass(He, null, [{
|
4785
4785
|
key: "changeVisibility",
|
4786
4786
|
value:
|
4787
4787
|
// prettier-ignore
|
4788
4788
|
function changeVisibility(e, t, i, n) {
|
4789
|
-
n.target.id ===
|
4789
|
+
n.target.id === He.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");
|
4790
4790
|
}
|
4791
4791
|
}, {
|
4792
4792
|
key: "createIconElement",
|
@@ -4800,13 +4800,13 @@ var Qn = /*#__PURE__*/function () {
|
|
4800
4800
|
value: function create(e) {
|
4801
4801
|
var t = document.createElement("div");
|
4802
4802
|
t.id = "visibility-icon-container";
|
4803
|
-
var i =
|
4803
|
+
var i = He.createIconElement(ho, He.VISIBLE_ICON_ID);
|
4804
4804
|
i.style.display = "none", t.appendChild(i);
|
4805
|
-
var n =
|
4806
|
-
return t.appendChild(n), t.onclick =
|
4805
|
+
var n = He.createIconElement(uo, "not-visible-icon");
|
4806
|
+
return t.appendChild(n), t.onclick = He.changeVisibility.bind(this, e, i, n), t;
|
4807
4807
|
}
|
4808
4808
|
}]);
|
4809
|
-
return
|
4809
|
+
return He;
|
4810
4810
|
}();
|
4811
4811
|
Qn.VISIBLE_ICON_ID = "visible-icon";
|
4812
4812
|
var po = Qn;
|
@@ -7300,7 +7300,7 @@ var Ji = /*#__PURE__*/function (_z10) {
|
|
7300
7300
|
key: "processMessages",
|
7301
7301
|
value: function processMessages(e, t) {
|
7302
7302
|
var i = this.totalMessagesMaxCharLength || -1;
|
7303
|
-
return
|
7303
|
+
return Ze.getCharacterLimitMessages(e, i).map(function (n) {
|
7304
7304
|
return {
|
7305
7305
|
content: n.text || "",
|
7306
7306
|
role: n.role === v.USER_ROLE ? "user" : "assistant",
|
@@ -7755,7 +7755,7 @@ var lt = /*#__PURE__*/function (_z12) {
|
|
7755
7755
|
function preprocessBody(e, t) {
|
7756
7756
|
var _i$max_tokens;
|
7757
7757
|
var i = JSON.parse(JSON.stringify(e)),
|
7758
|
-
n =
|
7758
|
+
n = Ze.getCharacterLimitMessages(t, this.totalMessagesMaxCharLength ? this.totalMessagesMaxCharLength - this._systemMessage.content.length : -1).map(function (r) {
|
7759
7759
|
return {
|
7760
7760
|
content: lt.getContent(r),
|
7761
7761
|
role: r.role === v.USER_ROLE ? "user" : "assistant"
|
@@ -7780,7 +7780,7 @@ var lt = /*#__PURE__*/function (_z12) {
|
|
7780
7780
|
throw new Error("Request settings have not been set up");
|
7781
7781
|
case 2:
|
7782
7782
|
i = this.preprocessBody(this.rawBody, t), n = this.deepChat.stream;
|
7783
|
-
n && (_typeof(n) != "object" || !n.simulation) || i.stream ? (i.stream = !0,
|
7783
|
+
n && (_typeof(n) != "object" || !n.simulation) || i.stream ? (i.stream = !0, C.request(this, i, e)) : w.request(this, i, e);
|
7784
7784
|
case 4:
|
7785
7785
|
case "end":
|
7786
7786
|
return _context71.stop();
|
@@ -8111,28 +8111,23 @@ var mn = {
|
|
8111
8111
|
},
|
8112
8112
|
use_web_worker: !0
|
8113
8113
|
},
|
8114
|
-
|
8115
|
-
_inherits(
|
8116
|
-
var _super35 = _createSuper(
|
8117
|
-
function
|
8114
|
+
Pe = /*#__PURE__*/function (_Ie2) {
|
8115
|
+
_inherits(T, _Ie2);
|
8116
|
+
var _super35 = _createSuper(T);
|
8117
|
+
function T(e) {
|
8118
8118
|
var _this32;
|
8119
|
-
_classCallCheck(this,
|
8120
|
-
_this32 = _super35.call(this, e), _this32._isModelLoaded = !1, _this32._isModelLoading = !1, _this32._loadOnFirstMessage = !1, _this32.permittedErrorPrefixes = [
|
8119
|
+
_classCallCheck(this, T);
|
8120
|
+
_this32 = _super35.call(this, e), _this32._isModelLoaded = !1, _this32._isModelLoading = !1, _this32._loadOnFirstMessage = !1, _this32.permittedErrorPrefixes = [T.MULTIPLE_MODELS_ERROR, T.WEB_LLM_NOT_FOUND_ERROR, T.GENERIC_ERROR], _this32.webModel = {}, _typeof(e.webModel) == "object" && (_this32.webModel = e.webModel), _this32.findModelInWindow(e), _this32.canSendMessage = _this32.canSubmit.bind(_assertThisInitialized(_this32));
|
8121
8121
|
return _this32;
|
8122
8122
|
}
|
8123
|
-
_createClass(
|
8123
|
+
_createClass(T, [{
|
8124
8124
|
key: "findModelInWindow",
|
8125
8125
|
value: function findModelInWindow(e) {
|
8126
8126
|
var _this33 = this;
|
8127
8127
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
8128
8128
|
var i;
|
8129
|
-
|
8130
|
-
|
8131
|
-
this.configureInit(n), setTimeout(function () {
|
8132
|
-
console.log("call"), console.log(_this33._downloadButton), console.log(n), _this33._downloadButton && n && (_this33._downloadButton.disabled = !1);
|
8133
|
-
}, 10);
|
8134
|
-
} else t > 5 ? ((i = this.addMessage) == null || i.call(this, {
|
8135
|
-
error: A.WEB_LLM_NOT_FOUND_ERROR,
|
8129
|
+
window.webLLM ? this.configureInit(this.shouldAddInitialMessage(e.introMessage)) : t > T.MODULE_SEARCH_LIMIT_S ? ((i = this.addMessage) == null || i.call(this, {
|
8130
|
+
error: T.WEB_LLM_NOT_FOUND_ERROR,
|
8136
8131
|
sendUpdate: !1
|
8137
8132
|
}), console.error("The WebLLM module is either not in the project or not been attached to the window object. Please see the following guide:"), console.error("Hello World")) : setTimeout(function () {
|
8138
8133
|
_this33.findModelInWindow(e, t + 1);
|
@@ -8152,18 +8147,27 @@ var mn = {
|
|
8152
8147
|
t = _ref10.introMessage;
|
8153
8148
|
if (!this.shouldAddInitialMessage(t) || !e) return;
|
8154
8149
|
var i = this.webModel.introMessage,
|
8155
|
-
n = (i == null ? void 0 : i.downloadClass) ||
|
8150
|
+
n = (i == null ? void 0 : i.downloadClass) || T.DOWNLOAD_BUTTON_CLASS,
|
8156
8151
|
r = "\n Download a web model that will run entirely on your browser.\n <br/> <button disabled style=\"margin-top: 10px; margin-bottom: 5px; margin-left: 1px\"\n class=\"".concat(n, " deep-chat-button\">Download</button>"),
|
8157
8152
|
o = (i == null ? void 0 : i.html) || "<div>".concat(r, "</div>");
|
8158
8153
|
return setTimeout(function () {
|
8159
8154
|
var a;
|
8160
|
-
_this34._downloadButton = (a = e.children[0]) == null ? void 0 : a.getElementsByClassName(n)[0], _this34._downloadButton && (_this34._downloadButton.onclick = _this34.init.bind(_this34));
|
8155
|
+
_this34._downloadButton = (a = e.children[0]) == null ? void 0 : a.getElementsByClassName(n)[0], _this34._downloadButton && (_this34._downloadButton.onclick = _this34.init.bind(_this34), _this34.setEnabled(_this34._downloadButton));
|
8161
8156
|
}), {
|
8162
8157
|
role: v.AI_ROLE,
|
8163
8158
|
html: o,
|
8164
8159
|
sendUpdate: !1
|
8165
8160
|
};
|
8166
8161
|
}
|
8162
|
+
}, {
|
8163
|
+
key: "setEnabled",
|
8164
|
+
value: function setEnabled(e) {
|
8165
|
+
var _this35 = this;
|
8166
|
+
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
8167
|
+
window.webLLM ? e.disabled = !1 : t < T.MODULE_SEARCH_LIMIT_S * 4 && setTimeout(function () {
|
8168
|
+
return _this35.setEnabled(e, t + 1);
|
8169
|
+
}, 250);
|
8170
|
+
}
|
8167
8171
|
}, {
|
8168
8172
|
key: "configureInit",
|
8169
8173
|
value: function () {
|
@@ -8228,11 +8232,11 @@ var mn = {
|
|
8228
8232
|
key: "attemptToCreateChat",
|
8229
8233
|
value: function attemptToCreateChat() {
|
8230
8234
|
var t;
|
8231
|
-
if (
|
8235
|
+
if (T.chat) {
|
8232
8236
|
(t = this.addMessage) == null || t.call(this, {
|
8233
|
-
error:
|
8237
|
+
error: T.MULTIPLE_MODELS_ERROR,
|
8234
8238
|
sendUpdate: !1
|
8235
|
-
}), console.error(
|
8239
|
+
}), console.error(T.MULTIPLE_MODELS_ERROR);
|
8236
8240
|
return;
|
8237
8241
|
}
|
8238
8242
|
if (this._isModelLoaded || this._isModelLoading) return;
|
@@ -8242,7 +8246,7 @@ var mn = {
|
|
8242
8246
|
}, {
|
8243
8247
|
key: "getConfig",
|
8244
8248
|
value: function getConfig() {
|
8245
|
-
var e =
|
8249
|
+
var e = T.DEFAULT_MODEL;
|
8246
8250
|
this.webModel.model && (e = this.webModel.model);
|
8247
8251
|
var t = JSON.parse(JSON.stringify(mn));
|
8248
8252
|
if (this.webModel.modelUrl) {
|
@@ -8264,25 +8268,25 @@ var mn = {
|
|
8264
8268
|
key: "loadModel",
|
8265
8269
|
value: function () {
|
8266
8270
|
var _loadModel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee78(e) {
|
8267
|
-
var
|
8271
|
+
var _this36 = this;
|
8268
8272
|
var i, t, _this$getConfig, n, r;
|
8269
8273
|
return _regeneratorRuntime().wrap(function _callee78$(_context78) {
|
8270
8274
|
while (1) switch (_context78.prev = _context78.next) {
|
8271
8275
|
case 0:
|
8272
|
-
|
8276
|
+
T.chat = e, this._isModelLoading = !0;
|
8273
8277
|
t = function t(n) {
|
8274
8278
|
var r;
|
8275
|
-
(r =
|
8279
|
+
(r = _this36.addMessage) == null || r.call(_this36, {
|
8276
8280
|
html: "<div>".concat(n.text, "</div>"),
|
8277
8281
|
overwrite: !0,
|
8278
8282
|
sendUpdate: !1
|
8279
8283
|
});
|
8280
8284
|
};
|
8281
|
-
|
8285
|
+
T.chat.setInitProgressCallback(t);
|
8282
8286
|
_context78.prev = 3;
|
8283
8287
|
_this$getConfig = this.getConfig(), n = _this$getConfig.model, r = _this$getConfig.pConfig;
|
8284
8288
|
_context78.next = 7;
|
8285
|
-
return
|
8289
|
+
return T.chat.reload(n, {
|
8286
8290
|
conv_config: {
|
8287
8291
|
system: "keep responses to one sentence"
|
8288
8292
|
}
|
@@ -8373,7 +8377,7 @@ var mn = {
|
|
8373
8377
|
this.streamHandlers.abortStream.abort = function () {
|
8374
8378
|
i.interruptGenerate();
|
8375
8379
|
}, this.streamHandlers.onOpen();
|
8376
|
-
n = new
|
8380
|
+
n = new $e(e);
|
8377
8381
|
_context81.next = 4;
|
8378
8382
|
return i.generate(t, function (r, o) {
|
8379
8383
|
n.upsertStreamedMessage({
|
@@ -8423,7 +8427,7 @@ var mn = {
|
|
8423
8427
|
case 6:
|
8424
8428
|
return _context82.abrupt("return");
|
8425
8429
|
case 7:
|
8426
|
-
!
|
8430
|
+
!T.chat || this._isModelLoading || (e.addLoadingMessage(), this.generateResp(e, t, T.chat));
|
8427
8431
|
case 8:
|
8428
8432
|
case "end":
|
8429
8433
|
return _context82.stop();
|
@@ -8444,21 +8448,21 @@ var mn = {
|
|
8444
8448
|
while (1) switch (_context83.prev = _context83.next) {
|
8445
8449
|
case 0:
|
8446
8450
|
(t = this.addMessage) == null || t.call(this, {
|
8447
|
-
error:
|
8451
|
+
error: T.GENERIC_ERROR,
|
8448
8452
|
sendUpdate: !1
|
8449
8453
|
});
|
8450
8454
|
console.error(e);
|
8451
8455
|
this._isModelLoaded = !1;
|
8452
8456
|
this._isModelLoading = !1;
|
8453
|
-
_context83.t0 =
|
8457
|
+
_context83.t0 = T.chat;
|
8454
8458
|
if (!_context83.t0) {
|
8455
8459
|
_context83.next = 9;
|
8456
8460
|
break;
|
8457
8461
|
}
|
8458
8462
|
_context83.next = 8;
|
8459
|
-
return
|
8463
|
+
return T.chat.unload();
|
8460
8464
|
case 8:
|
8461
|
-
|
8465
|
+
T.chat = void 0;
|
8462
8466
|
case 9:
|
8463
8467
|
case "end":
|
8464
8468
|
return _context83.stop();
|
@@ -8476,14 +8480,15 @@ var mn = {
|
|
8476
8480
|
return !0;
|
8477
8481
|
}
|
8478
8482
|
}]);
|
8479
|
-
return
|
8483
|
+
return T;
|
8480
8484
|
}(Ie);
|
8481
|
-
|
8482
|
-
|
8483
|
-
|
8484
|
-
|
8485
|
-
|
8486
|
-
|
8485
|
+
Pe.DOWNLOAD_BUTTON_CLASS = "deep-chat-download-button";
|
8486
|
+
Pe.GENERIC_ERROR = "ERROR. Your browser may not support this model. Please check the following setup [instructions](https://webllm.mlc.ai/#instructions).";
|
8487
|
+
Pe.MULTIPLE_MODELS_ERROR = "Cannot run multiple web models";
|
8488
|
+
Pe.WEB_LLM_NOT_FOUND_ERROR = "WebLLM module not found";
|
8489
|
+
Pe.DEFAULT_MODEL = "Llama-2-7b-chat-hf-q4f32_1";
|
8490
|
+
Pe.MODULE_SEARCH_LIMIT_S = 5;
|
8491
|
+
var Po = Pe;
|
8487
8492
|
var Do = /*#__PURE__*/function () {
|
8488
8493
|
function Do() {
|
8489
8494
|
_classCallCheck(this, Do);
|
@@ -8724,27 +8729,27 @@ var pe = /*#__PURE__*/function () {
|
|
8724
8729
|
}]);
|
8725
8730
|
return pe;
|
8726
8731
|
}();
|
8727
|
-
var fe = /*#__PURE__*/function (
|
8728
|
-
_inherits(fe,
|
8732
|
+
var fe = /*#__PURE__*/function (_We) {
|
8733
|
+
_inherits(fe, _We);
|
8729
8734
|
var _super36 = _createSuper(fe);
|
8730
8735
|
function fe(e, t, i) {
|
8731
|
-
var
|
8736
|
+
var _this37;
|
8732
8737
|
_classCallCheck(this, fe);
|
8733
8738
|
var a, l;
|
8734
|
-
|
8739
|
+
_this37 = _super36.call(this, e);
|
8735
8740
|
var n = t.permittedErrorPrefixes,
|
8736
8741
|
r = t.introPanelMarkUp,
|
8737
8742
|
o = t.demo;
|
8738
|
-
|
8739
|
-
return JSON.parse(JSON.stringify(
|
8740
|
-
}, e.clearMessages =
|
8741
|
-
|
8743
|
+
_this37._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, _this37._onClearMessages = Ui.onClearMessages.bind(_assertThisInitialized(_this37), e), _this37._displayLoadingMessage = fe.getDisplayLoadingMessage(e, t), _this37._permittedErrorPrefixes = n, _this37.addSetupMessageIfNeeded(e, t), _this37.populateIntroPanel(i, r, e.introPanelStyle), _this37.addIntroductoryMessage(e, t), e.initialMessages && _this37.populateInitialMessages(e.initialMessages), _this37._displayServiceErrorMessages = (l = e.errorMessages) == null ? void 0 : l.displayServiceErrorMessages, e.getMessages = function () {
|
8744
|
+
return JSON.parse(JSON.stringify(_this37.messages));
|
8745
|
+
}, e.clearMessages = _this37.clearMessages.bind(_assertThisInitialized(_this37), t), e.refreshMessages = _this37.refreshTextMessages.bind(_assertThisInitialized(_this37)), e.scrollToBottom = ne.scrollToBottom.bind(_assertThisInitialized(_this37), _this37.elementRef), e.addMessage = function (c, d) {
|
8746
|
+
_this37.addNewMessage(_objectSpread(_objectSpread({}, c), {}, {
|
8742
8747
|
sendUpdate: !!d
|
8743
8748
|
}), !d);
|
8744
|
-
}, t.addMessage =
|
8745
|
-
|
8749
|
+
}, t.addMessage = _this37.addIOMessage.bind(_assertThisInitialized(_this37)), o && _this37.prepareDemo(o), e.textToSpeech && Lt.processConfig(e.textToSpeech, function (c) {
|
8750
|
+
_this37.textToSpeech = c;
|
8746
8751
|
});
|
8747
|
-
return
|
8752
|
+
return _this37;
|
8748
8753
|
}
|
8749
8754
|
_createClass(fe, [{
|
8750
8755
|
key: "prepareDemo",
|
@@ -8763,26 +8768,28 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8763
8768
|
}, {
|
8764
8769
|
key: "addIntroductoryMessage",
|
8765
8770
|
value: function addIntroductoryMessage(e, t) {
|
8766
|
-
var
|
8767
|
-
var
|
8768
|
-
|
8769
|
-
|
8770
|
-
|
8771
|
-
|
8772
|
-
|
8773
|
-
|
8774
|
-
|
8771
|
+
var _i10;
|
8772
|
+
var n, r;
|
8773
|
+
e != null && e.shadowRoot && t && (this._introMessage = e.introMessage);
|
8774
|
+
var i = this._introMessage;
|
8775
|
+
if (e && t != null && t.isWebModel() && ((_i10 = i) !== null && _i10 !== void 0 ? _i10 : i = t.getIntroMessage(e)), i) {
|
8776
|
+
if (i != null && i.text) {
|
8777
|
+
var o = this.createAndAppendNewMessageElement(i.text, v.AI_ROLE);
|
8778
|
+
this.applyCustomStyles(o, v.AI_ROLE, !1, (n = this.messageStyles) == null ? void 0 : n.intro);
|
8779
|
+
} else if (i != null && i.html) {
|
8780
|
+
var _o3 = Ye.add(this, i.html, v.AI_ROLE, this.messageElementRefs);
|
8781
|
+
this.applyCustomStyles(_o3, v.AI_ROLE, !1, (r = this.messageStyles) == null ? void 0 : r.intro);
|
8775
8782
|
}
|
8776
8783
|
}
|
8777
8784
|
}
|
8778
8785
|
}, {
|
8779
8786
|
key: "populateInitialMessages",
|
8780
8787
|
value: function populateInitialMessages(e) {
|
8781
|
-
var
|
8788
|
+
var _this38 = this;
|
8782
8789
|
e.forEach(function (t) {
|
8783
|
-
Ae.processInitialMessageFile(t),
|
8790
|
+
Ae.processInitialMessageFile(t), _this38.addNewMessage(t, !0);
|
8784
8791
|
}), setTimeout(function () {
|
8785
|
-
return ne.scrollToBottom(
|
8792
|
+
return ne.scrollToBottom(_this38.elementRef);
|
8786
8793
|
});
|
8787
8794
|
}
|
8788
8795
|
// this should not be activated by streamed messages
|
@@ -8792,7 +8799,7 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8792
8799
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
8793
8800
|
var i = fe.createMessageContent(e);
|
8794
8801
|
if (!e.ignoreText && i.text !== void 0 && e.text !== null && (this.addNewTextMessage(i.text, i.role, e.overwrite), !t && this.textToSpeech && i.role !== v.USER_ROLE && Lt.speak(i.text, this.textToSpeech)), i.files && Array.isArray(i.files) && pe.addMessages(this, i.files, i.role), i.html !== void 0 && i.html !== null) {
|
8795
|
-
var n =
|
8802
|
+
var n = Ye.add(this, i.html, i.role, this.messageElementRefs, e.overwrite);
|
8796
8803
|
ge.isElementTemporary(n) && delete i.html;
|
8797
8804
|
}
|
8798
8805
|
this.updateStateOnMessage(i, e.overwrite, e.sendUpdate, t);
|
@@ -8810,7 +8817,7 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8810
8817
|
value: function removeMessageOnError() {
|
8811
8818
|
var e = this.messageElementRefs[this.messageElementRefs.length - 1],
|
8812
8819
|
t = e == null ? void 0 : e.bubbleElement;
|
8813
|
-
(t != null && t.classList.contains(
|
8820
|
+
(t != null && t.classList.contains($e.MESSAGE_CLASS) && t.textContent === "" || fe.isTemporaryElement(e)) && (e.outerContainer.remove(), this.messageElementRefs.pop());
|
8814
8821
|
}
|
8815
8822
|
// prettier-ignore
|
8816
8823
|
}, {
|
@@ -8922,7 +8929,7 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8922
8929
|
var i = [];
|
8923
8930
|
this.messageElementRefs.forEach(function (o) {
|
8924
8931
|
var a = o.bubbleElement.classList;
|
8925
|
-
a.contains("loading-message-text") || a.contains(
|
8932
|
+
a.contains("loading-message-text") || a.contains($e.MESSAGE_CLASS) ? i.push(o) : o.outerContainer.remove();
|
8926
8933
|
}), Array.from(this.elementRef.children).forEach(function (o) {
|
8927
8934
|
var l;
|
8928
8935
|
var a = (l = o.children[0]) == null ? void 0 : l.children[0];
|
@@ -8942,7 +8949,7 @@ var fe = /*#__PURE__*/function (_Ve) {
|
|
8942
8949
|
}
|
8943
8950
|
}]);
|
8944
8951
|
return fe;
|
8945
|
-
}(
|
8952
|
+
}(We);
|
8946
8953
|
var yt = /*#__PURE__*/function () {
|
8947
8954
|
function W() {
|
8948
8955
|
_classCallCheck(this, W);
|
@@ -8984,11 +8991,11 @@ yt.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS = "text-input-container-right-adjustment
|
|
8984
8991
|
yt.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS = "text-input-container-left-small-adjustment";
|
8985
8992
|
yt.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS = "text-input-container-right-small-adjustment";
|
8986
8993
|
var zo = yt;
|
8987
|
-
var
|
8988
|
-
function
|
8989
|
-
_classCallCheck(this,
|
8994
|
+
var Xe = /*#__PURE__*/function () {
|
8995
|
+
function Xe() {
|
8996
|
+
_classCallCheck(this, Xe);
|
8990
8997
|
}
|
8991
|
-
_createClass(
|
8998
|
+
_createClass(Xe, null, [{
|
8992
8999
|
key: "create",
|
8993
9000
|
value: function create() {
|
8994
9001
|
return Array.from({
|
@@ -9012,11 +9019,11 @@ var Ze = /*#__PURE__*/function () {
|
|
9012
9019
|
key: "addButton",
|
9013
9020
|
value: function addButton(e, t, i) {
|
9014
9021
|
t.classList.add(i);
|
9015
|
-
var n =
|
9022
|
+
var n = Xe.getContainerIndex(i);
|
9016
9023
|
e[n].appendChild(t), n === 3 && t.classList.add("outside-right");
|
9017
9024
|
}
|
9018
9025
|
}]);
|
9019
|
-
return
|
9026
|
+
return Xe;
|
9020
9027
|
}();
|
9021
9028
|
var gn = ["camera", "gifs", "images", "audio", "mixedFiles", "submit", "microphone"];
|
9022
9029
|
var D = /*#__PURE__*/function () {
|
@@ -9232,11 +9239,11 @@ var we = /*#__PURE__*/function () {
|
|
9232
9239
|
}();
|
9233
9240
|
var $i = /*#__PURE__*/function () {
|
9234
9241
|
function $i(e, t) {
|
9235
|
-
var
|
9242
|
+
var _this39 = this;
|
9236
9243
|
_classCallCheck(this, $i);
|
9237
9244
|
var i;
|
9238
9245
|
this._isOpen = !0, this._styles = t, this.elementRef = $i.createElement((i = this._styles) == null ? void 0 : i.container), this.close(), setTimeout(function () {
|
9239
|
-
return
|
9246
|
+
return _this39.addWindowEvents(e);
|
9240
9247
|
});
|
9241
9248
|
}
|
9242
9249
|
_createClass($i, [{
|
@@ -9264,13 +9271,13 @@ var $i = /*#__PURE__*/function () {
|
|
9264
9271
|
}, {
|
9265
9272
|
key: "addWindowEvents",
|
9266
9273
|
value: function addWindowEvents(e) {
|
9267
|
-
var
|
9274
|
+
var _this40 = this;
|
9268
9275
|
window.addEventListener("click", function (t) {
|
9269
9276
|
var i;
|
9270
|
-
e.parentElement !== ((i = t.target.shadowRoot) == null ? void 0 : i.children[0]) &&
|
9277
|
+
e.parentElement !== ((i = t.target.shadowRoot) == null ? void 0 : i.children[0]) && _this40.close();
|
9271
9278
|
}), window.addEventListener("keydown", function (t) {
|
9272
9279
|
var i, n, r;
|
9273
|
-
|
9280
|
+
_this40._isOpen && (t.key === R.ESCAPE ? (_this40.close(), (i = _this40.highlightedItem) == null || i.dispatchEvent(new MouseEvent("mouseleave"))) : t.key === R.ENTER ? ((n = _this40.highlightedItem) == null || n.click(), (r = _this40.highlightedItem) == null || r.dispatchEvent(new MouseEvent("mouseleave"))) : t.key === R.ARROW_DOWN ? ft.focusSiblingItem(_this40.highlightedItem || _this40.elementRef.children[_this40.elementRef.children.length - 1], _this40.elementRef, !0) : t.key === R.ARROW_UP && ft.focusSiblingItem(_this40.highlightedItem || _this40.elementRef.children[0], _this40.elementRef, !1));
|
9274
9281
|
});
|
9275
9282
|
}
|
9276
9283
|
}], [{
|
@@ -9282,25 +9289,25 @@ var $i = /*#__PURE__*/function () {
|
|
9282
9289
|
}]);
|
9283
9290
|
return $i;
|
9284
9291
|
}();
|
9285
|
-
var
|
9286
|
-
_inherits(
|
9287
|
-
var _super37 = _createSuper(
|
9288
|
-
function
|
9289
|
-
var
|
9290
|
-
_classCallCheck(this,
|
9292
|
+
var Ke = /*#__PURE__*/function (_xt) {
|
9293
|
+
_inherits(Ke, _xt);
|
9294
|
+
var _super37 = _createSuper(Ke);
|
9295
|
+
function Ke(e, t) {
|
9296
|
+
var _this41;
|
9297
|
+
_classCallCheck(this, Ke);
|
9291
9298
|
var n;
|
9292
|
-
|
9299
|
+
_this41 = _super37.call(this, Ke.createButtonElement(), void 0, {
|
9293
9300
|
styles: (n = t == null ? void 0 : t.button) == null ? void 0 : n.styles
|
9294
9301
|
});
|
9295
|
-
var i =
|
9296
|
-
|
9297
|
-
return
|
9302
|
+
var i = _this41.createInnerElements(_this41._customStyles);
|
9303
|
+
_this41._menu = new $i(e, t == null ? void 0 : t.menu), _this41.addClickEvent(), _this41.buttonContainer = Ke.createButtonContainer(), _this41.elementRef.appendChild(i.styles), _this41.buttonContainer.appendChild(_this41.elementRef), _this41.elementRef.classList.add("dropup-icon", "upload-file-button"), _this41.buttonContainer.appendChild(_this41._menu.elementRef), _this41.reapplyStateStyle("styles"), _this41.addContainerEvents(e);
|
9304
|
+
return _this41;
|
9298
9305
|
}
|
9299
|
-
_createClass(
|
9306
|
+
_createClass(Ke, [{
|
9300
9307
|
key: "createInnerElements",
|
9301
9308
|
value: function createInnerElements(e) {
|
9302
9309
|
return {
|
9303
|
-
styles: this.createInnerElement(
|
9310
|
+
styles: this.createInnerElement(Ke.createSVGIconElement(), "styles", e)
|
9304
9311
|
};
|
9305
9312
|
}
|
9306
9313
|
}, {
|
@@ -9321,9 +9328,9 @@ var We = /*#__PURE__*/function (_xt) {
|
|
9321
9328
|
}, {
|
9322
9329
|
key: "addContainerEvents",
|
9323
9330
|
value: function addContainerEvents(e) {
|
9324
|
-
var
|
9331
|
+
var _this42 = this;
|
9325
9332
|
e.addEventListener("click", function (t) {
|
9326
|
-
t.target.classList.contains("dropup-icon") ||
|
9333
|
+
t.target.classList.contains("dropup-icon") || _this42._menu.close();
|
9327
9334
|
});
|
9328
9335
|
}
|
9329
9336
|
}], [{
|
@@ -9351,7 +9358,7 @@ var We = /*#__PURE__*/function (_xt) {
|
|
9351
9358
|
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";
|
9352
9359
|
}
|
9353
9360
|
}]);
|
9354
|
-
return
|
9361
|
+
return Ke;
|
9355
9362
|
}(xt);
|
9356
9363
|
var j = /*#__PURE__*/function () {
|
9357
9364
|
function j() {
|
@@ -9362,7 +9369,7 @@ var j = /*#__PURE__*/function () {
|
|
9362
9369
|
value:
|
9363
9370
|
// prettier-ignore
|
9364
9371
|
function addToDropup(e, t, i, n) {
|
9365
|
-
var r = new
|
9372
|
+
var r = new Ke(i, n);
|
9366
9373
|
gn.forEach(function (a) {
|
9367
9374
|
var l = t["dropup-menu"].findIndex(function (d) {
|
9368
9375
|
return d.buttonType === a;
|
@@ -9370,8 +9377,8 @@ var j = /*#__PURE__*/function () {
|
|
9370
9377
|
c = t["dropup-menu"][l];
|
9371
9378
|
c && (r.addItem(c.button), t["dropup-menu"].splice(l, 1));
|
9372
9379
|
});
|
9373
|
-
var o =
|
9374
|
-
|
9380
|
+
var o = Ke.getPosition(t, n);
|
9381
|
+
Xe.addButton(e, r.buttonContainer, o), t[o].push({});
|
9375
9382
|
}
|
9376
9383
|
}, {
|
9377
9384
|
key: "addToSideContainer",
|
@@ -9379,7 +9386,7 @@ var j = /*#__PURE__*/function () {
|
|
9379
9386
|
["inside-left", "inside-right", "outside-left", "outside-right"].forEach(function (n) {
|
9380
9387
|
var r = n;
|
9381
9388
|
t[r].forEach(function (o) {
|
9382
|
-
|
9389
|
+
Xe.addButton(e, o.button.elementRef, r);
|
9383
9390
|
});
|
9384
9391
|
});
|
9385
9392
|
}
|
@@ -9458,10 +9465,10 @@ var Uo = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 24 24\"
|
|
9458
9465
|
var de = /*#__PURE__*/function () {
|
9459
9466
|
// prettier-ignore
|
9460
9467
|
function de(e, t, i, n) {
|
9461
|
-
var
|
9468
|
+
var _this43 = this;
|
9462
9469
|
_classCallCheck(this, de);
|
9463
9470
|
this._attachments = [], this._fileCountLimit = 99, this._acceptedFormat = "", t.maxNumberOfFiles && (this._fileCountLimit = t.maxNumberOfFiles), this._toggleContainerDisplay = i, this._fileAttachmentsContainerRef = n, t.acceptedFormats && (this._acceptedFormat = t.acceptedFormats), setTimeout(function () {
|
9464
|
-
|
9471
|
+
_this43._validationHandler = e._validationHandler;
|
9465
9472
|
});
|
9466
9473
|
}
|
9467
9474
|
_createClass(de, [{
|
@@ -9602,12 +9609,12 @@ var Ko = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9602
9609
|
_createClass(Se, [{
|
9603
9610
|
key: "createTimer",
|
9604
9611
|
value: function createTimer(e, t) {
|
9605
|
-
var
|
9612
|
+
var _this44 = this;
|
9606
9613
|
var i = 0;
|
9607
9614
|
var n = t !== void 0 && t < Se.TIMER_LIMIT_S ? t : Se.TIMER_LIMIT_S;
|
9608
9615
|
return setInterval(function () {
|
9609
9616
|
var a;
|
9610
|
-
i += 1, i === n && ((a =
|
9617
|
+
i += 1, i === n && ((a = _this44.stopPlaceholderCallback) == null || a.call(_this44), _this44.clearTimer()), i === 600 && e.classList.add("audio-placeholder-text-4-digits");
|
9611
9618
|
var r = Math.floor(i / 60),
|
9612
9619
|
o = (i % 60).toString().padStart(2, "0");
|
9613
9620
|
e.textContent = "".concat(r, ":").concat(o);
|
@@ -9627,7 +9634,7 @@ var Ko = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9627
9634
|
}, {
|
9628
9635
|
key: "addPlaceholderAudioAttachmentEvents",
|
9629
9636
|
value: function addPlaceholderAudioAttachmentEvents(e, t, i) {
|
9630
|
-
var
|
9637
|
+
var _this45 = this;
|
9631
9638
|
var n = function n() {
|
9632
9639
|
return e.replaceChildren(t);
|
9633
9640
|
};
|
@@ -9638,7 +9645,7 @@ var Ko = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
9638
9645
|
e.addEventListener("mouseleave", r);
|
9639
9646
|
var o = function o() {
|
9640
9647
|
var a;
|
9641
|
-
return (a =
|
9648
|
+
return (a = _this45.stopPlaceholderCallback) == null ? void 0 : a.call(_this45);
|
9642
9649
|
};
|
9643
9650
|
e.addEventListener("click", o);
|
9644
9651
|
}
|
@@ -9833,20 +9840,20 @@ var ls = /*#__PURE__*/function () {
|
|
9833
9840
|
}, {
|
9834
9841
|
key: "addButtons",
|
9835
9842
|
value: function addButtons() {
|
9836
|
-
var
|
9843
|
+
var _this46 = this;
|
9837
9844
|
for (var _len2 = arguments.length, e = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
9838
9845
|
e[_key2] = arguments[_key2];
|
9839
9846
|
}
|
9840
9847
|
e.forEach(function (t) {
|
9841
|
-
return
|
9848
|
+
return _this46._buttonPanel.appendChild(t);
|
9842
9849
|
});
|
9843
9850
|
}
|
9844
9851
|
}, {
|
9845
9852
|
key: "close",
|
9846
9853
|
value: function close() {
|
9847
|
-
var
|
9854
|
+
var _this47 = this;
|
9848
9855
|
this._elementRef.classList.remove("show-modal"), this._elementRef.classList.add("hide-modal"), this._backgroundPanelRef.classList.remove("show-modal-background"), this._backgroundPanelRef.classList.add("hide-modal-background"), this._isOpen = !1, setTimeout(function () {
|
9849
|
-
|
9856
|
+
_this47._elementRef.style.display = "none", _this47._backgroundPanelRef.style.display = "none";
|
9850
9857
|
}, ae.MODAL_CLOSE_TIMEOUT_MS);
|
9851
9858
|
}
|
9852
9859
|
}, {
|
@@ -9862,10 +9869,10 @@ var ls = /*#__PURE__*/function () {
|
|
9862
9869
|
}, {
|
9863
9870
|
key: "addCloseButton",
|
9864
9871
|
value: function addCloseButton(e, t, i) {
|
9865
|
-
var
|
9872
|
+
var _this48 = this;
|
9866
9873
|
var n = t ? ae.createSVGButton(e) : ae.createTextButton(e);
|
9867
9874
|
return this.addButtons(n), n.onclick = function () {
|
9868
|
-
|
9875
|
+
_this48.close(), setTimeout(function () {
|
9869
9876
|
i == null || i();
|
9870
9877
|
}, 140);
|
9871
9878
|
}, n;
|
@@ -9873,10 +9880,10 @@ var ls = /*#__PURE__*/function () {
|
|
9873
9880
|
}, {
|
9874
9881
|
key: "addWindowEvents",
|
9875
9882
|
value: function addWindowEvents() {
|
9876
|
-
var
|
9883
|
+
var _this49 = this;
|
9877
9884
|
window.addEventListener("keydown", function (e) {
|
9878
9885
|
var t, i;
|
9879
|
-
|
9886
|
+
_this49._isOpen && (e.key === R.ESCAPE ? (_this49.close(), (t = _this49.extensionCloseCallback) == null || t.call(_this49)) : e.key === R.ENTER && (_this49.close(), (i = _this49.extensionCloseCallback) == null || i.call(_this49)));
|
9880
9887
|
});
|
9881
9888
|
}
|
9882
9889
|
}], [{
|
@@ -9937,13 +9944,13 @@ var ct = /*#__PURE__*/function (_xt2) {
|
|
9937
9944
|
var _super39 = _createSuper(ct);
|
9938
9945
|
// prettier-ignore
|
9939
9946
|
function ct(e, t, i, n, r, o) {
|
9940
|
-
var
|
9947
|
+
var _this50;
|
9941
9948
|
_classCallCheck(this, ct);
|
9942
9949
|
var l, c, d, u, p, h;
|
9943
|
-
|
9944
|
-
var a =
|
9945
|
-
|
9946
|
-
return
|
9950
|
+
_this50 = _super39.call(this, ct.createButtonElement(), (l = i.button) == null ? void 0 : l.position, i.button, o);
|
9951
|
+
var a = _this50.createInnerElements(n, r, _this50._customStyles);
|
9952
|
+
_this50._inputElement = ct.createInputElement((c = i == null ? void 0 : i.files) == null ? void 0 : c.acceptedFormats), _this50.addClickEvent(e, i), _this50.elementRef.replaceChildren(a.styles), _this50.reapplyStateStyle("styles"), _this50._fileAttachmentsType = t, _this50._openModalOnce = ((u = (d = i.files) == null ? void 0 : d.infoModal) == null ? void 0 : u.openModalOnce) === !1 || (h = (p = i.files) == null ? void 0 : p.infoModal) == null ? void 0 : h.openModalOnce;
|
9953
|
+
return _this50;
|
9947
9954
|
}
|
9948
9955
|
_createClass(ct, [{
|
9949
9956
|
key: "createInnerElements",
|
@@ -10161,10 +10168,10 @@ var mt = /*#__PURE__*/function (_xt3) {
|
|
10161
10168
|
_inherits(mt, _xt3);
|
10162
10169
|
var _super40 = _createSuper(mt);
|
10163
10170
|
function mt(e) {
|
10164
|
-
var
|
10171
|
+
var _this51;
|
10165
10172
|
_classCallCheck(this, mt);
|
10166
|
-
(e == null ? void 0 : e.position) === "dropup-menu" && (e.position = "outside-right"),
|
10167
|
-
return
|
10173
|
+
(e == null ? void 0 : e.position) === "dropup-menu" && (e.position = "outside-right"), _this51 = _super40.call(this, mt.createMicrophoneElement(), e == null ? void 0 : e.position, e), _this51.isActive = !1, _this51._innerElements = _this51.createInnerElements(_this51._customStyles), _this51.changeToDefault();
|
10174
|
+
return _this51;
|
10168
10175
|
}
|
10169
10176
|
_createClass(mt, [{
|
10170
10177
|
key: "createInnerElements",
|
@@ -10238,11 +10245,11 @@ var cs = {},
|
|
10238
10245
|
ii = {},
|
10239
10246
|
ni = {},
|
10240
10247
|
St = {},
|
10241
|
-
|
10242
|
-
Object.defineProperty(
|
10248
|
+
De = {};
|
10249
|
+
Object.defineProperty(De, "__esModule", {
|
10243
10250
|
value: !0
|
10244
10251
|
});
|
10245
|
-
|
10252
|
+
De.Text = void 0;
|
10246
10253
|
var ve = /*#__PURE__*/function () {
|
10247
10254
|
function ve() {
|
10248
10255
|
_classCallCheck(this, ve);
|
@@ -10273,7 +10280,7 @@ var ve = /*#__PURE__*/function () {
|
|
10273
10280
|
}]);
|
10274
10281
|
return ve;
|
10275
10282
|
}();
|
10276
|
-
|
10283
|
+
De.Text = ve;
|
10277
10284
|
ve.FIRST_CHAR_REGEX = /\S/;
|
10278
10285
|
ve.DOUBLE_LINE = /\n\n/g;
|
10279
10286
|
ve.ONE_LINE = /\n/g;
|
@@ -10281,7 +10288,7 @@ Object.defineProperty(St, "__esModule", {
|
|
10281
10288
|
value: !0
|
10282
10289
|
});
|
10283
10290
|
St.Translate = void 0;
|
10284
|
-
var $o =
|
10291
|
+
var $o = De;
|
10285
10292
|
var Zo = /*#__PURE__*/function () {
|
10286
10293
|
function Zo() {
|
10287
10294
|
_classCallCheck(this, Zo);
|
@@ -10371,9 +10378,9 @@ var J = /*#__PURE__*/function () {
|
|
10371
10378
|
}, {
|
10372
10379
|
key: "keyDownWindow",
|
10373
10380
|
value: function keyDownWindow(e) {
|
10374
|
-
var
|
10381
|
+
var _this52 = this;
|
10375
10382
|
e.element && J.getElementIfFocusedOnAvailable(e.element, document.activeElement) && (J.KEY_DOWN_TIMEOUT !== null && clearTimeout(J.KEY_DOWN_TIMEOUT), J.KEY_DOWN_TIMEOUT = setTimeout(function () {
|
10376
|
-
J.KEY_DOWN_TIMEOUT = null,
|
10383
|
+
J.KEY_DOWN_TIMEOUT = null, _this52.resetRecording(e);
|
10377
10384
|
}, 500));
|
10378
10385
|
}
|
10379
10386
|
}, {
|
@@ -10466,11 +10473,11 @@ var Zi = /*#__PURE__*/function () {
|
|
10466
10473
|
return Zi;
|
10467
10474
|
}();
|
10468
10475
|
Mt.AutoScroll = Zi;
|
10469
|
-
var
|
10470
|
-
Object.defineProperty(
|
10476
|
+
var je = {};
|
10477
|
+
Object.defineProperty(je, "__esModule", {
|
10471
10478
|
value: !0
|
10472
10479
|
});
|
10473
|
-
|
10480
|
+
je.Elements = void 0;
|
10474
10481
|
var ea = /*#__PURE__*/function () {
|
10475
10482
|
function ea() {
|
10476
10483
|
_classCallCheck(this, ea);
|
@@ -10518,12 +10525,12 @@ var ea = /*#__PURE__*/function () {
|
|
10518
10525
|
}]);
|
10519
10526
|
return ea;
|
10520
10527
|
}();
|
10521
|
-
|
10522
|
-
var
|
10523
|
-
Object.defineProperty(
|
10528
|
+
je.Elements = ea;
|
10529
|
+
var Be = {};
|
10530
|
+
Object.defineProperty(Be, "__esModule", {
|
10524
10531
|
value: !0
|
10525
10532
|
});
|
10526
|
-
|
10533
|
+
Be.Cursor = void 0;
|
10527
10534
|
var dt = /*#__PURE__*/function () {
|
10528
10535
|
function dt() {
|
10529
10536
|
_classCallCheck(this, dt);
|
@@ -10541,10 +10548,10 @@ var dt = /*#__PURE__*/function () {
|
|
10541
10548
|
i += a;
|
10542
10549
|
} else if (o.textContent !== null) {
|
10543
10550
|
if (i + o.textContent.length > t) {
|
10544
|
-
var
|
10545
|
-
|
10551
|
+
var _a2 = document.createRange();
|
10552
|
+
_a2.setStart(o, t - i), _a2.collapse(!0);
|
10546
10553
|
var l = window.getSelection();
|
10547
|
-
return l == null || l.removeAllRanges(), l == null || l.addRange(
|
10554
|
+
return l == null || l.removeAllRanges(), l == null || l.addRange(_a2), e.focus(), -1;
|
10548
10555
|
}
|
10549
10556
|
i += o.textContent.length, n += o.textContent.length;
|
10550
10557
|
}
|
@@ -10605,16 +10612,16 @@ var dt = /*#__PURE__*/function () {
|
|
10605
10612
|
}]);
|
10606
10613
|
return dt;
|
10607
10614
|
}();
|
10608
|
-
|
10615
|
+
Be.Cursor = dt;
|
10609
10616
|
Object.defineProperty(_t, "__esModule", {
|
10610
10617
|
value: !0
|
10611
10618
|
});
|
10612
10619
|
_t.CommandUtils = void 0;
|
10613
10620
|
var yn = Mt,
|
10614
|
-
ta =
|
10621
|
+
ta = je,
|
10615
10622
|
ia = Qe,
|
10616
|
-
xn =
|
10617
|
-
En =
|
10623
|
+
xn = Be,
|
10624
|
+
En = De;
|
10618
10625
|
var K = /*#__PURE__*/function () {
|
10619
10626
|
function K() {
|
10620
10627
|
_classCallCheck(this, K);
|
@@ -10716,8 +10723,8 @@ Object.defineProperty(oi, "__esModule", {
|
|
10716
10723
|
value: !0
|
10717
10724
|
});
|
10718
10725
|
oi.Highlight = void 0;
|
10719
|
-
var na =
|
10720
|
-
et =
|
10726
|
+
var na = je,
|
10727
|
+
et = Be;
|
10721
10728
|
var Ut = /*#__PURE__*/function () {
|
10722
10729
|
function Ut() {
|
10723
10730
|
_classCallCheck(this, Ut);
|
@@ -10773,9 +10780,9 @@ Object.defineProperty(ai, "__esModule", {
|
|
10773
10780
|
value: !0
|
10774
10781
|
});
|
10775
10782
|
ai.Padding = void 0;
|
10776
|
-
var sa =
|
10777
|
-
Sn =
|
10778
|
-
|
10783
|
+
var sa = je,
|
10784
|
+
Sn = Be,
|
10785
|
+
ze = De;
|
10779
10786
|
var Ht = /*#__PURE__*/function () {
|
10780
10787
|
function Ht() {
|
10781
10788
|
_classCallCheck(this, Ht);
|
@@ -10788,11 +10795,11 @@ var Ht = /*#__PURE__*/function () {
|
|
10788
10795
|
r = t.value[n - 1],
|
10789
10796
|
o = t.selectionEnd === null ? n : t.selectionEnd,
|
10790
10797
|
a = t.value[o];
|
10791
|
-
|
10798
|
+
ze.Text.isCharDefined(r) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), ze.Text.isCharDefined(a) && (e.endPadding = " ", e.numberOfSpacesAfterNewText = 1), e.isCursorAtEnd = t.value.length === o;
|
10792
10799
|
return;
|
10793
10800
|
}
|
10794
10801
|
var i = t.value[t.value.length - 1];
|
10795
|
-
|
10802
|
+
ze.Text.isCharDefined(i) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), e.isCursorAtEnd = !0;
|
10796
10803
|
}
|
10797
10804
|
}, {
|
10798
10805
|
key: "setStateForGenericElement",
|
@@ -10805,12 +10812,12 @@ var Ht = /*#__PURE__*/function () {
|
|
10805
10812
|
c = (i = t.textContent) === null || i === void 0 ? void 0 : i[l - 1],
|
10806
10813
|
d = Sn.Cursor.getGenericElementCursorOffset(t, a, !1),
|
10807
10814
|
u = (n = t.textContent) === null || n === void 0 ? void 0 : n[d];
|
10808
|
-
|
10815
|
+
ze.Text.isCharDefined(c) && (e.startPadding = " "), ze.Text.isCharDefined(u) && (e.endPadding = " "), e.isCursorAtEnd = ((r = t.textContent) === null || r === void 0 ? void 0 : r.length) === d;
|
10809
10816
|
return;
|
10810
10817
|
}
|
10811
10818
|
}
|
10812
10819
|
var o = t.innerText.charAt(t.innerText.length - 1);
|
10813
|
-
|
10820
|
+
ze.Text.isCharDefined(o) && (e.startPadding = " "), e.isCursorAtEnd = !0;
|
10814
10821
|
}
|
10815
10822
|
}, {
|
10816
10823
|
key: "setState",
|
@@ -10844,11 +10851,11 @@ var wn = si,
|
|
10844
10851
|
_n = _t,
|
10845
10852
|
kt = Mt,
|
10846
10853
|
Si = oi,
|
10847
|
-
te =
|
10854
|
+
te = je,
|
10848
10855
|
wi = ai,
|
10849
10856
|
Mn = Qe,
|
10850
|
-
Tn =
|
10851
|
-
_i =
|
10857
|
+
Tn = Be,
|
10858
|
+
_i = De;
|
10852
10859
|
var oa = /*#__PURE__*/function () {
|
10853
10860
|
function oa() {
|
10854
10861
|
_classCallCheck(this, oa);
|
@@ -10994,22 +11001,22 @@ var Gt = /*#__PURE__*/function (_aa$Speech) {
|
|
10994
11001
|
}, {
|
10995
11002
|
key: "setEvents",
|
10996
11003
|
value: function setEvents() {
|
10997
|
-
var
|
11004
|
+
var _this53 = this;
|
10998
11005
|
this._service && (this._service.onstart = function () {
|
10999
|
-
|
11006
|
+
_this53.setStateOnStart();
|
11000
11007
|
}, this._service.onerror = function (e) {
|
11001
|
-
An.Browser.IS_SAFARI() && e.message === "Another request is started" || e.error === "aborted" &&
|
11008
|
+
An.Browser.IS_SAFARI() && e.message === "Another request is started" || e.error === "aborted" && _this53.isRestarting || e.error !== "no-speech" && _this53.error(e.message || e.error);
|
11002
11009
|
}, this._service.onaudioend = function () {
|
11003
|
-
|
11010
|
+
_this53.setStateOnStop();
|
11004
11011
|
}, this._service.onend = function () {
|
11005
|
-
|
11012
|
+
_this53._stopping = !1;
|
11006
11013
|
}, this._service.onresult = function (e) {
|
11007
|
-
if (_typeof(e.results) > "u" &&
|
11008
|
-
var
|
11009
|
-
t =
|
11010
|
-
i =
|
11011
|
-
n =
|
11012
|
-
|
11014
|
+
if (_typeof(e.results) > "u" && _this53._service) _this53._service.onend = null, _this53._service.stop();else if (_this53._extractText && !_this53._stopping) {
|
11015
|
+
var _this53$_extractText = _this53._extractText(e, _this53.finalTranscript, _this53._translations),
|
11016
|
+
t = _this53$_extractText.interimTranscript,
|
11017
|
+
i = _this53$_extractText.finalTranscript,
|
11018
|
+
n = _this53$_extractText.newText;
|
11019
|
+
_this53.updateElements(t, i, n);
|
11013
11020
|
}
|
11014
11021
|
});
|
11015
11022
|
}
|
@@ -11038,22 +11045,22 @@ Object.defineProperty(li, "__esModule", {
|
|
11038
11045
|
value: !0
|
11039
11046
|
});
|
11040
11047
|
li.GlobalState = void 0;
|
11041
|
-
var
|
11042
|
-
function
|
11043
|
-
_classCallCheck(this,
|
11048
|
+
var Je = /*#__PURE__*/function () {
|
11049
|
+
function Je() {
|
11050
|
+
_classCallCheck(this, Je);
|
11044
11051
|
}
|
11045
|
-
_createClass(
|
11052
|
+
_createClass(Je, null, [{
|
11046
11053
|
key: "doubleClickDetector",
|
11047
11054
|
value: function doubleClickDetector() {
|
11048
|
-
return
|
11049
|
-
|
11055
|
+
return Je.doubleClickPending ? !0 : (Je.doubleClickPending = !0, setTimeout(function () {
|
11056
|
+
Je.doubleClickPending = !1;
|
11050
11057
|
}, 300), !1);
|
11051
11058
|
}
|
11052
11059
|
}]);
|
11053
|
-
return
|
11060
|
+
return Je;
|
11054
11061
|
}();
|
11055
|
-
li.GlobalState =
|
11056
|
-
|
11062
|
+
li.GlobalState = Je;
|
11063
|
+
Je.doubleClickPending = !1;
|
11057
11064
|
var ci = {},
|
11058
11065
|
di = {};
|
11059
11066
|
Object.defineProperty(di, "__esModule", {
|
@@ -11229,10 +11236,10 @@ var Wt = /*#__PURE__*/function (_ua$Speech) {
|
|
11229
11236
|
_inherits(Wt, _ua$Speech);
|
11230
11237
|
var _super42 = _createSuper(Wt);
|
11231
11238
|
function Wt() {
|
11232
|
-
var
|
11239
|
+
var _this54;
|
11233
11240
|
_classCallCheck(this, Wt);
|
11234
|
-
|
11235
|
-
return
|
11241
|
+
_this54 = _super42.apply(this, arguments), _this54._newTextPadding = "";
|
11242
|
+
return _this54;
|
11236
11243
|
}
|
11237
11244
|
_createClass(Wt, [{
|
11238
11245
|
key: "start",
|
@@ -11360,12 +11367,12 @@ var Wt = /*#__PURE__*/function (_ua$Speech) {
|
|
11360
11367
|
}, {
|
11361
11368
|
key: "retrieveTokenInterval",
|
11362
11369
|
value: function retrieveTokenInterval(e) {
|
11363
|
-
var
|
11370
|
+
var _this55 = this;
|
11364
11371
|
this._retrieveTokenInterval = setInterval(function () {
|
11365
11372
|
e == null || e().then(function (t) {
|
11366
|
-
|
11373
|
+
_this55._service && (_this55._service.authorizationToken = (t == null ? void 0 : t.trim()) || "");
|
11367
11374
|
})["catch"](function (t) {
|
11368
|
-
|
11375
|
+
_this55.error(t);
|
11369
11376
|
});
|
11370
11377
|
}, 1e4);
|
11371
11378
|
}
|
@@ -11401,21 +11408,21 @@ var Rn = ii,
|
|
11401
11408
|
ha = _t,
|
11402
11409
|
Z = li,
|
11403
11410
|
pa = ci;
|
11404
|
-
var
|
11405
|
-
function
|
11406
|
-
_classCallCheck(this,
|
11411
|
+
var Ve = /*#__PURE__*/function () {
|
11412
|
+
function Ve() {
|
11413
|
+
_classCallCheck(this, Ve);
|
11407
11414
|
}
|
11408
|
-
_createClass(
|
11415
|
+
_createClass(Ve, null, [{
|
11409
11416
|
key: "toggle",
|
11410
11417
|
value: function toggle(e, t) {
|
11411
11418
|
var i, n;
|
11412
11419
|
var r = e.toLocaleLowerCase().trim();
|
11413
|
-
!((i = Z.GlobalState.service) === null || i === void 0) && i.recognizing ? this.stop() : r === "webspeech" ?
|
11420
|
+
!((i = Z.GlobalState.service) === null || i === void 0) && i.recognizing ? this.stop() : r === "webspeech" ? Ve.startWebSpeech(t) : r === "azure" ? Ve.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'"));
|
11414
11421
|
}
|
11415
11422
|
}, {
|
11416
11423
|
key: "startWebSpeech",
|
11417
11424
|
value: function startWebSpeech(e) {
|
11418
|
-
|
11425
|
+
Ve.stop() || (Z.GlobalState.service = new Rn.WebSpeech(), Z.GlobalState.service.start(e));
|
11419
11426
|
}
|
11420
11427
|
}, {
|
11421
11428
|
key: "isWebSpeechSupported",
|
@@ -11426,7 +11433,7 @@ var Ge = /*#__PURE__*/function () {
|
|
11426
11433
|
key: "startAzure",
|
11427
11434
|
value: function startAzure(e) {
|
11428
11435
|
var t;
|
11429
|
-
|
11436
|
+
Ve.stop() || !((t = Z.GlobalState.service) === null || t === void 0) && t.cannotBeStopped || (Z.GlobalState.service = new pa.Azure(), Z.GlobalState.service.start(e));
|
11430
11437
|
}
|
11431
11438
|
}, {
|
11432
11439
|
key: "stop",
|
@@ -11440,25 +11447,25 @@ var Ge = /*#__PURE__*/function () {
|
|
11440
11447
|
Z.GlobalState.service && ha.CommandUtils.toggleCommandModeOff(Z.GlobalState.service);
|
11441
11448
|
}
|
11442
11449
|
}]);
|
11443
|
-
return
|
11450
|
+
return Ve;
|
11444
11451
|
}();
|
11445
|
-
var Ci = cs["default"] =
|
11452
|
+
var Ci = cs["default"] = Ve;
|
11446
11453
|
var Kt = /*#__PURE__*/function (_mt) {
|
11447
11454
|
_inherits(Kt, _mt);
|
11448
11455
|
var _super43 = _createSuper(Kt);
|
11449
11456
|
function Kt(e, t, i) {
|
11450
|
-
var
|
11457
|
+
var _this56;
|
11451
11458
|
_classCallCheck(this, Kt);
|
11452
11459
|
var o;
|
11453
|
-
|
11460
|
+
_this56 = _super43.call(this, _typeof(e.speechToText) == "object" ? (o = e.speechToText) == null ? void 0 : o.button : {});
|
11454
11461
|
var _Kt$processConfigurat = Kt.processConfiguration(t, e.speechToText),
|
11455
11462
|
n = _Kt$processConfigurat.serviceName,
|
11456
11463
|
r = _Kt$processConfigurat.processedConfig;
|
11457
|
-
if (
|
11464
|
+
if (_this56._addErrorMessage = i, n === "webspeech" && !Ci.isWebSpeechSupported()) _this56.changeToUnsupported();else {
|
11458
11465
|
var a = !e.textInput || !e.textInput.disabled;
|
11459
|
-
|
11466
|
+
_this56.elementRef.onclick = _this56.buttonClick.bind(_assertThisInitialized(_this56), t, a, n, r);
|
11460
11467
|
}
|
11461
|
-
return
|
11468
|
+
return _this56;
|
11462
11469
|
}
|
11463
11470
|
// prettier-ignore
|
11464
11471
|
_createClass(Kt, [{
|
@@ -11539,11 +11546,11 @@ var fa = /*#__PURE__*/function (_mt2) {
|
|
11539
11546
|
_inherits(fa, _mt2);
|
11540
11547
|
var _super44 = _createSuper(fa);
|
11541
11548
|
function fa(e, t) {
|
11542
|
-
var
|
11549
|
+
var _this57;
|
11543
11550
|
_classCallCheck(this, fa);
|
11544
11551
|
var i, n;
|
11545
|
-
|
11546
|
-
return
|
11552
|
+
_this57 = _super44.call(this, t.button), _this57._waitingForBrowserApproval = !1, _this57._audioType = e, _this57._extension = ((i = t.files) == null ? void 0 : i.format) || "mp3", _this57._maxDurationSeconds = (n = t.files) == null ? void 0 : n.maxDurationSeconds, _this57.elementRef.onclick = _this57.buttonClick.bind(_assertThisInitialized(_this57));
|
11553
|
+
return _this57;
|
11547
11554
|
}
|
11548
11555
|
_createClass(fa, [{
|
11549
11556
|
key: "buttonClick",
|
@@ -11553,10 +11560,10 @@ var fa = /*#__PURE__*/function (_mt2) {
|
|
11553
11560
|
}, {
|
11554
11561
|
key: "stop",
|
11555
11562
|
value: function stop() {
|
11556
|
-
var
|
11563
|
+
var _this58 = this;
|
11557
11564
|
return new Promise(function (e) {
|
11558
11565
|
var t, i;
|
11559
|
-
|
11566
|
+
_this58.changeToDefault(), (t = _this58._mediaRecorder) == null || t.stop(), (i = _this58._mediaStream) == null || i.getTracks().forEach(function (n) {
|
11560
11567
|
return n.stop();
|
11561
11568
|
}), setTimeout(function () {
|
11562
11569
|
e();
|
@@ -11566,23 +11573,23 @@ var fa = /*#__PURE__*/function (_mt2) {
|
|
11566
11573
|
}, {
|
11567
11574
|
key: "record",
|
11568
11575
|
value: function record() {
|
11569
|
-
var
|
11576
|
+
var _this59 = this;
|
11570
11577
|
navigator.mediaDevices.getUserMedia({
|
11571
11578
|
audio: !0
|
11572
11579
|
}).then(function (e) {
|
11573
|
-
|
11574
|
-
|
11575
|
-
}),
|
11580
|
+
_this59.changeToActive(), _this59._mediaRecorder = new MediaRecorder(e), _this59._audioType.addPlaceholderAttachment(_this59.stop.bind(_this59), _this59._maxDurationSeconds), _this59._mediaStream = e, _this59._mediaRecorder.addEventListener("dataavailable", function (t) {
|
11581
|
+
_this59.createFile(t);
|
11582
|
+
}), _this59._mediaRecorder.start();
|
11576
11583
|
})["catch"](function (e) {
|
11577
|
-
console.error(e),
|
11584
|
+
console.error(e), _this59.stop();
|
11578
11585
|
})["finally"](function () {
|
11579
|
-
|
11586
|
+
_this59._waitingForBrowserApproval = !1;
|
11580
11587
|
});
|
11581
11588
|
}
|
11582
11589
|
}, {
|
11583
11590
|
key: "createFile",
|
11584
11591
|
value: function createFile(e) {
|
11585
|
-
var
|
11592
|
+
var _this60 = this;
|
11586
11593
|
var t = new Blob([e.data], {
|
11587
11594
|
type: "audio/".concat(this._extension)
|
11588
11595
|
}),
|
@@ -11592,7 +11599,7 @@ var fa = /*#__PURE__*/function (_mt2) {
|
|
11592
11599
|
}),
|
11593
11600
|
r = new FileReader();
|
11594
11601
|
r.readAsDataURL(n), r.onload = function (o) {
|
11595
|
-
|
11602
|
+
_this60._audioType.completePlaceholderAttachment(n, o.target.result);
|
11596
11603
|
};
|
11597
11604
|
}
|
11598
11605
|
}]);
|
@@ -11672,19 +11679,19 @@ var mi = /*#__PURE__*/function (_xt4) {
|
|
11672
11679
|
var _super45 = _createSuper(k);
|
11673
11680
|
// prettier-ignore
|
11674
11681
|
function k(e, t, i, n, r) {
|
11675
|
-
var
|
11682
|
+
var _this61;
|
11676
11683
|
_classCallCheck(this, k);
|
11677
11684
|
var o = Te.process(e.submitButtonStyles);
|
11678
|
-
|
11685
|
+
_this61 = _super45.call(this, k.createButtonContainerElement(), o == null ? void 0 : o.position, o), _this61._isSVGLoadingIconOverriden = !1, _this61.status = {
|
11679
11686
|
requestInProgress: !1,
|
11680
11687
|
loadingActive: !1
|
11681
|
-
},
|
11688
|
+
}, _this61._messages = i, _this61._inputElementRef = t, _this61._fileAttachments = r, _this61._innerElements = _this61.createInnerElements(), _this61._abortStream = new AbortController(), _this61._stopClicked = {
|
11682
11689
|
listener: function listener() {}
|
11683
|
-
},
|
11690
|
+
}, _this61._serviceIO = n, _this61._alwaysEnabled = !!(o != null && o.alwaysEnabled), e.disableSubmitButton = _this61.disableSubmitButton.bind(_assertThisInitialized(_this61), n), _this61.attemptOverwriteLoadingStyle(e), setTimeout(function () {
|
11684
11691
|
var a;
|
11685
|
-
|
11692
|
+
_this61._validationHandler = e._validationHandler, _this61.assignHandlers(_this61._validationHandler), (a = _this61._validationHandler) == null || a.call(_assertThisInitialized(_this61));
|
11686
11693
|
});
|
11687
|
-
return
|
11694
|
+
return _this61;
|
11688
11695
|
}
|
11689
11696
|
// prettier-ignore
|
11690
11697
|
_createClass(k, [{
|
@@ -11773,7 +11780,7 @@ var mi = /*#__PURE__*/function (_xt4) {
|
|
11773
11780
|
key: "programmaticSubmit",
|
11774
11781
|
value: function () {
|
11775
11782
|
var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee96(e) {
|
11776
|
-
var
|
11783
|
+
var _this62 = this;
|
11777
11784
|
var t;
|
11778
11785
|
return _regeneratorRuntime().wrap(function _callee96$(_context96) {
|
11779
11786
|
while (1) switch (_context96.prev = _context96.next) {
|
@@ -11788,7 +11795,7 @@ var mi = /*#__PURE__*/function (_xt4) {
|
|
11788
11795
|
type: de.getTypeFromBlob(i)
|
11789
11796
|
};
|
11790
11797
|
})), setTimeout(function () {
|
11791
|
-
return
|
11798
|
+
return _this62.attemptSubmit(t, !0);
|
11792
11799
|
});
|
11793
11800
|
case 3:
|
11794
11801
|
case "end":
|
@@ -11966,14 +11973,14 @@ var Xi = /*#__PURE__*/function (_rt) {
|
|
11966
11973
|
var _super46 = _createSuper(Xi);
|
11967
11974
|
// prettier-ignore
|
11968
11975
|
function Xi(e, t, i, n) {
|
11969
|
-
var
|
11976
|
+
var _this63;
|
11970
11977
|
_classCallCheck(this, Xi);
|
11971
|
-
|
11972
|
-
var
|
11973
|
-
r =
|
11974
|
-
o =
|
11975
|
-
|
11976
|
-
return
|
11978
|
+
_this63 = _super46.call(this, e, ["modal-content", "modal-camera-content"], i), _this63._stopped = !1, _this63._format = "image/png", _this63._canvas = document.createElement("canvas"), _this63._canvas.classList.add("camera-modal-canvas");
|
11979
|
+
var _this63$addButtonsAnd = _this63.addButtonsAndTheirEvents(t),
|
11980
|
+
r = _this63$addButtonsAnd.captureButton,
|
11981
|
+
o = _this63$addButtonsAnd.submitButton;
|
11982
|
+
_this63._captureButton = r, _this63._submitButton = o, _this63._captureIcon = _this63._captureButton.children[0], _this63._refreshIcon = U.createSVGElement(ba), _this63._refreshIcon.classList.add("modal-svg-button-icon", "modal-svg-refresh-icon"), (n == null ? void 0 : n.format) === "jpeg" && (_this63._format = "image/jpeg"), n != null && n.dimensions && (_this63._dimensions = n.dimensions), _this63._contentRef.appendChild(_this63._canvas), _this63.extensionCloseCallback = _this63.stop;
|
11983
|
+
return _this63;
|
11977
11984
|
}
|
11978
11985
|
_createClass(Xi, [{
|
11979
11986
|
key: "addButtonsAndTheirEvents",
|
@@ -11992,38 +11999,38 @@ var Xi = /*#__PURE__*/function (_rt) {
|
|
11992
11999
|
}, {
|
11993
12000
|
key: "addButtonEvents",
|
11994
12001
|
value: function addButtonEvents(e, t, i, n) {
|
11995
|
-
var
|
12002
|
+
var _this64 = this;
|
11996
12003
|
e.onclick = function () {
|
11997
|
-
|
12004
|
+
_this64.capture();
|
11998
12005
|
}, t.addEventListener("click", this.stop.bind(this)), i.onclick = function () {
|
11999
|
-
var r =
|
12000
|
-
r && Et.addFilesToType([r], [n]),
|
12006
|
+
var r = _this64.getFile();
|
12007
|
+
r && Et.addFilesToType([r], [n]), _this64.stop(), _this64.close();
|
12001
12008
|
};
|
12002
12009
|
}
|
12003
12010
|
}, {
|
12004
12011
|
key: "stop",
|
12005
12012
|
value: function stop() {
|
12006
|
-
var
|
12013
|
+
var _this65 = this;
|
12007
12014
|
this._mediaStream && this._mediaStream.getTracks().forEach(function (e) {
|
12008
12015
|
return e.stop();
|
12009
12016
|
}), this._stopped = !0, setTimeout(function () {
|
12010
|
-
|
12011
|
-
var e =
|
12012
|
-
e == null || e.clearRect(0, 0,
|
12017
|
+
_this65._captureButton.replaceChildren(_this65._captureIcon), _this65._captureButton.classList.replace("modal-svg-refresh-button", "modal-svg-camera-button");
|
12018
|
+
var e = _this65._canvas.getContext("2d");
|
12019
|
+
e == null || e.clearRect(0, 0, _this65._canvas.width, _this65._canvas.height);
|
12013
12020
|
}, rt.MODAL_CLOSE_TIMEOUT_MS);
|
12014
12021
|
}
|
12015
12022
|
}, {
|
12016
12023
|
key: "start",
|
12017
12024
|
value: function start() {
|
12018
|
-
var
|
12025
|
+
var _this66 = this;
|
12019
12026
|
this._dataURL = void 0, this._submitButton.classList.add("modal-svg-submit-disabled"), this._stopped = !1, navigator.mediaDevices.getUserMedia({
|
12020
12027
|
video: this._dimensions || !0
|
12021
12028
|
}).then(function (e) {
|
12022
|
-
if (
|
12029
|
+
if (_this66._mediaStream = e, !_this66.isOpen()) return _this66.stop();
|
12023
12030
|
var t = document.createElement("video");
|
12024
|
-
t.srcObject = e, t.play(), requestAnimationFrame(
|
12031
|
+
t.srcObject = e, t.play(), requestAnimationFrame(_this66.updateCanvas.bind(_this66, t, _this66._canvas));
|
12025
12032
|
})["catch"](function (e) {
|
12026
|
-
console.error(e),
|
12033
|
+
console.error(e), _this66.stop(), _this66.close();
|
12027
12034
|
});
|
12028
12035
|
}
|
12029
12036
|
}, {
|
@@ -12081,13 +12088,13 @@ var Jt = /*#__PURE__*/function (_xt5) {
|
|
12081
12088
|
_inherits(Jt, _xt5);
|
12082
12089
|
var _super47 = _createSuper(Jt);
|
12083
12090
|
function Jt(e, t, i) {
|
12084
|
-
var
|
12091
|
+
var _this67;
|
12085
12092
|
_classCallCheck(this, Jt);
|
12086
12093
|
var r;
|
12087
|
-
|
12088
|
-
var n =
|
12089
|
-
i &&
|
12090
|
-
return
|
12094
|
+
_this67 = _super47.call(this, Jt.createButtonElement(), (r = i == null ? void 0 : i.button) == null ? void 0 : r.position, (i == null ? void 0 : i.button) || {}, "Photo");
|
12095
|
+
var n = _this67.createInnerElements(_this67._customStyles);
|
12096
|
+
i && _this67.addClickEvent(e, t, i.modalContainerStyle, i.files), _this67.elementRef.classList.add("upload-file-button"), _this67.elementRef.appendChild(n.styles), _this67.reapplyStateStyle("styles");
|
12097
|
+
return _this67;
|
12091
12098
|
}
|
12092
12099
|
_createClass(Jt, [{
|
12093
12100
|
key: "createInnerElements",
|
@@ -12193,9 +12200,9 @@ var ut = /*#__PURE__*/function () {
|
|
12193
12200
|
key: "addElements",
|
12194
12201
|
value: function addElements(e, t, i, n, r, o) {
|
12195
12202
|
ne.addElements(e, t.elementRef);
|
12196
|
-
var a =
|
12203
|
+
var a = Xe.create(),
|
12197
12204
|
l = j.addButtons(a, i, n, o);
|
12198
|
-
zo.set(t.inputElementRef, a, r.elementRef, l),
|
12205
|
+
zo.set(t.inputElementRef, a, r.elementRef, l), Xe.add(e, a);
|
12199
12206
|
}
|
12200
12207
|
}]);
|
12201
12208
|
return ut;
|
@@ -12234,22 +12241,22 @@ var b = /*#__PURE__*/function (_co) {
|
|
12234
12241
|
_inherits(b, _co);
|
12235
12242
|
var _super48 = _createSuper(b);
|
12236
12243
|
function b() {
|
12237
|
-
var
|
12244
|
+
var _this68;
|
12238
12245
|
_classCallCheck(this, b);
|
12239
|
-
|
12246
|
+
_this68 = _super48.call(this), _this68.getMessages = function () {
|
12240
12247
|
return [];
|
12241
|
-
},
|
12248
|
+
}, _this68.submitUserMessage = function () {
|
12242
12249
|
return console.warn("submitUserMessage failed - please wait for chat view to render before calling this property.");
|
12243
|
-
},
|
12250
|
+
}, _this68.addMessage = function () {
|
12244
12251
|
return console.warn("addMessage failed - please wait for chat view to render before calling this property.");
|
12245
|
-
},
|
12246
|
-
return Yt.focusFromParentElement(
|
12247
|
-
},
|
12252
|
+
}, _this68.focusInput = function () {
|
12253
|
+
return Yt.focusFromParentElement(_this68._elementRef);
|
12254
|
+
}, _this68.refreshMessages = function () {}, _this68.clearMessages = function () {}, _this68.scrollToBottom = function () {}, _this68.disableSubmitButton = function () {}, _this68.onNewMessage = function () {}, _this68.onClearMessages = function () {}, _this68.onComponentRender = function () {}, _this68._hasBeenRendered = !1, _this68._auxiliaryStyleApplied = !1, jo.appendStyleSheetToHead(), _this68._elementRef = document.createElement("div"), _this68._elementRef.id = "container", _this68.attachShadow({
|
12248
12255
|
mode: "open"
|
12249
|
-
}).appendChild(
|
12250
|
-
|
12256
|
+
}).appendChild(_this68._elementRef), bi.apply(Sa, _this68.shadowRoot), setTimeout(function () {
|
12257
|
+
_this68._hasBeenRendered || _this68.onRender();
|
12251
12258
|
}, 20);
|
12252
|
-
return
|
12259
|
+
return _this68;
|
12253
12260
|
}
|
12254
12261
|
_createClass(b, [{
|
12255
12262
|
key: "changeToChatView",
|