deep-chat-dev 9.0.111 → 9.0.114
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 +1449 -1430
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.js +996 -964
- package/dist/services/openAI/openAIAssistantIO.d.ts.map +1 -1
- package/dist/services/openAI/utils/openAIAssistantFiles.d.ts +5 -12
- package/dist/services/openAI/utils/openAIAssistantFiles.d.ts.map +1 -1
- package/dist/services/openAI/utils/openAIUtils.d.ts +0 -2
- package/dist/services/openAI/utils/openAIUtils.d.ts.map +1 -1
- package/dist/utils/HTTP/stream.d.ts.map +1 -1
- package/dist/views/chat/messages/fileMessageUtils.d.ts +2 -2
- package/dist/views/chat/messages/fileMessageUtils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/deepChat.js
CHANGED
@@ -186,11 +186,11 @@ var wi = zn;
|
|
186
186
|
var R = /* @__PURE__ */function (s) {
|
187
187
|
return s.ESCAPE = "Escape", s.ENTER = "Enter", s.TAB = "Tab", s.ARROW_UP = "ArrowUp", s.ARROW_DOWN = "ArrowDown", s.ARROW_RIGHT = "ArrowRight", s.ARROW_LEFT = "ArrowLeft", s.BACKSPACE = "Backspace", s.DELETE = "Delete", s.META = "Meta", s.CONTROL = "Control", s;
|
188
188
|
}(R || {});
|
189
|
-
var
|
190
|
-
_classCallCheck(this,
|
189
|
+
var be = /*#__PURE__*/_createClass(function be() {
|
190
|
+
_classCallCheck(this, be);
|
191
191
|
});
|
192
|
-
|
193
|
-
|
192
|
+
be.IS_SAFARI = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
193
|
+
be.IS_CHROMIUM = window.chrome;
|
194
194
|
var Un = /*#__PURE__*/function () {
|
195
195
|
function rt() {
|
196
196
|
_classCallCheck(this, rt);
|
@@ -241,28 +241,28 @@ var xs = /*#__PURE__*/function () {
|
|
241
241
|
return xs;
|
242
242
|
}();
|
243
243
|
var qn = /*#__PURE__*/function () {
|
244
|
-
function
|
244
|
+
function He(e, t) {
|
245
245
|
var _this = this;
|
246
|
-
_classCallCheck(this,
|
246
|
+
_classCallCheck(this, He);
|
247
247
|
var n;
|
248
|
-
var i =
|
249
|
-
this.elementRef =
|
248
|
+
var i = He.processConfig(t, e.textInput);
|
249
|
+
this.elementRef = He.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
|
ys.add(_this.inputElementRef, (r = e.textInput) == null ? void 0 : r.characterLimit, e._validationHandler);
|
252
252
|
});
|
253
253
|
}
|
254
|
-
_createClass(
|
254
|
+
_createClass(He, [{
|
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 = He.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 && He.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)), He.clear(this.inputElementRef), this.inputElementRef.classList.remove("text-input-placeholder"));
|
266
266
|
}
|
267
267
|
}, {
|
268
268
|
key: "addEventListeners",
|
@@ -274,7 +274,7 @@ var qn = /*#__PURE__*/function () {
|
|
274
274
|
key: "onFocus",
|
275
275
|
value: function onFocus(e) {
|
276
276
|
var _this2 = this;
|
277
|
-
|
277
|
+
be.IS_SAFARI ? setTimeout(function () {
|
278
278
|
_this2.removeTextIfPlaceholder();
|
279
279
|
}) : this.removeTextIfPlaceholder(), Object.assign(this.elementRef.style, e);
|
280
280
|
}
|
@@ -318,7 +318,7 @@ var qn = /*#__PURE__*/function () {
|
|
318
318
|
key: "clear",
|
319
319
|
value: function clear(e) {
|
320
320
|
var t = window.scrollY;
|
321
|
-
e.classList.contains("text-input-disabled") || (e.textContent = ""),
|
321
|
+
e.classList.contains("text-input-disabled") || (e.textContent = ""), be.IS_CHROMIUM && window.scrollTo({
|
322
322
|
top: t
|
323
323
|
});
|
324
324
|
}
|
@@ -334,7 +334,7 @@ var qn = /*#__PURE__*/function () {
|
|
334
334
|
return t.id = "text-input-container", Object.assign(t.style, e), t;
|
335
335
|
}
|
336
336
|
}]);
|
337
|
-
return
|
337
|
+
return He;
|
338
338
|
}();
|
339
339
|
qn.TEXT_INPUT_ID = "text-input";
|
340
340
|
var Hi = qn;
|
@@ -435,7 +435,7 @@ var ln = "Make sure the events are using {text: string} or {html: string} format
|
|
435
435
|
return Gn;
|
436
436
|
}();
|
437
437
|
Hn.CODE_SNIPPET_GENERATION_JUMP = 0.5;
|
438
|
-
var
|
438
|
+
var Z = Hn;
|
439
439
|
var Vn = /*#__PURE__*/function () {
|
440
440
|
function Wn() {
|
441
441
|
_classCallCheck(this, Wn);
|
@@ -468,11 +468,11 @@ var Vn = /*#__PURE__*/function () {
|
|
468
468
|
}();
|
469
469
|
Vn.LOAD_VOICES_MS = 200;
|
470
470
|
var jt = Vn;
|
471
|
-
var
|
472
|
-
function
|
473
|
-
_classCallCheck(this,
|
471
|
+
var Le = /*#__PURE__*/function () {
|
472
|
+
function Le() {
|
473
|
+
_classCallCheck(this, Le);
|
474
474
|
}
|
475
|
-
_createClass(
|
475
|
+
_createClass(Le, null, [{
|
476
476
|
key: "checkForContainerStyles",
|
477
477
|
value: function checkForContainerStyles(e, t) {
|
478
478
|
var i = e.containerStyle;
|
@@ -510,13 +510,13 @@ var ke = /*#__PURE__*/function () {
|
|
510
510
|
(t = e.children[0]) != null && t.classList.contains("deep-chat-update-message") && (console.error('The "deep-chat-update-message" html class is deprecated since version 1.4.4.'), console.error("Please change to using {..., overwrite: true} object: https://deepchat.dev/docs/connect#Response"));
|
511
511
|
}
|
512
512
|
}]);
|
513
|
-
return
|
513
|
+
return Le;
|
514
514
|
}();
|
515
515
|
var ii = /*#__PURE__*/function () {
|
516
|
-
function
|
517
|
-
_classCallCheck(this,
|
516
|
+
function Se() {
|
517
|
+
_classCallCheck(this, Se);
|
518
518
|
}
|
519
|
-
_createClass(
|
519
|
+
_createClass(Se, null, [{
|
520
520
|
key: "getLastElementsByClass",
|
521
521
|
value: function getLastElementsByClass(e, t, i) {
|
522
522
|
var _loop = function _loop() {
|
@@ -557,8 +557,8 @@ var ii = /*#__PURE__*/function () {
|
|
557
557
|
}, {
|
558
558
|
key: "overwriteMessage",
|
559
559
|
value: function overwriteMessage(e, t, i, n, r, o) {
|
560
|
-
var a =
|
561
|
-
l =
|
560
|
+
var a = Se.getLastElementsByClass(t, [Se.getRoleClass(n), o], ["loading-message-text"]),
|
561
|
+
l = Se.getLastMessage(e, n, r);
|
562
562
|
return l && (l[r] = i), a;
|
563
563
|
}
|
564
564
|
}, {
|
@@ -570,18 +570,18 @@ var ii = /*#__PURE__*/function () {
|
|
570
570
|
}, {
|
571
571
|
key: "fillEmptyMessageElement",
|
572
572
|
value: function fillEmptyMessageElement(e, t) {
|
573
|
-
t.trim().length === 0 && (e.classList.add(
|
573
|
+
t.trim().length === 0 && (e.classList.add(Se.EMPTY_MESSAGE_CLASS), e.innerHTML = '<div style="color:#00000000">.</div>');
|
574
574
|
}
|
575
575
|
}, {
|
576
576
|
key: "unfillEmptyMessageElement",
|
577
577
|
value: function unfillEmptyMessageElement(e, t) {
|
578
|
-
e.classList.contains(
|
578
|
+
e.classList.contains(Se.EMPTY_MESSAGE_CLASS) && t.trim().length > 0 && e.replaceChildren();
|
579
579
|
}
|
580
580
|
}, {
|
581
581
|
key: "getLastMessageBubbleElement",
|
582
582
|
value: function getLastMessageBubbleElement(e) {
|
583
583
|
var t, i, n;
|
584
|
-
return Array.from(((n = (i = (t =
|
584
|
+
return Array.from(((n = (i = (t = Se.getLastMessageElement(e)) == null ? void 0 : t.children) == null ? void 0 : i[0]) == null ? void 0 : n.children) || []).find(function (r) {
|
585
585
|
return r.classList.contains("message-bubble");
|
586
586
|
});
|
587
587
|
}
|
@@ -591,17 +591,17 @@ var ii = /*#__PURE__*/function () {
|
|
591
591
|
return e.children[e.children.length - 1];
|
592
592
|
}
|
593
593
|
}]);
|
594
|
-
return
|
594
|
+
return Se;
|
595
595
|
}();
|
596
596
|
ii.AI_ROLE = "ai";
|
597
597
|
ii.USER_ROLE = "user";
|
598
598
|
ii.EMPTY_MESSAGE_CLASS = "empty-message";
|
599
599
|
var v = ii;
|
600
|
-
var
|
601
|
-
function
|
602
|
-
_classCallCheck(this,
|
600
|
+
var Ae = /*#__PURE__*/function () {
|
601
|
+
function Ae() {
|
602
|
+
_classCallCheck(this, Ae);
|
603
603
|
}
|
604
|
-
_createClass(
|
604
|
+
_createClass(Ae, null, [{
|
605
605
|
key: "mouseUp",
|
606
606
|
value: function mouseUp(e, t) {
|
607
607
|
T.unsetAllCSSMouseStates(e, t), Object.assign(e.style, t["default"]), Object.assign(e.style, t.hover);
|
@@ -624,10 +624,10 @@ var Te = /*#__PURE__*/function () {
|
|
624
624
|
}, {
|
625
625
|
key: "add",
|
626
626
|
value: function add(e, t) {
|
627
|
-
e.addEventListener("mouseenter",
|
627
|
+
e.addEventListener("mouseenter", Ae.mouseEnter.bind(this, e, t)), e.addEventListener("mouseleave", Ae.mouseLeave.bind(this, e, t)), e.addEventListener("mousedown", Ae.mouseDown.bind(this, e, t)), e.addEventListener("mouseup", Ae.mouseUp.bind(this, e, t));
|
628
628
|
}
|
629
629
|
}]);
|
630
|
-
return
|
630
|
+
return Ae;
|
631
631
|
}();
|
632
632
|
var Ms = "deep-chat-temporary-message",
|
633
633
|
Ts = "deep-chat-suggestion-button",
|
@@ -653,11 +653,11 @@ var Ms = "deep-chat-temporary-message",
|
|
653
653
|
}
|
654
654
|
},
|
655
655
|
cn = Object.keys(Oi);
|
656
|
-
var
|
657
|
-
function
|
658
|
-
_classCallCheck(this,
|
656
|
+
var ve = /*#__PURE__*/function () {
|
657
|
+
function ve() {
|
658
|
+
_classCallCheck(this, ve);
|
659
659
|
}
|
660
|
-
_createClass(
|
660
|
+
_createClass(ve, null, [{
|
661
661
|
key: "applySuggestionEvent",
|
662
662
|
value: function applySuggestionEvent(e, t) {
|
663
663
|
setTimeout(function () {
|
@@ -712,17 +712,17 @@ var be = /*#__PURE__*/function () {
|
|
712
712
|
cn.forEach(function (r) {
|
713
713
|
var o = i.getElementsByClassName(r);
|
714
714
|
Array.from(o || []).forEach(function (a) {
|
715
|
-
var l =
|
716
|
-
se.applyStylesToElement(a, l),
|
715
|
+
var l = ve.getProcessedStyles(t, a, r);
|
716
|
+
se.applyStylesToElement(a, l), ve.applyEvents(a, r);
|
717
717
|
});
|
718
718
|
});
|
719
719
|
var n = i.getElementsByClassName(Ts);
|
720
720
|
Array.from(n).forEach(function (r) {
|
721
|
-
return
|
721
|
+
return ve.applySuggestionEvent(e, r);
|
722
722
|
});
|
723
723
|
}
|
724
724
|
}]);
|
725
|
-
return
|
725
|
+
return ve;
|
726
726
|
}();
|
727
727
|
var se = /*#__PURE__*/function () {
|
728
728
|
function se() {
|
@@ -732,7 +732,7 @@ var se = /*#__PURE__*/function () {
|
|
732
732
|
key: "applyStylesToElement",
|
733
733
|
value: function applyStylesToElement(e, t) {
|
734
734
|
var i = T.processStateful(t, {}, {});
|
735
|
-
|
735
|
+
Ae.add(e, i), Object.assign(e.style, i["default"]);
|
736
736
|
}
|
737
737
|
}, {
|
738
738
|
key: "applyEventsToElement",
|
@@ -747,7 +747,7 @@ var se = /*#__PURE__*/function () {
|
|
747
747
|
value: function applyClassUtilitiesToElement(e, t) {
|
748
748
|
var i = t.events,
|
749
749
|
n = t.styles;
|
750
|
-
i && se.applyEventsToElement(e, i), n && !
|
750
|
+
i && se.applyEventsToElement(e, i), n && !ve.doesElementContainDeepChatClass(e) && se.applyStylesToElement(e, n);
|
751
751
|
}
|
752
752
|
}, {
|
753
753
|
key: "applyCustomClassUtilities",
|
@@ -762,7 +762,7 @@ var se = /*#__PURE__*/function () {
|
|
762
762
|
}, {
|
763
763
|
key: "apply",
|
764
764
|
value: function apply(e, t) {
|
765
|
-
|
765
|
+
ve.applyDeepChatUtilities(e, e.htmlClassUtilities, t), se.applyCustomClassUtilities(e.htmlClassUtilities, t);
|
766
766
|
}
|
767
767
|
}]);
|
768
768
|
return se;
|
@@ -787,7 +787,7 @@ var Xe = /*#__PURE__*/function () {
|
|
787
787
|
value: function overwrite(e, t, i, n) {
|
788
788
|
var r = e.messages,
|
789
789
|
o = v.overwriteMessage(r, n, t, i, "html", "html-message");
|
790
|
-
return o && (o.bubbleElement.innerHTML = t, se.apply(e, o.outerContainer),
|
790
|
+
return o && (o.bubbleElement.innerHTML = t, se.apply(e, o.outerContainer), Le.flagHTMLUpdateClass(o.bubbleElement)), o;
|
791
791
|
}
|
792
792
|
// prettier-ignore
|
793
793
|
}, {
|
@@ -800,7 +800,7 @@ var Xe = /*#__PURE__*/function () {
|
|
800
800
|
r.status = !1;
|
801
801
|
}
|
802
802
|
var o = Xe.createElements(e, t, i);
|
803
|
-
return v.fillEmptyMessageElement(o.bubbleElement, t), se.apply(e, o.outerContainer),
|
803
|
+
return v.fillEmptyMessageElement(o.bubbleElement, t), se.apply(e, o.outerContainer), Le.flagHTMLUpdateClass(o.bubbleElement), e.applyCustomStyles(o, i, !1, (a = e.messageStyles) == null ? void 0 : a.html), Xe.addElement(e, o.outerContainer), o;
|
804
804
|
}
|
805
805
|
}]);
|
806
806
|
return Xe;
|
@@ -847,7 +847,7 @@ function Rs(s, e) {
|
|
847
847
|
i = Kn(e);
|
848
848
|
return e !== i ? i : e.charCodeAt(0) === 35 && Ls.test(e) && (t = e[1].toLowerCase() === "x" ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10), $n(t)) ? Pi(t) : s;
|
849
849
|
}
|
850
|
-
function
|
850
|
+
function Re(s) {
|
851
851
|
return s.indexOf("&") < 0 ? s : s.replace(Is, Rs);
|
852
852
|
}
|
853
853
|
var Ns = /[&<>"]/,
|
@@ -869,10 +869,10 @@ m.blockquote_open = function () {
|
|
869
869
|
return "<blockquote>\n";
|
870
870
|
};
|
871
871
|
m.blockquote_close = function (s, e) {
|
872
|
-
return "</blockquote>" +
|
872
|
+
return "</blockquote>" + Oe(s, e);
|
873
873
|
};
|
874
874
|
m.code = function (s, e) {
|
875
|
-
return s[e].block ? "<pre><code>" + z(s[e].content) + "</code></pre>" +
|
875
|
+
return s[e].block ? "<pre><code>" + z(s[e].content) + "</code></pre>" + Oe(s, e) : "<code>" + z(s[e].content) + "</code>";
|
876
876
|
};
|
877
877
|
m.fence = function (s, e, t, i, n) {
|
878
878
|
var r = s[e],
|
@@ -884,9 +884,9 @@ m.fence = function (s, e, t, i, n) {
|
|
884
884
|
u;
|
885
885
|
if (r.params) {
|
886
886
|
if (c = r.params.split(/\s+/g), d = c.join(" "), As(n.rules.fence_custom, c[0])) return n.rules.fence_custom[c[0]](s, e, t, i, n);
|
887
|
-
l = z(
|
887
|
+
l = z(Re(gt(d))), o = ' class="' + a + l + '"';
|
888
888
|
}
|
889
|
-
return t.highlight ? u = t.highlight.apply(t.highlight, [r.content].concat(c)) || z(r.content) : u = z(r.content), "<pre><code" + o + ">" + u + "</code></pre>" +
|
889
|
+
return t.highlight ? u = t.highlight.apply(t.highlight, [r.content].concat(c)) || z(r.content) : u = z(r.content), "<pre><code" + o + ">" + u + "</code></pre>" + Oe(s, e);
|
890
890
|
};
|
891
891
|
m.fence_custom = {};
|
892
892
|
m.heading_open = function (s, e) {
|
@@ -896,13 +896,13 @@ m.heading_close = function (s, e) {
|
|
896
896
|
return "</h" + s[e].hLevel + ">\n";
|
897
897
|
};
|
898
898
|
m.hr = function (s, e, t) {
|
899
|
-
return (t.xhtmlOut ? "<hr />" : "<hr>") +
|
899
|
+
return (t.xhtmlOut ? "<hr />" : "<hr>") + Oe(s, e);
|
900
900
|
};
|
901
901
|
m.bullet_list_open = function () {
|
902
902
|
return "<ul>\n";
|
903
903
|
};
|
904
904
|
m.bullet_list_close = function (s, e) {
|
905
|
-
return "</ul>" +
|
905
|
+
return "</ul>" + Oe(s, e);
|
906
906
|
};
|
907
907
|
m.list_item_open = function () {
|
908
908
|
return "<li>";
|
@@ -916,17 +916,17 @@ m.ordered_list_open = function (s, e) {
|
|
916
916
|
return "<ol" + i + ">\n";
|
917
917
|
};
|
918
918
|
m.ordered_list_close = function (s, e) {
|
919
|
-
return "</ol>" +
|
919
|
+
return "</ol>" + Oe(s, e);
|
920
920
|
};
|
921
921
|
m.paragraph_open = function (s, e) {
|
922
922
|
return s[e].tight ? "" : "<p>";
|
923
923
|
};
|
924
924
|
m.paragraph_close = function (s, e) {
|
925
925
|
var t = !(s[e].tight && e && s[e - 1].type === "inline" && !s[e - 1].content);
|
926
|
-
return (s[e].tight ? "" : "</p>") + (t ?
|
926
|
+
return (s[e].tight ? "" : "</p>") + (t ? Oe(s, e) : "");
|
927
927
|
};
|
928
928
|
m.link_open = function (s, e, t) {
|
929
|
-
var i = s[e].title ? ' title="' + z(
|
929
|
+
var i = s[e].title ? ' title="' + z(Re(s[e].title)) + '"' : "",
|
930
930
|
n = t.linkTarget ? ' target="' + t.linkTarget + '"' : "";
|
931
931
|
return '<a href="' + z(s[e].href) + '"' + i + n + ">";
|
932
932
|
};
|
@@ -935,8 +935,8 @@ m.link_close = function () {
|
|
935
935
|
};
|
936
936
|
m.image = function (s, e, t) {
|
937
937
|
var i = ' src="' + z(s[e].src) + '"',
|
938
|
-
n = s[e].title ? ' title="' + z(
|
939
|
-
r = ' alt="' + (s[e].alt ? z(
|
938
|
+
n = s[e].title ? ' title="' + z(Re(s[e].title)) + '"' : "",
|
939
|
+
r = ' alt="' + (s[e].alt ? z(Re(gt(s[e].alt))) : "") + '"',
|
940
940
|
o = t.xhtmlOut ? " /" : "";
|
941
941
|
return "<img" + i + r + n + o + ">";
|
942
942
|
};
|
@@ -1030,7 +1030,7 @@ m.htmltag = function (s, e) {
|
|
1030
1030
|
return s[e].content;
|
1031
1031
|
};
|
1032
1032
|
m.abbr_open = function (s, e) {
|
1033
|
-
return '<abbr title="' + z(
|
1033
|
+
return '<abbr title="' + z(Re(s[e].title)) + '">';
|
1034
1034
|
};
|
1035
1035
|
m.abbr_close = function () {
|
1036
1036
|
return "</abbr>";
|
@@ -1080,7 +1080,7 @@ m.dd_close = function () {
|
|
1080
1080
|
function Yn(s, e) {
|
1081
1081
|
return ++e >= s.length - 2 ? e : s[e].type === "paragraph_open" && s[e].tight && s[e + 1].type === "inline" && s[e + 1].content.length === 0 && s[e + 2].type === "paragraph_close" && s[e + 2].tight ? Yn(s, e + 2) : e;
|
1082
1082
|
}
|
1083
|
-
var
|
1083
|
+
var Oe = m.getBreak = function (e, t) {
|
1084
1084
|
return t = Yn(e, t), t < e.length && e[t].type === "list_item_close" ? "" : "\n";
|
1085
1085
|
};
|
1086
1086
|
function Vi() {
|
@@ -1094,14 +1094,14 @@ Vi.prototype.render = function (s, e, t) {
|
|
1094
1094
|
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);
|
1095
1095
|
return o;
|
1096
1096
|
};
|
1097
|
-
function
|
1097
|
+
function G() {
|
1098
1098
|
this.__rules__ = [], this.__cache__ = null;
|
1099
1099
|
}
|
1100
|
-
|
1100
|
+
G.prototype.__find__ = function (s) {
|
1101
1101
|
for (var e = this.__rules__.length, t = -1; e--;) if (this.__rules__[++t].name === s) return t;
|
1102
1102
|
return -1;
|
1103
1103
|
};
|
1104
|
-
|
1104
|
+
G.prototype.__compile__ = function () {
|
1105
1105
|
var s = this,
|
1106
1106
|
e = [""];
|
1107
1107
|
s.__rules__.forEach(function (t) {
|
@@ -1114,13 +1114,13 @@ H.prototype.__compile__ = function () {
|
|
1114
1114
|
});
|
1115
1115
|
});
|
1116
1116
|
};
|
1117
|
-
|
1117
|
+
G.prototype.at = function (s, e, t) {
|
1118
1118
|
var i = this.__find__(s),
|
1119
1119
|
n = t || {};
|
1120
1120
|
if (i === -1) throw new Error("Parser rule not found: " + s);
|
1121
1121
|
this.__rules__[i].fn = e, this.__rules__[i].alt = n.alt || [], this.__cache__ = null;
|
1122
1122
|
};
|
1123
|
-
|
1123
|
+
G.prototype.before = function (s, e, t, i) {
|
1124
1124
|
var n = this.__find__(s),
|
1125
1125
|
r = i || {};
|
1126
1126
|
if (n === -1) throw new Error("Parser rule not found: " + s);
|
@@ -1131,7 +1131,7 @@ H.prototype.before = function (s, e, t, i) {
|
|
1131
1131
|
alt: r.alt || []
|
1132
1132
|
}), this.__cache__ = null;
|
1133
1133
|
};
|
1134
|
-
|
1134
|
+
G.prototype.after = function (s, e, t, i) {
|
1135
1135
|
var n = this.__find__(s),
|
1136
1136
|
r = i || {};
|
1137
1137
|
if (n === -1) throw new Error("Parser rule not found: " + s);
|
@@ -1142,7 +1142,7 @@ H.prototype.after = function (s, e, t, i) {
|
|
1142
1142
|
alt: r.alt || []
|
1143
1143
|
}), this.__cache__ = null;
|
1144
1144
|
};
|
1145
|
-
|
1145
|
+
G.prototype.push = function (s, e, t) {
|
1146
1146
|
var i = t || {};
|
1147
1147
|
this.__rules__.push({
|
1148
1148
|
name: s,
|
@@ -1151,7 +1151,7 @@ H.prototype.push = function (s, e, t) {
|
|
1151
1151
|
alt: i.alt || []
|
1152
1152
|
}), this.__cache__ = null;
|
1153
1153
|
};
|
1154
|
-
|
1154
|
+
G.prototype.enable = function (s, e) {
|
1155
1155
|
s = Array.isArray(s) ? s : [s], e && this.__rules__.forEach(function (t) {
|
1156
1156
|
t.enabled = !1;
|
1157
1157
|
}), s.forEach(function (t) {
|
@@ -1160,14 +1160,14 @@ H.prototype.enable = function (s, e) {
|
|
1160
1160
|
this.__rules__[i].enabled = !0;
|
1161
1161
|
}, this), this.__cache__ = null;
|
1162
1162
|
};
|
1163
|
-
|
1163
|
+
G.prototype.disable = function (s) {
|
1164
1164
|
s = Array.isArray(s) ? s : [s], s.forEach(function (e) {
|
1165
1165
|
var t = this.__find__(e);
|
1166
1166
|
if (t < 0) throw new Error("Rules manager: invalid rule name " + e);
|
1167
1167
|
this.__rules__[t].enabled = !1;
|
1168
1168
|
}, this), this.__cache__ = null;
|
1169
1169
|
};
|
1170
|
-
|
1170
|
+
G.prototype.getRules = function (s) {
|
1171
1171
|
return this.__cache__ === null && this.__compile__(), this.__cache__[s] || [];
|
1172
1172
|
};
|
1173
1173
|
function js(s) {
|
@@ -1179,24 +1179,24 @@ function js(s) {
|
|
1179
1179
|
children: []
|
1180
1180
|
}) : s.block.parse(s.src, s.options, s.env, s.tokens);
|
1181
1181
|
}
|
1182
|
-
function
|
1182
|
+
function Pe(s, e, t, i, n) {
|
1183
1183
|
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;
|
1184
1184
|
}
|
1185
|
-
|
1185
|
+
Pe.prototype.pushPending = function () {
|
1186
1186
|
this.tokens.push({
|
1187
1187
|
type: "text",
|
1188
1188
|
content: this.pending,
|
1189
1189
|
level: this.pendingLevel
|
1190
1190
|
}), this.pending = "";
|
1191
1191
|
};
|
1192
|
-
|
1192
|
+
Pe.prototype.push = function (s) {
|
1193
1193
|
this.pending && this.pushPending(), this.tokens.push(s), this.pendingLevel = this.level;
|
1194
1194
|
};
|
1195
|
-
|
1195
|
+
Pe.prototype.cacheSet = function (s, e) {
|
1196
1196
|
for (var t = this.cache.length; t <= s; t++) this.cache.push(0);
|
1197
1197
|
this.cache[s] = e;
|
1198
1198
|
};
|
1199
|
-
|
1199
|
+
Pe.prototype.cacheGet = function (s) {
|
1200
1200
|
return s < this.cache.length ? this.cache[s] : 0;
|
1201
1201
|
};
|
1202
1202
|
function bt(s, e) {
|
@@ -1220,7 +1220,7 @@ function bt(s, e) {
|
|
1220
1220
|
}
|
1221
1221
|
function Fs(s, e, t, i) {
|
1222
1222
|
var n, r, o, a, l, c;
|
1223
|
-
if (s.charCodeAt(0) !== 42 || s.charCodeAt(1) !== 91 || s.indexOf("]:") === -1 || (n = new
|
1223
|
+
if (s.charCodeAt(0) !== 42 || s.charCodeAt(1) !== 91 || s.indexOf("]:") === -1 || (n = new Pe(s, e, t, i, []), r = bt(n, 1), r < 0 || s.charCodeAt(r + 1) !== 58)) return -1;
|
1224
1224
|
for (a = n.posMax, o = r + 2; o < a && n.src.charCodeAt(o) !== 10; o++);
|
1225
1225
|
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);
|
1226
1226
|
}
|
@@ -1238,7 +1238,7 @@ function Bs(s) {
|
|
1238
1238
|
}
|
1239
1239
|
}
|
1240
1240
|
function Di(s) {
|
1241
|
-
var e =
|
1241
|
+
var e = Re(s);
|
1242
1242
|
try {
|
1243
1243
|
e = decodeURI(e);
|
1244
1244
|
} catch (_unused2) {}
|
@@ -1293,7 +1293,7 @@ function Qn(s) {
|
|
1293
1293
|
}
|
1294
1294
|
function zs(s, e, t, i) {
|
1295
1295
|
var n, r, o, a, l, c, d, u, p;
|
1296
|
-
if (s.charCodeAt(0) !== 91 || s.indexOf("]:") === -1 || (n = new
|
1296
|
+
if (s.charCodeAt(0) !== 91 || s.indexOf("]:") === -1 || (n = new Pe(s, e, t, i, []), r = bt(n, 0), r < 0 || s.charCodeAt(r + 1) !== 58)) return -1;
|
1297
1297
|
for (a = n.posMax, o = r + 2; o < a && (l = n.src.charCodeAt(o), !(l !== 32 && l !== 10)); o++);
|
1298
1298
|
if (!Zn(n, o)) return -1;
|
1299
1299
|
for (d = n.linkContent, o = n.pos, c = o, o = o + 1; o < a && (l = n.src.charCodeAt(o), !(l !== 32 && l !== 10)); o++);
|
@@ -1453,7 +1453,7 @@ var Ys = /['"]/,
|
|
1453
1453
|
function pn(s, e) {
|
1454
1454
|
return e < 0 || e >= s.length ? !1 : !Zs.test(s[e]);
|
1455
1455
|
}
|
1456
|
-
function
|
1456
|
+
function Ue(s, e, t) {
|
1457
1457
|
return s.substr(0, e) + t + s.substr(e + 1);
|
1458
1458
|
}
|
1459
1459
|
function Xs(s) {
|
@@ -1465,12 +1465,12 @@ function Xs(s) {
|
|
1465
1465
|
w.length = h + 1, i = t.content, r = 0, o = i.length;
|
1466
1466
|
e: for (; r < o && (un.lastIndex = r, n = un.exec(i), !!n);) {
|
1467
1467
|
if (l = !pn(i, n.index - 1), r = n.index + 1, g = n[0] === "'", c = !pn(i, r), !c && !l) {
|
1468
|
-
g && (t.content =
|
1468
|
+
g && (t.content = Ue(t.content, n.index, hn));
|
1469
1469
|
continue;
|
1470
1470
|
}
|
1471
1471
|
if (u = !c, p = !l, p) {
|
1472
1472
|
for (h = w.length - 1; h >= 0 && (d = w[h], !(w[h].level < a)); h--) if (d.single === g && w[h].level === a) {
|
1473
|
-
d = w[h], g ? (S[d.token].content =
|
1473
|
+
d = w[h], g ? (S[d.token].content = Ue(S[d.token].content, d.pos, s.options.quotes[2]), t.content = Ue(t.content, n.index, s.options.quotes[3])) : (S[d.token].content = Ue(S[d.token].content, d.pos, s.options.quotes[0]), t.content = Ue(t.content, n.index, s.options.quotes[1])), w.length = h;
|
1474
1474
|
continue e;
|
1475
1475
|
}
|
1476
1476
|
}
|
@@ -1479,7 +1479,7 @@ function Xs(s) {
|
|
1479
1479
|
pos: n.index,
|
1480
1480
|
single: g,
|
1481
1481
|
level: a
|
1482
|
-
}) : p && g && (t.content =
|
1482
|
+
}) : p && g && (t.content = Ue(t.content, n.index, hn));
|
1483
1483
|
}
|
1484
1484
|
}
|
1485
1485
|
}
|
@@ -1487,14 +1487,14 @@ function Xs(s) {
|
|
1487
1487
|
}
|
1488
1488
|
var Mi = [["block", js], ["abbr", Bs], ["references", Us], ["inline", qs], ["footnote_tail", Hs], ["abbr2", Gs], ["replacements", $s], ["smartquotes", Xs]];
|
1489
1489
|
function es() {
|
1490
|
-
this.options = {}, this.ruler = new
|
1490
|
+
this.options = {}, this.ruler = new G();
|
1491
1491
|
for (var s = 0; s < Mi.length; s++) this.ruler.push(Mi[s][0], Mi[s][1]);
|
1492
1492
|
}
|
1493
1493
|
es.prototype.process = function (s) {
|
1494
1494
|
var e, t, i;
|
1495
1495
|
for (i = this.ruler.getRules(""), e = 0, t = i.length; e < t; e++) i[e](s);
|
1496
1496
|
};
|
1497
|
-
function
|
1497
|
+
function De(s, e, t, i, n) {
|
1498
1498
|
var r, o, a, l, c, d, u;
|
1499
1499
|
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++) {
|
1500
1500
|
if (r = o.charCodeAt(l), !u) if (r === 32) {
|
@@ -1505,27 +1505,27 @@ function Oe(s, e, t, i, n) {
|
|
1505
1505
|
}
|
1506
1506
|
this.bMarks.push(o.length), this.eMarks.push(o.length), this.tShift.push(0), this.lineMax = this.bMarks.length - 1;
|
1507
1507
|
}
|
1508
|
-
|
1508
|
+
De.prototype.isEmpty = function (e) {
|
1509
1509
|
return this.bMarks[e] + this.tShift[e] >= this.eMarks[e];
|
1510
1510
|
};
|
1511
|
-
|
1511
|
+
De.prototype.skipEmptyLines = function (e) {
|
1512
1512
|
for (var t = this.lineMax; e < t && !(this.bMarks[e] + this.tShift[e] < this.eMarks[e]); e++);
|
1513
1513
|
return e;
|
1514
1514
|
};
|
1515
|
-
|
1515
|
+
De.prototype.skipSpaces = function (e) {
|
1516
1516
|
for (var t = this.src.length; e < t && this.src.charCodeAt(e) === 32; e++);
|
1517
1517
|
return e;
|
1518
1518
|
};
|
1519
|
-
|
1519
|
+
De.prototype.skipChars = function (e, t) {
|
1520
1520
|
for (var i = this.src.length; e < i && this.src.charCodeAt(e) === t; e++);
|
1521
1521
|
return e;
|
1522
1522
|
};
|
1523
|
-
|
1523
|
+
De.prototype.skipCharsBack = function (e, t, i) {
|
1524
1524
|
if (e <= i) return e;
|
1525
1525
|
for (; e > i;) if (t !== this.src.charCodeAt(--e)) return e + 1;
|
1526
1526
|
return e;
|
1527
1527
|
};
|
1528
|
-
|
1528
|
+
De.prototype.getLines = function (e, t, i, n) {
|
1529
1529
|
var r,
|
1530
1530
|
o,
|
1531
1531
|
a,
|
@@ -1677,36 +1677,36 @@ function sr(s, e, t, i) {
|
|
1677
1677
|
f,
|
1678
1678
|
S,
|
1679
1679
|
w,
|
1680
|
-
G,
|
1681
|
-
A,
|
1682
1680
|
V,
|
1683
|
-
|
1684
|
-
|
1681
|
+
A,
|
1682
|
+
W,
|
1685
1683
|
Q,
|
1684
|
+
oe = !0,
|
1685
|
+
q,
|
1686
1686
|
O,
|
1687
|
-
|
1687
|
+
Ee,
|
1688
1688
|
Si;
|
1689
1689
|
if ((u = mn(s, e)) >= 0) S = !0;else if ((u = fn(s, e)) >= 0) S = !1;else return !1;
|
1690
1690
|
if (s.level >= s.options.maxNesting) return !1;
|
1691
1691
|
if (f = s.src.charCodeAt(u - 1), i) return !0;
|
1692
|
-
for (
|
1692
|
+
for (V = s.tokens.length, S ? (d = s.bMarks[e] + s.tShift[e], g = Number(s.src.substr(d, u - d - 1)), s.tokens.push({
|
1693
1693
|
type: "ordered_list_open",
|
1694
1694
|
order: g,
|
1695
|
-
lines:
|
1695
|
+
lines: W = [e, 0],
|
1696
1696
|
level: s.level++
|
1697
1697
|
})) : s.tokens.push({
|
1698
1698
|
type: "bullet_list_open",
|
1699
|
-
lines:
|
1699
|
+
lines: W = [e, 0],
|
1700
1700
|
level: s.level++
|
1701
|
-
}), n = e, A = !1,
|
1701
|
+
}), n = e, A = !1, q = s.parser.ruler.getRules("list"); n < t && (w = s.skipSpaces(u), p = s.eMarks[n], w >= p ? h = 1 : h = w - u, h > 4 && (h = 1), h < 1 && (h = 1), r = u - s.bMarks[n] + h, s.tokens.push({
|
1702
1702
|
type: "list_item_open",
|
1703
|
-
lines:
|
1703
|
+
lines: Q = [e, 0],
|
1704
1704
|
level: s.level++
|
1705
1705
|
}), a = s.blkIndent, l = s.tight, o = s.tShift[e], c = s.parentType, s.tShift[e] = w - s.bMarks[e], s.blkIndent = r, s.tight = !0, s.parentType = "list", s.parser.tokenize(s, e, t, !0), (!s.tight || A) && (oe = !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({
|
1706
1706
|
type: "list_item_close",
|
1707
1707
|
level: --s.level
|
1708
|
-
}), n = e = s.line,
|
1709
|
-
for (Si = !1, O = 0,
|
1708
|
+
}), n = e = s.line, Q[1] = n, w = s.bMarks[e], !(n >= t || s.isEmpty(n) || s.tShift[n] < s.blkIndent));) {
|
1709
|
+
for (Si = !1, O = 0, Ee = q.length; O < Ee; O++) if (q[O](s, n, t, !0)) {
|
1710
1710
|
Si = !0;
|
1711
1711
|
break;
|
1712
1712
|
}
|
@@ -1719,7 +1719,7 @@ function sr(s, e, t, i) {
|
|
1719
1719
|
return s.tokens.push({
|
1720
1720
|
type: S ? "ordered_list_close" : "bullet_list_close",
|
1721
1721
|
level: --s.level
|
1722
|
-
}),
|
1722
|
+
}), W[1] = n, s.line = n, oe && nr(s, V), !0;
|
1723
1723
|
}
|
1724
1724
|
function rr(s, e, t, i) {
|
1725
1725
|
var n,
|
@@ -2001,7 +2001,7 @@ function mr(s, e) {
|
|
2001
2001
|
}
|
2002
2002
|
var Ot = [["code", Qs], ["fences", er, ["paragraph", "blockquote", "list"]], ["blockquote", tr, ["paragraph", "blockquote", "list"]], ["hr", ir, ["paragraph", "blockquote", "list"]], ["list", sr, ["paragraph", "blockquote"]], ["footnote", rr, ["paragraph"]], ["heading", or, ["paragraph", "blockquote"]], ["lheading", ar], ["htmlblock", ur, ["paragraph", "blockquote"]], ["table", hr, ["paragraph"]], ["deflist", fr, ["paragraph"]], ["paragraph", mr]];
|
2003
2003
|
function Wi() {
|
2004
|
-
this.ruler = new
|
2004
|
+
this.ruler = new G();
|
2005
2005
|
for (var s = 0; s < Ot.length; s++) this.ruler.push(Ot[s][0], Ot[s][1], {
|
2006
2006
|
alt: (Ot[s][2] || []).slice()
|
2007
2007
|
});
|
@@ -2026,7 +2026,7 @@ Wi.prototype.parse = function (s, e, t, i) {
|
|
2026
2026
|
s = s.replace(vr, " "), s = s.replace(br, "\n"), s.indexOf(" ") >= 0 && (s = s.replace(gr, function (a, l) {
|
2027
2027
|
var c;
|
2028
2028
|
return s.charCodeAt(l) === 10 ? (r = l + 1, o = 0, a) : (c = " ".slice((l - r - o) % 4), o = l - r + 1, c);
|
2029
|
-
})), n = new
|
2029
|
+
})), n = new De(s, this, e, t, i), this.tokenize(n, n.line, n.lineMax);
|
2030
2030
|
};
|
2031
2031
|
function yr(s) {
|
2032
2032
|
switch (s) {
|
@@ -2486,7 +2486,7 @@ function io(s, e) {
|
|
2486
2486
|
}
|
2487
2487
|
var Ci = [["text", xr], ["newline", Er], ["escape", Sr], ["backticks", wr], ["del", _r], ["ins", Mr], ["mark", Tr], ["emphasis", Cr], ["sub", kr], ["sup", Lr], ["links", Rr], ["footnote_inline", Nr], ["footnote_ref", Or], ["autolink", Fr], ["htmltag", Qr], ["entity", io]];
|
2488
2488
|
function si() {
|
2489
|
-
this.ruler = new
|
2489
|
+
this.ruler = new G();
|
2490
2490
|
for (var s = 0; s < Ci.length; s++) this.ruler.push(Ci[s][0], Ci[s][1]);
|
2491
2491
|
this.validateLink = no;
|
2492
2492
|
}
|
@@ -2518,13 +2518,13 @@ si.prototype.tokenize = function (s) {
|
|
2518
2518
|
s.pending && s.pushPending();
|
2519
2519
|
};
|
2520
2520
|
si.prototype.parse = function (s, e, t, i) {
|
2521
|
-
var n = new
|
2521
|
+
var n = new Pe(s, this, e, t, i);
|
2522
2522
|
this.tokenize(n);
|
2523
2523
|
};
|
2524
2524
|
function no(s) {
|
2525
2525
|
var e = ["vbscript", "javascript", "file", "data"],
|
2526
2526
|
t = s.trim().toLowerCase();
|
2527
|
-
return t =
|
2527
|
+
return t = Re(t), !(t.indexOf(":") !== -1 && e.indexOf(t.split(":")[0]) !== -1);
|
2528
2528
|
}
|
2529
2529
|
var so = {
|
2530
2530
|
options: {
|
@@ -2644,7 +2644,7 @@ function is(s, e, t) {
|
|
2644
2644
|
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;
|
2645
2645
|
}
|
2646
2646
|
function he(s, e) {
|
2647
|
-
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 Wi(), this.core = new es(), this.renderer = new Vi(), this.ruler = new
|
2647
|
+
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 Wi(), this.core = new es(), this.renderer = new Vi(), this.ruler = new G(), this.options = {}, this.configure(ao[s]), this.set(e || {});
|
2648
2648
|
}
|
2649
2649
|
he.prototype.set = function (s) {
|
2650
2650
|
Jn(this.options, s);
|
@@ -2727,10 +2727,10 @@ var vt = /*#__PURE__*/function () {
|
|
2727
2727
|
return vt;
|
2728
2728
|
}();
|
2729
2729
|
var ns = /*#__PURE__*/function () {
|
2730
|
-
function
|
2731
|
-
_classCallCheck(this,
|
2730
|
+
function Ge() {
|
2731
|
+
_classCallCheck(this, Ge);
|
2732
2732
|
}
|
2733
|
-
_createClass(
|
2733
|
+
_createClass(Ge, null, [{
|
2734
2734
|
key: "addMessage",
|
2735
2735
|
value: function addMessage(e, t, i, n) {
|
2736
2736
|
var r;
|
@@ -2740,17 +2740,17 @@ var ns = /*#__PURE__*/function () {
|
|
2740
2740
|
key: "wrapInLink",
|
2741
2741
|
value: function wrapInLink(e, t, i) {
|
2742
2742
|
var n = document.createElement("a");
|
2743
|
-
return n.href = t, n.download = i ||
|
2743
|
+
return n.href = t, n.download = i || Ge.DEFAULT_FILE_NAME, n.target = "_blank", n.appendChild(e), n;
|
2744
2744
|
}
|
2745
2745
|
}, {
|
2746
2746
|
key: "isNonLinkableDataUrl",
|
2747
2747
|
value: function isNonLinkableDataUrl(e, t) {
|
2748
|
-
return
|
2748
|
+
return !t.startsWith("data") || e === "image" ? !1 : e === "any" && t.startsWith("data:text/javascript") || !t.startsWith("data:image");
|
2749
2749
|
}
|
2750
2750
|
}, {
|
2751
2751
|
key: "processContent",
|
2752
2752
|
value: function processContent(e, t, i, n) {
|
2753
|
-
return !
|
2753
|
+
return !i || Ge.isNonLinkableDataUrl(e, i) ? t : Ge.wrapInLink(t, i, n);
|
2754
2754
|
}
|
2755
2755
|
}, {
|
2756
2756
|
key: "waitToLoadThenScroll",
|
@@ -2762,11 +2762,11 @@ var ns = /*#__PURE__*/function () {
|
|
2762
2762
|
}, {
|
2763
2763
|
key: "scrollDownOnImageLoad",
|
2764
2764
|
value: function scrollDownOnImageLoad(e, t) {
|
2765
|
-
if (e.startsWith("data"))
|
2765
|
+
if (e.startsWith("data")) Ge.waitToLoadThenScroll(t);else try {
|
2766
2766
|
fetch(e, {
|
2767
2767
|
mode: "no-cors"
|
2768
2768
|
})["catch"](function () {})["finally"](function () {
|
2769
|
-
|
2769
|
+
Ge.waitToLoadThenScroll(t);
|
2770
2770
|
});
|
2771
2771
|
} catch (_unused5) {
|
2772
2772
|
t.scrollTop = t.scrollHeight;
|
@@ -2792,7 +2792,7 @@ var ns = /*#__PURE__*/function () {
|
|
2792
2792
|
return delete t.ref, t;
|
2793
2793
|
}
|
2794
2794
|
}]);
|
2795
|
-
return
|
2795
|
+
return Ge;
|
2796
2796
|
}();
|
2797
2797
|
ns.DEFAULT_FILE_NAME = "file";
|
2798
2798
|
var ne = ns;
|
@@ -2934,11 +2934,11 @@ var ce = /*#__PURE__*/function () {
|
|
2934
2934
|
}]);
|
2935
2935
|
return ce;
|
2936
2936
|
}();
|
2937
|
-
var
|
2938
|
-
function
|
2939
|
-
_classCallCheck(this,
|
2937
|
+
var Ke = /*#__PURE__*/function () {
|
2938
|
+
function Ke() {
|
2939
|
+
_classCallCheck(this, Ke);
|
2940
2940
|
}
|
2941
|
-
_createClass(
|
2941
|
+
_createClass(Ke, null, [{
|
2942
2942
|
key: "getPosition",
|
2943
2943
|
value: function getPosition(e, t) {
|
2944
2944
|
var _i5, _i6, _i7;
|
@@ -2962,28 +2962,28 @@ var We = /*#__PURE__*/function () {
|
|
2962
2962
|
key: "createName",
|
2963
2963
|
value: function createName(e, t) {
|
2964
2964
|
var i = document.createElement("div");
|
2965
|
-
return i.classList.add("name"), i.textContent =
|
2965
|
+
return i.classList.add("name"), i.textContent = Ke.getNameText(e, t), Ke.applyStyle(i, e, t), i;
|
2966
2966
|
}
|
2967
2967
|
}, {
|
2968
2968
|
key: "add",
|
2969
2969
|
value: function add(e, t, i) {
|
2970
2970
|
var n = typeof i == "boolean" ? {} : i,
|
2971
|
-
r =
|
2972
|
-
o =
|
2971
|
+
r = Ke.createName(t, n),
|
2972
|
+
o = Ke.getPosition(t, n);
|
2973
2973
|
r.classList.add(o === "left" ? "left-item-position" : "right-item-position"), e.insertAdjacentElement(o === "left" ? "beforebegin" : "afterend", r);
|
2974
2974
|
}
|
2975
2975
|
}]);
|
2976
|
-
return
|
2976
|
+
return Ke;
|
2977
2977
|
}();
|
2978
|
-
var
|
2979
|
-
function
|
2978
|
+
var $e = /*#__PURE__*/function () {
|
2979
|
+
function $e(e) {
|
2980
2980
|
var _this3 = this;
|
2981
|
-
_classCallCheck(this,
|
2982
|
-
this.messageElementRefs = [], this.messages = [], this.htmlClassUtilities = {}, this.textElementsToText = [], this.elementRef =
|
2981
|
+
_classCallCheck(this, $e);
|
2982
|
+
this.messageElementRefs = [], this.messages = [], this.htmlClassUtilities = {}, this.textElementsToText = [], this.elementRef = $e.createContainerElement(), this.messageStyles = e.messageStyles, this._remarkable = vt.createNew(), this._avatars = e.avatars, this._names = e.names, this._onNewMessage = Bt.onNewMessage.bind(this, e), e.htmlClassUtilities && (this.htmlClassUtilities = e.htmlClassUtilities), setTimeout(function () {
|
2983
2983
|
_this3.submitUserMessage = e.submitUserMessage;
|
2984
2984
|
});
|
2985
2985
|
}
|
2986
|
-
_createClass(
|
2986
|
+
_createClass($e, [{
|
2987
2987
|
key: "addNewTextMessage",
|
2988
2988
|
value: function addNewTextMessage(e, t, i) {
|
2989
2989
|
if (i != null && i.status) {
|
@@ -3011,7 +3011,7 @@ var Je = /*#__PURE__*/function () {
|
|
3011
3011
|
var _this4 = this;
|
3012
3012
|
var i = this.createNewMessageElement(e, t);
|
3013
3013
|
return this.elementRef.appendChild(i.outerContainer), setTimeout(function () {
|
3014
|
-
return
|
3014
|
+
return Z.scrollToBottom(_this4.elementRef);
|
3015
3015
|
}), i;
|
3016
3016
|
}
|
3017
3017
|
}, {
|
@@ -3020,12 +3020,12 @@ var Je = /*#__PURE__*/function () {
|
|
3020
3020
|
var n;
|
3021
3021
|
(n = this._introPanel) == null || n.hide();
|
3022
3022
|
var i = this.messageElementRefs[this.messageElementRefs.length - 1];
|
3023
|
-
return
|
3023
|
+
return $e.isTemporaryElement(i) && (i.outerContainer.remove(), this.messageElementRefs.pop()), this.createMessageElements(e, t);
|
3024
3024
|
}
|
3025
3025
|
}, {
|
3026
3026
|
key: "createMessageElements",
|
3027
3027
|
value: function createMessageElements(e, t) {
|
3028
|
-
var i =
|
3028
|
+
var i = $e.createBaseElements(),
|
3029
3029
|
n = i.outerContainer,
|
3030
3030
|
r = i.innerContainer,
|
3031
3031
|
o = i.bubbleElement;
|
@@ -3036,7 +3036,7 @@ var Je = /*#__PURE__*/function () {
|
|
3036
3036
|
value:
|
3037
3037
|
// prettier-ignore
|
3038
3038
|
function addInnerContainerElements(e, t, i) {
|
3039
|
-
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 && ce.add(e, i, this._avatars), this._names &&
|
3039
|
+
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 && ce.add(e, i, this._avatars), this._names && Ke.add(e, i, this._names), {
|
3040
3040
|
bubbleElement: e
|
3041
3041
|
};
|
3042
3042
|
}
|
@@ -3081,7 +3081,7 @@ var Je = /*#__PURE__*/function () {
|
|
3081
3081
|
}, {
|
3082
3082
|
key: "isTemporaryElement",
|
3083
3083
|
value: function isTemporaryElement(e) {
|
3084
|
-
return (e == null ? void 0 : e.bubbleElement.classList.contains("loading-message-text")) ||
|
3084
|
+
return (e == null ? void 0 : e.bubbleElement.classList.contains("loading-message-text")) || ve.isElementTemporary(e);
|
3085
3085
|
}
|
3086
3086
|
}, {
|
3087
3087
|
key: "createBaseElements",
|
@@ -3110,7 +3110,7 @@ var Je = /*#__PURE__*/function () {
|
|
3110
3110
|
return t && (a.text = t), i && (a.files = i), n && (a.html = n), !t && !i && !n && (a.text = ""), r && (a._sessionId = r), a;
|
3111
3111
|
}
|
3112
3112
|
}]);
|
3113
|
-
return
|
3113
|
+
return $e;
|
3114
3114
|
}();
|
3115
3115
|
var Ji = /*#__PURE__*/function () {
|
3116
3116
|
// used for extracting at end and for isStreaming
|
@@ -3125,13 +3125,13 @@ var Ji = /*#__PURE__*/function () {
|
|
3125
3125
|
if (this._hasStreamEnded) return;
|
3126
3126
|
if ((e == null ? void 0 : e.text) === void 0 && (e == null ? void 0 : e.html) === void 0) return console.error(C.INVALID_STREAM_EVENT);
|
3127
3127
|
var t = (e == null ? void 0 : e.text) || (e == null ? void 0 : e.html) || "",
|
3128
|
-
i =
|
3128
|
+
i = Z.isScrollbarAtBottomOfElement(this._messages.elementRef),
|
3129
3129
|
n = (e == null ? void 0 : e.text) !== void 0 ? "text" : "html";
|
3130
3130
|
if (!this._elements && this._streamedContent === "") this.setInitialState(n, t, e == null ? void 0 : e.role);else {
|
3131
3131
|
if (this._streamType !== n) return console.error(C.INVALID_STREAM_EVENT_MIX);
|
3132
3132
|
this.updateBasedOnType(t, n, (r = this._elements) == null ? void 0 : r.bubbleElement, e == null ? void 0 : e.overwrite);
|
3133
3133
|
}
|
3134
|
-
i &&
|
3134
|
+
i && Z.scrollToBottom(this._messages.elementRef);
|
3135
3135
|
}
|
3136
3136
|
}, {
|
3137
3137
|
key: "setInitialState",
|
@@ -3171,7 +3171,7 @@ var Ji = /*#__PURE__*/function () {
|
|
3171
3171
|
var n = {
|
3172
3172
|
role: this._activeMessageRole || v.AI_ROLE
|
3173
3173
|
};
|
3174
|
-
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 = v.getLastMessageBubbleElement(t)) == null ? void 0 : o.innerHTML) || ""), this._elements && se.apply(this._messages, this._elements.outerContainer), n.html = this._streamedContent), n && (this._messages.messages.push(n), this._messages.sendClientUpdate(
|
3174
|
+
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 = v.getLastMessageBubbleElement(t)) == null ? void 0 : o.innerHTML) || ""), this._elements && se.apply(this._messages, this._elements.outerContainer), n.html = this._streamedContent), n && (this._messages.messages.push(n), this._messages.sendClientUpdate($e.createMessageContent(n), !1)), this._hasStreamEnded = !0;
|
3175
3175
|
}
|
3176
3176
|
}]);
|
3177
3177
|
return ot;
|
@@ -3313,29 +3313,29 @@ function uo(_x10, _x11) {
|
|
3313
3313
|
return _uo.apply(this, arguments);
|
3314
3314
|
}
|
3315
3315
|
function _uo() {
|
3316
|
-
_uo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3316
|
+
_uo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee106(s, e) {
|
3317
3317
|
var t, i;
|
3318
|
-
return _regeneratorRuntime().wrap(function
|
3319
|
-
while (1) switch (
|
3318
|
+
return _regeneratorRuntime().wrap(function _callee106$(_context106) {
|
3319
|
+
while (1) switch (_context106.prev = _context106.next) {
|
3320
3320
|
case 0:
|
3321
3321
|
t = s.getReader();
|
3322
3322
|
case 1:
|
3323
|
-
|
3323
|
+
_context106.next = 3;
|
3324
3324
|
return t.read();
|
3325
3325
|
case 3:
|
3326
|
-
if ((i =
|
3327
|
-
|
3326
|
+
if ((i = _context106.sent).done) {
|
3327
|
+
_context106.next = 7;
|
3328
3328
|
break;
|
3329
3329
|
}
|
3330
3330
|
e(i.value);
|
3331
3331
|
case 5:
|
3332
|
-
|
3332
|
+
_context106.next = 1;
|
3333
3333
|
break;
|
3334
3334
|
case 7:
|
3335
3335
|
case "end":
|
3336
|
-
return
|
3336
|
+
return _context106.stop();
|
3337
3337
|
}
|
3338
|
-
},
|
3338
|
+
}, _callee106);
|
3339
3339
|
}));
|
3340
3340
|
return _uo.apply(this, arguments);
|
3341
3341
|
}
|
@@ -3429,25 +3429,25 @@ function bo(s, e) {
|
|
3429
3429
|
h.accept || (h.accept = ji);
|
3430
3430
|
var g;
|
3431
3431
|
function f() {
|
3432
|
-
g.abort(), document.hidden ||
|
3432
|
+
g.abort(), document.hidden || Q();
|
3433
3433
|
}
|
3434
3434
|
l || document.addEventListener("visibilitychange", f);
|
3435
3435
|
var S = go,
|
3436
3436
|
w = 0;
|
3437
|
-
function
|
3437
|
+
function V() {
|
3438
3438
|
document.removeEventListener("visibilitychange", f), window.clearTimeout(w), g.abort();
|
3439
3439
|
}
|
3440
3440
|
t == null || t.addEventListener("abort", function () {
|
3441
|
-
|
3441
|
+
V(), u();
|
3442
3442
|
});
|
3443
3443
|
var A = c !== null && c !== void 0 ? c : window.fetch,
|
3444
|
-
|
3445
|
-
function
|
3446
|
-
return
|
3444
|
+
W = n !== null && n !== void 0 ? n : vo;
|
3445
|
+
function Q() {
|
3446
|
+
return _Q.apply(this, arguments);
|
3447
3447
|
}
|
3448
|
-
function
|
3449
|
-
|
3450
|
-
var oe,
|
3448
|
+
function _Q() {
|
3449
|
+
_Q = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
3450
|
+
var oe, q, O;
|
3451
3451
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
3452
3452
|
while (1) switch (_context3.prev = _context3.next) {
|
3453
3453
|
case 0:
|
@@ -3459,19 +3459,19 @@ function bo(s, e) {
|
|
3459
3459
|
signal: g.signal
|
3460
3460
|
}));
|
3461
3461
|
case 4:
|
3462
|
-
|
3462
|
+
q = _context3.sent;
|
3463
3463
|
_context3.next = 7;
|
3464
|
-
return
|
3464
|
+
return W(q);
|
3465
3465
|
case 7:
|
3466
3466
|
_context3.next = 9;
|
3467
|
-
return uo(
|
3467
|
+
return uo(q.body, ho(po(function (O) {
|
3468
3468
|
O ? h[xn] = O : delete h[xn];
|
3469
3469
|
}, function (O) {
|
3470
3470
|
S = O;
|
3471
3471
|
}, r)));
|
3472
3472
|
case 9:
|
3473
3473
|
o == null || o();
|
3474
|
-
|
3474
|
+
V();
|
3475
3475
|
u();
|
3476
3476
|
_context3.next = 17;
|
3477
3477
|
break;
|
@@ -3480,9 +3480,9 @@ function bo(s, e) {
|
|
3480
3480
|
_context3.t0 = _context3["catch"](1);
|
3481
3481
|
if (!g.signal.aborted) try {
|
3482
3482
|
O = (oe = a == null ? void 0 : a(_context3.t0)) !== null && oe !== void 0 ? oe : S;
|
3483
|
-
window.clearTimeout(w), w = window.setTimeout(
|
3483
|
+
window.clearTimeout(w), w = window.setTimeout(Q, O);
|
3484
3484
|
} catch (O) {
|
3485
|
-
|
3485
|
+
V(), p(O);
|
3486
3486
|
}
|
3487
3487
|
case 17:
|
3488
3488
|
case "end":
|
@@ -3490,9 +3490,9 @@ function bo(s, e) {
|
|
3490
3490
|
}
|
3491
3491
|
}, _callee3, null, [[1, 14]]);
|
3492
3492
|
}));
|
3493
|
-
return
|
3493
|
+
return _Q.apply(this, arguments);
|
3494
3494
|
}
|
3495
|
-
|
3495
|
+
Q();
|
3496
3496
|
});
|
3497
3497
|
}
|
3498
3498
|
function vo(s) {
|
@@ -3572,7 +3572,7 @@ var rs = /*#__PURE__*/function () {
|
|
3572
3572
|
return lt;
|
3573
3573
|
}();
|
3574
3574
|
rs.URL = "deep-chat-demo";
|
3575
|
-
var
|
3575
|
+
var ye = rs;
|
3576
3576
|
var I = /*#__PURE__*/function () {
|
3577
3577
|
function I() {
|
3578
3578
|
_classCallCheck(this, I);
|
@@ -3588,7 +3588,7 @@ var I = /*#__PURE__*/function () {
|
|
3588
3588
|
f,
|
3589
3589
|
S,
|
3590
3590
|
w,
|
3591
|
-
|
3591
|
+
V,
|
3592
3592
|
r,
|
3593
3593
|
_yield$E$processReque,
|
3594
3594
|
o,
|
@@ -3629,19 +3629,19 @@ var I = /*#__PURE__*/function () {
|
|
3629
3629
|
_context7.next = 16;
|
3630
3630
|
break;
|
3631
3631
|
}
|
3632
|
-
return _context7.abrupt("return",
|
3632
|
+
return _context7.abrupt("return", Ie.stream(e, o, i));
|
3633
3633
|
case 16:
|
3634
|
-
if (!(((f = e.requestSettings) == null ? void 0 : f.url) ===
|
3634
|
+
if (!(((f = e.requestSettings) == null ? void 0 : f.url) === ye.URL)) {
|
3635
3635
|
_context7.next = 18;
|
3636
3636
|
break;
|
3637
3637
|
}
|
3638
|
-
return _context7.abrupt("return",
|
3638
|
+
return _context7.abrupt("return", ye.requestStream(i, e.streamHandlers));
|
3639
3639
|
case 18:
|
3640
3640
|
p = new Qe(i);
|
3641
3641
|
bo(((S = e.requestSettings) == null ? void 0 : S.url) || e.url || "", {
|
3642
3642
|
method: ((w = e.requestSettings) == null ? void 0 : w.method) || "POST",
|
3643
3643
|
headers: a,
|
3644
|
-
credentials: (
|
3644
|
+
credentials: (V = e.requestSettings) == null ? void 0 : V.credentials,
|
3645
3645
|
body: n ? JSON.stringify(o) : o,
|
3646
3646
|
openWhenHidden: !0,
|
3647
3647
|
// keep stream open when browser tab not open
|
@@ -3669,30 +3669,34 @@ var I = /*#__PURE__*/function () {
|
|
3669
3669
|
},
|
3670
3670
|
onmessage: function onmessage(A) {
|
3671
3671
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
3672
|
-
var
|
3672
|
+
var W, Q, oe, q, O;
|
3673
3673
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
3674
3674
|
while (1) switch (_context6.prev = _context6.next) {
|
3675
3675
|
case 0:
|
3676
|
-
if (!(
|
3676
|
+
if (!(JSON.stringify(A.data) !== JSON.stringify("[DONE]"))) {
|
3677
3677
|
_context6.next = 9;
|
3678
3678
|
break;
|
3679
3679
|
}
|
3680
|
-
|
3680
|
+
try {
|
3681
|
+
q = JSON.parse(A.data);
|
3682
|
+
} catch (_unused6) {
|
3683
|
+
q = {};
|
3684
|
+
}
|
3681
3685
|
_context6.next = 4;
|
3682
|
-
return (
|
3686
|
+
return (Q = (W = e.deepChat).responseInterceptor) == null ? void 0 : Q.call(W, q);
|
3683
3687
|
case 4:
|
3684
3688
|
_context6.t0 = _context6.sent;
|
3685
3689
|
if (_context6.t0) {
|
3686
3690
|
_context6.next = 7;
|
3687
3691
|
break;
|
3688
3692
|
}
|
3689
|
-
_context6.t0 =
|
3693
|
+
_context6.t0 = q;
|
3690
3694
|
case 7:
|
3691
3695
|
O = _context6.t0;
|
3692
|
-
(oe = e.extractResultData) == null || oe.call(e, O).then(function (
|
3693
|
-
p.upsertStreamedMessage(
|
3694
|
-
})["catch"](function (
|
3695
|
-
return E.displayError(i,
|
3696
|
+
(oe = e.extractResultData) == null || oe.call(e, O).then(function (Ee) {
|
3697
|
+
p.upsertStreamedMessage(Ee);
|
3698
|
+
})["catch"](function (Ee) {
|
3699
|
+
return E.displayError(i, Ee);
|
3696
3700
|
});
|
3697
3701
|
case 9:
|
3698
3702
|
case "end":
|
@@ -3709,11 +3713,11 @@ var I = /*#__PURE__*/function () {
|
|
3709
3713
|
},
|
3710
3714
|
signal: u.signal
|
3711
3715
|
})["catch"](function (A) {
|
3712
|
-
var
|
3713
|
-
(
|
3716
|
+
var W;
|
3717
|
+
(W = e.extractResultData) == null || W.call(e, A).then(function () {
|
3714
3718
|
E.displayError(i, A);
|
3715
|
-
})["catch"](function (
|
3716
|
-
E.displayError(i,
|
3719
|
+
})["catch"](function (Q) {
|
3720
|
+
E.displayError(i, Q);
|
3717
3721
|
});
|
3718
3722
|
});
|
3719
3723
|
case 20:
|
@@ -3770,11 +3774,11 @@ var I = /*#__PURE__*/function () {
|
|
3770
3774
|
}]);
|
3771
3775
|
return I;
|
3772
3776
|
}();
|
3773
|
-
var
|
3774
|
-
function
|
3775
|
-
_classCallCheck(this,
|
3777
|
+
var Ie = /*#__PURE__*/function () {
|
3778
|
+
function Ie() {
|
3779
|
+
_classCallCheck(this, Ie);
|
3776
3780
|
}
|
3777
|
-
_createClass(
|
3781
|
+
_createClass(Ie, null, [{
|
3778
3782
|
key: "request",
|
3779
3783
|
value: function () {
|
3780
3784
|
var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(e, t, i) {
|
@@ -3817,7 +3821,7 @@ var Ae = /*#__PURE__*/function () {
|
|
3817
3821
|
return function r(_x18) {
|
3818
3822
|
return _ref2.apply(this, arguments);
|
3819
3823
|
};
|
3820
|
-
}(), o =
|
3824
|
+
}(), o = Ie.generateOptionalSignals();
|
3821
3825
|
(l = (a = e.requestSettings).handler) == null || l.call(a, t, _objectSpread(_objectSpread({}, o), {}, {
|
3822
3826
|
onResponse: r
|
3823
3827
|
}));
|
@@ -3851,7 +3855,7 @@ var Ae = /*#__PURE__*/function () {
|
|
3851
3855
|
e.streamHandlers.abortStream.abort = function () {
|
3852
3856
|
o.finaliseStreamedMessage(), e.streamHandlers.onClose(), n = !1;
|
3853
3857
|
};
|
3854
|
-
var d =
|
3858
|
+
var d = Ie.generateOptionalSignals();
|
3855
3859
|
(p = (u = e.requestSettings).handler) == null || p.call(u, t, _objectSpread(_objectSpread({}, d), {}, {
|
3856
3860
|
onOpen: a,
|
3857
3861
|
onResponse: c,
|
@@ -3911,7 +3915,7 @@ var Ae = /*#__PURE__*/function () {
|
|
3911
3915
|
return _ref3.apply(this, arguments);
|
3912
3916
|
};
|
3913
3917
|
}(),
|
3914
|
-
a =
|
3918
|
+
a = Ie.generateOptionalSignals();
|
3915
3919
|
(c = (l = e.requestSettings).handler) == null || c.call(l, void 0, _objectSpread(_objectSpread({}, a), {}, {
|
3916
3920
|
onOpen: n,
|
3917
3921
|
onResponse: o,
|
@@ -3934,7 +3938,7 @@ var Ae = /*#__PURE__*/function () {
|
|
3934
3938
|
};
|
3935
3939
|
}
|
3936
3940
|
}]);
|
3937
|
-
return
|
3941
|
+
return Ie;
|
3938
3942
|
}();
|
3939
3943
|
var _ = /*#__PURE__*/function () {
|
3940
3944
|
function _() {
|
@@ -3984,13 +3988,13 @@ var _ = /*#__PURE__*/function () {
|
|
3984
3988
|
_context12.next = 13;
|
3985
3989
|
break;
|
3986
3990
|
}
|
3987
|
-
return _context12.abrupt("return",
|
3991
|
+
return _context12.abrupt("return", Ie.request(e, o, i));
|
3988
3992
|
case 13:
|
3989
|
-
if (!(((g = e.requestSettings) == null ? void 0 : g.url) ===
|
3993
|
+
if (!(((g = e.requestSettings) == null ? void 0 : g.url) === ye.URL)) {
|
3990
3994
|
_context12.next = 15;
|
3991
3995
|
break;
|
3992
3996
|
}
|
3993
|
-
return _context12.abrupt("return",
|
3997
|
+
return _context12.abrupt("return", ye.request(e, i));
|
3994
3998
|
case 15:
|
3995
3999
|
d = !0;
|
3996
4000
|
u = E.fetch.bind(this, e, a, n);
|
@@ -4000,7 +4004,7 @@ var _ = /*#__PURE__*/function () {
|
|
4000
4004
|
return E.processResponseByType(f);
|
4001
4005
|
}).then( /*#__PURE__*/function () {
|
4002
4006
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(f) {
|
4003
|
-
var
|
4007
|
+
var V, A, S, w;
|
4004
4008
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
4005
4009
|
while (1) switch (_context11.prev = _context11.next) {
|
4006
4010
|
case 0:
|
@@ -4011,7 +4015,7 @@ var _ = /*#__PURE__*/function () {
|
|
4011
4015
|
return _context11.abrupt("return");
|
4012
4016
|
case 2:
|
4013
4017
|
_context11.next = 4;
|
4014
|
-
return (A = (
|
4018
|
+
return (A = (V = e.deepChat).responseInterceptor) == null ? void 0 : A.call(V, f);
|
4015
4019
|
case 4:
|
4016
4020
|
_context11.t0 = _context11.sent;
|
4017
4021
|
if (_context11.t0) {
|
@@ -4224,14 +4228,14 @@ var et = /*#__PURE__*/function () {
|
|
4224
4228
|
}]);
|
4225
4229
|
return et;
|
4226
4230
|
}();
|
4227
|
-
var
|
4228
|
-
function
|
4229
|
-
_classCallCheck(this,
|
4231
|
+
var Y = /*#__PURE__*/function () {
|
4232
|
+
function Y() {
|
4233
|
+
_classCallCheck(this, Y);
|
4230
4234
|
}
|
4231
|
-
_createClass(
|
4235
|
+
_createClass(Y, null, [{
|
4232
4236
|
key: "setup",
|
4233
4237
|
value: function setup(e) {
|
4234
|
-
e.requestSettings.url !==
|
4238
|
+
e.requestSettings.url !== ye.URL && (e.permittedErrorPrefixes = ["Connection error", "Error in server message"], e.websocket = "pending");
|
4235
4239
|
}
|
4236
4240
|
}, {
|
4237
4241
|
key: "createConnection",
|
@@ -4239,18 +4243,18 @@ var $ = /*#__PURE__*/function () {
|
|
4239
4243
|
if (!document.body.contains(e.deepChat)) return;
|
4240
4244
|
var i = e.requestSettings.websocket;
|
4241
4245
|
if (i) {
|
4242
|
-
if (e.requestSettings.handler) return
|
4246
|
+
if (e.requestSettings.handler) return Ie.websocket(e, t);
|
4243
4247
|
try {
|
4244
4248
|
var n = typeof i != "boolean" ? i : void 0,
|
4245
4249
|
r = new WebSocket(e.requestSettings.url || "", n);
|
4246
4250
|
e.websocket = r, e.websocket.onopen = function () {
|
4247
4251
|
var o, a;
|
4248
|
-
t.removeError(), e.websocket && _typeof(e.websocket) == "object" &&
|
4252
|
+
t.removeError(), e.websocket && _typeof(e.websocket) == "object" && Y.assignListeners(e, r, t), (a = (o = e.deepChat)._validationHandler) == null || a.call(o);
|
4249
4253
|
}, e.websocket.onerror = function (o) {
|
4250
|
-
console.error(o),
|
4254
|
+
console.error(o), Y.retryConnection(e, t);
|
4251
4255
|
};
|
4252
4256
|
} catch (n) {
|
4253
|
-
console.error(n),
|
4257
|
+
console.error(n), Y.retryConnection(e, t);
|
4254
4258
|
}
|
4255
4259
|
}
|
4256
4260
|
}
|
@@ -4259,7 +4263,7 @@ var $ = /*#__PURE__*/function () {
|
|
4259
4263
|
value: function retryConnection(e, t) {
|
4260
4264
|
var i, n;
|
4261
4265
|
(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 () {
|
4262
|
-
|
4266
|
+
Y.createConnection(e, t);
|
4263
4267
|
}, 5e3));
|
4264
4268
|
}
|
4265
4269
|
}, {
|
@@ -4315,7 +4319,7 @@ var $ = /*#__PURE__*/function () {
|
|
4315
4319
|
return _ref6.apply(this, arguments);
|
4316
4320
|
};
|
4317
4321
|
}(), t.onclose = function () {
|
4318
|
-
console.error("Connection closed"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error"), e.deepChat.stream && e.streamHandlers.abortStream.abort(),
|
4322
|
+
console.error("Connection closed"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error"), e.deepChat.stream && e.streamHandlers.abortStream.abort(), Y.createConnection(e, i);
|
4319
4323
|
};
|
4320
4324
|
}
|
4321
4325
|
}, {
|
@@ -4359,18 +4363,18 @@ var $ = /*#__PURE__*/function () {
|
|
4359
4363
|
}
|
4360
4364
|
return _context16.abrupt("return", i.addNewErrorMessage("service", l));
|
4361
4365
|
case 12:
|
4362
|
-
if (
|
4366
|
+
if (Y.isWebSocket(r)) {
|
4363
4367
|
_context16.next = 14;
|
4364
4368
|
break;
|
4365
4369
|
}
|
4366
4370
|
return _context16.abrupt("return", r.newUserMessage.listener(a));
|
4367
4371
|
case 14:
|
4368
4372
|
c = n ? JSON.stringify(a) : a;
|
4369
|
-
if (!(((u = e.requestSettings) == null ? void 0 : u.url) ===
|
4373
|
+
if (!(((u = e.requestSettings) == null ? void 0 : u.url) === ye.URL)) {
|
4370
4374
|
_context16.next = 17;
|
4371
4375
|
break;
|
4372
4376
|
}
|
4373
|
-
return _context16.abrupt("return",
|
4377
|
+
return _context16.abrupt("return", ye.request(e, i));
|
4374
4378
|
case 17:
|
4375
4379
|
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());
|
4376
4380
|
case 18:
|
@@ -4387,7 +4391,7 @@ var $ = /*#__PURE__*/function () {
|
|
4387
4391
|
}, {
|
4388
4392
|
key: "canSendMessage",
|
4389
4393
|
value: function canSendMessage(e) {
|
4390
|
-
return e ? e === "pending" ? !1 :
|
4394
|
+
return e ? e === "pending" ? !1 : Y.isWebSocket(e) ? e.readyState !== void 0 && e.readyState === e.OPEN : e.isOpen : !0;
|
4391
4395
|
}
|
4392
4396
|
// if false then it is the internal websocket handler
|
4393
4397
|
}, {
|
@@ -4396,7 +4400,7 @@ var $ = /*#__PURE__*/function () {
|
|
4396
4400
|
return e.send !== void 0;
|
4397
4401
|
}
|
4398
4402
|
}]);
|
4399
|
-
return
|
4403
|
+
return Y;
|
4400
4404
|
}();
|
4401
4405
|
var L = /*#__PURE__*/function () {
|
4402
4406
|
function L() {
|
@@ -4506,14 +4510,14 @@ var L = /*#__PURE__*/function () {
|
|
4506
4510
|
}]);
|
4507
4511
|
return L;
|
4508
4512
|
}();
|
4509
|
-
var
|
4510
|
-
function
|
4513
|
+
var Ne = /*#__PURE__*/function () {
|
4514
|
+
function Ne(e, t, i) {
|
4511
4515
|
var _a$url;
|
4512
|
-
_classCallCheck(this,
|
4516
|
+
_classCallCheck(this, Ne);
|
4513
4517
|
var n, r, o, a;
|
4514
|
-
this.rawBody = {}, this.validateConfigKey = !1, this.canSendMessage =
|
4518
|
+
this.rawBody = {}, this.validateConfigKey = !1, this.canSendMessage = Ne.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 && Y.setup(this);
|
4515
4519
|
}
|
4516
|
-
_createClass(
|
4520
|
+
_createClass(Ne, [{
|
4517
4521
|
key: "verifyKey",
|
4518
4522
|
value: function verifyKey(e, t) {}
|
4519
4523
|
}, {
|
@@ -4588,7 +4592,7 @@ var Le = /*#__PURE__*/function () {
|
|
4588
4592
|
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
4589
4593
|
while (1) switch (_context19.prev = _context19.next) {
|
4590
4594
|
case 0:
|
4591
|
-
n =
|
4595
|
+
n = Ne.createCustomFormDataBody(this.rawBody, t, i), r = this.requestSettings, o = this.getServiceIOByType(i[0]);
|
4592
4596
|
this.requestSettings = (o == null ? void 0 : o.request) || this.requestSettings;
|
4593
4597
|
_context19.next = 4;
|
4594
4598
|
return this.request(n, e, !1);
|
@@ -4643,7 +4647,7 @@ var Le = /*#__PURE__*/function () {
|
|
4643
4647
|
n = _objectSpread({
|
4644
4648
|
messages: i
|
4645
4649
|
}, this.rawBody);
|
4646
|
-
|
4650
|
+
Y.sendWebsocket(this, n, t, !1);
|
4647
4651
|
} else this.callServiceAPI(t, i, e.files);
|
4648
4652
|
case 4:
|
4649
4653
|
case "end":
|
@@ -4673,7 +4677,7 @@ var Le = /*#__PURE__*/function () {
|
|
4673
4677
|
_context22.next = 4;
|
4674
4678
|
break;
|
4675
4679
|
}
|
4676
|
-
return _context22.abrupt("return",
|
4680
|
+
return _context22.abrupt("return", Le.handleResponseProperty(e));
|
4677
4681
|
case 4:
|
4678
4682
|
if (!E.validateResponseFormat(e)) {
|
4679
4683
|
_context22.next = 6;
|
@@ -4723,10 +4727,10 @@ var Le = /*#__PURE__*/function () {
|
|
4723
4727
|
return o.text && (delete o.files, n.append("message".concat(r += 1), JSON.stringify(o))), n;
|
4724
4728
|
}
|
4725
4729
|
}]);
|
4726
|
-
return
|
4730
|
+
return Ne;
|
4727
4731
|
}();
|
4728
|
-
var U = /*#__PURE__*/function (
|
4729
|
-
_inherits(U,
|
4732
|
+
var U = /*#__PURE__*/function (_Ne) {
|
4733
|
+
_inherits(U, _Ne);
|
4730
4734
|
var _super = _createSuper(U);
|
4731
4735
|
// prettier-ignore
|
4732
4736
|
function U(e, t, i, n, r) {
|
@@ -4773,7 +4777,7 @@ var U = /*#__PURE__*/function (_Le) {
|
|
4773
4777
|
}
|
4774
4778
|
}]);
|
4775
4779
|
return U;
|
4776
|
-
}(
|
4780
|
+
}(Ne);
|
4777
4781
|
var zt = /*#__PURE__*/function () {
|
4778
4782
|
function zt() {
|
4779
4783
|
_classCallCheck(this, zt);
|
@@ -4794,19 +4798,19 @@ var zt = /*#__PURE__*/function () {
|
|
4794
4798
|
return zt;
|
4795
4799
|
}();
|
4796
4800
|
var $i = /*#__PURE__*/function (_HTMLElement) {
|
4797
|
-
_inherits(
|
4798
|
-
var _super2 = _createSuper(
|
4801
|
+
_inherits(Ve, _HTMLElement);
|
4802
|
+
var _super2 = _createSuper(Ve);
|
4799
4803
|
// If this is not working, try using propertyName directly
|
4800
|
-
function
|
4804
|
+
function Ve() {
|
4801
4805
|
var _this7;
|
4802
|
-
_classCallCheck(this,
|
4803
|
-
_this7 = _super2.call(this), _this7._waitingToRender_ = !1, _this7._propUpdated_ = !1, Object.keys(
|
4804
|
-
var t =
|
4806
|
+
_classCallCheck(this, Ve);
|
4807
|
+
_this7 = _super2.call(this), _this7._waitingToRender_ = !1, _this7._propUpdated_ = !1, Object.keys(Ve._attributeToProperty_).forEach(function (e) {
|
4808
|
+
var t = Ve._attributeToProperty_[e];
|
4805
4809
|
_this7.constructPropertyAccessors(t), _this7.hasOwnProperty(e) || _this7.constructPropertyAccessors(t, e);
|
4806
4810
|
});
|
4807
4811
|
return _this7;
|
4808
4812
|
}
|
4809
|
-
_createClass(
|
4813
|
+
_createClass(Ve, [{
|
4810
4814
|
key: "constructPropertyAccessors",
|
4811
4815
|
value:
|
4812
4816
|
// need to be called here as accessors need to be set for the class instance
|
@@ -4825,8 +4829,8 @@ var $i = /*#__PURE__*/function (_HTMLElement) {
|
|
4825
4829
|
key: "attributeChangedCallback",
|
4826
4830
|
value: function attributeChangedCallback(e, t, i) {
|
4827
4831
|
if (t === i) return;
|
4828
|
-
var n =
|
4829
|
-
r =
|
4832
|
+
var n = Ve._attributes_[e](i),
|
4833
|
+
r = Ve._attributeToProperty_[e];
|
4830
4834
|
this[r] = n;
|
4831
4835
|
}
|
4832
4836
|
}, {
|
@@ -4835,43 +4839,43 @@ var $i = /*#__PURE__*/function (_HTMLElement) {
|
|
4835
4839
|
}], [{
|
4836
4840
|
key: "observedAttributes",
|
4837
4841
|
get: function get() {
|
4838
|
-
return Object.keys(
|
4842
|
+
return Object.keys(Ve._attributes_) || [];
|
4839
4843
|
}
|
4840
4844
|
}]);
|
4841
|
-
return
|
4845
|
+
return Ve;
|
4842
4846
|
}( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
|
4843
4847
|
$i._attributes_ = {};
|
4844
4848
|
$i._attributeToProperty_ = {};
|
4845
4849
|
var yo = $i;
|
4846
4850
|
var xo = "<?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",
|
4847
4851
|
Eo = "<?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";
|
4848
|
-
var
|
4849
|
-
function
|
4850
|
-
_classCallCheck(this,
|
4852
|
+
var H = /*#__PURE__*/function () {
|
4853
|
+
function H() {
|
4854
|
+
_classCallCheck(this, H);
|
4851
4855
|
}
|
4852
|
-
_createClass(
|
4856
|
+
_createClass(H, null, [{
|
4853
4857
|
key: "createSVGElement",
|
4854
4858
|
value: function createSVGElement(e) {
|
4855
4859
|
return new DOMParser().parseFromString(e, "image/svg+xml").documentElement;
|
4856
4860
|
}
|
4857
4861
|
}]);
|
4858
|
-
return
|
4862
|
+
return H;
|
4859
4863
|
}();
|
4860
4864
|
var os = /*#__PURE__*/function () {
|
4861
|
-
function
|
4862
|
-
_classCallCheck(this,
|
4865
|
+
function We() {
|
4866
|
+
_classCallCheck(this, We);
|
4863
4867
|
}
|
4864
|
-
_createClass(
|
4868
|
+
_createClass(We, null, [{
|
4865
4869
|
key: "changeVisibility",
|
4866
4870
|
value:
|
4867
4871
|
// prettier-ignore
|
4868
4872
|
function changeVisibility(e, t, i, n) {
|
4869
|
-
n.target.id ===
|
4873
|
+
n.target.id === We.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");
|
4870
4874
|
}
|
4871
4875
|
}, {
|
4872
4876
|
key: "createIconElement",
|
4873
4877
|
value: function createIconElement(e, t) {
|
4874
|
-
var i =
|
4878
|
+
var i = H.createSVGElement(e);
|
4875
4879
|
return i.id = t, i.classList.add("visibility-icon"), i;
|
4876
4880
|
}
|
4877
4881
|
// prettier-ignore
|
@@ -4880,13 +4884,13 @@ var os = /*#__PURE__*/function () {
|
|
4880
4884
|
value: function create(e) {
|
4881
4885
|
var t = document.createElement("div");
|
4882
4886
|
t.id = "visibility-icon-container";
|
4883
|
-
var i =
|
4887
|
+
var i = We.createIconElement(Eo, We.VISIBLE_ICON_ID);
|
4884
4888
|
i.style.display = "none", t.appendChild(i);
|
4885
|
-
var n =
|
4886
|
-
return t.appendChild(n), t.onclick =
|
4889
|
+
var n = We.createIconElement(xo, "not-visible-icon");
|
4890
|
+
return t.appendChild(n), t.onclick = We.changeVisibility.bind(this, e, i, n), t;
|
4887
4891
|
}
|
4888
4892
|
}]);
|
4889
|
-
return
|
4893
|
+
return We;
|
4890
4894
|
}();
|
4891
4895
|
os.VISIBLE_ICON_ID = "visible-icon";
|
4892
4896
|
var So = os;
|
@@ -5156,8 +5160,8 @@ var Sn = {
|
|
5156
5160
|
}],
|
5157
5161
|
use_web_worker: !0
|
5158
5162
|
},
|
5159
|
-
it = /*#__PURE__*/function (
|
5160
|
-
_inherits(M,
|
5163
|
+
it = /*#__PURE__*/function (_Ne2) {
|
5164
|
+
_inherits(M, _Ne2);
|
5161
5165
|
var _super3 = _createSuper(M);
|
5162
5166
|
function M(e) {
|
5163
5167
|
var _this8;
|
@@ -5198,7 +5202,7 @@ var Sn = {
|
|
5198
5202
|
var t;
|
5199
5203
|
((t = this._webModel.introMessage) == null ? void 0 : t.autoScroll) !== !1 && setTimeout(function () {
|
5200
5204
|
var i, n;
|
5201
|
-
(i = _this11._messages) != null && i.elementRef &&
|
5205
|
+
(i = _this11._messages) != null && i.elementRef && Z.scrollToTop((n = _this11._messages) == null ? void 0 : n.elementRef);
|
5202
5206
|
}, e);
|
5203
5207
|
}
|
5204
5208
|
// prettier-ignore
|
@@ -5330,7 +5334,7 @@ var Sn = {
|
|
5330
5334
|
sendUpdate: !1
|
5331
5335
|
}), i && (setTimeout(function () {
|
5332
5336
|
var f;
|
5333
|
-
return
|
5337
|
+
return Z.scrollToBottom((f = _this12._messages) == null ? void 0 : f.elementRef);
|
5334
5338
|
}), i = !1);
|
5335
5339
|
};
|
5336
5340
|
M.chat.setInitProgressCallback(n);
|
@@ -5690,7 +5694,7 @@ var Sn = {
|
|
5690
5694
|
}
|
5691
5695
|
}]);
|
5692
5696
|
return M;
|
5693
|
-
}(
|
5697
|
+
}(Ne);
|
5694
5698
|
it.GENERIC_ERROR = "Error, please check the [troubleshooting](https://deepchat.dev/docs/webModel#troubleshooting) section of documentation for help.";
|
5695
5699
|
it.MULTIPLE_MODELS_ERROR = "Cannot run multiple web models";
|
5696
5700
|
it.WEB_LLM_NOT_FOUND_ERROR = "WebLLM module not found";
|
@@ -5781,9 +5785,9 @@ var as = /*#__PURE__*/function (_U) {
|
|
5781
5785
|
return Fi;
|
5782
5786
|
}(U);
|
5783
5787
|
as.URL_PREFIX = "https://api-inference.huggingface.co/models/";
|
5784
|
-
var
|
5785
|
-
var wt = /*#__PURE__*/function (
|
5786
|
-
_inherits(wt,
|
5788
|
+
var je = as;
|
5789
|
+
var wt = /*#__PURE__*/function (_je) {
|
5790
|
+
_inherits(wt, _je);
|
5787
5791
|
var _super5 = _createSuper(wt);
|
5788
5792
|
// prettier-ignore
|
5789
5793
|
function wt(e, t, i, n, r, o) {
|
@@ -5836,7 +5840,7 @@ var wt = /*#__PURE__*/function (_Pe) {
|
|
5836
5840
|
}
|
5837
5841
|
}]);
|
5838
5842
|
return wt;
|
5839
|
-
}(
|
5843
|
+
}(je);
|
5840
5844
|
var wo = /*#__PURE__*/function (_wt) {
|
5841
5845
|
_inherits(wo, _wt);
|
5842
5846
|
var _super6 = _createSuper(wo);
|
@@ -6251,8 +6255,8 @@ var Mo = /*#__PURE__*/function (_wt3) {
|
|
6251
6255
|
}]);
|
6252
6256
|
return Mo;
|
6253
6257
|
}(wt);
|
6254
|
-
var To = /*#__PURE__*/function (
|
6255
|
-
_inherits(To,
|
6258
|
+
var To = /*#__PURE__*/function (_je2) {
|
6259
|
+
_inherits(To, _je2);
|
6256
6260
|
var _super12 = _createSuper(To);
|
6257
6261
|
function To(e) {
|
6258
6262
|
_classCallCheck(this, To);
|
@@ -6290,9 +6294,9 @@ var To = /*#__PURE__*/function (_Pe2) {
|
|
6290
6294
|
}()
|
6291
6295
|
}]);
|
6292
6296
|
return To;
|
6293
|
-
}(
|
6294
|
-
var Co = /*#__PURE__*/function (
|
6295
|
-
_inherits(Co,
|
6297
|
+
}(je);
|
6298
|
+
var Co = /*#__PURE__*/function (_je3) {
|
6299
|
+
_inherits(Co, _je3);
|
6296
6300
|
var _super13 = _createSuper(Co);
|
6297
6301
|
function Co(e) {
|
6298
6302
|
var _this19;
|
@@ -6346,9 +6350,9 @@ var Co = /*#__PURE__*/function (_Pe3) {
|
|
6346
6350
|
}()
|
6347
6351
|
}]);
|
6348
6352
|
return Co;
|
6349
|
-
}(
|
6350
|
-
var Ao = /*#__PURE__*/function (
|
6351
|
-
_inherits(Ao,
|
6353
|
+
}(je);
|
6354
|
+
var Ao = /*#__PURE__*/function (_je4) {
|
6355
|
+
_inherits(Ao, _je4);
|
6352
6356
|
var _super14 = _createSuper(Ao);
|
6353
6357
|
function Ao(e) {
|
6354
6358
|
_classCallCheck(this, Ao);
|
@@ -6386,9 +6390,9 @@ var Ao = /*#__PURE__*/function (_Pe4) {
|
|
6386
6390
|
}()
|
6387
6391
|
}]);
|
6388
6392
|
return Ao;
|
6389
|
-
}(
|
6390
|
-
var ko = /*#__PURE__*/function (
|
6391
|
-
_inherits(ko,
|
6393
|
+
}(je);
|
6394
|
+
var ko = /*#__PURE__*/function (_je5) {
|
6395
|
+
_inherits(ko, _je5);
|
6392
6396
|
var _super15 = _createSuper(ko);
|
6393
6397
|
function ko(e) {
|
6394
6398
|
var _this20$maxMessages;
|
@@ -6470,7 +6474,7 @@ var ko = /*#__PURE__*/function (_Pe5) {
|
|
6470
6474
|
}()
|
6471
6475
|
}]);
|
6472
6476
|
return ko;
|
6473
|
-
}(
|
6477
|
+
}(je);
|
6474
6478
|
var Gt = /*#__PURE__*/function (_ri3) {
|
6475
6479
|
_inherits(Gt, _ri3);
|
6476
6480
|
var _super16 = _createSuper(Gt);
|
@@ -6580,8 +6584,8 @@ var Gt = /*#__PURE__*/function (_ri3) {
|
|
6580
6584
|
}]);
|
6581
6585
|
return Gt;
|
6582
6586
|
}(ri);
|
6583
|
-
var Io = /*#__PURE__*/function (
|
6584
|
-
_inherits(Io,
|
6587
|
+
var Io = /*#__PURE__*/function (_je6) {
|
6588
|
+
_inherits(Io, _je6);
|
6585
6589
|
var _super17 = _createSuper(Io);
|
6586
6590
|
function Io(e) {
|
6587
6591
|
_classCallCheck(this, Io);
|
@@ -6619,7 +6623,7 @@ var Io = /*#__PURE__*/function (_Pe6) {
|
|
6619
6623
|
}()
|
6620
6624
|
}]);
|
6621
6625
|
return Io;
|
6622
|
-
}(
|
6626
|
+
}(je);
|
6623
6627
|
var Vt = /*#__PURE__*/function (_ri4) {
|
6624
6628
|
_inherits(Vt, _ri4);
|
6625
6629
|
var _super18 = _createSuper(Vt);
|
@@ -6715,8 +6719,8 @@ var Vt = /*#__PURE__*/function (_ri4) {
|
|
6715
6719
|
}]);
|
6716
6720
|
return Vt;
|
6717
6721
|
}(ri);
|
6718
|
-
var Lo = /*#__PURE__*/function (
|
6719
|
-
_inherits(Lo,
|
6722
|
+
var Lo = /*#__PURE__*/function (_je7) {
|
6723
|
+
_inherits(Lo, _je7);
|
6720
6724
|
var _super19 = _createSuper(Lo);
|
6721
6725
|
function Lo(e) {
|
6722
6726
|
var _this23;
|
@@ -6756,7 +6760,7 @@ var Lo = /*#__PURE__*/function (_Pe7) {
|
|
6756
6760
|
}()
|
6757
6761
|
}]);
|
6758
6762
|
return Lo;
|
6759
|
-
}(
|
6763
|
+
}(je);
|
6760
6764
|
var Wt = /*#__PURE__*/function () {
|
6761
6765
|
function Wt() {
|
6762
6766
|
_classCallCheck(this, Wt);
|
@@ -6984,99 +6988,39 @@ var N = /*#__PURE__*/function () {
|
|
6984
6988
|
handleVerificationResult: N.handleVerificationResult
|
6985
6989
|
};
|
6986
6990
|
}
|
6987
|
-
|
6988
|
-
key: "storeFiles",
|
6989
|
-
value: function () {
|
6990
|
-
var _storeFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(e, t, i) {
|
6991
|
-
var n, r, o, a;
|
6992
|
-
return _regeneratorRuntime().wrap(function _callee58$(_context58) {
|
6993
|
-
while (1) switch (_context58.prev = _context58.next) {
|
6994
|
-
case 0:
|
6995
|
-
n = e.requestSettings.headers;
|
6996
|
-
if (n) {
|
6997
|
-
_context58.next = 3;
|
6998
|
-
break;
|
6999
|
-
}
|
7000
|
-
return _context58.abrupt("return");
|
7001
|
-
case 3:
|
7002
|
-
e.url = "https://api.openai.com/v1/files";
|
7003
|
-
r = n[E.CONTENT_TYPE];
|
7004
|
-
delete n[E.CONTENT_TYPE];
|
7005
|
-
o = i.map( /*#__PURE__*/function () {
|
7006
|
-
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(a) {
|
7007
|
-
var l;
|
7008
|
-
return _regeneratorRuntime().wrap(function _callee57$(_context57) {
|
7009
|
-
while (1) switch (_context57.prev = _context57.next) {
|
7010
|
-
case 0:
|
7011
|
-
l = new FormData();
|
7012
|
-
return _context57.abrupt("return", (l.append("purpose", "assistants"), l.append("file", a), new Promise(function (c) {
|
7013
|
-
c(N.directFetch(e, l, "POST", !1));
|
7014
|
-
})));
|
7015
|
-
case 2:
|
7016
|
-
case "end":
|
7017
|
-
return _context57.stop();
|
7018
|
-
}
|
7019
|
-
}, _callee57);
|
7020
|
-
}));
|
7021
|
-
return function (_x109) {
|
7022
|
-
return _ref8.apply(this, arguments);
|
7023
|
-
};
|
7024
|
-
}());
|
7025
|
-
_context58.prev = 7;
|
7026
|
-
_context58.next = 10;
|
7027
|
-
return Promise.all(o);
|
7028
|
-
case 10:
|
7029
|
-
a = _context58.sent.map(function (l) {
|
7030
|
-
return l.id;
|
7031
|
-
});
|
7032
|
-
return _context58.abrupt("return", (n[E.CONTENT_TYPE] = r, a));
|
7033
|
-
case 14:
|
7034
|
-
_context58.prev = 14;
|
7035
|
-
_context58.t0 = _context58["catch"](7);
|
7036
|
-
throw n[E.CONTENT_TYPE] = r, E.displayError(t, _context58.t0), e.completionsHandlers.onFinish(), _context58.t0;
|
7037
|
-
case 17:
|
7038
|
-
case "end":
|
7039
|
-
return _context58.stop();
|
7040
|
-
}
|
7041
|
-
}, _callee58, null, [[7, 14]]);
|
7042
|
-
}));
|
7043
|
-
function storeFiles(_x106, _x107, _x108) {
|
7044
|
-
return _storeFiles.apply(this, arguments);
|
7045
|
-
}
|
7046
|
-
return storeFiles;
|
7047
|
-
}() // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
6991
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
7048
6992
|
}, {
|
7049
6993
|
key: "directFetch",
|
7050
6994
|
value: function () {
|
7051
|
-
var _directFetch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6995
|
+
var _directFetch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(e, t, i) {
|
7052
6996
|
var n,
|
7053
6997
|
r,
|
7054
|
-
|
7055
|
-
return _regeneratorRuntime().wrap(function
|
7056
|
-
while (1) switch (
|
6998
|
+
_args57 = arguments;
|
6999
|
+
return _regeneratorRuntime().wrap(function _callee57$(_context57) {
|
7000
|
+
while (1) switch (_context57.prev = _context57.next) {
|
7057
7001
|
case 0:
|
7058
|
-
n =
|
7002
|
+
n = _args57.length > 3 && _args57[3] !== undefined ? _args57[3] : !0;
|
7059
7003
|
e.requestSettings.method = i;
|
7060
|
-
|
7004
|
+
_context57.next = 4;
|
7061
7005
|
return E.fetch(e, e.requestSettings.headers, n, t).then(function (o) {
|
7062
7006
|
return E.processResponseByType(o);
|
7063
7007
|
});
|
7064
7008
|
case 4:
|
7065
|
-
r =
|
7009
|
+
r = _context57.sent;
|
7066
7010
|
if (!r.error) {
|
7067
|
-
|
7011
|
+
_context57.next = 7;
|
7068
7012
|
break;
|
7069
7013
|
}
|
7070
7014
|
throw r.error.message;
|
7071
7015
|
case 7:
|
7072
|
-
return
|
7016
|
+
return _context57.abrupt("return", r);
|
7073
7017
|
case 8:
|
7074
7018
|
case "end":
|
7075
|
-
return
|
7019
|
+
return _context57.stop();
|
7076
7020
|
}
|
7077
|
-
},
|
7021
|
+
}, _callee57);
|
7078
7022
|
}));
|
7079
|
-
function directFetch(
|
7023
|
+
function directFetch(_x106, _x107, _x108) {
|
7080
7024
|
return _directFetch.apply(this, arguments);
|
7081
7025
|
}
|
7082
7026
|
return directFetch;
|
@@ -7110,13 +7054,13 @@ var Xi = /*#__PURE__*/function (_U4) {
|
|
7110
7054
|
}, {
|
7111
7055
|
key: "callServiceAPI",
|
7112
7056
|
value: function () {
|
7113
|
-
var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7057
|
+
var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(e, t) {
|
7114
7058
|
var n, i;
|
7115
|
-
return _regeneratorRuntime().wrap(function
|
7116
|
-
while (1) switch (
|
7059
|
+
return _regeneratorRuntime().wrap(function _callee58$(_context58) {
|
7060
|
+
while (1) switch (_context58.prev = _context58.next) {
|
7117
7061
|
case 0:
|
7118
7062
|
if ((n = this.requestSettings) != null && n.headers) {
|
7119
|
-
|
7063
|
+
_context58.next = 2;
|
7120
7064
|
break;
|
7121
7065
|
}
|
7122
7066
|
throw new Error("Request settings have not been set up");
|
@@ -7126,11 +7070,11 @@ var Xi = /*#__PURE__*/function (_U4) {
|
|
7126
7070
|
_.request(this, i, e);
|
7127
7071
|
case 5:
|
7128
7072
|
case "end":
|
7129
|
-
return
|
7073
|
+
return _context58.stop();
|
7130
7074
|
}
|
7131
|
-
},
|
7075
|
+
}, _callee58, this);
|
7132
7076
|
}));
|
7133
|
-
function callServiceAPI(
|
7077
|
+
function callServiceAPI(_x109, _x110) {
|
7134
7078
|
return _callServiceAPI11.apply(this, arguments);
|
7135
7079
|
}
|
7136
7080
|
return callServiceAPI;
|
@@ -7138,15 +7082,15 @@ var Xi = /*#__PURE__*/function (_U4) {
|
|
7138
7082
|
}, {
|
7139
7083
|
key: "extractResultData",
|
7140
7084
|
value: function () {
|
7141
|
-
var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7142
|
-
return _regeneratorRuntime().wrap(function
|
7143
|
-
while (1) switch (
|
7085
|
+
var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(e) {
|
7086
|
+
return _regeneratorRuntime().wrap(function _callee59$(_context59) {
|
7087
|
+
while (1) switch (_context59.prev = _context59.next) {
|
7144
7088
|
case 0:
|
7145
7089
|
if (!(e instanceof Blob)) {
|
7146
|
-
|
7090
|
+
_context59.next = 2;
|
7147
7091
|
break;
|
7148
7092
|
}
|
7149
|
-
return
|
7093
|
+
return _context59.abrupt("return", new Promise(function (t) {
|
7150
7094
|
var i = new FileReader();
|
7151
7095
|
i.readAsDataURL(e), i.onload = function (n) {
|
7152
7096
|
t({
|
@@ -7159,21 +7103,21 @@ var Xi = /*#__PURE__*/function (_U4) {
|
|
7159
7103
|
}));
|
7160
7104
|
case 2:
|
7161
7105
|
if (!e.error) {
|
7162
|
-
|
7106
|
+
_context59.next = 4;
|
7163
7107
|
break;
|
7164
7108
|
}
|
7165
7109
|
throw e.error.message;
|
7166
7110
|
case 4:
|
7167
|
-
return
|
7111
|
+
return _context59.abrupt("return", {
|
7168
7112
|
error: "error"
|
7169
7113
|
});
|
7170
7114
|
case 5:
|
7171
7115
|
case "end":
|
7172
|
-
return
|
7116
|
+
return _context59.stop();
|
7173
7117
|
}
|
7174
|
-
},
|
7118
|
+
}, _callee59);
|
7175
7119
|
}));
|
7176
|
-
function extractResultData(
|
7120
|
+
function extractResultData(_x111) {
|
7177
7121
|
return _extractResultData14.apply(this, arguments);
|
7178
7122
|
}
|
7179
7123
|
return extractResultData;
|
@@ -7185,26 +7129,26 @@ Xi.DEFAULT_MODEL = "tts-1";
|
|
7185
7129
|
Xi.DEFAULT_VOIDE = "alloy";
|
7186
7130
|
var Oo = Xi;
|
7187
7131
|
var oi = /*#__PURE__*/function (_U5) {
|
7188
|
-
_inherits(
|
7189
|
-
var _super24 = _createSuper(
|
7190
|
-
function
|
7132
|
+
_inherits(we, _U5);
|
7133
|
+
var _super24 = _createSuper(we);
|
7134
|
+
function we(e) {
|
7191
7135
|
var _o$model2;
|
7192
7136
|
var _this26;
|
7193
|
-
_classCallCheck(this,
|
7137
|
+
_classCallCheck(this, we);
|
7194
7138
|
var r, o;
|
7195
7139
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
7196
7140
|
i = t == null ? void 0 : t.openAI;
|
7197
7141
|
_this26 = _super24.call(this, e, N.buildKeyVerificationDetails(), N.buildHeaders, i, {
|
7198
7142
|
audio: {}
|
7199
|
-
}), _this26.insertKeyPlaceholderText = "OpenAI API Key", _this26.getKeyLink = "https://platform.openai.com/account/api-keys", _this26.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI : Speech To Text</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/guides/speech-to-text\">here</a> for more info.</p>", _this26.url = "", _this26.permittedErrorPrefixes = ["Invalid"], _this26.textInputPlaceholderText = "Upload an audio file", _this26._service_url =
|
7143
|
+
}), _this26.insertKeyPlaceholderText = "OpenAI API Key", _this26.getKeyLink = "https://platform.openai.com/account/api-keys", _this26.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI : Speech To Text</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/guides/speech-to-text\">here</a> for more info.</p>", _this26.url = "", _this26.permittedErrorPrefixes = ["Invalid"], _this26.textInputPlaceholderText = "Upload an audio file", _this26._service_url = we.AUDIO_TRANSCRIPTIONS_URL;
|
7200
7144
|
var n = (r = t == null ? void 0 : t.openAI) == null ? void 0 : r.audio;
|
7201
|
-
_typeof(n) == "object" && (_this26.processConfig(n),
|
7145
|
+
_typeof(n) == "object" && (_this26.processConfig(n), we.cleanConfig(n), Object.assign(_this26.rawBody, n)), (_o$model2 = (o = _this26.rawBody).model) !== null && _o$model2 !== void 0 ? _o$model2 : o.model = we.DEFAULT_MODEL, _this26.rawBody.response_format = "json", _this26.canSendMessage = we.canSendFileMessage;
|
7202
7146
|
return _this26;
|
7203
7147
|
}
|
7204
|
-
_createClass(
|
7148
|
+
_createClass(we, [{
|
7205
7149
|
key: "processConfig",
|
7206
7150
|
value: function processConfig(e) {
|
7207
|
-
e != null && e.type && e.type === "translation" && (this._service_url =
|
7151
|
+
e != null && e.type && e.type === "translation" && (this._service_url = we.AUDIO_TRANSLATIONS_URL, delete e.language);
|
7208
7152
|
}
|
7209
7153
|
}, {
|
7210
7154
|
key: "preprocessBody",
|
@@ -7218,33 +7162,33 @@ var oi = /*#__PURE__*/function (_U5) {
|
|
7218
7162
|
}, {
|
7219
7163
|
key: "callServiceAPI",
|
7220
7164
|
value: function () {
|
7221
|
-
var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7165
|
+
var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(e, t, i) {
|
7222
7166
|
var o, n, r;
|
7223
|
-
return _regeneratorRuntime().wrap(function
|
7224
|
-
while (1) switch (
|
7167
|
+
return _regeneratorRuntime().wrap(function _callee60$(_context60) {
|
7168
|
+
while (1) switch (_context60.prev = _context60.next) {
|
7225
7169
|
case 0:
|
7226
7170
|
if ((o = this.requestSettings) != null && o.headers) {
|
7227
|
-
|
7171
|
+
_context60.next = 2;
|
7228
7172
|
break;
|
7229
7173
|
}
|
7230
7174
|
throw new Error("Request settings have not been set up");
|
7231
7175
|
case 2:
|
7232
7176
|
if (i != null && i[0]) {
|
7233
|
-
|
7177
|
+
_context60.next = 4;
|
7234
7178
|
break;
|
7235
7179
|
}
|
7236
7180
|
throw new Error("No file was added");
|
7237
7181
|
case 4:
|
7238
7182
|
this.url = this.requestSettings.url || this._service_url;
|
7239
|
-
n = this.preprocessBody(this.rawBody, t), r =
|
7183
|
+
n = this.preprocessBody(this.rawBody, t), r = we.createFormDataBody(n, i[0]);
|
7240
7184
|
E.tempRemoveContentHeader(this.requestSettings, _.request.bind(this, this, r, e), !1);
|
7241
7185
|
case 7:
|
7242
7186
|
case "end":
|
7243
|
-
return
|
7187
|
+
return _context60.stop();
|
7244
7188
|
}
|
7245
|
-
},
|
7189
|
+
}, _callee60, this);
|
7246
7190
|
}));
|
7247
|
-
function callServiceAPI(
|
7191
|
+
function callServiceAPI(_x112, _x113, _x114) {
|
7248
7192
|
return _callServiceAPI12.apply(this, arguments);
|
7249
7193
|
}
|
7250
7194
|
return callServiceAPI;
|
@@ -7252,26 +7196,26 @@ var oi = /*#__PURE__*/function (_U5) {
|
|
7252
7196
|
}, {
|
7253
7197
|
key: "extractResultData",
|
7254
7198
|
value: function () {
|
7255
|
-
var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7256
|
-
return _regeneratorRuntime().wrap(function
|
7257
|
-
while (1) switch (
|
7199
|
+
var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(e) {
|
7200
|
+
return _regeneratorRuntime().wrap(function _callee61$(_context61) {
|
7201
|
+
while (1) switch (_context61.prev = _context61.next) {
|
7258
7202
|
case 0:
|
7259
7203
|
if (!e.error) {
|
7260
|
-
|
7204
|
+
_context61.next = 2;
|
7261
7205
|
break;
|
7262
7206
|
}
|
7263
7207
|
throw e.error.message;
|
7264
7208
|
case 2:
|
7265
|
-
return
|
7209
|
+
return _context61.abrupt("return", {
|
7266
7210
|
text: e.text
|
7267
7211
|
});
|
7268
7212
|
case 3:
|
7269
7213
|
case "end":
|
7270
|
-
return
|
7214
|
+
return _context61.stop();
|
7271
7215
|
}
|
7272
|
-
},
|
7216
|
+
}, _callee61);
|
7273
7217
|
}));
|
7274
|
-
function extractResultData(
|
7218
|
+
function extractResultData(_x115) {
|
7275
7219
|
return _extractResultData15.apply(this, arguments);
|
7276
7220
|
}
|
7277
7221
|
return extractResultData;
|
@@ -7295,17 +7239,17 @@ var oi = /*#__PURE__*/function (_U5) {
|
|
7295
7239
|
}), i;
|
7296
7240
|
}
|
7297
7241
|
}]);
|
7298
|
-
return
|
7242
|
+
return we;
|
7299
7243
|
}(U);
|
7300
7244
|
oi.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions";
|
7301
7245
|
oi.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations";
|
7302
7246
|
oi.DEFAULT_MODEL = "whisper-1";
|
7303
7247
|
var Po = oi;
|
7304
|
-
var
|
7305
|
-
function
|
7306
|
-
_classCallCheck(this,
|
7248
|
+
var X = /*#__PURE__*/function () {
|
7249
|
+
function X() {
|
7250
|
+
_classCallCheck(this, X);
|
7307
7251
|
}
|
7308
|
-
_createClass(
|
7252
|
+
_createClass(X, null, [{
|
7309
7253
|
key: "buildTextToSpeechHeaders",
|
7310
7254
|
value: function buildTextToSpeechHeaders(e, t) {
|
7311
7255
|
return {
|
@@ -7339,7 +7283,7 @@ var Z = /*#__PURE__*/function () {
|
|
7339
7283
|
"Ocp-Apim-Subscription-Key": "".concat(t)
|
7340
7284
|
};
|
7341
7285
|
},
|
7342
|
-
handleVerificationResult:
|
7286
|
+
handleVerificationResult: X.handleSpeechVerificationResult
|
7343
7287
|
};
|
7344
7288
|
}
|
7345
7289
|
}, {
|
@@ -7368,7 +7312,7 @@ var Z = /*#__PURE__*/function () {
|
|
7368
7312
|
"Ocp-Apim-Subscription-Key": "".concat(t)
|
7369
7313
|
};
|
7370
7314
|
},
|
7371
|
-
handleVerificationResult:
|
7315
|
+
handleVerificationResult: X.handleLanguageVerificationResult
|
7372
7316
|
};
|
7373
7317
|
}
|
7374
7318
|
// prettier-ignore
|
@@ -7386,9 +7330,9 @@ var Z = /*#__PURE__*/function () {
|
|
7386
7330
|
url: "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=es",
|
7387
7331
|
method: "POST",
|
7388
7332
|
createHeaders: function createHeaders(t) {
|
7389
|
-
return
|
7333
|
+
return X.buildTranslationHeaders(e, t);
|
7390
7334
|
},
|
7391
|
-
handleVerificationResult:
|
7335
|
+
handleVerificationResult: X.handleTranslationVerificationResult
|
7392
7336
|
};
|
7393
7337
|
}
|
7394
7338
|
}, {
|
@@ -7401,7 +7345,7 @@ var Z = /*#__PURE__*/function () {
|
|
7401
7345
|
return e && (i["Ocp-Apim-Subscription-Region"] = e), i;
|
7402
7346
|
}
|
7403
7347
|
}]);
|
7404
|
-
return
|
7348
|
+
return X;
|
7405
7349
|
}();
|
7406
7350
|
var Do = /*#__PURE__*/function (_U6) {
|
7407
7351
|
_inherits(Do, _U6);
|
@@ -7410,7 +7354,7 @@ var Do = /*#__PURE__*/function (_U6) {
|
|
7410
7354
|
function Do(e, t, i, n, r) {
|
7411
7355
|
var _this27;
|
7412
7356
|
_classCallCheck(this, Do);
|
7413
|
-
_this27 = _super25.call(this, e,
|
7357
|
+
_this27 = _super25.call(this, e, X.buildLanguageKeyVerificationDetails(i), t, n, r), _this27.insertKeyPlaceholderText = "Azure Language Subscription Key", _this27.getKeyLink =
|
7414
7358
|
// eslint-disable-next-line max-len
|
7415
7359
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this27.permittedErrorPrefixes = ["Access"];
|
7416
7360
|
return _this27;
|
@@ -7427,7 +7371,7 @@ var jo = /*#__PURE__*/function (_Do) {
|
|
7427
7371
|
var n, r, o, a;
|
7428
7372
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.azure) == null ? void 0 : r.summarization,
|
7429
7373
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
7430
|
-
_this28 = _super26.call(this, e,
|
7374
|
+
_this28 = _super26.call(this, e, X.buildSummarizationHeader, t.endpoint, i), _this28.url = "", _this28.textInputPlaceholderText = "Insert text to summarize", (_a$language = (a = _this28.rawBody).language) !== null && _a$language !== void 0 ? _a$language : a.language = "en", Object.assign(_this28.rawBody, t), _this28.url = "".concat(t.endpoint, "/language/analyze-text/jobs?api-version=2022-10-01-preview");
|
7431
7375
|
return _this28;
|
7432
7376
|
}
|
7433
7377
|
_createClass(jo, [{
|
@@ -7450,13 +7394,13 @@ var jo = /*#__PURE__*/function (_Do) {
|
|
7450
7394
|
}, {
|
7451
7395
|
key: "callServiceAPI",
|
7452
7396
|
value: function () {
|
7453
|
-
var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7397
|
+
var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(e, t) {
|
7454
7398
|
var i;
|
7455
|
-
return _regeneratorRuntime().wrap(function
|
7456
|
-
while (1) switch (
|
7399
|
+
return _regeneratorRuntime().wrap(function _callee62$(_context62) {
|
7400
|
+
while (1) switch (_context62.prev = _context62.next) {
|
7457
7401
|
case 0:
|
7458
7402
|
if (this.requestSettings) {
|
7459
|
-
|
7403
|
+
_context62.next = 2;
|
7460
7404
|
break;
|
7461
7405
|
}
|
7462
7406
|
throw new Error("Request settings have not been set up");
|
@@ -7465,11 +7409,11 @@ var jo = /*#__PURE__*/function (_Do) {
|
|
7465
7409
|
_.request(this, i, e), this.messages = e;
|
7466
7410
|
case 4:
|
7467
7411
|
case "end":
|
7468
|
-
return
|
7412
|
+
return _context62.stop();
|
7469
7413
|
}
|
7470
|
-
},
|
7414
|
+
}, _callee62, this);
|
7471
7415
|
}));
|
7472
|
-
function callServiceAPI(
|
7416
|
+
function callServiceAPI(_x116, _x117) {
|
7473
7417
|
return _callServiceAPI13.apply(this, arguments);
|
7474
7418
|
}
|
7475
7419
|
return callServiceAPI;
|
@@ -7477,13 +7421,13 @@ var jo = /*#__PURE__*/function (_Do) {
|
|
7477
7421
|
}, {
|
7478
7422
|
key: "extractResultData",
|
7479
7423
|
value: function () {
|
7480
|
-
var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7424
|
+
var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(e) {
|
7481
7425
|
var t, _i9, n;
|
7482
|
-
return _regeneratorRuntime().wrap(function
|
7483
|
-
while (1) switch (
|
7426
|
+
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
7427
|
+
while (1) switch (_context63.prev = _context63.next) {
|
7484
7428
|
case 0:
|
7485
7429
|
if (!e.error) {
|
7486
|
-
|
7430
|
+
_context63.next = 2;
|
7487
7431
|
break;
|
7488
7432
|
}
|
7489
7433
|
throw e.error.message;
|
@@ -7495,16 +7439,16 @@ var jo = /*#__PURE__*/function (_Do) {
|
|
7495
7439
|
};
|
7496
7440
|
_.executePollRequest(this, _i9, n, this.messages);
|
7497
7441
|
}
|
7498
|
-
return
|
7442
|
+
return _context63.abrupt("return", {
|
7499
7443
|
makingAnotherRequest: !0
|
7500
7444
|
});
|
7501
7445
|
case 4:
|
7502
7446
|
case "end":
|
7503
|
-
return
|
7447
|
+
return _context63.stop();
|
7504
7448
|
}
|
7505
|
-
},
|
7449
|
+
}, _callee63, this);
|
7506
7450
|
}));
|
7507
|
-
function extractResultData(
|
7451
|
+
function extractResultData(_x118) {
|
7508
7452
|
return _extractResultData16.apply(this, arguments);
|
7509
7453
|
}
|
7510
7454
|
return extractResultData;
|
@@ -7512,33 +7456,33 @@ var jo = /*#__PURE__*/function (_Do) {
|
|
7512
7456
|
}, {
|
7513
7457
|
key: "extractPollResultData",
|
7514
7458
|
value: function () {
|
7515
|
-
var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7459
|
+
var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(e) {
|
7516
7460
|
var t, _iterator, _step, _i10;
|
7517
|
-
return _regeneratorRuntime().wrap(function
|
7518
|
-
while (1) switch (
|
7461
|
+
return _regeneratorRuntime().wrap(function _callee64$(_context64) {
|
7462
|
+
while (1) switch (_context64.prev = _context64.next) {
|
7519
7463
|
case 0:
|
7520
7464
|
if (!e.error) {
|
7521
|
-
|
7465
|
+
_context64.next = 2;
|
7522
7466
|
break;
|
7523
7467
|
}
|
7524
7468
|
throw e.error;
|
7525
7469
|
case 2:
|
7526
7470
|
if (!(e.status === "running")) {
|
7527
|
-
|
7471
|
+
_context64.next = 4;
|
7528
7472
|
break;
|
7529
7473
|
}
|
7530
|
-
return
|
7474
|
+
return _context64.abrupt("return", {
|
7531
7475
|
timeoutMS: 2e3
|
7532
7476
|
});
|
7533
7477
|
case 4:
|
7534
7478
|
if (!(e.errors.length > 0)) {
|
7535
|
-
|
7479
|
+
_context64.next = 6;
|
7536
7480
|
break;
|
7537
7481
|
}
|
7538
7482
|
throw e.errors[0];
|
7539
7483
|
case 6:
|
7540
7484
|
if (!(e.tasks.items[0].results.errors.length > 0)) {
|
7541
|
-
|
7485
|
+
_context64.next = 8;
|
7542
7486
|
break;
|
7543
7487
|
}
|
7544
7488
|
throw e.tasks.items[0].results.errors[0];
|
@@ -7555,16 +7499,16 @@ var jo = /*#__PURE__*/function (_Do) {
|
|
7555
7499
|
} finally {
|
7556
7500
|
_iterator.f();
|
7557
7501
|
}
|
7558
|
-
return
|
7502
|
+
return _context64.abrupt("return", {
|
7559
7503
|
text: t || ""
|
7560
7504
|
});
|
7561
7505
|
case 12:
|
7562
7506
|
case "end":
|
7563
|
-
return
|
7507
|
+
return _context64.stop();
|
7564
7508
|
}
|
7565
|
-
},
|
7509
|
+
}, _callee64);
|
7566
7510
|
}));
|
7567
|
-
function extractPollResultData(
|
7511
|
+
function extractPollResultData(_x119) {
|
7568
7512
|
return _extractPollResultData4.apply(this, arguments);
|
7569
7513
|
}
|
7570
7514
|
return extractPollResultData;
|
@@ -7579,17 +7523,17 @@ var ut = /*#__PURE__*/function () {
|
|
7579
7523
|
_createClass(ut, null, [{
|
7580
7524
|
key: "poll",
|
7581
7525
|
value: function () {
|
7582
|
-
var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7526
|
+
var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(e, t) {
|
7583
7527
|
var i, a, l, d;
|
7584
|
-
return _regeneratorRuntime().wrap(function
|
7585
|
-
while (1) switch (
|
7528
|
+
return _regeneratorRuntime().wrap(function _callee65$(_context65) {
|
7529
|
+
while (1) switch (_context65.prev = _context65.next) {
|
7586
7530
|
case 0:
|
7587
7531
|
i = {
|
7588
7532
|
authorization: e,
|
7589
7533
|
"content-type": "application/json"
|
7590
7534
|
};
|
7591
|
-
|
7592
|
-
|
7535
|
+
_context65.t0 = "https://api.assemblyai.com/v2/transcript/";
|
7536
|
+
_context65.next = 4;
|
7593
7537
|
return fetch("https://api.assemblyai.com/v2/transcript", {
|
7594
7538
|
method: "POST",
|
7595
7539
|
body: JSON.stringify({
|
@@ -7598,55 +7542,55 @@ var ut = /*#__PURE__*/function () {
|
|
7598
7542
|
headers: i
|
7599
7543
|
});
|
7600
7544
|
case 4:
|
7601
|
-
|
7602
|
-
return
|
7545
|
+
_context65.next = 6;
|
7546
|
+
return _context65.sent.json();
|
7603
7547
|
case 6:
|
7604
|
-
|
7605
|
-
a =
|
7548
|
+
_context65.t1 = _context65.sent.id;
|
7549
|
+
a = _context65.t0.concat.call(_context65.t0, _context65.t1);
|
7606
7550
|
case 8:
|
7607
7551
|
if (l) {
|
7608
|
-
|
7552
|
+
_context65.next = 24;
|
7609
7553
|
break;
|
7610
7554
|
}
|
7611
|
-
|
7555
|
+
_context65.next = 11;
|
7612
7556
|
return fetch(a, {
|
7613
7557
|
headers: i
|
7614
7558
|
});
|
7615
7559
|
case 11:
|
7616
|
-
|
7617
|
-
return
|
7560
|
+
_context65.next = 13;
|
7561
|
+
return _context65.sent.json();
|
7618
7562
|
case 13:
|
7619
|
-
d =
|
7563
|
+
d = _context65.sent;
|
7620
7564
|
if (!(d.status === "completed")) {
|
7621
|
-
|
7565
|
+
_context65.next = 18;
|
7622
7566
|
break;
|
7623
7567
|
}
|
7624
7568
|
l = d;
|
7625
|
-
|
7569
|
+
_context65.next = 22;
|
7626
7570
|
break;
|
7627
7571
|
case 18:
|
7628
7572
|
if (!(d.status === "error")) {
|
7629
|
-
|
7573
|
+
_context65.next = 20;
|
7630
7574
|
break;
|
7631
7575
|
}
|
7632
7576
|
throw new Error("Transcription failed: ".concat(d.error));
|
7633
7577
|
case 20:
|
7634
|
-
|
7578
|
+
_context65.next = 22;
|
7635
7579
|
return new Promise(function (u) {
|
7636
7580
|
return setTimeout(u, 3e3);
|
7637
7581
|
});
|
7638
7582
|
case 22:
|
7639
|
-
|
7583
|
+
_context65.next = 8;
|
7640
7584
|
break;
|
7641
7585
|
case 24:
|
7642
|
-
return
|
7586
|
+
return _context65.abrupt("return", l);
|
7643
7587
|
case 25:
|
7644
7588
|
case "end":
|
7645
|
-
return
|
7589
|
+
return _context65.stop();
|
7646
7590
|
}
|
7647
|
-
},
|
7591
|
+
}, _callee65);
|
7648
7592
|
}));
|
7649
|
-
function poll(
|
7593
|
+
function poll(_x120, _x121) {
|
7650
7594
|
return _poll2.apply(this, arguments);
|
7651
7595
|
}
|
7652
7596
|
return poll;
|
@@ -7694,19 +7638,19 @@ var Qi = /*#__PURE__*/function (_U7) {
|
|
7694
7638
|
_createClass(Qi, [{
|
7695
7639
|
key: "callServiceAPI",
|
7696
7640
|
value: function () {
|
7697
|
-
var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7641
|
+
var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(e, t, i) {
|
7698
7642
|
var n;
|
7699
|
-
return _regeneratorRuntime().wrap(function
|
7700
|
-
while (1) switch (
|
7643
|
+
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
7644
|
+
while (1) switch (_context66.prev = _context66.next) {
|
7701
7645
|
case 0:
|
7702
7646
|
if ((n = this.requestSettings) != null && n.headers) {
|
7703
|
-
|
7647
|
+
_context66.next = 2;
|
7704
7648
|
break;
|
7705
7649
|
}
|
7706
7650
|
throw new Error("Request settings have not been set up");
|
7707
7651
|
case 2:
|
7708
7652
|
if (i != null && i[0]) {
|
7709
|
-
|
7653
|
+
_context66.next = 4;
|
7710
7654
|
break;
|
7711
7655
|
}
|
7712
7656
|
throw new Error("No file was added");
|
@@ -7714,11 +7658,11 @@ var Qi = /*#__PURE__*/function (_U7) {
|
|
7714
7658
|
_.request(this, i[0], e, !1);
|
7715
7659
|
case 5:
|
7716
7660
|
case "end":
|
7717
|
-
return
|
7661
|
+
return _context66.stop();
|
7718
7662
|
}
|
7719
|
-
},
|
7663
|
+
}, _callee66, this);
|
7720
7664
|
}));
|
7721
|
-
function callServiceAPI(
|
7665
|
+
function callServiceAPI(_x122, _x123, _x124) {
|
7722
7666
|
return _callServiceAPI14.apply(this, arguments);
|
7723
7667
|
}
|
7724
7668
|
return callServiceAPI;
|
@@ -7726,32 +7670,32 @@ var Qi = /*#__PURE__*/function (_U7) {
|
|
7726
7670
|
}, {
|
7727
7671
|
key: "extractResultData",
|
7728
7672
|
value: function () {
|
7729
|
-
var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7673
|
+
var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(e) {
|
7730
7674
|
var n, r, t;
|
7731
|
-
return _regeneratorRuntime().wrap(function
|
7732
|
-
while (1) switch (
|
7675
|
+
return _regeneratorRuntime().wrap(function _callee67$(_context67) {
|
7676
|
+
while (1) switch (_context67.prev = _context67.next) {
|
7733
7677
|
case 0:
|
7734
7678
|
if (!e.error) {
|
7735
|
-
|
7679
|
+
_context67.next = 2;
|
7736
7680
|
break;
|
7737
7681
|
}
|
7738
7682
|
throw e.error;
|
7739
7683
|
case 2:
|
7740
7684
|
t = (r = (n = this.requestSettings) == null ? void 0 : n.headers) == null ? void 0 : r.Authorization;
|
7741
|
-
|
7685
|
+
_context67.next = 5;
|
7742
7686
|
return ut.poll(t, e.upload_url);
|
7743
7687
|
case 5:
|
7744
|
-
|
7745
|
-
return
|
7746
|
-
text:
|
7688
|
+
_context67.t0 = _context67.sent.text;
|
7689
|
+
return _context67.abrupt("return", {
|
7690
|
+
text: _context67.t0
|
7747
7691
|
});
|
7748
7692
|
case 7:
|
7749
7693
|
case "end":
|
7750
|
-
return
|
7694
|
+
return _context67.stop();
|
7751
7695
|
}
|
7752
|
-
},
|
7696
|
+
}, _callee67, this);
|
7753
7697
|
}));
|
7754
|
-
function extractResultData(
|
7698
|
+
function extractResultData(_x125) {
|
7755
7699
|
return _extractResultData17.apply(this, arguments);
|
7756
7700
|
}
|
7757
7701
|
return extractResultData;
|
@@ -7771,7 +7715,7 @@ var ls = /*#__PURE__*/function (_U8) {
|
|
7771
7715
|
function ls(e, t, i, n, r) {
|
7772
7716
|
var _this30;
|
7773
7717
|
_classCallCheck(this, ls);
|
7774
|
-
_this30 = _super28.call(this, e,
|
7718
|
+
_this30 = _super28.call(this, e, X.buildSpeechKeyVerificationDetails(i), t, n, r), _this30.insertKeyPlaceholderText = "Azure Speech Subscription Key", _this30.getKeyLink =
|
7775
7719
|
// eslint-disable-next-line max-len
|
7776
7720
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal";
|
7777
7721
|
return _this30;
|
@@ -7789,7 +7733,7 @@ var cs = /*#__PURE__*/function (_ls) {
|
|
7789
7733
|
var n, r, o, a, l, c;
|
7790
7734
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.azure) == null ? void 0 : r.textToSpeech,
|
7791
7735
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
7792
|
-
_this31 = _super29.call(this, e,
|
7736
|
+
_this31 = _super29.call(this, e, X.buildTextToSpeechHeaders.bind({}, (t == null ? void 0 : t.outputFormat) || "audio-16khz-128kbitrate-mono-mp3"), t.region, i), _this31.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Text To Speech</b></div>\n <p>Insert text to synthesize it to audio.\n <p>\n Click <a href=\"".concat(ds.HELP_LINK, "\">here</a> for more info.\n </p>"), _this31.url = "", Object.assign(_this31.rawBody, t), (_a$lang = (a = _this31.rawBody).lang) !== null && _a$lang !== void 0 ? _a$lang : a.lang = "en-US", (_l$name = (l = _this31.rawBody).name) !== null && _l$name !== void 0 ? _l$name : l.name = "en-US-JennyNeural", (_c$gender = (c = _this31.rawBody).gender) !== null && _c$gender !== void 0 ? _c$gender : c.gender = "Female", _this31.url = "https://".concat(t.region, ".tts.speech.microsoft.com/cognitiveservices/v1");
|
7793
7737
|
return _this31;
|
7794
7738
|
}
|
7795
7739
|
_createClass(ds, [{
|
@@ -7801,13 +7745,13 @@ var cs = /*#__PURE__*/function (_ls) {
|
|
7801
7745
|
}, {
|
7802
7746
|
key: "callServiceAPI",
|
7803
7747
|
value: function () {
|
7804
|
-
var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7748
|
+
var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(e, t) {
|
7805
7749
|
var i;
|
7806
|
-
return _regeneratorRuntime().wrap(function
|
7807
|
-
while (1) switch (
|
7750
|
+
return _regeneratorRuntime().wrap(function _callee68$(_context68) {
|
7751
|
+
while (1) switch (_context68.prev = _context68.next) {
|
7808
7752
|
case 0:
|
7809
7753
|
if (this.requestSettings) {
|
7810
|
-
|
7754
|
+
_context68.next = 2;
|
7811
7755
|
break;
|
7812
7756
|
}
|
7813
7757
|
throw new Error("Request settings have not been set up");
|
@@ -7816,11 +7760,11 @@ var cs = /*#__PURE__*/function (_ls) {
|
|
7816
7760
|
_.request(this, i, e, !1);
|
7817
7761
|
case 4:
|
7818
7762
|
case "end":
|
7819
|
-
return
|
7763
|
+
return _context68.stop();
|
7820
7764
|
}
|
7821
|
-
},
|
7765
|
+
}, _callee68, this);
|
7822
7766
|
}));
|
7823
|
-
function callServiceAPI(
|
7767
|
+
function callServiceAPI(_x126, _x127) {
|
7824
7768
|
return _callServiceAPI15.apply(this, arguments);
|
7825
7769
|
}
|
7826
7770
|
return callServiceAPI;
|
@@ -7828,11 +7772,11 @@ var cs = /*#__PURE__*/function (_ls) {
|
|
7828
7772
|
}, {
|
7829
7773
|
key: "extractResultData",
|
7830
7774
|
value: function () {
|
7831
|
-
var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7832
|
-
return _regeneratorRuntime().wrap(function
|
7833
|
-
while (1) switch (
|
7775
|
+
var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(e) {
|
7776
|
+
return _regeneratorRuntime().wrap(function _callee69$(_context69) {
|
7777
|
+
while (1) switch (_context69.prev = _context69.next) {
|
7834
7778
|
case 0:
|
7835
|
-
return
|
7779
|
+
return _context69.abrupt("return", new Promise(function (t) {
|
7836
7780
|
var i = new FileReader();
|
7837
7781
|
i.readAsDataURL(e), i.onload = function (n) {
|
7838
7782
|
t({
|
@@ -7845,11 +7789,11 @@ var cs = /*#__PURE__*/function (_ls) {
|
|
7845
7789
|
}));
|
7846
7790
|
case 1:
|
7847
7791
|
case "end":
|
7848
|
-
return
|
7792
|
+
return _context69.stop();
|
7849
7793
|
}
|
7850
|
-
},
|
7794
|
+
}, _callee69);
|
7851
7795
|
}));
|
7852
|
-
function extractResultData(
|
7796
|
+
function extractResultData(_x128) {
|
7853
7797
|
return _extractResultData18.apply(this, arguments);
|
7854
7798
|
}
|
7855
7799
|
return extractResultData;
|
@@ -7877,7 +7821,7 @@ var us = /*#__PURE__*/function (_ls2) {
|
|
7877
7821
|
}
|
7878
7822
|
}
|
7879
7823
|
};
|
7880
|
-
_this32 = _super30.call(this, e,
|
7824
|
+
_this32 = _super30.call(this, e, X.buildSpeechToTextHeaders, t.region, i, n), _this32.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Speech To Text</b></div>\n <p><b>Upload a .wav or .ogg audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"".concat(zi.HELP_LINK, "\">here</a> for more info.\n </p>"), _this32.url = "", _this32.isTextInputDisabled = !0, _this32.textInputPlaceholderText = "Upload an audio file", _this32.canSendMessage = zi.canFileSendMessage;
|
7881
7825
|
var r = t.lang || "en-US";
|
7882
7826
|
_this32.url = "https://".concat(t.region, ".stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=").concat(r, "&format=detailed"), _this32.recordAudio = void 0;
|
7883
7827
|
return _this32;
|
@@ -7885,19 +7829,19 @@ var us = /*#__PURE__*/function (_ls2) {
|
|
7885
7829
|
_createClass(zi, [{
|
7886
7830
|
key: "callServiceAPI",
|
7887
7831
|
value: function () {
|
7888
|
-
var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7832
|
+
var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(e, t, i) {
|
7889
7833
|
var n, r;
|
7890
|
-
return _regeneratorRuntime().wrap(function
|
7891
|
-
while (1) switch (
|
7834
|
+
return _regeneratorRuntime().wrap(function _callee70$(_context70) {
|
7835
|
+
while (1) switch (_context70.prev = _context70.next) {
|
7892
7836
|
case 0:
|
7893
7837
|
if ((n = this.requestSettings) != null && n.headers) {
|
7894
|
-
|
7838
|
+
_context70.next = 2;
|
7895
7839
|
break;
|
7896
7840
|
}
|
7897
7841
|
throw new Error("Request settings have not been set up");
|
7898
7842
|
case 2:
|
7899
7843
|
if (i != null && i[0]) {
|
7900
|
-
|
7844
|
+
_context70.next = 4;
|
7901
7845
|
break;
|
7902
7846
|
}
|
7903
7847
|
throw new Error("No file was added");
|
@@ -7905,11 +7849,11 @@ var us = /*#__PURE__*/function (_ls2) {
|
|
7905
7849
|
(r = this.requestSettings) != null && r.headers && (this.requestSettings.headers["Content-Type"] = i[0].name.toLocaleLowerCase().endsWith(".wav") ? "audio/wav; codecs=audio/pcm; samplerate=16000" : "audio/ogg; codecs=opus"), _.request(this, i[0], e, !1);
|
7906
7850
|
case 5:
|
7907
7851
|
case "end":
|
7908
|
-
return
|
7852
|
+
return _context70.stop();
|
7909
7853
|
}
|
7910
|
-
},
|
7854
|
+
}, _callee70, this);
|
7911
7855
|
}));
|
7912
|
-
function callServiceAPI(
|
7856
|
+
function callServiceAPI(_x129, _x130, _x131) {
|
7913
7857
|
return _callServiceAPI16.apply(this, arguments);
|
7914
7858
|
}
|
7915
7859
|
return callServiceAPI;
|
@@ -7917,26 +7861,26 @@ var us = /*#__PURE__*/function (_ls2) {
|
|
7917
7861
|
}, {
|
7918
7862
|
key: "extractResultData",
|
7919
7863
|
value: function () {
|
7920
|
-
var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7921
|
-
return _regeneratorRuntime().wrap(function
|
7922
|
-
while (1) switch (
|
7864
|
+
var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(e) {
|
7865
|
+
return _regeneratorRuntime().wrap(function _callee71$(_context71) {
|
7866
|
+
while (1) switch (_context71.prev = _context71.next) {
|
7923
7867
|
case 0:
|
7924
7868
|
if (!e.error) {
|
7925
|
-
|
7869
|
+
_context71.next = 2;
|
7926
7870
|
break;
|
7927
7871
|
}
|
7928
7872
|
throw e.error;
|
7929
7873
|
case 2:
|
7930
|
-
return
|
7874
|
+
return _context71.abrupt("return", {
|
7931
7875
|
text: e.DisplayText || ""
|
7932
7876
|
});
|
7933
7877
|
case 3:
|
7934
7878
|
case "end":
|
7935
|
-
return
|
7879
|
+
return _context71.stop();
|
7936
7880
|
}
|
7937
|
-
},
|
7881
|
+
}, _callee71);
|
7938
7882
|
}));
|
7939
|
-
function extractResultData(
|
7883
|
+
function extractResultData(_x132) {
|
7940
7884
|
return _extractResultData19.apply(this, arguments);
|
7941
7885
|
}
|
7942
7886
|
return extractResultData;
|
@@ -7963,7 +7907,7 @@ var zo = /*#__PURE__*/function (_U9) {
|
|
7963
7907
|
var n, r, o;
|
7964
7908
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.azure) == null ? void 0 : r.translation,
|
7965
7909
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
7966
|
-
_this33 = _super31.call(this, e,
|
7910
|
+
_this33 = _super31.call(this, e, X.buildTranslationKeyVerificationDetails(t.region), X.buildTranslationHeaders.bind({}, t == null ? void 0 : t.region), i), _this33.insertKeyPlaceholderText = "Azure Translate Subscription Key", _this33.getKeyLink =
|
7967
7911
|
// eslint-disable-next-line max-len
|
7968
7912
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this33.url = "", _this33.url = "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=".concat(t.language || "es");
|
7969
7913
|
return _this33;
|
@@ -7979,13 +7923,13 @@ var zo = /*#__PURE__*/function (_U9) {
|
|
7979
7923
|
}, {
|
7980
7924
|
key: "callServiceAPI",
|
7981
7925
|
value: function () {
|
7982
|
-
var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7926
|
+
var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(e, t) {
|
7983
7927
|
var i;
|
7984
|
-
return _regeneratorRuntime().wrap(function
|
7985
|
-
while (1) switch (
|
7928
|
+
return _regeneratorRuntime().wrap(function _callee72$(_context72) {
|
7929
|
+
while (1) switch (_context72.prev = _context72.next) {
|
7986
7930
|
case 0:
|
7987
7931
|
if (this.requestSettings) {
|
7988
|
-
|
7932
|
+
_context72.next = 2;
|
7989
7933
|
break;
|
7990
7934
|
}
|
7991
7935
|
throw new Error("Request settings have not been set up");
|
@@ -7994,11 +7938,11 @@ var zo = /*#__PURE__*/function (_U9) {
|
|
7994
7938
|
_.request(this, i, e);
|
7995
7939
|
case 4:
|
7996
7940
|
case "end":
|
7997
|
-
return
|
7941
|
+
return _context72.stop();
|
7998
7942
|
}
|
7999
|
-
},
|
7943
|
+
}, _callee72, this);
|
8000
7944
|
}));
|
8001
|
-
function callServiceAPI(
|
7945
|
+
function callServiceAPI(_x133, _x134) {
|
8002
7946
|
return _callServiceAPI17.apply(this, arguments);
|
8003
7947
|
}
|
8004
7948
|
return callServiceAPI;
|
@@ -8006,27 +7950,27 @@ var zo = /*#__PURE__*/function (_U9) {
|
|
8006
7950
|
}, {
|
8007
7951
|
key: "extractResultData",
|
8008
7952
|
value: function () {
|
8009
|
-
var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7953
|
+
var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(e) {
|
8010
7954
|
var t;
|
8011
|
-
return _regeneratorRuntime().wrap(function
|
8012
|
-
while (1) switch (
|
7955
|
+
return _regeneratorRuntime().wrap(function _callee73$(_context73) {
|
7956
|
+
while (1) switch (_context73.prev = _context73.next) {
|
8013
7957
|
case 0:
|
8014
7958
|
if (!Array.isArray(e)) {
|
8015
|
-
|
7959
|
+
_context73.next = 2;
|
8016
7960
|
break;
|
8017
7961
|
}
|
8018
|
-
return
|
7962
|
+
return _context73.abrupt("return", {
|
8019
7963
|
text: ((t = e[0].translations) == null ? void 0 : t[0].text) || ""
|
8020
7964
|
});
|
8021
7965
|
case 2:
|
8022
7966
|
throw e.error;
|
8023
7967
|
case 3:
|
8024
7968
|
case "end":
|
8025
|
-
return
|
7969
|
+
return _context73.stop();
|
8026
7970
|
}
|
8027
|
-
},
|
7971
|
+
}, _callee73);
|
8028
7972
|
}));
|
8029
|
-
function extractResultData(
|
7973
|
+
function extractResultData(_x135) {
|
8030
7974
|
return _extractResultData20.apply(this, arguments);
|
8031
7975
|
}
|
8032
7976
|
return extractResultData;
|
@@ -8034,15 +7978,76 @@ var zo = /*#__PURE__*/function (_U9) {
|
|
8034
7978
|
}]);
|
8035
7979
|
return zo;
|
8036
7980
|
}(U);
|
8037
|
-
var
|
8038
|
-
function
|
8039
|
-
_classCallCheck(this,
|
7981
|
+
var ge = /*#__PURE__*/function () {
|
7982
|
+
function ge() {
|
7983
|
+
_classCallCheck(this, ge);
|
8040
7984
|
}
|
8041
|
-
_createClass(
|
7985
|
+
_createClass(ge, null, [{
|
7986
|
+
key: "storeFiles",
|
7987
|
+
value: function () {
|
7988
|
+
var _storeFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(e, t, i) {
|
7989
|
+
var n, r, o, a;
|
7990
|
+
return _regeneratorRuntime().wrap(function _callee75$(_context75) {
|
7991
|
+
while (1) switch (_context75.prev = _context75.next) {
|
7992
|
+
case 0:
|
7993
|
+
n = e.requestSettings.headers;
|
7994
|
+
if (n) {
|
7995
|
+
_context75.next = 3;
|
7996
|
+
break;
|
7997
|
+
}
|
7998
|
+
return _context75.abrupt("return");
|
7999
|
+
case 3:
|
8000
|
+
e.url = "https://api.openai.com/v1/files";
|
8001
|
+
r = n[E.CONTENT_TYPE];
|
8002
|
+
delete n[E.CONTENT_TYPE];
|
8003
|
+
o = i.map( /*#__PURE__*/function () {
|
8004
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(a) {
|
8005
|
+
var l;
|
8006
|
+
return _regeneratorRuntime().wrap(function _callee74$(_context74) {
|
8007
|
+
while (1) switch (_context74.prev = _context74.next) {
|
8008
|
+
case 0:
|
8009
|
+
l = new FormData();
|
8010
|
+
return _context74.abrupt("return", (l.append("purpose", "assistants"), l.append("file", a), new Promise(function (c) {
|
8011
|
+
c(N.directFetch(e, l, "POST", !1));
|
8012
|
+
})));
|
8013
|
+
case 2:
|
8014
|
+
case "end":
|
8015
|
+
return _context74.stop();
|
8016
|
+
}
|
8017
|
+
}, _callee74);
|
8018
|
+
}));
|
8019
|
+
return function (_x139) {
|
8020
|
+
return _ref8.apply(this, arguments);
|
8021
|
+
};
|
8022
|
+
}());
|
8023
|
+
_context75.prev = 7;
|
8024
|
+
_context75.next = 10;
|
8025
|
+
return Promise.all(o);
|
8026
|
+
case 10:
|
8027
|
+
a = _context75.sent.map(function (l) {
|
8028
|
+
return l.id;
|
8029
|
+
});
|
8030
|
+
return _context75.abrupt("return", (n[E.CONTENT_TYPE] = r, a));
|
8031
|
+
case 14:
|
8032
|
+
_context75.prev = 14;
|
8033
|
+
_context75.t0 = _context75["catch"](7);
|
8034
|
+
throw n[E.CONTENT_TYPE] = r, E.displayError(t, _context75.t0), e.completionsHandlers.onFinish(), _context75.t0;
|
8035
|
+
case 17:
|
8036
|
+
case "end":
|
8037
|
+
return _context75.stop();
|
8038
|
+
}
|
8039
|
+
}, _callee75, null, [[7, 14]]);
|
8040
|
+
}));
|
8041
|
+
function storeFiles(_x136, _x137, _x138) {
|
8042
|
+
return _storeFiles.apply(this, arguments);
|
8043
|
+
}
|
8044
|
+
return storeFiles;
|
8045
|
+
}()
|
8046
|
+
}, {
|
8042
8047
|
key: "getType",
|
8043
8048
|
value: function getType(e, t) {
|
8044
8049
|
var i = e[t].path;
|
8045
|
-
return i.endsWith("png") ? "image" : "any";
|
8050
|
+
return !i || i.endsWith("png") ? "image" : "any";
|
8046
8051
|
}
|
8047
8052
|
}, {
|
8048
8053
|
key: "getFiles",
|
@@ -8068,7 +8073,7 @@ var $e = /*#__PURE__*/function () {
|
|
8068
8073
|
l({
|
8069
8074
|
src: d.target.result,
|
8070
8075
|
name: t[a].name,
|
8071
|
-
type:
|
8076
|
+
type: ge.getType(t, a)
|
8072
8077
|
});
|
8073
8078
|
};
|
8074
8079
|
});
|
@@ -8106,9 +8111,11 @@ var $e = /*#__PURE__*/function () {
|
|
8106
8111
|
l.text && l.text.startsWith("sandbox:") && (c = l.file_path) != null && c.file_id && i.push({
|
8107
8112
|
path: l.text,
|
8108
8113
|
fileId: l.file_path.file_id,
|
8109
|
-
name:
|
8114
|
+
name: ge.getFileName(l.text)
|
8110
8115
|
});
|
8111
8116
|
});
|
8117
|
+
}), t != null && t.image_file && i.push({
|
8118
|
+
fileId: t.image_file.file_id
|
8112
8119
|
}), i;
|
8113
8120
|
}
|
8114
8121
|
}, {
|
@@ -8125,12 +8132,14 @@ var $e = /*#__PURE__*/function () {
|
|
8125
8132
|
break;
|
8126
8133
|
}
|
8127
8134
|
_context77.next = 4;
|
8128
|
-
return
|
8135
|
+
return ge.getFiles(e, t);
|
8129
8136
|
case 4:
|
8130
8137
|
n = _context77.sent;
|
8131
8138
|
(r = i == null ? void 0 : i.text) != null && r.value && n.forEach(function (a, l) {
|
8132
|
-
var
|
8133
|
-
|
8139
|
+
var d;
|
8140
|
+
if (!a.src) return;
|
8141
|
+
var c = t[l].path;
|
8142
|
+
(d = i == null ? void 0 : i.text) != null && d.value && c && (i.text.value = i.text.value.replace(c, a.src));
|
8134
8143
|
});
|
8135
8144
|
case 6:
|
8136
8145
|
return _context77.abrupt("return", {
|
@@ -8148,8 +8157,32 @@ var $e = /*#__PURE__*/function () {
|
|
8148
8157
|
}
|
8149
8158
|
return getFilesAndNewText;
|
8150
8159
|
}()
|
8160
|
+
}, {
|
8161
|
+
key: "getFilesAndText",
|
8162
|
+
value: function () {
|
8163
|
+
var _getFilesAndText = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee78(e, t, i) {
|
8164
|
+
var n;
|
8165
|
+
return _regeneratorRuntime().wrap(function _callee78$(_context78) {
|
8166
|
+
while (1) switch (_context78.prev = _context78.next) {
|
8167
|
+
case 0:
|
8168
|
+
n = ge.getFileDetails(t, i);
|
8169
|
+
_context78.next = 3;
|
8170
|
+
return ge.getFilesAndNewText(e, n, i);
|
8171
|
+
case 3:
|
8172
|
+
return _context78.abrupt("return", _context78.sent);
|
8173
|
+
case 4:
|
8174
|
+
case "end":
|
8175
|
+
return _context78.stop();
|
8176
|
+
}
|
8177
|
+
}, _callee78);
|
8178
|
+
}));
|
8179
|
+
function getFilesAndText(_x145, _x146, _x147) {
|
8180
|
+
return _getFilesAndText.apply(this, arguments);
|
8181
|
+
}
|
8182
|
+
return getFilesAndText;
|
8183
|
+
}()
|
8151
8184
|
}]);
|
8152
|
-
return
|
8185
|
+
return ge;
|
8153
8186
|
}();
|
8154
8187
|
var en = /*#__PURE__*/function (_U10) {
|
8155
8188
|
_inherits(ae, _U10);
|
@@ -8208,40 +8241,40 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8208
8241
|
}, {
|
8209
8242
|
key: "callServiceAPI",
|
8210
8243
|
value: function () {
|
8211
|
-
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8244
|
+
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee79(e, t, i) {
|
8212
8245
|
var n;
|
8213
|
-
return _regeneratorRuntime().wrap(function
|
8214
|
-
while (1) switch (
|
8246
|
+
return _regeneratorRuntime().wrap(function _callee79$(_context79) {
|
8247
|
+
while (1) switch (_context79.prev = _context79.next) {
|
8215
8248
|
case 0:
|
8216
8249
|
if (this.requestSettings) {
|
8217
|
-
|
8250
|
+
_context79.next = 2;
|
8218
8251
|
break;
|
8219
8252
|
}
|
8220
8253
|
throw new Error("Request settings have not been set up");
|
8221
8254
|
case 2:
|
8222
8255
|
this.searchedForThreadId || this.searchPreviousMessagesForThreadId(e.messages);
|
8223
8256
|
if (!i) {
|
8224
|
-
|
8257
|
+
_context79.next = 9;
|
8225
8258
|
break;
|
8226
8259
|
}
|
8227
|
-
|
8228
|
-
return
|
8260
|
+
_context79.next = 6;
|
8261
|
+
return ge.storeFiles(this, e, i);
|
8229
8262
|
case 6:
|
8230
|
-
|
8231
|
-
|
8263
|
+
_context79.t0 = _context79.sent;
|
8264
|
+
_context79.next = 10;
|
8232
8265
|
break;
|
8233
8266
|
case 9:
|
8234
|
-
|
8267
|
+
_context79.t0 = void 0;
|
8235
8268
|
case 10:
|
8236
|
-
n =
|
8269
|
+
n = _context79.t0;
|
8237
8270
|
this.requestSettings.method = "POST", this.callService(e, t, n);
|
8238
8271
|
case 12:
|
8239
8272
|
case "end":
|
8240
|
-
return
|
8273
|
+
return _context79.stop();
|
8241
8274
|
}
|
8242
|
-
},
|
8275
|
+
}, _callee79, this);
|
8243
8276
|
}));
|
8244
|
-
function callServiceAPI(
|
8277
|
+
function callServiceAPI(_x148, _x149, _x150) {
|
8245
8278
|
return _callServiceAPI18.apply(this, arguments);
|
8246
8279
|
}
|
8247
8280
|
return callServiceAPI;
|
@@ -8257,34 +8290,34 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8257
8290
|
}, {
|
8258
8291
|
key: "extractResultData",
|
8259
8292
|
value: function () {
|
8260
|
-
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8293
|
+
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee80(e) {
|
8261
8294
|
var n, t, i;
|
8262
|
-
return _regeneratorRuntime().wrap(function
|
8263
|
-
while (1) switch (
|
8295
|
+
return _regeneratorRuntime().wrap(function _callee80$(_context80) {
|
8296
|
+
while (1) switch (_context80.prev = _context80.next) {
|
8264
8297
|
case 0:
|
8265
8298
|
if (!e.error) {
|
8266
|
-
|
8299
|
+
_context80.next = 2;
|
8267
8300
|
break;
|
8268
8301
|
}
|
8269
8302
|
throw e.error.message;
|
8270
8303
|
case 2:
|
8271
|
-
|
8304
|
+
_context80.next = 4;
|
8272
8305
|
return this.assignThreadAndRun(e);
|
8273
8306
|
case 4:
|
8274
8307
|
t = "".concat(ae.THREAD_PREFIX, "/").concat(this.sessionId, "/runs/").concat(this.run_id), i = {
|
8275
8308
|
method: "GET",
|
8276
8309
|
headers: (n = this.requestSettings) == null ? void 0 : n.headers
|
8277
8310
|
};
|
8278
|
-
return
|
8311
|
+
return _context80.abrupt("return", (_.executePollRequest(this, t, i, this.messages), {
|
8279
8312
|
makingAnotherRequest: !0
|
8280
8313
|
}));
|
8281
8314
|
case 6:
|
8282
8315
|
case "end":
|
8283
|
-
return
|
8316
|
+
return _context80.stop();
|
8284
8317
|
}
|
8285
|
-
},
|
8318
|
+
}, _callee80, this);
|
8286
8319
|
}));
|
8287
|
-
function extractResultData(
|
8320
|
+
function extractResultData(_x151) {
|
8288
8321
|
return _extractResultData21.apply(this, arguments);
|
8289
8322
|
}
|
8290
8323
|
return extractResultData;
|
@@ -8292,32 +8325,32 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8292
8325
|
}, {
|
8293
8326
|
key: "assignThreadAndRun",
|
8294
8327
|
value: function () {
|
8295
|
-
var _assignThreadAndRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8328
|
+
var _assignThreadAndRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee81(e) {
|
8296
8329
|
var t;
|
8297
|
-
return _regeneratorRuntime().wrap(function
|
8298
|
-
while (1) switch (
|
8330
|
+
return _regeneratorRuntime().wrap(function _callee81$(_context81) {
|
8331
|
+
while (1) switch (_context81.prev = _context81.next) {
|
8299
8332
|
case 0:
|
8300
8333
|
if (!this.sessionId) {
|
8301
|
-
|
8334
|
+
_context81.next = 8;
|
8302
8335
|
break;
|
8303
8336
|
}
|
8304
8337
|
this.url = "".concat(ae.THREAD_PREFIX, "/").concat(this.sessionId, "/runs");
|
8305
|
-
|
8338
|
+
_context81.next = 4;
|
8306
8339
|
return N.directFetch(this, JSON.parse(JSON.stringify(this.rawBody)), "POST");
|
8307
8340
|
case 4:
|
8308
|
-
t =
|
8341
|
+
t = _context81.sent;
|
8309
8342
|
this.run_id = t.id;
|
8310
|
-
|
8343
|
+
_context81.next = 9;
|
8311
8344
|
break;
|
8312
8345
|
case 8:
|
8313
8346
|
this.sessionId = e.thread_id, this.run_id = e.id, this.messages && (this.messages.messages[this.messages.messages.length - 1]._sessionId = this.sessionId);
|
8314
8347
|
case 9:
|
8315
8348
|
case "end":
|
8316
|
-
return
|
8349
|
+
return _context81.stop();
|
8317
8350
|
}
|
8318
|
-
},
|
8351
|
+
}, _callee81, this);
|
8319
8352
|
}));
|
8320
|
-
function assignThreadAndRun(
|
8353
|
+
function assignThreadAndRun(_x152) {
|
8321
8354
|
return _assignThreadAndRun.apply(this, arguments);
|
8322
8355
|
}
|
8323
8356
|
return assignThreadAndRun;
|
@@ -8325,63 +8358,62 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8325
8358
|
}, {
|
8326
8359
|
key: "extractPollResultData",
|
8327
8360
|
value: function () {
|
8328
|
-
var _extractPollResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8329
|
-
var r, t, i, a, l,
|
8330
|
-
return _regeneratorRuntime().wrap(function
|
8331
|
-
while (1) switch (
|
8361
|
+
var _extractPollResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee82(e) {
|
8362
|
+
var r, t, i, a, l, _yield$ge$getFilesAnd, c, d, n;
|
8363
|
+
return _regeneratorRuntime().wrap(function _callee82$(_context82) {
|
8364
|
+
while (1) switch (_context82.prev = _context82.next) {
|
8332
8365
|
case 0:
|
8333
8366
|
t = e.status, i = e.required_action;
|
8334
8367
|
if (!(t === "queued" || t === "in_progress")) {
|
8335
|
-
|
8368
|
+
_context82.next = 3;
|
8336
8369
|
break;
|
8337
8370
|
}
|
8338
|
-
return
|
8371
|
+
return _context82.abrupt("return", {
|
8339
8372
|
timeoutMS: ae.POLLING_TIMEOUT_MS
|
8340
8373
|
});
|
8341
8374
|
case 3:
|
8342
8375
|
if (!(t === "completed" && this.messages)) {
|
8343
|
-
|
8376
|
+
_context82.next = 15;
|
8344
8377
|
break;
|
8345
8378
|
}
|
8346
8379
|
this.url = "".concat(ae.THREAD_PREFIX, "/").concat(e.thread_id, "/messages");
|
8347
|
-
|
8380
|
+
_context82.next = 7;
|
8348
8381
|
return N.directFetch(this, {}, "GET");
|
8349
8382
|
case 7:
|
8350
|
-
a =
|
8351
|
-
l = a.content.find(function (
|
8352
|
-
return !!
|
8383
|
+
a = _context82.sent.data[0];
|
8384
|
+
l = a.content.find(function (u) {
|
8385
|
+
return !!u.text || !!u.image_file;
|
8353
8386
|
});
|
8354
|
-
|
8355
|
-
|
8356
|
-
|
8357
|
-
|
8358
|
-
_yield
|
8359
|
-
d = _yield
|
8360
|
-
|
8361
|
-
|
8362
|
-
text: d,
|
8387
|
+
_context82.next = 11;
|
8388
|
+
return ge.getFilesAndText(this, a, l);
|
8389
|
+
case 11:
|
8390
|
+
_yield$ge$getFilesAnd = _context82.sent;
|
8391
|
+
c = _yield$ge$getFilesAnd.text;
|
8392
|
+
d = _yield$ge$getFilesAnd.files;
|
8393
|
+
return _context82.abrupt("return", {
|
8394
|
+
text: c,
|
8363
8395
|
_sessionId: this.sessionId,
|
8364
|
-
files:
|
8396
|
+
files: d
|
8365
8397
|
});
|
8366
|
-
case
|
8398
|
+
case 15:
|
8367
8399
|
n = (r = i == null ? void 0 : i.submit_tool_outputs) == null ? void 0 : r.tool_calls;
|
8368
8400
|
if (!(t === "requires_action" && n)) {
|
8369
|
-
|
8401
|
+
_context82.next = 20;
|
8370
8402
|
break;
|
8371
8403
|
}
|
8372
|
-
|
8404
|
+
_context82.next = 19;
|
8373
8405
|
return this.handleTools(n);
|
8406
|
+
case 19:
|
8407
|
+
return _context82.abrupt("return", _context82.sent);
|
8374
8408
|
case 20:
|
8375
|
-
return _context81.abrupt("return", _context81.sent);
|
8376
|
-
case 21:
|
8377
8409
|
throw Error("Thread run status: ".concat(t));
|
8378
|
-
case
|
8410
|
+
case 21:
|
8379
8411
|
case "end":
|
8380
|
-
return
|
8412
|
+
return _context82.stop();
|
8381
8413
|
}
|
8382
|
-
},
|
8414
|
+
}, _callee82, this);
|
8383
8415
|
}));
|
8384
|
-
function extractPollResultData(
|
8416
|
+
function extractPollResultData(_x153) {
|
8385
8417
|
return _extractPollResultData5.apply(this, arguments);
|
8386
8418
|
}
|
8387
8419
|
return extractPollResultData;
|
@@ -8389,13 +8421,13 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8389
8421
|
}, {
|
8390
8422
|
key: "handleTools",
|
8391
8423
|
value: function () {
|
8392
|
-
var _handleTools = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8424
|
+
var _handleTools = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee83(e) {
|
8393
8425
|
var t, i, n;
|
8394
|
-
return _regeneratorRuntime().wrap(function
|
8395
|
-
while (1) switch (
|
8426
|
+
return _regeneratorRuntime().wrap(function _callee83$(_context83) {
|
8427
|
+
while (1) switch (_context83.prev = _context83.next) {
|
8396
8428
|
case 0:
|
8397
8429
|
if (this._functionHandler) {
|
8398
|
-
|
8430
|
+
_context83.next = 2;
|
8399
8431
|
break;
|
8400
8432
|
}
|
8401
8433
|
throw Error("Please define the `function_handler` property inside the [openAI](https://deepchat.dev/docs/directConnection/openAI#Assistant) object.");
|
@@ -8406,14 +8438,14 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8406
8438
|
arguments: r["function"].arguments
|
8407
8439
|
};
|
8408
8440
|
});
|
8409
|
-
|
8441
|
+
_context83.next = 5;
|
8410
8442
|
return this._functionHandler(t);
|
8411
8443
|
case 5:
|
8412
|
-
i =
|
8444
|
+
i = _context83.sent;
|
8413
8445
|
if (!(!Array.isArray(i) || i.find(function (r) {
|
8414
8446
|
return typeof r != "string";
|
8415
8447
|
}) || e.length !== i.length)) {
|
8416
|
-
|
8448
|
+
_context83.next = 8;
|
8417
8449
|
break;
|
8418
8450
|
}
|
8419
8451
|
throw Error("Response must contain an array of strings for each individual function/tool_call, see https://deepchat.dev/docs/directConnection/OpenAI/#assistant-functions.");
|
@@ -8425,21 +8457,21 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8425
8457
|
};
|
8426
8458
|
});
|
8427
8459
|
this.url = "".concat(ae.THREAD_PREFIX, "/").concat(this.sessionId, "/runs/").concat(this.run_id, "/submit_tool_outputs");
|
8428
|
-
|
8460
|
+
_context83.next = 12;
|
8429
8461
|
return N.directFetch(this, {
|
8430
8462
|
tool_outputs: n
|
8431
8463
|
}, "POST");
|
8432
8464
|
case 12:
|
8433
|
-
return
|
8465
|
+
return _context83.abrupt("return", {
|
8434
8466
|
timeoutMS: ae.POLLING_TIMEOUT_MS
|
8435
8467
|
});
|
8436
8468
|
case 13:
|
8437
8469
|
case "end":
|
8438
|
-
return
|
8470
|
+
return _context83.stop();
|
8439
8471
|
}
|
8440
|
-
},
|
8472
|
+
}, _callee83, this);
|
8441
8473
|
}));
|
8442
|
-
function handleTools(
|
8474
|
+
function handleTools(_x154) {
|
8443
8475
|
return _handleTools.apply(this, arguments);
|
8444
8476
|
}
|
8445
8477
|
return handleTools;
|
@@ -8451,11 +8483,11 @@ en.THREAD_PREFIX = "https://api.openai.com/v1/threads";
|
|
8451
8483
|
en.POLLING_TIMEOUT_MS = 800;
|
8452
8484
|
var Uo = en;
|
8453
8485
|
var ai = /*#__PURE__*/function (_U11) {
|
8454
|
-
_inherits(
|
8455
|
-
var _super33 = _createSuper(
|
8456
|
-
function
|
8486
|
+
_inherits(_e, _U11);
|
8487
|
+
var _super33 = _createSuper(_e);
|
8488
|
+
function _e(e) {
|
8457
8489
|
var _this35;
|
8458
|
-
_classCallCheck(this,
|
8490
|
+
_classCallCheck(this, _e);
|
8459
8491
|
var o;
|
8460
8492
|
var t = e.directConnection,
|
8461
8493
|
i = t == null ? void 0 : t.openAI,
|
@@ -8478,10 +8510,10 @@ var ai = /*#__PURE__*/function (_U11) {
|
|
8478
8510
|
}
|
8479
8511
|
};
|
8480
8512
|
}
|
8481
|
-
_typeof(r) == "object" && Object.assign(_this35.rawBody, r), _this35.canSendMessage =
|
8513
|
+
_typeof(r) == "object" && Object.assign(_this35.rawBody, r), _this35.canSendMessage = _e.canFileSendMessage;
|
8482
8514
|
return _this35;
|
8483
8515
|
}
|
8484
|
-
_createClass(
|
8516
|
+
_createClass(_e, [{
|
8485
8517
|
key: "preprocessBody",
|
8486
8518
|
value: function preprocessBody(e, t) {
|
8487
8519
|
var i = JSON.parse(JSON.stringify(e));
|
@@ -8495,50 +8527,50 @@ var ai = /*#__PURE__*/function (_U11) {
|
|
8495
8527
|
var n;
|
8496
8528
|
var r = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim();
|
8497
8529
|
if (i[1] || r && r !== "") {
|
8498
|
-
this.url =
|
8530
|
+
this.url = _e.IMAGE_EDIT_URL;
|
8499
8531
|
var l = this.preprocessBody(this.rawBody, r);
|
8500
|
-
n =
|
8501
|
-
} else this.url =
|
8532
|
+
n = _e.createFormDataBody(l, i[0], i[1]);
|
8533
|
+
} else this.url = _e.IMAGE_VARIATIONS_URL, n = _e.createFormDataBody(this.rawBody, i[0]);
|
8502
8534
|
E.tempRemoveContentHeader(this.requestSettings, _.request.bind(this, this, n, e), !1);
|
8503
8535
|
}
|
8504
8536
|
}, {
|
8505
8537
|
key: "callServiceAPI",
|
8506
8538
|
value: function () {
|
8507
|
-
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8539
|
+
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee84(e, t, i) {
|
8508
8540
|
var n, r;
|
8509
|
-
return _regeneratorRuntime().wrap(function
|
8510
|
-
while (1) switch (
|
8541
|
+
return _regeneratorRuntime().wrap(function _callee84$(_context84) {
|
8542
|
+
while (1) switch (_context84.prev = _context84.next) {
|
8511
8543
|
case 0:
|
8512
8544
|
if ((n = this.requestSettings) != null && n.headers) {
|
8513
|
-
|
8545
|
+
_context84.next = 2;
|
8514
8546
|
break;
|
8515
8547
|
}
|
8516
8548
|
throw new Error("Request settings have not been set up");
|
8517
8549
|
case 2:
|
8518
8550
|
if (!(i != null && i[0])) {
|
8519
|
-
|
8551
|
+
_context84.next = 6;
|
8520
8552
|
break;
|
8521
8553
|
}
|
8522
8554
|
this.callApiWithImage(e, t, i);
|
8523
|
-
|
8555
|
+
_context84.next = 11;
|
8524
8556
|
break;
|
8525
8557
|
case 6:
|
8526
8558
|
if (this.requestSettings) {
|
8527
|
-
|
8559
|
+
_context84.next = 8;
|
8528
8560
|
break;
|
8529
8561
|
}
|
8530
8562
|
throw new Error("Request settings have not been set up");
|
8531
8563
|
case 8:
|
8532
|
-
this.url =
|
8564
|
+
this.url = _e.IMAGE_GENERATION_URL;
|
8533
8565
|
r = this.preprocessBody(this.rawBody, t[t.length - 1].text);
|
8534
8566
|
_.request(this, r, e);
|
8535
8567
|
case 11:
|
8536
8568
|
case "end":
|
8537
|
-
return
|
8569
|
+
return _context84.stop();
|
8538
8570
|
}
|
8539
|
-
},
|
8571
|
+
}, _callee84, this);
|
8540
8572
|
}));
|
8541
|
-
function callServiceAPI(
|
8573
|
+
function callServiceAPI(_x155, _x156, _x157) {
|
8542
8574
|
return _callServiceAPI19.apply(this, arguments);
|
8543
8575
|
}
|
8544
8576
|
return callServiceAPI;
|
@@ -8546,17 +8578,17 @@ var ai = /*#__PURE__*/function (_U11) {
|
|
8546
8578
|
}, {
|
8547
8579
|
key: "extractResultData",
|
8548
8580
|
value: function () {
|
8549
|
-
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8550
|
-
return _regeneratorRuntime().wrap(function
|
8551
|
-
while (1) switch (
|
8581
|
+
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee85(e) {
|
8582
|
+
return _regeneratorRuntime().wrap(function _callee85$(_context85) {
|
8583
|
+
while (1) switch (_context85.prev = _context85.next) {
|
8552
8584
|
case 0:
|
8553
8585
|
if (!e.error) {
|
8554
|
-
|
8586
|
+
_context85.next = 2;
|
8555
8587
|
break;
|
8556
8588
|
}
|
8557
8589
|
throw e.error.message;
|
8558
8590
|
case 2:
|
8559
|
-
return
|
8591
|
+
return _context85.abrupt("return", {
|
8560
8592
|
files: e.data.map(function (i) {
|
8561
8593
|
return i.url ? {
|
8562
8594
|
src: i.url,
|
@@ -8569,11 +8601,11 @@ var ai = /*#__PURE__*/function (_U11) {
|
|
8569
8601
|
});
|
8570
8602
|
case 3:
|
8571
8603
|
case "end":
|
8572
|
-
return
|
8604
|
+
return _context85.stop();
|
8573
8605
|
}
|
8574
|
-
},
|
8606
|
+
}, _callee85);
|
8575
8607
|
}));
|
8576
|
-
function extractResultData(
|
8608
|
+
function extractResultData(_x158) {
|
8577
8609
|
return _extractResultData22.apply(this, arguments);
|
8578
8610
|
}
|
8579
8611
|
return extractResultData;
|
@@ -8600,7 +8632,7 @@ var ai = /*#__PURE__*/function (_U11) {
|
|
8600
8632
|
}), n;
|
8601
8633
|
}
|
8602
8634
|
}]);
|
8603
|
-
return
|
8635
|
+
return _e;
|
8604
8636
|
}(U);
|
8605
8637
|
ai.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations";
|
8606
8638
|
ai.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations";
|
@@ -8652,13 +8684,13 @@ var ht = /*#__PURE__*/function (_U12) {
|
|
8652
8684
|
}, {
|
8653
8685
|
key: "callServiceAPI",
|
8654
8686
|
value: function () {
|
8655
|
-
var _callServiceAPI20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8687
|
+
var _callServiceAPI20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee86(e, t) {
|
8656
8688
|
var i, n;
|
8657
|
-
return _regeneratorRuntime().wrap(function
|
8658
|
-
while (1) switch (
|
8689
|
+
return _regeneratorRuntime().wrap(function _callee86$(_context86) {
|
8690
|
+
while (1) switch (_context86.prev = _context86.next) {
|
8659
8691
|
case 0:
|
8660
8692
|
if (this.requestSettings) {
|
8661
|
-
|
8693
|
+
_context86.next = 2;
|
8662
8694
|
break;
|
8663
8695
|
}
|
8664
8696
|
throw new Error("Request settings have not been set up");
|
@@ -8667,11 +8699,11 @@ var ht = /*#__PURE__*/function (_U12) {
|
|
8667
8699
|
n && (_typeof(n) != "object" || !n.simulation) || i.stream ? (i.stream = !0, I.request(this, i, e)) : _.request(this, i, e);
|
8668
8700
|
case 4:
|
8669
8701
|
case "end":
|
8670
|
-
return
|
8702
|
+
return _context86.stop();
|
8671
8703
|
}
|
8672
|
-
},
|
8704
|
+
}, _callee86, this);
|
8673
8705
|
}));
|
8674
|
-
function callServiceAPI(
|
8706
|
+
function callServiceAPI(_x159, _x160) {
|
8675
8707
|
return _callServiceAPI20.apply(this, arguments);
|
8676
8708
|
}
|
8677
8709
|
return callServiceAPI;
|
@@ -8679,17 +8711,17 @@ var ht = /*#__PURE__*/function (_U12) {
|
|
8679
8711
|
}, {
|
8680
8712
|
key: "extractResultData",
|
8681
8713
|
value: function () {
|
8682
|
-
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8683
|
-
return _regeneratorRuntime().wrap(function
|
8684
|
-
while (1) switch (
|
8714
|
+
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee87(e, t, i) {
|
8715
|
+
return _regeneratorRuntime().wrap(function _callee87$(_context87) {
|
8716
|
+
while (1) switch (_context87.prev = _context87.next) {
|
8685
8717
|
case 0:
|
8686
8718
|
if (!e.error) {
|
8687
|
-
|
8719
|
+
_context87.next = 2;
|
8688
8720
|
break;
|
8689
8721
|
}
|
8690
8722
|
throw e.error.message;
|
8691
8723
|
case 2:
|
8692
|
-
return
|
8724
|
+
return _context87.abrupt("return", e.choices[0].delta ? {
|
8693
8725
|
text: e.choices[0].delta.content || ""
|
8694
8726
|
} : e.choices[0].message ? e.choices[0].message.tool_calls ? this.handleTools(e.choices[0].message, t, i) : {
|
8695
8727
|
text: e.choices[0].message.content
|
@@ -8698,11 +8730,11 @@ var ht = /*#__PURE__*/function (_U12) {
|
|
8698
8730
|
});
|
8699
8731
|
case 3:
|
8700
8732
|
case "end":
|
8701
|
-
return
|
8733
|
+
return _context87.stop();
|
8702
8734
|
}
|
8703
|
-
},
|
8735
|
+
}, _callee87, this);
|
8704
8736
|
}));
|
8705
|
-
function extractResultData(
|
8737
|
+
function extractResultData(_x161, _x162, _x163) {
|
8706
8738
|
return _extractResultData23.apply(this, arguments);
|
8707
8739
|
}
|
8708
8740
|
return extractResultData;
|
@@ -8710,13 +8742,13 @@ var ht = /*#__PURE__*/function (_U12) {
|
|
8710
8742
|
}, {
|
8711
8743
|
key: "handleTools",
|
8712
8744
|
value: function () {
|
8713
|
-
var _handleTools2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8745
|
+
var _handleTools2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee88(e, t, i) {
|
8714
8746
|
var a, n, r, o, l;
|
8715
|
-
return _regeneratorRuntime().wrap(function
|
8716
|
-
while (1) switch (
|
8747
|
+
return _regeneratorRuntime().wrap(function _callee88$(_context88) {
|
8748
|
+
while (1) switch (_context88.prev = _context88.next) {
|
8717
8749
|
case 0:
|
8718
8750
|
if (!(!e.tool_calls || !t || !i || !this._functionHandler)) {
|
8719
|
-
|
8751
|
+
_context88.next = 2;
|
8720
8752
|
break;
|
8721
8753
|
}
|
8722
8754
|
throw Error("Please define the `function_handler` property inside the [openAI](https://deepchat.dev/docs/directConnection/openAI#Chat) object.");
|
@@ -8728,22 +8760,22 @@ var ht = /*#__PURE__*/function (_U12) {
|
|
8728
8760
|
arguments: l["function"].arguments
|
8729
8761
|
};
|
8730
8762
|
});
|
8731
|
-
|
8763
|
+
_context88.next = 6;
|
8732
8764
|
return (a = this._functionHandler) == null ? void 0 : a.call(this, r);
|
8733
8765
|
case 6:
|
8734
|
-
o =
|
8766
|
+
o = _context88.sent;
|
8735
8767
|
if (!o.text) {
|
8736
|
-
|
8768
|
+
_context88.next = 9;
|
8737
8769
|
break;
|
8738
8770
|
}
|
8739
|
-
return
|
8771
|
+
return _context88.abrupt("return", {
|
8740
8772
|
text: o.text
|
8741
8773
|
});
|
8742
8774
|
case 9:
|
8743
8775
|
if (!(n.messages.push(e), Array.isArray(o) && !o.find(function (l) {
|
8744
8776
|
return typeof l != "string";
|
8745
8777
|
}) || r.length === o.length)) {
|
8746
|
-
|
8778
|
+
_context88.next = 17;
|
8747
8779
|
break;
|
8748
8780
|
}
|
8749
8781
|
o.forEach(function (c, d) {
|
@@ -8756,30 +8788,30 @@ var ht = /*#__PURE__*/function (_U12) {
|
|
8756
8788
|
content: c.response
|
8757
8789
|
});
|
8758
8790
|
}), delete n.tools, delete n.tool_choice;
|
8759
|
-
|
8791
|
+
_context88.next = 13;
|
8760
8792
|
return t == null ? void 0 : t(n).then(function (c) {
|
8761
8793
|
return E.processResponseByType(c);
|
8762
8794
|
});
|
8763
8795
|
case 13:
|
8764
|
-
l =
|
8796
|
+
l = _context88.sent;
|
8765
8797
|
if (!l.error) {
|
8766
|
-
|
8798
|
+
_context88.next = 16;
|
8767
8799
|
break;
|
8768
8800
|
}
|
8769
8801
|
throw l.error.message;
|
8770
8802
|
case 16:
|
8771
|
-
return
|
8803
|
+
return _context88.abrupt("return", {
|
8772
8804
|
text: l.choices[0].message.content || ""
|
8773
8805
|
});
|
8774
8806
|
case 17:
|
8775
8807
|
throw Error("Response object must either be {response: string}[] for each individual function or {text: string} for a direct response, see https://deepchat.dev/docs/directConnection/OpenAI#FunctionHandler.");
|
8776
8808
|
case 18:
|
8777
8809
|
case "end":
|
8778
|
-
return
|
8810
|
+
return _context88.stop();
|
8779
8811
|
}
|
8780
|
-
},
|
8812
|
+
}, _callee88, this);
|
8781
8813
|
}));
|
8782
|
-
function handleTools(
|
8814
|
+
function handleTools(_x164, _x165, _x166) {
|
8783
8815
|
return _handleTools2.apply(this, arguments);
|
8784
8816
|
}
|
8785
8817
|
return handleTools;
|
@@ -8845,13 +8877,13 @@ var Ho = /*#__PURE__*/function (_Zi3) {
|
|
8845
8877
|
}, {
|
8846
8878
|
key: "callServiceAPI",
|
8847
8879
|
value: function () {
|
8848
|
-
var _callServiceAPI21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8880
|
+
var _callServiceAPI21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee89(e, t) {
|
8849
8881
|
var i;
|
8850
|
-
return _regeneratorRuntime().wrap(function
|
8851
|
-
while (1) switch (
|
8882
|
+
return _regeneratorRuntime().wrap(function _callee89$(_context89) {
|
8883
|
+
while (1) switch (_context89.prev = _context89.next) {
|
8852
8884
|
case 0:
|
8853
8885
|
if (this.requestSettings) {
|
8854
|
-
|
8886
|
+
_context89.next = 2;
|
8855
8887
|
break;
|
8856
8888
|
}
|
8857
8889
|
throw new Error("Request settings have not been set up");
|
@@ -8860,11 +8892,11 @@ var Ho = /*#__PURE__*/function (_Zi3) {
|
|
8860
8892
|
_.request(this, i, e);
|
8861
8893
|
case 4:
|
8862
8894
|
case "end":
|
8863
|
-
return
|
8895
|
+
return _context89.stop();
|
8864
8896
|
}
|
8865
|
-
},
|
8897
|
+
}, _callee89, this);
|
8866
8898
|
}));
|
8867
|
-
function callServiceAPI(
|
8899
|
+
function callServiceAPI(_x167, _x168) {
|
8868
8900
|
return _callServiceAPI21.apply(this, arguments);
|
8869
8901
|
}
|
8870
8902
|
return callServiceAPI;
|
@@ -8872,26 +8904,26 @@ var Ho = /*#__PURE__*/function (_Zi3) {
|
|
8872
8904
|
}, {
|
8873
8905
|
key: "extractResultData",
|
8874
8906
|
value: function () {
|
8875
|
-
var _extractResultData24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8876
|
-
return _regeneratorRuntime().wrap(function
|
8877
|
-
while (1) switch (
|
8907
|
+
var _extractResultData24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee90(e) {
|
8908
|
+
return _regeneratorRuntime().wrap(function _callee90$(_context90) {
|
8909
|
+
while (1) switch (_context90.prev = _context90.next) {
|
8878
8910
|
case 0:
|
8879
8911
|
if (!e.message) {
|
8880
|
-
|
8912
|
+
_context90.next = 2;
|
8881
8913
|
break;
|
8882
8914
|
}
|
8883
8915
|
throw e.message;
|
8884
8916
|
case 2:
|
8885
|
-
return
|
8917
|
+
return _context90.abrupt("return", {
|
8886
8918
|
text: e.text
|
8887
8919
|
});
|
8888
8920
|
case 3:
|
8889
8921
|
case "end":
|
8890
|
-
return
|
8922
|
+
return _context90.stop();
|
8891
8923
|
}
|
8892
|
-
},
|
8924
|
+
}, _callee90);
|
8893
8925
|
}));
|
8894
|
-
function extractResultData(
|
8926
|
+
function extractResultData(_x169) {
|
8895
8927
|
return _extractResultData24.apply(this, arguments);
|
8896
8928
|
}
|
8897
8929
|
return extractResultData;
|
@@ -8926,7 +8958,7 @@ var Go = /*#__PURE__*/function () {
|
|
8926
8958
|
}
|
8927
8959
|
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);
|
8928
8960
|
}
|
8929
|
-
return i ? new
|
8961
|
+
return i ? new Ne(e) : new Ne(e, void 0, n || !0);
|
8930
8962
|
}
|
8931
8963
|
}]);
|
8932
8964
|
return Go;
|
@@ -9050,7 +9082,7 @@ var Wo = /*#__PURE__*/function () {
|
|
9050
9082
|
key: "getText",
|
9051
9083
|
value: function getText(e, t) {
|
9052
9084
|
var i, n;
|
9053
|
-
if (!e.directConnection && !e.request && !e.webModel && !e.demo) return "Connect to any API using the [request](https://deepchat.dev/docs/connect#Request)\n property or a popular service via\n [directConnection](https://deepchat.dev/docs/directConnection/#directConnection).\n \n Host AI entirely on your browser via a [webModel](
|
9085
|
+
if (!e.directConnection && !e.request && !e.webModel && !e.demo) return "Connect to any API using the [request](https://deepchat.dev/docs/connect#Request)\n property or a popular service via\n [directConnection](https://deepchat.dev/docs/directConnection/#directConnection).\n \n Host AI entirely on your browser via a [webModel](https://deepchat.dev/docs/webModel).\n \n To get started checkout the [Start](https://deepchat.dev/start) page and\n live code [examples](https://deepchat.dev/examples/frameworks).\n \n To remove this message set the [demo](https://deepchat.dev/docs/demo#demo) property to true.";
|
9054
9086
|
if (e.directConnection) {
|
9055
9087
|
if (!t.isDirectConnection()) return "Please define a valid service inside\n the [directConnection](https://deepchat.dev/docs/directConnection/#directConnection) object.";
|
9056
9088
|
var r = (i = e.directConnection.openAI) == null ? void 0 : i.chat;
|
@@ -9072,26 +9104,26 @@ var fe = /*#__PURE__*/function () {
|
|
9072
9104
|
key: "createImage",
|
9073
9105
|
value: function createImage(e, t) {
|
9074
9106
|
var i = new Image();
|
9075
|
-
return i.src = e.src, ne.scrollDownOnImageLoad(i.src, t), ne.processContent(i, i.src, e.name);
|
9107
|
+
return i.src = e.src, ne.scrollDownOnImageLoad(i.src, t), ne.processContent("image", i, i.src, e.name);
|
9076
9108
|
}
|
9077
9109
|
// WORK - image still does not scroll down when loaded
|
9078
9110
|
}, {
|
9079
9111
|
key: "addNewImageMessage",
|
9080
9112
|
value: function () {
|
9081
|
-
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9113
|
+
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee91(e, t, i) {
|
9082
9114
|
var n, r;
|
9083
|
-
return _regeneratorRuntime().wrap(function
|
9084
|
-
while (1) switch (
|
9115
|
+
return _regeneratorRuntime().wrap(function _callee91$(_context91) {
|
9116
|
+
while (1) switch (_context91.prev = _context91.next) {
|
9085
9117
|
case 0:
|
9086
9118
|
n = fe.createImage(t, e.elementRef), r = e.createNewMessageElement("", i);
|
9087
9119
|
r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("image-message"), ne.addMessage(e, r, "image", i);
|
9088
9120
|
case 2:
|
9089
9121
|
case "end":
|
9090
|
-
return
|
9122
|
+
return _context91.stop();
|
9091
9123
|
}
|
9092
|
-
},
|
9124
|
+
}, _callee91);
|
9093
9125
|
}));
|
9094
|
-
function addNewImageMessage(
|
9126
|
+
function addNewImageMessage(_x170, _x171, _x172) {
|
9095
9127
|
return _addNewImageMessage.apply(this, arguments);
|
9096
9128
|
}
|
9097
9129
|
return addNewImageMessage;
|
@@ -9100,7 +9132,7 @@ var fe = /*#__PURE__*/function () {
|
|
9100
9132
|
key: "createAudioElement",
|
9101
9133
|
value: function createAudioElement(e, t) {
|
9102
9134
|
var i = document.createElement("audio");
|
9103
|
-
return i.src = e.src, i.classList.add("audio-player"), i.controls = !0,
|
9135
|
+
return i.src = e.src, i.classList.add("audio-player"), i.controls = !0, be.IS_SAFARI && (i.classList.add("audio-player-safari"), i.classList.add(t === v.USER_ROLE ? "audio-player-safari-right" : "audio-player-safari-left")), i;
|
9104
9136
|
}
|
9105
9137
|
}, {
|
9106
9138
|
key: "addNewAudioMessage",
|
@@ -9116,10 +9148,10 @@ var fe = /*#__PURE__*/function () {
|
|
9116
9148
|
t.classList.add("any-file-message-contents");
|
9117
9149
|
var i = document.createElement("div");
|
9118
9150
|
i.classList.add("any-file-message-icon-container");
|
9119
|
-
var n =
|
9151
|
+
var n = H.createSVGElement(Ko);
|
9120
9152
|
n.classList.add("any-file-message-icon"), i.appendChild(n);
|
9121
9153
|
var r = document.createElement("div");
|
9122
|
-
return r.classList.add("any-file-message-text"), r.textContent = e.name || ne.DEFAULT_FILE_NAME, t.appendChild(i), t.appendChild(r), ne.processContent(t, e.src, r.textContent
|
9154
|
+
return r.classList.add("any-file-message-text"), r.textContent = e.name || ne.DEFAULT_FILE_NAME, t.appendChild(i), t.appendChild(r), ne.processContent("any", t, e.src, r.textContent);
|
9123
9155
|
}
|
9124
9156
|
}, {
|
9125
9157
|
key: "addNewAnyFileMessage",
|
@@ -9140,8 +9172,8 @@ var fe = /*#__PURE__*/function () {
|
|
9140
9172
|
}]);
|
9141
9173
|
return fe;
|
9142
9174
|
}();
|
9143
|
-
var me = /*#__PURE__*/function (
|
9144
|
-
_inherits(me,
|
9175
|
+
var me = /*#__PURE__*/function (_$e) {
|
9176
|
+
_inherits(me, _$e);
|
9145
9177
|
var _super36 = _createSuper(me);
|
9146
9178
|
function me(e, t, i) {
|
9147
9179
|
var _this38;
|
@@ -9153,7 +9185,7 @@ var me = /*#__PURE__*/function (_Je) {
|
|
9153
9185
|
o = t.demo;
|
9154
9186
|
_this38._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, _this38._onClearMessages = Bt.onClearMessages.bind(_assertThisInitialized(_this38), e), _this38._onError = Bt.onError.bind(_assertThisInitialized(_this38), e), _this38._displayLoadingMessage = me.getDisplayLoadingMessage(e, t), _this38._permittedErrorPrefixes = n, _this38.addSetupMessageIfNeeded(e, t) || _this38.populateIntroPanel(i, r, e.introPanelStyle), _this38.addIntroductoryMessage(e, t), e.initialMessages && _this38.populateInitialMessages(e.initialMessages), _this38._displayServiceErrorMessages = (l = e.errorMessages) == null ? void 0 : l.displayServiceErrorMessages, e.getMessages = function () {
|
9155
9187
|
return JSON.parse(JSON.stringify(_this38.messages));
|
9156
|
-
}, e.clearMessages = _this38.clearMessages.bind(_assertThisInitialized(_this38), t), e.refreshMessages = _this38.refreshTextMessages.bind(_assertThisInitialized(_this38)), e.scrollToBottom =
|
9188
|
+
}, e.clearMessages = _this38.clearMessages.bind(_assertThisInitialized(_this38), t), e.refreshMessages = _this38.refreshTextMessages.bind(_assertThisInitialized(_this38)), e.scrollToBottom = Z.scrollToBottom.bind(_assertThisInitialized(_this38), _this38.elementRef), e._addMessage = function (c, d) {
|
9157
9189
|
_this38.addNewMessage(_objectSpread(_objectSpread({}, c), {}, {
|
9158
9190
|
sendUpdate: !!d
|
9159
9191
|
}), !d);
|
@@ -9201,9 +9233,9 @@ var me = /*#__PURE__*/function (_Je) {
|
|
9201
9233
|
value: function populateInitialMessages(e) {
|
9202
9234
|
var _this39 = this;
|
9203
9235
|
e.forEach(function (t) {
|
9204
|
-
|
9236
|
+
Le.processInitialMessageFile(t), _this39.addNewMessage(t, !0);
|
9205
9237
|
}), setTimeout(function () {
|
9206
|
-
return
|
9238
|
+
return Z.scrollToBottom(_this39.elementRef);
|
9207
9239
|
}, 0);
|
9208
9240
|
}
|
9209
9241
|
// this should not be activated by streamed messages
|
@@ -9217,7 +9249,7 @@ var me = /*#__PURE__*/function (_Je) {
|
|
9217
9249
|
};
|
9218
9250
|
if (!e.ignoreText && i.text !== void 0 && e.text !== null && (this.addNewTextMessage(i.text, i.role, n), !t && this.textToSpeech && i.role !== v.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) {
|
9219
9251
|
var r = Xe.add(this, i.html, i.role, this.messageElementRefs, n);
|
9220
|
-
|
9252
|
+
ve.isElementTemporary(r) && delete i.html;
|
9221
9253
|
}
|
9222
9254
|
this.isValidMessageContent(i) && this.updateStateOnMessage(i, e.overwrite, e.sendUpdate, t);
|
9223
9255
|
}
|
@@ -9254,7 +9286,7 @@ var me = /*#__PURE__*/function (_Je) {
|
|
9254
9286
|
var o = this.getPermittedMessage(t) || ((l = this._errorMessageOverrides) == null ? void 0 : l[e]) || ((c = this._errorMessageOverrides) == null ? void 0 : c["default"]) || "Error, please try again.";
|
9255
9287
|
this.renderText(r, o);
|
9256
9288
|
var a = D.extractParticularSharedStyles(["fontSize", "fontFamily"], (d = this.messageStyles) == null ? void 0 : d["default"]);
|
9257
|
-
D.applyCustomStylesToElements(i, !1, a), D.applyCustomStylesToElements(i, !1, (u = this.messageStyles) == null ? void 0 : u.error), this.elementRef.appendChild(n),
|
9289
|
+
D.applyCustomStylesToElements(i, !1, a), D.applyCustomStylesToElements(i, !1, (u = this.messageStyles) == null ? void 0 : u.error), this.elementRef.appendChild(n), Z.scrollToBottom(this.elementRef), this.textToSpeech && jt.speak(o, this.textToSpeech), (p = this._onError) == null || p.call(this, o);
|
9258
9290
|
}
|
9259
9291
|
}, {
|
9260
9292
|
key: "getPermittedMessage",
|
@@ -9291,7 +9323,7 @@ var me = /*#__PURE__*/function (_Je) {
|
|
9291
9323
|
i = e.bubbleElement;
|
9292
9324
|
i.classList.add("loading-message-text");
|
9293
9325
|
var n = document.createElement("div");
|
9294
|
-
n.classList.add("dots-flashing"), i.appendChild(n), this.applyCustomStyles(e, v.AI_ROLE, !1, (r = this.messageStyles) == null ? void 0 : r.loading), tn.set(i, this.messageStyles), this.elementRef.appendChild(t),
|
9326
|
+
n.classList.add("dots-flashing"), i.appendChild(n), this.applyCustomStyles(e, v.AI_ROLE, !1, (r = this.messageStyles) == null ? void 0 : r.loading), tn.set(i, this.messageStyles), this.elementRef.appendChild(t), Z.scrollToBottom(this.elementRef);
|
9295
9327
|
}
|
9296
9328
|
}, {
|
9297
9329
|
key: "populateIntroPanel",
|
@@ -9301,11 +9333,11 @@ var me = /*#__PURE__*/function (_Je) {
|
|
9301
9333
|
}, {
|
9302
9334
|
key: "addMultipleFiles",
|
9303
9335
|
value: function () {
|
9304
|
-
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9305
|
-
return _regeneratorRuntime().wrap(function
|
9306
|
-
while (1) switch (
|
9336
|
+
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee92(e) {
|
9337
|
+
return _regeneratorRuntime().wrap(function _callee92$(_context92) {
|
9338
|
+
while (1) switch (_context92.prev = _context92.next) {
|
9307
9339
|
case 0:
|
9308
|
-
return
|
9340
|
+
return _context92.abrupt("return", Promise.all((e || []).map(function (t) {
|
9309
9341
|
return new Promise(function (i) {
|
9310
9342
|
if (!t.type || t.type === "any") {
|
9311
9343
|
var n = t.file.name || ne.DEFAULT_FILE_NAME;
|
@@ -9328,11 +9360,11 @@ var me = /*#__PURE__*/function (_Je) {
|
|
9328
9360
|
})));
|
9329
9361
|
case 1:
|
9330
9362
|
case "end":
|
9331
|
-
return
|
9363
|
+
return _context92.stop();
|
9332
9364
|
}
|
9333
|
-
},
|
9365
|
+
}, _callee92);
|
9334
9366
|
}));
|
9335
|
-
function addMultipleFiles(
|
9367
|
+
function addMultipleFiles(_x173) {
|
9336
9368
|
return _addMultipleFiles.apply(this, arguments);
|
9337
9369
|
}
|
9338
9370
|
return addMultipleFiles;
|
@@ -9364,12 +9396,12 @@ var me = /*#__PURE__*/function (_Je) {
|
|
9364
9396
|
}
|
9365
9397
|
}]);
|
9366
9398
|
return me;
|
9367
|
-
}(
|
9399
|
+
}($e);
|
9368
9400
|
var Mt = /*#__PURE__*/function () {
|
9369
|
-
function
|
9370
|
-
_classCallCheck(this,
|
9401
|
+
function K() {
|
9402
|
+
_classCallCheck(this, K);
|
9371
9403
|
}
|
9372
|
-
_createClass(
|
9404
|
+
_createClass(K, null, [{
|
9373
9405
|
key: "adjustInputPadding",
|
9374
9406
|
value: function adjustInputPadding(e, t) {
|
9375
9407
|
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");
|
@@ -9377,7 +9409,7 @@ var Mt = /*#__PURE__*/function () {
|
|
9377
9409
|
}, {
|
9378
9410
|
key: "adjustForOutsideButton",
|
9379
9411
|
value: function adjustForOutsideButton(e, t, i) {
|
9380
|
-
i["outside-right"].length === 0 && i["outside-left"].length > 0 ? (e[0].classList.add(
|
9412
|
+
i["outside-right"].length === 0 && i["outside-left"].length > 0 ? (e[0].classList.add(K.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS), t.classList.add(K.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS)) : i["outside-left"].length === 0 && i["outside-right"].length > 0 && (e[3].classList.add(K.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS), t.classList.add(K.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS));
|
9381
9413
|
}
|
9382
9414
|
// when submit is the only button
|
9383
9415
|
// when submit button is outside by itself - we increase the height for a better look
|
@@ -9385,10 +9417,10 @@ var Mt = /*#__PURE__*/function () {
|
|
9385
9417
|
key: "adjustOutsideSubmit",
|
9386
9418
|
value: function adjustOutsideSubmit(e, t, i) {
|
9387
9419
|
if (!(i["inside-left"].length > 0 || i["inside-right"].length > 0)) {
|
9388
|
-
if (i["outside-right"].length === 0 && i["outside-left"].length > 0) return e[0].classList.add(
|
9420
|
+
if (i["outside-right"].length === 0 && i["outside-left"].length > 0) return e[0].classList.add(K.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), t.classList.add(K.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), i["outside-left"].map(function (n) {
|
9389
9421
|
return n.button.elementRef.classList.add("submit-button-enlarged");
|
9390
9422
|
});
|
9391
|
-
if (i["outside-left"].length === 0 && i["outside-right"].length > 0) return e[3].classList.add(
|
9423
|
+
if (i["outside-left"].length === 0 && i["outside-right"].length > 0) return e[3].classList.add(K.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), t.classList.add(K.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), i["outside-right"].map(function (n) {
|
9392
9424
|
return n.button.elementRef.classList.add("submit-button-enlarged");
|
9393
9425
|
});
|
9394
9426
|
}
|
@@ -9396,10 +9428,10 @@ var Mt = /*#__PURE__*/function () {
|
|
9396
9428
|
}, {
|
9397
9429
|
key: "set",
|
9398
9430
|
value: function set(e, t, i, n) {
|
9399
|
-
!!
|
9431
|
+
!!K.adjustOutsideSubmit(t, i, n) || K.adjustForOutsideButton(t, i, n), K.adjustInputPadding(e, n);
|
9400
9432
|
}
|
9401
9433
|
}]);
|
9402
|
-
return
|
9434
|
+
return K;
|
9403
9435
|
}();
|
9404
9436
|
Mt.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS = "text-input-container-left-adjustment";
|
9405
9437
|
Mt.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS = "text-input-container-right-adjustment";
|
@@ -9454,7 +9486,7 @@ var j = /*#__PURE__*/function () {
|
|
9454
9486
|
}, {
|
9455
9487
|
key: "createElement",
|
9456
9488
|
value: function createElement(e, t) {
|
9457
|
-
return t ? j.createTextElement(e) :
|
9489
|
+
return t ? j.createTextElement(e) : H.createSVGElement(e);
|
9458
9490
|
}
|
9459
9491
|
}, {
|
9460
9492
|
key: "createCustomElement",
|
@@ -9600,14 +9632,14 @@ var yt = /*#__PURE__*/function () {
|
|
9600
9632
|
}]);
|
9601
9633
|
return yt;
|
9602
9634
|
}();
|
9603
|
-
var
|
9604
|
-
function
|
9605
|
-
_classCallCheck(this,
|
9635
|
+
var Te = /*#__PURE__*/function () {
|
9636
|
+
function Te() {
|
9637
|
+
_classCallCheck(this, Te);
|
9606
9638
|
}
|
9607
|
-
_createClass(
|
9639
|
+
_createClass(Te, null, [{
|
9608
9640
|
key: "addItemEvents",
|
9609
9641
|
value: function addItemEvents(e, t, i, n) {
|
9610
|
-
|
9642
|
+
Ae.add(t, n), t.addEventListener("click", function () {
|
9611
9643
|
i.click();
|
9612
9644
|
}), t.addEventListener("mouseenter", function (r) {
|
9613
9645
|
e.highlightedItem = r.target;
|
@@ -9631,7 +9663,7 @@ var _e = /*#__PURE__*/function () {
|
|
9631
9663
|
key: "populateItem",
|
9632
9664
|
value: function populateItem(e, t, i, n) {
|
9633
9665
|
var r = e.children[0];
|
9634
|
-
r.classList.contains("text-button") ? t.appendChild(
|
9666
|
+
r.classList.contains("text-button") ? t.appendChild(Te.createItemText(r.textContent, n == null ? void 0 : n.text)) : (t.appendChild(Te.createItemIcon(e, n == null ? void 0 : n.iconContainer)), t.appendChild(Te.createItemText(i, n == null ? void 0 : n.text)));
|
9635
9667
|
}
|
9636
9668
|
// prettier-ignore
|
9637
9669
|
}, {
|
@@ -9641,16 +9673,16 @@ var _e = /*#__PURE__*/function () {
|
|
9641
9673
|
var n = t.elementRef,
|
9642
9674
|
r = t.dropupText,
|
9643
9675
|
o = document.createElement("div");
|
9644
|
-
Object.assign(o.style, (l = i == null ? void 0 : i.item) == null ? void 0 : l["default"]),
|
9676
|
+
Object.assign(o.style, (l = i == null ? void 0 : i.item) == null ? void 0 : l["default"]), Te.populateItem(n, o, r, i), o.classList.add("dropup-menu-item");
|
9645
9677
|
var a = T.processStateful((i == null ? void 0 : i.item) || {}, {
|
9646
9678
|
backgroundColor: "#f3f3f3"
|
9647
9679
|
}, {
|
9648
9680
|
backgroundColor: "#ebebeb"
|
9649
9681
|
});
|
9650
|
-
return
|
9682
|
+
return Te.addItemEvents(e, o, n, a), o;
|
9651
9683
|
}
|
9652
9684
|
}]);
|
9653
|
-
return
|
9685
|
+
return Te;
|
9654
9686
|
}();
|
9655
9687
|
var nn = /*#__PURE__*/function () {
|
9656
9688
|
function nn(e, t) {
|
@@ -9679,7 +9711,7 @@ var nn = /*#__PURE__*/function () {
|
|
9679
9711
|
}, {
|
9680
9712
|
key: "addItem",
|
9681
9713
|
value: function addItem(e) {
|
9682
|
-
var t =
|
9714
|
+
var t = Te.createItem(this, e, this._styles);
|
9683
9715
|
this.elementRef.appendChild(t);
|
9684
9716
|
}
|
9685
9717
|
// prettier-ignore
|
@@ -9763,7 +9795,7 @@ var Ye = /*#__PURE__*/function (_Tt) {
|
|
9763
9795
|
}, {
|
9764
9796
|
key: "createSVGIconElement",
|
9765
9797
|
value: function createSVGIconElement() {
|
9766
|
-
return
|
9798
|
+
return H.createSVGElement($o);
|
9767
9799
|
}
|
9768
9800
|
}, {
|
9769
9801
|
key: "createButtonContainer",
|
@@ -10001,7 +10033,7 @@ var ue = /*#__PURE__*/function () {
|
|
10001
10033
|
key: "createAnyFileAttachment",
|
10002
10034
|
value: function createAnyFileAttachment(e) {
|
10003
10035
|
var t = document.createElement("div");
|
10004
|
-
t.classList.add("border-bound-attachment"),
|
10036
|
+
t.classList.add("border-bound-attachment"), be.IS_SAFARI && t.classList.add("border-bound-attachment-safari");
|
10005
10037
|
var i = document.createElement("div");
|
10006
10038
|
i.classList.add("any-file-attachment-text");
|
10007
10039
|
var n = document.createElement("div");
|
@@ -10019,19 +10051,19 @@ var ue = /*#__PURE__*/function () {
|
|
10019
10051
|
var ta = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <title>play</title>\n <path d=\"M5.92 24.096q0 1.088 0.928 1.728 0.512 0.288 1.088 0.288 0.448 0 0.896-0.224l16.16-8.064q0.48-0.256 0.8-0.736t0.288-1.088-0.288-1.056-0.8-0.736l-16.16-8.064q-0.448-0.224-0.896-0.224-0.544 0-1.088 0.288-0.928 0.608-0.928 1.728v16.16z\"></path>\n</svg>",
|
10020
10052
|
_n = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n<title>stop</title>\n<path d=\"M5.92 24.096q0 0.832 0.576 1.408t1.44 0.608h16.128q0.832 0 1.44-0.608t0.576-1.408v-16.16q0-0.832-0.576-1.44t-1.44-0.576h-16.128q-0.832 0-1.44 0.576t-0.576 1.44v16.16z\"></path>\n</svg>",
|
10021
10053
|
fs = /*#__PURE__*/function (_ue) {
|
10022
|
-
_inherits(
|
10023
|
-
var _super38 = _createSuper(
|
10054
|
+
_inherits(Me, _ue);
|
10055
|
+
var _super38 = _createSuper(Me);
|
10024
10056
|
// prettier-ignore
|
10025
|
-
function
|
10026
|
-
_classCallCheck(this,
|
10057
|
+
function Me(e, t, i, n) {
|
10058
|
+
_classCallCheck(this, Me);
|
10027
10059
|
return _super38.call(this, e, t, i, n);
|
10028
10060
|
}
|
10029
|
-
_createClass(
|
10061
|
+
_createClass(Me, [{
|
10030
10062
|
key: "createTimer",
|
10031
10063
|
value: function createTimer(e, t) {
|
10032
10064
|
var _this44 = this;
|
10033
10065
|
var i = 0;
|
10034
|
-
var n = t !== void 0 && t <
|
10066
|
+
var n = t !== void 0 && t < Me.TIMER_LIMIT_S ? t : Me.TIMER_LIMIT_S;
|
10035
10067
|
return setInterval(function () {
|
10036
10068
|
var a;
|
10037
10069
|
i += 1, i === n && ((a = _this44.stopPlaceholderCallback) == null || a.call(_this44), _this44.clearTimer()), i === 600 && e.classList.add("audio-placeholder-text-4-digits");
|
@@ -10043,12 +10075,12 @@ var ta = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
10043
10075
|
}, {
|
10044
10076
|
key: "createPlaceholderAudioAttachment",
|
10045
10077
|
value: function createPlaceholderAudioAttachment(e) {
|
10046
|
-
var t =
|
10078
|
+
var t = Me.createAudioContainer(),
|
10047
10079
|
i = document.createElement("div");
|
10048
10080
|
i.classList.add("audio-placeholder-text-3-digits");
|
10049
10081
|
var n = document.createElement("div");
|
10050
10082
|
n.classList.add("file-attachment-text-container", "audio-placeholder-text-3-digits-container"), n.appendChild(i);
|
10051
|
-
var r =
|
10083
|
+
var r = H.createSVGElement(_n);
|
10052
10084
|
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;
|
10053
10085
|
}
|
10054
10086
|
}, {
|
@@ -10080,7 +10112,7 @@ var ta = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
10080
10112
|
key: "completePlaceholderAttachment",
|
10081
10113
|
value: function completePlaceholderAttachment(e, t) {
|
10082
10114
|
var i = this._activePlaceholderAttachment;
|
10083
|
-
i && (i.file = e,
|
10115
|
+
i && (i.file = e, Me.addAudioElements(i.attachmentContainerElement.children[0], t), i.removeButton = this.createRemoveAttachmentButton(i), i.attachmentContainerElement.appendChild(i.removeButton), this._activePlaceholderAttachment = void 0, this.clearTimer());
|
10084
10116
|
}
|
10085
10117
|
}, {
|
10086
10118
|
key: "removePlaceholderAttachment",
|
@@ -10096,17 +10128,17 @@ var ta = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
10096
10128
|
key: "createAudioContainer",
|
10097
10129
|
value: function createAudioContainer() {
|
10098
10130
|
var e = document.createElement("div");
|
10099
|
-
return e.classList.add("border-bound-attachment", "audio-attachment-icon-container"),
|
10131
|
+
return e.classList.add("border-bound-attachment", "audio-attachment-icon-container"), be.IS_SAFARI && e.classList.add("border-bound-attachment-safari"), e;
|
10100
10132
|
}
|
10101
10133
|
}, {
|
10102
10134
|
key: "addAudioElements",
|
10103
10135
|
value: function addAudioElements(e, t) {
|
10104
|
-
var i = e.parentElement ?
|
10136
|
+
var i = e.parentElement ? Z.cloneElement(e) : e,
|
10105
10137
|
n = document.createElement("audio");
|
10106
10138
|
n.src = t;
|
10107
|
-
var r =
|
10139
|
+
var r = H.createSVGElement(ta);
|
10108
10140
|
r.classList.add("attachment-icon", "play-icon");
|
10109
|
-
var o =
|
10141
|
+
var o = H.createSVGElement(_n);
|
10110
10142
|
o.classList.add("attachment-icon", "stop-icon"), i.replaceChildren(r), n.onplay = function () {
|
10111
10143
|
i.replaceChildren(o);
|
10112
10144
|
}, n.onpause = function () {
|
@@ -10120,8 +10152,8 @@ var ta = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
10120
10152
|
}, {
|
10121
10153
|
key: "createAudioAttachment",
|
10122
10154
|
value: function createAudioAttachment(e) {
|
10123
|
-
var t =
|
10124
|
-
return
|
10155
|
+
var t = Me.createAudioContainer();
|
10156
|
+
return Me.addAudioElements(t, e), t;
|
10125
10157
|
}
|
10126
10158
|
}, {
|
10127
10159
|
key: "stopAttachmentPlayback",
|
@@ -10130,7 +10162,7 @@ var ta = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
10130
10162
|
(n = (i = (t = e.children[0]) == null ? void 0 : t.children) == null ? void 0 : i[0]) != null && n.classList.contains("stop-icon") && e.children[0].click();
|
10131
10163
|
}
|
10132
10164
|
}]);
|
10133
|
-
return
|
10165
|
+
return Me;
|
10134
10166
|
}(ue);
|
10135
10167
|
fs.TIMER_LIMIT_S = 5999;
|
10136
10168
|
var qi = fs;
|
@@ -10184,33 +10216,33 @@ var Ct = /*#__PURE__*/function () {
|
|
10184
10216
|
}, {
|
10185
10217
|
key: "completePlaceholders",
|
10186
10218
|
value: function () {
|
10187
|
-
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
10188
|
-
return _regeneratorRuntime().wrap(function
|
10189
|
-
while (1) switch (
|
10219
|
+
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee94() {
|
10220
|
+
return _regeneratorRuntime().wrap(function _callee94$(_context94) {
|
10221
|
+
while (1) switch (_context94.prev = _context94.next) {
|
10190
10222
|
case 0:
|
10191
|
-
|
10223
|
+
_context94.next = 2;
|
10192
10224
|
return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
|
10193
|
-
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
10225
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee93(e) {
|
10194
10226
|
var t;
|
10195
|
-
return _regeneratorRuntime().wrap(function
|
10196
|
-
while (1) switch (
|
10227
|
+
return _regeneratorRuntime().wrap(function _callee93$(_context93) {
|
10228
|
+
while (1) switch (_context93.prev = _context93.next) {
|
10197
10229
|
case 0:
|
10198
|
-
return
|
10230
|
+
return _context93.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
|
10199
10231
|
case 1:
|
10200
10232
|
case "end":
|
10201
|
-
return
|
10233
|
+
return _context93.stop();
|
10202
10234
|
}
|
10203
|
-
},
|
10235
|
+
}, _callee93);
|
10204
10236
|
}));
|
10205
|
-
return function (
|
10237
|
+
return function (_x174) {
|
10206
10238
|
return _ref12.apply(this, arguments);
|
10207
10239
|
};
|
10208
10240
|
}()));
|
10209
10241
|
case 2:
|
10210
10242
|
case "end":
|
10211
|
-
return
|
10243
|
+
return _context94.stop();
|
10212
10244
|
}
|
10213
|
-
},
|
10245
|
+
}, _callee94, this);
|
10214
10246
|
}));
|
10215
10247
|
function completePlaceholders() {
|
10216
10248
|
return _completePlaceholders.apply(this, arguments);
|
@@ -10344,7 +10376,7 @@ var ms = /*#__PURE__*/function () {
|
|
10344
10376
|
value: function createSVGButton(e) {
|
10345
10377
|
var t = document.createElement("div");
|
10346
10378
|
t.classList.add("modal-button", "modal-svg-button");
|
10347
|
-
var i =
|
10379
|
+
var i = H.createSVGElement(e);
|
10348
10380
|
return i.classList.add("modal-svg-button-icon"), t.appendChild(i), t;
|
10349
10381
|
}
|
10350
10382
|
}, {
|
@@ -10424,7 +10456,7 @@ var pt = /*#__PURE__*/function (_Tt2) {
|
|
10424
10456
|
}, {
|
10425
10457
|
key: "createSVGIconElement",
|
10426
10458
|
value: function createSVGIconElement(e, t) {
|
10427
|
-
var i =
|
10459
|
+
var i = H.createSVGElement(t);
|
10428
10460
|
return i.id = e, i;
|
10429
10461
|
}
|
10430
10462
|
}]);
|
@@ -10484,11 +10516,11 @@ var de = /*#__PURE__*/function () {
|
|
10484
10516
|
}]);
|
10485
10517
|
return de;
|
10486
10518
|
}();
|
10487
|
-
var
|
10488
|
-
function
|
10489
|
-
_classCallCheck(this,
|
10519
|
+
var Ce = /*#__PURE__*/function () {
|
10520
|
+
function Ce() {
|
10521
|
+
_classCallCheck(this, Ce);
|
10490
10522
|
}
|
10491
|
-
_createClass(
|
10523
|
+
_createClass(Ce, null, [{
|
10492
10524
|
key: "validate",
|
10493
10525
|
value:
|
10494
10526
|
// prettier-ignore
|
@@ -10500,26 +10532,26 @@ var Me = /*#__PURE__*/function () {
|
|
10500
10532
|
}, {
|
10501
10533
|
key: "useValidationFunc",
|
10502
10534
|
value: function () {
|
10503
|
-
var _useValidationFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
10535
|
+
var _useValidationFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee95(e, t, i, n) {
|
10504
10536
|
var r, o, a, l;
|
10505
|
-
return _regeneratorRuntime().wrap(function
|
10506
|
-
while (1) switch (
|
10537
|
+
return _regeneratorRuntime().wrap(function _callee95$(_context95) {
|
10538
|
+
while (1) switch (_context95.prev = _context95.next) {
|
10507
10539
|
case 0:
|
10508
10540
|
r = t.inputElementRef, o = r.classList.contains("text-input-placeholder") ? "" : r.textContent;
|
10509
|
-
|
10541
|
+
_context95.next = 3;
|
10510
10542
|
return i.completePlaceholders();
|
10511
10543
|
case 3:
|
10512
10544
|
a = i.getAllFileData(), l = a == null ? void 0 : a.map(function (c) {
|
10513
10545
|
return c.file;
|
10514
10546
|
});
|
10515
|
-
return
|
10547
|
+
return _context95.abrupt("return", Ce.validate(e, n, o, l));
|
10516
10548
|
case 5:
|
10517
10549
|
case "end":
|
10518
|
-
return
|
10550
|
+
return _context95.stop();
|
10519
10551
|
}
|
10520
|
-
},
|
10552
|
+
}, _callee95);
|
10521
10553
|
}));
|
10522
|
-
function useValidationFunc(
|
10554
|
+
function useValidationFunc(_x175, _x176, _x177, _x178) {
|
10523
10555
|
return _useValidationFunc.apply(this, arguments);
|
10524
10556
|
}
|
10525
10557
|
return useValidationFunc;
|
@@ -10527,22 +10559,22 @@ var Me = /*#__PURE__*/function () {
|
|
10527
10559
|
}, {
|
10528
10560
|
key: "useValidationFuncProgrammatic",
|
10529
10561
|
value: function () {
|
10530
|
-
var _useValidationFuncProgrammatic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
10562
|
+
var _useValidationFuncProgrammatic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee96(e, t, i) {
|
10531
10563
|
var r, n;
|
10532
|
-
return _regeneratorRuntime().wrap(function
|
10533
|
-
while (1) switch (
|
10564
|
+
return _regeneratorRuntime().wrap(function _callee96$(_context96) {
|
10565
|
+
while (1) switch (_context96.prev = _context96.next) {
|
10534
10566
|
case 0:
|
10535
10567
|
n = (r = t.files) == null ? void 0 : r.map(function (o) {
|
10536
10568
|
return o.file;
|
10537
10569
|
});
|
10538
|
-
return
|
10570
|
+
return _context96.abrupt("return", Ce.validate(e, i, t.text, n, !0));
|
10539
10571
|
case 2:
|
10540
10572
|
case "end":
|
10541
|
-
return
|
10573
|
+
return _context96.stop();
|
10542
10574
|
}
|
10543
|
-
},
|
10575
|
+
}, _callee96);
|
10544
10576
|
}));
|
10545
|
-
function useValidationFuncProgrammatic(
|
10577
|
+
function useValidationFuncProgrammatic(_x179, _x180, _x181) {
|
10546
10578
|
return _useValidationFuncProgrammatic.apply(this, arguments);
|
10547
10579
|
}
|
10548
10580
|
return useValidationFuncProgrammatic;
|
@@ -10550,40 +10582,40 @@ var Me = /*#__PURE__*/function () {
|
|
10550
10582
|
}, {
|
10551
10583
|
key: "validateWebsocket",
|
10552
10584
|
value: function validateWebsocket(e, t) {
|
10553
|
-
return e.websocket &&
|
10585
|
+
return e.websocket && !Y.canSendMessage(e.websocket) ? (t.changeToDisabledIcon(), !1) : !0;
|
10554
10586
|
}
|
10555
10587
|
// prettier-ignore
|
10556
10588
|
}, {
|
10557
10589
|
key: "attach",
|
10558
10590
|
value: function attach(e, t, i, n, r) {
|
10559
|
-
var o = e.validateInput ||
|
10591
|
+
var o = e.validateInput || Le.processValidateInput(e);
|
10560
10592
|
e._validationHandler = /*#__PURE__*/function () {
|
10561
|
-
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
10593
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee97(a) {
|
10562
10594
|
var l;
|
10563
|
-
return _regeneratorRuntime().wrap(function
|
10564
|
-
while (1) switch (
|
10595
|
+
return _regeneratorRuntime().wrap(function _callee97$(_context97) {
|
10596
|
+
while (1) switch (_context97.prev = _context97.next) {
|
10565
10597
|
case 0:
|
10566
|
-
if (!(r.status.loadingActive || r.status.requestInProgress || t.isSubmitProgrammaticallyDisabled === !0 || !
|
10567
|
-
|
10598
|
+
if (!(r.status.loadingActive || r.status.requestInProgress || t.isSubmitProgrammaticallyDisabled === !0 || !Ce.validateWebsocket(t, r))) {
|
10599
|
+
_context97.next = 2;
|
10568
10600
|
break;
|
10569
10601
|
}
|
10570
|
-
return
|
10602
|
+
return _context97.abrupt("return", !1);
|
10571
10603
|
case 2:
|
10572
10604
|
l = o || t.canSendMessage;
|
10573
|
-
return
|
10605
|
+
return _context97.abrupt("return", l ? a ? Ce.useValidationFuncProgrammatic(l, a, r) : Ce.useValidationFunc(l, i, n, r) : null);
|
10574
10606
|
case 4:
|
10575
10607
|
case "end":
|
10576
|
-
return
|
10608
|
+
return _context97.stop();
|
10577
10609
|
}
|
10578
|
-
},
|
10610
|
+
}, _callee97);
|
10579
10611
|
}));
|
10580
|
-
return function (
|
10612
|
+
return function (_x182) {
|
10581
10613
|
return _ref13.apply(this, arguments);
|
10582
10614
|
};
|
10583
10615
|
}();
|
10584
10616
|
}
|
10585
10617
|
}]);
|
10586
|
-
return
|
10618
|
+
return Ce;
|
10587
10619
|
}();
|
10588
10620
|
var na = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg height=\"1.4em\" width=\"1.4em\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n\t viewBox=\"0 0 490.9 490.9\" xml:space=\"preserve\">\n\t<g>\n\t\t<g>\n\t\t\t<path d=\"M245.5,322.9c53,0,96.2-43.2,96.2-96.2V96.2c0-53-43.2-96.2-96.2-96.2s-96.2,43.2-96.2,96.2v130.5\n\t\t\t\tC149.3,279.8,192.5,322.9,245.5,322.9z M173.8,96.2c0-39.5,32.2-71.7,71.7-71.7s71.7,32.2,71.7,71.7v130.5\n\t\t\t\tc0,39.5-32.2,71.7-71.7,71.7s-71.7-32.2-71.7-71.7V96.2z\"/>\n\t\t\t<path d=\"M94.4,214.5c-6.8,0-12.3,5.5-12.3,12.3c0,85.9,66.7,156.6,151.1,162.8v76.7h-63.9c-6.8,0-12.3,5.5-12.3,12.3\n\t\t\t\ts5.5,12.3,12.3,12.3h152.3c6.8,0,12.3-5.5,12.3-12.3s-5.5-12.3-12.3-12.3h-63.9v-76.7c84.4-6.3,151.1-76.9,151.1-162.8\n\t\t\t\tc0-6.8-5.5-12.3-12.3-12.3s-12.3,5.5-12.3,12.3c0,76.6-62.3,138.9-138.9,138.9s-138.9-62.3-138.9-138.9\n\t\t\t\tC106.6,220,101.2,214.5,94.4,214.5z\"/>\n\t\t</g>\n\t</g>\n</svg>\n";
|
10589
10621
|
var xt = /*#__PURE__*/function (_Tt3) {
|
@@ -10657,7 +10689,7 @@ var xt = /*#__PURE__*/function (_Tt3) {
|
|
10657
10689
|
}, {
|
10658
10690
|
key: "createSVGIconElement",
|
10659
10691
|
value: function createSVGIconElement() {
|
10660
|
-
var e =
|
10692
|
+
var e = H.createSVGElement(na);
|
10661
10693
|
return e.id = "microphone-icon", e;
|
10662
10694
|
}
|
10663
10695
|
}]);
|
@@ -10667,26 +10699,26 @@ var gs = {},
|
|
10667
10699
|
li = {},
|
10668
10700
|
ci = {},
|
10669
10701
|
At = {},
|
10670
|
-
|
10671
|
-
Object.defineProperty(
|
10702
|
+
Fe = {};
|
10703
|
+
Object.defineProperty(Fe, "__esModule", {
|
10672
10704
|
value: !0
|
10673
10705
|
});
|
10674
|
-
|
10675
|
-
var
|
10676
|
-
function
|
10677
|
-
_classCallCheck(this,
|
10706
|
+
Fe.Text = void 0;
|
10707
|
+
var xe = /*#__PURE__*/function () {
|
10708
|
+
function xe() {
|
10709
|
+
_classCallCheck(this, xe);
|
10678
10710
|
}
|
10679
|
-
_createClass(
|
10711
|
+
_createClass(xe, null, [{
|
10680
10712
|
key: "capitalize",
|
10681
10713
|
value: function capitalize(e) {
|
10682
|
-
return e.replace(
|
10714
|
+
return e.replace(xe.FIRST_CHAR_REGEX, function (t) {
|
10683
10715
|
return t.toUpperCase();
|
10684
10716
|
});
|
10685
10717
|
}
|
10686
10718
|
}, {
|
10687
10719
|
key: "lineBreak",
|
10688
10720
|
value: function lineBreak(e) {
|
10689
|
-
return e.replace(
|
10721
|
+
return e.replace(xe.DOUBLE_LINE, "<p></p>").replace(xe.ONE_LINE, "<br>");
|
10690
10722
|
}
|
10691
10723
|
}, {
|
10692
10724
|
key: "isCharDefined",
|
@@ -10700,17 +10732,17 @@ var ye = /*#__PURE__*/function () {
|
|
10700
10732
|
return e.split(/(\W+)/);
|
10701
10733
|
}
|
10702
10734
|
}]);
|
10703
|
-
return
|
10735
|
+
return xe;
|
10704
10736
|
}();
|
10705
|
-
|
10706
|
-
|
10707
|
-
|
10708
|
-
|
10737
|
+
Fe.Text = xe;
|
10738
|
+
xe.FIRST_CHAR_REGEX = /\S/;
|
10739
|
+
xe.DOUBLE_LINE = /\n\n/g;
|
10740
|
+
xe.ONE_LINE = /\n/g;
|
10709
10741
|
Object.defineProperty(At, "__esModule", {
|
10710
10742
|
value: !0
|
10711
10743
|
});
|
10712
10744
|
At.Translate = void 0;
|
10713
|
-
var sa =
|
10745
|
+
var sa = Fe;
|
10714
10746
|
var ra = /*#__PURE__*/function () {
|
10715
10747
|
function ra() {
|
10716
10748
|
_classCallCheck(this, ra);
|
@@ -10786,11 +10818,11 @@ Object.defineProperty(di, "__esModule", {
|
|
10786
10818
|
value: !0
|
10787
10819
|
});
|
10788
10820
|
di.EventListeners = void 0;
|
10789
|
-
var
|
10790
|
-
function
|
10791
|
-
_classCallCheck(this,
|
10821
|
+
var $ = /*#__PURE__*/function () {
|
10822
|
+
function $() {
|
10823
|
+
_classCallCheck(this, $);
|
10792
10824
|
}
|
10793
|
-
_createClass(
|
10825
|
+
_createClass($, null, [{
|
10794
10826
|
key: "getElementIfFocusedOnAvailable",
|
10795
10827
|
value: function getElementIfFocusedOnAvailable(e, t) {
|
10796
10828
|
return Array.isArray(e) ? e.find(function (i) {
|
@@ -10801,14 +10833,14 @@ var J = /*#__PURE__*/function () {
|
|
10801
10833
|
key: "keyDownWindow",
|
10802
10834
|
value: function keyDownWindow(e) {
|
10803
10835
|
var _this51 = this;
|
10804
|
-
e.element &&
|
10805
|
-
|
10836
|
+
e.element && $.getElementIfFocusedOnAvailable(e.element, document.activeElement) && ($.KEY_DOWN_TIMEOUT !== null && clearTimeout($.KEY_DOWN_TIMEOUT), $.KEY_DOWN_TIMEOUT = setTimeout(function () {
|
10837
|
+
$.KEY_DOWN_TIMEOUT = null, _this51.resetRecording(e);
|
10806
10838
|
}, 500));
|
10807
10839
|
}
|
10808
10840
|
}, {
|
10809
10841
|
key: "mouseDownWindow",
|
10810
10842
|
value: function mouseDownWindow(e, t) {
|
10811
|
-
this.mouseDownElement =
|
10843
|
+
this.mouseDownElement = $.getElementIfFocusedOnAvailable(e, t.target);
|
10812
10844
|
}
|
10813
10845
|
}, {
|
10814
10846
|
key: "mouseUpWindow",
|
@@ -10819,7 +10851,7 @@ var J = /*#__PURE__*/function () {
|
|
10819
10851
|
key: "add",
|
10820
10852
|
value: function add(e, t) {
|
10821
10853
|
var i = (t == null ? void 0 : t.insertInCursorLocation) === void 0 || (t == null ? void 0 : t.insertInCursorLocation);
|
10822
|
-
t != null && t.element && i && (e.mouseDownEvent =
|
10854
|
+
t != null && t.element && i && (e.mouseDownEvent = $.mouseDownWindow.bind(e, t.element), document.addEventListener("mousedown", e.mouseDownEvent), e.mouseUpEvent = $.mouseUpWindow.bind(e, t), document.addEventListener("mouseup", e.mouseUpEvent), e.keyDownEvent = $.keyDownWindow.bind(e, t), document.addEventListener("keydown", e.keyDownEvent));
|
10823
10855
|
}
|
10824
10856
|
}, {
|
10825
10857
|
key: "remove",
|
@@ -10827,10 +10859,10 @@ var J = /*#__PURE__*/function () {
|
|
10827
10859
|
document.removeEventListener("mousedown", e.mouseDownEvent), document.removeEventListener("mouseup", e.mouseUpEvent), document.removeEventListener("keydown", e.keyDownEvent);
|
10828
10860
|
}
|
10829
10861
|
}]);
|
10830
|
-
return
|
10862
|
+
return $;
|
10831
10863
|
}();
|
10832
|
-
di.EventListeners =
|
10833
|
-
|
10864
|
+
di.EventListeners = $;
|
10865
|
+
$.KEY_DOWN_TIMEOUT = null;
|
10834
10866
|
var ui = {};
|
10835
10867
|
Object.defineProperty(ui, "__esModule", {
|
10836
10868
|
value: !0
|
@@ -10895,11 +10927,11 @@ var sn = /*#__PURE__*/function () {
|
|
10895
10927
|
return sn;
|
10896
10928
|
}();
|
10897
10929
|
Lt.AutoScroll = sn;
|
10898
|
-
var
|
10899
|
-
Object.defineProperty(
|
10930
|
+
var Be = {};
|
10931
|
+
Object.defineProperty(Be, "__esModule", {
|
10900
10932
|
value: !0
|
10901
10933
|
});
|
10902
|
-
|
10934
|
+
Be.Elements = void 0;
|
10903
10935
|
var la = /*#__PURE__*/function () {
|
10904
10936
|
function la() {
|
10905
10937
|
_classCallCheck(this, la);
|
@@ -10947,12 +10979,12 @@ var la = /*#__PURE__*/function () {
|
|
10947
10979
|
}]);
|
10948
10980
|
return la;
|
10949
10981
|
}();
|
10950
|
-
|
10951
|
-
var
|
10952
|
-
Object.defineProperty(
|
10982
|
+
Be.Elements = la;
|
10983
|
+
var ze = {};
|
10984
|
+
Object.defineProperty(ze, "__esModule", {
|
10953
10985
|
value: !0
|
10954
10986
|
});
|
10955
|
-
|
10987
|
+
ze.Cursor = void 0;
|
10956
10988
|
var ft = /*#__PURE__*/function () {
|
10957
10989
|
function ft() {
|
10958
10990
|
_classCallCheck(this, ft);
|
@@ -11034,21 +11066,21 @@ var ft = /*#__PURE__*/function () {
|
|
11034
11066
|
}]);
|
11035
11067
|
return ft;
|
11036
11068
|
}();
|
11037
|
-
|
11069
|
+
ze.Cursor = ft;
|
11038
11070
|
Object.defineProperty(It, "__esModule", {
|
11039
11071
|
value: !0
|
11040
11072
|
});
|
11041
11073
|
It.CommandUtils = void 0;
|
11042
11074
|
var Tn = Lt,
|
11043
|
-
ca =
|
11075
|
+
ca = Be,
|
11044
11076
|
da = nt,
|
11045
|
-
Cn =
|
11046
|
-
An =
|
11047
|
-
var
|
11048
|
-
function
|
11049
|
-
_classCallCheck(this,
|
11077
|
+
Cn = ze,
|
11078
|
+
An = Fe;
|
11079
|
+
var J = /*#__PURE__*/function () {
|
11080
|
+
function J() {
|
11081
|
+
_classCallCheck(this, J);
|
11050
11082
|
}
|
11051
|
-
_createClass(
|
11083
|
+
_createClass(J, null, [{
|
11052
11084
|
key: "processCommand",
|
11053
11085
|
value: function processCommand(e, t) {
|
11054
11086
|
return (!t || !t.caseSensitive) && (e = e.toLowerCase()), (t == null ? void 0 : t.substrings) === !1 ? An.Text.breakupIntoWordsArr(e) : e;
|
@@ -11059,7 +11091,7 @@ var K = /*#__PURE__*/function () {
|
|
11059
11091
|
var t;
|
11060
11092
|
return ((t = e.settings) === null || t === void 0 ? void 0 : t.caseSensitive) === !0 ? e : Object.keys(e).reduce(function (n, r) {
|
11061
11093
|
var o = e[r];
|
11062
|
-
return n[r] = typeof o == "string" ?
|
11094
|
+
return n[r] = typeof o == "string" ? J.processCommand(o, e.settings) : o, n;
|
11063
11095
|
}, {});
|
11064
11096
|
}
|
11065
11097
|
}, {
|
@@ -11077,7 +11109,7 @@ var K = /*#__PURE__*/function () {
|
|
11077
11109
|
}, {
|
11078
11110
|
key: "setText",
|
11079
11111
|
value: function setText(e, t, i, n) {
|
11080
|
-
|
11112
|
+
J.toggleCommandModeOff(e), ca.Elements.isPrimitiveElement(n) ? (n.value = i, e.isTargetInShadow || Cn.Cursor.setOffsetForPrimitive(n, i.length, !0), da.Browser.IS_SAFARI() && e.autoScroll && Tn.AutoScroll.scrollSafariPrimitiveToEnd(n)) : (n.textContent = i, e.isTargetInShadow || Cn.Cursor.focusEndOfGeneric(n), setTimeout(function () {
|
11081
11113
|
return Tn.AutoScroll.scrollGeneric(e, n);
|
11082
11114
|
})), e.resetRecording(t);
|
11083
11115
|
}
|
@@ -11107,46 +11139,46 @@ var K = /*#__PURE__*/function () {
|
|
11107
11139
|
if (!c || !n || !i) return;
|
11108
11140
|
var d = ((o = c.settings) === null || o === void 0 ? void 0 : o.caseSensitive) === !0 ? t : t.toLowerCase(),
|
11109
11141
|
u = An.Text.breakupIntoWordsArr(d),
|
11110
|
-
p = ((a = c.settings) === null || a === void 0 ? void 0 : a.substrings) === !1 ?
|
11142
|
+
p = ((a = c.settings) === null || a === void 0 ? void 0 : a.substrings) === !1 ? J.checkIfMatchesWord : J.checkIfMatchesSubstring;
|
11111
11143
|
if (c.commandMode && p(c.commandMode, d, u)) return e.setInterimColorToFinal(), setTimeout(function () {
|
11112
|
-
return
|
11144
|
+
return J.toggleCommandModeOn(e);
|
11113
11145
|
}), {
|
11114
11146
|
doNotProcessTranscription: !1
|
11115
11147
|
};
|
11116
11148
|
if (!(c.commandMode && !e.isWaitingForCommand)) {
|
11117
|
-
if (c.stop && p(c.stop, d, u)) return
|
11149
|
+
if (c.stop && p(c.stop, d, u)) return J.toggleCommandModeOff(e), setTimeout(function () {
|
11118
11150
|
return e.stop();
|
11119
11151
|
}), {
|
11120
11152
|
doNotProcessTranscription: !1
|
11121
11153
|
};
|
11122
|
-
if (c.pause && p(c.pause, d, u)) return
|
11154
|
+
if (c.pause && p(c.pause, d, u)) return J.toggleCommandModeOff(e), e.setInterimColorToFinal(), setTimeout(function () {
|
11123
11155
|
var h;
|
11124
11156
|
e.isPaused = !0, (h = e.onPauseTrigger) === null || h === void 0 || h.call(e, !0);
|
11125
11157
|
}), {
|
11126
11158
|
doNotProcessTranscription: !1
|
11127
11159
|
};
|
11128
|
-
if (c.resume && p(c.resume, d, u)) return e.isPaused = !1, (l = e.onPauseTrigger) === null || l === void 0 || l.call(e, !1),
|
11160
|
+
if (c.resume && p(c.resume, d, u)) return e.isPaused = !1, (l = e.onPauseTrigger) === null || l === void 0 || l.call(e, !1), J.toggleCommandModeOff(e), e.resetRecording(i), {
|
11129
11161
|
doNotProcessTranscription: !0
|
11130
11162
|
};
|
11131
|
-
if (c.reset && p(c.reset, d, u)) return r !== void 0 &&
|
11163
|
+
if (c.reset && p(c.reset, d, u)) return r !== void 0 && J.setText(e, i, r, n), {
|
11132
11164
|
doNotProcessTranscription: !0
|
11133
11165
|
};
|
11134
|
-
if (c.removeAllText && p(c.removeAllText, d, u)) return
|
11166
|
+
if (c.removeAllText && p(c.removeAllText, d, u)) return J.setText(e, i, "", n), {
|
11135
11167
|
doNotProcessTranscription: !0
|
11136
11168
|
};
|
11137
11169
|
}
|
11138
11170
|
}
|
11139
11171
|
}]);
|
11140
|
-
return
|
11172
|
+
return J;
|
11141
11173
|
}();
|
11142
|
-
It.CommandUtils =
|
11174
|
+
It.CommandUtils = J;
|
11143
11175
|
var hi = {};
|
11144
11176
|
Object.defineProperty(hi, "__esModule", {
|
11145
11177
|
value: !0
|
11146
11178
|
});
|
11147
11179
|
hi.Highlight = void 0;
|
11148
|
-
var ua =
|
11149
|
-
st =
|
11180
|
+
var ua = Be,
|
11181
|
+
st = ze;
|
11150
11182
|
var Jt = /*#__PURE__*/function () {
|
11151
11183
|
function Jt() {
|
11152
11184
|
_classCallCheck(this, Jt);
|
@@ -11202,9 +11234,9 @@ Object.defineProperty(pi, "__esModule", {
|
|
11202
11234
|
value: !0
|
11203
11235
|
});
|
11204
11236
|
pi.Padding = void 0;
|
11205
|
-
var ha =
|
11206
|
-
kn =
|
11207
|
-
|
11237
|
+
var ha = Be,
|
11238
|
+
kn = ze,
|
11239
|
+
qe = Fe;
|
11208
11240
|
var $t = /*#__PURE__*/function () {
|
11209
11241
|
function $t() {
|
11210
11242
|
_classCallCheck(this, $t);
|
@@ -11217,11 +11249,11 @@ var $t = /*#__PURE__*/function () {
|
|
11217
11249
|
r = t.value[n - 1],
|
11218
11250
|
o = t.selectionEnd === null ? n : t.selectionEnd,
|
11219
11251
|
a = t.value[o];
|
11220
|
-
|
11252
|
+
qe.Text.isCharDefined(r) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), qe.Text.isCharDefined(a) && (e.endPadding = " ", e.numberOfSpacesAfterNewText = 1), e.isCursorAtEnd = t.value.length === o;
|
11221
11253
|
return;
|
11222
11254
|
}
|
11223
11255
|
var i = t.value[t.value.length - 1];
|
11224
|
-
|
11256
|
+
qe.Text.isCharDefined(i) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), e.isCursorAtEnd = !0;
|
11225
11257
|
}
|
11226
11258
|
}, {
|
11227
11259
|
key: "setStateForGenericElement",
|
@@ -11234,12 +11266,12 @@ var $t = /*#__PURE__*/function () {
|
|
11234
11266
|
c = (i = t.textContent) === null || i === void 0 ? void 0 : i[l - 1],
|
11235
11267
|
d = kn.Cursor.getGenericElementCursorOffset(t, a, !1),
|
11236
11268
|
u = (n = t.textContent) === null || n === void 0 ? void 0 : n[d];
|
11237
|
-
|
11269
|
+
qe.Text.isCharDefined(c) && (e.startPadding = " "), qe.Text.isCharDefined(u) && (e.endPadding = " "), e.isCursorAtEnd = ((r = t.textContent) === null || r === void 0 ? void 0 : r.length) === d;
|
11238
11270
|
return;
|
11239
11271
|
}
|
11240
11272
|
}
|
11241
11273
|
var o = t.innerText.charAt(t.innerText.length - 1);
|
11242
|
-
|
11274
|
+
qe.Text.isCharDefined(o) && (e.startPadding = " "), e.isCursorAtEnd = !0;
|
11243
11275
|
}
|
11244
11276
|
}, {
|
11245
11277
|
key: "setState",
|
@@ -11273,11 +11305,11 @@ var In = di,
|
|
11273
11305
|
Ln = It,
|
11274
11306
|
Pt = Lt,
|
11275
11307
|
Ai = hi,
|
11276
|
-
ie =
|
11308
|
+
ie = Be,
|
11277
11309
|
ki = pi,
|
11278
11310
|
Rn = nt,
|
11279
|
-
Nn =
|
11280
|
-
Ii =
|
11311
|
+
Nn = ze,
|
11312
|
+
Ii = Fe;
|
11281
11313
|
var fa = /*#__PURE__*/function () {
|
11282
11314
|
function fa() {
|
11283
11315
|
_classCallCheck(this, fa);
|
@@ -11533,26 +11565,26 @@ var Zt = /*#__PURE__*/function () {
|
|
11533
11565
|
}, {
|
11534
11566
|
key: "getNewSpeechConfig",
|
11535
11567
|
value: function () {
|
11536
|
-
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11537
|
-
return _regeneratorRuntime().wrap(function
|
11538
|
-
while (1) switch (
|
11568
|
+
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee98(e, t) {
|
11569
|
+
return _regeneratorRuntime().wrap(function _callee98$(_context98) {
|
11570
|
+
while (1) switch (_context98.prev = _context98.next) {
|
11539
11571
|
case 0:
|
11540
11572
|
if (!t.region) {
|
11541
|
-
|
11573
|
+
_context98.next = 2;
|
11542
11574
|
break;
|
11543
11575
|
}
|
11544
|
-
return
|
11576
|
+
return _context98.abrupt("return", t.subscriptionKey ? e.fromSubscription(t.subscriptionKey.trim(), t.region.trim()) : t.token ? e.fromAuthorizationToken(t.token.trim(), t.region.trim()) : t.retrieveToken ? t.retrieveToken().then(function (i) {
|
11545
11577
|
return t.region ? e.fromAuthorizationToken((i == null ? void 0 : i.trim()) || "", t.region.trim()) : null;
|
11546
11578
|
})["catch"](function (i) {
|
11547
11579
|
return console.error(i), null;
|
11548
11580
|
}) : null);
|
11549
11581
|
case 2:
|
11550
11582
|
case "end":
|
11551
|
-
return
|
11583
|
+
return _context98.stop();
|
11552
11584
|
}
|
11553
|
-
},
|
11585
|
+
}, _callee98);
|
11554
11586
|
}));
|
11555
|
-
function getNewSpeechConfig(
|
11587
|
+
function getNewSpeechConfig(_x183, _x184) {
|
11556
11588
|
return _getNewSpeechConfig.apply(this, arguments);
|
11557
11589
|
}
|
11558
11590
|
return getNewSpeechConfig;
|
@@ -11565,23 +11597,23 @@ var Zt = /*#__PURE__*/function () {
|
|
11565
11597
|
}, {
|
11566
11598
|
key: "get",
|
11567
11599
|
value: function () {
|
11568
|
-
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11600
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee99(e, t) {
|
11569
11601
|
var i;
|
11570
|
-
return _regeneratorRuntime().wrap(function
|
11571
|
-
while (1) switch (
|
11602
|
+
return _regeneratorRuntime().wrap(function _callee99$(_context99) {
|
11603
|
+
while (1) switch (_context99.prev = _context99.next) {
|
11572
11604
|
case 0:
|
11573
|
-
|
11605
|
+
_context99.next = 2;
|
11574
11606
|
return Zt.getNewSpeechConfig(e, t);
|
11575
11607
|
case 2:
|
11576
|
-
i =
|
11577
|
-
return
|
11608
|
+
i = _context99.sent;
|
11609
|
+
return _context99.abrupt("return", (i && Zt.process(i, t), i));
|
11578
11610
|
case 4:
|
11579
11611
|
case "end":
|
11580
|
-
return
|
11612
|
+
return _context99.stop();
|
11581
11613
|
}
|
11582
|
-
},
|
11614
|
+
}, _callee99);
|
11583
11615
|
}));
|
11584
|
-
function get(
|
11616
|
+
function get(_x185, _x186) {
|
11585
11617
|
return _get.apply(this, arguments);
|
11586
11618
|
}
|
11587
11619
|
return get;
|
@@ -11671,28 +11703,28 @@ var Xt = /*#__PURE__*/function (_ya$Speech) {
|
|
11671
11703
|
}, {
|
11672
11704
|
key: "startAsync",
|
11673
11705
|
value: function () {
|
11674
|
-
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11706
|
+
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee100(e) {
|
11675
11707
|
var t;
|
11676
|
-
return _regeneratorRuntime().wrap(function
|
11677
|
-
while (1) switch (
|
11708
|
+
return _regeneratorRuntime().wrap(function _callee100$(_context100) {
|
11709
|
+
while (1) switch (_context100.prev = _context100.next) {
|
11678
11710
|
case 0:
|
11679
|
-
|
11680
|
-
if (!
|
11681
|
-
|
11711
|
+
_context100.t0 = this.validate(e);
|
11712
|
+
if (!_context100.t0) {
|
11713
|
+
_context100.next = 6;
|
11682
11714
|
break;
|
11683
11715
|
}
|
11684
|
-
|
11716
|
+
_context100.next = 4;
|
11685
11717
|
return this.instantiateService(e);
|
11686
11718
|
case 4:
|
11687
11719
|
this._translations = e == null ? void 0 : e.translations;
|
11688
11720
|
(t = this._service) === null || t === void 0 || t.startContinuousRecognitionAsync(function () {}, this.error);
|
11689
11721
|
case 6:
|
11690
11722
|
case "end":
|
11691
|
-
return
|
11723
|
+
return _context100.stop();
|
11692
11724
|
}
|
11693
|
-
},
|
11725
|
+
}, _callee100, this);
|
11694
11726
|
}));
|
11695
|
-
function startAsync(
|
11727
|
+
function startAsync(_x187) {
|
11696
11728
|
return _startAsync.apply(this, arguments);
|
11697
11729
|
}
|
11698
11730
|
return startAsync;
|
@@ -11705,28 +11737,28 @@ var Xt = /*#__PURE__*/function (_ya$Speech) {
|
|
11705
11737
|
}, {
|
11706
11738
|
key: "instantiateService",
|
11707
11739
|
value: function () {
|
11708
|
-
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11740
|
+
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee101(e) {
|
11709
11741
|
var t, i, n, r;
|
11710
|
-
return _regeneratorRuntime().wrap(function
|
11711
|
-
while (1) switch (
|
11742
|
+
return _regeneratorRuntime().wrap(function _callee101$(_context101) {
|
11743
|
+
while (1) switch (_context101.prev = _context101.next) {
|
11712
11744
|
case 0:
|
11713
11745
|
t = Xt.getAPI();
|
11714
11746
|
i = t.AudioConfig.fromDefaultMicrophoneInput();
|
11715
|
-
|
11747
|
+
_context101.next = 4;
|
11716
11748
|
return jn.AzureSpeechConfig.get(t.SpeechConfig, e);
|
11717
11749
|
case 4:
|
11718
|
-
n =
|
11750
|
+
n = _context101.sent;
|
11719
11751
|
if (n) {
|
11720
11752
|
r = new t.SpeechRecognizer(n, i);
|
11721
11753
|
this.setEvents(r), this._service = r, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
|
11722
11754
|
} else this.error("Unable to contact Azure server");
|
11723
11755
|
case 6:
|
11724
11756
|
case "end":
|
11725
|
-
return
|
11757
|
+
return _context101.stop();
|
11726
11758
|
}
|
11727
|
-
},
|
11759
|
+
}, _callee101, this);
|
11728
11760
|
}));
|
11729
|
-
function instantiateService(
|
11761
|
+
function instantiateService(_x188) {
|
11730
11762
|
return _instantiateService.apply(this, arguments);
|
11731
11763
|
}
|
11732
11764
|
return instantiateService;
|
@@ -11830,21 +11862,21 @@ var Bn = li,
|
|
11830
11862
|
xa = It,
|
11831
11863
|
ee = fi,
|
11832
11864
|
Ea = mi;
|
11833
|
-
var
|
11834
|
-
function
|
11835
|
-
_classCallCheck(this,
|
11865
|
+
var Je = /*#__PURE__*/function () {
|
11866
|
+
function Je() {
|
11867
|
+
_classCallCheck(this, Je);
|
11836
11868
|
}
|
11837
|
-
_createClass(
|
11869
|
+
_createClass(Je, null, [{
|
11838
11870
|
key: "toggle",
|
11839
11871
|
value: function toggle(e, t) {
|
11840
11872
|
var i, n;
|
11841
11873
|
var r = e.toLocaleLowerCase().trim();
|
11842
|
-
!((i = ee.GlobalState.service) === null || i === void 0) && i.recognizing ? this.stop() : r === "webspeech" ?
|
11874
|
+
!((i = ee.GlobalState.service) === null || i === void 0) && i.recognizing ? this.stop() : r === "webspeech" ? Je.startWebSpeech(t) : r === "azure" ? Je.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'"));
|
11843
11875
|
}
|
11844
11876
|
}, {
|
11845
11877
|
key: "startWebSpeech",
|
11846
11878
|
value: function startWebSpeech(e) {
|
11847
|
-
|
11879
|
+
Je.stop() || (ee.GlobalState.service = new Bn.WebSpeech(), ee.GlobalState.service.start(e));
|
11848
11880
|
}
|
11849
11881
|
}, {
|
11850
11882
|
key: "isWebSpeechSupported",
|
@@ -11855,7 +11887,7 @@ var Ke = /*#__PURE__*/function () {
|
|
11855
11887
|
key: "startAzure",
|
11856
11888
|
value: function startAzure(e) {
|
11857
11889
|
var t;
|
11858
|
-
|
11890
|
+
Je.stop() || !((t = ee.GlobalState.service) === null || t === void 0) && t.cannotBeStopped || (ee.GlobalState.service = new Ea.Azure(), ee.GlobalState.service.start(e));
|
11859
11891
|
}
|
11860
11892
|
}, {
|
11861
11893
|
key: "stop",
|
@@ -11869,9 +11901,9 @@ var Ke = /*#__PURE__*/function () {
|
|
11869
11901
|
ee.GlobalState.service && xa.CommandUtils.toggleCommandModeOff(ee.GlobalState.service);
|
11870
11902
|
}
|
11871
11903
|
}]);
|
11872
|
-
return
|
11904
|
+
return Je;
|
11873
11905
|
}();
|
11874
|
-
var Ni = gs["default"] =
|
11906
|
+
var Ni = gs["default"] = Je;
|
11875
11907
|
var Qt = /*#__PURE__*/function (_xt) {
|
11876
11908
|
_inherits(Qt, _xt);
|
11877
11909
|
var _super43 = _createSuper(Qt);
|
@@ -12065,11 +12097,11 @@ var B = /*#__PURE__*/function () {
|
|
12065
12097
|
}]);
|
12066
12098
|
return B;
|
12067
12099
|
}();
|
12068
|
-
var
|
12069
|
-
function
|
12070
|
-
_classCallCheck(this,
|
12100
|
+
var ke = /*#__PURE__*/function () {
|
12101
|
+
function ke() {
|
12102
|
+
_classCallCheck(this, ke);
|
12071
12103
|
}
|
12072
|
-
_createClass(
|
12104
|
+
_createClass(ke, null, [{
|
12073
12105
|
key: "resetSubmit",
|
12074
12106
|
value: function resetSubmit(e, t) {
|
12075
12107
|
t ? e.unsetCustomStateStyles(["loading", "submit"]) : e.unsetCustomStateStyles(["stop", "loading", "submit"]), e.reapplyStateStyle("submit");
|
@@ -12085,16 +12117,16 @@ var Ce = /*#__PURE__*/function () {
|
|
12085
12117
|
}, {
|
12086
12118
|
key: "setUpDisabledButton",
|
12087
12119
|
value: function setUpDisabledButton(e) {
|
12088
|
-
B.setPropertyValueIfDoesNotExist(e, ["submit", "container", "default", "backgroundColor"], ""), B.setPropertyValueIfDoesNotExist(e, ["disabled", "container", "default", "backgroundColor"], "unset"), B.setPropertyValueIfDoesNotExist(e.submit, ["svg", "styles", "default", "filter"], ""), B.setPropertyValueIfDoesNotExist(e.disabled, ["svg", "styles", "default", "filter"], "brightness(0) saturate(100%) invert(70%) sepia(0%) saturate(5564%) hue-rotate(207deg) brightness(100%) contrast(97%)"),
|
12120
|
+
B.setPropertyValueIfDoesNotExist(e, ["submit", "container", "default", "backgroundColor"], ""), B.setPropertyValueIfDoesNotExist(e, ["disabled", "container", "default", "backgroundColor"], "unset"), B.setPropertyValueIfDoesNotExist(e.submit, ["svg", "styles", "default", "filter"], ""), B.setPropertyValueIfDoesNotExist(e.disabled, ["svg", "styles", "default", "filter"], "brightness(0) saturate(100%) invert(70%) sepia(0%) saturate(5564%) hue-rotate(207deg) brightness(100%) contrast(97%)"), ke.overwriteDefaultStyleWithSubmit(e, "disabled");
|
12089
12121
|
}
|
12090
12122
|
}, {
|
12091
12123
|
key: "process",
|
12092
12124
|
value: function process(e) {
|
12093
12125
|
var t = JSON.parse(JSON.stringify(e || {}));
|
12094
|
-
return
|
12126
|
+
return ke.overwriteDefaultStyleWithSubmit(t, "loading"), ke.overwriteDefaultStyleWithSubmit(t, "stop"), e != null && e.alwaysEnabled || ke.setUpDisabledButton(t), t;
|
12095
12127
|
}
|
12096
12128
|
}]);
|
12097
|
-
return
|
12129
|
+
return ke;
|
12098
12130
|
}();
|
12099
12131
|
var Ei = /*#__PURE__*/function (_Tt4) {
|
12100
12132
|
_inherits(k, _Tt4);
|
@@ -12103,7 +12135,7 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12103
12135
|
function k(e, t, i, n, r) {
|
12104
12136
|
var _this60;
|
12105
12137
|
_classCallCheck(this, k);
|
12106
|
-
var o =
|
12138
|
+
var o = ke.process(e.submitButtonStyles);
|
12107
12139
|
_this60 = _super45.call(this, k.createButtonContainerElement(), o == null ? void 0 : o.position, o), _this60._isSVGLoadingIconOverriden = !1, _this60.status = {
|
12108
12140
|
requestInProgress: !1,
|
12109
12141
|
loadingActive: !1
|
@@ -12168,12 +12200,12 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12168
12200
|
}, {
|
12169
12201
|
key: "submitFromInput",
|
12170
12202
|
value: function () {
|
12171
|
-
var _submitFromInput = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12203
|
+
var _submitFromInput = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee102() {
|
12172
12204
|
var t, e, _i18;
|
12173
|
-
return _regeneratorRuntime().wrap(function
|
12174
|
-
while (1) switch (
|
12205
|
+
return _regeneratorRuntime().wrap(function _callee102$(_context102) {
|
12206
|
+
while (1) switch (_context102.prev = _context102.next) {
|
12175
12207
|
case 0:
|
12176
|
-
|
12208
|
+
_context102.next = 2;
|
12177
12209
|
return this._fileAttachments.completePlaceholders();
|
12178
12210
|
case 2:
|
12179
12211
|
e = this._fileAttachments.getAllFileData();
|
@@ -12189,9 +12221,9 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12189
12221
|
}
|
12190
12222
|
case 4:
|
12191
12223
|
case "end":
|
12192
|
-
return
|
12224
|
+
return _context102.stop();
|
12193
12225
|
}
|
12194
|
-
},
|
12226
|
+
}, _callee102, this);
|
12195
12227
|
}));
|
12196
12228
|
function submitFromInput() {
|
12197
12229
|
return _submitFromInput.apply(this, arguments);
|
@@ -12201,13 +12233,13 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12201
12233
|
}, {
|
12202
12234
|
key: "programmaticSubmit",
|
12203
12235
|
value: function () {
|
12204
|
-
var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12236
|
+
var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee103(e) {
|
12205
12237
|
var _this61 = this;
|
12206
12238
|
var t;
|
12207
|
-
return _regeneratorRuntime().wrap(function
|
12208
|
-
while (1) switch (
|
12239
|
+
return _regeneratorRuntime().wrap(function _callee103$(_context103) {
|
12240
|
+
while (1) switch (_context103.prev = _context103.next) {
|
12209
12241
|
case 0:
|
12210
|
-
typeof e == "string" && (e =
|
12242
|
+
typeof e == "string" && (e = Le.processSubmitUserMessage(e));
|
12211
12243
|
t = {
|
12212
12244
|
text: e.text
|
12213
12245
|
};
|
@@ -12221,11 +12253,11 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12221
12253
|
});
|
12222
12254
|
case 3:
|
12223
12255
|
case "end":
|
12224
|
-
return
|
12256
|
+
return _context103.stop();
|
12225
12257
|
}
|
12226
|
-
},
|
12258
|
+
}, _callee103);
|
12227
12259
|
}));
|
12228
|
-
function programmaticSubmit(
|
12260
|
+
function programmaticSubmit(_x189) {
|
12229
12261
|
return _programmaticSubmit.apply(this, arguments);
|
12230
12262
|
}
|
12231
12263
|
return programmaticSubmit;
|
@@ -12233,31 +12265,31 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12233
12265
|
}, {
|
12234
12266
|
key: "attemptSubmit",
|
12235
12267
|
value: function () {
|
12236
|
-
var _attemptSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12268
|
+
var _attemptSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee104(e) {
|
12237
12269
|
var t,
|
12238
12270
|
r,
|
12239
12271
|
o,
|
12240
12272
|
a,
|
12241
12273
|
i,
|
12242
12274
|
n,
|
12243
|
-
|
12244
|
-
return _regeneratorRuntime().wrap(function
|
12245
|
-
while (1) switch (
|
12275
|
+
_args104 = arguments;
|
12276
|
+
return _regeneratorRuntime().wrap(function _callee104$(_context104) {
|
12277
|
+
while (1) switch (_context104.prev = _context104.next) {
|
12246
12278
|
case 0:
|
12247
|
-
t =
|
12248
|
-
|
12279
|
+
t = _args104.length > 1 && _args104[1] !== undefined ? _args104[1] : !1;
|
12280
|
+
_context104.next = 3;
|
12249
12281
|
return (r = this._validationHandler) == null ? void 0 : r.call(this, t ? e : void 0);
|
12250
12282
|
case 3:
|
12251
|
-
|
12252
|
-
|
12253
|
-
if (!(
|
12254
|
-
|
12283
|
+
_context104.t0 = _context104.sent;
|
12284
|
+
_context104.t1 = !1;
|
12285
|
+
if (!(_context104.t0 === _context104.t1)) {
|
12286
|
+
_context104.next = 7;
|
12255
12287
|
break;
|
12256
12288
|
}
|
12257
|
-
return
|
12289
|
+
return _context104.abrupt("return");
|
12258
12290
|
case 7:
|
12259
12291
|
this.changeToLoadingIcon();
|
12260
|
-
|
12292
|
+
_context104.next = 10;
|
12261
12293
|
return this.addNewMessage(e);
|
12262
12294
|
case 10:
|
12263
12295
|
this._serviceIO.isWebModel() || this._messages.addLoadingMessage();
|
@@ -12268,17 +12300,17 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12268
12300
|
text: e.text === "" ? void 0 : e.text,
|
12269
12301
|
files: i
|
12270
12302
|
};
|
12271
|
-
|
12303
|
+
_context104.next = 15;
|
12272
12304
|
return this._serviceIO.callAPI(n, this._messages);
|
12273
12305
|
case 15:
|
12274
12306
|
(a = this._fileAttachments) == null || a.removeAllFiles();
|
12275
12307
|
case 16:
|
12276
12308
|
case "end":
|
12277
|
-
return
|
12309
|
+
return _context104.stop();
|
12278
12310
|
}
|
12279
|
-
},
|
12311
|
+
}, _callee104, this);
|
12280
12312
|
}));
|
12281
|
-
function attemptSubmit(
|
12313
|
+
function attemptSubmit(_x190) {
|
12282
12314
|
return _attemptSubmit.apply(this, arguments);
|
12283
12315
|
}
|
12284
12316
|
return attemptSubmit;
|
@@ -12286,35 +12318,35 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12286
12318
|
}, {
|
12287
12319
|
key: "addNewMessage",
|
12288
12320
|
value: function () {
|
12289
|
-
var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12321
|
+
var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee105(_ref14) {
|
12290
12322
|
var e, t, i;
|
12291
|
-
return _regeneratorRuntime().wrap(function
|
12292
|
-
while (1) switch (
|
12323
|
+
return _regeneratorRuntime().wrap(function _callee105$(_context105) {
|
12324
|
+
while (1) switch (_context105.prev = _context105.next) {
|
12293
12325
|
case 0:
|
12294
12326
|
e = _ref14.text, t = _ref14.files;
|
12295
12327
|
i = {
|
12296
12328
|
role: v.USER_ROLE
|
12297
12329
|
};
|
12298
12330
|
e && (i.text = e);
|
12299
|
-
|
12300
|
-
if (!
|
12301
|
-
|
12331
|
+
_context105.t0 = t;
|
12332
|
+
if (!_context105.t0) {
|
12333
|
+
_context105.next = 8;
|
12302
12334
|
break;
|
12303
12335
|
}
|
12304
|
-
|
12336
|
+
_context105.next = 7;
|
12305
12337
|
return this._messages.addMultipleFiles(t);
|
12306
12338
|
case 7:
|
12307
|
-
i.files =
|
12339
|
+
i.files = _context105.sent;
|
12308
12340
|
case 8:
|
12309
12341
|
this._serviceIO.sessionId && (i._sessionId = this._serviceIO.sessionId);
|
12310
12342
|
Object.keys(i).length > 0 && this._messages.addNewMessage(i);
|
12311
12343
|
case 10:
|
12312
12344
|
case "end":
|
12313
|
-
return
|
12345
|
+
return _context105.stop();
|
12314
12346
|
}
|
12315
|
-
},
|
12347
|
+
}, _callee105, this);
|
12316
12348
|
}));
|
12317
|
-
function addNewMessage(
|
12349
|
+
function addNewMessage(_x191) {
|
12318
12350
|
return _addNewMessage.apply(this, arguments);
|
12319
12351
|
}
|
12320
12352
|
return addNewMessage;
|
@@ -12340,7 +12372,7 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12340
12372
|
}, {
|
12341
12373
|
key: "changeToSubmitIcon",
|
12342
12374
|
value: function changeToSubmitIcon() {
|
12343
|
-
this.elementRef.classList.contains(k.SUBMIT_CLASS) || (this.elementRef.classList.remove(k.LOADING_CLASS, k.DISABLED_CLASS), this.elementRef.classList.add(k.SUBMIT_CLASS), this.elementRef.replaceChildren(this._innerElements.submit),
|
12375
|
+
this.elementRef.classList.contains(k.SUBMIT_CLASS) || (this.elementRef.classList.remove(k.LOADING_CLASS, k.DISABLED_CLASS), this.elementRef.classList.add(k.SUBMIT_CLASS), this.elementRef.replaceChildren(this._innerElements.submit), ke.resetSubmit(this, this.status.loadingActive), this.elementRef.onclick = this.submitFromInput.bind(this));
|
12344
12376
|
}
|
12345
12377
|
// called every time when user triggers an input via ValidationHandler - hence use class to check if not already present
|
12346
12378
|
}, {
|
@@ -12364,7 +12396,7 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12364
12396
|
}, {
|
12365
12397
|
key: "createSubmitIconElement",
|
12366
12398
|
value: function createSubmitIconElement() {
|
12367
|
-
var e =
|
12399
|
+
var e = H.createSVGElement(wa);
|
12368
12400
|
return e.id = "submit-icon", e;
|
12369
12401
|
}
|
12370
12402
|
}, {
|
@@ -12401,7 +12433,7 @@ var rn = /*#__PURE__*/function (_ct) {
|
|
12401
12433
|
var _this62$addButtonsAnd = _this62.addButtonsAndTheirEvents(t),
|
12402
12434
|
r = _this62$addButtonsAnd.captureButton,
|
12403
12435
|
o = _this62$addButtonsAnd.submitButton;
|
12404
|
-
_this62._captureButton = r, _this62._submitButton = o, _this62._captureIcon = _this62._captureButton.children[0], _this62._refreshIcon =
|
12436
|
+
_this62._captureButton = r, _this62._submitButton = o, _this62._captureIcon = _this62._captureButton.children[0], _this62._refreshIcon = H.createSVGElement(Ma), _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;
|
12405
12437
|
return _this62;
|
12406
12438
|
}
|
12407
12439
|
_createClass(rn, [{
|
@@ -12547,7 +12579,7 @@ var ei = /*#__PURE__*/function (_Tt5) {
|
|
12547
12579
|
}, {
|
12548
12580
|
key: "createSVGIconElement",
|
12549
12581
|
value: function createSVGIconElement() {
|
12550
|
-
var e =
|
12582
|
+
var e = H.createSVGElement(ka);
|
12551
12583
|
return e.id = "camera-icon", e;
|
12552
12584
|
}
|
12553
12585
|
}]);
|
@@ -12564,7 +12596,7 @@ var mt = /*#__PURE__*/function () {
|
|
12564
12596
|
button: new Qt(e, r, t.addNewErrorMessage.bind(t))
|
12565
12597
|
});
|
12566
12598
|
var l = new _a(e, r.inputElementRef, t, i, a);
|
12567
|
-
r.submit = l.submitFromInput.bind(l),
|
12599
|
+
r.submit = l.submitFromInput.bind(l), Ce.attach(e, i, r, a, l), e.submitUserMessage = l.programmaticSubmit.bind(l), o.submit = {
|
12568
12600
|
button: l
|
12569
12601
|
}, mt.addElements(this.elementRef, r, o, n, a, e.dropupStyles);
|
12570
12602
|
}
|
@@ -12620,7 +12652,7 @@ var mt = /*#__PURE__*/function () {
|
|
12620
12652
|
}, {
|
12621
12653
|
key: "addElements",
|
12622
12654
|
value: function addElements(e, t, i, n, r, o) {
|
12623
|
-
|
12655
|
+
Z.addElements(e, t.elementRef);
|
12624
12656
|
var a = tt.create(),
|
12625
12657
|
l = F.addButtons(a, i, n, o);
|
12626
12658
|
Jo.set(t.inputElementRef, a, r.elementRef, l), tt.add(e, a);
|
@@ -12638,9 +12670,9 @@ var on = /*#__PURE__*/function () {
|
|
12638
12670
|
var n = document.createElement("div");
|
12639
12671
|
n.id = "chat-view";
|
12640
12672
|
var r = new me(e, t, i);
|
12641
|
-
t.websocket &&
|
12673
|
+
t.websocket && Y.createConnection(t, r);
|
12642
12674
|
var o = new mt(e, r, t, n);
|
12643
|
-
return
|
12675
|
+
return Z.addElements(n, r.elementRef, o.elementRef), n;
|
12644
12676
|
}
|
12645
12677
|
}, {
|
12646
12678
|
key: "render",
|
@@ -12689,7 +12721,7 @@ var b = /*#__PURE__*/function (_yo) {
|
|
12689
12721
|
key: "onRender",
|
12690
12722
|
value: function onRender() {
|
12691
12723
|
var _this$_childElement;
|
12692
|
-
(!this._activeService || this._activeService.demo) && (this._activeService = Go.create(this)), this.auxiliaryStyle && !this._auxiliaryStyleApplied && (wi.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), wi.applyDefaultStyleToComponent(this.style, this.chatStyle),
|
12724
|
+
(!this._activeService || this._activeService.demo) && (this._activeService = Go.create(this)), this.auxiliaryStyle && !this._auxiliaryStyleApplied && (wi.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), wi.applyDefaultStyleToComponent(this.style, this.chatStyle), Le.checkForContainerStyles(this, this._elementRef), this._activeService.key && this._activeService.validateConfigKey ? Ft.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : !(this._activeService instanceof U) || 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 U && P.render(this._elementRef, this.changeToChatView.bind(this), this._activeService), this._hasBeenRendered = !0, Bt.onRender(this);
|
12693
12725
|
}
|
12694
12726
|
}, {
|
12695
12727
|
key: "disconnectedCallback",
|