deep-chat-dev 9.0.243 → 9.0.246
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 +11474 -11474
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.js +141 -135
- package/dist/utils/HTTP/stream.d.ts.map +1 -1
- package/dist/views/chat/messages/html/htmlMessages.d.ts +1 -1
- package/dist/views/chat/messages/html/htmlMessages.d.ts.map +1 -1
- package/dist/views/chat/messages/stream/messageStream.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/deepChat.js
CHANGED
@@ -544,7 +544,7 @@ var ut = /*#__PURE__*/function () {
|
|
544
544
|
}]);
|
545
545
|
}();
|
546
546
|
ut.BUBBLE_CLASS = "deep-chat-loading-message-bubble", ut.DOTS_CONTAINER_CLASS = "deep-chat-loading-message-dots-container";
|
547
|
-
var
|
547
|
+
var De = ut;
|
548
548
|
var ue = /*#__PURE__*/function () {
|
549
549
|
function ue() {
|
550
550
|
_classCallCheck(this, ue);
|
@@ -792,11 +792,11 @@ var $n = "deep-chat-temporary-message",
|
|
792
792
|
}
|
793
793
|
},
|
794
794
|
Bs = Object.keys(ts);
|
795
|
-
var
|
796
|
-
function
|
797
|
-
_classCallCheck(this,
|
795
|
+
var we = /*#__PURE__*/function () {
|
796
|
+
function we() {
|
797
|
+
_classCallCheck(this, we);
|
798
798
|
}
|
799
|
-
return _createClass(
|
799
|
+
return _createClass(we, null, [{
|
800
800
|
key: "applySuggestionEvent",
|
801
801
|
value: function applySuggestionEvent(e, t) {
|
802
802
|
setTimeout(function () {
|
@@ -851,13 +851,13 @@ var De = /*#__PURE__*/function () {
|
|
851
851
|
Bs.forEach(function (r) {
|
852
852
|
var o = i.getElementsByClassName(r);
|
853
853
|
Array.from(o || []).forEach(function (a) {
|
854
|
-
var l =
|
855
|
-
ie.applyStylesToElement(a, l),
|
854
|
+
var l = we.getProcessedStyles(t, a, r);
|
855
|
+
ie.applyStylesToElement(a, l), we.applyEvents(a, r);
|
856
856
|
});
|
857
857
|
});
|
858
858
|
var s = i.getElementsByClassName(Wn);
|
859
859
|
Array.from(s).forEach(function (r) {
|
860
|
-
return
|
860
|
+
return we.applySuggestionEvent(e, r);
|
861
861
|
});
|
862
862
|
}
|
863
863
|
}]);
|
@@ -885,7 +885,7 @@ var ie = /*#__PURE__*/function () {
|
|
885
885
|
value: function applyClassUtilitiesToElement(e, t) {
|
886
886
|
var i = t.events,
|
887
887
|
s = t.styles;
|
888
|
-
i && ie.applyEventsToElement(e, i), s && !
|
888
|
+
i && ie.applyEventsToElement(e, i), s && !we.doesElementContainDeepChatClass(e) && ie.applyStylesToElement(e, s);
|
889
889
|
}
|
890
890
|
}, {
|
891
891
|
key: "applyCustomClassUtilities",
|
@@ -900,7 +900,7 @@ var ie = /*#__PURE__*/function () {
|
|
900
900
|
}, {
|
901
901
|
key: "apply",
|
902
902
|
value: function apply(e, t) {
|
903
|
-
|
903
|
+
we.applyDeepChatUtilities(e, e.htmlClassUtilities, t), ie.applyCustomClassUtilities(e.htmlClassUtilities, t);
|
904
904
|
}
|
905
905
|
}, {
|
906
906
|
key: "traverseNodes",
|
@@ -928,11 +928,11 @@ var ie = /*#__PURE__*/function () {
|
|
928
928
|
}
|
929
929
|
}]);
|
930
930
|
}();
|
931
|
-
var
|
932
|
-
function
|
933
|
-
_classCallCheck(this,
|
931
|
+
var Le = /*#__PURE__*/function () {
|
932
|
+
function Le() {
|
933
|
+
_classCallCheck(this, Le);
|
934
934
|
}
|
935
|
-
return _createClass(
|
935
|
+
return _createClass(Le, null, [{
|
936
936
|
key: "addElement",
|
937
937
|
value: function addElement(e, t) {
|
938
938
|
e.appendOuterContainerElemet(t), e.focusMode || (e.elementRef.scrollTop = e.elementRef.scrollHeight);
|
@@ -941,7 +941,7 @@ var ke = /*#__PURE__*/function () {
|
|
941
941
|
key: "createElements",
|
942
942
|
value: function createElements(e, t, i, s) {
|
943
943
|
var r = e.createMessageElementsOnOrientation("", i, s);
|
944
|
-
return r.bubbleElement.classList.add(
|
944
|
+
return r.bubbleElement.classList.add(Le.HTML_BUBBLE_CLASS), r.bubbleElement.innerHTML = t, r;
|
945
945
|
}
|
946
946
|
}, {
|
947
947
|
key: "overwriteElements",
|
@@ -953,15 +953,15 @@ var ke = /*#__PURE__*/function () {
|
|
953
953
|
key: "overwrite",
|
954
954
|
value: function overwrite(e, t, i, s) {
|
955
955
|
var r = e.messageToElements,
|
956
|
-
o = v.overwriteMessage(r, s, t, i, "html",
|
957
|
-
return o &&
|
956
|
+
o = v.overwriteMessage(r, s, t, i, "html", Le.HTML_BUBBLE_CLASS);
|
957
|
+
return o && Le.overwriteElements(e, t, o), o;
|
958
958
|
}
|
959
959
|
}, {
|
960
960
|
key: "create",
|
961
961
|
value: function create(e, t, i) {
|
962
962
|
var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
|
963
963
|
var o;
|
964
|
-
var r =
|
964
|
+
var r = Le.createElements(e, t, i, s);
|
965
965
|
return v.fillEmptyMessageElement(r.bubbleElement, t), ie.apply(e, r.outerContainer), ne.flagHTMLUpdateClass(r.bubbleElement), e.applyCustomStyles(r, i, !1, (o = e.messageStyles) == null ? void 0 : o.html), r;
|
966
966
|
}
|
967
967
|
// prettier-ignore
|
@@ -970,17 +970,23 @@ var ke = /*#__PURE__*/function () {
|
|
970
970
|
value: function add(e, t, i, s, r) {
|
971
971
|
var o = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : !1;
|
972
972
|
if (r != null && r.status) {
|
973
|
-
var
|
974
|
-
if (
|
973
|
+
var c = this.overwrite(e, t, i, s);
|
974
|
+
if (c) return c;
|
975
975
|
r.status = !1;
|
976
976
|
}
|
977
|
-
var a =
|
978
|
-
|
977
|
+
var a = document.createElement("div");
|
978
|
+
if (a.innerHTML = t, we.isElementTemporary({
|
979
|
+
outerContainer: a,
|
980
|
+
bubbleElement: a,
|
981
|
+
innerContainer: a
|
982
|
+
}) && e.messageElementRefs.length > 0) return;
|
983
|
+
var l = Le.create(e, t, i, o);
|
984
|
+
return o || Le.addElement(e, l.outerContainer), l;
|
979
985
|
}
|
980
986
|
}]);
|
981
987
|
}();
|
982
|
-
|
983
|
-
var
|
988
|
+
Le.HTML_BUBBLE_CLASS = "html-message";
|
989
|
+
var Ae = Le;
|
984
990
|
var mi;
|
985
991
|
function _n(n) {
|
986
992
|
return mi = mi || document.createElement("textarea"), mi.innerHTML = "&" + n + ";", mi.value;
|
@@ -1855,7 +1861,7 @@ function Cr(n, e, t, i) {
|
|
1855
1861
|
y,
|
1856
1862
|
R,
|
1857
1863
|
B,
|
1858
|
-
|
1864
|
+
Me,
|
1859
1865
|
N,
|
1860
1866
|
re = !0,
|
1861
1867
|
oe,
|
@@ -1868,11 +1874,11 @@ function Cr(n, e, t, i) {
|
|
1868
1874
|
for (R = n.tokens.length, g ? (d = n.bMarks[e] + n.tShift[e], m = Number(n.src.substr(d, u - d - 1)), n.tokens.push({
|
1869
1875
|
type: "ordered_list_open",
|
1870
1876
|
order: m,
|
1871
|
-
lines:
|
1877
|
+
lines: Me = [e, 0],
|
1872
1878
|
level: n.level++
|
1873
1879
|
})) : n.tokens.push({
|
1874
1880
|
type: "bullet_list_open",
|
1875
|
-
lines:
|
1881
|
+
lines: Me = [e, 0],
|
1876
1882
|
level: n.level++
|
1877
1883
|
}), s = e, B = !1, oe = n.parser.ruler.getRules("list"); s < t && (y = n.skipSpaces(u), h = n.eMarks[s], y >= h ? f = 1 : f = y - u, f > 4 && (f = 1), f < 1 && (f = 1), r = u - n.bMarks[s] + f, n.tokens.push({
|
1878
1884
|
type: "list_item_open",
|
@@ -1895,7 +1901,7 @@ function Cr(n, e, t, i) {
|
|
1895
1901
|
return n.tokens.push({
|
1896
1902
|
type: g ? "ordered_list_close" : "bullet_list_close",
|
1897
1903
|
level: --n.level
|
1898
|
-
}),
|
1904
|
+
}), Me[1] = s, n.line = s, re && Ar(n, R), !0;
|
1899
1905
|
}
|
1900
1906
|
function Tr(n, e, t, i) {
|
1901
1907
|
var s,
|
@@ -2819,34 +2825,34 @@ var To = {
|
|
2819
2825
|
function Ln(n, e, t) {
|
2820
2826
|
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;
|
2821
2827
|
}
|
2822
|
-
function
|
2828
|
+
function Ce(n, e) {
|
2823
2829
|
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 Vi(), this.block = new _s(), this.core = new Mn(), this.renderer = new Ss(), this.ruler = new de(), this.options = {}, this.configure(ko[n]), this.set(e || {});
|
2824
2830
|
}
|
2825
|
-
|
2831
|
+
Ce.prototype.set = function (n) {
|
2826
2832
|
xn(this.options, n);
|
2827
2833
|
};
|
2828
|
-
|
2834
|
+
Ce.prototype.configure = function (n) {
|
2829
2835
|
var e = this;
|
2830
2836
|
if (!n) throw new Error("Wrong `remarkable` preset, check name/content");
|
2831
2837
|
n.options && e.set(n.options), n.components && Object.keys(n.components).forEach(function (t) {
|
2832
2838
|
n.components[t].rules && e[t].ruler.enable(n.components[t].rules, !0);
|
2833
2839
|
});
|
2834
2840
|
};
|
2835
|
-
|
2841
|
+
Ce.prototype.use = function (n, e) {
|
2836
2842
|
return n(this, e), this;
|
2837
2843
|
};
|
2838
|
-
|
2844
|
+
Ce.prototype.parse = function (n, e) {
|
2839
2845
|
var t = new Ln(this, n, e);
|
2840
2846
|
return this.core.process(t), t.tokens;
|
2841
2847
|
};
|
2842
|
-
|
2848
|
+
Ce.prototype.render = function (n, e) {
|
2843
2849
|
return e = e || {}, this.renderer.render(this.parse(n, e), this.options, e);
|
2844
2850
|
};
|
2845
|
-
|
2851
|
+
Ce.prototype.parseInline = function (n, e) {
|
2846
2852
|
var t = new Ln(this, n, e);
|
2847
2853
|
return t.inlineMode = !0, this.core.process(t), t.tokens;
|
2848
2854
|
};
|
2849
|
-
|
2855
|
+
Ce.prototype.renderInline = function (n, e) {
|
2850
2856
|
return e = e || {}, this.renderer.render(this.parseInline(n, e), this.options, e);
|
2851
2857
|
};
|
2852
2858
|
var ft = /*#__PURE__*/function () {
|
@@ -2856,10 +2862,10 @@ var ft = /*#__PURE__*/function () {
|
|
2856
2862
|
return _createClass(ft, null, [{
|
2857
2863
|
key: "instantiate",
|
2858
2864
|
value: function instantiate(e) {
|
2859
|
-
if (e) return new
|
2865
|
+
if (e) return new Ce(_objectSpread(_objectSpread({}, ft.DEFAULT_PROPERTIES), e));
|
2860
2866
|
if (window.hljs) {
|
2861
2867
|
var t = window.hljs;
|
2862
|
-
return new
|
2868
|
+
return new Ce({
|
2863
2869
|
highlight: function highlight(i, s) {
|
2864
2870
|
if (s && t.getLanguage(s)) try {
|
2865
2871
|
return t.highlight(i, {
|
@@ -2888,7 +2894,7 @@ var ft = /*#__PURE__*/function () {
|
|
2888
2894
|
typographer: !0
|
2889
2895
|
// Enable smartypants and other sweet transforms
|
2890
2896
|
});
|
2891
|
-
} else return new
|
2897
|
+
} else return new Ce(ft.DEFAULT_PROPERTIES);
|
2892
2898
|
}
|
2893
2899
|
}, {
|
2894
2900
|
key: "createNew",
|
@@ -3009,7 +3015,7 @@ var U = /*#__PURE__*/function () {
|
|
3009
3015
|
}, {
|
3010
3016
|
key: "apply",
|
3011
3017
|
value: function apply(e, t, i) {
|
3012
|
-
|
3018
|
+
De.setRing(t.bubbleElement, i == null ? void 0 : i.bubble), i != null && i.bubble && (i = JSON.parse(JSON.stringify(i)), delete i.bubble), e.applyCustomStyles(t, "history", !1, i);
|
3013
3019
|
}
|
3014
3020
|
}, {
|
3015
3021
|
key: "addLoadHistoryMessage",
|
@@ -3036,7 +3042,7 @@ var U = /*#__PURE__*/function () {
|
|
3036
3042
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
3037
3043
|
var r, o, a, l;
|
3038
3044
|
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,
|
3039
|
-
s = i ?
|
3045
|
+
s = i ? Ae.createElements(e, i, v.AI_ROLE, !0) : U.createDefaultElements(e);
|
3040
3046
|
return U.addLoadHistoryMessage(s, e, t), s;
|
3041
3047
|
}
|
3042
3048
|
}, {
|
@@ -3198,7 +3204,7 @@ var te = /*#__PURE__*/function () {
|
|
3198
3204
|
var r;
|
3199
3205
|
(r = this._introPanel) == null || r.hide();
|
3200
3206
|
var s = this.messageElementRefs[this.messageElementRefs.length - 1];
|
3201
|
-
return Be.changeFullViewToSmall(this), te.isTemporaryElement(s) && (this.revealRoleElementsIfTempRemoved(s, t), this.removeLastMessage()), this.createMessageElements(e, t, i);
|
3207
|
+
return Be.changeFullViewToSmall(this), !i && te.isTemporaryElement(s) && (this.revealRoleElementsIfTempRemoved(s, t), this.removeLastMessage()), this.createMessageElements(e, t, i);
|
3202
3208
|
}
|
3203
3209
|
// this can be tested by having an ai message, then a temp ai message with html that submits new user message:
|
3204
3210
|
// https://github.com/OvidijusParsiunas/deep-chat/issues/258
|
@@ -3206,7 +3212,7 @@ var te = /*#__PURE__*/function () {
|
|
3206
3212
|
}, {
|
3207
3213
|
key: "revealRoleElementsIfTempRemoved",
|
3208
3214
|
value: function revealRoleElementsIfTempRemoved(e, t) {
|
3209
|
-
if ((this.avatars || this.names) &&
|
3215
|
+
if ((this.avatars || this.names) && we.isElementTemporary(e)) {
|
3210
3216
|
var i = this.messageElementRefs[this.messageElementRefs.length - 2];
|
3211
3217
|
i && this.messageToElements.length > 0 && !e.bubbleElement.classList.contains(v.getRoleClass(t)) && v.revealRoleElements(i.innerContainer, !!this.avatars, !!this.names);
|
3212
3218
|
}
|
@@ -3293,7 +3299,7 @@ var te = /*#__PURE__*/function () {
|
|
3293
3299
|
}, {
|
3294
3300
|
key: "isTemporaryElement",
|
3295
3301
|
value: function isTemporaryElement(e) {
|
3296
|
-
return te.isLoadingMessage(e) ||
|
3302
|
+
return te.isLoadingMessage(e) || we.isElementTemporary(e);
|
3297
3303
|
}
|
3298
3304
|
}, {
|
3299
3305
|
key: "createBaseElements",
|
@@ -3325,7 +3331,7 @@ var te = /*#__PURE__*/function () {
|
|
3325
3331
|
}, {
|
3326
3332
|
key: "isLoadingMessage",
|
3327
3333
|
value: function isLoadingMessage(e) {
|
3328
|
-
return e == null ? void 0 : e.bubbleElement.classList.contains(
|
3334
|
+
return e == null ? void 0 : e.bubbleElement.classList.contains(De.BUBBLE_CLASS);
|
3329
3335
|
}
|
3330
3336
|
}]);
|
3331
3337
|
}();
|
@@ -3494,7 +3500,7 @@ var _ = /*#__PURE__*/function () {
|
|
3494
3500
|
}, {
|
3495
3501
|
key: "overwriteMessage",
|
3496
3502
|
value: function overwriteMessage(e, t, i, s, r, o) {
|
3497
|
-
var a = _.getLastElementsByClass(t, [_.getRoleClass(s), o], [
|
3503
|
+
var a = _.getLastElementsByClass(t, [_.getRoleClass(s), o], [De.BUBBLE_CLASS]),
|
3498
3504
|
l = _.getLastMessage(e, s, r);
|
3499
3505
|
return l && (l[r] = i), a;
|
3500
3506
|
}
|
@@ -3582,7 +3588,7 @@ var _ = /*#__PURE__*/function () {
|
|
3582
3588
|
key: "generateMessageBodyElements",
|
3583
3589
|
value: function generateMessageBodyElements(e, t) {
|
3584
3590
|
var i = {};
|
3585
|
-
return e.text && (i.text = _.findMessageElements(t, pe.TEXT_BUBBLE_CLASS)), e.html && (i.html = _.findMessageElements(t,
|
3591
|
+
return e.text && (i.text = _.findMessageElements(t, pe.TEXT_BUBBLE_CLASS)), e.html && (i.html = _.findMessageElements(t, Ae.HTML_BUBBLE_CLASS)), e.files && (i.files = _.filterdMessageElements(t, V.FILE_BUBBLE_CLASS)), i;
|
3586
3592
|
}
|
3587
3593
|
}, {
|
3588
3594
|
key: "generateMessageBody",
|
@@ -3657,9 +3663,9 @@ var pt = /*#__PURE__*/function () {
|
|
3657
3663
|
}, {
|
3658
3664
|
key: "setInitialState",
|
3659
3665
|
value: function setInitialState(e, t, i) {
|
3660
|
-
this._streamType = e, i !== null && i !== void 0 ? i : i = v.AI_ROLE, this._elements = e === "text" ? this._messages.addNewTextMessage(t, i) :
|
3666
|
+
this._streamType = e, i !== null && i !== void 0 ? i : i = v.AI_ROLE, this._elements = e === "text" ? this._messages.addNewTextMessage(t, i) : Ae.add(this._messages, t, i, this._messages.messageElementRefs), this._elements && (this._elements.bubbleElement.classList.add(pt.MESSAGE_CLASS), this._activeMessageRole = i, this._message = _defineProperty({
|
3661
3667
|
role: this._activeMessageRole
|
3662
|
-
}, e, t), this._messages.messageToElements.push([this._message, _defineProperty({}, e, this._elements)]);
|
3668
|
+
}, e, t), this._messages.messageToElements.push([this._message, _defineProperty({}, e, this._elements)]));
|
3663
3669
|
}
|
3664
3670
|
}, {
|
3665
3671
|
key: "updateBasedOnType",
|
@@ -3732,7 +3738,7 @@ var pt = /*#__PURE__*/function () {
|
|
3732
3738
|
}]);
|
3733
3739
|
}();
|
3734
3740
|
pt.MESSAGE_CLASS = "streamed-message";
|
3735
|
-
var
|
3741
|
+
var Te = pt;
|
3736
3742
|
var Ue = /*#__PURE__*/function () {
|
3737
3743
|
function Ue() {
|
3738
3744
|
_classCallCheck(this, Ue);
|
@@ -4063,7 +4069,7 @@ function Bo(n, e) {
|
|
4063
4069
|
R(), u();
|
4064
4070
|
});
|
4065
4071
|
var B = c !== null && c !== void 0 ? c : window.fetch,
|
4066
|
-
|
4072
|
+
Me = s !== null && s !== void 0 ? s : Fo;
|
4067
4073
|
function N() {
|
4068
4074
|
return _N.apply(this, arguments);
|
4069
4075
|
}
|
@@ -4083,7 +4089,7 @@ function Bo(n, e) {
|
|
4083
4089
|
case 4:
|
4084
4090
|
oe = _context6.sent;
|
4085
4091
|
_context6.next = 7;
|
4086
|
-
return
|
4092
|
+
return Me(oe);
|
4087
4093
|
case 7:
|
4088
4094
|
_context6.next = 9;
|
4089
4095
|
return Lo(oe.body, Io(Oo(function (z) {
|
@@ -4137,7 +4143,7 @@ var M = /*#__PURE__*/function () {
|
|
4137
4143
|
y,
|
4138
4144
|
R,
|
4139
4145
|
B,
|
4140
|
-
|
4146
|
+
Me,
|
4141
4147
|
o,
|
4142
4148
|
_yield$E$processReque,
|
4143
4149
|
a,
|
@@ -4188,11 +4194,11 @@ var M = /*#__PURE__*/function () {
|
|
4188
4194
|
}
|
4189
4195
|
return _context9.abrupt("return", _e.requestStream(i, e));
|
4190
4196
|
case 19:
|
4191
|
-
f = new
|
4197
|
+
f = new Te(i), m = E.fetch.bind(this, e, l, s);
|
4192
4198
|
return _context9.abrupt("return", (Bo(((R = e.connectSettings) == null ? void 0 : R.url) || e.url || "", {
|
4193
4199
|
method: ((B = e.connectSettings) == null ? void 0 : B.method) || "POST",
|
4194
4200
|
headers: l,
|
4195
|
-
credentials: (
|
4201
|
+
credentials: (Me = e.connectSettings) == null ? void 0 : Me.credentials,
|
4196
4202
|
body: s ? JSON.stringify(a) : a,
|
4197
4203
|
openWhenHidden: !0,
|
4198
4204
|
// keep stream open when browser tab not open
|
@@ -4327,12 +4333,12 @@ var M = /*#__PURE__*/function () {
|
|
4327
4333
|
if (i.text) {
|
4328
4334
|
t.onOpen();
|
4329
4335
|
_o2 = i.text.split("");
|
4330
|
-
M.populateMessages(e, _o2, new
|
4336
|
+
M.populateMessages(e, _o2, new Te(e), r, "text", 0, s);
|
4331
4337
|
}
|
4332
4338
|
if (i.html) {
|
4333
4339
|
t.onOpen();
|
4334
4340
|
_o3 = ie.splitHTML(i.html);
|
4335
|
-
_o3.length === 0 && (_o3 = i.html.split("")), M.populateMessages(e, _o3, new
|
4341
|
+
_o3.length === 0 && (_o3 = i.html.split("")), M.populateMessages(e, _o3, new Te(e), r, "html", 0, s);
|
4336
4342
|
}
|
4337
4343
|
case 12:
|
4338
4344
|
case "end":
|
@@ -4682,7 +4688,7 @@ var G = /*#__PURE__*/function () {
|
|
4682
4688
|
var _i$o;
|
4683
4689
|
var o = s.role || v.AI_ROLE,
|
4684
4690
|
a = i[o];
|
4685
|
-
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
|
4691
|
+
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 Te(t), i[o].upsertStreamedMessage(s));
|
4686
4692
|
} else M.simulate(t, e.streamHandlers, s);
|
4687
4693
|
}
|
4688
4694
|
}]);
|
@@ -4769,7 +4775,7 @@ var Se = /*#__PURE__*/function () {
|
|
4769
4775
|
var u, h;
|
4770
4776
|
var s = !0,
|
4771
4777
|
r = !1;
|
4772
|
-
var o = new
|
4778
|
+
var o = new Te(i),
|
4773
4779
|
a = function a() {
|
4774
4780
|
r || !s || (e.streamHandlers.onOpen(), r = !0);
|
4775
4781
|
},
|
@@ -5808,19 +5814,19 @@ var Ai = /*#__PURE__*/function () {
|
|
5808
5814
|
}
|
5809
5815
|
}]);
|
5810
5816
|
}();
|
5811
|
-
var
|
5817
|
+
var Ie = /*#__PURE__*/function (_HTMLElement) {
|
5812
5818
|
// If this is not working, try using propertyName directly
|
5813
|
-
function
|
5819
|
+
function Ie() {
|
5814
5820
|
var _this15;
|
5815
|
-
_classCallCheck(this,
|
5816
|
-
_this15 = _callSuper(this,
|
5817
|
-
var t =
|
5821
|
+
_classCallCheck(this, Ie);
|
5822
|
+
_this15 = _callSuper(this, Ie), _this15._waitingToRender_ = !1, _this15._propUpdated_ = !1, Object.keys(Ie._attributeToProperty_).forEach(function (e) {
|
5823
|
+
var t = Ie._attributeToProperty_[e];
|
5818
5824
|
_this15.constructPropertyAccessors(t), _this15.hasOwnProperty(e) || _this15.constructPropertyAccessors(t, e);
|
5819
5825
|
});
|
5820
5826
|
return _this15;
|
5821
5827
|
}
|
5822
|
-
_inherits(
|
5823
|
-
return _createClass(
|
5828
|
+
_inherits(Ie, _HTMLElement);
|
5829
|
+
return _createClass(Ie, [{
|
5824
5830
|
key: "constructPropertyAccessors",
|
5825
5831
|
value:
|
5826
5832
|
// need to be called here as accessors need to be set for the class instance
|
@@ -5839,8 +5845,8 @@ var Le = /*#__PURE__*/function (_HTMLElement) {
|
|
5839
5845
|
key: "attributeChangedCallback",
|
5840
5846
|
value: function attributeChangedCallback(e, t, i) {
|
5841
5847
|
if (t === i) return;
|
5842
|
-
var s =
|
5843
|
-
r =
|
5848
|
+
var s = Ie._attributes_[e](i),
|
5849
|
+
r = Ie._attributeToProperty_[e];
|
5844
5850
|
this[r] = s;
|
5845
5851
|
}
|
5846
5852
|
}, {
|
@@ -5849,12 +5855,12 @@ var Le = /*#__PURE__*/function (_HTMLElement) {
|
|
5849
5855
|
}], [{
|
5850
5856
|
key: "observedAttributes",
|
5851
5857
|
get: function get() {
|
5852
|
-
return Object.keys(
|
5858
|
+
return Object.keys(Ie._attributes_) || [];
|
5853
5859
|
}
|
5854
5860
|
}]);
|
5855
5861
|
}(/*#__PURE__*/_wrapNativeSuper(HTMLElement));
|
5856
|
-
|
5857
|
-
var os =
|
5862
|
+
Ie._attributes_ = {}, Ie._attributeToProperty_ = {};
|
5863
|
+
var os = Ie;
|
5858
5864
|
var Uo = "<?xml version=\"1.0\" standalone=\"no\"?>\n<svg version=\"1.1\"\n\txmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n\txmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"0.9em\" height=\"0.9em\"\n\tviewBox=\"0 0 1200 1200\" enable-background=\"new 0 0 1200 1200\">\n\t\t<path d=\"\n\t\t\tM669.727,273.516c-22.891-2.476-46.15-3.895-69.727-4.248c-103.025,0.457-209.823,25.517-310.913,73.536\n\t\t\tc-75.058,37.122-148.173,89.529-211.67,154.174C46.232,529.978,6.431,577.76,0,628.74c0.76,44.162,48.153,98.67,77.417,131.764\n\t\t\tc59.543,62.106,130.754,113.013,211.67,154.174c2.75,1.335,5.51,2.654,8.276,3.955l-75.072,131.102l102.005,60.286l551.416-960.033\n\t\t\tl-98.186-60.008L669.727,273.516z M902.563,338.995l-74.927,129.857c34.47,44.782,54.932,100.006,54.932,159.888\n\t\t\tc0,149.257-126.522,270.264-282.642,270.264c-6.749,0-13.29-0.728-19.922-1.172l-49.585,85.84c22.868,2.449,45.99,4.233,69.58,4.541\n\t\t\tc103.123-0.463,209.861-25.812,310.84-73.535c75.058-37.122,148.246-89.529,211.743-154.174\n\t\t\tc31.186-32.999,70.985-80.782,77.417-131.764c-0.76-44.161-48.153-98.669-77.417-131.763\n\t\t\tc-59.543-62.106-130.827-113.013-211.743-154.175C908.108,341.478,905.312,340.287,902.563,338.995L902.563,338.995z\n\t\t\tM599.927,358.478c6.846,0,13.638,0.274,20.361,0.732l-58.081,100.561c-81.514,16.526-142.676,85.88-142.676,168.897\n\t\t\tc0,20.854,3.841,40.819,10.913,59.325c0.008,0.021-0.008,0.053,0,0.074l-58.228,100.854\n\t\t\tc-34.551-44.823-54.932-100.229-54.932-160.182C317.285,479.484,443.808,358.477,599.927,358.478L599.927,358.478z M768.896,570.513\n\t\t\tL638.013,797.271c81.076-16.837,141.797-85.875,141.797-168.603C779.81,608.194,775.724,588.729,768.896,570.513L768.896,570.513z\"\n\t\t\t/>\n</svg>\n",
|
5859
5865
|
jo = "<?xml version=\"1.0\" standalone=\"no\"?>\n<svg version=\"1.1\"\n\txmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n\txmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"0.9em\" height=\"0.9em\"\n\tviewBox=\"0 0 1200 1200\" enable-background=\"new 0 0 1200 1200\">\n\t\t<path id=\"path6686\" inkscape:connector-curvature=\"0\" d=\"M779.843,599.925c0,95.331-80.664,172.612-180.169,172.612\n\t\t\tc-99.504,0-180.168-77.281-180.168-172.612c0-95.332,80.664-172.612,180.168-172.612\n\t\t\tC699.179,427.312,779.843,504.594,779.843,599.925z M600,240.521c-103.025,0.457-209.814,25.538-310.904,73.557\n\t\t\tc-75.058,37.122-148.206,89.496-211.702,154.141C46.208,501.218,6.431,549,0,599.981c0.76,44.161,48.13,98.669,77.394,131.763\n\t\t\tc59.543,62.106,130.786,113.018,211.702,154.179c94.271,45.751,198.616,72.092,310.904,73.557\n\t\t\tc103.123-0.464,209.888-25.834,310.866-73.557c75.058-37.122,148.243-89.534,211.74-154.179\n\t\t\tc31.185-32.999,70.962-80.782,77.394-131.763c-0.76-44.161-48.13-98.671-77.394-131.764\n\t\t\tc-59.543-62.106-130.824-112.979-211.74-154.141C816.644,268.36,712.042,242.2,600,240.521z M599.924,329.769\n\t\t\tc156.119,0,282.675,120.994,282.675,270.251c0,149.256-126.556,270.25-282.675,270.25S317.249,749.275,317.249,600.02\n\t\t\tC317.249,450.763,443.805,329.769,599.924,329.769L599.924,329.769z\"/>\n</svg>\n";
|
5860
5866
|
var $ = /*#__PURE__*/function () {
|
@@ -6510,7 +6516,7 @@ var Xs = {
|
|
6510
6516
|
this.streamHandlers.abortStream.abort = function () {
|
6511
6517
|
i.interruptGenerate();
|
6512
6518
|
}, this.streamHandlers.onOpen();
|
6513
|
-
s = new
|
6519
|
+
s = new Te(e);
|
6514
6520
|
_context40.next = 4;
|
6515
6521
|
return i.generate(t, /*#__PURE__*/function () {
|
6516
6522
|
var _ref14 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee39(r, o) {
|
@@ -7003,11 +7009,11 @@ var Ho = /*#__PURE__*/function (_ui2) {
|
|
7003
7009
|
}]);
|
7004
7010
|
}(ui);
|
7005
7011
|
var fi = "data:image/png;base64,";
|
7006
|
-
var
|
7007
|
-
function
|
7008
|
-
_classCallCheck(this,
|
7012
|
+
var Re = /*#__PURE__*/function () {
|
7013
|
+
function Re() {
|
7014
|
+
_classCallCheck(this, Re);
|
7009
7015
|
}
|
7010
|
-
return _createClass(
|
7016
|
+
return _createClass(Re, null, [{
|
7011
7017
|
key: "buildHeaders",
|
7012
7018
|
value: function buildHeaders(e) {
|
7013
7019
|
return {
|
@@ -7027,7 +7033,7 @@ var Te = /*#__PURE__*/function () {
|
|
7027
7033
|
return {
|
7028
7034
|
url: "https://api.stability.ai/v1/engines/list",
|
7029
7035
|
method: "GET",
|
7030
|
-
handleVerificationResult:
|
7036
|
+
handleVerificationResult: Re.handleVerificationResult
|
7031
7037
|
};
|
7032
7038
|
}
|
7033
7039
|
}]);
|
@@ -7058,7 +7064,7 @@ var Ri = /*#__PURE__*/function (_Ki) {
|
|
7058
7064
|
}
|
7059
7065
|
}
|
7060
7066
|
};
|
7061
|
-
_this25 = _callSuper(this, Ri, [e,
|
7067
|
+
_this25 = _callSuper(this, Ri, [e, Re.buildKeyVerificationDetails(), Re.buildHeaders, i, s]), _this25.url = "https://api.stability.ai/v1/generation/esrgan-v1-x2plus/image-to-image/upscale", _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 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>";
|
7062
7068
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageUpscale;
|
7063
7069
|
_typeof(r) == "object" && (r.engine_id && (_this25.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/upscale")), Ri.cleanConfig(r), Object.assign(_this25.rawBody, r)), _this25.canSendMessage = Ri.canSendFileMessage;
|
7064
7070
|
return _this25;
|
@@ -7165,7 +7171,7 @@ var Mi = /*#__PURE__*/function (_Ki2) {
|
|
7165
7171
|
}
|
7166
7172
|
}
|
7167
7173
|
};
|
7168
|
-
_this26 = _callSuper(this, Mi, [e,
|
7174
|
+
_this26 = _callSuper(this, Mi, [e, Re.buildKeyVerificationDetails(), Re.buildHeaders, i, s]), _this26.url = "https://api.stability.ai/v1/generation/stable-diffusion-xl-1024-v1-0/image-to-image/masking", _this26._maskSource = "MASK_IMAGE_WHITE", _this26.textInputPlaceholderText = "Describe image changes", _this26.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>";
|
7169
7175
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageMasking;
|
7170
7176
|
_typeof(r) == "object" && (r.engine_id && (_this26.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/masking")), r.weight !== void 0 && r.weight !== null && (_this26._imageWeight = r.weight), r.mask_source !== void 0 && r.mask_source !== null && (_this26._maskSource = r.mask_source), Mi.cleanConfig(r), Object.assign(_this26.rawBody, r)), _this26.canSendMessage = Mi.canSendFileTextMessage;
|
7171
7177
|
return _this26;
|
@@ -7534,7 +7540,7 @@ var ki = /*#__PURE__*/function (_Ki3) {
|
|
7534
7540
|
}
|
7535
7541
|
}
|
7536
7542
|
};
|
7537
|
-
_this29 = _callSuper(this, ki, [e,
|
7543
|
+
_this29 = _callSuper(this, ki, [e, Re.buildKeyVerificationDetails(), Re.buildHeaders, i, s]), _this29.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/image-to-image", _this29.textInputPlaceholderText = "Describe image changes", _this29.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>";
|
7538
7544
|
var r = (o = t.stabilityAI) == null ? void 0 : o.imageToImage;
|
7539
7545
|
_typeof(r) == "object" && (r.engine_id && (_this29.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/text-to-image")), r.weight !== void 0 && r.weight !== null && (_this29._imageWeight = r.weight), ki.cleanConfig(r), Object.assign(_this29.rawBody, r)), _this29.canSendMessage = ki.canSendFileTextMessage;
|
7540
7546
|
return _this29;
|
@@ -7672,7 +7678,7 @@ var Li = /*#__PURE__*/function (_Ki4) {
|
|
7672
7678
|
var r;
|
7673
7679
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
7674
7680
|
i = t.stabilityAI;
|
7675
|
-
_this30 = _callSuper(this, Li, [e,
|
7681
|
+
_this30 = _callSuper(this, Li, [e, Re.buildKeyVerificationDetails(), Re.buildHeaders, i]), _this30.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/text-to-image", _this30.textInputPlaceholderText = "Describe an image", _this30.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>";
|
7676
7682
|
var s = (r = t.stabilityAI) == null ? void 0 : r.textToImage;
|
7677
7683
|
_typeof(s) == "object" && (s.engine_id && (_this30.url = "https://api.stability.ai/v1/generation/".concat(s.engine_id, "/text-to-image")), s.weight !== void 0 && s.weight !== null && (_this30._imageWeight = s.weight), Li.cleanConfig(s), Object.assign(_this30.rawBody, s)), _this30.canSendMessage = Li.canSendTextMessage;
|
7678
7684
|
return _this30;
|
@@ -8182,7 +8188,7 @@ var le = /*#__PURE__*/function () {
|
|
8182
8188
|
}]);
|
8183
8189
|
}();
|
8184
8190
|
le.FILES_WITH_TEXT_ERROR = "content with type `text` must have `text` values", le.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.";
|
8185
|
-
var
|
8191
|
+
var ke = le;
|
8186
8192
|
var He = /*#__PURE__*/function (_W3) {
|
8187
8193
|
// prettier-ignore
|
8188
8194
|
function He(e, t, i, s, r, o) {
|
@@ -8329,7 +8335,7 @@ var He = /*#__PURE__*/function (_W3) {
|
|
8329
8335
|
break;
|
8330
8336
|
}
|
8331
8337
|
_context75.next = 16;
|
8332
|
-
return
|
8338
|
+
return ke.storeFiles(this, e, i, this.urlSegments.storeFiles);
|
8333
8339
|
case 16:
|
8334
8340
|
_context75.t1 = _context75.sent;
|
8335
8341
|
_context75.next = 20;
|
@@ -8412,7 +8418,7 @@ var He = /*#__PURE__*/function (_W3) {
|
|
8412
8418
|
_context77.next = 6;
|
8413
8419
|
break;
|
8414
8420
|
}
|
8415
|
-
throw e.error.message.startsWith(
|
8421
|
+
throw e.error.message.startsWith(ke.FILES_WITH_TEXT_ERROR) ? Error("Please send text with your file(s)") : e.error.message;
|
8416
8422
|
case 6:
|
8417
8423
|
_context77.next = 8;
|
8418
8424
|
return this.assignThreadAndRun(e);
|
@@ -8496,7 +8502,7 @@ var He = /*#__PURE__*/function (_W3) {
|
|
8496
8502
|
case 9:
|
8497
8503
|
i = _context79.sent;
|
8498
8504
|
case 10:
|
8499
|
-
return _context79.abrupt("return",
|
8505
|
+
return _context79.abrupt("return", ke.processAPIMessages(this, i, t, this.urlSegments));
|
8500
8506
|
case 11:
|
8501
8507
|
case "end":
|
8502
8508
|
return _context79.stop();
|
@@ -8597,7 +8603,7 @@ var He = /*#__PURE__*/function (_W3) {
|
|
8597
8603
|
_context81.next = 8;
|
8598
8604
|
break;
|
8599
8605
|
}
|
8600
|
-
throw Error(
|
8606
|
+
throw Error(ke.FUNCTION_TOOL_RESP_ERROR);
|
8601
8607
|
case 8:
|
8602
8608
|
_context81.next = 10;
|
8603
8609
|
return Promise.all(i);
|
@@ -8609,7 +8615,7 @@ var He = /*#__PURE__*/function (_W3) {
|
|
8609
8615
|
_context81.next = 13;
|
8610
8616
|
break;
|
8611
8617
|
}
|
8612
|
-
throw Error(
|
8618
|
+
throw Error(ke.FUNCTION_TOOL_RESP_ERROR);
|
8613
8619
|
case 13:
|
8614
8620
|
r = s.map(function (l, c) {
|
8615
8621
|
return {
|
@@ -8714,7 +8720,7 @@ var He = /*#__PURE__*/function (_W3) {
|
|
8714
8720
|
}
|
8715
8721
|
l = e.content.find(function (d) {
|
8716
8722
|
return !!d.text;
|
8717
|
-
}) || e.content[0], c =
|
8723
|
+
}) || e.content[0], c = ke.getFilesAndText.bind(this, this, {
|
8718
8724
|
role: "assistant",
|
8719
8725
|
content: e.content
|
8720
8726
|
}, this.urlSegments, l);
|
@@ -8738,7 +8744,7 @@ var He = /*#__PURE__*/function (_W3) {
|
|
8738
8744
|
break;
|
8739
8745
|
}
|
8740
8746
|
_context83.next = 11;
|
8741
|
-
return
|
8747
|
+
return ke.processStreamMessages(this, e.delta.content, this.urlSegments);
|
8742
8748
|
case 11:
|
8743
8749
|
_l = _context83.sent;
|
8744
8750
|
return _context83.abrupt("return", {
|
@@ -11939,8 +11945,8 @@ var he = /*#__PURE__*/function () {
|
|
11939
11945
|
key: "updateHTMLMessage",
|
11940
11946
|
value: function updateHTMLMessage(e, t, i) {
|
11941
11947
|
var s, r, o;
|
11942
|
-
if (t[1].html)
|
11943
|
-
var a =
|
11948
|
+
if (t[1].html) Ae.overwriteElements(e, i, t[1].html);else {
|
11949
|
+
var a = Ae.create(e, i, t[0].role),
|
11944
11950
|
l = ((r = t[1].files) == null ? void 0 : r[((s = t[1].files) == null ? void 0 : s.length) - 1]) || t[1].text,
|
11945
11951
|
c = l.outerContainer.nextSibling;
|
11946
11952
|
(o = c == null ? void 0 : c.parentElement) == null || o.insertBefore(a.outerContainer, c), e.messageElementRefs.splice(e.messageElementRefs.length - 1, 1);
|
@@ -12108,7 +12114,7 @@ var fe = /*#__PURE__*/function (_pe) {
|
|
12108
12114
|
value: function addIntroductoryMessage(e, t) {
|
12109
12115
|
var s;
|
12110
12116
|
var i;
|
12111
|
-
return e != null && e.text ? i = this.createAndAppendNewMessageElement(e.text, v.AI_ROLE) : e != null && e.html && (i =
|
12117
|
+
return e != null && e.text ? i = this.createAndAppendNewMessageElement(e.text, v.AI_ROLE) : e != null && e.html && (i = Ae.add(this, e.html, v.AI_ROLE, this.messageElementRefs)), i && (this.applyCustomStyles(i, v.AI_ROLE, !1, (s = this.messageStyles) == null ? void 0 : s.intro), i.outerContainer.classList.add(pe.INTRO_CLASS), t && (i.outerContainer.style.display = "none")), i;
|
12112
12118
|
}
|
12113
12119
|
}, {
|
12114
12120
|
key: "removeIntroductoryMessage",
|
@@ -12141,8 +12147,8 @@ var fe = /*#__PURE__*/function (_pe) {
|
|
12141
12147
|
value: function tryAddHTMLMessage(e, t) {
|
12142
12148
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
|
12143
12149
|
if (e.html !== void 0 && e.html !== null) {
|
12144
|
-
var s =
|
12145
|
-
|
12150
|
+
var s = Ae.add(this, e.html, e.role, this.messageElementRefs, t, i);
|
12151
|
+
we.isElementTemporary(s) && delete e.html;
|
12146
12152
|
}
|
12147
12153
|
}
|
12148
12154
|
// this should not be activated by streamed messages
|
@@ -12179,7 +12185,7 @@ var fe = /*#__PURE__*/function (_pe) {
|
|
12179
12185
|
value: function removeMessageOnError() {
|
12180
12186
|
var e = this.messageElementRefs[this.messageElementRefs.length - 1],
|
12181
12187
|
t = e == null ? void 0 : e.bubbleElement;
|
12182
|
-
(t != null && t.classList.contains(
|
12188
|
+
(t != null && t.classList.contains(Te.MESSAGE_CLASS) && t.textContent === "" || fe.isTemporaryElement(e)) && this.removeLastMessage();
|
12183
12189
|
}
|
12184
12190
|
// prettier-ignore
|
12185
12191
|
}, {
|
@@ -12224,9 +12230,9 @@ var fe = /*#__PURE__*/function (_pe) {
|
|
12224
12230
|
value: function addDefaultLoadingMessage() {
|
12225
12231
|
var e = this.createMessageElements("", v.AI_ROLE),
|
12226
12232
|
t = e.bubbleElement;
|
12227
|
-
e.bubbleElement.classList.add(
|
12233
|
+
e.bubbleElement.classList.add(De.DOTS_CONTAINER_CLASS);
|
12228
12234
|
var i = document.createElement("div");
|
12229
|
-
return i.classList.add("loading-message-dots"), t.appendChild(i),
|
12235
|
+
return i.classList.add("loading-message-dots"), t.appendChild(i), De.setDots(t, this.messageStyles), e;
|
12230
12236
|
}
|
12231
12237
|
}, {
|
12232
12238
|
key: "addLoadingMessage",
|
@@ -12236,8 +12242,8 @@ var fe = /*#__PURE__*/function (_pe) {
|
|
12236
12242
|
var t = this.messageElementRefs[this.messageElementRefs.length - 1];
|
12237
12243
|
if (pe.isLoadingMessage(t) || !e && !this._isLoadingMessageAllowed) return;
|
12238
12244
|
var i = (a = (o = (r = this.messageStyles) == null ? void 0 : r.loading) == null ? void 0 : o.message) == null ? void 0 : a.html,
|
12239
|
-
s = i ?
|
12240
|
-
this.appendOuterContainerElemet(s.outerContainer), s.bubbleElement.classList.add(
|
12245
|
+
s = i ? Ae.createElements(this, i, v.AI_ROLE, !1) : this.addDefaultLoadingMessage();
|
12246
|
+
this.appendOuterContainerElemet(s.outerContainer), s.bubbleElement.classList.add(De.BUBBLE_CLASS), this.applyCustomStyles(s, v.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 || ee.scrollToBottom(this.elementRef);
|
12241
12247
|
}
|
12242
12248
|
}, {
|
12243
12249
|
key: "populateIntroPanel",
|
@@ -12322,7 +12328,7 @@ var fe = /*#__PURE__*/function (_pe) {
|
|
12322
12328
|
}, {
|
12323
12329
|
key: "isActiveElement",
|
12324
12330
|
value: function isActiveElement(e) {
|
12325
|
-
return e ? e.contains(
|
12331
|
+
return e ? e.contains(De.BUBBLE_CLASS) || e.contains(Be.CLASS) || e.contains(Te.MESSAGE_CLASS) : !1;
|
12326
12332
|
}
|
12327
12333
|
}]);
|
12328
12334
|
}(pe);
|
@@ -14339,32 +14345,32 @@ var ti = /*#__PURE__*/function (_li) {
|
|
14339
14345
|
}(li);
|
14340
14346
|
ti.MICROPHONE_RESET_TIMEOUT_MS = 300;
|
14341
14347
|
var ci = ti;
|
14342
|
-
var
|
14348
|
+
var Ne = /*#__PURE__*/function () {
|
14343
14349
|
// prettier-ignore
|
14344
|
-
function
|
14350
|
+
function Ne(e, t, i, s) {
|
14345
14351
|
var _this75 = this;
|
14346
|
-
_classCallCheck(this,
|
14352
|
+
_classCallCheck(this, Ne);
|
14347
14353
|
this._attachments = [], this._fileCountLimit = 99, this._acceptedFormat = "", t.maxNumberOfFiles && (this._fileCountLimit = t.maxNumberOfFiles), this._toggleContainerDisplay = i, this._fileAttachmentsContainerRef = s, t.acceptedFormats && (this._acceptedFormat = t.acceptedFormats), setTimeout(function () {
|
14348
14354
|
_this75._validationHandler = e._validationHandler;
|
14349
14355
|
});
|
14350
14356
|
}
|
14351
|
-
return _createClass(
|
14357
|
+
return _createClass(Ne, [{
|
14352
14358
|
key: "attemptAddFile",
|
14353
14359
|
value: function attemptAddFile(e, t) {
|
14354
|
-
return
|
14360
|
+
return Ne.isFileTypeValid(e, this._acceptedFormat) ? (this.addAttachmentBasedOnType(e, t, !0), !0) : !1;
|
14355
14361
|
}
|
14356
14362
|
}, {
|
14357
14363
|
key: "addAttachmentBasedOnType",
|
14358
14364
|
value: function addAttachmentBasedOnType(e, t, i) {
|
14359
|
-
var s =
|
14365
|
+
var s = Ne.getTypeFromBlob(e);
|
14360
14366
|
if (s === "image") {
|
14361
|
-
var r =
|
14367
|
+
var r = Ne.createImageAttachment(t);
|
14362
14368
|
this.addFileAttachment(e, "image", r, i);
|
14363
14369
|
} else if (s === "audio") {
|
14364
14370
|
var _r2 = di.createAudioAttachment(t);
|
14365
14371
|
this.addFileAttachment(e, "audio", _r2, i);
|
14366
14372
|
} else {
|
14367
|
-
var _r3 =
|
14373
|
+
var _r3 = Ne.createAnyFileAttachment(e.name);
|
14368
14374
|
this.addFileAttachment(e, "any", _r3, i);
|
14369
14375
|
}
|
14370
14376
|
}
|
@@ -14372,7 +14378,7 @@ var Pe = /*#__PURE__*/function () {
|
|
14372
14378
|
key: "addFileAttachment",
|
14373
14379
|
value: function addFileAttachment(e, t, i, s) {
|
14374
14380
|
var a;
|
14375
|
-
var r =
|
14381
|
+
var r = Ne.createContainer(i);
|
14376
14382
|
if (this._attachments.length >= this._fileCountLimit) {
|
14377
14383
|
var l = this._attachments[this._attachments.length - 1].removeButton;
|
14378
14384
|
l == null || l.click();
|
@@ -14472,19 +14478,19 @@ var Pe = /*#__PURE__*/function () {
|
|
14472
14478
|
}
|
14473
14479
|
}]);
|
14474
14480
|
}();
|
14475
|
-
var
|
14481
|
+
var Oe = /*#__PURE__*/function (_Ne) {
|
14476
14482
|
// prettier-ignore
|
14477
|
-
function
|
14478
|
-
_classCallCheck(this,
|
14479
|
-
return _callSuper(this,
|
14483
|
+
function Oe(e, t, i, s) {
|
14484
|
+
_classCallCheck(this, Oe);
|
14485
|
+
return _callSuper(this, Oe, [e, t, i, s]);
|
14480
14486
|
}
|
14481
|
-
_inherits(
|
14482
|
-
return _createClass(
|
14487
|
+
_inherits(Oe, _Ne);
|
14488
|
+
return _createClass(Oe, [{
|
14483
14489
|
key: "createTimer",
|
14484
14490
|
value: function createTimer(e, t) {
|
14485
14491
|
var _this76 = this;
|
14486
14492
|
var i = 0;
|
14487
|
-
var s = t !== void 0 && t <
|
14493
|
+
var s = t !== void 0 && t < Oe.TIMER_LIMIT_S ? t : Oe.TIMER_LIMIT_S;
|
14488
14494
|
return setInterval(function () {
|
14489
14495
|
var a;
|
14490
14496
|
i += 1, i === s && ((a = _this76.stopPlaceholderCallback) == null || a.call(_this76), _this76.clearTimer()), i === 600 && e.classList.add("audio-placeholder-text-4-digits");
|
@@ -14496,7 +14502,7 @@ var Ie = /*#__PURE__*/function (_Pe) {
|
|
14496
14502
|
}, {
|
14497
14503
|
key: "createPlaceholderAudioAttachment",
|
14498
14504
|
value: function createPlaceholderAudioAttachment(e) {
|
14499
|
-
var t =
|
14505
|
+
var t = Oe.createAudioContainer(),
|
14500
14506
|
i = document.createElement("div");
|
14501
14507
|
i.classList.add("audio-placeholder-text-3-digits");
|
14502
14508
|
var s = document.createElement("div");
|
@@ -14533,7 +14539,7 @@ var Ie = /*#__PURE__*/function (_Pe) {
|
|
14533
14539
|
key: "completePlaceholderAttachment",
|
14534
14540
|
value: function completePlaceholderAttachment(e, t) {
|
14535
14541
|
var i = this._activePlaceholderAttachment;
|
14536
|
-
i && (i.file = e,
|
14542
|
+
i && (i.file = e, Oe.addAudioElements(i.attachmentContainerElement.children[0], t), i.removeButton = this.createRemoveAttachmentButton(i), i.attachmentContainerElement.appendChild(i.removeButton), this._activePlaceholderAttachment = void 0, this.clearTimer());
|
14537
14543
|
}
|
14538
14544
|
}, {
|
14539
14545
|
key: "removePlaceholderAttachment",
|
@@ -14573,8 +14579,8 @@ var Ie = /*#__PURE__*/function (_Pe) {
|
|
14573
14579
|
}, {
|
14574
14580
|
key: "createAudioAttachment",
|
14575
14581
|
value: function createAudioAttachment(e) {
|
14576
|
-
var t =
|
14577
|
-
return
|
14582
|
+
var t = Oe.createAudioContainer();
|
14583
|
+
return Oe.addAudioElements(t, e), t;
|
14578
14584
|
}
|
14579
14585
|
}, {
|
14580
14586
|
key: "stopAttachmentPlayback",
|
@@ -14583,9 +14589,9 @@ var Ie = /*#__PURE__*/function (_Pe) {
|
|
14583
14589
|
(s = (i = (t = e.children[0]) == null ? void 0 : t.children) == null ? void 0 : i[0]) != null && s.classList.contains("stop-icon") && e.children[0].click();
|
14584
14590
|
}
|
14585
14591
|
}]);
|
14586
|
-
}(
|
14587
|
-
|
14588
|
-
var di =
|
14592
|
+
}(Ne);
|
14593
|
+
Oe.TIMER_LIMIT_S = 5999;
|
14594
|
+
var di = Oe;
|
14589
14595
|
var Ma = /*#__PURE__*/function () {
|
14590
14596
|
function Ma() {
|
14591
14597
|
_classCallCheck(this, Ma);
|
@@ -14595,7 +14601,7 @@ var Ma = /*#__PURE__*/function () {
|
|
14595
14601
|
value:
|
14596
14602
|
// prettier-ignore
|
14597
14603
|
function create(e, t, i, s, r) {
|
14598
|
-
return r === "audio" ? new di(e, t, i, s) : new
|
14604
|
+
return r === "audio" ? new di(e, t, i, s) : new Ne(e, t, i, s);
|
14599
14605
|
}
|
14600
14606
|
}]);
|
14601
14607
|
}();
|
@@ -14876,15 +14882,15 @@ var Jt = /*#__PURE__*/function (_ct5) {
|
|
14876
14882
|
}
|
14877
14883
|
}]);
|
14878
14884
|
}(ct);
|
14879
|
-
var
|
14880
|
-
function
|
14881
|
-
_classCallCheck(this,
|
14885
|
+
var Pe = /*#__PURE__*/function () {
|
14886
|
+
function Pe() {
|
14887
|
+
_classCallCheck(this, Pe);
|
14882
14888
|
}
|
14883
|
-
return _createClass(
|
14889
|
+
return _createClass(Pe, null, [{
|
14884
14890
|
key: "create",
|
14885
14891
|
value: function create(e, t, i) {
|
14886
|
-
var s =
|
14887
|
-
|
14892
|
+
var s = Pe.createElement(i);
|
14893
|
+
Pe.addEvents(s, e, t), e.appendChild(s);
|
14888
14894
|
}
|
14889
14895
|
}, {
|
14890
14896
|
key: "createElement",
|
@@ -14896,13 +14902,13 @@ var Oe = /*#__PURE__*/function () {
|
|
14896
14902
|
key: "addEvents",
|
14897
14903
|
value: function addEvents(e, t, i) {
|
14898
14904
|
t.ondragenter = function (s) {
|
14899
|
-
s.preventDefault(),
|
14905
|
+
s.preventDefault(), Pe.display(e);
|
14900
14906
|
}, e.ondragleave = function (s) {
|
14901
|
-
s.preventDefault(),
|
14907
|
+
s.preventDefault(), Pe.hide(e);
|
14902
14908
|
}, e.ondragover = function (s) {
|
14903
14909
|
s.preventDefault();
|
14904
14910
|
}, e.ondrop = function (s) {
|
14905
|
-
s.preventDefault(),
|
14911
|
+
s.preventDefault(), Pe.uploadFile(i, s), Pe.hide(e);
|
14906
14912
|
};
|
14907
14913
|
}
|
14908
14914
|
}, {
|
@@ -15273,7 +15279,7 @@ var I = /*#__PURE__*/function (_ct6) {
|
|
15273
15279
|
e.files && (t.files = Array.from(e.files).map(function (i) {
|
15274
15280
|
return {
|
15275
15281
|
file: i,
|
15276
|
-
type:
|
15282
|
+
type: Ne.getTypeFromBlob(i)
|
15277
15283
|
};
|
15278
15284
|
})), setTimeout(function () {
|
15279
15285
|
return _this88.attemptSubmit(t, !0);
|
@@ -15655,7 +15661,7 @@ var Xt = /*#__PURE__*/function () {
|
|
15655
15661
|
button: new ka(_d, t.recordAudio)
|
15656
15662
|
};
|
15657
15663
|
}
|
15658
|
-
return
|
15664
|
+
return Pe.isEnabled(r, e.dragAndDrop) && Pe.create(i, r, e.dragAndDrop), r;
|
15659
15665
|
}
|
15660
15666
|
// prettier-ignore
|
15661
15667
|
}], [{
|