deep-chat-dev 9.0.268 → 9.0.269
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 +8873 -8832
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.js +373 -365
- package/dist/types/openAIRealtime.d.ts +1 -1
- package/dist/types/streamWrapper.d.ts +0 -1
- package/dist/types/streamWrapper.d.ts.map +1 -1
- package/dist/views/chat/messages/stream/messageStream.d.ts +6 -2
- package/dist/views/chat/messages/stream/messageStream.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/deepChat.js
CHANGED
@@ -31,11 +31,11 @@ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o =
|
|
31
31
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
32
32
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
33
33
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
34
|
-
var
|
35
|
-
function
|
36
|
-
_classCallCheck(this,
|
34
|
+
var Hn = /*#__PURE__*/function () {
|
35
|
+
function Hn() {
|
36
|
+
_classCallCheck(this, Hn);
|
37
37
|
}
|
38
|
-
return _createClass(
|
38
|
+
return _createClass(Hn, null, [{
|
39
39
|
key: "render",
|
40
40
|
value: function render(e, t) {
|
41
41
|
var i = document.createElement("div");
|
@@ -64,7 +64,7 @@ var gi = /*#__PURE__*/function () {
|
|
64
64
|
var s = gi.createElements(),
|
65
65
|
r = {
|
66
66
|
onSuccess: t,
|
67
|
-
onFail:
|
67
|
+
onFail: Hn.render.bind(this, e, "Your 'key' has failed authentication"),
|
68
68
|
onLoad: gi.onLoad.bind(this, s)
|
69
69
|
};
|
70
70
|
i.key && i.verifyKey(i.key, r), e.replaceChildren(s);
|
@@ -206,12 +206,12 @@ ht.DEFAULT_COMPONENT_STYLE = {
|
|
206
206
|
// this is also causing the chat to squeeze when there is no space
|
207
207
|
overflow: "hidden"
|
208
208
|
};
|
209
|
-
var
|
210
|
-
var
|
211
|
-
_classCallCheck(this,
|
209
|
+
var qt = ht;
|
210
|
+
var Wt = /*#__PURE__*/_createClass(function Wt() {
|
211
|
+
_classCallCheck(this, Wt);
|
212
212
|
});
|
213
|
-
|
214
|
-
var Be =
|
213
|
+
Wt.IS_SAFARI = /^((?!chrome|android).)*safari/i.test(navigator.userAgent), Wt.IS_CHROMIUM = window.chrome, Wt.IS_MOBILE = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
|
214
|
+
var Be = Wt;
|
215
215
|
var U = /* @__PURE__ */function (n) {
|
216
216
|
return n.ESCAPE = "Escape", n.ENTER = "Enter", n.TAB = "Tab", n.ARROW_UP = "ArrowUp", n.ARROW_DOWN = "ArrowDown", n.ARROW_RIGHT = "ArrowRight", n.ARROW_LEFT = "ArrowLeft", n.BACKSPACE = "Backspace", n.DELETE = "Delete", n.META = "Meta", n.CONTROL = "Control", n;
|
217
217
|
}(U || {});
|
@@ -253,11 +253,11 @@ var Xe = /*#__PURE__*/function () {
|
|
253
253
|
}();
|
254
254
|
Xe.PERMITTED_KEYS = /* @__PURE__ */new Set([U.BACKSPACE, U.DELETE, U.ARROW_RIGHT, U.ARROW_LEFT, U.ARROW_DOWN, U.ARROW_UP, U.META, U.CONTROL, U.ENTER]);
|
255
255
|
var Qi = Xe;
|
256
|
-
var
|
257
|
-
function
|
258
|
-
_classCallCheck(this,
|
256
|
+
var qn = /*#__PURE__*/function () {
|
257
|
+
function qn() {
|
258
|
+
_classCallCheck(this, qn);
|
259
259
|
}
|
260
|
-
return _createClass(
|
260
|
+
return _createClass(qn, null, [{
|
261
261
|
key: "sanitizePastedTextContent",
|
262
262
|
value: function sanitizePastedTextContent(e) {
|
263
263
|
var i, s;
|
@@ -310,7 +310,7 @@ var Ye = /*#__PURE__*/function () {
|
|
310
310
|
(t = this._config.styles) != null && t.focus && (e.onfocus = function () {
|
311
311
|
var s;
|
312
312
|
return Object.assign(_this2.elementRef.style, (s = _this2._config.styles) == null ? void 0 : s.focus);
|
313
|
-
}, e.onblur = this.onBlur.bind(this, this._config.styles.focus, (i = this._config.styles) == null ? void 0 : i.container)), e.addEventListener("keydown", this.onKeydown.bind(this)), e.addEventListener("input", this.onInput.bind(this)), e.addEventListener("paste",
|
313
|
+
}, e.onblur = this.onBlur.bind(this, this._config.styles.focus, (i = this._config.styles) == null ? void 0 : i.container)), e.addEventListener("keydown", this.onKeydown.bind(this)), e.addEventListener("input", this.onInput.bind(this)), e.addEventListener("paste", qn.sanitizePastedTextContent), e.addEventListener("compositionstart", function () {
|
314
314
|
return _this2._isComposing = !0;
|
315
315
|
}), e.addEventListener("compositionend", function () {
|
316
316
|
return _this2._isComposing = !1;
|
@@ -647,7 +647,7 @@ var ce = /*#__PURE__*/function () {
|
|
647
647
|
}]);
|
648
648
|
}();
|
649
649
|
ce.DEFAULT_FILE_NAME = "file", ce.FILE_BUBBLE_CLASS = "file-message";
|
650
|
-
var
|
650
|
+
var q = ce;
|
651
651
|
var te = /*#__PURE__*/function () {
|
652
652
|
function te() {
|
653
653
|
_classCallCheck(this, te);
|
@@ -743,11 +743,11 @@ var te = /*#__PURE__*/function () {
|
|
743
743
|
}
|
744
744
|
}]);
|
745
745
|
}();
|
746
|
-
var
|
747
|
-
function
|
748
|
-
_classCallCheck(this,
|
746
|
+
var We = /*#__PURE__*/function () {
|
747
|
+
function We() {
|
748
|
+
_classCallCheck(this, We);
|
749
749
|
}
|
750
|
-
return _createClass(
|
750
|
+
return _createClass(We, null, [{
|
751
751
|
key: "mouseUp",
|
752
752
|
value: function mouseUp(e, t) {
|
753
753
|
I.unsetAllCSSMouseStates(e, t), Object.assign(e.style, t["default"]), Object.assign(e.style, t.hover);
|
@@ -770,12 +770,12 @@ var $e = /*#__PURE__*/function () {
|
|
770
770
|
}, {
|
771
771
|
key: "add",
|
772
772
|
value: function add(e, t) {
|
773
|
-
e.addEventListener("mouseenter",
|
773
|
+
e.addEventListener("mouseenter", We.mouseEnter.bind(this, e, t)), e.addEventListener("mouseleave", We.mouseLeave.bind(this, e, t)), e.addEventListener("mousedown", We.mouseDown.bind(this, e, t)), e.addEventListener("mouseup", We.mouseUp.bind(this, e, t));
|
774
774
|
}
|
775
775
|
}]);
|
776
776
|
}();
|
777
|
-
var
|
778
|
-
|
777
|
+
var Wn = "deep-chat-temporary-message",
|
778
|
+
$n = "deep-chat-suggestion-button",
|
779
779
|
es = {
|
780
780
|
"deep-chat-button": {
|
781
781
|
styles: {
|
@@ -798,11 +798,11 @@ var $n = "deep-chat-temporary-message",
|
|
798
798
|
}
|
799
799
|
},
|
800
800
|
Bs = Object.keys(es);
|
801
|
-
var
|
802
|
-
function
|
803
|
-
_classCallCheck(this,
|
801
|
+
var _e = /*#__PURE__*/function () {
|
802
|
+
function _e() {
|
803
|
+
_classCallCheck(this, _e);
|
804
804
|
}
|
805
|
-
return _createClass(
|
805
|
+
return _createClass(_e, null, [{
|
806
806
|
key: "applySuggestionEvent",
|
807
807
|
value: function applySuggestionEvent(e, t) {
|
808
808
|
setTimeout(function () {
|
@@ -818,7 +818,7 @@ var Se = /*#__PURE__*/function () {
|
|
818
818
|
key: "isElementTemporary",
|
819
819
|
value: function isElementTemporary(e) {
|
820
820
|
var t;
|
821
|
-
return e ? (t = e.bubbleElement.children[0]) == null ? void 0 : t.classList.contains(
|
821
|
+
return e ? (t = e.bubbleElement.children[0]) == null ? void 0 : t.classList.contains(Wn) : !1;
|
822
822
|
}
|
823
823
|
}, {
|
824
824
|
key: "doesElementContainDeepChatClass",
|
@@ -857,13 +857,13 @@ var Se = /*#__PURE__*/function () {
|
|
857
857
|
Bs.forEach(function (r) {
|
858
858
|
var o = i.getElementsByClassName(r);
|
859
859
|
Array.from(o || []).forEach(function (a) {
|
860
|
-
var l =
|
861
|
-
X.applyStylesToElement(a, l),
|
860
|
+
var l = _e.getProcessedStyles(t, a, r);
|
861
|
+
X.applyStylesToElement(a, l), _e.applyEvents(a, r);
|
862
862
|
});
|
863
863
|
});
|
864
|
-
var s = i.getElementsByClassName(
|
864
|
+
var s = i.getElementsByClassName($n);
|
865
865
|
Array.from(s).forEach(function (r) {
|
866
|
-
return
|
866
|
+
return _e.applySuggestionEvent(e, r);
|
867
867
|
});
|
868
868
|
}
|
869
869
|
}]);
|
@@ -876,7 +876,7 @@ var X = /*#__PURE__*/function () {
|
|
876
876
|
key: "applyStylesToElement",
|
877
877
|
value: function applyStylesToElement(e, t) {
|
878
878
|
var i = I.processStateful(t);
|
879
|
-
|
879
|
+
We.add(e, i), Object.assign(e.style, i["default"]);
|
880
880
|
}
|
881
881
|
}, {
|
882
882
|
key: "applyEventsToElement",
|
@@ -891,7 +891,7 @@ var X = /*#__PURE__*/function () {
|
|
891
891
|
value: function applyClassUtilitiesToElement(e, t) {
|
892
892
|
var i = t.events,
|
893
893
|
s = t.styles;
|
894
|
-
i && X.applyEventsToElement(e, i), s && !
|
894
|
+
i && X.applyEventsToElement(e, i), s && !_e.doesElementContainDeepChatClass(e) && X.applyStylesToElement(e, s);
|
895
895
|
}
|
896
896
|
}, {
|
897
897
|
key: "applyCustomClassUtilities",
|
@@ -906,7 +906,7 @@ var X = /*#__PURE__*/function () {
|
|
906
906
|
}, {
|
907
907
|
key: "apply",
|
908
908
|
value: function apply(e, t) {
|
909
|
-
|
909
|
+
_e.applyDeepChatUtilities(e, e.htmlClassUtilities, t), X.applyCustomClassUtilities(e.htmlClassUtilities, t);
|
910
910
|
}
|
911
911
|
}, {
|
912
912
|
key: "traverseNodes",
|
@@ -928,7 +928,7 @@ var X = /*#__PURE__*/function () {
|
|
928
928
|
key: "isTemporaryBasedOnHTML",
|
929
929
|
value: function isTemporaryBasedOnHTML(e) {
|
930
930
|
var t = document.createElement("div");
|
931
|
-
return t.innerHTML = e,
|
931
|
+
return t.innerHTML = e, _e.isElementTemporary({
|
932
932
|
outerContainer: t,
|
933
933
|
bubbleElement: t,
|
934
934
|
innerContainer: t
|
@@ -944,11 +944,11 @@ var X = /*#__PURE__*/function () {
|
|
944
944
|
}
|
945
945
|
}]);
|
946
946
|
}();
|
947
|
-
var
|
948
|
-
function
|
949
|
-
_classCallCheck(this,
|
947
|
+
var Le = /*#__PURE__*/function () {
|
948
|
+
function Le() {
|
949
|
+
_classCallCheck(this, Le);
|
950
950
|
}
|
951
|
-
return _createClass(
|
951
|
+
return _createClass(Le, null, [{
|
952
952
|
key: "addElement",
|
953
953
|
value: function addElement(e, t) {
|
954
954
|
e.appendOuterContainerElemet(t), e.focusMode || (e.elementRef.scrollTop = e.elementRef.scrollHeight);
|
@@ -958,7 +958,7 @@ var ke = /*#__PURE__*/function () {
|
|
958
958
|
value: function createElements(e, t, i, s) {
|
959
959
|
var r = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !1;
|
960
960
|
var o = e.createMessageElementsOnOrientation("", i, s, r);
|
961
|
-
return o.bubbleElement.classList.add(
|
961
|
+
return o.bubbleElement.classList.add(Le.HTML_BUBBLE_CLASS), o.bubbleElement.innerHTML = t, o;
|
962
962
|
}
|
963
963
|
}, {
|
964
964
|
key: "overwriteElements",
|
@@ -970,15 +970,15 @@ var ke = /*#__PURE__*/function () {
|
|
970
970
|
key: "overwrite",
|
971
971
|
value: function overwrite(e, t, i, s) {
|
972
972
|
var r = e.messageToElements,
|
973
|
-
o = y.overwriteMessage(r, s, t, i, "html",
|
974
|
-
return o &&
|
973
|
+
o = y.overwriteMessage(r, s, t, i, "html", Le.HTML_BUBBLE_CLASS);
|
974
|
+
return o && Le.overwriteElements(e, t, o), o;
|
975
975
|
}
|
976
976
|
}, {
|
977
977
|
key: "create",
|
978
978
|
value: function create(e, t, i) {
|
979
979
|
var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
|
980
980
|
var o;
|
981
|
-
var r =
|
981
|
+
var r = Le.createElements(e, t, i, s);
|
982
982
|
return y.fillEmptyMessageElement(r.bubbleElement, t), X.apply(e, r.outerContainer), te.flagHTMLUpdateClass(r.bubbleElement), e.applyCustomStyles(r, i, !1, (o = e.messageStyles) == null ? void 0 : o.html), r;
|
983
983
|
}
|
984
984
|
}, {
|
@@ -991,13 +991,13 @@ var ke = /*#__PURE__*/function () {
|
|
991
991
|
s.status = !1;
|
992
992
|
}
|
993
993
|
if (r && e.messageElementRefs.length > 0 && X.isTemporaryBasedOnHTML(t)) return;
|
994
|
-
var o =
|
995
|
-
return r ||
|
994
|
+
var o = Le.create(e, t, i, r);
|
995
|
+
return r || Le.addElement(e, o.outerContainer), o;
|
996
996
|
}
|
997
997
|
}]);
|
998
998
|
}();
|
999
|
-
|
1000
|
-
var
|
999
|
+
Le.HTML_BUBBLE_CLASS = "html-message";
|
1000
|
+
var xe = Le;
|
1001
1001
|
var hi;
|
1002
1002
|
function _n(n) {
|
1003
1003
|
return hi = hi || document.createElement("textarea"), hi.innerHTML = "&" + n + ";", hi.value;
|
@@ -1643,7 +1643,7 @@ var vr = /['"]/,
|
|
1643
1643
|
Us = /['"]/g,
|
1644
1644
|
yr = /[-\s()\[\]]/,
|
1645
1645
|
js = "’";
|
1646
|
-
function
|
1646
|
+
function Hs(n, e) {
|
1647
1647
|
return e < 0 || e >= n.length ? !1 : !yr.test(n[e]);
|
1648
1648
|
}
|
1649
1649
|
function dt(n, e, t) {
|
@@ -1657,7 +1657,7 @@ function Er(n) {
|
|
1657
1657
|
for (a = g[e].level, f = b.length - 1; f >= 0 && !(b[f].level <= a); f--);
|
1658
1658
|
b.length = f + 1, i = t.content, r = 0, o = i.length;
|
1659
1659
|
e: for (; r < o && (Us.lastIndex = r, s = Us.exec(i), !!s);) {
|
1660
|
-
if (l = !
|
1660
|
+
if (l = !Hs(i, s.index - 1), r = s.index + 1, m = s[0] === "'", c = !Hs(i, r), !c && !l) {
|
1661
1661
|
m && (t.content = dt(t.content, s.index, js));
|
1662
1662
|
continue;
|
1663
1663
|
}
|
@@ -1831,7 +1831,7 @@ function wr(n, e, t, i) {
|
|
1831
1831
|
level: n.level
|
1832
1832
|
})), !0);
|
1833
1833
|
}
|
1834
|
-
function
|
1834
|
+
function qs(n, e) {
|
1835
1835
|
var t, i, s;
|
1836
1836
|
return i = n.bMarks[e] + n.tShift[e], s = n.eMarks[e], i >= s || (t = n.src.charCodeAt(i++), t !== 42 && t !== 45 && t !== 43) || i < s && n.src.charCodeAt(i) !== 32 ? -1 : i;
|
1837
1837
|
}
|
@@ -1872,47 +1872,47 @@ function Tr(n, e, t, i) {
|
|
1872
1872
|
b,
|
1873
1873
|
M,
|
1874
1874
|
Y,
|
1875
|
-
|
1875
|
+
He,
|
1876
1876
|
ae,
|
1877
|
-
|
1878
|
-
|
1877
|
+
Re = !0,
|
1878
|
+
Ee,
|
1879
1879
|
ie,
|
1880
1880
|
Ps,
|
1881
|
-
|
1882
|
-
if ((u = zs(n, e)) >= 0) g = !0;else if ((u =
|
1881
|
+
$i;
|
1882
|
+
if ((u = zs(n, e)) >= 0) g = !0;else if ((u = qs(n, e)) >= 0) g = !1;else return !1;
|
1883
1883
|
if (n.level >= n.options.maxNesting) return !1;
|
1884
1884
|
if (p = n.src.charCodeAt(u - 1), i) return !0;
|
1885
1885
|
for (M = n.tokens.length, g ? (d = n.bMarks[e] + n.tShift[e], m = Number(n.src.substr(d, u - d - 1)), n.tokens.push({
|
1886
1886
|
type: "ordered_list_open",
|
1887
1887
|
order: m,
|
1888
|
-
lines:
|
1888
|
+
lines: He = [e, 0],
|
1889
1889
|
level: n.level++
|
1890
1890
|
})) : n.tokens.push({
|
1891
1891
|
type: "bullet_list_open",
|
1892
|
-
lines:
|
1892
|
+
lines: He = [e, 0],
|
1893
1893
|
level: n.level++
|
1894
|
-
}), s = e, Y = !1,
|
1894
|
+
}), s = e, Y = !1, Ee = n.parser.ruler.getRules("list"); s < t && (b = n.skipSpaces(u), h = n.eMarks[s], b >= h ? f = 1 : f = b - u, f > 4 && (f = 1), f < 1 && (f = 1), r = u - n.bMarks[s] + f, n.tokens.push({
|
1895
1895
|
type: "list_item_open",
|
1896
1896
|
lines: ae = [e, 0],
|
1897
1897
|
level: n.level++
|
1898
|
-
}), a = n.blkIndent, l = n.tight, o = n.tShift[e], c = n.parentType, n.tShift[e] = b - n.bMarks[e], n.blkIndent = r, n.tight = !0, n.parentType = "list", n.parser.tokenize(n, e, t, !0), (!n.tight || Y) && (
|
1898
|
+
}), a = n.blkIndent, l = n.tight, o = n.tShift[e], c = n.parentType, n.tShift[e] = b - n.bMarks[e], n.blkIndent = r, n.tight = !0, n.parentType = "list", n.parser.tokenize(n, e, t, !0), (!n.tight || Y) && (Re = !1), Y = n.line - e > 1 && n.isEmpty(n.line - 1), n.blkIndent = a, n.tShift[e] = o, n.tight = l, n.parentType = c, n.tokens.push({
|
1899
1899
|
type: "list_item_close",
|
1900
1900
|
level: --n.level
|
1901
1901
|
}), s = e = n.line, ae[1] = s, b = n.bMarks[e], !(s >= t || n.isEmpty(s) || n.tShift[s] < n.blkIndent));) {
|
1902
|
-
for (
|
1903
|
-
|
1902
|
+
for ($i = !1, ie = 0, Ps = Ee.length; ie < Ps; ie++) if (Ee[ie](n, s, t, !0)) {
|
1903
|
+
$i = !0;
|
1904
1904
|
break;
|
1905
1905
|
}
|
1906
|
-
if (
|
1906
|
+
if ($i) break;
|
1907
1907
|
if (g) {
|
1908
1908
|
if (u = zs(n, s), u < 0) break;
|
1909
|
-
} else if (u =
|
1909
|
+
} else if (u = qs(n, s), u < 0) break;
|
1910
1910
|
if (p !== n.src.charCodeAt(u - 1)) break;
|
1911
1911
|
}
|
1912
1912
|
return n.tokens.push({
|
1913
1913
|
type: g ? "ordered_list_close" : "bullet_list_close",
|
1914
1914
|
level: --n.level
|
1915
|
-
}),
|
1915
|
+
}), He[1] = s, n.line = s, Re && Ar(n, M), !0;
|
1916
1916
|
}
|
1917
1917
|
function Cr(n, e, t, i) {
|
1918
1918
|
var s,
|
@@ -2221,7 +2221,7 @@ Ss.prototype.parse = function (n, e, t, i) {
|
|
2221
2221
|
return n.charCodeAt(l) === 10 ? (r = l + 1, o = 0, a) : (c = " ".slice((l - r - o) % 4), o = l - r + 1, c);
|
2222
2222
|
})), s = new lt(n, this, e, t, i), this.tokenize(s, s.line, s.lineMax);
|
2223
2223
|
};
|
2224
|
-
function
|
2224
|
+
function Hr(n) {
|
2225
2225
|
switch (n) {
|
2226
2226
|
case 10:
|
2227
2227
|
case 92:
|
@@ -2249,8 +2249,8 @@ function qr(n) {
|
|
2249
2249
|
return !1;
|
2250
2250
|
}
|
2251
2251
|
}
|
2252
|
-
function
|
2253
|
-
for (var t = n.pos; t < n.posMax && !
|
2252
|
+
function qr(n, e) {
|
2253
|
+
for (var t = n.pos; t < n.posMax && !Hr(n.src.charCodeAt(t));) t++;
|
2254
2254
|
return t === n.pos ? !1 : (e || (n.pending += n.src.slice(n.pos, t)), n.pos = t, !0);
|
2255
2255
|
}
|
2256
2256
|
function zr(n, e) {
|
@@ -2348,7 +2348,7 @@ function Kr(n, e) {
|
|
2348
2348
|
level: --n.level
|
2349
2349
|
})), n.pos = n.posMax + 2, n.posMax = r, !0) : (n.pos = o, !1);
|
2350
2350
|
}
|
2351
|
-
function
|
2351
|
+
function Wr(n, e) {
|
2352
2352
|
var t,
|
2353
2353
|
i,
|
2354
2354
|
s,
|
@@ -2374,7 +2374,7 @@ function $r(n, e) {
|
|
2374
2374
|
level: --n.level
|
2375
2375
|
})), n.pos = n.posMax + 2, n.posMax = r, !0) : (n.pos = o, !1);
|
2376
2376
|
}
|
2377
|
-
function
|
2377
|
+
function $r(n, e) {
|
2378
2378
|
var t,
|
2379
2379
|
i,
|
2380
2380
|
s,
|
@@ -2625,7 +2625,7 @@ function oo(n, e) {
|
|
2625
2625
|
level: n.level
|
2626
2626
|
})), n.pos += s[0].length, !0) : !1) : !1));
|
2627
2627
|
}
|
2628
|
-
function
|
2628
|
+
function Hi(n, e) {
|
2629
2629
|
return n = n.source, e = e || "", function t(i, s) {
|
2630
2630
|
return i ? (s = s.source || s, n = n.replace(i, s), t) : new RegExp(n, e);
|
2631
2631
|
};
|
@@ -2634,15 +2634,15 @@ var ao = /[a-zA-Z_:][a-zA-Z0-9:._-]*/,
|
|
2634
2634
|
lo = /[^"'=<>`\x00-\x20]+/,
|
2635
2635
|
co = /'[^']*'/,
|
2636
2636
|
ho = /"[^"]*"/,
|
2637
|
-
uo =
|
2638
|
-
fo =
|
2639
|
-
po =
|
2637
|
+
uo = Hi(/(?:unquoted|single_quoted|double_quoted)/)("unquoted", lo)("single_quoted", co)("double_quoted", ho)(),
|
2638
|
+
fo = Hi(/(?:\s+attr_name(?:\s*=\s*attr_value)?)/)("attr_name", ao)("attr_value", uo)(),
|
2639
|
+
po = Hi(/<[A-Za-z][A-Za-z0-9]*attribute*\s*\/?>/)("attribute", fo)(),
|
2640
2640
|
mo = /<\/[A-Za-z][A-Za-z0-9]*\s*>/,
|
2641
2641
|
go = /<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->/,
|
2642
2642
|
bo = /<[?].*?[?]>/,
|
2643
2643
|
vo = /<![A-Z]+\s+[^>]*>/,
|
2644
2644
|
yo = /<!\[CDATA\[[\s\S]*?\]\]>/,
|
2645
|
-
Eo =
|
2645
|
+
Eo = Hi(/^(?:open_tag|close_tag|comment|processing|declaration|cdata)/)("open_tag", po)("close_tag", mo)("comment", go)("processing", bo)("declaration", vo)("cdata", yo)();
|
2646
2646
|
function So(n) {
|
2647
2647
|
var e = n | 32;
|
2648
2648
|
return e >= 97 && e <= 122;
|
@@ -2677,13 +2677,13 @@ function Ao(n, e) {
|
|
2677
2677
|
}
|
2678
2678
|
return e || (n.pending += "&"), n.pos++, !0;
|
2679
2679
|
}
|
2680
|
-
var Zi = [["text",
|
2681
|
-
function
|
2680
|
+
var Zi = [["text", qr], ["newline", zr], ["escape", Gr], ["backticks", Vr], ["del", Kr], ["ins", Wr], ["mark", $r], ["emphasis", Jr], ["sub", Yr], ["sup", Qr], ["links", eo], ["footnote_inline", to], ["footnote_ref", io], ["autolink", oo], ["htmltag", _o], ["entity", Ao]];
|
2681
|
+
function qi() {
|
2682
2682
|
this.ruler = new oe();
|
2683
2683
|
for (var n = 0; n < Zi.length; n++) this.ruler.push(Zi[n][0], Zi[n][1]);
|
2684
2684
|
this.validateLink = To;
|
2685
2685
|
}
|
2686
|
-
|
2686
|
+
qi.prototype.skipToken = function (n) {
|
2687
2687
|
var e = this.ruler.getRules(""),
|
2688
2688
|
t = e.length,
|
2689
2689
|
i = n.pos,
|
@@ -2699,7 +2699,7 @@ Hi.prototype.skipToken = function (n) {
|
|
2699
2699
|
}
|
2700
2700
|
n.pos++, n.cacheSet(i, n.pos);
|
2701
2701
|
};
|
2702
|
-
|
2702
|
+
qi.prototype.tokenize = function (n) {
|
2703
2703
|
for (var e = this.ruler.getRules(""), t = e.length, i = n.posMax, s, r; n.pos < i;) {
|
2704
2704
|
for (r = 0; r < t && (s = e[r](n, !1), !s); r++);
|
2705
2705
|
if (s) {
|
@@ -2710,7 +2710,7 @@ Hi.prototype.tokenize = function (n) {
|
|
2710
2710
|
}
|
2711
2711
|
n.pending && n.pushPending();
|
2712
2712
|
};
|
2713
|
-
|
2713
|
+
qi.prototype.parse = function (n, e, t, i) {
|
2714
2714
|
var s = new at(n, this, e, t, i);
|
2715
2715
|
this.tokenize(s);
|
2716
2716
|
};
|
@@ -2836,34 +2836,34 @@ var Co = {
|
|
2836
2836
|
function Ln(n, e, t) {
|
2837
2837
|
this.src = e, this.env = t, this.options = n.options, this.tokens = [], this.inlineMode = !1, this.inline = n.inline, this.block = n.block, this.renderer = n.renderer, this.typographer = n.typographer;
|
2838
2838
|
}
|
2839
|
-
function
|
2840
|
-
typeof n != "string" && (e = n, n = "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
|
2839
|
+
function we(n, e) {
|
2840
|
+
typeof n != "string" && (e = n, n = "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 qi(), this.block = new Ss(), this.core = new Mn(), this.renderer = new Es(), this.ruler = new oe(), this.options = {}, this.configure(ko[n]), this.set(e || {});
|
2841
2841
|
}
|
2842
|
-
|
2842
|
+
we.prototype.set = function (n) {
|
2843
2843
|
xn(this.options, n);
|
2844
2844
|
};
|
2845
|
-
|
2845
|
+
we.prototype.configure = function (n) {
|
2846
2846
|
var e = this;
|
2847
2847
|
if (!n) throw new Error("Wrong `remarkable` preset, check name/content");
|
2848
2848
|
n.options && e.set(n.options), n.components && Object.keys(n.components).forEach(function (t) {
|
2849
2849
|
n.components[t].rules && e[t].ruler.enable(n.components[t].rules, !0);
|
2850
2850
|
});
|
2851
2851
|
};
|
2852
|
-
|
2852
|
+
we.prototype.use = function (n, e) {
|
2853
2853
|
return n(this, e), this;
|
2854
2854
|
};
|
2855
|
-
|
2855
|
+
we.prototype.parse = function (n, e) {
|
2856
2856
|
var t = new Ln(this, n, e);
|
2857
2857
|
return this.core.process(t), t.tokens;
|
2858
2858
|
};
|
2859
|
-
|
2859
|
+
we.prototype.render = function (n, e) {
|
2860
2860
|
return e = e || {}, this.renderer.render(this.parse(n, e), this.options, e);
|
2861
2861
|
};
|
2862
|
-
|
2862
|
+
we.prototype.parseInline = function (n, e) {
|
2863
2863
|
var t = new Ln(this, n, e);
|
2864
2864
|
return t.inlineMode = !0, this.core.process(t), t.tokens;
|
2865
2865
|
};
|
2866
|
-
|
2866
|
+
we.prototype.renderInline = function (n, e) {
|
2867
2867
|
return e = e || {}, this.renderer.render(this.parseInline(n, e), this.options, e);
|
2868
2868
|
};
|
2869
2869
|
var ft = /*#__PURE__*/function () {
|
@@ -2873,10 +2873,10 @@ var ft = /*#__PURE__*/function () {
|
|
2873
2873
|
return _createClass(ft, null, [{
|
2874
2874
|
key: "instantiate",
|
2875
2875
|
value: function instantiate(e) {
|
2876
|
-
if (e) return new
|
2876
|
+
if (e) return new we(_objectSpread(_objectSpread({}, ft.DEFAULT_PROPERTIES), e));
|
2877
2877
|
if (window.hljs) {
|
2878
2878
|
var t = window.hljs;
|
2879
|
-
return new
|
2879
|
+
return new we({
|
2880
2880
|
highlight: function highlight(i, s) {
|
2881
2881
|
if (s && t.getLanguage(s)) try {
|
2882
2882
|
return t.highlight(i, {
|
@@ -2905,7 +2905,7 @@ var ft = /*#__PURE__*/function () {
|
|
2905
2905
|
typographer: !0
|
2906
2906
|
// Enable smartypants and other sweet transforms
|
2907
2907
|
});
|
2908
|
-
} else return new
|
2908
|
+
} else return new we(ft.DEFAULT_PROPERTIES);
|
2909
2909
|
}
|
2910
2910
|
}, {
|
2911
2911
|
key: "createNew",
|
@@ -2985,7 +2985,7 @@ var yi = /*#__PURE__*/function () {
|
|
2985
2985
|
isHistory: i,
|
2986
2986
|
isInitial: i
|
2987
2987
|
}));
|
2988
|
-
|
2988
|
+
q.reAddFileRefToObject(t, s), (r = e.onMessage) == null || r.call(e, s), e.dispatchEvent(new CustomEvent("message", {
|
2989
2989
|
detail: s
|
2990
2990
|
})), te.fireOnNewMessage(e, s);
|
2991
2991
|
}
|
@@ -3053,7 +3053,7 @@ var F = /*#__PURE__*/function () {
|
|
3053
3053
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
3054
3054
|
var r, o, a, l;
|
3055
3055
|
var i = (l = (a = (o = (r = e.messageStyles) == null ? void 0 : r.loading) == null ? void 0 : o.history) == null ? void 0 : a.full) == null ? void 0 : l.html,
|
3056
|
-
s = i ?
|
3056
|
+
s = i ? xe.createElements(e, i, y.AI_ROLE, !0, !0) : F.createDefaultElements(e);
|
3057
3057
|
return F.addLoadHistoryMessage(s, e, t), y.softRemRoleElements(s.innerContainer, e.avatar, e.name), s;
|
3058
3058
|
}
|
3059
3059
|
}, {
|
@@ -3079,14 +3079,14 @@ var F = /*#__PURE__*/function () {
|
|
3079
3079
|
}();
|
3080
3080
|
F.CLASS = "loading-history-message", F.FULL_VIEW_CLASS = "loading-history-message-full-view", F.SMALL_CLASS = "loading-history-message-small";
|
3081
3081
|
var Fe = F;
|
3082
|
-
var
|
3083
|
-
function
|
3084
|
-
_classCallCheck(this,
|
3082
|
+
var $t = /*#__PURE__*/function () {
|
3083
|
+
function $t() {
|
3084
|
+
_classCallCheck(this, $t);
|
3085
3085
|
}
|
3086
|
-
return _createClass(
|
3086
|
+
return _createClass($t, null, [{
|
3087
3087
|
key: "setFade",
|
3088
3088
|
value: function setFade(e, t) {
|
3089
|
-
e.style.transitionDuration = typeof t == "number" ? "".concat(t, "ms") : "".concat(
|
3089
|
+
e.style.transitionDuration = typeof t == "number" ? "".concat(t, "ms") : "".concat($t.DEFAULT_FADE_MS, "ms");
|
3090
3090
|
}
|
3091
3091
|
}, {
|
3092
3092
|
key: "fadeAnimation",
|
@@ -3097,7 +3097,7 @@ var Wt = /*#__PURE__*/function () {
|
|
3097
3097
|
while (1) switch (_context.prev = _context.next) {
|
3098
3098
|
case 0:
|
3099
3099
|
e.style.opacity = "0";
|
3100
|
-
i = typeof t == "number" ? t :
|
3100
|
+
i = typeof t == "number" ? t : $t.DEFAULT_FADE_MS;
|
3101
3101
|
_context.next = 4;
|
3102
3102
|
return new Promise(function (s) {
|
3103
3103
|
setTimeout(function () {
|
@@ -3119,9 +3119,9 @@ var Wt = /*#__PURE__*/function () {
|
|
3119
3119
|
}()
|
3120
3120
|
}]);
|
3121
3121
|
}();
|
3122
|
-
|
3123
|
-
var Ei =
|
3124
|
-
var
|
3122
|
+
$t.DEFAULT_FADE_MS = 500;
|
3123
|
+
var Ei = $t;
|
3124
|
+
var Ws = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3csvg%20fill='%23000000'%20version='1.1'%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%2032%2032'%20xml:space='preserve'%3e%3cpath%20d='M23,30.36H9c-2.404,0-4.36-1.956-4.36-4.36V15c0-2.404,1.956-4.36,4.36-4.36h3.659%20c0.167-1.566,1.415-2.813,2.981-2.981V5.333c-1.131-0.174-2-1.154-2-2.333c0-1.301,1.059-2.36,2.36-2.36%20c1.302,0,2.36,1.059,2.36,2.36c0,1.179-0.869,2.159-2,2.333V7.66c1.566,0.167,2.814,1.415,2.981,2.981H23%20c2.404,0,4.36,1.956,4.36,4.36v11C27.36,28.404,25.404,30.36,23,30.36z%20M9,11.36c-2.007,0-3.64,1.633-3.64,3.64v11%20c0,2.007,1.633,3.64,3.64,3.64h14c2.007,0,3.64-1.633,3.64-3.64V15c0-2.007-1.633-3.64-3.64-3.64H9z%20M13.384,10.64h5.231%20C18.439,9.354,17.334,8.36,16,8.36C14.667,8.36,13.561,9.354,13.384,10.64z%20M16,1.36c-0.904,0-1.64,0.736-1.64,1.64%20S15.096,4.64,16,4.64c0.904,0,1.64-0.736,1.64-1.64S16.904,1.36,16,1.36z%20M20,27.36h-8c-1.301,0-2.36-1.059-2.36-2.36%20s1.059-2.36,2.36-2.36h8c1.302,0,2.36,1.059,2.36,2.36S21.302,27.36,20,27.36z%20M12,23.36c-0.904,0-1.64,0.735-1.64,1.64%20s0.736,1.64,1.64,1.64h8c0.904,0,1.64-0.735,1.64-1.64s-0.735-1.64-1.64-1.64H12z%20M31,23.86h-2c-0.199,0-0.36-0.161-0.36-0.36V15%20c0-0.199,0.161-0.36,0.36-0.36h2c0.199,0,0.36,0.161,0.36,0.36v8.5C31.36,23.699,31.199,23.86,31,23.86z%20M29.36,23.14h1.279v-7.78%20H29.36V23.14z%20M3,23.86H1c-0.199,0-0.36-0.161-0.36-0.36V15c0-0.199,0.161-0.36,0.36-0.36h2c0.199,0,0.36,0.161,0.36,0.36v8.5%20C3.36,23.699,3.199,23.86,3,23.86z%20M1.36,23.14h1.28v-7.78H1.36V23.14z%20M20,20.36c-1.302,0-2.36-1.059-2.36-2.36%20s1.059-2.36,2.36-2.36s2.36,1.059,2.36,2.36C22.36,19.302,21.302,20.36,20,20.36z%20M20,16.36c-0.904,0-1.64,0.736-1.64,1.64%20s0.735,1.64,1.64,1.64s1.64-0.735,1.64-1.64S20.904,16.36,20,16.36z%20M12,20.36c-1.301,0-2.36-1.059-2.36-2.36s1.059-2.36,2.36-2.36%20s2.36,1.059,2.36,2.36C14.36,19.302,13.301,20.36,12,20.36z%20M12,16.36c-0.904,0-1.64,0.736-1.64,1.64s0.736,1.64,1.64,1.64%20s1.64-0.735,1.64-1.64S12.904,16.36,12,16.36z'/%3e%3crect%20style='fill:none;'%20width='32'%20height='32'/%3e%3c/svg%3e",
|
3125
3125
|
ss = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6CAMAAAC/MqoPAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADNQTFRF////9vX18vLy/Pz86enp4+Li2tnZ1tbWzczM+fn57Ozs4N/f09LS0M/P5uXl7+/v3dzcwtncCAAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAEgAAABIAEbJaz4AAAZNSURBVHja7d3bdtsqEABQYABZSLH9/3+ZpnUsIcF5iOM6PfElNoMHMfPQdq3GmL0GkLhEUqLaUExnOtOZznSmM53pTGc605nOdKYznelMZzrTmV4LXSqllKyJDkob26xWq8Zae/iH0QoWTm9d1xur4WuypQJtTd+5dqn0VjcxzNO5/57mEBvdLo8Oron6aseWOjYOFkVvjQs3DmgyONMuht52EfztP+4hdu0i6LCO808/M8c1lE/fuPGej41uUzgdtoO/75N+2ELJ9I3b3//hPXbiMenm3pR/Jt4USgcLBIp4Bh10gqKVhvLo0klCxeSky96nKcj3siw6pJIL4XsoiQ7apyvMY/V3HHrSRioLopvEhSpTCn2TPEuwKYMOIX0tAxRBf/Hpa+lfSqBv9gi1FPsNfTrMAiVmIE/vJhz61FGnQxRIEYE4vfNYdN8Rp6MlHaHotHTn8ejekaZPAjEmyvQWdZFTtYTpXqCGJ0zvcek9Yfoel76nS0ffv1NMp1ca+pkgyfRCGind4L7OWWc605l+cxjsyhqy9AGbPpClc1/nvl5VX0c/3Alk6RU3+Am7shNZ+h6bvidLr7jBB+zKBrL0irOOudmIUDzTmf5gIP+iEuXtRuTVaEmY/oZLfyNMrzjryPc0gerMTdpVg0tvjJUU6bLPcGOoUv46SLL6Wi8yhLf06C7TUyekI0efRaaYqdFltkeNpPumRPSMDxgBYvSM035FrKAmH72hRW99PrpvSdEHkTEGUvSsK3yKVDkuJ92RohcZaehzzirPpOg+J92Tolfc4Cumx5xVXpGiZ34+ICX6W84qv5GiR5NPbiIpOv6BCoSvSkTX+eiaGP092zINvBOj4x8mSf9FqejvNo/cvpOji19ZbmviL0GPLsYMFzgzCor0+Bv/ePDvSJKOb9dJ5UlnbnEHiHgzv6cdTpJOWuc/u3FEucLDOL75xGtBiefrcwgoC9NDSH/jkH6pAuXmBqPQ9HSUPVdZBH1GGOrMXAQdYxcKZfxAoK+KKBKFLosoEoX+u4giUehz8jlcnAuhp78I46yDYNAd+QLR6K+pr+yvxdBTHyVDubQh0UfSxaHSd0lbvNkVRE87JGOtc+PQd2QLQ6fHhJkKsSh6yg13tO08JPprsgrrXWH0dJd2vH1MLPprot4eXoujpzrdhngiD40ek2y92lggPcnWa8qN1Yz0BFuvZhRl0uOfR0v4Ewuli/Bg4Qr3lArqGdndQ3UPO1EunXYwnelMZzrTmc50pjOd6UxnOtOZznSmM53pTGf6kuj6oedFKV0s3fX6sX1S3bsi6a4PD7+/YAqYeBw6pIB/4qEgOqxdSPbGiim4NRRCbzs3Jj0L4UfXtQXQVRfn5IdA/Bw7RZzurEV6EtdsLeGXkIPuA+K1UoVeA0l62zmN/LqfSSft9KkepmoRuvi3nd5uKNFB9zbbXEANqdr941XO0NJx2v2jdJenpf+/3bvn0ts16ph+sd6hX7dPo2+2cZzE02Ia43bzDHqr+2Evnhz74ZHU30ffbKOeng1/NPV30Ns1gYQnSP2P6e65Pfxc6h02XZqXQCjhJ6kPL6bFo4NrGvAU4UII4SE2P1vQuZkuOxckVfehisF1MjUddN/MZBN+kvq5uf0O/xa66gyNS9ktMWlz44rO1Z8C19i5FPdHzPamXn+F3hryPfxMr78+4F+kq22kO6Rf6fUQt+puuustyWv4rbG3l/duztFB96GYoe1cTBdXMr+nw9qVM6ZfxOvzezff0nXi/ZOndvrR6Zvpm0c3h6nhdb+5iS7tsIim/qXZD9+97/Jf+rpZ5BET1ayv0GUzLhEuhBBjIy/RdVPgndutIRt9nt7p5cKFEEJ3Z+jQFDZL+XnMDXxHB73gxn5s9Kc3d3/pFciFkN/QTSXHJpX5l66gDrkQoP6hL3xsPw39la4qOiV8tH78XeSbue6N9mvWa6J/ybpc1CT1Wnh5Qq9meP8IOKH3ddH7E/ri1iYux/SXDrXR4UiPdck/wUpU+FtPf6/orja6O9KL3l56LOvVxe5Ib2qjN0d6Vbex4ghWlU3bPqI90If66MNng680FNpbJijH6kCvaF3uMzQ3+IrpFerV4Y9dffQdN3im10ivbuImhD3Qq5u4HdZkua8znelMZ/pS4z9CPVKkxowNxgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNy0wMy0yN1QxNTo0NToxNSswMDowMN1xSg4AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTctMDMtMjdUMTU6NDU6MTUrMDA6MDCsLPKyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAABJRU5ErkJggg==";
|
3126
3126
|
var In = /*#__PURE__*/function () {
|
3127
3127
|
function In(e) {
|
@@ -3146,15 +3146,15 @@ var In = /*#__PURE__*/function () {
|
|
3146
3146
|
}
|
3147
3147
|
}]);
|
3148
3148
|
}();
|
3149
|
-
var
|
3150
|
-
function
|
3149
|
+
var Me = /*#__PURE__*/function (_In) {
|
3150
|
+
function Me(e) {
|
3151
3151
|
var _this3;
|
3152
|
-
_classCallCheck(this,
|
3153
|
-
_this3 = _callSuper(this,
|
3152
|
+
_classCallCheck(this, Me);
|
3153
|
+
_this3 = _callSuper(this, Me, ["avatar-container"]), _this3._avatars = e;
|
3154
3154
|
return _this3;
|
3155
3155
|
}
|
3156
|
-
_inherits(
|
3157
|
-
return _createClass(
|
3156
|
+
_inherits(Me, _In);
|
3157
|
+
return _createClass(Me, [{
|
3158
3158
|
key: "addBesideMsg",
|
3159
3159
|
value: function addBesideMsg(e, t) {
|
3160
3160
|
var i = typeof this._avatars == "boolean" ? void 0 : this._avatars,
|
@@ -3167,9 +3167,9 @@ var Re = /*#__PURE__*/function (_In) {
|
|
3167
3167
|
value: function createAvatar(e, t) {
|
3168
3168
|
var r, o, a, l, c;
|
3169
3169
|
var i = document.createElement("img");
|
3170
|
-
e === y.USER_ROLE ? (i.src = ((r = t == null ? void 0 : t.user) == null ? void 0 : r.src) || ((o = t == null ? void 0 : t["default"]) == null ? void 0 : o.src) || ss, i.onerror =
|
3170
|
+
e === y.USER_ROLE ? (i.src = ((r = t == null ? void 0 : t.user) == null ? void 0 : r.src) || ((o = t == null ? void 0 : t["default"]) == null ? void 0 : o.src) || ss, i.onerror = Me.errorFallback.bind(this, ss)) : (i.src = ((a = t == null ? void 0 : t[e]) == null ? void 0 : a.src) || ((l = t == null ? void 0 : t.ai) == null ? void 0 : l.src) || ((c = t == null ? void 0 : t["default"]) == null ? void 0 : c.src) || Ws, i.onerror = Me.errorFallback.bind(this, Ws)), i.classList.add("avatar"), i.alt = "".concat(e, " avatar");
|
3171
3171
|
var s = document.createElement("div");
|
3172
|
-
return s.classList.add(this.className), s.appendChild(i), t &&
|
3172
|
+
return s.classList.add(this.className), s.appendChild(i), t && Me.applyCustomStyles(s, i, t, e), s;
|
3173
3173
|
}
|
3174
3174
|
}, {
|
3175
3175
|
key: "getPosition",
|
@@ -3193,10 +3193,10 @@ var Re = /*#__PURE__*/function (_In) {
|
|
3193
3193
|
key: "applyCustomStyles",
|
3194
3194
|
value: function applyCustomStyles(e, t, i, s) {
|
3195
3195
|
var r, o, a, l;
|
3196
|
-
if ((r = i["default"]) != null && r.styles &&
|
3197
|
-
(a = i.ai) != null && a.styles &&
|
3196
|
+
if ((r = i["default"]) != null && r.styles && Me.applyCustomStylesToElements(e, t, i["default"].styles), s === y.USER_ROLE) (o = i.user) != null && o.styles && Me.applyCustomStylesToElements(e, t, i.user.styles);else {
|
3197
|
+
(a = i.ai) != null && a.styles && Me.applyCustomStylesToElements(e, t, i.ai.styles);
|
3198
3198
|
var c = (l = i[s]) == null ? void 0 : l.styles;
|
3199
|
-
c &&
|
3199
|
+
c && Me.applyCustomStylesToElements(e, t, c);
|
3200
3200
|
}
|
3201
3201
|
}
|
3202
3202
|
}]);
|
@@ -3249,7 +3249,7 @@ var Z = /*#__PURE__*/function () {
|
|
3249
3249
|
var _this5 = this;
|
3250
3250
|
_classCallCheck(this, Z);
|
3251
3251
|
var t;
|
3252
|
-
this.messageElementRefs = [], this.htmlClassUtilities = {}, this.messageToElements = [], this.elementRef = Z.createContainerElement(), this.messageStyles = te.processMessageStyles(e.messageStyles), this._remarkable = ti.createNew(e.remarkable), e.avatars && (this.avatar = new
|
3252
|
+
this.messageElementRefs = [], this.htmlClassUtilities = {}, this.messageToElements = [], this.elementRef = Z.createContainerElement(), this.messageStyles = te.processMessageStyles(e.messageStyles), this._remarkable = ti.createNew(e.remarkable), e.avatars && (this.avatar = new Me(e.avatars)), e.names && (this.name = new zt(e.names)), this._onMessage = yi.onMessage.bind(this, e), e.htmlClassUtilities && (this.htmlClassUtilities = e.htmlClassUtilities), this.focusMode = e.focusMode, this.focusMode || (this._lastGroupMessagesElement = document.createElement("div")), typeof this.focusMode != "boolean" && (t = this.focusMode) != null && t.fade && Ei.setFade(this.elementRef, this.focusMode.fade), setTimeout(function () {
|
3253
3253
|
_this5.submitUserMessage = e.submitUserMessage;
|
3254
3254
|
});
|
3255
3255
|
}
|
@@ -3346,7 +3346,7 @@ var Z = /*#__PURE__*/function () {
|
|
3346
3346
|
}, {
|
3347
3347
|
key: "revealRoleElementsIfTempRemoved",
|
3348
3348
|
value: function revealRoleElementsIfTempRemoved(e, t) {
|
3349
|
-
if ((this.avatar || this.name) &&
|
3349
|
+
if ((this.avatar || this.name) && _e.isElementTemporary(e)) {
|
3350
3350
|
var i = this.messageElementRefs[this.messageElementRefs.length - 2];
|
3351
3351
|
i && this.messageToElements.length > 0 && !e.bubbleElement.classList.contains(y.getRoleClass(t)) && y.revealRoleElements(i.innerContainer, this.avatar, this.name);
|
3352
3352
|
}
|
@@ -3433,7 +3433,7 @@ var Z = /*#__PURE__*/function () {
|
|
3433
3433
|
}, {
|
3434
3434
|
key: "isTemporaryElement",
|
3435
3435
|
value: function isTemporaryElement(e) {
|
3436
|
-
return Z.isLoadingMessage(e) ||
|
3436
|
+
return Z.isLoadingMessage(e) || _e.isElementTemporary(e);
|
3437
3437
|
}
|
3438
3438
|
}, {
|
3439
3439
|
key: "createBaseElements",
|
@@ -3611,7 +3611,7 @@ var S = /*#__PURE__*/function () {
|
|
3611
3611
|
key: "generateMessageBodyElements",
|
3612
3612
|
value: function generateMessageBodyElements(e, t) {
|
3613
3613
|
var i = {};
|
3614
|
-
return e.text && (i.text = S.findMessageElements(t, he.TEXT_BUBBLE_CLASS)), e.html && (i.html = S.findMessageElements(t,
|
3614
|
+
return e.text && (i.text = S.findMessageElements(t, he.TEXT_BUBBLE_CLASS)), e.html && (i.html = S.findMessageElements(t, xe.HTML_BUBBLE_CLASS)), e.files && (i.files = S.filterdMessageElements(t, q.FILE_BUBBLE_CLASS)), i;
|
3615
3615
|
}
|
3616
3616
|
}, {
|
3617
3617
|
key: "generateMessageBody",
|
@@ -3688,15 +3688,14 @@ var S = /*#__PURE__*/function () {
|
|
3688
3688
|
}();
|
3689
3689
|
S.AI_ROLE = "ai", S.USER_ROLE = "user", S.ERROR_MESSAGE_TEXT_CLASS = "error-message-text", S.OUTER_CONTAINER_CLASS_ROLE_PREFIX = "deep-chat-outer-container-role-", S.EMPTY_MESSAGE_CLASS = "empty-message", S.POSITION_TOP_MESSAGE_CLASS = "deep-chat-top-message", S.POSITION_MIDDLE_MESSAGE_CLASS = "deep-chat-middle-message", S.POSITION_BOTTOM_MESSAGE_CLASS = "deep-chat-bottom-message";
|
3690
3690
|
var y = S;
|
3691
|
-
var
|
3692
|
-
function
|
3693
|
-
_classCallCheck(this,
|
3694
|
-
this._fileAdded = !1, this._streamType = "", this._hasStreamEnded = !1, this._partialText = "", this._messages = e,
|
3691
|
+
var pe = /*#__PURE__*/function () {
|
3692
|
+
function pe(e, t) {
|
3693
|
+
_classCallCheck(this, pe);
|
3694
|
+
this._fileAdded = !1, this._streamType = "", this._hasStreamEnded = !1, this._partialText = "", this._messages = e, _typeof(t) == "object" && (this._partialRender = t.partialRender, this._customWrappers = t.htmlWrappers);
|
3695
3695
|
}
|
3696
|
-
return _createClass(
|
3696
|
+
return _createClass(pe, [{
|
3697
3697
|
key: "upsertStreamedMessage",
|
3698
3698
|
value: function upsertStreamedMessage(e) {
|
3699
|
-
var r;
|
3700
3699
|
if (this._hasStreamEnded) return;
|
3701
3700
|
if ((e == null ? void 0 : e.text) === void 0 && (e == null ? void 0 : e.html) === void 0) return console.error(k.INVALID_STREAM_EVENT);
|
3702
3701
|
e != null && e.custom && this._message && (this._message.custom = e.custom);
|
@@ -3705,22 +3704,31 @@ var Le = /*#__PURE__*/function () {
|
|
3705
3704
|
s = (e == null ? void 0 : e.text) !== void 0 ? "text" : "html";
|
3706
3705
|
if (!this._elements && !this._message) this.setInitialState(s, t, e == null ? void 0 : e.role);else {
|
3707
3706
|
if (this._streamType !== s) return console.error(k.INVALID_STREAM_EVENT_MIX);
|
3708
|
-
this.updateBasedOnType(t, s,
|
3707
|
+
this.updateBasedOnType(t, s, e == null ? void 0 : e.overwrite);
|
3709
3708
|
}
|
3710
3709
|
i && G.scrollToBottom(this._messages.elementRef);
|
3711
3710
|
}
|
3712
3711
|
}, {
|
3713
3712
|
key: "setInitialState",
|
3714
3713
|
value: function setInitialState(e, t, i) {
|
3715
|
-
this._streamType = e, i !== null && i !== void 0 ? i : i = y.AI_ROLE, this._elements = e === "text" ? this._messages.addNewTextMessage(
|
3714
|
+
this._streamType = e, i !== null && i !== void 0 ? i : i = y.AI_ROLE, this._elements = e === "text" ? this._messages.addNewTextMessage("", i) : xe.add(this._messages, t, i), this._elements && (this._elements.bubbleElement.classList.add(pe.MESSAGE_CLASS), this.setTargetWrapperIfNeeded(this._elements, i), this._activeMessageRole = i, this._message = _defineProperty({
|
3716
3715
|
role: this._activeMessageRole
|
3717
3716
|
}, e, t), this._messages.messageToElements.push([this._message, _defineProperty({}, e, this._elements)]));
|
3718
3717
|
}
|
3718
|
+
}, {
|
3719
|
+
key: "setTargetWrapperIfNeeded",
|
3720
|
+
value: function setTargetWrapperIfNeeded(e, t) {
|
3721
|
+
var s, r;
|
3722
|
+
var i = ((s = this._customWrappers) == null ? void 0 : s[t]) || ((r = this._customWrappers) == null ? void 0 : r["default"]);
|
3723
|
+
i && (e.bubbleElement.innerHTML = i, this._targetWrapper = e.bubbleElement.getElementsByClassName(pe.TARGET_WRAPPER_CLASS)[0]);
|
3724
|
+
}
|
3719
3725
|
}, {
|
3720
3726
|
key: "updateBasedOnType",
|
3721
|
-
value: function updateBasedOnType(e, t
|
3722
|
-
var
|
3723
|
-
|
3727
|
+
value: function updateBasedOnType(e, t) {
|
3728
|
+
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
|
3729
|
+
var o;
|
3730
|
+
var s = this._targetWrapper || ((o = this._elements) == null ? void 0 : o.bubbleElement);
|
3731
|
+
this._partialRender || y.unfillEmptyMessageElement(s, e), (t === "text" ? this.updateText : this.updateHTML).bind(this)(e, s, i);
|
3724
3732
|
}
|
3725
3733
|
}, {
|
3726
3734
|
key: "updateText",
|
@@ -3731,7 +3739,7 @@ var Le = /*#__PURE__*/function () {
|
|
3731
3739
|
key: "isNewPartialRenderParagraph",
|
3732
3740
|
value: function isNewPartialRenderParagraph() {
|
3733
3741
|
var e, t;
|
3734
|
-
return this._partialBubble ? this._partialText && ((t = this._partialText) == null ? void 0 : t.indexOf(
|
3742
|
+
return this._partialBubble ? this._partialText && ((t = this._partialText) == null ? void 0 : t.indexOf(pe.PARTIAL_RENDER_TEXT_MARK)) > -1 : ((e = this._message) == null ? void 0 : e.text) && this._message.text.indexOf(pe.PARTIAL_RENDER_TEXT_MARK) > -1;
|
3735
3743
|
}
|
3736
3744
|
}, {
|
3737
3745
|
key: "partialRenderNewParagraph",
|
@@ -3757,7 +3765,7 @@ var Le = /*#__PURE__*/function () {
|
|
3757
3765
|
var e;
|
3758
3766
|
if (!(this._endStreamAfterOperation || !this._message) && !(this._fileAdded && !this._elements)) {
|
3759
3767
|
if (!this._elements) throw Error(k.NO_VALID_STREAM_EVENTS_SENT);
|
3760
|
-
(e = this._elements.bubbleElement) != null && e.classList.contains(
|
3768
|
+
(e = this._elements.bubbleElement) != null && e.classList.contains(pe.MESSAGE_CLASS) && (this._streamType === "text" ? this._messages.textToSpeech && gt.speak(this._message.text || "", this._messages.textToSpeech) : this._streamType === "html" && this._elements && X.apply(this._messages, this._elements.outerContainer), this._elements.bubbleElement.classList.remove(pe.MESSAGE_CLASS), this._message && (this._targetWrapper && (this._message.html = this._elements.bubbleElement.children[0].outerHTML, this._streamType === "text" && delete this._message.text), this._messages.sendClientUpdate(he.createMessageContent(this._message), !1)), this._hasStreamEnded = !0);
|
3761
3769
|
}
|
3762
3770
|
}
|
3763
3771
|
}, {
|
@@ -3775,7 +3783,7 @@ var Le = /*#__PURE__*/function () {
|
|
3775
3783
|
key: "endStreamAfterFileDownloaded",
|
3776
3784
|
value: function () {
|
3777
3785
|
var _endStreamAfterFileDownloaded = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e, t) {
|
3778
|
-
var
|
3786
|
+
var _yield$t, i, s;
|
3779
3787
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
3780
3788
|
while (1) switch (_context2.prev = _context2.next) {
|
3781
3789
|
case 0:
|
@@ -3786,7 +3794,7 @@ var Le = /*#__PURE__*/function () {
|
|
3786
3794
|
_yield$t = _context2.sent;
|
3787
3795
|
i = _yield$t.text;
|
3788
3796
|
s = _yield$t.files;
|
3789
|
-
i && this.updateBasedOnType(i, "text",
|
3797
|
+
i && this.updateBasedOnType(i, "text", !0), this._endStreamAfterOperation = !1, this.finaliseStreamedMessage(), s && e.addNewMessage({
|
3790
3798
|
files: s
|
3791
3799
|
});
|
3792
3800
|
case 7:
|
@@ -3802,13 +3810,13 @@ var Le = /*#__PURE__*/function () {
|
|
3802
3810
|
}()
|
3803
3811
|
}]);
|
3804
3812
|
}();
|
3805
|
-
|
3806
|
-
var
|
3807
|
-
var
|
3808
|
-
function
|
3809
|
-
_classCallCheck(this,
|
3813
|
+
pe.MESSAGE_CLASS = "streamed-message", pe.PARTIAL_RENDER_TEXT_MARK = "\n\n", pe.TARGET_WRAPPER_CLASS = "stream-wrapper";
|
3814
|
+
var Ae = pe;
|
3815
|
+
var qe = /*#__PURE__*/function () {
|
3816
|
+
function qe() {
|
3817
|
+
_classCallCheck(this, qe);
|
3810
3818
|
}
|
3811
|
-
return _createClass(
|
3819
|
+
return _createClass(qe, null, [{
|
3812
3820
|
key: "tempRemoveContentHeader",
|
3813
3821
|
value: // need to pass stringifyBody boolean separately as binding is throwing an error for some reason
|
3814
3822
|
// prettier-ignore
|
@@ -3824,8 +3832,8 @@ var He = /*#__PURE__*/function () {
|
|
3824
3832
|
}
|
3825
3833
|
throw new Error("Request settings have not been set up");
|
3826
3834
|
case 2:
|
3827
|
-
s = e.headers[
|
3828
|
-
delete e.headers[
|
3835
|
+
s = e.headers[qe.CONTENT_TYPE];
|
3836
|
+
delete e.headers[qe.CONTENT_TYPE];
|
3829
3837
|
_context3.prev = 4;
|
3830
3838
|
_context3.next = 7;
|
3831
3839
|
return t(i);
|
@@ -3836,9 +3844,9 @@ var He = /*#__PURE__*/function () {
|
|
3836
3844
|
case 10:
|
3837
3845
|
_context3.prev = 10;
|
3838
3846
|
_context3.t0 = _context3["catch"](4);
|
3839
|
-
throw e.headers[
|
3847
|
+
throw e.headers[qe.CONTENT_TYPE] = s, _context3.t0;
|
3840
3848
|
case 13:
|
3841
|
-
return _context3.abrupt("return", (e.headers[
|
3849
|
+
return _context3.abrupt("return", (e.headers[qe.CONTENT_TYPE] = s, r));
|
3842
3850
|
case 14:
|
3843
3851
|
case "end":
|
3844
3852
|
return _context3.stop();
|
@@ -3982,7 +3990,7 @@ var He = /*#__PURE__*/function () {
|
|
3982
3990
|
}
|
3983
3991
|
if (r) {
|
3984
3992
|
d = k.INVALID_RESPONSE(t, "response", !!a, l);
|
3985
|
-
|
3993
|
+
qe.displayError(e, d);
|
3986
3994
|
}
|
3987
3995
|
return _context5.abrupt("return");
|
3988
3996
|
case 17:
|
@@ -4000,8 +4008,8 @@ var He = /*#__PURE__*/function () {
|
|
4000
4008
|
}()
|
4001
4009
|
}]);
|
4002
4010
|
}();
|
4003
|
-
|
4004
|
-
var E =
|
4011
|
+
qe.CONTENT_TYPE = "Content-Type";
|
4012
|
+
var E = qe;
|
4005
4013
|
function Lo(_x14, _x15) {
|
4006
4014
|
return _Lo.apply(this, arguments);
|
4007
4015
|
}
|
@@ -4061,10 +4069,10 @@ function Io(n) {
|
|
4061
4069
|
};
|
4062
4070
|
}
|
4063
4071
|
function Oo(n, e, t) {
|
4064
|
-
var i =
|
4072
|
+
var i = $s();
|
4065
4073
|
var s = new TextDecoder();
|
4066
4074
|
return function (o, a) {
|
4067
|
-
if (o.length === 0) t == null || t(i), i =
|
4075
|
+
if (o.length === 0) t == null || t(i), i = $s();else if (a > 0) {
|
4068
4076
|
var l = s.decode(o.subarray(0, a)),
|
4069
4077
|
c = a + (o[a + 1] === 32 ? 2 : 1),
|
4070
4078
|
d = s.decode(o.subarray(c));
|
@@ -4090,7 +4098,7 @@ function Po(n, e) {
|
|
4090
4098
|
var t = new Uint8Array(n.length + e.length);
|
4091
4099
|
return t.set(n), t.set(e, n.length), t;
|
4092
4100
|
}
|
4093
|
-
function
|
4101
|
+
function $s() {
|
4094
4102
|
return {
|
4095
4103
|
data: "",
|
4096
4104
|
event: "",
|
@@ -4134,13 +4142,13 @@ function Bo(n, e) {
|
|
4134
4142
|
M(), u();
|
4135
4143
|
});
|
4136
4144
|
var Y = c !== null && c !== void 0 ? c : window.fetch,
|
4137
|
-
|
4145
|
+
He = s !== null && s !== void 0 ? s : Fo;
|
4138
4146
|
function ae() {
|
4139
4147
|
return _ae.apply(this, arguments);
|
4140
4148
|
}
|
4141
4149
|
function _ae() {
|
4142
4150
|
_ae = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
4143
|
-
var
|
4151
|
+
var Re, Ee, ie;
|
4144
4152
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
4145
4153
|
while (1) switch (_context6.prev = _context6.next) {
|
4146
4154
|
case 0:
|
@@ -4152,12 +4160,12 @@ function Bo(n, e) {
|
|
4152
4160
|
signal: m.signal
|
4153
4161
|
}));
|
4154
4162
|
case 4:
|
4155
|
-
|
4163
|
+
Ee = _context6.sent;
|
4156
4164
|
_context6.next = 7;
|
4157
|
-
return
|
4165
|
+
return He(Ee);
|
4158
4166
|
case 7:
|
4159
4167
|
_context6.next = 9;
|
4160
|
-
return Lo(
|
4168
|
+
return Lo(Ee.body, Io(Oo(function (ie) {
|
4161
4169
|
ie ? f[Js] = ie : delete f[Js];
|
4162
4170
|
}, function (ie) {
|
4163
4171
|
g = ie;
|
@@ -4172,7 +4180,7 @@ function Bo(n, e) {
|
|
4172
4180
|
_context6.prev = 14;
|
4173
4181
|
_context6.t0 = _context6["catch"](1);
|
4174
4182
|
if (!m.signal.aborted) try {
|
4175
|
-
ie = (
|
4183
|
+
ie = (Re = a == null ? void 0 : a(_context6.t0)) !== null && Re !== void 0 ? Re : g;
|
4176
4184
|
window.clearTimeout(b), b = window.setTimeout(ae, ie);
|
4177
4185
|
} catch (ie) {
|
4178
4186
|
M(), h(ie);
|
@@ -4243,15 +4251,15 @@ var A = /*#__PURE__*/function () {
|
|
4243
4251
|
_context7.next = 13;
|
4244
4252
|
break;
|
4245
4253
|
}
|
4246
|
-
return _context7.abrupt("return",
|
4254
|
+
return _context7.abrupt("return", ve.stream(e, a, i));
|
4247
4255
|
case 13:
|
4248
|
-
if (!(((p = e.connectSettings) == null ? void 0 : p.url) ===
|
4256
|
+
if (!(((p = e.connectSettings) == null ? void 0 : p.url) === ye.URL)) {
|
4249
4257
|
_context7.next = 15;
|
4250
4258
|
break;
|
4251
4259
|
}
|
4252
|
-
return _context7.abrupt("return",
|
4260
|
+
return _context7.abrupt("return", ye.requestStream(i, e));
|
4253
4261
|
case 15:
|
4254
|
-
d = new
|
4262
|
+
d = new Ae(i, e.stream), u = E.fetch.bind(this, e, l, s), h = {
|
4255
4263
|
method: ((g = e.connectSettings) == null ? void 0 : g.method) || "POST",
|
4256
4264
|
headers: l,
|
4257
4265
|
credentials: (b = e.connectSettings) == null ? void 0 : b.credentials,
|
@@ -4280,7 +4288,7 @@ var A = /*#__PURE__*/function () {
|
|
4280
4288
|
var u = !1;
|
4281
4289
|
fetch(((h = e.connectSettings) == null ? void 0 : h.url) || e.url || "", s).then(/*#__PURE__*/function () {
|
4282
4290
|
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(f) {
|
4283
|
-
var b, M, m, p, g, _yield$m$read, Y,
|
4291
|
+
var b, M, m, p, g, _yield$m$read, Y, He, ae, Re, Ee;
|
4284
4292
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
4285
4293
|
while (1) switch (_context8.prev = _context8.next) {
|
4286
4294
|
case 0:
|
@@ -4303,8 +4311,8 @@ var A = /*#__PURE__*/function () {
|
|
4303
4311
|
case 8:
|
4304
4312
|
_yield$m$read = _context8.sent;
|
4305
4313
|
Y = _yield$m$read.value;
|
4306
|
-
|
4307
|
-
if (!(g =
|
4314
|
+
He = _yield$m$read.done;
|
4315
|
+
if (!(g = He, g)) {
|
4308
4316
|
_context8.next = 15;
|
4309
4317
|
break;
|
4310
4318
|
}
|
@@ -4325,11 +4333,11 @@ var A = /*#__PURE__*/function () {
|
|
4325
4333
|
}
|
4326
4334
|
_context8.t0 = ae;
|
4327
4335
|
case 21:
|
4328
|
-
|
4329
|
-
|
4336
|
+
Re = _context8.t0;
|
4337
|
+
Ee = _typeof(Re) == "object" ? Re : {
|
4330
4338
|
text: ae
|
4331
4339
|
};
|
4332
|
-
A.handleMessage(e, t, i, c,
|
4340
|
+
A.handleMessage(e, t, i, c, Ee, o, a);
|
4333
4341
|
case 24:
|
4334
4342
|
_context8.next = 5;
|
4335
4343
|
break;
|
@@ -4499,13 +4507,13 @@ var A = /*#__PURE__*/function () {
|
|
4499
4507
|
case 10:
|
4500
4508
|
if (i.text) {
|
4501
4509
|
t.onOpen();
|
4502
|
-
_o2 = i.text.split(""), a = new
|
4510
|
+
_o2 = i.text.split(""), a = new Ae(e, s == null ? void 0 : s.stream);
|
4503
4511
|
A.populateMessages(e, _o2, a, r, "text", 0, s);
|
4504
4512
|
}
|
4505
4513
|
if (i.html) {
|
4506
4514
|
t.onOpen();
|
4507
4515
|
_o3 = X.splitHTML(i.html);
|
4508
|
-
_o3.length === 0 && (_o3 = i.html.split("")), A.populateMessages(e, _o3, new
|
4516
|
+
_o3.length === 0 && (_o3 = i.html.split("")), A.populateMessages(e, _o3, new Ae(e), r, "html", 0, s);
|
4509
4517
|
}
|
4510
4518
|
i.error && (E.displayError(e, i.error), t.onClose());
|
4511
4519
|
case 13:
|
@@ -4669,12 +4677,12 @@ var Ze = /*#__PURE__*/function () {
|
|
4669
4677
|
}]);
|
4670
4678
|
}();
|
4671
4679
|
Ze.URL = "deep-chat-demo";
|
4672
|
-
var
|
4673
|
-
var
|
4674
|
-
function
|
4675
|
-
_classCallCheck(this,
|
4680
|
+
var ye = Ze;
|
4681
|
+
var H = /*#__PURE__*/function () {
|
4682
|
+
function H() {
|
4683
|
+
_classCallCheck(this, H);
|
4676
4684
|
}
|
4677
|
-
return _createClass(
|
4685
|
+
return _createClass(H, null, [{
|
4678
4686
|
key: "setup",
|
4679
4687
|
value: function setup(e) {
|
4680
4688
|
e.permittedErrorPrefixes = ["Connection error", "Error in server message"], e.websocket = "pending";
|
@@ -4689,21 +4697,21 @@ var q = /*#__PURE__*/function () {
|
|
4689
4697
|
}, {
|
4690
4698
|
key: "createConnection",
|
4691
4699
|
value: function createConnection(e, t) {
|
4692
|
-
if (!
|
4700
|
+
if (!H.isElementPresentInDOM(e.deepChat)) return;
|
4693
4701
|
var i = e.connectSettings.websocket;
|
4694
4702
|
if (i) {
|
4695
|
-
if (e.connectSettings.handler) return
|
4703
|
+
if (e.connectSettings.handler) return ve.websocket(e, t);
|
4696
4704
|
try {
|
4697
4705
|
var s = typeof i != "boolean" ? i : void 0,
|
4698
4706
|
r = new WebSocket(e.connectSettings.url || "", s);
|
4699
4707
|
e.websocket = r, e.websocket.onopen = function () {
|
4700
4708
|
var o, a;
|
4701
|
-
t.removeError(), e.websocket && _typeof(e.websocket) == "object" &&
|
4709
|
+
t.removeError(), e.websocket && _typeof(e.websocket) == "object" && H.assignListeners(e, r, t), (a = (o = e.deepChat)._validationHandler) == null || a.call(o);
|
4702
4710
|
}, e.websocket.onerror = function (o) {
|
4703
|
-
console.error(o),
|
4711
|
+
console.error(o), H.retryConnection(e, t);
|
4704
4712
|
};
|
4705
4713
|
} catch (s) {
|
4706
|
-
console.error(s),
|
4714
|
+
console.error(s), H.retryConnection(e, t);
|
4707
4715
|
}
|
4708
4716
|
}
|
4709
4717
|
}
|
@@ -4711,8 +4719,8 @@ var q = /*#__PURE__*/function () {
|
|
4711
4719
|
key: "retryConnection",
|
4712
4720
|
value: function retryConnection(e, t) {
|
4713
4721
|
var i, s;
|
4714
|
-
(s = (i = e.deepChat)._validationHandler) == null || s.call(i),
|
4715
|
-
|
4722
|
+
(s = (i = e.deepChat)._validationHandler) == null || s.call(i), H.isElementPresentInDOM(e.deepChat) && (e.websocket = "pending", t.isLastMessageError() || t.addNewErrorMessage("service", "Connection error"), setTimeout(function () {
|
4723
|
+
H.createConnection(e, t);
|
4716
4724
|
}, 5e3));
|
4717
4725
|
}
|
4718
4726
|
}, {
|
@@ -4749,7 +4757,7 @@ var q = /*#__PURE__*/function () {
|
|
4749
4757
|
_context12.next = 13;
|
4750
4758
|
break;
|
4751
4759
|
}
|
4752
|
-
l =
|
4760
|
+
l = H.stream.bind(_this8, e, i, s), c = s[o.role || y.AI_ROLE];
|
4753
4761
|
A.upsertWFiles(i, l, c, a);
|
4754
4762
|
_context12.next = 17;
|
4755
4763
|
break;
|
@@ -4783,7 +4791,7 @@ var q = /*#__PURE__*/function () {
|
|
4783
4791
|
return _ref8.apply(this, arguments);
|
4784
4792
|
};
|
4785
4793
|
}(), t.onclose = function () {
|
4786
|
-
console.error("Connection closed"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error"), e.stream && e.streamHandlers.abortStream.abort(),
|
4794
|
+
console.error("Connection closed"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error"), e.stream && e.streamHandlers.abortStream.abort(), H.createConnection(e, i);
|
4787
4795
|
};
|
4788
4796
|
}
|
4789
4797
|
}, {
|
@@ -4804,11 +4812,11 @@ var q = /*#__PURE__*/function () {
|
|
4804
4812
|
while (1) switch (_context13.prev = _context13.next) {
|
4805
4813
|
case 0:
|
4806
4814
|
s = _args13.length > 3 && _args13[3] !== undefined ? _args13[3] : !0;
|
4807
|
-
if (!(((d = e.connectSettings) == null ? void 0 : d.url) ===
|
4815
|
+
if (!(((d = e.connectSettings) == null ? void 0 : d.url) === ye.URL)) {
|
4808
4816
|
_context13.next = 3;
|
4809
4817
|
break;
|
4810
4818
|
}
|
4811
|
-
return _context13.abrupt("return",
|
4819
|
+
return _context13.abrupt("return", ye.request(e, i));
|
4812
4820
|
case 3:
|
4813
4821
|
r = e.websocket;
|
4814
4822
|
if (!(!r || r === "pending")) {
|
@@ -4833,7 +4841,7 @@ var q = /*#__PURE__*/function () {
|
|
4833
4841
|
}
|
4834
4842
|
return _context13.abrupt("return", i.addNewErrorMessage("service", l));
|
4835
4843
|
case 14:
|
4836
|
-
if (
|
4844
|
+
if (H.isWebSocket(r)) {
|
4837
4845
|
_context13.next = 16;
|
4838
4846
|
break;
|
4839
4847
|
}
|
@@ -4855,7 +4863,7 @@ var q = /*#__PURE__*/function () {
|
|
4855
4863
|
}, {
|
4856
4864
|
key: "canSendMessage",
|
4857
4865
|
value: function canSendMessage(e) {
|
4858
|
-
return e ? e === "pending" ? !1 :
|
4866
|
+
return e ? e === "pending" ? !1 : H.isWebSocket(e) ? e.readyState !== void 0 && e.readyState === e.OPEN : e.isOpen : !0;
|
4859
4867
|
}
|
4860
4868
|
// if false then it is the internal websocket handler
|
4861
4869
|
}, {
|
@@ -4872,16 +4880,16 @@ var q = /*#__PURE__*/function () {
|
|
4872
4880
|
var _i$o;
|
4873
4881
|
var o = s.role || y.AI_ROLE,
|
4874
4882
|
a = i[o];
|
4875
|
-
s.text === r || s.html === r ? (a == null || a.finaliseStreamedMessage(), delete i[o]) : ((_i$o = i[o]) !== null && _i$o !== void 0 ? _i$o : i[o] = new
|
4883
|
+
s.text === r || s.html === r ? (a == null || a.finaliseStreamedMessage(), delete i[o]) : ((_i$o = i[o]) !== null && _i$o !== void 0 ? _i$o : i[o] = new Ae(t, e.stream), i[o].upsertStreamedMessage(s));
|
4876
4884
|
} else A.simulate(t, e.streamHandlers, s);
|
4877
4885
|
}
|
4878
4886
|
}]);
|
4879
4887
|
}();
|
4880
|
-
var
|
4881
|
-
function
|
4882
|
-
_classCallCheck(this,
|
4888
|
+
var ve = /*#__PURE__*/function () {
|
4889
|
+
function ve() {
|
4890
|
+
_classCallCheck(this, ve);
|
4883
4891
|
}
|
4884
|
-
return _createClass(
|
4892
|
+
return _createClass(ve, null, [{
|
4885
4893
|
key: "request",
|
4886
4894
|
value: function () {
|
4887
4895
|
var _request2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(e, t, i) {
|
@@ -4927,7 +4935,7 @@ var be = /*#__PURE__*/function () {
|
|
4927
4935
|
return function r(_x38) {
|
4928
4936
|
return _ref9.apply(this, arguments);
|
4929
4937
|
};
|
4930
|
-
}(), o =
|
4938
|
+
}(), o = ve.generateOptionalSignals();
|
4931
4939
|
(l = (a = e.connectSettings).handler) == null || l.call(a, t, _objectSpread(_objectSpread({}, o), {}, {
|
4932
4940
|
onResponse: r
|
4933
4941
|
}));
|
@@ -4959,12 +4967,12 @@ var be = /*#__PURE__*/function () {
|
|
4959
4967
|
var u, h;
|
4960
4968
|
var s = !0,
|
4961
4969
|
r = !1;
|
4962
|
-
var o = new
|
4970
|
+
var o = new Ae(i, e.stream),
|
4963
4971
|
a = function a() {
|
4964
4972
|
r || !s || (e.streamHandlers.onOpen(), r = !0);
|
4965
4973
|
},
|
4966
4974
|
l = function l() {
|
4967
|
-
s && (
|
4975
|
+
s && (ve.attemptToFinaliseStream(o, i), e.streamHandlers.onClose(), s = !1);
|
4968
4976
|
},
|
4969
4977
|
c = /*#__PURE__*/function () {
|
4970
4978
|
var _ref0 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(f) {
|
@@ -4985,9 +4993,9 @@ var be = /*#__PURE__*/function () {
|
|
4985
4993
|
});
|
4986
4994
|
case 4:
|
4987
4995
|
m = _context16.sent;
|
4988
|
-
if (m) m.error ? (
|
4996
|
+
if (m) m.error ? (ve.streamError(m.error, o, e, i), s = !1) : A.upsertWFiles(i, o.upsertStreamedMessage.bind(o), o, m);else {
|
4989
4997
|
p = k.INVALID_RESPONSE(f, "server", !!e.deepChat.responseInterceptor, m);
|
4990
|
-
|
4998
|
+
ve.streamError(p, o, e, i), s = !1;
|
4991
4999
|
}
|
4992
5000
|
case 6:
|
4993
5001
|
case "end":
|
@@ -5000,9 +5008,9 @@ var be = /*#__PURE__*/function () {
|
|
5000
5008
|
};
|
5001
5009
|
}();
|
5002
5010
|
e.streamHandlers.abortStream.abort = function () {
|
5003
|
-
|
5011
|
+
ve.attemptToFinaliseStream(o, i), e.streamHandlers.onClose(), s = !1;
|
5004
5012
|
};
|
5005
|
-
var d =
|
5013
|
+
var d = ve.generateOptionalSignals();
|
5006
5014
|
(h = (u = e.connectSettings).handler) == null || h.call(u, t, _objectSpread(_objectSpread({}, d), {}, {
|
5007
5015
|
onOpen: a,
|
5008
5016
|
onResponse: c,
|
@@ -5059,7 +5067,7 @@ var be = /*#__PURE__*/function () {
|
|
5059
5067
|
return typeof m.error == "string";
|
5060
5068
|
});
|
5061
5069
|
if (f) console.error(f.error), t.isLastMessageError() || t.addNewErrorMessage("service", f.error);else if (A.isSimulation(e.stream)) {
|
5062
|
-
m = u, p =
|
5070
|
+
m = u, p = H.stream.bind(_this9, e, t, i.roleToStream), g = i.roleToStream[m.role || y.AI_ROLE];
|
5063
5071
|
A.upsertWFiles(t, p, g, m);
|
5064
5072
|
} else h.forEach(function (m) {
|
5065
5073
|
return t.addNewMessage(m);
|
@@ -5075,7 +5083,7 @@ var be = /*#__PURE__*/function () {
|
|
5075
5083
|
return _ref1.apply(this, arguments);
|
5076
5084
|
};
|
5077
5085
|
}(),
|
5078
|
-
a =
|
5086
|
+
a = ve.generateOptionalSignals();
|
5079
5087
|
(c = (l = e.connectSettings).handler) == null || c.call(l, void 0, _objectSpread(_objectSpread({}, a), {}, {
|
5080
5088
|
onOpen: s,
|
5081
5089
|
onResponse: o,
|
@@ -5147,13 +5155,13 @@ var R = /*#__PURE__*/function () {
|
|
5147
5155
|
_context19.next = 13;
|
5148
5156
|
break;
|
5149
5157
|
}
|
5150
|
-
return _context19.abrupt("return",
|
5158
|
+
return _context19.abrupt("return", ve.request(e, o, i));
|
5151
5159
|
case 13:
|
5152
|
-
if (!(((m = e.connectSettings) == null ? void 0 : m.url) ===
|
5160
|
+
if (!(((m = e.connectSettings) == null ? void 0 : m.url) === ye.URL)) {
|
5153
5161
|
_context19.next = 15;
|
5154
5162
|
break;
|
5155
5163
|
}
|
5156
|
-
return _context19.abrupt("return",
|
5164
|
+
return _context19.abrupt("return", ye.request(e, i));
|
5157
5165
|
case 15:
|
5158
5166
|
d = !0;
|
5159
5167
|
u = E.fetch.bind(this, e, a, s);
|
@@ -5713,7 +5721,7 @@ var rt = /*#__PURE__*/function () {
|
|
5713
5721
|
var _a$url;
|
5714
5722
|
_classCallCheck(this, rt);
|
5715
5723
|
var s, r, o, a, l;
|
5716
|
-
this.rawBody = {}, this.validateKeyProperty = !1, this.canSendMessage = rt.canSendMessage, this.connectSettings = {}, this.fileTypes = {}, this.completionsHandlers = {}, this.streamHandlers = {}, this.deepChat = e, this.demo = i, Object.assign(this.rawBody, (s = e.connect) == null ? void 0 : s.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, B.set(e, this, t), e.connect && (this.connectSettings = e.connect), this.demo && ((_a$url = (a = this.connectSettings).url) !== null && _a$url !== void 0 ? _a$url : a.url =
|
5724
|
+
this.rawBody = {}, this.validateKeyProperty = !1, this.canSendMessage = rt.canSendMessage, this.connectSettings = {}, this.fileTypes = {}, this.completionsHandlers = {}, this.streamHandlers = {}, this.deepChat = e, this.demo = i, Object.assign(this.rawBody, (s = e.connect) == null ? void 0 : s.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, B.set(e, this, t), e.connect && (this.connectSettings = e.connect), this.demo && ((_a$url = (a = this.connectSettings).url) !== null && _a$url !== void 0 ? _a$url : a.url = ye.URL), this.connectSettings.websocket && H.setup(this), this.stream = ((l = this.deepChat.connect) == null ? void 0 : l.stream) || te.checkForStream(this.deepChat), e.loadHistory && ii.addErrorPrefix(this);
|
5717
5725
|
}
|
5718
5726
|
return _createClass(rt, [{
|
5719
5727
|
key: "verifyKey",
|
@@ -5843,11 +5851,11 @@ var rt = /*#__PURE__*/function () {
|
|
5843
5851
|
s = _ref14[0];
|
5844
5852
|
return s;
|
5845
5853
|
}), this.maxMessages, this.totalMessagesMaxCharLength);
|
5846
|
-
if (this.connectSettings.websocket && (!this.connectSettings.handler || this.connectSettings.url !==
|
5854
|
+
if (this.connectSettings.websocket && (!this.connectSettings.handler || this.connectSettings.url !== ye.URL)) {
|
5847
5855
|
s = _objectSpread({
|
5848
5856
|
messages: i
|
5849
5857
|
}, this.rawBody);
|
5850
|
-
|
5858
|
+
H.sendWebsocket(this, s, t, !1);
|
5851
5859
|
} else this.callServiceAPI(t, i, e.files);
|
5852
5860
|
case 4:
|
5853
5861
|
case "end":
|
@@ -6694,7 +6702,7 @@ var Xs = {
|
|
6694
6702
|
this.streamHandlers.abortStream.abort = function () {
|
6695
6703
|
i.interruptGenerate();
|
6696
6704
|
}, this.streamHandlers.onOpen();
|
6697
|
-
s = new
|
6705
|
+
s = new Ae(e);
|
6698
6706
|
_context39.next = 4;
|
6699
6707
|
return i.generate(t, /*#__PURE__*/function () {
|
6700
6708
|
var _ref15 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(r, o) {
|
@@ -7087,19 +7095,19 @@ var li = /*#__PURE__*/function (_je) {
|
|
7087
7095
|
}
|
7088
7096
|
}]);
|
7089
7097
|
}(je);
|
7090
|
-
var
|
7098
|
+
var Ho = /*#__PURE__*/function (_li) {
|
7091
7099
|
// prettier-ignore
|
7092
|
-
function
|
7093
|
-
_classCallCheck(this,
|
7100
|
+
function Ho(e) {
|
7101
|
+
_classCallCheck(this, Ho);
|
7094
7102
|
var s, r, o;
|
7095
7103
|
var t = (r = (s = e.directConnection) == null ? void 0 : s.huggingFace) == null ? void 0 : r.audioClassification,
|
7096
7104
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
7097
|
-
return _callSuper(this,
|
7105
|
+
return _callSuper(this, Ho, [e, "Attach an audio file", "ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition", t, i, {
|
7098
7106
|
audio: {}
|
7099
7107
|
}]);
|
7100
7108
|
}
|
7101
|
-
_inherits(
|
7102
|
-
return _createClass(
|
7109
|
+
_inherits(Ho, _li);
|
7110
|
+
return _createClass(Ho, [{
|
7103
7111
|
key: "extractPollResultData",
|
7104
7112
|
value: function () {
|
7105
7113
|
var _extractPollResultData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee46(e) {
|
@@ -7137,18 +7145,18 @@ var qo = /*#__PURE__*/function (_li) {
|
|
7137
7145
|
}()
|
7138
7146
|
}]);
|
7139
7147
|
}(li);
|
7140
|
-
var
|
7141
|
-
function
|
7142
|
-
_classCallCheck(this,
|
7148
|
+
var qo = /*#__PURE__*/function (_li2) {
|
7149
|
+
function qo(e) {
|
7150
|
+
_classCallCheck(this, qo);
|
7143
7151
|
var s, r, o;
|
7144
7152
|
var t = (r = (s = e.directConnection) == null ? void 0 : s.huggingFace) == null ? void 0 : r.imageClassification,
|
7145
7153
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
7146
|
-
return _callSuper(this,
|
7154
|
+
return _callSuper(this, qo, [e, "Attach an image file", "google/vit-base-patch16-224", t, i, {
|
7147
7155
|
images: {}
|
7148
7156
|
}]);
|
7149
7157
|
}
|
7150
|
-
_inherits(
|
7151
|
-
return _createClass(
|
7158
|
+
_inherits(qo, _li2);
|
7159
|
+
return _createClass(qo, [{
|
7152
7160
|
key: "extractPollResultData",
|
7153
7161
|
value: function () {
|
7154
7162
|
var _extractPollResultData2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee47(e) {
|
@@ -7187,11 +7195,11 @@ var Ho = /*#__PURE__*/function (_li2) {
|
|
7187
7195
|
}]);
|
7188
7196
|
}(li);
|
7189
7197
|
var ci = "data:image/png;base64,";
|
7190
|
-
var
|
7191
|
-
function
|
7192
|
-
_classCallCheck(this,
|
7198
|
+
var Ce = /*#__PURE__*/function () {
|
7199
|
+
function Ce() {
|
7200
|
+
_classCallCheck(this, Ce);
|
7193
7201
|
}
|
7194
|
-
return _createClass(
|
7202
|
+
return _createClass(Ce, null, [{
|
7195
7203
|
key: "buildHeaders",
|
7196
7204
|
value: function buildHeaders(e) {
|
7197
7205
|
return {
|
@@ -7211,7 +7219,7 @@ var Te = /*#__PURE__*/function () {
|
|
7211
7219
|
return {
|
7212
7220
|
url: "https://api.stability.ai/v1/engines/list",
|
7213
7221
|
method: "GET",
|
7214
|
-
handleVerificationResult:
|
7222
|
+
handleVerificationResult: Ce.handleVerificationResult
|
7215
7223
|
};
|
7216
7224
|
}
|
7217
7225
|
}]);
|
@@ -7242,7 +7250,7 @@ var wi = /*#__PURE__*/function (_zi) {
|
|
7242
7250
|
}
|
7243
7251
|
}
|
7244
7252
|
};
|
7245
|
-
_this24 = _callSuper(this, wi, [e,
|
7253
|
+
_this24 = _callSuper(this, wi, [e, Ce.buildKeyVerificationDetails(), Ce.buildHeaders, i, s]), _this24.url = "https://api.stability.ai/v1/generation/esrgan-v1-x2plus/image-to-image/upscale", _this24.textInputPlaceholderText = "Describe image changes", _this24.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI</b></div>\n <div style=\"width: 100%; text-align: center; margin-left: -10px; margin-top: 5px\"><b>Image to Image Upscale</b></div>\n <p>Upload an image to generate a new one with higher resolution.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
7246
7254
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageUpscale;
|
7247
7255
|
_typeof(r) == "object" && (r.engine_id && (_this24.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/upscale")), wi.cleanConfig(r), Object.assign(_this24.rawBody, r)), _this24.canSendMessage = wi.canSendFileMessage;
|
7248
7256
|
return _this24;
|
@@ -7349,7 +7357,7 @@ var Ai = /*#__PURE__*/function (_zi2) {
|
|
7349
7357
|
}
|
7350
7358
|
}
|
7351
7359
|
};
|
7352
|
-
_this25 = _callSuper(this, Ai, [e,
|
7360
|
+
_this25 = _callSuper(this, Ai, [e, Ce.buildKeyVerificationDetails(), Ce.buildHeaders, i, s]), _this25.url = "https://api.stability.ai/v1/generation/stable-diffusion-xl-1024-v1-0/image-to-image/masking", _this25._maskSource = "MASK_IMAGE_WHITE", _this25.textInputPlaceholderText = "Describe image changes", _this25.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI</b></div>\n <div style=\"width: 100%; text-align: center; margin-left: -10px; margin-top: 5px\"><b>Image to Image Masking</b></div>\n <p>Upload an image, its mask image to create a new one based on the changes you have described for the mask area.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
7353
7361
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageMasking;
|
7354
7362
|
_typeof(r) == "object" && (r.engine_id && (_this25.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/masking")), r.weight !== void 0 && r.weight !== null && (_this25._imageWeight = r.weight), r.mask_source !== void 0 && r.mask_source !== null && (_this25._maskSource = r.mask_source), Ai.cleanConfig(r), Object.assign(_this25.rawBody, r)), _this25.canSendMessage = Ai.canSendFileTextMessage;
|
7355
7363
|
return _this25;
|
@@ -7621,20 +7629,20 @@ var Ko = /*#__PURE__*/function (_je4) {
|
|
7621
7629
|
}()
|
7622
7630
|
}]);
|
7623
7631
|
}(je);
|
7624
|
-
var
|
7625
|
-
function
|
7632
|
+
var Wo = /*#__PURE__*/function (_je5) {
|
7633
|
+
function Wo(e) {
|
7626
7634
|
var _this27$maxMessages;
|
7627
7635
|
var _this27;
|
7628
|
-
_classCallCheck(this,
|
7636
|
+
_classCallCheck(this, Wo);
|
7629
7637
|
var s, r, o;
|
7630
7638
|
var t = (r = (s = e.directConnection) == null ? void 0 : s.huggingFace) == null ? void 0 : r.conversation,
|
7631
7639
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
7632
|
-
_this27 = _callSuper(this,
|
7640
|
+
_this27 = _callSuper(this, Wo, [e, "Ask me anything!", "facebook/blenderbot-400M-distill", t, i]), (_this27$maxMessages = _this27.maxMessages) !== null && _this27$maxMessages !== void 0 ? _this27$maxMessages : _this27.maxMessages = -1;
|
7633
7641
|
return _this27;
|
7634
7642
|
}
|
7635
7643
|
// prettier-ignore
|
7636
|
-
_inherits(
|
7637
|
-
return _createClass(
|
7644
|
+
_inherits(Wo, _je5);
|
7645
|
+
return _createClass(Wo, [{
|
7638
7646
|
key: "processMessages",
|
7639
7647
|
value: function processMessages(e) {
|
7640
7648
|
var t = e.filter(function (a) {
|
@@ -7718,7 +7726,7 @@ var Ti = /*#__PURE__*/function (_zi3) {
|
|
7718
7726
|
}
|
7719
7727
|
}
|
7720
7728
|
};
|
7721
|
-
_this28 = _callSuper(this, Ti, [e,
|
7729
|
+
_this28 = _callSuper(this, Ti, [e, Ce.buildKeyVerificationDetails(), Ce.buildHeaders, i, s]), _this28.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/image-to-image", _this28.textInputPlaceholderText = "Describe image changes", _this28.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI: Image to Image</b></div>\n <p>Upload an image to create a new one with the changes you have described.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
7722
7730
|
var r = (o = t.stabilityAI) == null ? void 0 : o.imageToImage;
|
7723
7731
|
_typeof(r) == "object" && (r.engine_id && (_this28.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/text-to-image")), r.weight !== void 0 && r.weight !== null && (_this28._imageWeight = r.weight), Ti.cleanConfig(r), Object.assign(_this28.rawBody, r)), _this28.canSendMessage = Ti.canSendFileTextMessage;
|
7724
7732
|
return _this28;
|
@@ -7810,16 +7818,16 @@ var Ti = /*#__PURE__*/function (_zi3) {
|
|
7810
7818
|
}
|
7811
7819
|
}]);
|
7812
7820
|
}(zi);
|
7813
|
-
var
|
7814
|
-
function
|
7815
|
-
_classCallCheck(this,
|
7821
|
+
var $o = /*#__PURE__*/function (_je6) {
|
7822
|
+
function $o(e) {
|
7823
|
+
_classCallCheck(this, $o);
|
7816
7824
|
var s, r, o;
|
7817
7825
|
var t = (r = (s = e.directConnection) == null ? void 0 : s.huggingFace) == null ? void 0 : r.translation,
|
7818
7826
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
7819
|
-
return _callSuper(this,
|
7827
|
+
return _callSuper(this, $o, [e, "Insert text to translate", "Helsinki-NLP/opus-tatoeba-en-ja", t, i]);
|
7820
7828
|
}
|
7821
|
-
_inherits(
|
7822
|
-
return _createClass(
|
7829
|
+
_inherits($o, _je6);
|
7830
|
+
return _createClass($o, [{
|
7823
7831
|
key: "extractResultData",
|
7824
7832
|
value: function () {
|
7825
7833
|
var _extractResultData9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee59(e) {
|
@@ -7856,7 +7864,7 @@ var Ci = /*#__PURE__*/function (_zi4) {
|
|
7856
7864
|
var r;
|
7857
7865
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
7858
7866
|
i = t.stabilityAI;
|
7859
|
-
_this29 = _callSuper(this, Ci, [e,
|
7867
|
+
_this29 = _callSuper(this, Ci, [e, Ce.buildKeyVerificationDetails(), Ce.buildHeaders, i]), _this29.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/text-to-image", _this29.textInputPlaceholderText = "Describe an image", _this29.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI: Text to Image</b></div>\n <p>Insert text to generate an image.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
7860
7868
|
var s = (r = t.stabilityAI) == null ? void 0 : r.textToImage;
|
7861
7869
|
_typeof(s) == "object" && (s.engine_id && (_this29.url = "https://api.stability.ai/v1/generation/".concat(s.engine_id, "/text-to-image")), s.weight !== void 0 && s.weight !== null && (_this29._imageWeight = s.weight), Ci.cleanConfig(s), Object.assign(_this29.rawBody, s)), _this29.canSendMessage = Ci.canSendTextMessage;
|
7862
7870
|
return _this29;
|
@@ -8366,7 +8374,7 @@ var ne = /*#__PURE__*/function () {
|
|
8366
8374
|
}]);
|
8367
8375
|
}();
|
8368
8376
|
ne.FILES_WITH_TEXT_ERROR = "content with type `text` must have `text` values", ne.FUNCTION_TOOL_RESP_ERROR = "Response must contain an array of strings for each individual function/tool_call, see https://deepchat.dev/docs/directConnection/OpenAI/#assistant-functions.";
|
8369
|
-
var
|
8377
|
+
var ke = ne;
|
8370
8378
|
var Ve = /*#__PURE__*/function (_V3) {
|
8371
8379
|
// prettier-ignore
|
8372
8380
|
function Ve(e, t, i, s, r, o) {
|
@@ -8439,7 +8447,7 @@ var Ve = /*#__PURE__*/function (_V3) {
|
|
8439
8447
|
if (r === "code_interpreter") return Ve.processAttachmentsMessage(s, t, "code_interpreter");
|
8440
8448
|
if (t.find(function (_ref21) {
|
8441
8449
|
var a = _ref21.name;
|
8442
|
-
return !
|
8450
|
+
return !q.isImageFileExtension(a);
|
8443
8451
|
})) console.error("The uploaded files contained a non-image file"), console.error('Make sure only images can be uploaded or define a "code_interpreter" or "file_search" value in the "files_tool_type" property'), console.warn('Make sure your existing assistant supports these "tools" or specify them in the "new_assistant" property');else {
|
8444
8452
|
var _a2 = Ve.processImageMessage(s, t);
|
8445
8453
|
if (_a2) return _a2;
|
@@ -8513,7 +8521,7 @@ var Ve = /*#__PURE__*/function (_V3) {
|
|
8513
8521
|
break;
|
8514
8522
|
}
|
8515
8523
|
_context74.next = 16;
|
8516
|
-
return
|
8524
|
+
return ke.storeFiles(this, e, i, this.urlSegments.storeFiles);
|
8517
8525
|
case 16:
|
8518
8526
|
_context74.t1 = _context74.sent;
|
8519
8527
|
_context74.next = 20;
|
@@ -8596,7 +8604,7 @@ var Ve = /*#__PURE__*/function (_V3) {
|
|
8596
8604
|
_context76.next = 6;
|
8597
8605
|
break;
|
8598
8606
|
}
|
8599
|
-
throw e.error.message.startsWith(
|
8607
|
+
throw e.error.message.startsWith(ke.FILES_WITH_TEXT_ERROR) ? Error("Please send text with your file(s)") : e.error.message;
|
8600
8608
|
case 6:
|
8601
8609
|
_context76.next = 8;
|
8602
8610
|
return this.assignThreadAndRun(e);
|
@@ -8680,7 +8688,7 @@ var Ve = /*#__PURE__*/function (_V3) {
|
|
8680
8688
|
case 9:
|
8681
8689
|
i = _context78.sent;
|
8682
8690
|
case 10:
|
8683
|
-
return _context78.abrupt("return",
|
8691
|
+
return _context78.abrupt("return", ke.processAPIMessages(this, i, t, this.urlSegments));
|
8684
8692
|
case 11:
|
8685
8693
|
case "end":
|
8686
8694
|
return _context78.stop();
|
@@ -8781,7 +8789,7 @@ var Ve = /*#__PURE__*/function (_V3) {
|
|
8781
8789
|
_context80.next = 8;
|
8782
8790
|
break;
|
8783
8791
|
}
|
8784
|
-
throw Error(
|
8792
|
+
throw Error(ke.FUNCTION_TOOL_RESP_ERROR);
|
8785
8793
|
case 8:
|
8786
8794
|
_context80.next = 10;
|
8787
8795
|
return Promise.all(i);
|
@@ -8793,7 +8801,7 @@ var Ve = /*#__PURE__*/function (_V3) {
|
|
8793
8801
|
_context80.next = 13;
|
8794
8802
|
break;
|
8795
8803
|
}
|
8796
|
-
throw Error(
|
8804
|
+
throw Error(ke.FUNCTION_TOOL_RESP_ERROR);
|
8797
8805
|
case 13:
|
8798
8806
|
r = s.map(function (l, c) {
|
8799
8807
|
return {
|
@@ -8898,7 +8906,7 @@ var Ve = /*#__PURE__*/function (_V3) {
|
|
8898
8906
|
}
|
8899
8907
|
l = e.content.find(function (d) {
|
8900
8908
|
return !!d.text;
|
8901
|
-
}) || e.content[0], c =
|
8909
|
+
}) || e.content[0], c = ke.getFilesAndText.bind(this, this, {
|
8902
8910
|
role: "assistant",
|
8903
8911
|
content: e.content
|
8904
8912
|
}, this.urlSegments, l);
|
@@ -8922,7 +8930,7 @@ var Ve = /*#__PURE__*/function (_V3) {
|
|
8922
8930
|
break;
|
8923
8931
|
}
|
8924
8932
|
_context82.next = 11;
|
8925
|
-
return
|
8933
|
+
return ke.processStreamMessages(this, e.delta.content, this.urlSegments);
|
8926
8934
|
case 11:
|
8927
8935
|
_l2 = _context82.sent;
|
8928
8936
|
return _context82.abrupt("return", {
|
@@ -8977,7 +8985,7 @@ var Ve = /*#__PURE__*/function (_V3) {
|
|
8977
8985
|
key: "processImageMessage",
|
8978
8986
|
value: function processImageMessage(e, t) {
|
8979
8987
|
var i = t == null ? void 0 : t.filter(function (s) {
|
8980
|
-
return
|
8988
|
+
return q.isImageFileExtension(s.name);
|
8981
8989
|
}).map(function (s) {
|
8982
8990
|
return {
|
8983
8991
|
type: "image_file",
|
@@ -9393,7 +9401,7 @@ var On = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg height=\"1.4em\"
|
|
9393
9401
|
}]);
|
9394
9402
|
}();
|
9395
9403
|
re.INPUT_BUTTON_SVG_TEXT_CLASS = "input-button-svg-text", re.INPUT_BUTTON_INNER_TEXT_CLASS = "text-button", re.INPUT_BUTTON_SVG_CLASS = "input-button-svg";
|
9396
|
-
var
|
9404
|
+
var Te = re;
|
9397
9405
|
var Gt = /*#__PURE__*/function () {
|
9398
9406
|
function Gt() {
|
9399
9407
|
_classCallCheck(this, Gt);
|
@@ -9507,7 +9515,7 @@ var ct = /*#__PURE__*/function () {
|
|
9507
9515
|
key: "changeElementsByState",
|
9508
9516
|
value: function changeElementsByState(e) {
|
9509
9517
|
var _this$elementRef;
|
9510
|
-
(_this$elementRef = this.elementRef).replaceChildren.apply(_this$elementRef, _toConsumableArray(e)),
|
9518
|
+
(_this$elementRef = this.elementRef).replaceChildren.apply(_this$elementRef, _toConsumableArray(e)), Te.reassignClassBasedOnChildren(this.elementRef, e);
|
9511
9519
|
}
|
9512
9520
|
}, {
|
9513
9521
|
key: "buildDefaultIconElement",
|
@@ -9518,7 +9526,7 @@ var ct = /*#__PURE__*/function () {
|
|
9518
9526
|
}, {
|
9519
9527
|
key: "createInnerElements",
|
9520
9528
|
value: function createInnerElements(e, t, i) {
|
9521
|
-
var s =
|
9529
|
+
var s = Te.createCustomElements(t, this.svg, i);
|
9522
9530
|
if (s && s.length > 0) {
|
9523
9531
|
if (this.position === "dropup-menu") {
|
9524
9532
|
var r = this.svg.cloneNode(!0);
|
@@ -9552,12 +9560,12 @@ var Ui = /*#__PURE__*/function (_ct) {
|
|
9552
9560
|
}, {
|
9553
9561
|
key: "createInnerButtonElements",
|
9554
9562
|
value: function createInnerButtonElements(e, t) {
|
9555
|
-
return
|
9563
|
+
return Te.createCustomElements(e, this.svg, t) || [this.svg];
|
9556
9564
|
}
|
9557
9565
|
}, {
|
9558
9566
|
key: "changeState",
|
9559
9567
|
value: function changeState(e) {
|
9560
|
-
this.changeElementsByState(e), this.elementRef.classList.replace(
|
9568
|
+
this.changeElementsByState(e), this.elementRef.classList.replace(Te.INPUT_BUTTON_SVG_CLASS, "deep-chat-openai-realtime-button");
|
9561
9569
|
}
|
9562
9570
|
}, {
|
9563
9571
|
key: "changeToActive",
|
@@ -10451,26 +10459,26 @@ var mt = /*#__PURE__*/function (_V6) {
|
|
10451
10459
|
}(V);
|
10452
10460
|
mt.DEFAULT_MODEL = "tts-1", mt.DEFAULT_VOIDE = "alloy";
|
10453
10461
|
var ds = mt;
|
10454
|
-
var
|
10455
|
-
function
|
10462
|
+
var me = /*#__PURE__*/function (_V7) {
|
10463
|
+
function me(e) {
|
10456
10464
|
var _o$model2;
|
10457
10465
|
var _this45;
|
10458
|
-
_classCallCheck(this,
|
10466
|
+
_classCallCheck(this, me);
|
10459
10467
|
var r, o;
|
10460
10468
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
10461
10469
|
i = t == null ? void 0 : t.openAI;
|
10462
|
-
_this45 = _callSuper(this,
|
10470
|
+
_this45 = _callSuper(this, me, [e, L.buildKeyVerificationDetails(), L.buildHeaders, i, {
|
10463
10471
|
audio: {}
|
10464
|
-
}]), _this45.insertKeyPlaceholderText = "OpenAI API Key", _this45.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this45.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>", _this45.url = "", _this45.permittedErrorPrefixes = ["Invalid"], _this45.textInputPlaceholderText = "Upload an audio file", _this45._service_url =
|
10472
|
+
}]), _this45.insertKeyPlaceholderText = "OpenAI API Key", _this45.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this45.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>", _this45.url = "", _this45.permittedErrorPrefixes = ["Invalid"], _this45.textInputPlaceholderText = "Upload an audio file", _this45._service_url = me.AUDIO_TRANSCRIPTIONS_URL;
|
10465
10473
|
var s = (r = t == null ? void 0 : t.openAI) == null ? void 0 : r.audio;
|
10466
|
-
_typeof(s) == "object" && (_this45.processConfig(s),
|
10474
|
+
_typeof(s) == "object" && (_this45.processConfig(s), me.cleanConfig(s), Object.assign(_this45.rawBody, s)), (_o$model2 = (o = _this45.rawBody).model) !== null && _o$model2 !== void 0 ? _o$model2 : o.model = me.DEFAULT_MODEL, _this45.rawBody.response_format = "json", _this45.canSendMessage = me.canSendFileMessage;
|
10467
10475
|
return _this45;
|
10468
10476
|
}
|
10469
|
-
_inherits(
|
10470
|
-
return _createClass(
|
10477
|
+
_inherits(me, _V7);
|
10478
|
+
return _createClass(me, [{
|
10471
10479
|
key: "processConfig",
|
10472
10480
|
value: function processConfig(e) {
|
10473
|
-
e != null && e.type && e.type === "translation" && (this._service_url =
|
10481
|
+
e != null && e.type && e.type === "translation" && (this._service_url = me.AUDIO_TRANSLATIONS_URL, delete e.language);
|
10474
10482
|
}
|
10475
10483
|
}, {
|
10476
10484
|
key: "preprocessBody",
|
@@ -10502,7 +10510,7 @@ var pe = /*#__PURE__*/function (_V7) {
|
|
10502
10510
|
throw new Error("No file was added");
|
10503
10511
|
case 4:
|
10504
10512
|
this.url = this.connectSettings.url || this._service_url;
|
10505
|
-
s = this.preprocessBody(this.rawBody, t), r =
|
10513
|
+
s = this.preprocessBody(this.rawBody, t), r = me.createFormDataBody(s, i[0]);
|
10506
10514
|
E.tempRemoveContentHeader(this.connectSettings, R.request.bind(this, this, r, e), !1);
|
10507
10515
|
case 7:
|
10508
10516
|
case "end":
|
@@ -10562,8 +10570,8 @@ var pe = /*#__PURE__*/function (_V7) {
|
|
10562
10570
|
}
|
10563
10571
|
}]);
|
10564
10572
|
}(V);
|
10565
|
-
|
10566
|
-
var hs =
|
10573
|
+
me.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions", me.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations", me.DEFAULT_MODEL = "whisper-1";
|
10574
|
+
var hs = me;
|
10567
10575
|
var fe = /*#__PURE__*/function () {
|
10568
10576
|
function fe() {
|
10569
10577
|
_classCallCheck(this, fe);
|
@@ -11639,10 +11647,10 @@ var Ts = /*#__PURE__*/function (_bt) {
|
|
11639
11647
|
}
|
11640
11648
|
}]);
|
11641
11649
|
}(bt);
|
11642
|
-
var
|
11643
|
-
function
|
11650
|
+
var ge = /*#__PURE__*/function (_V11) {
|
11651
|
+
function ge(e) {
|
11644
11652
|
var _this56;
|
11645
|
-
_classCallCheck(this,
|
11653
|
+
_classCallCheck(this, ge);
|
11646
11654
|
var o;
|
11647
11655
|
var t = e.directConnection,
|
11648
11656
|
i = t == null ? void 0 : t.openAI,
|
@@ -11654,7 +11662,7 @@ var me = /*#__PURE__*/function (_V11) {
|
|
11654
11662
|
}
|
11655
11663
|
}
|
11656
11664
|
};
|
11657
|
-
_this56 = _callSuper(this,
|
11665
|
+
_this56 = _callSuper(this, ge, [e, L.buildKeyVerificationDetails(), L.buildHeaders, i, s]), _this56.insertKeyPlaceholderText = "OpenAI API Key", _this56.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this56.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI DALL\xB7E</b></div>\n <p><b>Insert text</b> to generate an image.</p>\n <p><b>Upload 1</b> PNG image to generate its variation and optionally insert text to specify the change.</p>\n <p><b>Upload 2</b> PNG images where the second is a copy of the first with a transparent area where the edit should\n take place and text to specify the edit.</p>\n <p>Click <a href=\"https://platform.openai.com/docs/guides/images/introduction\">here</a> for more info.</p>", _this56.url = "", _this56.permittedErrorPrefixes = ["Incorrect", "Invalid input image"];
|
11658
11666
|
var r = (o = t == null ? void 0 : t.openAI) == null ? void 0 : o.images;
|
11659
11667
|
if (_this56.camera) {
|
11660
11668
|
var a = _typeof(r) == "object" && r.size ? Number.parseInt(r.size) : 1024;
|
@@ -11665,11 +11673,11 @@ var me = /*#__PURE__*/function (_V11) {
|
|
11665
11673
|
}
|
11666
11674
|
};
|
11667
11675
|
}
|
11668
|
-
_typeof(r) == "object" && Object.assign(_this56.rawBody, r), _this56.canSendMessage =
|
11676
|
+
_typeof(r) == "object" && Object.assign(_this56.rawBody, r), _this56.canSendMessage = ge.canFileSendMessage;
|
11669
11677
|
return _this56;
|
11670
11678
|
}
|
11671
|
-
_inherits(
|
11672
|
-
return _createClass(
|
11679
|
+
_inherits(ge, _V11);
|
11680
|
+
return _createClass(ge, [{
|
11673
11681
|
key: "preprocessBody",
|
11674
11682
|
value: function preprocessBody(e, t) {
|
11675
11683
|
var i = JSON.parse(JSON.stringify(e));
|
@@ -11683,10 +11691,10 @@ var me = /*#__PURE__*/function (_V11) {
|
|
11683
11691
|
var s;
|
11684
11692
|
var r = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim();
|
11685
11693
|
if (i[1] || r && r !== "") {
|
11686
|
-
this.url =
|
11694
|
+
this.url = ge.IMAGE_EDIT_URL;
|
11687
11695
|
var l = this.preprocessBody(this.rawBody, r);
|
11688
|
-
s =
|
11689
|
-
} else this.url =
|
11696
|
+
s = ge.createFormDataBody(l, i[0], i[1]);
|
11697
|
+
} else this.url = ge.IMAGE_VARIATIONS_URL, s = ge.createFormDataBody(this.rawBody, i[0]);
|
11690
11698
|
E.tempRemoveContentHeader(this.connectSettings, R.request.bind(this, this, s, e), !1);
|
11691
11699
|
}
|
11692
11700
|
}, {
|
@@ -11717,7 +11725,7 @@ var me = /*#__PURE__*/function (_V11) {
|
|
11717
11725
|
}
|
11718
11726
|
throw new Error("Request settings have not been set up");
|
11719
11727
|
case 8:
|
11720
|
-
this.url =
|
11728
|
+
this.url = ge.IMAGE_GENERATION_URL;
|
11721
11729
|
r = this.preprocessBody(this.rawBody, t[t.length - 1].text);
|
11722
11730
|
R.request(this, r, e);
|
11723
11731
|
case 11:
|
@@ -11789,8 +11797,8 @@ var me = /*#__PURE__*/function (_V11) {
|
|
11789
11797
|
}
|
11790
11798
|
}]);
|
11791
11799
|
}(V);
|
11792
|
-
|
11793
|
-
var ms =
|
11800
|
+
ge.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations", ge.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations", ge.IMAGE_EDIT_URL = "https://api.openai.com/v1/images/edits";
|
11801
|
+
var ms = ge;
|
11794
11802
|
var ea = /*#__PURE__*/function (_ws3) {
|
11795
11803
|
function ea(e) {
|
11796
11804
|
var _this57$maxMessages;
|
@@ -12010,7 +12018,7 @@ var ia = /*#__PURE__*/function () {
|
|
12010
12018
|
if (t.openAI) return t.openAI.images ? new ms(e) : t.openAI.speechToText ? new hs(e) : t.openAI.textToSpeech ? new ds(e) : t.openAI.assistant ? new xs(e) : t.openAI.realtime ? new cs(e) : new bt(e);
|
12011
12019
|
if (t.assemblyAI) return new As(e);
|
12012
12020
|
if (t.cohere) return t.cohere.textGeneration ? new Xo(e) : t.cohere.summarization ? new Yo(e) : new ea(e);
|
12013
|
-
if (t.huggingFace) return t.huggingFace.textGeneration ? new Go(e) : t.huggingFace.summarization ? new Ko(e) : t.huggingFace.translation ? new
|
12021
|
+
if (t.huggingFace) return t.huggingFace.textGeneration ? new Go(e) : t.huggingFace.summarization ? new Ko(e) : t.huggingFace.translation ? new $o(e) : t.huggingFace.fillMask ? new Jo(e) : t.huggingFace.questionAnswer ? new Vo(e) : t.huggingFace.audioSpeechRecognition ? new zo(e) : t.huggingFace.audioClassification ? new Ho(e) : t.huggingFace.imageClassification ? new qo(e) : new Wo(e);
|
12014
12022
|
if (t.azure) {
|
12015
12023
|
if (t.azure.openAI) {
|
12016
12024
|
if (t.azure.openAI.chat) return new Ts(e);
|
@@ -12096,23 +12104,23 @@ var Oi = /*#__PURE__*/function () {
|
|
12096
12104
|
}]);
|
12097
12105
|
}();
|
12098
12106
|
var sa = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" \n\t viewBox=\"50 30 420 450\" xml:space=\"preserve\">\n<g filter=\"brightness(0) saturate(100%) invert(16%) sepia(0%) saturate(1942%) hue-rotate(215deg) brightness(99%) contrast(93%)\">\n\t<g>\n\t\t<path d=\"M447.933,103.629c-0.034-3.076-1.224-6.09-3.485-8.352L352.683,3.511c-0.004-0.004-0.007-0.005-0.011-0.008\n\t\t\tC350.505,1.338,347.511,0,344.206,0H89.278C75.361,0,64.04,11.32,64.04,25.237v461.525c0,13.916,11.32,25.237,25.237,25.237\n\t\t\th333.444c13.916,0,25.237-11.32,25.237-25.237V103.753C447.96,103.709,447.937,103.672,447.933,103.629z M356.194,40.931\n\t\t\tl50.834,50.834h-49.572c-0.695,0-1.262-0.567-1.262-1.262V40.931z M423.983,486.763c0,0.695-0.566,1.261-1.261,1.261H89.278\n\t\t\tc-0.695,0-1.261-0.566-1.261-1.261V25.237c0-0.695,0.566-1.261,1.261-1.261h242.94v66.527c0,13.916,11.322,25.239,25.239,25.239\n\t\t\th66.527V486.763z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,164.014H149.912c-6.62,0-11.988,5.367-11.988,11.988c0,6.62,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.368,11.988-11.988C374.076,169.381,368.707,164.014,362.088,164.014z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,236.353H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.62,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.368,11.988-11.988C374.076,241.721,368.707,236.353,362.088,236.353z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,308.691H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.621,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.367,11.988-11.988C374.076,314.06,368.707,308.691,362.088,308.691z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M256,381.031H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.621,5.368,11.988,11.988,11.988H256\n\t\t\tc6.62,0,11.988-5.367,11.988-11.988C267.988,386.398,262.62,381.031,256,381.031z\"/>\n\t</g>\n</g>\n</svg>",
|
12099
|
-
|
12100
|
-
function
|
12101
|
-
_classCallCheck(this,
|
12107
|
+
$ = /*#__PURE__*/function () {
|
12108
|
+
function $() {
|
12109
|
+
_classCallCheck(this, $);
|
12102
12110
|
}
|
12103
|
-
return _createClass(
|
12111
|
+
return _createClass($, null, [{
|
12104
12112
|
key: "createImage",
|
12105
12113
|
value: function createImage(e, t, i) {
|
12106
12114
|
var s = new Image();
|
12107
|
-
return s.src = e.src, i &&
|
12115
|
+
return s.src = e.src, i && q.scrollDownOnImageLoad(s.src, t), q.processContent("image", s, s.src, e.name);
|
12108
12116
|
}
|
12109
12117
|
// WORK - image still does not scroll down when loaded
|
12110
12118
|
}, {
|
12111
12119
|
key: "createImageMessage",
|
12112
12120
|
value: function createImageMessage(e, t, i, s) {
|
12113
|
-
var r =
|
12121
|
+
var r = $.createImage(t, e.elementRef, !s && !e.focusMode),
|
12114
12122
|
o = e.createNewMessageElement("", i);
|
12115
|
-
return o.bubbleElement.appendChild(r), o.bubbleElement.classList.add(
|
12123
|
+
return o.bubbleElement.appendChild(r), o.bubbleElement.classList.add($.IMAGE_BUBBLE_CLASS), {
|
12116
12124
|
type: "image",
|
12117
12125
|
elements: o
|
12118
12126
|
};
|
@@ -12126,9 +12134,9 @@ var sa = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg version=\"1.1\"
|
|
12126
12134
|
}, {
|
12127
12135
|
key: "createNewAudioMessage",
|
12128
12136
|
value: function createNewAudioMessage(e, t, i, s) {
|
12129
|
-
var r =
|
12137
|
+
var r = $.createAudioElement(t, i),
|
12130
12138
|
o = e.createMessageElementsOnOrientation("", i, s);
|
12131
|
-
return o.bubbleElement.appendChild(r), o.bubbleElement.classList.add(
|
12139
|
+
return o.bubbleElement.appendChild(r), o.bubbleElement.classList.add($.AUDIO_BUBBLE_CLASS), {
|
12132
12140
|
type: "audio",
|
12133
12141
|
elements: o
|
12134
12142
|
};
|
@@ -12143,14 +12151,14 @@ var sa = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg version=\"1.1\"
|
|
12143
12151
|
var s = Ue.createSVGElement(sa);
|
12144
12152
|
s.classList.add("any-file-message-icon"), i.appendChild(s);
|
12145
12153
|
var r = document.createElement("div");
|
12146
|
-
return r.classList.add("any-file-message-text"), r.textContent = e.name ||
|
12154
|
+
return r.classList.add("any-file-message-text"), r.textContent = e.name || q.DEFAULT_FILE_NAME, t.appendChild(i), t.appendChild(r), q.processContent("any", t, e.src, r.textContent);
|
12147
12155
|
}
|
12148
12156
|
}, {
|
12149
12157
|
key: "createNewAnyFileMessage",
|
12150
12158
|
value: function createNewAnyFileMessage(e, t, i, s) {
|
12151
12159
|
var r = e.createMessageElementsOnOrientation("", i, s),
|
12152
|
-
o =
|
12153
|
-
return r.bubbleElement.classList.add(
|
12160
|
+
o = $.createAnyFile(t);
|
12161
|
+
return r.bubbleElement.classList.add($.ANY_FILE_BUBBLE_CLASS), r.bubbleElement.appendChild(o), {
|
12154
12162
|
type: "file",
|
12155
12163
|
elements: r
|
12156
12164
|
};
|
@@ -12160,23 +12168,23 @@ var sa = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg version=\"1.1\"
|
|
12160
12168
|
value: function createMessages(e, t, i) {
|
12161
12169
|
var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
|
12162
12170
|
return t.map(function (r) {
|
12163
|
-
return r.ref && (r =
|
12171
|
+
return r.ref && (r = q.removeFileRef(r)), q.isAudioFile(r) ? $.createNewAudioMessage(e, r, i, s) : q.isImageFile(r) ? $.createImageMessage(e, r, i, s) : $.createNewAnyFileMessage(e, r, i, s);
|
12164
12172
|
});
|
12165
12173
|
}
|
12166
12174
|
// no overwrite previous message logic as it is complex to track which files are to be overwritten
|
12167
12175
|
}, {
|
12168
12176
|
key: "addMessages",
|
12169
12177
|
value: function addMessages(e, t, i, s) {
|
12170
|
-
|
12178
|
+
$.createMessages(e, t, i, s).forEach(function (_ref32) {
|
12171
12179
|
var o = _ref32.type,
|
12172
12180
|
a = _ref32.elements;
|
12173
|
-
|
12181
|
+
q.addMessage(e, a, o, i, s);
|
12174
12182
|
});
|
12175
12183
|
}
|
12176
12184
|
}]);
|
12177
12185
|
}();
|
12178
|
-
|
12179
|
-
var Pi =
|
12186
|
+
$.IMAGE_BUBBLE_CLASS = "image-message", $.AUDIO_BUBBLE_CLASS = "audio-message", $.ANY_FILE_BUBBLE_CLASS = "any-file-message";
|
12187
|
+
var Pi = $;
|
12180
12188
|
var le = /*#__PURE__*/function () {
|
12181
12189
|
function le() {
|
12182
12190
|
_classCallCheck(this, le);
|
@@ -12208,8 +12216,8 @@ var le = /*#__PURE__*/function () {
|
|
12208
12216
|
key: "updateHTMLMessage",
|
12209
12217
|
value: function updateHTMLMessage(e, t, i) {
|
12210
12218
|
var s, r, o;
|
12211
|
-
if (t[1].html)
|
12212
|
-
var a =
|
12219
|
+
if (t[1].html) xe.overwriteElements(e, i, t[1].html);else {
|
12220
|
+
var a = xe.create(e, i, t[0].role),
|
12213
12221
|
l = ((r = t[1].files) == null ? void 0 : r[((s = t[1].files) == null ? void 0 : s.length) - 1]) || t[1].text,
|
12214
12222
|
c = l.outerContainer.nextSibling;
|
12215
12223
|
(o = c == null ? void 0 : c.parentElement) == null || o.insertBefore(a.outerContainer, c), e.messageElementRefs.splice(e.messageElementRefs.length - 1, 1);
|
@@ -12239,7 +12247,7 @@ var le = /*#__PURE__*/function () {
|
|
12239
12247
|
var f = _ref33.type,
|
12240
12248
|
m = _ref33.elements;
|
12241
12249
|
var g;
|
12242
|
-
|
12250
|
+
q.setElementProps(e, m, f, s), (g = d.parentElement) == null || g.insertBefore(m.outerContainer, d), e.messageElementRefs.splice(e.messageElementRefs.length - 1, 1), e.messageElementRefs.splice(c + p, 0, m);
|
12243
12251
|
}), le.removeFilesMessages(e, t), t[1].files = r.map(function (_ref34) {
|
12244
12252
|
var f = _ref34.elements;
|
12245
12253
|
return f;
|
@@ -12377,7 +12385,7 @@ var de = /*#__PURE__*/function (_he) {
|
|
12377
12385
|
value: function addIntroductoryMessage(e, t) {
|
12378
12386
|
var s;
|
12379
12387
|
var i;
|
12380
|
-
return e != null && e.text ? i = this.createAndAppendNewMessageElement(e.text, y.AI_ROLE) : e != null && e.html && (i =
|
12388
|
+
return e != null && e.text ? i = this.createAndAppendNewMessageElement(e.text, y.AI_ROLE) : e != null && e.html && (i = xe.add(this, e.html, y.AI_ROLE)), i && (this.applyCustomStyles(i, y.AI_ROLE, !1, (s = this.messageStyles) == null ? void 0 : s.intro), i.outerContainer.classList.add(he.INTRO_CLASS), t && (i.outerContainer.style.display = "none")), i;
|
12381
12389
|
}
|
12382
12390
|
}, {
|
12383
12391
|
key: "removeIntroductoryMessage",
|
@@ -12410,8 +12418,8 @@ var de = /*#__PURE__*/function (_he) {
|
|
12410
12418
|
value: function tryAddHTMLMessage(e, t) {
|
12411
12419
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
|
12412
12420
|
if (e.html !== void 0 && e.html !== null) {
|
12413
|
-
var s =
|
12414
|
-
i &&
|
12421
|
+
var s = xe.add(this, e.html, e.role, t, i);
|
12422
|
+
i && _e.isElementTemporary(s) && delete e.html;
|
12415
12423
|
}
|
12416
12424
|
}
|
12417
12425
|
// this should not be activated by streamed messages
|
@@ -12450,7 +12458,7 @@ var de = /*#__PURE__*/function (_he) {
|
|
12450
12458
|
value: function removeMessageOnError() {
|
12451
12459
|
var e = this.messageElementRefs[this.messageElementRefs.length - 1],
|
12452
12460
|
t = e == null ? void 0 : e.bubbleElement;
|
12453
|
-
(t != null && t.classList.contains(
|
12461
|
+
(t != null && t.classList.contains(Ae.MESSAGE_CLASS) && t.textContent === "" || de.isTemporaryElement(e)) && this.removeLastMessage();
|
12454
12462
|
}
|
12455
12463
|
// prettier-ignore
|
12456
12464
|
}, {
|
@@ -12510,7 +12518,7 @@ var de = /*#__PURE__*/function (_he) {
|
|
12510
12518
|
var t = this.messageElementRefs[this.messageElementRefs.length - 1];
|
12511
12519
|
if (he.isLoadingMessage(t) || !e && !this._isLoadingMessageAllowed) return;
|
12512
12520
|
var i = (a = (o = (r = this.messageStyles) == null ? void 0 : r.loading) == null ? void 0 : o.message) == null ? void 0 : a.html,
|
12513
|
-
s = i ?
|
12521
|
+
s = i ? xe.createElements(this, i, y.AI_ROLE, !1) : this.addDefaultLoadingMessage();
|
12514
12522
|
this.appendOuterContainerElemet(s.outerContainer), s.bubbleElement.classList.add(De.BUBBLE_CLASS), this.applyCustomStyles(s, y.AI_ROLE, !1, (d = (c = (l = this.messageStyles) == null ? void 0 : l.loading) == null ? void 0 : c.message) == null ? void 0 : d.styles), this.focusMode || G.scrollToBottom(this.elementRef);
|
12515
12523
|
}
|
12516
12524
|
}, {
|
@@ -12528,7 +12536,7 @@ var de = /*#__PURE__*/function (_he) {
|
|
12528
12536
|
return _context122.abrupt("return", (this._hiddenAttachments = t, Promise.all((e || []).map(function (i) {
|
12529
12537
|
return new Promise(function (s) {
|
12530
12538
|
if (!i.type || i.type === "any") {
|
12531
|
-
var r = i.file.name ||
|
12539
|
+
var r = i.file.name || q.DEFAULT_FILE_NAME;
|
12532
12540
|
s({
|
12533
12541
|
name: r,
|
12534
12542
|
type: "any",
|
@@ -12596,7 +12604,7 @@ var de = /*#__PURE__*/function (_he) {
|
|
12596
12604
|
}, {
|
12597
12605
|
key: "isActiveElement",
|
12598
12606
|
value: function isActiveElement(e) {
|
12599
|
-
return e ? e.contains(De.BUBBLE_CLASS) || e.contains(Fe.CLASS) || e.contains(
|
12607
|
+
return e ? e.contains(De.BUBBLE_CLASS) || e.contains(Fe.CLASS) || e.contains(Ae.MESSAGE_CLASS) : !1;
|
12600
12608
|
}
|
12601
12609
|
}]);
|
12602
12610
|
}(he);
|
@@ -12680,7 +12688,7 @@ var Ys = ["camera", "gifs", "images", "audio", "mixedFiles", "submit", "micropho
|
|
12680
12688
|
return _createClass(Q, null, [{
|
12681
12689
|
key: "addItemEvents",
|
12682
12690
|
value: function addItemEvents(e, t, i, s) {
|
12683
|
-
|
12691
|
+
We.add(t, s), t.addEventListener("click", function () {
|
12684
12692
|
i.click();
|
12685
12693
|
}), t.addEventListener("mouseenter", function (r) {
|
12686
12694
|
e.highlightedItem = r.target;
|
@@ -12712,7 +12720,7 @@ var Ys = ["camera", "gifs", "images", "audio", "mixedFiles", "submit", "micropho
|
|
12712
12720
|
var u;
|
12713
12721
|
return ((u = d.svg) == null ? void 0 : u.content) === "";
|
12714
12722
|
});
|
12715
|
-
l.classList.contains(
|
12723
|
+
l.classList.contains(Te.INPUT_BUTTON_INNER_TEXT_CLASS) ? (c || t.appendChild(Q.createItemIcon(o, i == null ? void 0 : i.iconContainer)), t.appendChild(Q.createItemText(l.textContent, i == null ? void 0 : i.text))) : (c || t.appendChild(Q.createItemIcon(s.children[0], i == null ? void 0 : i.iconContainer)), t.appendChild(Q.createItemText(r, i == null ? void 0 : i.text)));
|
12716
12724
|
}
|
12717
12725
|
}, {
|
12718
12726
|
key: "createItem",
|
@@ -12730,7 +12738,7 @@ var Ys = ["camera", "gifs", "images", "audio", "mixedFiles", "submit", "micropho
|
|
12730
12738
|
}]);
|
12731
12739
|
}();
|
12732
12740
|
Q.MENU_ITEM_CLASS = "dropup-menu-item", Q.TEXT_CLASS = "dropup-menu-item-text", Q.ICON_CLASS = "dropup-menu-item-icon";
|
12733
|
-
var
|
12741
|
+
var Se = Q;
|
12734
12742
|
var O = /*#__PURE__*/function (_ct2) {
|
12735
12743
|
function O(e, t, i, s) {
|
12736
12744
|
var _this62;
|
@@ -12782,13 +12790,13 @@ var O = /*#__PURE__*/function (_ct2) {
|
|
12782
12790
|
var t = Array.from(this.elementRef.children);
|
12783
12791
|
if (e != null && e.text) {
|
12784
12792
|
var _i8 = t.find(function (s) {
|
12785
|
-
return s.classList.contains(
|
12793
|
+
return s.classList.contains(Se.TEXT_CLASS);
|
12786
12794
|
});
|
12787
12795
|
_i8 && Object.assign(_i8.style, e.text);
|
12788
12796
|
}
|
12789
12797
|
if (e != null && e.iconContainer) {
|
12790
12798
|
var _i9 = t.find(function (s) {
|
12791
|
-
return s.classList.contains(
|
12799
|
+
return s.classList.contains(Se.ICON_CLASS);
|
12792
12800
|
});
|
12793
12801
|
_i9 && Object.assign(_i9.style, e.iconContainer);
|
12794
12802
|
}
|
@@ -12797,7 +12805,7 @@ var O = /*#__PURE__*/function (_ct2) {
|
|
12797
12805
|
key: "resetDropupItem",
|
12798
12806
|
value: function resetDropupItem(e) {
|
12799
12807
|
var i, s, r;
|
12800
|
-
this.elementRef = X.replaceElementWithNewClone(this.elementRef, this._originalElementRef), this.elementRef.innerHTML = "", ((i = e == null ? void 0 : e.svg) == null ? void 0 : i.content) === "" || this.elementRef.appendChild(
|
12808
|
+
this.elementRef = X.replaceElementWithNewClone(this.elementRef, this._originalElementRef), this.elementRef.innerHTML = "", ((i = e == null ? void 0 : e.svg) == null ? void 0 : i.content) === "" || this.elementRef.appendChild(Se.createItemIcon(this.svg, (s = this._menuStyles) == null ? void 0 : s.iconContainer)), this.elementRef.appendChild(Se.createItemText(this.dropupText, (r = this._menuStyles) == null ? void 0 : r.text));
|
12801
12809
|
}
|
12802
12810
|
}, {
|
12803
12811
|
key: "assignDropupItemStyle",
|
@@ -12805,25 +12813,25 @@ var O = /*#__PURE__*/function (_ct2) {
|
|
12805
12813
|
var s;
|
12806
12814
|
this.elementRef.parentElement && this._originalElementRef && this.resetDropupItem(t), this.applyDropupContentStyles(e), Object.assign(this.elementRef.style, (s = e == null ? void 0 : e.item) == null ? void 0 : s["default"]);
|
12807
12815
|
var i = I.processStateful((e == null ? void 0 : e.item) || {});
|
12808
|
-
|
12816
|
+
We.add(this.elementRef, i), this.addClickListener();
|
12809
12817
|
}
|
12810
12818
|
}, {
|
12811
12819
|
key: "changeToDefault",
|
12812
12820
|
value: function changeToDefault(e) {
|
12813
12821
|
var t, i, s, r, o, a;
|
12814
|
-
!e && this._state === "default" || (this.elementRef.classList.contains(
|
12822
|
+
!e && this._state === "default" || (this.elementRef.classList.contains(Se.MENU_ITEM_CLASS) ? this.assignDropupItemStyle((t = this._dropupStyles) == null ? void 0 : t["default"], (i = this.customStyles) == null ? void 0 : i["default"]) : (this.changeElementsByState(this._innerElements["default"]), (s = this.customStyles) != null && s.active && D.unsetAllCSS(this.elementRef, (r = this.customStyles) == null ? void 0 : r.active), (o = this.customStyles) != null && o.disabled && D.unsetAllCSS(this.elementRef, (a = this.customStyles) == null ? void 0 : a.disabled), this.reapplyStateStyle("default", ["active", "disabled"])), this.elementRef.classList.remove(O.DISABLED_CONTAINER_CLASS, O.ACTIVE_CONTAINER_CLASS), this.elementRef.classList.add(O.DEFAULT_CONTAINER_CLASS), N.removeAriaDisabled(this.elementRef), this._state = "default");
|
12815
12823
|
}
|
12816
12824
|
}, {
|
12817
12825
|
key: "changeToActive",
|
12818
12826
|
value: function changeToActive(e) {
|
12819
12827
|
var t, i;
|
12820
|
-
!e && this._state === "active" || (this.elementRef.classList.contains(
|
12828
|
+
!e && this._state === "active" || (this.elementRef.classList.contains(Se.MENU_ITEM_CLASS) ? this.assignDropupItemStyle((t = this._dropupStyles) == null ? void 0 : t.active, (i = this.customStyles) == null ? void 0 : i.active) : (this.changeElementsByState(this._innerElements.active), this.reapplyStateStyle("active", ["disabled", "default"])), this.elementRef.classList.remove(O.DISABLED_CONTAINER_CLASS, O.DEFAULT_CONTAINER_CLASS), this.elementRef.classList.add(O.ACTIVE_CONTAINER_CLASS), N.removeAriaDisabled(this.elementRef), this._state = "active");
|
12821
12829
|
}
|
12822
12830
|
}, {
|
12823
12831
|
key: "changeToDisabled",
|
12824
12832
|
value: function changeToDisabled(e) {
|
12825
12833
|
var t, i, s, r, o, a;
|
12826
|
-
!e && this._state === "disabled" || (this.elementRef.classList.contains(
|
12834
|
+
!e && this._state === "disabled" || (this.elementRef.classList.contains(Se.MENU_ITEM_CLASS) ? this.assignDropupItemStyle((t = this._dropupStyles) == null ? void 0 : t.disabled, (i = this.customStyles) == null ? void 0 : i.disabled) : (this.changeElementsByState(this._innerElements.disabled), (s = this.customStyles) != null && s.active && D.unsetAllCSS(this.elementRef, (r = this.customStyles) == null ? void 0 : r.active), (o = this.customStyles) != null && o["default"] && D.unsetAllCSS(this.elementRef, (a = this.customStyles) == null ? void 0 : a["default"]), this.reapplyStateStyle("disabled", ["default", "active"])), this.elementRef.classList.remove(O.ACTIVE_CONTAINER_CLASS, O.DEFAULT_CONTAINER_CLASS), this.elementRef.classList.add(O.DISABLED_CONTAINER_CLASS), N.addAriaDisabled(this.elementRef), this._state = "disabled");
|
12827
12835
|
}
|
12828
12836
|
// called after class is initialised
|
12829
12837
|
}, {
|
@@ -12927,7 +12935,7 @@ var Cs = /*#__PURE__*/function () {
|
|
12927
12935
|
}, {
|
12928
12936
|
key: "addItem",
|
12929
12937
|
value: function addItem(e) {
|
12930
|
-
var t =
|
12938
|
+
var t = Se.createItem(this, e, this._styles);
|
12931
12939
|
this.elementRef.appendChild(t);
|
12932
12940
|
}
|
12933
12941
|
// prettier-ignore
|
@@ -13018,11 +13026,11 @@ var et = /*#__PURE__*/function (_ct3) {
|
|
13018
13026
|
}(ct);
|
13019
13027
|
et.BUTTON_ICON_CLASS = "dropup-button";
|
13020
13028
|
var Ni = et;
|
13021
|
-
var
|
13022
|
-
function
|
13023
|
-
_classCallCheck(this,
|
13029
|
+
var W = /*#__PURE__*/function () {
|
13030
|
+
function W() {
|
13031
|
+
_classCallCheck(this, W);
|
13024
13032
|
}
|
13025
|
-
return _createClass(
|
13033
|
+
return _createClass(W, null, [{
|
13026
13034
|
key: "addToDropup",
|
13027
13035
|
value:
|
13028
13036
|
// prettier-ignore
|
@@ -13074,12 +13082,12 @@ var $ = /*#__PURE__*/function () {
|
|
13074
13082
|
}, {
|
13075
13083
|
key: "generatePositionToButtons",
|
13076
13084
|
value: function generatePositionToButtons(e) {
|
13077
|
-
var t =
|
13085
|
+
var t = W.createPositionsToButtonsObj();
|
13078
13086
|
Object.keys(e).forEach(function (s) {
|
13079
13087
|
var o;
|
13080
13088
|
var r = (o = e[s]) == null ? void 0 : o.button.position;
|
13081
|
-
r &&
|
13082
|
-
}), t["inside-right"].length === 0 && e.submit &&
|
13089
|
+
r && W.setPosition(e, s, t[r]);
|
13090
|
+
}), t["inside-right"].length === 0 && e.submit && W.setPosition(e, "submit", t["inside-right"]), t["outside-right"].length === 0 && (e.submit ? W.setPosition(e, "submit", t["outside-right"]) : e.microphone ? W.setPosition(e, "microphone", t["outside-right"]) : e.camera ? W.setPosition(e, "camera", t["outside-right"]) : e["".concat(st.INDICATOR_PREFIX, "1")] && W.setPosition(e, "".concat(st.INDICATOR_PREFIX, "1"), t["outside-right"])), e.submit && W.setPosition(e, "submit", t["outside-left"].length === 0 ? t["outside-left"] : t["inside-right"]), e.microphone && W.setPosition(e, "microphone", t["outside-left"].length === 0 ? t["outside-left"] : t["inside-right"]);
|
13083
13091
|
var i = Object.keys(e);
|
13084
13092
|
return i.length > 1 || t["dropup-menu"].length > 0 ? (Ys.forEach(function (s) {
|
13085
13093
|
e[s] && t["dropup-menu"].push(_objectSpread(_objectSpread({}, e[s]), {}, {
|
@@ -13090,14 +13098,14 @@ var $ = /*#__PURE__*/function () {
|
|
13090
13098
|
r.startsWith(st.INDICATOR_PREFIX) && e[r] && t["dropup-menu"].push(_objectSpread(_objectSpread({}, e[r]), {}, {
|
13091
13099
|
customType: r
|
13092
13100
|
}));
|
13093
|
-
})) : i.length === 1 &&
|
13101
|
+
})) : i.length === 1 && W.setPosition(e, i[0], t["outside-right"].length === 0 ? t["outside-right"] : t["outside-left"]), t;
|
13094
13102
|
}
|
13095
13103
|
// prettier-ignore
|
13096
13104
|
}, {
|
13097
13105
|
key: "addButtons",
|
13098
13106
|
value: function addButtons(e, t, i, s) {
|
13099
|
-
var r =
|
13100
|
-
return
|
13107
|
+
var r = W.generatePositionToButtons(t);
|
13108
|
+
return W.addToSideContainer(e, r), r["dropup-menu"].length > 0 && W.addToDropup(e, r, i, s), r;
|
13101
13109
|
}
|
13102
13110
|
}]);
|
13103
13111
|
}();
|
@@ -13491,7 +13499,7 @@ function Ki() {
|
|
13491
13499
|
}
|
13492
13500
|
var Lt = {},
|
13493
13501
|
an;
|
13494
|
-
function
|
13502
|
+
function Wi() {
|
13495
13503
|
if (an) return Lt;
|
13496
13504
|
an = 1, Object.defineProperty(Lt, "__esModule", {
|
13497
13505
|
value: !0
|
@@ -13587,7 +13595,7 @@ function Fn() {
|
|
13587
13595
|
var n = Bn(),
|
13588
13596
|
e = Ki(),
|
13589
13597
|
t = Rs(),
|
13590
|
-
i =
|
13598
|
+
i = Wi(),
|
13591
13599
|
s = Vi();
|
13592
13600
|
var r = /*#__PURE__*/function () {
|
13593
13601
|
function r() {
|
@@ -13693,7 +13701,7 @@ function ga() {
|
|
13693
13701
|
value: !0
|
13694
13702
|
}), It.Highlight = void 0;
|
13695
13703
|
var n = Ki(),
|
13696
|
-
e =
|
13704
|
+
e = Wi();
|
13697
13705
|
var t = /*#__PURE__*/function () {
|
13698
13706
|
function t() {
|
13699
13707
|
_classCallCheck(this, t);
|
@@ -13752,7 +13760,7 @@ function ba() {
|
|
13752
13760
|
value: !0
|
13753
13761
|
}), Ot.Padding = void 0;
|
13754
13762
|
var n = Ki(),
|
13755
|
-
e =
|
13763
|
+
e = Wi(),
|
13756
13764
|
t = Vi();
|
13757
13765
|
var i = /*#__PURE__*/function () {
|
13758
13766
|
function i() {
|
@@ -13827,7 +13835,7 @@ function Un() {
|
|
13827
13835
|
r = Ki(),
|
13828
13836
|
o = ba(),
|
13829
13837
|
a = Rs(),
|
13830
|
-
l =
|
13838
|
+
l = Wi(),
|
13831
13839
|
c = Vi();
|
13832
13840
|
var d = /*#__PURE__*/function () {
|
13833
13841
|
function d() {
|
@@ -14200,13 +14208,13 @@ function wa() {
|
|
14200
14208
|
}();
|
14201
14209
|
return jt.AzureAudioConfig = n, jt;
|
14202
14210
|
}
|
14203
|
-
var
|
14211
|
+
var Ht = {},
|
14204
14212
|
yn;
|
14205
14213
|
function Aa() {
|
14206
|
-
if (yn) return
|
14207
|
-
yn = 1, Object.defineProperty(
|
14214
|
+
if (yn) return Ht;
|
14215
|
+
yn = 1, Object.defineProperty(Ht, "__esModule", {
|
14208
14216
|
value: !0
|
14209
|
-
}),
|
14217
|
+
}), Ht.AzureTranscript = void 0;
|
14210
14218
|
var n = Dn();
|
14211
14219
|
var e = /*#__PURE__*/function () {
|
14212
14220
|
function e() {
|
@@ -14229,7 +14237,7 @@ function Aa() {
|
|
14229
14237
|
}
|
14230
14238
|
}]);
|
14231
14239
|
}();
|
14232
|
-
return
|
14240
|
+
return Ht.AzureTranscript = e, Ht;
|
14233
14241
|
}
|
14234
14242
|
var En;
|
14235
14243
|
function Ta() {
|
@@ -14999,12 +15007,12 @@ var di = /*#__PURE__*/function () {
|
|
14999
15007
|
}
|
15000
15008
|
}]);
|
15001
15009
|
}();
|
15002
|
-
var
|
15003
|
-
function
|
15004
|
-
_classCallCheck(this,
|
15005
|
-
this._isOpen = !1, this._contentRef =
|
15010
|
+
var be = /*#__PURE__*/function () {
|
15011
|
+
function be(e, t, i) {
|
15012
|
+
_classCallCheck(this, be);
|
15013
|
+
this._isOpen = !1, this._contentRef = be.createModalContent(t, i == null ? void 0 : i.backgroundColor), this._buttonPanel = be.createButtonPanel(i == null ? void 0 : i.backgroundColor), this._elementRef = be.createContainer(this._contentRef, i), this._elementRef.appendChild(this._buttonPanel), e.appendChild(this._elementRef), this._backgroundPanelRef = be.createDarkBackgroundPanel(), e.appendChild(this._backgroundPanelRef), this.addWindowEvents(e);
|
15006
15014
|
}
|
15007
|
-
return _createClass(
|
15015
|
+
return _createClass(be, [{
|
15008
15016
|
key: "isOpen",
|
15009
15017
|
value: function isOpen() {
|
15010
15018
|
return this._isOpen;
|
@@ -15026,7 +15034,7 @@ var ge = /*#__PURE__*/function () {
|
|
15026
15034
|
var _this82 = this;
|
15027
15035
|
this._elementRef.classList.remove("show-modal"), this._elementRef.classList.add("hide-modal"), this._backgroundPanelRef.classList.remove("show-modal-background"), this._backgroundPanelRef.classList.add("hide-modal-background"), this._isOpen = !1, setTimeout(function () {
|
15028
15036
|
_this82._elementRef.style.display = "none", _this82._backgroundPanelRef.style.display = "none";
|
15029
|
-
},
|
15037
|
+
}, be.MODAL_CLOSE_TIMEOUT_MS);
|
15030
15038
|
}
|
15031
15039
|
}, {
|
15032
15040
|
key: "displayModalElements",
|
@@ -15042,7 +15050,7 @@ var ge = /*#__PURE__*/function () {
|
|
15042
15050
|
key: "addCloseButton",
|
15043
15051
|
value: function addCloseButton(e, t, i) {
|
15044
15052
|
var _this83 = this;
|
15045
|
-
var s = t ?
|
15053
|
+
var s = t ? be.createSVGButton(e) : be.createTextButton(e);
|
15046
15054
|
return this.addButtons(s), s.onclick = function () {
|
15047
15055
|
_this83.close(), setTimeout(function () {
|
15048
15056
|
i == null || i();
|
@@ -15104,14 +15112,14 @@ var ge = /*#__PURE__*/function () {
|
|
15104
15112
|
value: function createTextModalFunc(e, t, i) {
|
15105
15113
|
var s;
|
15106
15114
|
if (_typeof(t) == "object" && (s = t.files) != null && s.infoModal) {
|
15107
|
-
var r = new
|
15115
|
+
var r = new be(e, ["modal-content"], t.files.infoModal.containerStyle);
|
15108
15116
|
return r.addCloseButton("OK", !1, i), r.openTextModal.bind(r, t.infoModalTextMarkUp || "");
|
15109
15117
|
}
|
15110
15118
|
}
|
15111
15119
|
}]);
|
15112
15120
|
}();
|
15113
|
-
|
15114
|
-
var tt =
|
15121
|
+
be.MODAL_CLOSE_TIMEOUT_MS = 190;
|
15122
|
+
var tt = be;
|
15115
15123
|
var Di = /*#__PURE__*/function (_ct5) {
|
15116
15124
|
// prettier-ignore
|
15117
15125
|
function Di(e, t, i, s, r, o) {
|
@@ -15222,11 +15230,11 @@ var Pe = /*#__PURE__*/function () {
|
|
15222
15230
|
}
|
15223
15231
|
}]);
|
15224
15232
|
}();
|
15225
|
-
var
|
15226
|
-
function
|
15227
|
-
_classCallCheck(this,
|
15233
|
+
var $e = /*#__PURE__*/function () {
|
15234
|
+
function $e() {
|
15235
|
+
_classCallCheck(this, $e);
|
15228
15236
|
}
|
15229
|
-
return _createClass(
|
15237
|
+
return _createClass($e, null, [{
|
15230
15238
|
key: "validate",
|
15231
15239
|
value:
|
15232
15240
|
// prettier-ignore
|
@@ -15250,7 +15258,7 @@ var We = /*#__PURE__*/function () {
|
|
15250
15258
|
o = i.getAllFileData(), a = o == null ? void 0 : o.map(function (l) {
|
15251
15259
|
return l.file;
|
15252
15260
|
});
|
15253
|
-
return _context129.abrupt("return",
|
15261
|
+
return _context129.abrupt("return", $e.validate(e, s, r, a));
|
15254
15262
|
case 5:
|
15255
15263
|
case "end":
|
15256
15264
|
return _context129.stop();
|
@@ -15273,7 +15281,7 @@ var We = /*#__PURE__*/function () {
|
|
15273
15281
|
s = (r = t.files) == null ? void 0 : r.map(function (o) {
|
15274
15282
|
return o.file;
|
15275
15283
|
});
|
15276
|
-
return _context130.abrupt("return",
|
15284
|
+
return _context130.abrupt("return", $e.validate(e, i, t.text, s, !0));
|
15277
15285
|
case 2:
|
15278
15286
|
case "end":
|
15279
15287
|
return _context130.stop();
|
@@ -15290,7 +15298,7 @@ var We = /*#__PURE__*/function () {
|
|
15290
15298
|
value: function validateWebsocket(e, t) {
|
15291
15299
|
var i = e.websocket,
|
15292
15300
|
s = e.connectSettings;
|
15293
|
-
return i && s.url !==
|
15301
|
+
return i && s.url !== ye.URL && !H.canSendMessage(i) ? (t.changeToDisabledIcon(), !1) : !0;
|
15294
15302
|
}
|
15295
15303
|
// prettier-ignore
|
15296
15304
|
}, {
|
@@ -15303,14 +15311,14 @@ var We = /*#__PURE__*/function () {
|
|
15303
15311
|
return _regeneratorRuntime().wrap(function _callee131$(_context131) {
|
15304
15312
|
while (1) switch (_context131.prev = _context131.next) {
|
15305
15313
|
case 0:
|
15306
|
-
if (!(r.status.loadingActive || r.status.requestInProgress || t.isSubmitProgrammaticallyDisabled === !0 ||
|
15314
|
+
if (!(r.status.loadingActive || r.status.requestInProgress || t.isSubmitProgrammaticallyDisabled === !0 || !$e.validateWebsocket(t, r))) {
|
15307
15315
|
_context131.next = 2;
|
15308
15316
|
break;
|
15309
15317
|
}
|
15310
15318
|
return _context131.abrupt("return", !1);
|
15311
15319
|
case 2:
|
15312
15320
|
l = o || t.canSendMessage;
|
15313
|
-
return _context131.abrupt("return", l ? a ?
|
15321
|
+
return _context131.abrupt("return", l ? a ? $e.useValidationFuncProgrammatic(l, a, r) : $e.useValidationFunc(l, i, s, r) : null);
|
15314
15322
|
case 4:
|
15315
15323
|
case "end":
|
15316
15324
|
return _context131.stop();
|
@@ -15468,21 +15476,21 @@ var P = /*#__PURE__*/function (_ct6) {
|
|
15468
15476
|
key: "createCustomElements",
|
15469
15477
|
value: function createCustomElements() {
|
15470
15478
|
var _this90 = this;
|
15471
|
-
var e =
|
15479
|
+
var e = Te.createCustomElements("submit", this.svg, this.customStyles),
|
15472
15480
|
t = {
|
15473
15481
|
loading: void 0,
|
15474
15482
|
stop: void 0
|
15475
15483
|
};
|
15476
15484
|
return Object.keys(t).forEach(function (i) {
|
15477
15485
|
var s = i,
|
15478
|
-
r =
|
15486
|
+
r = Te.createCustomElements(s, _this90.svg, _this90.customStyles);
|
15479
15487
|
r && (t[s] = r);
|
15480
15488
|
}), t.submit = e || this.buildDefaultIconElement("submit-icon"), t;
|
15481
15489
|
}
|
15482
15490
|
}, {
|
15483
15491
|
key: "createDisabledIconElement",
|
15484
15492
|
value: function createDisabledIconElement(e) {
|
15485
|
-
return
|
15493
|
+
return Te.createCustomElements("disabled", this.svg, this.customStyles) || [e[0].cloneNode(!0)];
|
15486
15494
|
}
|
15487
15495
|
// prettier-ignore
|
15488
15496
|
}, {
|
@@ -15908,7 +15916,7 @@ var Kt = /*#__PURE__*/function () {
|
|
15908
15916
|
button: new ri(e, a, t.addNewErrorMessage.bind(t))
|
15909
15917
|
});
|
15910
15918
|
var l = new vs(e, a, t, i, o, r);
|
15911
|
-
a.submit = l.submitFromInput.bind(l),
|
15919
|
+
a.submit = l.submitFromInput.bind(l), $e.attach(e, i, a, o, l), e.submitUserMessage = l.programmaticSubmit.bind(l), r.submit = {
|
15912
15920
|
button: l
|
15913
15921
|
}, e.customButtons && st.add(e, r), Kt.addElements(this.elementRef, a, r, s, o, e.dropupStyles);
|
15914
15922
|
}
|
@@ -15966,7 +15974,7 @@ var Kt = /*#__PURE__*/function () {
|
|
15966
15974
|
value: function addElements(e, t, i, s, r, o) {
|
15967
15975
|
G.addElements(e, t.elementRef);
|
15968
15976
|
var a = yt.create(),
|
15969
|
-
l =
|
15977
|
+
l = W.addButtons(a, i, s, o);
|
15970
15978
|
bs.set(t.inputElementRef, a, r.elementRef, l), yt.add(e, a);
|
15971
15979
|
}
|
15972
15980
|
}]);
|
@@ -15981,7 +15989,7 @@ var Ls = /*#__PURE__*/function () {
|
|
15981
15989
|
var s = document.createElement("div");
|
15982
15990
|
s.id = "chat-view";
|
15983
15991
|
var r = new de(e, t, i);
|
15984
|
-
t.websocket &&
|
15992
|
+
t.websocket && H.createConnection(t, r);
|
15985
15993
|
var o = new Kt(e, r, t, s);
|
15986
15994
|
return G.addElements(s, r.elementRef, o.elementRef), s;
|
15987
15995
|
}
|
@@ -16013,7 +16021,7 @@ var _ = /*#__PURE__*/function (_rs) {
|
|
16013
16021
|
return ai.focusFromParentElement(_this98._elementRef);
|
16014
16022
|
}, _this98.refreshMessages = function () {}, _this98.scrollToBottom = function () {}, _this98.disableSubmitButton = function () {}, _this98.setPlaceholderText = function () {}, _this98._hasBeenRendered = !1, _this98._auxiliaryStyleApplied = !1, _this98._elementRef = document.createElement("div"), _this98._elementRef.id = "container", _this98.attachShadow({
|
16015
16023
|
mode: "open"
|
16016
|
-
}).appendChild(_this98._elementRef),
|
16024
|
+
}).appendChild(_this98._elementRef), qt.apply(Fa, _this98.shadowRoot), setTimeout(function () {
|
16017
16025
|
_this98._hasBeenRendered || _this98.onRender();
|
16018
16026
|
}, 20);
|
16019
16027
|
return _this98;
|
@@ -16029,7 +16037,7 @@ var _ = /*#__PURE__*/function (_rs) {
|
|
16029
16037
|
key: "onRender",
|
16030
16038
|
value: function onRender() {
|
16031
16039
|
var _this$_childElement;
|
16032
|
-
bi.attemptAppendStyleSheetToHead(this.style), te.processConnect(this), (!this._activeService || this._activeService.demo) && (this._activeService = ia.create(this)), this.auxiliaryStyle && !this._auxiliaryStyleApplied && (
|
16040
|
+
bi.attemptAppendStyleSheetToHead(this.style), te.processConnect(this), (!this._activeService || this._activeService.demo) && (this._activeService = ia.create(this)), this.auxiliaryStyle && !this._auxiliaryStyleApplied && (qt.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), qt.applyDefaultStyleToComponent(this.style, this.chatStyle), te.checkForContainerStyles(this, this._elementRef), this._activeService.key && this._activeService.validateKeyProperty ? gi.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : !(this._activeService instanceof V) || this._activeService.key ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], Ls.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof V && K.render(this._elementRef, this.changeToChatView.bind(this), this._activeService), this._hasBeenRendered || yi.onRender(this), this._hasBeenRendered = !0;
|
16033
16041
|
}
|
16034
16042
|
}, {
|
16035
16043
|
key: "disconnectedCallback",
|