deep-chat-dev 9.0.42 → 9.0.45
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 +2582 -2202
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.d.ts +4 -0
- package/dist/deepChat.d.ts.map +1 -1
- package/dist/deepChat.js +682 -623
- package/dist/services/serviceIO.d.ts +1 -2
- package/dist/services/serviceIO.d.ts.map +1 -1
- package/dist/services/utils/baseServiceIO.d.ts.map +1 -1
- package/dist/types/avatars.d.ts.map +1 -1
- package/dist/types/insertKeyViewStyles.d.ts +4 -0
- package/dist/types/insertKeyViewStyles.d.ts.map +1 -0
- package/dist/types/validationHandler.d.ts +2 -0
- package/dist/types/validationHandler.d.ts.map +1 -0
- package/dist/views/chat/input/buttons/customButtonInnerElements.d.ts +1 -1
- package/dist/views/chat/input/buttons/customButtonInnerElements.d.ts.map +1 -1
- package/dist/views/chat/input/buttons/submit/submitButton.d.ts +3 -1
- package/dist/views/chat/input/buttons/submit/submitButton.d.ts.map +1 -1
- package/dist/views/chat/input/fileAttachments/fileAttachmentTypes/audioFileAttachmentType.d.ts +2 -1
- package/dist/views/chat/input/fileAttachments/fileAttachmentTypes/audioFileAttachmentType.d.ts.map +1 -1
- package/dist/views/chat/input/fileAttachments/fileAttachmentTypes/fileAttachmentTypeFactory.d.ts +2 -1
- package/dist/views/chat/input/fileAttachments/fileAttachmentTypes/fileAttachmentTypeFactory.d.ts.map +1 -1
- package/dist/views/chat/input/fileAttachments/fileAttachmentTypes/fileAttachmentsType.d.ts +3 -1
- package/dist/views/chat/input/fileAttachments/fileAttachmentTypes/fileAttachmentsType.d.ts.map +1 -1
- package/dist/views/chat/input/fileAttachments/fileAttachments.d.ts +2 -1
- package/dist/views/chat/input/fileAttachments/fileAttachments.d.ts.map +1 -1
- package/dist/views/chat/input/input.d.ts +1 -0
- package/dist/views/chat/input/input.d.ts.map +1 -1
- package/dist/views/chat/input/textInput/inputEvents.d.ts +9 -0
- package/dist/views/chat/input/textInput/inputEvents.d.ts.map +1 -0
- package/dist/views/chat/input/textInput/textInput.d.ts +2 -2
- package/dist/views/chat/input/textInput/textInput.d.ts.map +1 -1
- package/dist/views/insertKey/insertKeyView.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/views/chat/input/textInput/inputLimit.d.ts +0 -8
- package/dist/views/chat/input/textInput/inputLimit.d.ts.map +0 -1
package/dist/deepChat.js
CHANGED
@@ -178,37 +178,24 @@ Sn.DEFAULT_COMPONENT_STYLE = {
|
|
178
178
|
position: "relative"
|
179
179
|
};
|
180
180
|
var oi = Sn;
|
181
|
-
var
|
181
|
+
var T = /* @__PURE__ */function (n) {
|
182
182
|
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;
|
183
|
-
}(
|
183
|
+
}(T || {});
|
184
184
|
var ce = /*#__PURE__*/_createClass(function ce() {
|
185
185
|
_classCallCheck(this, ce);
|
186
186
|
});
|
187
187
|
ce.IS_SAFARI = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
188
188
|
ce.IS_CHROMIUM = window.chrome;
|
189
|
-
var rr = /*#__PURE__*/function () {
|
190
|
-
function rr() {
|
191
|
-
_classCallCheck(this, rr);
|
192
|
-
}
|
193
|
-
_createClass(rr, null, [{
|
194
|
-
key: "sanitizePastedTextContent",
|
195
|
-
value: function sanitizePastedTextContent(e) {
|
196
|
-
var i, r;
|
197
|
-
e.preventDefault();
|
198
|
-
var t = (i = e.clipboardData) == null ? void 0 : i.getData("text/plain");
|
199
|
-
(r = document.execCommand) == null || r.call(document, "insertHTML", !1, t);
|
200
|
-
}
|
201
|
-
}]);
|
202
|
-
return rr;
|
203
|
-
}();
|
204
189
|
var wn = /*#__PURE__*/function () {
|
205
|
-
function
|
206
|
-
_classCallCheck(this,
|
190
|
+
function Ge() {
|
191
|
+
_classCallCheck(this, Ge);
|
207
192
|
}
|
208
|
-
_createClass(
|
193
|
+
_createClass(Ge, null, [{
|
209
194
|
key: "add",
|
210
|
-
value:
|
211
|
-
|
195
|
+
value:
|
196
|
+
// WORK - check why rendered twice as addEventListeners will be called twice
|
197
|
+
function add(e, t, i) {
|
198
|
+
t !== void 0 && e.addEventListener("keydown", Ge.onKeyDown.bind(this, t)), e.oninput = Ge.onInput.bind(this, t, i);
|
212
199
|
}
|
213
200
|
// preventing insertion early for a nicer UX
|
214
201
|
// prettier-ignore
|
@@ -216,7 +203,7 @@ var wn = /*#__PURE__*/function () {
|
|
216
203
|
key: "onKeyDown",
|
217
204
|
value: function onKeyDown(e, t) {
|
218
205
|
var r = t.target.textContent;
|
219
|
-
r && r.length >= e && !
|
206
|
+
r && r.length >= e && !Ge.PERMITTED_KEYS.has(t.key) && !Ge.isKeyCombinationPermitted(t) && t.preventDefault();
|
220
207
|
}
|
221
208
|
}, {
|
222
209
|
key: "isKeyCombinationPermitted",
|
@@ -224,50 +211,70 @@ var wn = /*#__PURE__*/function () {
|
|
224
211
|
return e.key === "a" ? e.ctrlKey || e.metaKey : !1;
|
225
212
|
}
|
226
213
|
// removing text characters after paste or other events
|
214
|
+
// prettier-ignore
|
227
215
|
}, {
|
228
216
|
key: "onInput",
|
229
|
-
value: function onInput(e, t) {
|
230
|
-
var
|
231
|
-
|
232
|
-
|
217
|
+
value: function onInput(e, t, i) {
|
218
|
+
var r = i.target,
|
219
|
+
s = r.textContent;
|
220
|
+
s && (e !== void 0 && s.length > e && (r.textContent = s.substring(0, e), Ft.focusEndOfInput(r)), t == null || t());
|
233
221
|
}
|
234
222
|
}]);
|
235
|
-
return
|
223
|
+
return Ge;
|
224
|
+
}();
|
225
|
+
wn.PERMITTED_KEYS = /* @__PURE__ */new Set([T.BACKSPACE, T.DELETE, T.ARROW_RIGHT, T.ARROW_LEFT, T.ARROW_DOWN, T.ARROW_UP, T.META, T.CONTROL, T.ENTER]);
|
226
|
+
var rr = wn;
|
227
|
+
var sr = /*#__PURE__*/function () {
|
228
|
+
function sr() {
|
229
|
+
_classCallCheck(this, sr);
|
230
|
+
}
|
231
|
+
_createClass(sr, null, [{
|
232
|
+
key: "sanitizePastedTextContent",
|
233
|
+
value: function sanitizePastedTextContent(e) {
|
234
|
+
var i, r;
|
235
|
+
e.preventDefault();
|
236
|
+
var t = (i = e.clipboardData) == null ? void 0 : i.getData("text/plain");
|
237
|
+
(r = document.execCommand) == null || r.call(document, "insertHTML", !1, t);
|
238
|
+
}
|
239
|
+
}]);
|
240
|
+
return sr;
|
236
241
|
}();
|
237
|
-
wn.PERMITTED_KEYS = /* @__PURE__ */new Set([C.BACKSPACE, C.DELETE, C.ARROW_RIGHT, C.ARROW_LEFT, C.ARROW_DOWN, C.ARROW_UP, C.META, C.CONTROL, C.ENTER]);
|
238
|
-
var sr = wn;
|
239
242
|
var _n = /*#__PURE__*/function () {
|
240
|
-
function
|
241
|
-
|
243
|
+
function Ie(e, t) {
|
244
|
+
var _this = this;
|
245
|
+
_classCallCheck(this, Ie);
|
242
246
|
var r;
|
243
|
-
var i =
|
244
|
-
this.elementRef =
|
247
|
+
var i = Ie.processConfig(t, e.textInput);
|
248
|
+
this.elementRef = Ie.createContainerElement((r = i == null ? void 0 : i.styles) == null ? void 0 : r.container), this.inputElementRef = this.createInputElement(i), this._config = i, this.elementRef.appendChild(this.inputElementRef), setTimeout(function () {
|
249
|
+
var s;
|
250
|
+
rr.add(_this.inputElementRef, (s = e.textInput) == null ? void 0 : s.characterLimit, e._validationHandler);
|
251
|
+
});
|
245
252
|
}
|
246
|
-
_createClass(
|
253
|
+
_createClass(Ie, [{
|
247
254
|
key: "createInputElement",
|
248
255
|
value: function createInputElement(e) {
|
249
256
|
var i, r, s;
|
250
257
|
var t = document.createElement("div");
|
251
|
-
return t.id =
|
258
|
+
return t.id = Ie.TEXT_INPUT_ID, t.classList.add("text-input-styling", "text-input-placeholder"), t.innerText = ((i = e == null ? void 0 : e.placeholder) == null ? void 0 : i.text) || "Ask me anything!", ce.IS_CHROMIUM && Ie.preventAutomaticScrollUpOnNewLine(t), typeof (e == null ? void 0 : e.disabled) == "boolean" && e.disabled === !0 ? (t.contentEditable = "false", t.classList.add("text-input-disabled")) : (t.contentEditable = "true", this.addEventListeners(t, e)), Object.assign(t.style, (r = e == null ? void 0 : e.styles) == null ? void 0 : r.text), Object.assign(t.style, (s = e == null ? void 0 : e.placeholder) == null ? void 0 : s.style), t;
|
252
259
|
}
|
253
260
|
}, {
|
254
261
|
key: "removeTextIfPlaceholder",
|
255
262
|
value: function removeTextIfPlaceholder() {
|
256
263
|
var e, t, i, r;
|
257
|
-
this.inputElementRef.classList.contains("text-input-placeholder") && !this.inputElementRef.classList.contains("text-input-disabled") && ((e = this._config.placeholder) != null && e.style && (_.unsetStyle(this.inputElementRef, (t = this._config.placeholder) == null ? void 0 : t.style), Object.assign(this.inputElementRef.style, (r = (i = this._config) == null ? void 0 : i.styles) == null ? void 0 : r.text)),
|
264
|
+
this.inputElementRef.classList.contains("text-input-placeholder") && !this.inputElementRef.classList.contains("text-input-disabled") && ((e = this._config.placeholder) != null && e.style && (_.unsetStyle(this.inputElementRef, (t = this._config.placeholder) == null ? void 0 : t.style), Object.assign(this.inputElementRef.style, (r = (i = this._config) == null ? void 0 : i.styles) == null ? void 0 : r.text)), Ie.clear(this.inputElementRef), this.inputElementRef.classList.remove("text-input-placeholder"));
|
258
265
|
}
|
259
266
|
}, {
|
260
267
|
key: "addEventListeners",
|
261
268
|
value: function addEventListeners(e, t) {
|
262
269
|
var i, r, s;
|
263
|
-
e.onfocus = this.onFocus.bind(this, (i = t == null ? void 0 : t.styles) == null ? void 0 : i.focus), (r = t == null ? void 0 : t.styles) != null && r.focus && (e.onblur = this.onBlur.bind(this, t.styles.focus, (s = t == null ? void 0 : t.styles) == null ? void 0 : s.container)), e.addEventListener("keydown", this.onKeydown.bind(this)), e.onpaste =
|
270
|
+
e.onfocus = this.onFocus.bind(this, (i = t == null ? void 0 : t.styles) == null ? void 0 : i.focus), (r = t == null ? void 0 : t.styles) != null && r.focus && (e.onblur = this.onBlur.bind(this, t.styles.focus, (s = t == null ? void 0 : t.styles) == null ? void 0 : s.container)), e.addEventListener("keydown", this.onKeydown.bind(this)), e.onpaste = sr.sanitizePastedTextContent;
|
264
271
|
}
|
265
272
|
}, {
|
266
273
|
key: "onFocus",
|
267
274
|
value: function onFocus(e) {
|
268
|
-
var
|
275
|
+
var _this2 = this;
|
269
276
|
ce.IS_SAFARI ? setTimeout(function () {
|
270
|
-
|
277
|
+
_this2.removeTextIfPlaceholder();
|
271
278
|
}) : this.removeTextIfPlaceholder(), Object.assign(this.elementRef.style, e);
|
272
279
|
}
|
273
280
|
}, {
|
@@ -279,7 +286,7 @@ var _n = /*#__PURE__*/function () {
|
|
279
286
|
key: "onKeydown",
|
280
287
|
value: function onKeydown(e) {
|
281
288
|
var t;
|
282
|
-
e.key ===
|
289
|
+
e.key === T.ENTER && !e.ctrlKey && !e.shiftKey && (e.preventDefault(), (t = this.submit) == null || t.call(this));
|
283
290
|
}
|
284
291
|
}], [{
|
285
292
|
key: "processConfig",
|
@@ -326,10 +333,10 @@ var _n = /*#__PURE__*/function () {
|
|
326
333
|
return t.id = "text-input-container", Object.assign(t.style, e), t;
|
327
334
|
}
|
328
335
|
}]);
|
329
|
-
return
|
336
|
+
return Ie;
|
330
337
|
}();
|
331
338
|
_n.TEXT_INPUT_ID = "text-input";
|
332
|
-
var
|
339
|
+
var Ti = _n;
|
333
340
|
var Ft = /*#__PURE__*/function () {
|
334
341
|
function Ft() {
|
335
342
|
_classCallCheck(this, Ft);
|
@@ -345,7 +352,7 @@ var Ft = /*#__PURE__*/function () {
|
|
345
352
|
}, {
|
346
353
|
key: "focusFromParentElement",
|
347
354
|
value: function focusFromParentElement(e) {
|
348
|
-
var t = e.querySelector("#".concat(
|
355
|
+
var t = e.querySelector("#".concat(Ti.TEXT_INPUT_ID));
|
349
356
|
t && Ft.focusEndOfInput(t);
|
350
357
|
}
|
351
358
|
}]);
|
@@ -362,7 +369,7 @@ function ar(n, e, t, i) {
|
|
362
369
|
s = t ? "".concat(Gi(e), " message after interceptor: ").concat(or(i), " \n") : "";
|
363
370
|
return "".concat(r + s, "Make sure the ").concat(e, " message is using the Response format: https://deepchat.dev/docs/connect/#Response \n You can also augment it using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor");
|
364
371
|
}
|
365
|
-
var
|
372
|
+
var C = {
|
366
373
|
INVALID_KEY: "Invalid API Key",
|
367
374
|
CONNECTION_FAILED: "Failed to connect",
|
368
375
|
INVALID_RESPONSE: ar,
|
@@ -469,29 +476,29 @@ function lr(_x6, _x7) {
|
|
469
476
|
return _lr.apply(this, arguments);
|
470
477
|
}
|
471
478
|
function _lr() {
|
472
|
-
_lr = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
479
|
+
_lr = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee77(n, e) {
|
473
480
|
var t, i;
|
474
|
-
return _regeneratorRuntime().wrap(function
|
475
|
-
while (1) switch (
|
481
|
+
return _regeneratorRuntime().wrap(function _callee77$(_context77) {
|
482
|
+
while (1) switch (_context77.prev = _context77.next) {
|
476
483
|
case 0:
|
477
484
|
t = n.getReader();
|
478
485
|
case 1:
|
479
|
-
|
486
|
+
_context77.next = 3;
|
480
487
|
return t.read();
|
481
488
|
case 3:
|
482
|
-
if ((i =
|
483
|
-
|
489
|
+
if ((i = _context77.sent).done) {
|
490
|
+
_context77.next = 7;
|
484
491
|
break;
|
485
492
|
}
|
486
493
|
e(i.value);
|
487
494
|
case 5:
|
488
|
-
|
495
|
+
_context77.next = 1;
|
489
496
|
break;
|
490
497
|
case 7:
|
491
498
|
case "end":
|
492
|
-
return
|
499
|
+
return _context77.stop();
|
493
500
|
}
|
494
|
-
},
|
501
|
+
}, _callee77);
|
495
502
|
}));
|
496
503
|
return _lr.apply(this, arguments);
|
497
504
|
}
|
@@ -603,7 +610,7 @@ function fr(n, e) {
|
|
603
610
|
}
|
604
611
|
function _D() {
|
605
612
|
_D = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
606
|
-
var
|
613
|
+
var Te, ne, j;
|
607
614
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
608
615
|
while (1) switch (_context3.prev = _context3.next) {
|
609
616
|
case 0:
|
@@ -635,7 +642,7 @@ function fr(n, e) {
|
|
635
642
|
_context3.prev = 14;
|
636
643
|
_context3.t0 = _context3["catch"](1);
|
637
644
|
if (!b.signal.aborted) try {
|
638
|
-
j = (
|
645
|
+
j = (Te = a == null ? void 0 : a(_context3.t0)) !== null && Te !== void 0 ? Te : g;
|
639
646
|
window.clearTimeout(E), E = window.setTimeout(D, j);
|
640
647
|
} catch (j) {
|
641
648
|
w(), p(j);
|
@@ -656,10 +663,10 @@ function mr(n) {
|
|
656
663
|
if (!(e != null && e.startsWith(bi))) throw new Error("Expected content-type to be ".concat(bi, ", Actual: ").concat(e));
|
657
664
|
}
|
658
665
|
var kn = /*#__PURE__*/function () {
|
659
|
-
function
|
660
|
-
_classCallCheck(this,
|
666
|
+
function Ve() {
|
667
|
+
_classCallCheck(this, Ve);
|
661
668
|
}
|
662
|
-
_createClass(
|
669
|
+
_createClass(Ve, null, [{
|
663
670
|
key: "generateResponse",
|
664
671
|
value: function generateResponse(e) {
|
665
672
|
var t = e.messages[e.messages.length - 1];
|
@@ -682,15 +689,15 @@ var kn = /*#__PURE__*/function () {
|
|
682
689
|
}, {
|
683
690
|
key: "getResponse",
|
684
691
|
value: function getResponse(e) {
|
685
|
-
return e.customDemoResponse ?
|
686
|
-
text:
|
692
|
+
return e.customDemoResponse ? Ve.getCustomResponse(e.customDemoResponse, e.messages[e.messages.length - 1]) : {
|
693
|
+
text: Ve.generateResponse(e)
|
687
694
|
};
|
688
695
|
}
|
689
696
|
// timeout is used to simulate a timeout for a response to come back
|
690
697
|
}, {
|
691
698
|
key: "request",
|
692
699
|
value: function request(e, t, i) {
|
693
|
-
var r =
|
700
|
+
var r = Ve.getResponse(e);
|
694
701
|
setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
695
702
|
var s;
|
696
703
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
@@ -721,12 +728,12 @@ var kn = /*#__PURE__*/function () {
|
|
721
728
|
value: function requestStream(e, t) {
|
722
729
|
setTimeout(function () {
|
723
730
|
var r;
|
724
|
-
var i = (r =
|
731
|
+
var i = (r = Ve.getResponse(e)) == null ? void 0 : r.text;
|
725
732
|
z.simulate(e, t, i);
|
726
733
|
}, 400);
|
727
734
|
}
|
728
735
|
}]);
|
729
|
-
return
|
736
|
+
return Ve;
|
730
737
|
}();
|
731
738
|
kn.URL = "deep-chat-demo";
|
732
739
|
var de = kn;
|
@@ -827,7 +834,7 @@ var z = /*#__PURE__*/function () {
|
|
827
834
|
if (JSON.stringify(w.data) !== JSON.stringify("[DONE]")) {
|
828
835
|
var q = JSON.parse(w.data);
|
829
836
|
(A = e.extractResultData) == null || A.call(e, q).then(function (D) {
|
830
|
-
(D == null ? void 0 : D.text) === void 0 ? console.error("Response data: ".concat(w.data, " \n ").concat(
|
837
|
+
(D == null ? void 0 : D.text) === void 0 ? console.error("Response data: ".concat(w.data, " \n ").concat(C.INVALID_STREAM_RESPONSE)) : p && i.updateStreamedMessage(D.text, p);
|
831
838
|
})["catch"](function (D) {
|
832
839
|
return M.displayError(i, D);
|
833
840
|
});
|
@@ -933,7 +940,7 @@ var ve = /*#__PURE__*/function () {
|
|
933
940
|
_context7.t0 = c;
|
934
941
|
case 8:
|
935
942
|
d = _context7.t0;
|
936
|
-
M.validateResponseFormat(d) ? typeof d.error == "string" ? (console.error(d.error), i.addNewErrorMessage("service", d.error), e.completionsHandlers.onFinish()) : e.deepChat.stream && d.text ? z.simulate(i, e.streamHandlers, d.text) : (i.addNewMessage(d, !0), e.completionsHandlers.onFinish()) : (console.error(
|
943
|
+
M.validateResponseFormat(d) ? typeof d.error == "string" ? (console.error(d.error), i.addNewErrorMessage("service", d.error), e.completionsHandlers.onFinish()) : e.deepChat.stream && d.text ? z.simulate(i, e.streamHandlers, d.text) : (i.addNewMessage(d, !0), e.completionsHandlers.onFinish()) : (console.error(C.INVALID_RESPONSE(c, "server", !!e.deepChat.responseInterceptor, d)), i.addNewErrorMessage("service", "Error in server message"), e.completionsHandlers.onFinish());
|
937
944
|
case 10:
|
938
945
|
case "end":
|
939
946
|
return _context7.stop();
|
@@ -972,7 +979,7 @@ var ve = /*#__PURE__*/function () {
|
|
972
979
|
r && (i.finaliseStreamedMessage(), e.streamHandlers.onClose(), r = !1);
|
973
980
|
},
|
974
981
|
c = function c(h) {
|
975
|
-
r && (!h || _typeof(h) != "object" || typeof h.error != "string" && typeof h.text != "string" ? console.error(
|
982
|
+
r && (!h || _typeof(h) != "object" || typeof h.error != "string" && typeof h.text != "string" ? console.error(C.INVALID_RESPONSE(h, "server", !1)) : h.error ? (console.error(h.error), i.finaliseStreamedMessage(), e.streamHandlers.onClose(), i.addNewErrorMessage("service", h.error), r = !1) : h.text && o && i.updateStreamedMessage(h.text, o));
|
976
983
|
};
|
977
984
|
e.streamHandlers.abortStream.abort = function () {
|
978
985
|
i.finaliseStreamedMessage(), e.streamHandlers.onClose(), r = !1;
|
@@ -1026,7 +1033,7 @@ var ve = /*#__PURE__*/function () {
|
|
1026
1033
|
_context9.t0 = d;
|
1027
1034
|
case 7:
|
1028
1035
|
u = _context9.t0;
|
1029
|
-
M.validateResponseFormat(u) ? typeof u.error == "string" ? (console.error(u.error), t.isLastMessageError() || t.addNewErrorMessage("service", u.error)) : e.deepChat.stream ? z.simulate(t, e.streamHandlers, u.text) : t.addNewMessage(u, !0) : (console.error(
|
1036
|
+
M.validateResponseFormat(u) ? typeof u.error == "string" ? (console.error(u.error), t.isLastMessageError() || t.addNewErrorMessage("service", u.error)) : e.deepChat.stream ? z.simulate(t, e.streamHandlers, u.text) : t.addNewMessage(u, !0) : (console.error(C.INVALID_RESPONSE(d, "server", !!e.deepChat.responseInterceptor, u)), t.addNewErrorMessage("service", "Error in server message"));
|
1030
1037
|
case 9:
|
1031
1038
|
case "end":
|
1032
1039
|
return _context9.stop();
|
@@ -1165,7 +1172,7 @@ var S = /*#__PURE__*/function () {
|
|
1165
1172
|
_context10.next = 15;
|
1166
1173
|
break;
|
1167
1174
|
}
|
1168
|
-
throw Error(
|
1175
|
+
throw Error(C.INVALID_RESPONSE(g, "response", !!e.deepChat.responseInterceptor, E));
|
1169
1176
|
case 15:
|
1170
1177
|
w.pollingInAnotherRequest || (e.deepChat.stream && w.text ? z.simulate(i, e.streamHandlers, w.text) : (i.addNewMessage(w, !0), c()));
|
1171
1178
|
case 16:
|
@@ -1308,7 +1315,7 @@ var S = /*#__PURE__*/function () {
|
|
1308
1315
|
}, {
|
1309
1316
|
key: "verifyKey",
|
1310
1317
|
value: function verifyKey(e, t, i, r, s, o, a, l, c) {
|
1311
|
-
if (e === "") return o(
|
1318
|
+
if (e === "") return o(C.INVALID_KEY);
|
1312
1319
|
a(), fetch(t, {
|
1313
1320
|
method: r,
|
1314
1321
|
headers: i,
|
@@ -1318,7 +1325,7 @@ var S = /*#__PURE__*/function () {
|
|
1318
1325
|
}).then(function (d) {
|
1319
1326
|
l(d, e, s, o);
|
1320
1327
|
})["catch"](function (d) {
|
1321
|
-
o(
|
1328
|
+
o(C.CONNECTION_FAILED), console.error(d);
|
1322
1329
|
});
|
1323
1330
|
}
|
1324
1331
|
}]);
|
@@ -1430,7 +1437,7 @@ var K = /*#__PURE__*/function () {
|
|
1430
1437
|
_context14.next = 14;
|
1431
1438
|
break;
|
1432
1439
|
}
|
1433
|
-
throw Error(
|
1440
|
+
throw Error(C.INVALID_RESPONSE(a, "server", !!e.deepChat.responseInterceptor, l));
|
1434
1441
|
case 14:
|
1435
1442
|
e.deepChat.stream && c.text ? z.simulate(i, e.streamHandlers, c.text) : i.addNewMessage(c, !0);
|
1436
1443
|
_context14.next = 20;
|
@@ -1532,11 +1539,11 @@ var K = /*#__PURE__*/function () {
|
|
1532
1539
|
}]);
|
1533
1540
|
return K;
|
1534
1541
|
}();
|
1535
|
-
var
|
1536
|
-
function
|
1537
|
-
_classCallCheck(this,
|
1542
|
+
var Ci = /*#__PURE__*/function () {
|
1543
|
+
function Ci() {
|
1544
|
+
_classCallCheck(this, Ci);
|
1538
1545
|
}
|
1539
|
-
_createClass(
|
1546
|
+
_createClass(Ci, null, [{
|
1540
1547
|
key: "checkForContainerStyles",
|
1541
1548
|
value: function checkForContainerStyles(e, t) {
|
1542
1549
|
var i = e.containerStyle;
|
@@ -1555,17 +1562,17 @@ var Ti = /*#__PURE__*/function () {
|
|
1555
1562
|
t && (console.error("The file property in MessageContent is deprecated since version 1.3.17."), console.error("Please change to using the files array property: https://deepchat.dev/docs/messages/#MessageContent"), e.files = [t]);
|
1556
1563
|
}
|
1557
1564
|
}]);
|
1558
|
-
return
|
1565
|
+
return Ci;
|
1559
1566
|
}();
|
1560
1567
|
var ht;
|
1561
|
-
function
|
1568
|
+
function Tn(n) {
|
1562
1569
|
return ht = ht || document.createElement("textarea"), ht.innerHTML = "&" + n + ";", ht.value;
|
1563
1570
|
}
|
1564
1571
|
var gr = Object.prototype.hasOwnProperty;
|
1565
1572
|
function br(n, e) {
|
1566
1573
|
return n ? gr.call(n, e) : !1;
|
1567
1574
|
}
|
1568
|
-
function
|
1575
|
+
function Cn(n) {
|
1569
1576
|
var e = [].slice.call(arguments, 1);
|
1570
1577
|
return e.forEach(function (t) {
|
1571
1578
|
if (t) {
|
@@ -1596,7 +1603,7 @@ var yr = /&([a-z#][a-z0-9]{1,31});/gi,
|
|
1596
1603
|
xr = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i;
|
1597
1604
|
function Er(n, e) {
|
1598
1605
|
var t = 0,
|
1599
|
-
i =
|
1606
|
+
i = Tn(e);
|
1600
1607
|
return e !== i ? i : e.charCodeAt(0) === 35 && xr.test(e) && (t = e[1].toLowerCase() === "x" ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10), An(t)) ? vi(t) : n;
|
1601
1608
|
}
|
1602
1609
|
function ye(n) {
|
@@ -1829,14 +1836,14 @@ f.dt_close = function () {
|
|
1829
1836
|
f.dd_close = function () {
|
1830
1837
|
return "</dd>\n";
|
1831
1838
|
};
|
1832
|
-
function
|
1833
|
-
return ++e >= n.length - 2 ? e : n[e].type === "paragraph_open" && n[e].tight && n[e + 1].type === "inline" && n[e + 1].content.length === 0 && n[e + 2].type === "paragraph_close" && n[e + 2].tight ?
|
1839
|
+
function In(n, e) {
|
1840
|
+
return ++e >= n.length - 2 ? e : n[e].type === "paragraph_open" && n[e].tight && n[e + 1].type === "inline" && n[e + 1].content.length === 0 && n[e + 2].type === "paragraph_close" && n[e + 2].tight ? In(n, e + 2) : e;
|
1834
1841
|
}
|
1835
1842
|
var xe = f.getBreak = function (e, t) {
|
1836
|
-
return t =
|
1843
|
+
return t = In(e, t), t < e.length && e[t].type === "list_item_close" ? "" : "\n";
|
1837
1844
|
};
|
1838
1845
|
function Ai() {
|
1839
|
-
this.rules =
|
1846
|
+
this.rules = Cn({}, f), this.getBreak = f.getBreak;
|
1840
1847
|
}
|
1841
1848
|
Ai.prototype.renderInline = function (n, e, t) {
|
1842
1849
|
for (var i = this.rules, r = n.length, s = 0, o = ""; r--;) o += i[n[s].type](n, s++, e, t, this);
|
@@ -1970,13 +1977,13 @@ function Xe(n, e) {
|
|
1970
1977
|
}
|
1971
1978
|
return i ? (s = n.pos, n.labelUnmatchedScopes = 0) : n.labelUnmatchedScopes = t - 1, n.pos = a, n.isInLabel = l, s;
|
1972
1979
|
}
|
1973
|
-
function
|
1980
|
+
function Tr(n, e, t, i) {
|
1974
1981
|
var r, s, o, a, l, c;
|
1975
1982
|
if (n.charCodeAt(0) !== 42 || n.charCodeAt(1) !== 91 || n.indexOf("]:") === -1 || (r = new Ee(n, e, t, i, []), s = Xe(r, 1), s < 0 || n.charCodeAt(s + 1) !== 58)) return -1;
|
1976
1983
|
for (a = r.posMax, o = s + 2; o < a && r.src.charCodeAt(o) !== 10; o++);
|
1977
1984
|
return l = n.slice(2, s), c = n.slice(s + 2, o).trim(), c.length === 0 ? -1 : (i.abbreviations || (i.abbreviations = {}), _typeof(i.abbreviations[":" + l]) > "u" && (i.abbreviations[":" + l] = c), o);
|
1978
1985
|
}
|
1979
|
-
function
|
1986
|
+
function Cr(n) {
|
1980
1987
|
var e = n.tokens,
|
1981
1988
|
t,
|
1982
1989
|
i,
|
@@ -1984,7 +1991,7 @@ function Tr(n) {
|
|
1984
1991
|
s;
|
1985
1992
|
if (!n.inlineMode) {
|
1986
1993
|
for (t = 1, i = e.length - 1; t < i; t++) if (e[t - 1].type === "paragraph_open" && e[t].type === "inline" && e[t + 1].type === "paragraph_close") {
|
1987
|
-
for (r = e[t].content; r.length && (s =
|
1994
|
+
for (r = e[t].content; r.length && (s = Tr(r, n.inline, n.options, n.env), !(s < 0));) r = r.slice(s).trim();
|
1988
1995
|
e[t].content = r, r.length || (e[t - 1].tight = !0, e[t + 1].tight = !0);
|
1989
1996
|
}
|
1990
1997
|
}
|
@@ -1996,7 +2003,7 @@ function yi(n) {
|
|
1996
2003
|
} catch (_unused2) {}
|
1997
2004
|
return encodeURI(e);
|
1998
2005
|
}
|
1999
|
-
function
|
2006
|
+
function Ln(n, e) {
|
2000
2007
|
var t,
|
2001
2008
|
i,
|
2002
2009
|
r,
|
@@ -2047,7 +2054,7 @@ function Ar(n, e, t, i) {
|
|
2047
2054
|
var r, s, o, a, l, c, d, u, p;
|
2048
2055
|
if (n.charCodeAt(0) !== 91 || n.indexOf("]:") === -1 || (r = new Ee(n, e, t, i, []), s = Xe(r, 0), s < 0 || n.charCodeAt(s + 1) !== 58)) return -1;
|
2049
2056
|
for (a = r.posMax, o = s + 2; o < a && (l = r.src.charCodeAt(o), !(l !== 32 && l !== 10)); o++);
|
2050
|
-
if (!
|
2057
|
+
if (!Ln(r, o)) return -1;
|
2051
2058
|
for (d = r.linkContent, o = r.pos, c = o, o = o + 1; o < a && (l = r.src.charCodeAt(o), !(l !== 32 && l !== 10)); o++);
|
2052
2059
|
for (o < a && c !== o && Rn(r, o) ? (u = r.linkContent, o = r.pos) : (u = "", o = c); o < a && r.src.charCodeAt(o) === 32;) o++;
|
2053
2060
|
return o < a && r.src.charCodeAt(o) !== 10 ? -1 : (p = Nn(n.slice(1, s)), _typeof(i.references[p]) > "u" && (i.references[p] = {
|
@@ -2055,7 +2062,7 @@ function Ar(n, e, t, i) {
|
|
2055
2062
|
href: d
|
2056
2063
|
}), o);
|
2057
2064
|
}
|
2058
|
-
function
|
2065
|
+
function Ir(n) {
|
2059
2066
|
var e = n.tokens,
|
2060
2067
|
t,
|
2061
2068
|
i,
|
@@ -2068,7 +2075,7 @@ function Lr(n) {
|
|
2068
2075
|
}
|
2069
2076
|
}
|
2070
2077
|
}
|
2071
|
-
function
|
2078
|
+
function Lr(n) {
|
2072
2079
|
var e = n.tokens,
|
2073
2080
|
t,
|
2074
2081
|
i,
|
@@ -2205,7 +2212,7 @@ var Fr = /['"]/,
|
|
2205
2212
|
function $i(n, e) {
|
2206
2213
|
return e < 0 || e >= n.length ? !1 : !Br.test(n[e]);
|
2207
2214
|
}
|
2208
|
-
function
|
2215
|
+
function Ce(n, e, t) {
|
2209
2216
|
return n.substr(0, e) + t + n.substr(e + 1);
|
2210
2217
|
}
|
2211
2218
|
function Ur(n) {
|
@@ -2217,12 +2224,12 @@ function Ur(n) {
|
|
2217
2224
|
E.length = h + 1, i = t.content, s = 0, o = i.length;
|
2218
2225
|
e: for (; s < o && (Ji.lastIndex = s, r = Ji.exec(i), !!r);) {
|
2219
2226
|
if (l = !$i(i, r.index - 1), s = r.index + 1, b = r[0] === "'", c = !$i(i, s), !c && !l) {
|
2220
|
-
b && (t.content =
|
2227
|
+
b && (t.content = Ce(t.content, r.index, Yi));
|
2221
2228
|
continue;
|
2222
2229
|
}
|
2223
2230
|
if (u = !c, p = !l, p) {
|
2224
2231
|
for (h = E.length - 1; h >= 0 && (d = E[h], !(E[h].level < a)); h--) if (d.single === b && E[h].level === a) {
|
2225
|
-
d = E[h], b ? (g[d.token].content =
|
2232
|
+
d = E[h], b ? (g[d.token].content = Ce(g[d.token].content, d.pos, n.options.quotes[2]), t.content = Ce(t.content, r.index, n.options.quotes[3])) : (g[d.token].content = Ce(g[d.token].content, d.pos, n.options.quotes[0]), t.content = Ce(t.content, r.index, n.options.quotes[1])), E.length = h;
|
2226
2233
|
continue e;
|
2227
2234
|
}
|
2228
2235
|
}
|
@@ -2231,13 +2238,13 @@ function Ur(n) {
|
|
2231
2238
|
pos: r.index,
|
2232
2239
|
single: b,
|
2233
2240
|
level: a
|
2234
|
-
}) : p && b && (t.content =
|
2241
|
+
}) : p && b && (t.content = Ce(t.content, r.index, Yi));
|
2235
2242
|
}
|
2236
2243
|
}
|
2237
2244
|
}
|
2238
2245
|
}
|
2239
2246
|
}
|
2240
|
-
var li = [["block", kr], ["abbr",
|
2247
|
+
var li = [["block", kr], ["abbr", Cr], ["references", Ir], ["inline", Lr], ["footnote_tail", Rr], ["abbr2", Nr], ["replacements", zr], ["smartquotes", Ur]];
|
2241
2248
|
function On() {
|
2242
2249
|
this.options = {}, this.ruler = new U();
|
2243
2250
|
for (var n = 0; n < li.length; n++) this.ruler.push(li[n][0], li[n][1]);
|
@@ -2433,7 +2440,7 @@ function Wr(n, e, t, i) {
|
|
2433
2440
|
A,
|
2434
2441
|
q,
|
2435
2442
|
D,
|
2436
|
-
|
2443
|
+
Te = !0,
|
2437
2444
|
ne,
|
2438
2445
|
j,
|
2439
2446
|
Hi,
|
@@ -2454,7 +2461,7 @@ function Wr(n, e, t, i) {
|
|
2454
2461
|
type: "list_item_open",
|
2455
2462
|
lines: D = [e, 0],
|
2456
2463
|
level: n.level++
|
2457
|
-
}), a = n.blkIndent, l = n.tight, o = n.tShift[e], c = n.parentType, n.tShift[e] = E - n.bMarks[e], n.blkIndent = s, n.tight = !0, n.parentType = "list", n.parser.tokenize(n, e, t, !0), (!n.tight || A) && (
|
2464
|
+
}), a = n.blkIndent, l = n.tight, o = n.tShift[e], c = n.parentType, n.tShift[e] = E - n.bMarks[e], n.blkIndent = s, n.tight = !0, n.parentType = "list", n.parser.tokenize(n, e, t, !0), (!n.tight || A) && (Te = !1), A = 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({
|
2458
2465
|
type: "list_item_close",
|
2459
2466
|
level: --n.level
|
2460
2467
|
}), r = e = n.line, D[1] = r, E = n.bMarks[e], !(r >= t || n.isEmpty(r) || n.tShift[r] < n.blkIndent));) {
|
@@ -2471,7 +2478,7 @@ function Wr(n, e, t, i) {
|
|
2471
2478
|
return n.tokens.push({
|
2472
2479
|
type: g ? "ordered_list_close" : "bullet_list_close",
|
2473
2480
|
level: --n.level
|
2474
|
-
}), q[1] = r, n.line = r,
|
2481
|
+
}), q[1] = r, n.line = r, Te && Kr(n, w), !0;
|
2475
2482
|
}
|
2476
2483
|
function Jr(n, e, t, i) {
|
2477
2484
|
var r,
|
@@ -2752,13 +2759,13 @@ function rs(n, e) {
|
|
2752
2759
|
})), !0;
|
2753
2760
|
}
|
2754
2761
|
var ft = [["code", qr], ["fences", Hr, ["paragraph", "blockquote", "list"]], ["blockquote", Gr, ["paragraph", "blockquote", "list"]], ["hr", Vr, ["paragraph", "blockquote", "list"]], ["list", Wr, ["paragraph", "blockquote"]], ["footnote", Jr, ["paragraph"]], ["heading", Yr, ["paragraph", "blockquote"]], ["lheading", $r], ["htmlblock", es, ["paragraph", "blockquote"]], ["table", ts, ["paragraph"]], ["deflist", ns, ["paragraph"]], ["paragraph", rs]];
|
2755
|
-
function
|
2762
|
+
function Ii() {
|
2756
2763
|
this.ruler = new U();
|
2757
2764
|
for (var n = 0; n < ft.length; n++) this.ruler.push(ft[n][0], ft[n][1], {
|
2758
2765
|
alt: (ft[n][2] || []).slice()
|
2759
2766
|
});
|
2760
2767
|
}
|
2761
|
-
|
2768
|
+
Ii.prototype.tokenize = function (n, e, t) {
|
2762
2769
|
for (var i = this.ruler.getRules(""), r = i.length, s = e, o = !1, a, l; s < t && (n.line = s = n.skipEmptyLines(s), !(s >= t || n.tShift[s] < n.blkIndent));) {
|
2763
2770
|
for (l = 0; l < r && (a = i[l](n, s, t, !1), !a); l++);
|
2764
2771
|
if (n.tight = !o, n.isEmpty(n.line - 1) && (o = !0), s = n.line, s < t && n.isEmpty(s)) {
|
@@ -2770,7 +2777,7 @@ Li.prototype.tokenize = function (n, e, t) {
|
|
2770
2777
|
var ss = /[\n\t]/g,
|
2771
2778
|
os = /\r[\n\u0085]|[\u2424\u2028\u0085]/g,
|
2772
2779
|
as = /\u00a0/g;
|
2773
|
-
|
2780
|
+
Ii.prototype.parse = function (n, e, t, i) {
|
2774
2781
|
var r,
|
2775
2782
|
s = 0,
|
2776
2783
|
o = 0;
|
@@ -2838,10 +2845,10 @@ function ds(n, e) {
|
|
2838
2845
|
for (r++; r < i && n.src.charCodeAt(r) === 32;) r++;
|
2839
2846
|
return n.pos = r, !0;
|
2840
2847
|
}
|
2841
|
-
var
|
2842
|
-
for (var Xi = 0; Xi < 256; Xi++)
|
2848
|
+
var Li = [];
|
2849
|
+
for (var Xi = 0; Xi < 256; Xi++) Li.push(0);
|
2843
2850
|
"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function (n) {
|
2844
|
-
|
2851
|
+
Li[n.charCodeAt(0)] = 1;
|
2845
2852
|
});
|
2846
2853
|
function us(n, e) {
|
2847
2854
|
var t,
|
@@ -2849,7 +2856,7 @@ function us(n, e) {
|
|
2849
2856
|
r = n.posMax;
|
2850
2857
|
if (n.src.charCodeAt(i) !== 92) return !1;
|
2851
2858
|
if (i++, i < r) {
|
2852
|
-
if (t = n.src.charCodeAt(i), t < 256 &&
|
2859
|
+
if (t = n.src.charCodeAt(i), t < 256 && Li[t] !== 0) return e || (n.pending += n.src[i]), n.pos += 2, !0;
|
2853
2860
|
if (t === 10) {
|
2854
2861
|
for (e || n.push({
|
2855
2862
|
type: "hardbreak",
|
@@ -3087,7 +3094,7 @@ function Es(n, e) {
|
|
3087
3094
|
if (a = i + 1, a < p && n.src.charCodeAt(a) === 40) {
|
3088
3095
|
for (a++; a < p && (c = n.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);
|
3089
3096
|
if (a >= p) return !1;
|
3090
|
-
for (h = a,
|
3097
|
+
for (h = a, Ln(n, a) ? (s = n.linkContent, a = n.pos) : s = "", h = a; a < p && (c = n.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);
|
3091
3098
|
if (a < p && h !== a && Rn(n, a)) for (o = n.linkContent, a = n.pos; a < p && (c = n.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);else o = "";
|
3092
3099
|
if (a >= p || n.src.charCodeAt(a) !== 41) return n.pos = u, !1;
|
3093
3100
|
a++;
|
@@ -3153,7 +3160,7 @@ function ws(n, e) {
|
|
3153
3160
|
var _s = ["coap", "doi", "javascript", "aaa", "aaas", "about", "acap", "cap", "cid", "crid", "data", "dav", "dict", "dns", "file", "ftp", "geo", "go", "gopher", "h323", "http", "https", "iax", "icap", "im", "imap", "info", "ipp", "iris", "iris.beep", "iris.xpc", "iris.xpcs", "iris.lwz", "ldap", "mailto", "mid", "msrp", "msrps", "mtqp", "mupdate", "news", "nfs", "ni", "nih", "nntp", "opaquelocktoken", "pop", "pres", "rtsp", "service", "session", "shttp", "sieve", "sip", "sips", "sms", "snmp", "soap.beep", "soap.beeps", "tag", "tel", "telnet", "tftp", "thismessage", "tn3270", "tip", "tv", "urn", "vemmi", "ws", "wss", "xcon", "xcon-userid", "xmlrpc.beep", "xmlrpc.beeps", "xmpp", "z39.50r", "z39.50s", "adiumxtra", "afp", "afs", "aim", "apt", "attachment", "aw", "beshare", "bitcoin", "bolo", "callto", "chrome", "chrome-extension", "com-eventbrite-attendee", "content", "cvs", "dlna-playsingle", "dlna-playcontainer", "dtn", "dvb", "ed2k", "facetime", "feed", "finger", "fish", "gg", "git", "gizmoproject", "gtalk", "hcp", "icon", "ipn", "irc", "irc6", "ircs", "itms", "jar", "jms", "keyparc", "lastfm", "ldaps", "magnet", "maps", "market", "message", "mms", "ms-help", "msnim", "mumble", "mvn", "notes", "oid", "palm", "paparazzi", "platform", "proxy", "psyc", "query", "res", "resource", "rmi", "rsync", "rtmp", "secondlife", "sftp", "sgn", "skype", "smb", "soldat", "spotify", "ssh", "steam", "svn", "teamspeak", "things", "udp", "unreal", "ut2004", "ventrilo", "view-source", "webcal", "wtai", "wyciwyg", "xfire", "xri", "ymsgr"],
|
3154
3161
|
Ms = /^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/,
|
3155
3162
|
ks = /^<([a-zA-Z.\-]{1,25}):([^<>\x00-\x20]*)>/;
|
3156
|
-
function
|
3163
|
+
function Ts(n, e) {
|
3157
3164
|
var t,
|
3158
3165
|
i,
|
3159
3166
|
r,
|
@@ -3189,12 +3196,12 @@ function Bt(n, e) {
|
|
3189
3196
|
return i ? (r = r.source || r, n = n.replace(i, r), t) : new RegExp(n, e);
|
3190
3197
|
};
|
3191
3198
|
}
|
3192
|
-
var
|
3199
|
+
var Cs = /[a-zA-Z_:][a-zA-Z0-9:._-]*/,
|
3193
3200
|
As = /[^"'=<>`\x00-\x20]+/,
|
3194
|
-
|
3195
|
-
|
3196
|
-
Rs = Bt(/(?:unquoted|single_quoted|double_quoted)/)("unquoted", As)("single_quoted",
|
3197
|
-
Ns = Bt(/(?:\s+attr_name(?:\s*=\s*attr_value)?)/)("attr_name",
|
3201
|
+
Is = /'[^']*'/,
|
3202
|
+
Ls = /"[^"]*"/,
|
3203
|
+
Rs = Bt(/(?:unquoted|single_quoted|double_quoted)/)("unquoted", As)("single_quoted", Is)("double_quoted", Ls)(),
|
3204
|
+
Ns = Bt(/(?:\s+attr_name(?:\s*=\s*attr_value)?)/)("attr_name", Cs)("attr_value", Rs)(),
|
3198
3205
|
Os = Bt(/<[A-Za-z][A-Za-z0-9]*attribute*\s*\/?>/)("attribute", Ns)(),
|
3199
3206
|
Ps = /<\/[A-Za-z][A-Za-z0-9]*\s*>/,
|
3200
3207
|
Ds = /<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->/,
|
@@ -3230,13 +3237,13 @@ function Vs(n, e) {
|
|
3230
3237
|
if (t = n.src.charCodeAt(s + 1), t === 35) {
|
3231
3238
|
if (r = n.src.slice(s).match(Hs), r) return e || (i = r[1][0].toLowerCase() === "x" ? parseInt(r[1].slice(1), 16) : parseInt(r[1], 10), n.pending += An(i) ? vi(i) : vi(65533)), n.pos += r[0].length, !0;
|
3232
3239
|
} else if (r = n.src.slice(s).match(Gs), r) {
|
3233
|
-
var a =
|
3240
|
+
var a = Tn(r[1]);
|
3234
3241
|
if (r[1] !== a) return e || (n.pending += a), n.pos += r[0].length, !0;
|
3235
3242
|
}
|
3236
3243
|
}
|
3237
3244
|
return e || (n.pending += "&"), n.pos++, !0;
|
3238
3245
|
}
|
3239
|
-
var di = [["text", cs], ["newline", ds], ["escape", us], ["backticks", hs], ["del", ps], ["ins", fs], ["mark", ms], ["emphasis", gs], ["sub", vs], ["sup", xs], ["links", Es], ["footnote_inline", Ss], ["footnote_ref", ws], ["autolink",
|
3246
|
+
var di = [["text", cs], ["newline", ds], ["escape", us], ["backticks", hs], ["del", ps], ["ins", fs], ["mark", ms], ["emphasis", gs], ["sub", vs], ["sup", xs], ["links", Es], ["footnote_inline", Ss], ["footnote_ref", ws], ["autolink", Ts], ["htmltag", qs], ["entity", Vs]];
|
3240
3247
|
function Ut() {
|
3241
3248
|
this.ruler = new U();
|
3242
3249
|
for (var n = 0; n < di.length; n++) this.ruler.push(di[n][0], di[n][1]);
|
@@ -3399,10 +3406,10 @@ function Dn(n, e, t) {
|
|
3399
3406
|
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;
|
3400
3407
|
}
|
3401
3408
|
function ie(n, e) {
|
3402
|
-
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 Ut(), this.block = new
|
3409
|
+
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 Ut(), this.block = new Ii(), this.core = new On(), this.renderer = new Ai(), this.ruler = new U(), this.options = {}, this.configure($s[n]), this.set(e || {});
|
3403
3410
|
}
|
3404
3411
|
ie.prototype.set = function (n) {
|
3405
|
-
|
3412
|
+
Cn(this.options, n);
|
3406
3413
|
};
|
3407
3414
|
ie.prototype.configure = function (n) {
|
3408
3415
|
var e = this;
|
@@ -3580,14 +3587,14 @@ var k = /*#__PURE__*/function () {
|
|
3580
3587
|
}]);
|
3581
3588
|
return k;
|
3582
3589
|
}();
|
3583
|
-
var
|
3584
|
-
function
|
3590
|
+
var Be = /*#__PURE__*/function () {
|
3591
|
+
function Be(e, t, i) {
|
3585
3592
|
var _a$url;
|
3586
|
-
_classCallCheck(this,
|
3593
|
+
_classCallCheck(this, Be);
|
3587
3594
|
var r, s, o, a;
|
3588
|
-
this.rawBody = {}, this.validateConfigKey = !1, this.canSendMessage =
|
3595
|
+
this.rawBody = {}, this.validateConfigKey = !1, this.canSendMessage = Be.canSendMessage, this.requestSettings = {}, this.fileTypes = {}, this.completionsHandlers = {}, this.streamHandlers = {}, this.deepChat = e, this.demo = i, Object.assign(this.rawBody, (r = e.request) == null ? void 0 : r.additionalBodyProps), this.totalMessagesMaxCharLength = (s = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : s.totalMessagesMaxCharLength, this.maxMessages = (o = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : o.maxMessages, k.set(e, this, t), e.request && (this.requestSettings = e.request), this.demo && ((_a$url = (a = this.requestSettings).url) !== null && _a$url !== void 0 ? _a$url : a.url = de.URL), this._directServiceRequiresFiles = !!t && Object.keys(t).length > 0, this.requestSettings.websocket && K.setup(this);
|
3589
3596
|
}
|
3590
|
-
_createClass(
|
3597
|
+
_createClass(Be, [{
|
3591
3598
|
key: "verifyKey",
|
3592
3599
|
value: function verifyKey(e, t) {}
|
3593
3600
|
}, {
|
@@ -3662,7 +3669,7 @@ var Fe = /*#__PURE__*/function () {
|
|
3662
3669
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
3663
3670
|
while (1) switch (_context18.prev = _context18.next) {
|
3664
3671
|
case 0:
|
3665
|
-
s =
|
3672
|
+
s = Be.createCustomFormDataBody(e, i, r), o = this.requestSettings, a = this.getServiceIOByType(r[0]);
|
3666
3673
|
this.requestSettings = (a == null ? void 0 : a.request) || this.requestSettings;
|
3667
3674
|
_context18.next = 4;
|
3668
3675
|
return this.request(s, t, !1);
|
@@ -3725,7 +3732,7 @@ var Fe = /*#__PURE__*/function () {
|
|
3725
3732
|
}
|
3726
3733
|
throw e.error;
|
3727
3734
|
case 2:
|
3728
|
-
return _context20.abrupt("return", e.result ?
|
3735
|
+
return _context20.abrupt("return", e.result ? Ci.handleResponseProperty(e) : e);
|
3729
3736
|
case 3:
|
3730
3737
|
case "end":
|
3731
3738
|
return _context20.stop();
|
@@ -3744,8 +3751,8 @@ var Fe = /*#__PURE__*/function () {
|
|
3744
3751
|
}
|
3745
3752
|
}], [{
|
3746
3753
|
key: "canSendMessage",
|
3747
|
-
value: function canSendMessage(e, t) {
|
3748
|
-
return !!(e && e.trim() !== "") || !!(t && t.length > 0);
|
3754
|
+
value: function canSendMessage(e, t, i) {
|
3755
|
+
return i ? !0 : !!(e && e.trim() !== "") || !!(t && t.length > 0);
|
3749
3756
|
}
|
3750
3757
|
}, {
|
3751
3758
|
key: "createCustomFormDataBody",
|
@@ -3764,18 +3771,18 @@ var Fe = /*#__PURE__*/function () {
|
|
3764
3771
|
return o.text && (delete o.files, r.append("message".concat(s += 1), JSON.stringify(o))), r;
|
3765
3772
|
}
|
3766
3773
|
}]);
|
3767
|
-
return
|
3774
|
+
return Be;
|
3768
3775
|
}();
|
3769
|
-
var B = /*#__PURE__*/function (
|
3770
|
-
_inherits(B,
|
3776
|
+
var B = /*#__PURE__*/function (_Be) {
|
3777
|
+
_inherits(B, _Be);
|
3771
3778
|
var _super = _createSuper(B);
|
3772
3779
|
// prettier-ignore
|
3773
3780
|
function B(e, t, i, r, s) {
|
3774
|
-
var
|
3781
|
+
var _this3;
|
3775
3782
|
_classCallCheck(this, B);
|
3776
3783
|
var o;
|
3777
|
-
|
3778
|
-
return
|
3784
|
+
_this3 = _super.call(this, e, s), _this3.insertKeyPlaceholderText = "API Key", _this3.getKeyLink = "", Object.assign(_this3.rawBody, (o = e.request) == null ? void 0 : o.additionalBodyProps), _this3.keyVerificationDetails = t, _this3.buildHeadersFunc = i, r && _this3.setApiKeyProperties(r), _this3.requestSettings = _this3.buildRequestSettings(_this3.key || "", e.request);
|
3785
|
+
return _this3;
|
3779
3786
|
}
|
3780
3787
|
_createClass(B, [{
|
3781
3788
|
key: "setApiKeyProperties",
|
@@ -3813,7 +3820,7 @@ var B = /*#__PURE__*/function (_Fe) {
|
|
3813
3820
|
}
|
3814
3821
|
}]);
|
3815
3822
|
return B;
|
3816
|
-
}(
|
3823
|
+
}(Be);
|
3817
3824
|
var St = /*#__PURE__*/function () {
|
3818
3825
|
function St() {
|
3819
3826
|
_classCallCheck(this, St);
|
@@ -3834,19 +3841,19 @@ var St = /*#__PURE__*/function () {
|
|
3834
3841
|
return St;
|
3835
3842
|
}();
|
3836
3843
|
var Ri = /*#__PURE__*/function (_HTMLElement) {
|
3837
|
-
_inherits(
|
3838
|
-
var _super2 = _createSuper(
|
3844
|
+
_inherits(Le, _HTMLElement);
|
3845
|
+
var _super2 = _createSuper(Le);
|
3839
3846
|
// If this is not working, try using propertyName directly
|
3840
|
-
function
|
3841
|
-
var
|
3842
|
-
_classCallCheck(this,
|
3843
|
-
|
3844
|
-
var t =
|
3845
|
-
|
3847
|
+
function Le() {
|
3848
|
+
var _this4;
|
3849
|
+
_classCallCheck(this, Le);
|
3850
|
+
_this4 = _super2.call(this), _this4._waitingToRender_ = !1, _this4._propUpdated_ = !1, Object.keys(Le._attributeToProperty_).forEach(function (e) {
|
3851
|
+
var t = Le._attributeToProperty_[e];
|
3852
|
+
_this4.constructPropertyAccessors(t), _this4.hasOwnProperty(e) || _this4.constructPropertyAccessors(t, e);
|
3846
3853
|
});
|
3847
|
-
return
|
3854
|
+
return _this4;
|
3848
3855
|
}
|
3849
|
-
_createClass(
|
3856
|
+
_createClass(Le, [{
|
3850
3857
|
key: "constructPropertyAccessors",
|
3851
3858
|
value:
|
3852
3859
|
// need to be called here as accessors need to be set for the class instance
|
@@ -3865,8 +3872,8 @@ var Ri = /*#__PURE__*/function (_HTMLElement) {
|
|
3865
3872
|
key: "attributeChangedCallback",
|
3866
3873
|
value: function attributeChangedCallback(e, t, i) {
|
3867
3874
|
if (t === i) return;
|
3868
|
-
var r =
|
3869
|
-
s =
|
3875
|
+
var r = Le._attributes_[e](i),
|
3876
|
+
s = Le._attributeToProperty_[e];
|
3870
3877
|
this[s] = r;
|
3871
3878
|
}
|
3872
3879
|
}, {
|
@@ -3875,10 +3882,10 @@ var Ri = /*#__PURE__*/function (_HTMLElement) {
|
|
3875
3882
|
}], [{
|
3876
3883
|
key: "observedAttributes",
|
3877
3884
|
get: function get() {
|
3878
|
-
return Object.keys(
|
3885
|
+
return Object.keys(Le._attributes_) || [];
|
3879
3886
|
}
|
3880
3887
|
}]);
|
3881
|
-
return
|
3888
|
+
return Le;
|
3882
3889
|
}( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
|
3883
3890
|
Ri._attributes_ = {};
|
3884
3891
|
Ri._attributeToProperty_ = {};
|
@@ -3930,11 +3937,11 @@ var jn = /*#__PURE__*/function () {
|
|
3930
3937
|
}();
|
3931
3938
|
jn.VISIBLE_ICON_ID = "visible-icon";
|
3932
3939
|
var eo = jn;
|
3933
|
-
var
|
3934
|
-
function
|
3935
|
-
_classCallCheck(this,
|
3940
|
+
var I = /*#__PURE__*/function () {
|
3941
|
+
function I() {
|
3942
|
+
_classCallCheck(this, I);
|
3936
3943
|
}
|
3937
|
-
_createClass(
|
3944
|
+
_createClass(I, null, [{
|
3938
3945
|
key: "createCautionText",
|
3939
3946
|
value: function createCautionText() {
|
3940
3947
|
var e = document.createElement("a");
|
@@ -3954,20 +3961,23 @@ var L = /*#__PURE__*/function () {
|
|
3954
3961
|
}
|
3955
3962
|
}, {
|
3956
3963
|
key: "createHelpTextContainer",
|
3957
|
-
value: function createHelpTextContainer(e) {
|
3958
|
-
var t = document.createElement("div");
|
3959
|
-
t.id = "insert-key-help-text-container";
|
3964
|
+
value: function createHelpTextContainer(e, t) {
|
3960
3965
|
var i = document.createElement("div");
|
3961
|
-
i.id = "insert-key-help-text-
|
3962
|
-
var r =
|
3963
|
-
|
3964
|
-
|
3965
|
-
|
3966
|
-
|
3967
|
-
|
3968
|
-
|
3969
|
-
|
3970
|
-
|
3966
|
+
i.id = "insert-key-help-text-container";
|
3967
|
+
var r = document.createElement("div");
|
3968
|
+
r.id = "insert-key-help-text-contents";
|
3969
|
+
var s = I.createFailText();
|
3970
|
+
if (r.appendChild(s), e) {
|
3971
|
+
var o = I.createHelpLink(e);
|
3972
|
+
r.appendChild(o);
|
3973
|
+
}
|
3974
|
+
if (t === void 0 || t === !0) {
|
3975
|
+
var _o2 = I.createCautionText();
|
3976
|
+
r.appendChild(_o2);
|
3977
|
+
}
|
3978
|
+
return i.appendChild(r), {
|
3979
|
+
helpTextContainerElement: i,
|
3980
|
+
failTextElement: s
|
3971
3981
|
};
|
3972
3982
|
}
|
3973
3983
|
}, {
|
@@ -3993,12 +4003,12 @@ var L = /*#__PURE__*/function () {
|
|
3993
4003
|
value: function addVerificationEvents(e, t, i, r, s) {
|
3994
4004
|
var o = {
|
3995
4005
|
onSuccess: r,
|
3996
|
-
onFail:
|
3997
|
-
onLoad:
|
4006
|
+
onFail: I.onFail.bind(this, e, t, i),
|
4007
|
+
onLoad: I.onLoad.bind(this, e, t)
|
3998
4008
|
},
|
3999
|
-
a =
|
4009
|
+
a = I.verifyKey.bind(this, e, o, s);
|
4000
4010
|
t.onclick = a, e.onkeydown = function (l) {
|
4001
|
-
!e.classList.contains("loading") && l.key ===
|
4011
|
+
!e.classList.contains("loading") && l.key === T.ENTER && a();
|
4002
4012
|
};
|
4003
4013
|
}
|
4004
4014
|
}, {
|
@@ -4018,39 +4028,41 @@ var L = /*#__PURE__*/function () {
|
|
4018
4028
|
var t = document.createElement("div");
|
4019
4029
|
t.id = "insert-key-input-container";
|
4020
4030
|
var i = document.createElement("input");
|
4021
|
-
return i.id = "insert-key-input", i.placeholder = e || "API Key", i.type = "password", i.classList.add("insert-key-input-valid"), i.onfocus =
|
4031
|
+
return i.id = "insert-key-input", i.placeholder = e || "API Key", i.type = "password", i.classList.add("insert-key-input-valid"), i.onfocus = I.onInputFocus, t.appendChild(i), t;
|
4022
4032
|
}
|
4033
|
+
// prettier-ignore
|
4023
4034
|
}, {
|
4024
4035
|
key: "createContents",
|
4025
4036
|
value: function createContents(e, t) {
|
4037
|
+
var d;
|
4026
4038
|
var i = document.createElement("div");
|
4027
4039
|
i.id = "insert-key-contents";
|
4028
|
-
var r =
|
4040
|
+
var r = I.createInput(t.insertKeyPlaceholderText),
|
4029
4041
|
s = r.children[0],
|
4030
4042
|
o = eo.create(s);
|
4031
4043
|
r.appendChild(o), i.appendChild(r);
|
4032
|
-
var a =
|
4033
|
-
|
4034
|
-
l =
|
4035
|
-
c =
|
4036
|
-
return i.appendChild(a), i.appendChild(l),
|
4044
|
+
var a = I.createStartButton(),
|
4045
|
+
_I$createHelpTextCont = I.createHelpTextContainer(t.getKeyLink, (d = t.deepChat._insertKeyViewStyles) == null ? void 0 : d.displayCautionText),
|
4046
|
+
l = _I$createHelpTextCont.helpTextContainerElement,
|
4047
|
+
c = _I$createHelpTextCont.failTextElement;
|
4048
|
+
return i.appendChild(a), i.appendChild(l), I.addVerificationEvents(s, a, c, e, t), i;
|
4037
4049
|
}
|
4038
4050
|
}, {
|
4039
4051
|
key: "createElements",
|
4040
4052
|
value: function createElements(e, t) {
|
4041
4053
|
var i = document.createElement("div");
|
4042
4054
|
i.id = "insert-key-view";
|
4043
|
-
var r =
|
4055
|
+
var r = I.createContents(e, t);
|
4044
4056
|
return i.appendChild(r), i;
|
4045
4057
|
}
|
4046
4058
|
}, {
|
4047
4059
|
key: "render",
|
4048
4060
|
value: function render(e, t, i) {
|
4049
|
-
var r =
|
4061
|
+
var r = I.createElements(t, i);
|
4050
4062
|
e.replaceChildren(r);
|
4051
4063
|
}
|
4052
4064
|
}]);
|
4053
|
-
return
|
4065
|
+
return I;
|
4054
4066
|
}();
|
4055
4067
|
var wt = /*#__PURE__*/function () {
|
4056
4068
|
function wt() {
|
@@ -4070,7 +4082,7 @@ var wt = /*#__PURE__*/function () {
|
|
4070
4082
|
key: "handleVerificationResult",
|
4071
4083
|
value: function handleVerificationResult(e, t, i, r) {
|
4072
4084
|
var s = e;
|
4073
|
-
Array.isArray(s.error) && s.error[0] === "Error in `parameters`: field required" ? i(t) : r(
|
4085
|
+
Array.isArray(s.error) && s.error[0] === "Error in `parameters`: field required" ? i(t) : r(C.INVALID_KEY);
|
4074
4086
|
}
|
4075
4087
|
}, {
|
4076
4088
|
key: "buildKeyVerificationDetails",
|
@@ -4089,10 +4101,10 @@ var zn = /*#__PURE__*/function (_B) {
|
|
4089
4101
|
var _super3 = _createSuper(Ei);
|
4090
4102
|
// prettier-ignore
|
4091
4103
|
function Ei(e, t, i, r, s, o) {
|
4092
|
-
var
|
4104
|
+
var _this5;
|
4093
4105
|
_classCallCheck(this, Ei);
|
4094
|
-
|
4095
|
-
return
|
4106
|
+
_this5 = _super3.call(this, e, wt.buildKeyVerificationDetails(), wt.buildHeaders, s, o), _this5.insertKeyPlaceholderText = "Hugging Face Token", _this5.getKeyLink = "https://huggingface.co/settings/tokens", _this5.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Hugging Face</b></div>\n <p>First message may take an extented amount of time to complete as the model needs to be initialized.</p>", _this5.permittedErrorPrefixes = ["Authorization header"], _this5.url = "".concat(Ei.URL_PREFIX).concat(i), _this5.textInputPlaceholderText = t, _typeof(r) == "object" && (r.model && (_this5.url = "".concat(Ei.URL_PREFIX).concat(r.model)), r.options && (_this5.rawBody.options = r.options), r.parameters && (_this5.rawBody.parameters = r.parameters));
|
4107
|
+
return _this5;
|
4096
4108
|
}
|
4097
4109
|
// prettier-ignore
|
4098
4110
|
_createClass(Ei, [{
|
@@ -4142,10 +4154,10 @@ var nt = /*#__PURE__*/function (_we) {
|
|
4142
4154
|
var _super4 = _createSuper(nt);
|
4143
4155
|
// prettier-ignore
|
4144
4156
|
function nt(e, t, i, r, s, o) {
|
4145
|
-
var
|
4157
|
+
var _this6;
|
4146
4158
|
_classCallCheck(this, nt);
|
4147
|
-
|
4148
|
-
return
|
4159
|
+
_this6 = _super4.call(this, e, t, i, r, s, o), _this6.isTextInputDisabled = !0, _this6.canSendMessage = nt.canSendFile;
|
4160
|
+
return _this6;
|
4149
4161
|
}
|
4150
4162
|
_createClass(nt, [{
|
4151
4163
|
key: "preprocessBody",
|
@@ -4312,7 +4324,7 @@ var Q = /*#__PURE__*/function () {
|
|
4312
4324
|
}, {
|
4313
4325
|
key: "handleVerificationResult",
|
4314
4326
|
value: function handleVerificationResult(e, t, i, r) {
|
4315
|
-
e.message ? r(
|
4327
|
+
e.message ? r(C.INVALID_KEY) : i(t);
|
4316
4328
|
}
|
4317
4329
|
}, {
|
4318
4330
|
key: "buildKeyVerificationDetails",
|
@@ -4331,10 +4343,10 @@ var qt = /*#__PURE__*/function (_B2) {
|
|
4331
4343
|
var _super7 = _createSuper(qt);
|
4332
4344
|
// prettier-ignore
|
4333
4345
|
function qt(e, t, i, r, s) {
|
4334
|
-
var
|
4346
|
+
var _this7;
|
4335
4347
|
_classCallCheck(this, qt);
|
4336
|
-
|
4337
|
-
return
|
4348
|
+
_this7 = _super7.call(this, e, t, i, r, s), _this7.insertKeyPlaceholderText = "Stability AI API Key", _this7.getKeyLink = "https://platform.stability.ai/docs/getting-started/authentication", _this7.permittedErrorPrefixes = ["Incorrect", "invalid_"];
|
4349
|
+
return _this7;
|
4338
4350
|
}
|
4339
4351
|
return _createClass(qt);
|
4340
4352
|
}(B);
|
@@ -4342,7 +4354,7 @@ var _t = /*#__PURE__*/function (_qt) {
|
|
4342
4354
|
_inherits(_t, _qt);
|
4343
4355
|
var _super8 = _createSuper(_t);
|
4344
4356
|
function _t(e) {
|
4345
|
-
var
|
4357
|
+
var _this8;
|
4346
4358
|
_classCallCheck(this, _t);
|
4347
4359
|
var o;
|
4348
4360
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
@@ -4355,10 +4367,10 @@ var _t = /*#__PURE__*/function (_qt) {
|
|
4355
4367
|
}
|
4356
4368
|
}
|
4357
4369
|
};
|
4358
|
-
|
4370
|
+
_this8 = _super8.call(this, e, Q.buildKeyVerificationDetails(), Q.buildHeaders, i, r), _this8.url = "https://api.stability.ai/v1/generation/esrgan-v1-x2plus/image-to-image/upscale", _this8.textInputPlaceholderText = "Describe image changes", _this8.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>";
|
4359
4371
|
var s = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageUpscale;
|
4360
|
-
_typeof(s) == "object" && (s.engine_id && (
|
4361
|
-
return
|
4372
|
+
_typeof(s) == "object" && (s.engine_id && (_this8.url = "https://api.stability.ai/v1/generation/".concat(s.engine_id, "/image-to-image/upscale")), _t.cleanConfig(s), Object.assign(_this8.rawBody, s)), _this8.canSendMessage = _t.canSendFileMessage;
|
4373
|
+
return _this8;
|
4362
4374
|
}
|
4363
4375
|
_createClass(_t, [{
|
4364
4376
|
key: "createFormDataBody",
|
@@ -4451,7 +4463,7 @@ var Mt = /*#__PURE__*/function (_qt2) {
|
|
4451
4463
|
_inherits(Mt, _qt2);
|
4452
4464
|
var _super9 = _createSuper(Mt);
|
4453
4465
|
function Mt(e) {
|
4454
|
-
var
|
4466
|
+
var _this9;
|
4455
4467
|
_classCallCheck(this, Mt);
|
4456
4468
|
var o;
|
4457
4469
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
@@ -4464,10 +4476,10 @@ var Mt = /*#__PURE__*/function (_qt2) {
|
|
4464
4476
|
}
|
4465
4477
|
}
|
4466
4478
|
};
|
4467
|
-
|
4479
|
+
_this9 = _super9.call(this, e, Q.buildKeyVerificationDetails(), Q.buildHeaders, i, r), _this9.url = "https://api.stability.ai/v1/generation/stable-inpainting-512-v2-0/image-to-image/masking", _this9._maskSource = "MASK_IMAGE_WHITE", _this9.textInputPlaceholderText = "Describe image changes", _this9.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>";
|
4468
4480
|
var s = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageMasking;
|
4469
|
-
_typeof(s) == "object" && (s.engine_id && (
|
4470
|
-
return
|
4481
|
+
_typeof(s) == "object" && (s.engine_id && (_this9.url = "https://api.stability.ai/v1/generation/".concat(s.engine_id, "/image-to-image/masking")), s.weight !== void 0 && s.weight !== null && (_this9._imageWeight = s.weight), s.mask_source !== void 0 && s.mask_source !== null && (_this9._maskSource = s.mask_source), Mt.cleanConfig(s), Object.assign(_this9.rawBody, s)), _this9.canSendMessage = Mt.canSendFileTextMessage;
|
4482
|
+
return _this9;
|
4471
4483
|
}
|
4472
4484
|
_createClass(Mt, [{
|
4473
4485
|
key: "createFormDataBody",
|
@@ -4650,13 +4662,13 @@ var so = /*#__PURE__*/function (_we3) {
|
|
4650
4662
|
_inherits(so, _we3);
|
4651
4663
|
var _super12 = _createSuper(so);
|
4652
4664
|
function so(e) {
|
4653
|
-
var
|
4665
|
+
var _this10;
|
4654
4666
|
_classCallCheck(this, so);
|
4655
4667
|
var r, s, o;
|
4656
4668
|
var t = (s = (r = e.directConnection) == null ? void 0 : r.huggingFace) == null ? void 0 : s.questionAnswer,
|
4657
4669
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
4658
|
-
|
4659
|
-
return
|
4670
|
+
_this10 = _super12.call(this, e, "Ask a question", "bert-large-uncased-whole-word-masking-finetuned-squad", t, i), _this10.permittedErrorPrefixes = ["Authorization header", "Error in"], _this10.context = t.context;
|
4671
|
+
return _this10;
|
4660
4672
|
}
|
4661
4673
|
_createClass(so, [{
|
4662
4674
|
key: "preprocessBody",
|
@@ -4746,14 +4758,14 @@ var ao = /*#__PURE__*/function (_we5) {
|
|
4746
4758
|
_inherits(ao, _we5);
|
4747
4759
|
var _super14 = _createSuper(ao);
|
4748
4760
|
function ao(e) {
|
4749
|
-
var
|
4750
|
-
var
|
4761
|
+
var _this11$maxMessages;
|
4762
|
+
var _this11;
|
4751
4763
|
_classCallCheck(this, ao);
|
4752
4764
|
var r, s, o;
|
4753
4765
|
var t = (s = (r = e.directConnection) == null ? void 0 : r.huggingFace) == null ? void 0 : s.conversation,
|
4754
4766
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
4755
|
-
|
4756
|
-
return
|
4767
|
+
_this11 = _super14.call(this, e, "Ask me anything!", "facebook/blenderbot-400M-distill", t, i), (_this11$maxMessages = _this11.maxMessages) !== null && _this11$maxMessages !== void 0 ? _this11$maxMessages : _this11.maxMessages = -1;
|
4768
|
+
return _this11;
|
4757
4769
|
}
|
4758
4770
|
// prettier-ignore
|
4759
4771
|
_createClass(ao, [{
|
@@ -4830,7 +4842,7 @@ var kt = /*#__PURE__*/function (_qt3) {
|
|
4830
4842
|
_inherits(kt, _qt3);
|
4831
4843
|
var _super15 = _createSuper(kt);
|
4832
4844
|
function kt(e) {
|
4833
|
-
var
|
4845
|
+
var _this12;
|
4834
4846
|
_classCallCheck(this, kt);
|
4835
4847
|
var o;
|
4836
4848
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
@@ -4843,10 +4855,10 @@ var kt = /*#__PURE__*/function (_qt3) {
|
|
4843
4855
|
}
|
4844
4856
|
}
|
4845
4857
|
};
|
4846
|
-
|
4858
|
+
_this12 = _super15.call(this, e, Q.buildKeyVerificationDetails(), Q.buildHeaders, i, r), _this12.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-5/image-to-image", _this12.textInputPlaceholderText = "Describe image changes", _this12.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>";
|
4847
4859
|
var s = (o = t.stabilityAI) == null ? void 0 : o.imageToImage;
|
4848
|
-
_typeof(s) == "object" && (s.engine_id && (
|
4849
|
-
return
|
4860
|
+
_typeof(s) == "object" && (s.engine_id && (_this12.url = "https://api.stability.ai/v1/generation/".concat(s.engine_id, "/text-to-image")), s.weight !== void 0 && s.weight !== null && (_this12._imageWeight = s.weight), kt.cleanConfig(s), Object.assign(_this12.rawBody, s)), _this12.canSendMessage = kt.canSendFileTextMessage;
|
4861
|
+
return _this12;
|
4850
4862
|
}
|
4851
4863
|
_createClass(kt, [{
|
4852
4864
|
key: "createFormDataBody",
|
@@ -4975,21 +4987,21 @@ var lo = /*#__PURE__*/function (_we6) {
|
|
4975
4987
|
}]);
|
4976
4988
|
return lo;
|
4977
4989
|
}(we);
|
4978
|
-
var
|
4979
|
-
_inherits(
|
4980
|
-
var _super17 = _createSuper(
|
4981
|
-
function
|
4982
|
-
var
|
4983
|
-
_classCallCheck(this,
|
4990
|
+
var Tt = /*#__PURE__*/function (_qt4) {
|
4991
|
+
_inherits(Tt, _qt4);
|
4992
|
+
var _super17 = _createSuper(Tt);
|
4993
|
+
function Tt(e) {
|
4994
|
+
var _this13;
|
4995
|
+
_classCallCheck(this, Tt);
|
4984
4996
|
var s;
|
4985
4997
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
4986
4998
|
i = t.stabilityAI;
|
4987
|
-
|
4999
|
+
_this13 = _super17.call(this, e, Q.buildKeyVerificationDetails(), Q.buildHeaders, i), _this13.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-5/text-to-image", _this13.textInputPlaceholderText = "Describe an image", _this13.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>";
|
4988
5000
|
var r = (s = t.stabilityAI) == null ? void 0 : s.textToImage;
|
4989
|
-
_typeof(r) == "object" && (r.engine_id && (
|
4990
|
-
return
|
5001
|
+
_typeof(r) == "object" && (r.engine_id && (_this13.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/text-to-image")), r.weight !== void 0 && r.weight !== null && (_this13._imageWeight = r.weight), Tt.cleanConfig(r), Object.assign(_this13.rawBody, r)), _this13.canSendMessage = Tt.canSendTextMessage;
|
5002
|
+
return _this13;
|
4991
5003
|
}
|
4992
|
-
_createClass(
|
5004
|
+
_createClass(Tt, [{
|
4993
5005
|
key: "preprocessBody",
|
4994
5006
|
value: function preprocessBody(e, t) {
|
4995
5007
|
var i = JSON.parse(JSON.stringify(e)),
|
@@ -5068,19 +5080,19 @@ var Ct = /*#__PURE__*/function (_qt4) {
|
|
5068
5080
|
return !!(e && e.trim() !== "");
|
5069
5081
|
}
|
5070
5082
|
}]);
|
5071
|
-
return
|
5083
|
+
return Tt;
|
5072
5084
|
}(qt);
|
5073
5085
|
var co = /*#__PURE__*/function (_we7) {
|
5074
5086
|
_inherits(co, _we7);
|
5075
5087
|
var _super18 = _createSuper(co);
|
5076
5088
|
function co(e) {
|
5077
|
-
var
|
5089
|
+
var _this14;
|
5078
5090
|
_classCallCheck(this, co);
|
5079
5091
|
var r, s, o;
|
5080
5092
|
var t = (s = (r = e.directConnection) == null ? void 0 : r.huggingFace) == null ? void 0 : s.fillMask,
|
5081
5093
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
5082
|
-
|
5083
|
-
return
|
5094
|
+
_this14 = _super18.call(this, e, "The goal of life is [MASK].", "bert-base-uncased", t, i), _this14.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Hugging Face</b></div>\n <p>Insert a sentence with the word [MASK] and the model will try to fill it for you. E.g. I want [MASK].</p>\n <p>First message may take an extented amount of time to complete as the model needs to be initialized.</p>", _this14.permittedErrorPrefixes = ["Authorization header", "No mask_token"];
|
5095
|
+
return _this14;
|
5084
5096
|
}
|
5085
5097
|
_createClass(co, [{
|
5086
5098
|
key: "extractResultData",
|
@@ -5112,11 +5124,11 @@ var co = /*#__PURE__*/function (_we7) {
|
|
5112
5124
|
}]);
|
5113
5125
|
return co;
|
5114
5126
|
}(we);
|
5115
|
-
var
|
5116
|
-
function
|
5117
|
-
_classCallCheck(this,
|
5127
|
+
var Ct = /*#__PURE__*/function () {
|
5128
|
+
function Ct() {
|
5129
|
+
_classCallCheck(this, Ct);
|
5118
5130
|
}
|
5119
|
-
_createClass(
|
5131
|
+
_createClass(Ct, null, [{
|
5120
5132
|
key: "buildHeaders",
|
5121
5133
|
value: function buildHeaders(e) {
|
5122
5134
|
return {
|
@@ -5129,7 +5141,7 @@ var Tt = /*#__PURE__*/function () {
|
|
5129
5141
|
}, {
|
5130
5142
|
key: "handleVerificationResult",
|
5131
5143
|
value: function handleVerificationResult(e, t, i, r) {
|
5132
|
-
e.message === "invalid request: prompt must be at least 1 token long" ? i(t) : r(
|
5144
|
+
e.message === "invalid request: prompt must be at least 1 token long" ? i(t) : r(C.INVALID_KEY);
|
5133
5145
|
}
|
5134
5146
|
}, {
|
5135
5147
|
key: "buildKeyVerificationDetails",
|
@@ -5137,23 +5149,23 @@ var Tt = /*#__PURE__*/function () {
|
|
5137
5149
|
return {
|
5138
5150
|
url: "https://api.cohere.ai/v1/generate",
|
5139
5151
|
method: "POST",
|
5140
|
-
handleVerificationResult:
|
5152
|
+
handleVerificationResult: Ct.handleVerificationResult,
|
5141
5153
|
body: JSON.stringify({
|
5142
5154
|
prompt: ""
|
5143
5155
|
})
|
5144
5156
|
};
|
5145
5157
|
}
|
5146
5158
|
}]);
|
5147
|
-
return
|
5159
|
+
return Ct;
|
5148
5160
|
}();
|
5149
5161
|
var Ni = /*#__PURE__*/function (_B3) {
|
5150
5162
|
_inherits(Ni, _B3);
|
5151
5163
|
var _super19 = _createSuper(Ni);
|
5152
5164
|
function Ni(e, t, i, r, s) {
|
5153
|
-
var
|
5165
|
+
var _this15;
|
5154
5166
|
_classCallCheck(this, Ni);
|
5155
|
-
|
5156
|
-
return
|
5167
|
+
_this15 = _super19.call(this, e, Ct.buildKeyVerificationDetails(), Ct.buildHeaders, s), _this15.insertKeyPlaceholderText = "Cohere API Key", _this15.getKeyLink = "https://dashboard.cohere.ai/api-keys", _this15.permittedErrorPrefixes = ["invalid"], _this15.url = t, _this15.textInputPlaceholderText = i, r && _typeof(r) == "object" && Object.assign(_this15.rawBody, r);
|
5168
|
+
return _this15;
|
5157
5169
|
}
|
5158
5170
|
return _createClass(Ni);
|
5159
5171
|
}(B);
|
@@ -5335,7 +5347,7 @@ var W = /*#__PURE__*/function () {
|
|
5335
5347
|
}, {
|
5336
5348
|
key: "handleSpeechVerificationResult",
|
5337
5349
|
value: function handleSpeechVerificationResult(e, t, i, r) {
|
5338
|
-
e.error ? r(
|
5350
|
+
e.error ? r(C.INVALID_KEY) : i(t);
|
5339
5351
|
}
|
5340
5352
|
}, {
|
5341
5353
|
key: "buildSpeechKeyVerificationDetails",
|
@@ -5364,7 +5376,7 @@ var W = /*#__PURE__*/function () {
|
|
5364
5376
|
key: "handleLanguageVerificationResult",
|
5365
5377
|
value: function handleLanguageVerificationResult(e, t, i, r) {
|
5366
5378
|
var o;
|
5367
|
-
((o = e.error) == null ? void 0 : o.code) === "401" ? r(
|
5379
|
+
((o = e.error) == null ? void 0 : o.code) === "401" ? r(C.INVALID_KEY) : i(t);
|
5368
5380
|
}
|
5369
5381
|
}, {
|
5370
5382
|
key: "buildLanguageKeyVerificationDetails",
|
@@ -5385,7 +5397,7 @@ var W = /*#__PURE__*/function () {
|
|
5385
5397
|
key: "handleTranslationVerificationResult",
|
5386
5398
|
value: function handleTranslationVerificationResult(e, t, i, r) {
|
5387
5399
|
e.json().then(function (o) {
|
5388
|
-
!Array.isArray(o) && o.error.code === 401e3 ? r(
|
5400
|
+
!Array.isArray(o) && o.error.code === 401e3 ? r(C.INVALID_KEY) : i(t);
|
5389
5401
|
});
|
5390
5402
|
}
|
5391
5403
|
}, {
|
@@ -5417,12 +5429,12 @@ var po = /*#__PURE__*/function (_B4) {
|
|
5417
5429
|
var _super22 = _createSuper(po);
|
5418
5430
|
// prettier-ignore
|
5419
5431
|
function po(e, t, i, r, s) {
|
5420
|
-
var
|
5432
|
+
var _this16;
|
5421
5433
|
_classCallCheck(this, po);
|
5422
|
-
|
5434
|
+
_this16 = _super22.call(this, e, W.buildLanguageKeyVerificationDetails(i), t, r, s), _this16.insertKeyPlaceholderText = "Azure Language Subscription Key", _this16.getKeyLink =
|
5423
5435
|
// eslint-disable-next-line max-len
|
5424
|
-
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal",
|
5425
|
-
return
|
5436
|
+
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this16.permittedErrorPrefixes = ["Access"];
|
5437
|
+
return _this16;
|
5426
5438
|
}
|
5427
5439
|
return _createClass(po);
|
5428
5440
|
}(B);
|
@@ -5431,13 +5443,13 @@ var fo = /*#__PURE__*/function (_po) {
|
|
5431
5443
|
var _super23 = _createSuper(fo);
|
5432
5444
|
function fo(e) {
|
5433
5445
|
var _a$language;
|
5434
|
-
var
|
5446
|
+
var _this17;
|
5435
5447
|
_classCallCheck(this, fo);
|
5436
5448
|
var r, s, o, a;
|
5437
5449
|
var t = (s = (r = e.directConnection) == null ? void 0 : r.azure) == null ? void 0 : s.summarization,
|
5438
5450
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
5439
|
-
|
5440
|
-
return
|
5451
|
+
_this17 = _super23.call(this, e, W.buildSummarizationHeader, t.endpoint, i), _this17.url = "", _this17.textInputPlaceholderText = "Insert text to summarize", (_a$language = (a = _this17.rawBody).language) !== null && _a$language !== void 0 ? _a$language : a.language = "en", Object.assign(_this17.rawBody, t), _this17.url = "".concat(t.endpoint, "/language/analyze-text/jobs?api-version=2022-10-01-preview");
|
5452
|
+
return _this17;
|
5441
5453
|
}
|
5442
5454
|
_createClass(fo, [{
|
5443
5455
|
key: "preprocessBody",
|
@@ -5621,7 +5633,7 @@ var Pi = /*#__PURE__*/function () {
|
|
5621
5633
|
key: "handleVerificationResult",
|
5622
5634
|
value: function handleVerificationResult(e, t, i, r) {
|
5623
5635
|
var s = e;
|
5624
|
-
s.error ? s.error.code === "invalid_api_key" ? r(
|
5636
|
+
s.error ? s.error.code === "invalid_api_key" ? r(C.INVALID_KEY) : r(C.CONNECTION_FAILED) : i(t);
|
5625
5637
|
}
|
5626
5638
|
}, {
|
5627
5639
|
key: "buildKeyVerificationDetails",
|
@@ -5643,16 +5655,16 @@ var mo = /*#__PURE__*/function (_B5) {
|
|
5643
5655
|
var _super24 = _createSuper(mo);
|
5644
5656
|
function mo(e) {
|
5645
5657
|
var _a$model;
|
5646
|
-
var
|
5658
|
+
var _this18;
|
5647
5659
|
_classCallCheck(this, mo);
|
5648
5660
|
var o, a;
|
5649
5661
|
var t = e.directConnection,
|
5650
5662
|
i = e.textInput,
|
5651
5663
|
r = t == null ? void 0 : t.openAI;
|
5652
|
-
|
5664
|
+
_this18 = _super24.call(this, e, J.buildKeyVerificationDetails(), J.buildHeaders, r), _this18.insertKeyPlaceholderText = "OpenAI API Key", _this18.getKeyLink = "https://platform.openai.com/account/api-keys", _this18.url = "https://api.openai.com/v1/completions", _this18.permittedErrorPrefixes = ["Incorrect"], _this18._maxCharLength = J.CONVERSE_MAX_CHAR_LENGTH, _this18.full_transaction_max_tokens = 4e3, _this18.numberOfCharsPerToken = 3.5;
|
5653
5665
|
var s = (o = t == null ? void 0 : t.openAI) == null ? void 0 : o.completions;
|
5654
|
-
i != null && i.characterLimit && (
|
5655
|
-
return
|
5666
|
+
i != null && i.characterLimit && (_this18._maxCharLength = i.characterLimit), _typeof(s) == "object" && Object.assign(_this18.rawBody, s), (_a$model = (a = _this18.rawBody).model) !== null && _a$model !== void 0 ? _a$model : a.model = Bn.GPT_COMPLETIONS_DAVINCI_MODEL;
|
5667
|
+
return _this18;
|
5656
5668
|
}
|
5657
5669
|
// prettier-ignore
|
5658
5670
|
_createClass(mo, [{
|
@@ -5730,11 +5742,11 @@ var mo = /*#__PURE__*/function (_B5) {
|
|
5730
5742
|
}]);
|
5731
5743
|
return mo;
|
5732
5744
|
}(B);
|
5733
|
-
var
|
5734
|
-
function
|
5735
|
-
_classCallCheck(this,
|
5745
|
+
var Je = /*#__PURE__*/function () {
|
5746
|
+
function Je() {
|
5747
|
+
_classCallCheck(this, Je);
|
5736
5748
|
}
|
5737
|
-
_createClass(
|
5749
|
+
_createClass(Je, null, [{
|
5738
5750
|
key: "poll",
|
5739
5751
|
value: function () {
|
5740
5752
|
var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(e, t) {
|
@@ -5822,7 +5834,7 @@ var We = /*#__PURE__*/function () {
|
|
5822
5834
|
key: "handleVerificationResult",
|
5823
5835
|
value: function handleVerificationResult(e, t, i, r) {
|
5824
5836
|
var s = e;
|
5825
|
-
s.error ? s.error.code === "invalid_api_key" ? r(
|
5837
|
+
s.error ? s.error.code === "invalid_api_key" ? r(C.INVALID_KEY) : r(C.CONNECTION_FAILED) : i(t);
|
5826
5838
|
}
|
5827
5839
|
}, {
|
5828
5840
|
key: "buildKeyVerificationDetails",
|
@@ -5830,24 +5842,24 @@ var We = /*#__PURE__*/function () {
|
|
5830
5842
|
return {
|
5831
5843
|
url: "https://api.assemblyai.com/v2/upload",
|
5832
5844
|
method: "POST",
|
5833
|
-
handleVerificationResult:
|
5845
|
+
handleVerificationResult: Je.handleVerificationResult
|
5834
5846
|
};
|
5835
5847
|
}
|
5836
5848
|
}]);
|
5837
|
-
return
|
5849
|
+
return Je;
|
5838
5850
|
}();
|
5839
5851
|
var Di = /*#__PURE__*/function (_B6) {
|
5840
5852
|
_inherits(Di, _B6);
|
5841
5853
|
var _super25 = _createSuper(Di);
|
5842
5854
|
function Di(e) {
|
5843
|
-
var
|
5855
|
+
var _this19;
|
5844
5856
|
_classCallCheck(this, Di);
|
5845
5857
|
var i;
|
5846
5858
|
var t = (i = e.directConnection) == null ? void 0 : i.assemblyAI;
|
5847
|
-
|
5859
|
+
_this19 = _super25.call(this, e, Je.buildKeyVerificationDetails(), Je.buildHeaders, t, {
|
5848
5860
|
audio: {}
|
5849
|
-
}),
|
5850
|
-
return
|
5861
|
+
}), _this19.insertKeyPlaceholderText = "AssemblyAI API Key", _this19.getKeyLink = "https://www.assemblyai.com/app/account", _this19.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>AssemblyAI Audio</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"https://www.assemblyai.com/docs/Guides/transcribing_an_audio_file#get-started\">here</a> for more info.\n </p>", _this19.url = "https://api.assemblyai.com/v2/upload", _this19.isTextInputDisabled = !0, _this19.textInputPlaceholderText = "Upload an audio file", _this19.permittedErrorPrefixes = ["Authentication", "Invalid"], _this19.canSendMessage = Di.canFileSendMessage;
|
5862
|
+
return _this19;
|
5851
5863
|
}
|
5852
5864
|
_createClass(Di, [{
|
5853
5865
|
key: "callServiceAPI",
|
@@ -5897,7 +5909,7 @@ var Di = /*#__PURE__*/function (_B6) {
|
|
5897
5909
|
case 2:
|
5898
5910
|
t = (s = (r = this.requestSettings) == null ? void 0 : r.headers) == null ? void 0 : s.Authorization;
|
5899
5911
|
_context51.next = 5;
|
5900
|
-
return
|
5912
|
+
return Je.poll(t, e.upload_url);
|
5901
5913
|
case 5:
|
5902
5914
|
_context51.t0 = _context51.sent.text;
|
5903
5915
|
return _context51.abrupt("return", {
|
@@ -5927,12 +5939,12 @@ var qn = /*#__PURE__*/function (_B7) {
|
|
5927
5939
|
var _super26 = _createSuper(qn);
|
5928
5940
|
// prettier-ignore
|
5929
5941
|
function qn(e, t, i, r, s) {
|
5930
|
-
var
|
5942
|
+
var _this20;
|
5931
5943
|
_classCallCheck(this, qn);
|
5932
|
-
|
5944
|
+
_this20 = _super26.call(this, e, W.buildSpeechKeyVerificationDetails(i), t, r, s), _this20.insertKeyPlaceholderText = "Azure Speech Subscription Key", _this20.getKeyLink =
|
5933
5945
|
// eslint-disable-next-line max-len
|
5934
5946
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal";
|
5935
|
-
return
|
5947
|
+
return _this20;
|
5936
5948
|
}
|
5937
5949
|
return _createClass(qn);
|
5938
5950
|
}(B);
|
@@ -5942,13 +5954,13 @@ var Hn = /*#__PURE__*/function (_qn) {
|
|
5942
5954
|
// prettier-ignore
|
5943
5955
|
function Gn(e) {
|
5944
5956
|
var _a$lang, _l$name, _c$gender;
|
5945
|
-
var
|
5957
|
+
var _this21;
|
5946
5958
|
_classCallCheck(this, Gn);
|
5947
5959
|
var r, s, o, a, l, c;
|
5948
5960
|
var t = (s = (r = e.directConnection) == null ? void 0 : r.azure) == null ? void 0 : s.textToSpeech,
|
5949
5961
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
5950
|
-
|
5951
|
-
return
|
5962
|
+
_this21 = _super27.call(this, e, W.buildTextToSpeechHeaders.bind({}, (t == null ? void 0 : t.outputFormat) || "audio-16khz-128kbitrate-mono-mp3"), t.region, i), _this21.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Text To Speech</b></div>\n <p>Insert text to synthesize it to audio.\n <p>\n Click <a href=\"".concat(Gn.HELP_LINK, "\">here</a> for more info.\n </p>"), _this21.url = "", Object.assign(_this21.rawBody, t), (_a$lang = (a = _this21.rawBody).lang) !== null && _a$lang !== void 0 ? _a$lang : a.lang = "en-US", (_l$name = (l = _this21.rawBody).name) !== null && _l$name !== void 0 ? _l$name : l.name = "en-US-JennyNeural", (_c$gender = (c = _this21.rawBody).gender) !== null && _c$gender !== void 0 ? _c$gender : c.gender = "Female", _this21.url = "https://".concat(t.region, ".tts.speech.microsoft.com/cognitiveservices/v1");
|
5963
|
+
return _this21;
|
5952
5964
|
}
|
5953
5965
|
_createClass(Gn, [{
|
5954
5966
|
key: "preprocessBody",
|
@@ -6023,7 +6035,7 @@ var Vn = /*#__PURE__*/function (_qn2) {
|
|
6023
6035
|
_inherits(Si, _qn2);
|
6024
6036
|
var _super28 = _createSuper(Si);
|
6025
6037
|
function Si(e) {
|
6026
|
-
var
|
6038
|
+
var _this22;
|
6027
6039
|
_classCallCheck(this, Si);
|
6028
6040
|
var o, a, l;
|
6029
6041
|
var t = (a = (o = e.directConnection) == null ? void 0 : o.azure) == null ? void 0 : a.speechToText,
|
@@ -6035,10 +6047,10 @@ var Vn = /*#__PURE__*/function (_qn2) {
|
|
6035
6047
|
}
|
6036
6048
|
}
|
6037
6049
|
};
|
6038
|
-
|
6050
|
+
_this22 = _super28.call(this, e, W.buildSpeechToTextHeaders, t.region, i, r), _this22.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Speech To Text</b></div>\n <p><b>Upload a .wav or .ogg audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"".concat(Si.HELP_LINK, "\">here</a> for more info.\n </p>"), _this22.url = "", _this22.isTextInputDisabled = !0, _this22.textInputPlaceholderText = "Upload an audio file", _this22.canSendMessage = Si.canFileSendMessage;
|
6039
6051
|
var s = t.lang || "en-US";
|
6040
|
-
|
6041
|
-
return
|
6052
|
+
_this22.url = "https://".concat(t.region, ".stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=").concat(s, "&format=detailed"), _this22.recordAudio = void 0;
|
6053
|
+
return _this22;
|
6042
6054
|
}
|
6043
6055
|
_createClass(Si, [{
|
6044
6056
|
key: "callServiceAPI",
|
@@ -6116,15 +6128,15 @@ var vo = /*#__PURE__*/function (_B8) {
|
|
6116
6128
|
var _super29 = _createSuper(vo);
|
6117
6129
|
// prettier-ignore
|
6118
6130
|
function vo(e) {
|
6119
|
-
var
|
6131
|
+
var _this23;
|
6120
6132
|
_classCallCheck(this, vo);
|
6121
6133
|
var r, s, o;
|
6122
6134
|
var t = (s = (r = e.directConnection) == null ? void 0 : r.azure) == null ? void 0 : s.translation,
|
6123
6135
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
6124
|
-
|
6136
|
+
_this23 = _super29.call(this, e, W.buildTranslationKeyVerificationDetails(t.region), W.buildTranslationHeaders.bind({}, t == null ? void 0 : t.region), i), _this23.insertKeyPlaceholderText = "Azure Translate Subscription Key", _this23.getKeyLink =
|
6125
6137
|
// eslint-disable-next-line max-len
|
6126
|
-
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal",
|
6127
|
-
return
|
6138
|
+
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this23.url = "", _this23.url = "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=".concat(t.language || "es");
|
6139
|
+
return _this23;
|
6128
6140
|
}
|
6129
6141
|
_createClass(vo, [{
|
6130
6142
|
key: "preprocessBody",
|
@@ -6196,7 +6208,7 @@ var Ht = /*#__PURE__*/function (_B9) {
|
|
6196
6208
|
_inherits(he, _B9);
|
6197
6209
|
var _super30 = _createSuper(he);
|
6198
6210
|
function he(e) {
|
6199
|
-
var
|
6211
|
+
var _this24;
|
6200
6212
|
_classCallCheck(this, he);
|
6201
6213
|
var a;
|
6202
6214
|
var t = e.directConnection,
|
@@ -6210,19 +6222,19 @@ var Ht = /*#__PURE__*/function (_B9) {
|
|
6210
6222
|
}
|
6211
6223
|
}
|
6212
6224
|
};
|
6213
|
-
|
6225
|
+
_this24 = _super30.call(this, e, J.buildKeyVerificationDetails(), J.buildHeaders, r, s), _this24.insertKeyPlaceholderText = "OpenAI API Key", _this24.getKeyLink = "https://platform.openai.com/account/api-keys", _this24.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>", _this24.url = "", _this24.permittedErrorPrefixes = ["Incorrect", "Invalid input image"], _this24._maxCharLength = J.FILE_MAX_CHAR_LENGTH, i != null && i.characterLimit && (_this24._maxCharLength = i.characterLimit);
|
6214
6226
|
var o = (a = t == null ? void 0 : t.openAI) == null ? void 0 : a.images;
|
6215
|
-
if (
|
6227
|
+
if (_this24.camera) {
|
6216
6228
|
var l = _typeof(o) == "object" && o.size ? Number.parseInt(o.size) : 1024;
|
6217
|
-
|
6229
|
+
_this24.camera.files = {
|
6218
6230
|
dimensions: {
|
6219
6231
|
width: l,
|
6220
6232
|
height: l
|
6221
6233
|
}
|
6222
6234
|
};
|
6223
6235
|
}
|
6224
|
-
_typeof(o) == "object" && Object.assign(
|
6225
|
-
return
|
6236
|
+
_typeof(o) == "object" && Object.assign(_this24.rawBody, o), _this24.canSendMessage = he.canFileSendMessage;
|
6237
|
+
return _this24;
|
6226
6238
|
}
|
6227
6239
|
_createClass(he, [{
|
6228
6240
|
key: "preprocessBody",
|
@@ -6358,18 +6370,18 @@ var Gt = /*#__PURE__*/function (_B10) {
|
|
6358
6370
|
var _super31 = _createSuper(pe);
|
6359
6371
|
function pe(e) {
|
6360
6372
|
var _a$model2;
|
6361
|
-
var
|
6373
|
+
var _this25;
|
6362
6374
|
_classCallCheck(this, pe);
|
6363
6375
|
var o, a;
|
6364
6376
|
var t = e.textInput,
|
6365
6377
|
i = JSON.parse(JSON.stringify(e.directConnection)),
|
6366
6378
|
r = i == null ? void 0 : i.openAI;
|
6367
|
-
|
6379
|
+
_this25 = _super31.call(this, e, J.buildKeyVerificationDetails(), J.buildHeaders, r, {
|
6368
6380
|
audio: {}
|
6369
|
-
}),
|
6381
|
+
}), _this25.insertKeyPlaceholderText = "OpenAI API Key", _this25.getKeyLink = "https://platform.openai.com/account/api-keys", _this25.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI Whisper</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/api-reference/audio/create\">here</a> for more info.</p>", _this25.url = "", _this25.permittedErrorPrefixes = ["Invalid"], _this25._maxCharLength = J.FILE_MAX_CHAR_LENGTH, _this25._service_url = pe.AUDIO_TRANSCRIPTIONS_URL, t != null && t.characterLimit && (_this25._maxCharLength = t.characterLimit);
|
6370
6382
|
var s = (o = i == null ? void 0 : i.openAI) == null ? void 0 : o.audio;
|
6371
|
-
_typeof(s) == "object" && (
|
6372
|
-
return
|
6383
|
+
_typeof(s) == "object" && (_this25.processConfig(s), pe.cleanConfig(s), Object.assign(_this25.rawBody, s)), (_a$model2 = (a = _this25.rawBody).model) !== null && _a$model2 !== void 0 ? _a$model2 : a.model = pe.DEFAULT_MODEL, _this25.rawBody.response_format = "json", _this25.canSendMessage = pe.canSendFileMessage;
|
6384
|
+
return _this25;
|
6373
6385
|
}
|
6374
6386
|
_createClass(pe, [{
|
6375
6387
|
key: "processConfig",
|
@@ -6479,16 +6491,16 @@ var At = /*#__PURE__*/function (_B11) {
|
|
6479
6491
|
_inherits(At, _B11);
|
6480
6492
|
var _super32 = _createSuper(At);
|
6481
6493
|
function At(e) {
|
6482
|
-
var
|
6483
|
-
var
|
6494
|
+
var _this26$maxMessages, _o$model;
|
6495
|
+
var _this26;
|
6484
6496
|
_classCallCheck(this, At);
|
6485
6497
|
var s, o;
|
6486
6498
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
6487
6499
|
i = t.openAI;
|
6488
|
-
|
6500
|
+
_this26 = _super32.call(this, e, J.buildKeyVerificationDetails(), J.buildHeaders, i), _this26.insertKeyPlaceholderText = "OpenAI API Key", _this26.getKeyLink = "https://platform.openai.com/account/api-keys", _this26.url = "https://api.openai.com/v1/chat/completions", _this26.permittedErrorPrefixes = ["Incorrect"], _this26._systemMessage = At.generateSystemMessage("You are a helpful assistant.");
|
6489
6501
|
var r = (s = t.openAI) == null ? void 0 : s.chat;
|
6490
|
-
_typeof(r) == "object" && (r.system_prompt && (
|
6491
|
-
return
|
6502
|
+
_typeof(r) == "object" && (r.system_prompt && (_this26._systemMessage = At.generateSystemMessage(r.system_prompt)), _this26.cleanConfig(r), Object.assign(_this26.rawBody, r)), (_this26$maxMessages = _this26.maxMessages) !== null && _this26$maxMessages !== void 0 ? _this26$maxMessages : _this26.maxMessages = -1, (_o$model = (o = _this26.rawBody).model) !== null && _o$model !== void 0 ? _o$model : o.model = Bn.GPT_CHAT_TURBO_MODEL;
|
6503
|
+
return _this26;
|
6492
6504
|
}
|
6493
6505
|
_createClass(At, [{
|
6494
6506
|
key: "cleanConfig",
|
@@ -6585,15 +6597,15 @@ var Eo = /*#__PURE__*/function (_Ni3) {
|
|
6585
6597
|
_inherits(Eo, _Ni3);
|
6586
6598
|
var _super33 = _createSuper(Eo);
|
6587
6599
|
function Eo(e) {
|
6588
|
-
var
|
6589
|
-
var
|
6600
|
+
var _this27$maxMessages;
|
6601
|
+
var _this27;
|
6590
6602
|
_classCallCheck(this, Eo);
|
6591
6603
|
var s;
|
6592
6604
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
6593
6605
|
i = (s = t.cohere) == null ? void 0 : s.chat,
|
6594
6606
|
r = t.cohere;
|
6595
|
-
|
6596
|
-
return
|
6607
|
+
_this27 = _super33.call(this, e, "https://api.cohere.ai/v1/chat", "Ask me anything!", i, r), _this27.username = "USER", _typeof(i) == "object" && (i.user_name && (_this27.username = i.user_name), _this27.cleanConfig(i), Object.assign(_this27.rawBody, i)), (_this27$maxMessages = _this27.maxMessages) !== null && _this27$maxMessages !== void 0 ? _this27$maxMessages : _this27.maxMessages = -1;
|
6608
|
+
return _this27;
|
6597
6609
|
}
|
6598
6610
|
_createClass(Eo, [{
|
6599
6611
|
key: "cleanConfig",
|
@@ -6603,7 +6615,7 @@ var Eo = /*#__PURE__*/function (_Ni3) {
|
|
6603
6615
|
}, {
|
6604
6616
|
key: "preprocessBody",
|
6605
6617
|
value: function preprocessBody(e, t) {
|
6606
|
-
var
|
6618
|
+
var _this28 = this;
|
6607
6619
|
var i = JSON.parse(JSON.stringify(e)),
|
6608
6620
|
r = t.filter(function (s) {
|
6609
6621
|
return s.text;
|
@@ -6611,7 +6623,7 @@ var Eo = /*#__PURE__*/function (_Ni3) {
|
|
6611
6623
|
return i.query = r[r.length - 1].text, i.chat_history = r.slice(0, r.length - 1).map(function (s) {
|
6612
6624
|
return {
|
6613
6625
|
text: s.text,
|
6614
|
-
user_name: s.role === "ai" ? "CHATBOT" :
|
6626
|
+
user_name: s.role === "ai" ? "CHATBOT" : _this28.username
|
6615
6627
|
};
|
6616
6628
|
}), i;
|
6617
6629
|
}
|
@@ -6693,9 +6705,9 @@ var So = /*#__PURE__*/function () {
|
|
6693
6705
|
if (t.azure.summarization) return new fo(e);
|
6694
6706
|
if (t.azure.translation) return new vo(e);
|
6695
6707
|
}
|
6696
|
-
if (t.stabilityAI) return t.stabilityAI.imageToImage ? new kt(e) : t.stabilityAI.imageToImageUpscale ? new _t(e) : t.stabilityAI.imageToImageMasking ? new Mt(e) : new
|
6708
|
+
if (t.stabilityAI) return t.stabilityAI.imageToImage ? new kt(e) : t.stabilityAI.imageToImageUpscale ? new _t(e) : t.stabilityAI.imageToImageMasking ? new Mt(e) : new Tt(e);
|
6697
6709
|
}
|
6698
|
-
return i ? new
|
6710
|
+
return i ? new Be(e) : new Be(e, void 0, r || !0);
|
6699
6711
|
}
|
6700
6712
|
}]);
|
6701
6713
|
return So;
|
@@ -7095,21 +7107,21 @@ var O = /*#__PURE__*/function () {
|
|
7095
7107
|
}]);
|
7096
7108
|
return O;
|
7097
7109
|
}();
|
7098
|
-
var
|
7099
|
-
function
|
7100
|
-
_classCallCheck(this,
|
7110
|
+
var It = /*#__PURE__*/function () {
|
7111
|
+
function It(e, t, i) {
|
7112
|
+
_classCallCheck(this, It);
|
7101
7113
|
this._isDisplayed = !1, e ? (this._elementRef = this.createIntroPanelWithChild(e, i), this._isDisplayed = !0) : t && (this._elementRef = this.createInternalIntroPanel(t, i), this._isDisplayed = !0);
|
7102
7114
|
}
|
7103
|
-
_createClass(
|
7115
|
+
_createClass(It, [{
|
7104
7116
|
key: "createIntroPanelWithChild",
|
7105
7117
|
value: function createIntroPanelWithChild(e, t) {
|
7106
|
-
var i =
|
7118
|
+
var i = It.createIntroPanel(t);
|
7107
7119
|
return e.style.display === "none" && (e.style.display = "block"), i.appendChild(e), i;
|
7108
7120
|
}
|
7109
7121
|
}, {
|
7110
7122
|
key: "createInternalIntroPanel",
|
7111
7123
|
value: function createInternalIntroPanel(e, t) {
|
7112
|
-
var i =
|
7124
|
+
var i = It.createIntroPanel(t);
|
7113
7125
|
return i.id = "internal-intro-panel", i.innerHTML = e, i;
|
7114
7126
|
}
|
7115
7127
|
}, {
|
@@ -7129,7 +7141,7 @@ var Lt = /*#__PURE__*/function () {
|
|
7129
7141
|
return t.classList.add("intro-panel"), Object.assign(t.style, e), t;
|
7130
7142
|
}
|
7131
7143
|
}]);
|
7132
|
-
return
|
7144
|
+
return It;
|
7133
7145
|
}();
|
7134
7146
|
var Qn = /*#__PURE__*/function () {
|
7135
7147
|
function yt() {
|
@@ -7222,12 +7234,12 @@ var zi = /*#__PURE__*/function () {
|
|
7222
7234
|
}();
|
7223
7235
|
zi.AI_ROLE = "ai";
|
7224
7236
|
zi.USER_ROLE = "user";
|
7225
|
-
var
|
7226
|
-
var
|
7227
|
-
function
|
7228
|
-
_classCallCheck(this,
|
7237
|
+
var Lt = zi;
|
7238
|
+
var je = /*#__PURE__*/function () {
|
7239
|
+
function je() {
|
7240
|
+
_classCallCheck(this, je);
|
7229
7241
|
}
|
7230
|
-
_createClass(
|
7242
|
+
_createClass(je, null, [{
|
7231
7243
|
key: "addElement",
|
7232
7244
|
value: function addElement(e, t) {
|
7233
7245
|
e.elementRef.appendChild(t), e.elementRef.scrollTop = e.elementRef.scrollHeight;
|
@@ -7243,28 +7255,28 @@ var De = /*#__PURE__*/function () {
|
|
7243
7255
|
}, {
|
7244
7256
|
key: "updateLastAIMessage",
|
7245
7257
|
value: function updateLastAIMessage(e, t, i) {
|
7246
|
-
var r =
|
7258
|
+
var r = Lt.getLastElementsByClass(i, ["ai-message-text", "html-message"], ["loading-message-text"]);
|
7247
7259
|
if (!r) return !1;
|
7248
7260
|
r && (r.bubbleElement.innerHTML = t);
|
7249
|
-
var s =
|
7261
|
+
var s = Lt.getLastMessage(e, !0, "html");
|
7250
7262
|
return s && (s.html = t), !0;
|
7251
7263
|
}
|
7252
7264
|
}, {
|
7253
7265
|
key: "add",
|
7254
7266
|
value: function add(e, t, i, r) {
|
7255
7267
|
var o;
|
7256
|
-
if (te.isUpdateMessage(t) &&
|
7257
|
-
var s =
|
7258
|
-
return t.trim().length === 0 &&
|
7268
|
+
if (te.isUpdateMessage(t) && je.updateLastAIMessage(e.messages, t, r)) return;
|
7269
|
+
var s = je.createElements(e, t, i);
|
7270
|
+
return t.trim().length === 0 && L.editEmptyMessageElement(s.bubbleElement), le.apply(e, s.outerContainer), e.applyCustomStyles(s, i, !1, (o = e.messageStyles) == null ? void 0 : o.html), je.addElement(e, s.outerContainer), s;
|
7259
7271
|
}
|
7260
7272
|
}]);
|
7261
|
-
return
|
7273
|
+
return je;
|
7262
7274
|
}();
|
7263
|
-
var
|
7264
|
-
function
|
7265
|
-
_classCallCheck(this,
|
7275
|
+
var To = /*#__PURE__*/function () {
|
7276
|
+
function To() {
|
7277
|
+
_classCallCheck(this, To);
|
7266
7278
|
}
|
7267
|
-
_createClass(
|
7279
|
+
_createClass(To, null, [{
|
7268
7280
|
key: "getText",
|
7269
7281
|
value: function getText(e, t) {
|
7270
7282
|
if (!e.directConnection && !e.request && !e.demo) return "Connect to any API using the [request](https://deepchat.dev/docs/connect#Request)\n property or choose any one of the preconfigured APIs via\n the [directConnection](https://deepchat.dev/docs/directConnection/#directConnection) property.\n \n To get started checkout the [Start](https://deepchat.dev/start) page and\n live code [examples](https://deepchat.dev/examples/frameworks).\n \n To remove this message set the [demo](https://deepchat.dev/docs/demo#demo) property to true.";
|
@@ -7274,9 +7286,9 @@ var Co = /*#__PURE__*/function () {
|
|
7274
7286
|
return null;
|
7275
7287
|
}
|
7276
7288
|
}]);
|
7277
|
-
return
|
7289
|
+
return To;
|
7278
7290
|
}();
|
7279
|
-
var
|
7291
|
+
var Co = "<?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>";
|
7280
7292
|
var se = /*#__PURE__*/function () {
|
7281
7293
|
function se() {
|
7282
7294
|
_classCallCheck(this, se);
|
@@ -7330,7 +7342,7 @@ var se = /*#__PURE__*/function () {
|
|
7330
7342
|
t.classList.add("any-file-message-contents");
|
7331
7343
|
var i = document.createElement("div");
|
7332
7344
|
i.classList.add("any-file-message-icon-container");
|
7333
|
-
var r = F.createSVGElement(
|
7345
|
+
var r = F.createSVGElement(Co);
|
7334
7346
|
r.classList.add("any-file-message-icon"), i.appendChild(r);
|
7335
7347
|
var s = document.createElement("div");
|
7336
7348
|
return s.classList.add("any-file-message-text"), s.textContent = e.name || re.DEFAULT_FILE_NAME, t.appendChild(i), t.appendChild(s), re.processContent(t, e.src);
|
@@ -7354,7 +7366,7 @@ var se = /*#__PURE__*/function () {
|
|
7354
7366
|
return se;
|
7355
7367
|
}();
|
7356
7368
|
var Ao = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8c3ZnIGZpbGw9IiMwMDAwMDAiIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIAoJCXZpZXdCb3g9IjAgMCAzMiAzMiIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+Cgk8cGF0aCBkPSJNMjMsMzAuMzZIOWMtMi40MDQsMC00LjM2LTEuOTU2LTQuMzYtNC4zNlYxNWMwLTIuNDA0LDEuOTU2LTQuMzYsNC4zNi00LjM2aDMuNjU5CgkJYzAuMTY3LTEuNTY2LDEuNDE1LTIuODEzLDIuOTgxLTIuOTgxVjUuMzMzYy0xLjEzMS0wLjE3NC0yLTEuMTU0LTItMi4zMzNjMC0xLjMwMSwxLjA1OS0yLjM2LDIuMzYtMi4zNgoJCWMxLjMwMiwwLDIuMzYsMS4wNTksMi4zNiwyLjM2YzAsMS4xNzktMC44NjksMi4xNTktMiwyLjMzM1Y3LjY2YzEuNTY2LDAuMTY3LDIuODE0LDEuNDE1LDIuOTgxLDIuOTgxSDIzCgkJYzIuNDA0LDAsNC4zNiwxLjk1Niw0LjM2LDQuMzZ2MTFDMjcuMzYsMjguNDA0LDI1LjQwNCwzMC4zNiwyMywzMC4zNnogTTksMTEuMzZjLTIuMDA3LDAtMy42NCwxLjYzMy0zLjY0LDMuNjR2MTEKCQljMCwyLjAwNywxLjYzMywzLjY0LDMuNjQsMy42NGgxNGMyLjAwNywwLDMuNjQtMS42MzMsMy42NC0zLjY0VjE1YzAtMi4wMDctMS42MzMtMy42NC0zLjY0LTMuNjRIOXogTTEzLjM4NCwxMC42NGg1LjIzMQoJCUMxOC40MzksOS4zNTQsMTcuMzM0LDguMzYsMTYsOC4zNkMxNC42NjcsOC4zNiwxMy41NjEsOS4zNTQsMTMuMzg0LDEwLjY0eiBNMTYsMS4zNmMtMC45MDQsMC0xLjY0LDAuNzM2LTEuNjQsMS42NAoJCVMxNS4wOTYsNC42NCwxNiw0LjY0YzAuOTA0LDAsMS42NC0wLjczNiwxLjY0LTEuNjRTMTYuOTA0LDEuMzYsMTYsMS4zNnogTTIwLDI3LjM2aC04Yy0xLjMwMSwwLTIuMzYtMS4wNTktMi4zNi0yLjM2CgkJczEuMDU5LTIuMzYsMi4zNi0yLjM2aDhjMS4zMDIsMCwyLjM2LDEuMDU5LDIuMzYsMi4zNlMyMS4zMDIsMjcuMzYsMjAsMjcuMzZ6IE0xMiwyMy4zNmMtMC45MDQsMC0xLjY0LDAuNzM1LTEuNjQsMS42NAoJCXMwLjczNiwxLjY0LDEuNjQsMS42NGg4YzAuOTA0LDAsMS42NC0wLjczNSwxLjY0LTEuNjRzLTAuNzM1LTEuNjQtMS42NC0xLjY0SDEyeiBNMzEsMjMuODZoLTJjLTAuMTk5LDAtMC4zNi0wLjE2MS0wLjM2LTAuMzZWMTUKCQljMC0wLjE5OSwwLjE2MS0wLjM2LDAuMzYtMC4zNmgyYzAuMTk5LDAsMC4zNiwwLjE2MSwwLjM2LDAuMzZ2OC41QzMxLjM2LDIzLjY5OSwzMS4xOTksMjMuODYsMzEsMjMuODZ6IE0yOS4zNiwyMy4xNGgxLjI3OXYtNy43OAoJCUgyOS4zNlYyMy4xNHogTTMsMjMuODZIMWMtMC4xOTksMC0wLjM2LTAuMTYxLTAuMzYtMC4zNlYxNWMwLTAuMTk5LDAuMTYxLTAuMzYsMC4zNi0wLjM2aDJjMC4xOTksMCwwLjM2LDAuMTYxLDAuMzYsMC4zNnY4LjUKCQlDMy4zNiwyMy42OTksMy4xOTksMjMuODYsMywyMy44NnogTTEuMzYsMjMuMTRoMS4yOHYtNy43OEgxLjM2VjIzLjE0eiBNMjAsMjAuMzZjLTEuMzAyLDAtMi4zNi0xLjA1OS0yLjM2LTIuMzYKCQlzMS4wNTktMi4zNiwyLjM2LTIuMzZzMi4zNiwxLjA1OSwyLjM2LDIuMzZDMjIuMzYsMTkuMzAyLDIxLjMwMiwyMC4zNiwyMCwyMC4zNnogTTIwLDE2LjM2Yy0wLjkwNCwwLTEuNjQsMC43MzYtMS42NCwxLjY0CgkJczAuNzM1LDEuNjQsMS42NCwxLjY0czEuNjQtMC43MzUsMS42NC0xLjY0UzIwLjkwNCwxNi4zNiwyMCwxNi4zNnogTTEyLDIwLjM2Yy0xLjMwMSwwLTIuMzYtMS4wNTktMi4zNi0yLjM2czEuMDU5LTIuMzYsMi4zNi0yLjM2CgkJczIuMzYsMS4wNTksMi4zNiwyLjM2QzE0LjM2LDE5LjMwMiwxMy4zMDEsMjAuMzYsMTIsMjAuMzZ6IE0xMiwxNi4zNmMtMC45MDQsMC0xLjY0LDAuNzM2LTEuNjQsMS42NHMwLjczNiwxLjY0LDEuNjQsMS42NAoJCXMxLjY0LTAuNzM1LDEuNjQtMS42NFMxMi45MDQsMTYuMzYsMTIsMTYuMzZ6Ii8+Cgk8cmVjdCBzdHlsZT0iZmlsbDpub25lOyIgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIi8+Cjwvc3ZnPg==",
|
7357
|
-
|
7369
|
+
Io = "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==";
|
7358
7370
|
var oe = /*#__PURE__*/function () {
|
7359
7371
|
function oe() {
|
7360
7372
|
_classCallCheck(this, oe);
|
@@ -7376,7 +7388,7 @@ var oe = /*#__PURE__*/function () {
|
|
7376
7388
|
value: function createAvatar(e, t) {
|
7377
7389
|
var s, o, a, l;
|
7378
7390
|
var i = document.createElement("img");
|
7379
|
-
e ? i.src = ((s = t == null ? void 0 : t.ai) == null ? void 0 : s.src) || ((o = t == null ? void 0 : t["default"]) == null ? void 0 : o.src) || Ao : i.src = ((a = t == null ? void 0 : t.user) == null ? void 0 : a.src) || ((l = t == null ? void 0 : t["default"]) == null ? void 0 : l.src) ||
|
7391
|
+
e ? i.src = ((s = t == null ? void 0 : t.ai) == null ? void 0 : s.src) || ((o = t == null ? void 0 : t["default"]) == null ? void 0 : o.src) || Ao : i.src = ((a = t == null ? void 0 : t.user) == null ? void 0 : a.src) || ((l = t == null ? void 0 : t["default"]) == null ? void 0 : l.src) || Io, i.classList.add("avatar");
|
7380
7392
|
var r = document.createElement("div");
|
7381
7393
|
return r.classList.add("avatar-container"), r.appendChild(i), t && oe.applyCustomStyles(r, i, t, e), r;
|
7382
7394
|
}
|
@@ -7440,24 +7452,24 @@ var Ne = /*#__PURE__*/function () {
|
|
7440
7452
|
}]);
|
7441
7453
|
return Ne;
|
7442
7454
|
}();
|
7443
|
-
var
|
7444
|
-
function
|
7445
|
-
var
|
7446
|
-
_classCallCheck(this,
|
7455
|
+
var L = /*#__PURE__*/function () {
|
7456
|
+
function L(e, t, i) {
|
7457
|
+
var _this29 = this;
|
7458
|
+
_classCallCheck(this, L);
|
7447
7459
|
var a, l;
|
7448
7460
|
this._messageElementRefs = [], this._textElementsToText = [], this._streamedText = "", this.htmlClassUtilities = {}, this.messages = [];
|
7449
7461
|
var r = t.permittedErrorPrefixes,
|
7450
7462
|
s = t.introPanelMarkUp,
|
7451
7463
|
o = t.demo;
|
7452
|
-
this._remarkable = xi.createNew(), this.elementRef =
|
7453
|
-
return JSON.parse(JSON.stringify(
|
7464
|
+
this._remarkable = xi.createNew(), this.elementRef = L.createContainerElement(), this.messageStyles = e.messageStyles, this._avatars = e.avatars, this._names = e.names, this._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, e.htmlClassUtilities && (this.htmlClassUtilities = e.htmlClassUtilities), this._onNewMessage = _i.onNewMessage.bind(this, e), this._onClearMessages = _i.onClearMessages.bind(this, e), this._displayLoadingMessage = L.getDisplayLoadingMessage(e, t), this._permittedErrorPrefixes = r, this.addSetupMessageIfNeeded(e, t), this.populateIntroPanel(i, s, e.introPanelStyle), e.introMessage && this.addIntroductoryMessage(e.introMessage), e.initialMessages && this.populateInitialMessages(e.initialMessages), this._displayServiceErrorMessages = (l = e.errorMessages) == null ? void 0 : l.displayServiceErrorMessages, e.getMessages = function () {
|
7465
|
+
return JSON.parse(JSON.stringify(_this29.messages));
|
7454
7466
|
}, e.clearMessages = this.clearMessages.bind(this), e.refreshMessages = this.refreshTextMessages.bind(this), e.scrollToBottom = this.scrollToBottom.bind(this), o && this.prepareDemo(o), e.textToSpeech && mt.processConfig(e.textToSpeech, function (c) {
|
7455
|
-
|
7467
|
+
_this29._textToSpeech = c;
|
7456
7468
|
}), setTimeout(function () {
|
7457
|
-
|
7469
|
+
_this29.submitUserMessage = e.submitUserMessage;
|
7458
7470
|
});
|
7459
7471
|
}
|
7460
|
-
_createClass(
|
7472
|
+
_createClass(L, [{
|
7461
7473
|
key: "prepareDemo",
|
7462
7474
|
value: function prepareDemo(e) {
|
7463
7475
|
_typeof(e) == "object" && (e.response && (this.customDemoResponse = e.response), e.displayErrors && (e.displayErrors["default"] && this.addNewErrorMessage("", ""), e.displayErrors.service && this.addNewErrorMessage("service", ""), e.displayErrors.speechToText && this.addNewErrorMessage("speechToText", "")), e.displayLoadingBubble && this.addLoadingMessage());
|
@@ -7465,7 +7477,7 @@ var I = /*#__PURE__*/function () {
|
|
7465
7477
|
}, {
|
7466
7478
|
key: "addSetupMessageIfNeeded",
|
7467
7479
|
value: function addSetupMessageIfNeeded(e, t) {
|
7468
|
-
var i =
|
7480
|
+
var i = To.getText(e, t);
|
7469
7481
|
if (i) {
|
7470
7482
|
var r = this.createAndAppendNewMessageElement(i, !0);
|
7471
7483
|
this.applyCustomStyles(r, !0, !1);
|
@@ -7479,18 +7491,18 @@ var I = /*#__PURE__*/function () {
|
|
7479
7491
|
var o = this.createAndAppendNewMessageElement(this._introMessage.text, !0);
|
7480
7492
|
this.applyCustomStyles(o, !0, !1, (i = this.messageStyles) == null ? void 0 : i.intro);
|
7481
7493
|
} else if ((r = this._introMessage) != null && r.html) {
|
7482
|
-
var
|
7483
|
-
this.applyCustomStyles(
|
7494
|
+
var _o3 = je.add(this, this._introMessage.html, !0, this._messageElementRefs);
|
7495
|
+
this.applyCustomStyles(_o3, !0, !1, (s = this.messageStyles) == null ? void 0 : s.intro);
|
7484
7496
|
}
|
7485
7497
|
}
|
7486
7498
|
}, {
|
7487
7499
|
key: "populateInitialMessages",
|
7488
7500
|
value: function populateInitialMessages(e) {
|
7489
|
-
var
|
7501
|
+
var _this30 = this;
|
7490
7502
|
e.forEach(function (t) {
|
7491
|
-
|
7503
|
+
Ci.processInitialMessageFile(t), _this30.addNewMessage(t, t.role === Lt.AI_ROLE, !0);
|
7492
7504
|
}), setTimeout(function () {
|
7493
|
-
return
|
7505
|
+
return _this30.scrollToBottom();
|
7494
7506
|
});
|
7495
7507
|
}
|
7496
7508
|
// prettier-ignore
|
@@ -7509,7 +7521,7 @@ var I = /*#__PURE__*/function () {
|
|
7509
7521
|
}, {
|
7510
7522
|
key: "createMessageElements",
|
7511
7523
|
value: function createMessageElements(e, t) {
|
7512
|
-
var i =
|
7524
|
+
var i = L.createBaseElements(),
|
7513
7525
|
r = i.outerContainer,
|
7514
7526
|
s = i.innerContainer,
|
7515
7527
|
o = i.bubbleElement;
|
@@ -7521,7 +7533,7 @@ var I = /*#__PURE__*/function () {
|
|
7521
7533
|
var r;
|
7522
7534
|
(r = this._introPanel) == null || r.hide();
|
7523
7535
|
var i = this._messageElementRefs[this._messageElementRefs.length - 1];
|
7524
|
-
return
|
7536
|
+
return L.isTemporaryElement(i) && (i.outerContainer.remove(), this._messageElementRefs.pop()), this.createMessageElements(e, t);
|
7525
7537
|
}
|
7526
7538
|
}, {
|
7527
7539
|
key: "createAndAppendNewMessageElement",
|
@@ -7534,7 +7546,7 @@ var I = /*#__PURE__*/function () {
|
|
7534
7546
|
key: "addNewTextMessage",
|
7535
7547
|
value: function addNewTextMessage(e, t) {
|
7536
7548
|
var i = this.createAndAppendNewMessageElement(e, t);
|
7537
|
-
return this.applyCustomStyles(i, t, !1), e.trim().length === 0 &&
|
7549
|
+
return this.applyCustomStyles(i, t, !1), e.trim().length === 0 && L.editEmptyMessageElement(i.bubbleElement), this._textElementsToText.push([i, e]), i;
|
7538
7550
|
}
|
7539
7551
|
// this should not be activated by streamed messages
|
7540
7552
|
}, {
|
@@ -7542,9 +7554,9 @@ var I = /*#__PURE__*/function () {
|
|
7542
7554
|
value: function addNewMessage(e, t) {
|
7543
7555
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
|
7544
7556
|
var r = !0;
|
7545
|
-
var s =
|
7557
|
+
var s = L.createMessageContent(t, e);
|
7546
7558
|
if (s.text !== void 0 && e.text !== null && (this.addNewTextMessage(s.text, t), !i && this._textToSpeech && t && mt.speak(s.text, this._textToSpeech)), s.files && Array.isArray(s.files) && se.addMessages(this, s.files, t), s.html !== void 0 && s.html !== null) {
|
7547
|
-
var o =
|
7559
|
+
var o = je.add(this, s.html, t, this._messageElementRefs);
|
7548
7560
|
te.isElementTemporary(o) && delete s.html, r = !!o;
|
7549
7561
|
}
|
7550
7562
|
this.updateStateOnMessage(s, r, i);
|
@@ -7568,7 +7580,7 @@ var I = /*#__PURE__*/function () {
|
|
7568
7580
|
value: function removeMessageOnError() {
|
7569
7581
|
var e = this._messageElementRefs[this._messageElementRefs.length - 1],
|
7570
7582
|
t = e == null ? void 0 : e.bubbleElement;
|
7571
|
-
(t != null && t.classList.contains("streamed-message") && t.textContent === "" ||
|
7583
|
+
(t != null && t.classList.contains("streamed-message") && t.textContent === "" || L.isTemporaryElement(e)) && (e.outerContainer.remove(), this._messageElementRefs.pop());
|
7572
7584
|
}
|
7573
7585
|
// prettier-ignore
|
7574
7586
|
}, {
|
@@ -7576,7 +7588,7 @@ var I = /*#__PURE__*/function () {
|
|
7576
7588
|
value: function addNewErrorMessage(e, t) {
|
7577
7589
|
var l, c, d, u;
|
7578
7590
|
this.removeMessageOnError();
|
7579
|
-
var i =
|
7591
|
+
var i = L.createBaseElements(),
|
7580
7592
|
r = i.outerContainer,
|
7581
7593
|
s = i.bubbleElement;
|
7582
7594
|
s.classList.add("error-message-text");
|
@@ -7591,10 +7603,10 @@ var I = /*#__PURE__*/function () {
|
|
7591
7603
|
if (e) {
|
7592
7604
|
if (this._displayServiceErrorMessages) return e;
|
7593
7605
|
if (typeof e == "string" && this._permittedErrorPrefixes) {
|
7594
|
-
var t =
|
7606
|
+
var t = L.checkPermittedErrorPrefixes(this._permittedErrorPrefixes, e);
|
7595
7607
|
if (t) return t;
|
7596
7608
|
} else if (Array.isArray(e) && this._permittedErrorPrefixes) for (var _t3 = 0; _t3 < e.length; _t3 += 1) {
|
7597
|
-
var i =
|
7609
|
+
var i = L.checkPermittedErrorPrefixes(this._permittedErrorPrefixes, e[_t3]);
|
7598
7610
|
if (i) return i;
|
7599
7611
|
}
|
7600
7612
|
}
|
@@ -7640,7 +7652,7 @@ var I = /*#__PURE__*/function () {
|
|
7640
7652
|
value: function addNewStreamedMessage() {
|
7641
7653
|
var _this$addNewTextMessa = this.addNewTextMessage("", !0),
|
7642
7654
|
e = _this$addNewTextMessa.bubbleElement,
|
7643
|
-
t =
|
7655
|
+
t = L.createMessageContent(!0, {
|
7644
7656
|
text: ""
|
7645
7657
|
});
|
7646
7658
|
return this.messages.push(t), e.classList.add("streamed-message"), this.scrollToBottom(), e;
|
@@ -7660,14 +7672,14 @@ var I = /*#__PURE__*/function () {
|
|
7660
7672
|
key: "finaliseStreamedMessage",
|
7661
7673
|
value: function finaliseStreamedMessage() {
|
7662
7674
|
var e;
|
7663
|
-
(e = this.getLastMessageBubbleElement()) != null && e.classList.contains("streamed-message") && (this._textElementsToText[this._textElementsToText.length - 1][1] = this._streamedText, this.messages[this.messages.length - 1].text = this._streamedText, this.sendClientUpdate(
|
7675
|
+
(e = this.getLastMessageBubbleElement()) != null && e.classList.contains("streamed-message") && (this._textElementsToText[this._textElementsToText.length - 1][1] = this._streamedText, this.messages[this.messages.length - 1].text = this._streamedText, this.sendClientUpdate(L.createMessageContent(!0, {
|
7664
7676
|
text: this._streamedText
|
7665
7677
|
}), !1), this._textToSpeech && mt.speak(this._streamedText, this._textToSpeech), this._streamedText = "");
|
7666
7678
|
}
|
7667
7679
|
}, {
|
7668
7680
|
key: "populateIntroPanel",
|
7669
7681
|
value: function populateIntroPanel(e, t, i) {
|
7670
|
-
(e || t) && (this._introPanel = new
|
7682
|
+
(e || t) && (this._introPanel = new It(e, t, i), this._introPanel._elementRef && (le.apply(this, this._introPanel._elementRef), this.elementRef.appendChild(this._introPanel._elementRef)));
|
7671
7683
|
}
|
7672
7684
|
}, {
|
7673
7685
|
key: "addMultipleFiles",
|
@@ -7729,9 +7741,9 @@ var I = /*#__PURE__*/function () {
|
|
7729
7741
|
}, {
|
7730
7742
|
key: "refreshTextMessages",
|
7731
7743
|
value: function refreshTextMessages() {
|
7732
|
-
var
|
7744
|
+
var _this31 = this;
|
7733
7745
|
this._remarkable = xi.createNew(), this._textElementsToText.forEach(function (e) {
|
7734
|
-
e[0].bubbleElement.innerHTML =
|
7746
|
+
e[0].bubbleElement.innerHTML = _this31._remarkable.render(e[1]);
|
7735
7747
|
});
|
7736
7748
|
}
|
7737
7749
|
}], [{
|
@@ -7750,7 +7762,7 @@ var I = /*#__PURE__*/function () {
|
|
7750
7762
|
key: "createMessageContent",
|
7751
7763
|
value: function createMessageContent(e, t) {
|
7752
7764
|
var i = {
|
7753
|
-
role:
|
7765
|
+
role: Lt.getRole(e)
|
7754
7766
|
},
|
7755
7767
|
r = t.text,
|
7756
7768
|
s = t.files,
|
@@ -7786,7 +7798,7 @@ var I = /*#__PURE__*/function () {
|
|
7786
7798
|
for (var i = 0; i < e.length; i += 1) if (t.startsWith(e[i])) return t;
|
7787
7799
|
}
|
7788
7800
|
}]);
|
7789
|
-
return
|
7801
|
+
return L;
|
7790
7802
|
}();
|
7791
7803
|
var st = /*#__PURE__*/function () {
|
7792
7804
|
function H() {
|
@@ -7828,12 +7840,12 @@ st.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS = "text-input-container-left-adjustment";
|
|
7828
7840
|
st.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS = "text-input-container-right-adjustment";
|
7829
7841
|
st.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS = "text-input-container-left-small-adjustment";
|
7830
7842
|
st.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS = "text-input-container-right-small-adjustment";
|
7831
|
-
var
|
7832
|
-
var
|
7833
|
-
function
|
7834
|
-
_classCallCheck(this,
|
7843
|
+
var Lo = st;
|
7844
|
+
var Ue = /*#__PURE__*/function () {
|
7845
|
+
function Ue() {
|
7846
|
+
_classCallCheck(this, Ue);
|
7835
7847
|
}
|
7836
|
-
_createClass(
|
7848
|
+
_createClass(Ue, null, [{
|
7837
7849
|
key: "create",
|
7838
7850
|
value: function create() {
|
7839
7851
|
return Array.from({
|
@@ -7857,11 +7869,11 @@ var Be = /*#__PURE__*/function () {
|
|
7857
7869
|
key: "addButton",
|
7858
7870
|
value: function addButton(e, t, i) {
|
7859
7871
|
t.classList.add(i);
|
7860
|
-
var r =
|
7872
|
+
var r = Ue.getContainerIndex(i);
|
7861
7873
|
e[r].appendChild(t), r === 3 && t.classList.add("outside-right");
|
7862
7874
|
}
|
7863
7875
|
}]);
|
7864
|
-
return
|
7876
|
+
return Ue;
|
7865
7877
|
}();
|
7866
7878
|
var rn = ["camera", "gifs", "images", "audio", "mixedFiles", "submit", "microphone"];
|
7867
7879
|
var R = /*#__PURE__*/function () {
|
@@ -7883,7 +7895,7 @@ var R = /*#__PURE__*/function () {
|
|
7883
7895
|
key: "createCustomElement",
|
7884
7896
|
value: function createCustomElement(e, t) {
|
7885
7897
|
var r, s, o, a;
|
7886
|
-
var i = e
|
7898
|
+
var i = t == null ? void 0 : t[e];
|
7887
7899
|
if ((r = i == null ? void 0 : i.text) != null && r.content) return R.createElement((s = i == null ? void 0 : i.text) == null ? void 0 : s.content, !0);
|
7888
7900
|
if ((o = i == null ? void 0 : i.svg) != null && o.content) return R.createElement((a = i == null ? void 0 : i.svg) == null ? void 0 : a.content, !1);
|
7889
7901
|
}
|
@@ -7898,7 +7910,7 @@ var R = /*#__PURE__*/function () {
|
|
7898
7910
|
key: "createSpecificStateElement",
|
7899
7911
|
value: function createSpecificStateElement(e, t, i) {
|
7900
7912
|
var r;
|
7901
|
-
return i && (r = R.createCustomElement(
|
7913
|
+
return i && (r = R.createCustomElement(t, i)), R.processElement(e, r), r;
|
7902
7914
|
}
|
7903
7915
|
// used for creating elements that change state in a sequence
|
7904
7916
|
// prettier-ignore
|
@@ -7911,7 +7923,7 @@ var R = /*#__PURE__*/function () {
|
|
7911
7923
|
r[t[0]] = s;
|
7912
7924
|
var o = s;
|
7913
7925
|
return t.slice(1).forEach(function (a) {
|
7914
|
-
o = R.createCustomElement(
|
7926
|
+
o = R.createCustomElement(a, i) || o, r[a] = o;
|
7915
7927
|
}), r;
|
7916
7928
|
}
|
7917
7929
|
}]);
|
@@ -8077,11 +8089,11 @@ var me = /*#__PURE__*/function () {
|
|
8077
8089
|
}();
|
8078
8090
|
var Fi = /*#__PURE__*/function () {
|
8079
8091
|
function Fi(e, t) {
|
8080
|
-
var
|
8092
|
+
var _this32 = this;
|
8081
8093
|
_classCallCheck(this, Fi);
|
8082
8094
|
var i;
|
8083
8095
|
this._isOpen = !0, this._styles = t, this.elementRef = Fi.createElement((i = this._styles) == null ? void 0 : i.container), this.close(), setTimeout(function () {
|
8084
|
-
return
|
8096
|
+
return _this32.addWindowEvents(e);
|
8085
8097
|
});
|
8086
8098
|
}
|
8087
8099
|
_createClass(Fi, [{
|
@@ -8109,13 +8121,13 @@ var Fi = /*#__PURE__*/function () {
|
|
8109
8121
|
}, {
|
8110
8122
|
key: "addWindowEvents",
|
8111
8123
|
value: function addWindowEvents(e) {
|
8112
|
-
var
|
8124
|
+
var _this33 = this;
|
8113
8125
|
window.addEventListener("click", function (t) {
|
8114
8126
|
var i;
|
8115
|
-
e.parentElement !== ((i = t.target.shadowRoot) == null ? void 0 : i.children[0]) &&
|
8127
|
+
e.parentElement !== ((i = t.target.shadowRoot) == null ? void 0 : i.children[0]) && _this33.close();
|
8116
8128
|
}), window.addEventListener("keydown", function (t) {
|
8117
8129
|
var i, r, s;
|
8118
|
-
|
8130
|
+
_this33._isOpen && (t.key === T.ESCAPE ? (_this33.close(), (i = _this33.highlightedItem) == null || i.dispatchEvent(new MouseEvent("mouseleave"))) : t.key === T.ENTER ? ((r = _this33.highlightedItem) == null || r.click(), (s = _this33.highlightedItem) == null || s.dispatchEvent(new MouseEvent("mouseleave"))) : t.key === T.ARROW_DOWN ? et.focusSiblingItem(_this33.highlightedItem || _this33.elementRef.children[_this33.elementRef.children.length - 1], _this33.elementRef, !0) : t.key === T.ARROW_UP && et.focusSiblingItem(_this33.highlightedItem || _this33.elementRef.children[0], _this33.elementRef, !1));
|
8119
8131
|
});
|
8120
8132
|
}
|
8121
8133
|
}], [{
|
@@ -8127,25 +8139,25 @@ var Fi = /*#__PURE__*/function () {
|
|
8127
8139
|
}]);
|
8128
8140
|
return Fi;
|
8129
8141
|
}();
|
8130
|
-
var
|
8131
|
-
_inherits(
|
8132
|
-
var _super34 = _createSuper(
|
8133
|
-
function
|
8134
|
-
var
|
8135
|
-
_classCallCheck(this,
|
8142
|
+
var ze = /*#__PURE__*/function (_ot) {
|
8143
|
+
_inherits(ze, _ot);
|
8144
|
+
var _super34 = _createSuper(ze);
|
8145
|
+
function ze(e, t) {
|
8146
|
+
var _this34;
|
8147
|
+
_classCallCheck(this, ze);
|
8136
8148
|
var r;
|
8137
|
-
|
8149
|
+
_this34 = _super34.call(this, ze.createButtonElement(), void 0, {
|
8138
8150
|
styles: (r = t == null ? void 0 : t.button) == null ? void 0 : r.styles
|
8139
8151
|
});
|
8140
|
-
var i =
|
8141
|
-
|
8142
|
-
return
|
8152
|
+
var i = _this34.createInnerElements(_this34._customStyles);
|
8153
|
+
_this34._menu = new Fi(e, t == null ? void 0 : t.menu), _this34.addClickEvent(), _this34.buttonContainer = ze.createButtonContainer(), _this34.elementRef.appendChild(i.styles), _this34.buttonContainer.appendChild(_this34.elementRef), _this34.elementRef.classList.add("dropup-icon", "upload-file-button"), _this34.buttonContainer.appendChild(_this34._menu.elementRef), _this34.reapplyStateStyle("styles"), _this34.addContainerEvents(e);
|
8154
|
+
return _this34;
|
8143
8155
|
}
|
8144
|
-
_createClass(
|
8156
|
+
_createClass(ze, [{
|
8145
8157
|
key: "createInnerElements",
|
8146
8158
|
value: function createInnerElements(e) {
|
8147
8159
|
return {
|
8148
|
-
styles: this.createInnerElement(
|
8160
|
+
styles: this.createInnerElement(ze.createSVGIconElement(), "styles", e)
|
8149
8161
|
};
|
8150
8162
|
}
|
8151
8163
|
}, {
|
@@ -8166,9 +8178,9 @@ var je = /*#__PURE__*/function (_ot) {
|
|
8166
8178
|
}, {
|
8167
8179
|
key: "addContainerEvents",
|
8168
8180
|
value: function addContainerEvents(e) {
|
8169
|
-
var
|
8181
|
+
var _this35 = this;
|
8170
8182
|
e.addEventListener("click", function (t) {
|
8171
|
-
t.target.classList.contains("dropup-icon") ||
|
8183
|
+
t.target.classList.contains("dropup-icon") || _this35._menu.close();
|
8172
8184
|
});
|
8173
8185
|
}
|
8174
8186
|
}], [{
|
@@ -8196,7 +8208,7 @@ var je = /*#__PURE__*/function (_ot) {
|
|
8196
8208
|
return (i = t == null ? void 0 : t.button) != null && i.position ? (r = t == null ? void 0 : t.button) == null ? void 0 : r.position : e["outside-left"].length > 0 && e["outside-right"].length === 0 ? "outside-right" : "outside-left";
|
8197
8209
|
}
|
8198
8210
|
}]);
|
8199
|
-
return
|
8211
|
+
return ze;
|
8200
8212
|
}(ot);
|
8201
8213
|
var N = /*#__PURE__*/function () {
|
8202
8214
|
function N() {
|
@@ -8207,7 +8219,7 @@ var N = /*#__PURE__*/function () {
|
|
8207
8219
|
value:
|
8208
8220
|
// prettier-ignore
|
8209
8221
|
function addToDropup(e, t, i, r) {
|
8210
|
-
var s = new
|
8222
|
+
var s = new ze(i, r);
|
8211
8223
|
rn.forEach(function (a) {
|
8212
8224
|
var l = t["dropup-menu"].findIndex(function (d) {
|
8213
8225
|
return d.buttonType === a;
|
@@ -8215,8 +8227,8 @@ var N = /*#__PURE__*/function () {
|
|
8215
8227
|
c = t["dropup-menu"][l];
|
8216
8228
|
c && (s.addItem(c.button), t["dropup-menu"].splice(l, 1));
|
8217
8229
|
});
|
8218
|
-
var o =
|
8219
|
-
|
8230
|
+
var o = ze.getPosition(t, r);
|
8231
|
+
Ue.addButton(e, s.buttonContainer, o), t[o].push({});
|
8220
8232
|
}
|
8221
8233
|
}, {
|
8222
8234
|
key: "addToSideContainer",
|
@@ -8224,7 +8236,7 @@ var N = /*#__PURE__*/function () {
|
|
8224
8236
|
["inside-left", "inside-right", "outside-left", "outside-right"].forEach(function (r) {
|
8225
8237
|
var s = r;
|
8226
8238
|
t[s].forEach(function (o) {
|
8227
|
-
|
8239
|
+
Ue.addButton(e, o.button.elementRef, s);
|
8228
8240
|
});
|
8229
8241
|
});
|
8230
8242
|
}
|
@@ -8301,9 +8313,13 @@ var No = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 24 24\"
|
|
8301
8313
|
}
|
8302
8314
|
};
|
8303
8315
|
var be = /*#__PURE__*/function () {
|
8304
|
-
|
8316
|
+
// prettier-ignore
|
8317
|
+
function be(e, t, i, r) {
|
8318
|
+
var _this36 = this;
|
8305
8319
|
_classCallCheck(this, be);
|
8306
|
-
this._attachments = [], this._fileCountLimit = 99, this._acceptedFormat = "",
|
8320
|
+
this._attachments = [], this._fileCountLimit = 99, this._acceptedFormat = "", t.maxNumberOfFiles && (this._fileCountLimit = t.maxNumberOfFiles), this._toggleContainerDisplay = i, this._fileAttachmentsContainerRef = r, t.acceptedFormats && (this._acceptedFormat = t.acceptedFormats), setTimeout(function () {
|
8321
|
+
_this36._validationHandler = e._validationHandler;
|
8322
|
+
});
|
8307
8323
|
}
|
8308
8324
|
_createClass(be, [{
|
8309
8325
|
key: "attemptAddFile",
|
@@ -8327,19 +8343,20 @@ var be = /*#__PURE__*/function () {
|
|
8327
8343
|
}, {
|
8328
8344
|
key: "addFileAttachment",
|
8329
8345
|
value: function addFileAttachment(e, t, i, r) {
|
8346
|
+
var a;
|
8330
8347
|
var s = be.createContainer(i);
|
8331
8348
|
if (this._attachments.length >= this._fileCountLimit) {
|
8332
|
-
var
|
8333
|
-
|
8334
|
-
var
|
8335
|
-
this._fileAttachmentsContainerRef.insertBefore(s,
|
8349
|
+
var l = this._attachments[this._attachments.length - 1].removeButton;
|
8350
|
+
l == null || l.click();
|
8351
|
+
var c = this._fileAttachmentsContainerRef.children;
|
8352
|
+
this._fileAttachmentsContainerRef.insertBefore(s, c[0]);
|
8336
8353
|
} else this._fileAttachmentsContainerRef.appendChild(s);
|
8337
8354
|
var o = {
|
8338
8355
|
file: e,
|
8339
8356
|
attachmentContainerElement: s,
|
8340
8357
|
fileType: t
|
8341
8358
|
};
|
8342
|
-
return r && (o.removeButton = this.createRemoveAttachmentButton(o), s.appendChild(o.removeButton)), this._toggleContainerDisplay(!0), this._attachments.push(o), this._fileAttachmentsContainerRef.scrollTop = this._fileAttachmentsContainerRef.scrollHeight, o;
|
8359
|
+
return r && (o.removeButton = this.createRemoveAttachmentButton(o), s.appendChild(o.removeButton)), this._toggleContainerDisplay(!0), this._attachments.push(o), this._fileAttachmentsContainerRef.scrollTop = this._fileAttachmentsContainerRef.scrollHeight, (a = this._validationHandler) == null || a.call(this), o;
|
8343
8360
|
}
|
8344
8361
|
}, {
|
8345
8362
|
key: "createRemoveAttachmentButton",
|
@@ -8352,11 +8369,12 @@ var be = /*#__PURE__*/function () {
|
|
8352
8369
|
}, {
|
8353
8370
|
key: "removeAttachment",
|
8354
8371
|
value: function removeAttachment(e) {
|
8355
|
-
var
|
8356
|
-
|
8372
|
+
var r;
|
8373
|
+
var t = this._attachments.findIndex(function (s) {
|
8374
|
+
return s === e;
|
8357
8375
|
}),
|
8358
8376
|
i = this._attachments[t].attachmentContainerElement;
|
8359
|
-
this._attachments.splice(t, 1), ki.stopAttachmentPlayback(i), i.remove(), this._toggleContainerDisplay(!1);
|
8377
|
+
this._attachments.splice(t, 1), ki.stopAttachmentPlayback(i), i.remove(), this._toggleContainerDisplay(!1), (r = this._validationHandler) == null || r.call(this);
|
8360
8378
|
}
|
8361
8379
|
}, {
|
8362
8380
|
key: "getFiles",
|
@@ -8426,19 +8444,20 @@ var zo = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
8426
8444
|
Xn = /*#__PURE__*/function (_be) {
|
8427
8445
|
_inherits(fe, _be);
|
8428
8446
|
var _super35 = _createSuper(fe);
|
8429
|
-
|
8447
|
+
// prettier-ignore
|
8448
|
+
function fe(e, t, i, r) {
|
8430
8449
|
_classCallCheck(this, fe);
|
8431
|
-
return _super35.call(this, e, t, i);
|
8450
|
+
return _super35.call(this, e, t, i, r);
|
8432
8451
|
}
|
8433
8452
|
_createClass(fe, [{
|
8434
8453
|
key: "createTimer",
|
8435
8454
|
value: function createTimer(e, t) {
|
8436
|
-
var
|
8455
|
+
var _this37 = this;
|
8437
8456
|
var i = 0;
|
8438
8457
|
var r = t !== void 0 && t < fe.TIMER_LIMIT_S ? t : fe.TIMER_LIMIT_S;
|
8439
8458
|
return setInterval(function () {
|
8440
8459
|
var a;
|
8441
|
-
i += 1, i === r && ((a =
|
8460
|
+
i += 1, i === r && ((a = _this37.stopPlaceholderCallback) == null || a.call(_this37), _this37.clearTimer()), i === 600 && e.classList.add("audio-placeholder-text-4-digits");
|
8442
8461
|
var s = Math.floor(i / 60),
|
8443
8462
|
o = (i % 60).toString().padStart(2, "0");
|
8444
8463
|
e.textContent = "".concat(s, ":").concat(o);
|
@@ -8458,7 +8477,7 @@ var zo = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
8458
8477
|
}, {
|
8459
8478
|
key: "addPlaceholderAudioAttachmentEvents",
|
8460
8479
|
value: function addPlaceholderAudioAttachmentEvents(e, t, i) {
|
8461
|
-
var
|
8480
|
+
var _this38 = this;
|
8462
8481
|
var r = function r() {
|
8463
8482
|
return e.replaceChildren(t);
|
8464
8483
|
};
|
@@ -8469,7 +8488,7 @@ var zo = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
8469
8488
|
e.addEventListener("mouseleave", s);
|
8470
8489
|
var o = function o() {
|
8471
8490
|
var a;
|
8472
|
-
return (a =
|
8491
|
+
return (a = _this38.stopPlaceholderCallback) == null ? void 0 : a.call(_this38);
|
8473
8492
|
};
|
8474
8493
|
e.addEventListener("click", o);
|
8475
8494
|
}
|
@@ -8546,8 +8565,8 @@ var Fo = /*#__PURE__*/function () {
|
|
8546
8565
|
key: "create",
|
8547
8566
|
value:
|
8548
8567
|
// prettier-ignore
|
8549
|
-
function create(e, t, i, r) {
|
8550
|
-
return
|
8568
|
+
function create(e, t, i, r, s) {
|
8569
|
+
return s === "audio" ? new ki(e, t, i, r) : new be(e, t, i, r);
|
8551
8570
|
}
|
8552
8571
|
}]);
|
8553
8572
|
return Fo;
|
@@ -8562,9 +8581,9 @@ var at = /*#__PURE__*/function () {
|
|
8562
8581
|
// prettier-ignore
|
8563
8582
|
_createClass(at, [{
|
8564
8583
|
key: "addType",
|
8565
|
-
value: function addType(e, t) {
|
8566
|
-
var
|
8567
|
-
return this._fileAttachmentsTypes.push(
|
8584
|
+
value: function addType(e, t, i) {
|
8585
|
+
var r = Fo.create(e, t, this.toggleContainerDisplay.bind(this), this.elementRef, i);
|
8586
|
+
return this._fileAttachmentsTypes.push(r), r;
|
8568
8587
|
}
|
8569
8588
|
}, {
|
8570
8589
|
key: "createAttachmentContainer",
|
@@ -8664,20 +8683,20 @@ var er = /*#__PURE__*/function () {
|
|
8664
8683
|
}, {
|
8665
8684
|
key: "addButtons",
|
8666
8685
|
value: function addButtons() {
|
8667
|
-
var
|
8686
|
+
var _this39 = this;
|
8668
8687
|
for (var _len2 = arguments.length, e = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
8669
8688
|
e[_key2] = arguments[_key2];
|
8670
8689
|
}
|
8671
8690
|
e.forEach(function (t) {
|
8672
|
-
return
|
8691
|
+
return _this39._buttonPanel.appendChild(t);
|
8673
8692
|
});
|
8674
8693
|
}
|
8675
8694
|
}, {
|
8676
8695
|
key: "close",
|
8677
8696
|
value: function close() {
|
8678
|
-
var
|
8697
|
+
var _this40 = this;
|
8679
8698
|
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 () {
|
8680
|
-
|
8699
|
+
_this40._elementRef.style.display = "none", _this40._backgroundPanelRef.style.display = "none";
|
8681
8700
|
}, X.MODAL_CLOSE_TIMEOUT_MS);
|
8682
8701
|
}
|
8683
8702
|
}, {
|
@@ -8693,10 +8712,10 @@ var er = /*#__PURE__*/function () {
|
|
8693
8712
|
}, {
|
8694
8713
|
key: "addCloseButton",
|
8695
8714
|
value: function addCloseButton(e, t, i) {
|
8696
|
-
var
|
8715
|
+
var _this41 = this;
|
8697
8716
|
var r = t ? X.createSVGButton(e) : X.createTextButton(e);
|
8698
8717
|
return this.addButtons(r), r.onclick = function () {
|
8699
|
-
|
8718
|
+
_this41.close(), setTimeout(function () {
|
8700
8719
|
i == null || i();
|
8701
8720
|
}, 140);
|
8702
8721
|
}, r;
|
@@ -8704,10 +8723,10 @@ var er = /*#__PURE__*/function () {
|
|
8704
8723
|
}, {
|
8705
8724
|
key: "addWindowEvents",
|
8706
8725
|
value: function addWindowEvents() {
|
8707
|
-
var
|
8726
|
+
var _this42 = this;
|
8708
8727
|
window.addEventListener("keydown", function (e) {
|
8709
8728
|
var t, i;
|
8710
|
-
|
8729
|
+
_this42._isOpen && (e.key === T.ESCAPE ? (_this42.close(), (t = _this42.extensionCloseCallback) == null || t.call(_this42)) : e.key === T.ENTER && (_this42.close(), (i = _this42.extensionCloseCallback) == null || i.call(_this42)));
|
8711
8730
|
});
|
8712
8731
|
}
|
8713
8732
|
}], [{
|
@@ -8762,24 +8781,24 @@ var er = /*#__PURE__*/function () {
|
|
8762
8781
|
return X;
|
8763
8782
|
}();
|
8764
8783
|
er.MODAL_CLOSE_TIMEOUT_MS = 190;
|
8765
|
-
var
|
8766
|
-
var
|
8767
|
-
_inherits(
|
8768
|
-
var _super36 = _createSuper(
|
8784
|
+
var Ke = er;
|
8785
|
+
var Ye = /*#__PURE__*/function (_ot2) {
|
8786
|
+
_inherits(Ye, _ot2);
|
8787
|
+
var _super36 = _createSuper(Ye);
|
8769
8788
|
// prettier-ignore
|
8770
|
-
function
|
8771
|
-
var
|
8772
|
-
_classCallCheck(this,
|
8789
|
+
function Ye(e, t, i, r, s, o) {
|
8790
|
+
var _this43;
|
8791
|
+
_classCallCheck(this, Ye);
|
8773
8792
|
var l, c, d, u, p, h;
|
8774
|
-
|
8775
|
-
var a =
|
8776
|
-
|
8777
|
-
return
|
8793
|
+
_this43 = _super36.call(this, Ye.createButtonElement(), (l = i.button) == null ? void 0 : l.position, i.button, o);
|
8794
|
+
var a = _this43.createInnerElements(r, s, _this43._customStyles);
|
8795
|
+
_this43._inputElement = Ye.createInputElement((c = i == null ? void 0 : i.files) == null ? void 0 : c.acceptedFormats), _this43.addClickEvent(e, i), _this43.elementRef.replaceChildren(a.styles), _this43.reapplyStateStyle("styles"), _this43._fileAttachmentsType = t, _this43._openModalOnce = ((u = (d = i.files) == null ? void 0 : d.infoModal) == null ? void 0 : u.openModalOnce) === !1 || (h = (p = i.files) == null ? void 0 : p.infoModal) == null ? void 0 : h.openModalOnce;
|
8796
|
+
return _this43;
|
8778
8797
|
}
|
8779
|
-
_createClass(
|
8798
|
+
_createClass(Ye, [{
|
8780
8799
|
key: "createInnerElements",
|
8781
8800
|
value: function createInnerElements(e, t, i) {
|
8782
|
-
var r =
|
8801
|
+
var r = Ye.createSVGIconElement(e, t);
|
8783
8802
|
return {
|
8784
8803
|
styles: this.createInnerElement(r, "styles", i)
|
8785
8804
|
};
|
@@ -8803,7 +8822,7 @@ var Je = /*#__PURE__*/function (_ot2) {
|
|
8803
8822
|
key: "addClickEvent",
|
8804
8823
|
value: function addClickEvent(e, t) {
|
8805
8824
|
var i = this.triggerImportPrompt.bind(this, this._inputElement),
|
8806
|
-
r =
|
8825
|
+
r = Ke.createTextModalFunc(e, t, i);
|
8807
8826
|
this.elementRef.onclick = this.click.bind(this, r);
|
8808
8827
|
}
|
8809
8828
|
}, {
|
@@ -8830,7 +8849,7 @@ var Je = /*#__PURE__*/function (_ot2) {
|
|
8830
8849
|
return i.id = e, i;
|
8831
8850
|
}
|
8832
8851
|
}]);
|
8833
|
-
return
|
8852
|
+
return Ye;
|
8834
8853
|
}(ot);
|
8835
8854
|
var ee = /*#__PURE__*/function () {
|
8836
8855
|
function ee() {
|
@@ -8891,10 +8910,10 @@ var tt = /*#__PURE__*/function (_ot3) {
|
|
8891
8910
|
_inherits(tt, _ot3);
|
8892
8911
|
var _super37 = _createSuper(tt);
|
8893
8912
|
function tt(e) {
|
8894
|
-
var
|
8913
|
+
var _this44;
|
8895
8914
|
_classCallCheck(this, tt);
|
8896
|
-
(e == null ? void 0 : e.position) === "dropup-menu" && (e.position = "outside-right"),
|
8897
|
-
return
|
8915
|
+
(e == null ? void 0 : e.position) === "dropup-menu" && (e.position = "outside-right"), _this44 = _super37.call(this, tt.createMicrophoneElement(), e == null ? void 0 : e.position, e), _this44.isActive = !1, _this44._innerElements = _this44.createInnerElements(_this44._customStyles), _this44.changeToDefault();
|
8916
|
+
return _this44;
|
8898
8917
|
}
|
8899
8918
|
_createClass(tt, [{
|
8900
8919
|
key: "createInnerElements",
|
@@ -9069,17 +9088,17 @@ var Ho = /*#__PURE__*/function () {
|
|
9069
9088
|
return Ho;
|
9070
9089
|
}();
|
9071
9090
|
Wt.WebSpeechTranscript = Ho;
|
9072
|
-
var
|
9073
|
-
Object.defineProperty(
|
9091
|
+
var qe = {};
|
9092
|
+
Object.defineProperty(qe, "__esModule", {
|
9074
9093
|
value: !0
|
9075
9094
|
});
|
9076
|
-
|
9077
|
-
var
|
9078
|
-
_classCallCheck(this,
|
9095
|
+
qe.Browser = void 0;
|
9096
|
+
var We = /*#__PURE__*/_createClass(function We() {
|
9097
|
+
_classCallCheck(this, We);
|
9079
9098
|
});
|
9080
|
-
|
9081
|
-
|
9082
|
-
return
|
9099
|
+
qe.Browser = We;
|
9100
|
+
We.IS_SAFARI = function () {
|
9101
|
+
return We._IS_SAFARI === void 0 && (We._IS_SAFARI = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)), We._IS_SAFARI;
|
9083
9102
|
};
|
9084
9103
|
var ct = {},
|
9085
9104
|
Jt = {};
|
@@ -9101,9 +9120,9 @@ var V = /*#__PURE__*/function () {
|
|
9101
9120
|
}, {
|
9102
9121
|
key: "keyDownWindow",
|
9103
9122
|
value: function keyDownWindow(e) {
|
9104
|
-
var
|
9123
|
+
var _this45 = this;
|
9105
9124
|
e.element && V.getElementIfFocusedOnAvailable(e.element, document.activeElement) && (V.KEY_DOWN_TIMEOUT !== null && clearTimeout(V.KEY_DOWN_TIMEOUT), V.KEY_DOWN_TIMEOUT = setTimeout(function () {
|
9106
|
-
V.KEY_DOWN_TIMEOUT = null,
|
9125
|
+
V.KEY_DOWN_TIMEOUT = null, _this45.resetRecording(e);
|
9107
9126
|
}, 500));
|
9108
9127
|
}
|
9109
9128
|
}, {
|
@@ -9254,11 +9273,11 @@ Object.defineProperty(ke, "__esModule", {
|
|
9254
9273
|
value: !0
|
9255
9274
|
});
|
9256
9275
|
ke.Cursor = void 0;
|
9257
|
-
var
|
9258
|
-
function
|
9259
|
-
_classCallCheck(this,
|
9276
|
+
var $e = /*#__PURE__*/function () {
|
9277
|
+
function $e() {
|
9278
|
+
_classCallCheck(this, $e);
|
9260
9279
|
}
|
9261
|
-
_createClass(
|
9280
|
+
_createClass($e, null, [{
|
9262
9281
|
key: "setOffsetForGeneric",
|
9263
9282
|
value: function setOffsetForGeneric(e, t) {
|
9264
9283
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
@@ -9266,7 +9285,7 @@ var Ye = /*#__PURE__*/function () {
|
|
9266
9285
|
for (var s = 0; s < e.childNodes.length; s += 1) {
|
9267
9286
|
var o = e.childNodes[s];
|
9268
9287
|
if (o.childNodes.length > 0) {
|
9269
|
-
var a =
|
9288
|
+
var a = $e.setOffsetForGeneric(o, t, i);
|
9270
9289
|
if (a === -1) return -1;
|
9271
9290
|
i += a;
|
9272
9291
|
} else if (o.textContent !== null) {
|
@@ -9294,8 +9313,8 @@ var Ye = /*#__PURE__*/function () {
|
|
9294
9313
|
value: function setOffsetForSafariGeneric(e, t) {
|
9295
9314
|
var i = window.getSelection();
|
9296
9315
|
if (i) {
|
9297
|
-
var r =
|
9298
|
-
console.log(r), setTimeout(function () {}, 100),
|
9316
|
+
var r = $e.getGenericElementCursorOffset(e, i, !0);
|
9317
|
+
console.log(r), setTimeout(function () {}, 100), $e.setOffsetForGeneric(e, r + t);
|
9299
9318
|
}
|
9300
9319
|
}
|
9301
9320
|
// set to automatically scroll to cursor (scroll does not work in Safari)
|
@@ -9333,16 +9352,16 @@ var Ye = /*#__PURE__*/function () {
|
|
9333
9352
|
return r;
|
9334
9353
|
}
|
9335
9354
|
}]);
|
9336
|
-
return
|
9355
|
+
return $e;
|
9337
9356
|
}();
|
9338
|
-
ke.Cursor =
|
9357
|
+
ke.Cursor = $e;
|
9339
9358
|
Object.defineProperty(dt, "__esModule", {
|
9340
9359
|
value: !0
|
9341
9360
|
});
|
9342
9361
|
dt.CommandUtils = void 0;
|
9343
9362
|
var an = ut,
|
9344
9363
|
Ko = Me,
|
9345
|
-
Wo =
|
9364
|
+
Wo = qe,
|
9346
9365
|
ln = ke,
|
9347
9366
|
cn = _e;
|
9348
9367
|
var G = /*#__PURE__*/function () {
|
@@ -9447,7 +9466,7 @@ Object.defineProperty($t, "__esModule", {
|
|
9447
9466
|
});
|
9448
9467
|
$t.Highlight = void 0;
|
9449
9468
|
var Jo = Me,
|
9450
|
-
|
9469
|
+
He = ke;
|
9451
9470
|
var Rt = /*#__PURE__*/function () {
|
9452
9471
|
function Rt() {
|
9453
9472
|
_classCallCheck(this, Rt);
|
@@ -9463,8 +9482,8 @@ var Rt = /*#__PURE__*/function () {
|
|
9463
9482
|
value: function setStateForGeneric(e, t) {
|
9464
9483
|
var i = window.getSelection();
|
9465
9484
|
if (i != null && i.focusNode) {
|
9466
|
-
var r =
|
9467
|
-
s =
|
9485
|
+
var r = He.Cursor.getGenericElementCursorOffset(t, i, !0),
|
9486
|
+
s = He.Cursor.getGenericElementCursorOffset(t, i, !1);
|
9468
9487
|
e.isHighlighted = r !== s;
|
9469
9488
|
}
|
9470
9489
|
}
|
@@ -9478,8 +9497,8 @@ var Rt = /*#__PURE__*/function () {
|
|
9478
9497
|
value: function removeForGeneric(e, t) {
|
9479
9498
|
var i = window.getSelection();
|
9480
9499
|
if (i) {
|
9481
|
-
var r =
|
9482
|
-
i.deleteFromDocument(),
|
9500
|
+
var r = He.Cursor.getGenericElementCursorOffset(t, i, !0);
|
9501
|
+
i.deleteFromDocument(), He.Cursor.setOffsetForGeneric(t, r), e.isHighlighted = !1;
|
9483
9502
|
}
|
9484
9503
|
}
|
9485
9504
|
}, {
|
@@ -9490,7 +9509,7 @@ var Rt = /*#__PURE__*/function () {
|
|
9490
9509
|
s = t.value;
|
9491
9510
|
if (i && r) {
|
9492
9511
|
var o = s.substring(0, i) + s.substring(r);
|
9493
|
-
t.value = o,
|
9512
|
+
t.value = o, He.Cursor.setOffsetForPrimitive(t, i, e.autoScroll);
|
9494
9513
|
}
|
9495
9514
|
e.isHighlighted = !1;
|
9496
9515
|
}
|
@@ -9576,7 +9595,7 @@ var un = Jt,
|
|
9576
9595
|
ui = $t,
|
9577
9596
|
Z = Me,
|
9578
9597
|
hi = Zt,
|
9579
|
-
pn =
|
9598
|
+
pn = qe,
|
9580
9599
|
fn = ke,
|
9581
9600
|
pi = _e;
|
9582
9601
|
var Zo = /*#__PURE__*/function () {
|
@@ -9694,7 +9713,7 @@ Object.defineProperty(Kt, "__esModule", {
|
|
9694
9713
|
});
|
9695
9714
|
Kt.WebSpeech = void 0;
|
9696
9715
|
var mn = Wt,
|
9697
|
-
gn =
|
9716
|
+
gn = qe,
|
9698
9717
|
Qo = ct;
|
9699
9718
|
var Ot = /*#__PURE__*/function (_Qo$Speech) {
|
9700
9719
|
_inherits(Ot, _Qo$Speech);
|
@@ -9724,22 +9743,22 @@ var Ot = /*#__PURE__*/function (_Qo$Speech) {
|
|
9724
9743
|
}, {
|
9725
9744
|
key: "setEvents",
|
9726
9745
|
value: function setEvents() {
|
9727
|
-
var
|
9746
|
+
var _this46 = this;
|
9728
9747
|
this._service && (this._service.onstart = function () {
|
9729
|
-
|
9748
|
+
_this46.setStateOnStart();
|
9730
9749
|
}, this._service.onerror = function (e) {
|
9731
|
-
gn.Browser.IS_SAFARI() && e.message === "Another request is started" || e.error === "aborted" &&
|
9750
|
+
gn.Browser.IS_SAFARI() && e.message === "Another request is started" || e.error === "aborted" && _this46.isRestarting || e.error !== "no-speech" && _this46.error(e.message || e.error);
|
9732
9751
|
}, this._service.onaudioend = function () {
|
9733
|
-
|
9752
|
+
_this46.setStateOnStop();
|
9734
9753
|
}, this._service.onend = function () {
|
9735
|
-
|
9754
|
+
_this46._stopping = !1;
|
9736
9755
|
}, this._service.onresult = function (e) {
|
9737
|
-
if (_typeof(e.results) > "u" &&
|
9738
|
-
var
|
9739
|
-
t =
|
9740
|
-
i =
|
9741
|
-
r =
|
9742
|
-
|
9756
|
+
if (_typeof(e.results) > "u" && _this46._service) _this46._service.onend = null, _this46._service.stop();else if (_this46._extractText && !_this46._stopping) {
|
9757
|
+
var _this46$_extractText = _this46._extractText(e, _this46.finalTranscript, _this46._translations),
|
9758
|
+
t = _this46$_extractText.interimTranscript,
|
9759
|
+
i = _this46$_extractText.finalTranscript,
|
9760
|
+
r = _this46$_extractText.newText;
|
9761
|
+
_this46.updateElements(t, i, r);
|
9743
9762
|
}
|
9744
9763
|
});
|
9745
9764
|
}
|
@@ -9768,22 +9787,22 @@ Object.defineProperty(Qt, "__esModule", {
|
|
9768
9787
|
value: !0
|
9769
9788
|
});
|
9770
9789
|
Qt.GlobalState = void 0;
|
9771
|
-
var
|
9772
|
-
function
|
9773
|
-
_classCallCheck(this,
|
9790
|
+
var Fe = /*#__PURE__*/function () {
|
9791
|
+
function Fe() {
|
9792
|
+
_classCallCheck(this, Fe);
|
9774
9793
|
}
|
9775
|
-
_createClass(
|
9794
|
+
_createClass(Fe, null, [{
|
9776
9795
|
key: "doubleClickDetector",
|
9777
9796
|
value: function doubleClickDetector() {
|
9778
|
-
return
|
9779
|
-
|
9797
|
+
return Fe.doubleClickPending ? !0 : (Fe.doubleClickPending = !0, setTimeout(function () {
|
9798
|
+
Fe.doubleClickPending = !1;
|
9780
9799
|
}, 300), !1);
|
9781
9800
|
}
|
9782
9801
|
}]);
|
9783
|
-
return
|
9802
|
+
return Fe;
|
9784
9803
|
}();
|
9785
|
-
Qt.GlobalState =
|
9786
|
-
|
9804
|
+
Qt.GlobalState = Fe;
|
9805
|
+
Fe.doubleClickPending = !1;
|
9787
9806
|
var Xt = {},
|
9788
9807
|
ei = {};
|
9789
9808
|
Object.defineProperty(ei, "__esModule", {
|
@@ -9959,10 +9978,10 @@ var Dt = /*#__PURE__*/function (_ia$Speech) {
|
|
9959
9978
|
_inherits(Dt, _ia$Speech);
|
9960
9979
|
var _super39 = _createSuper(Dt);
|
9961
9980
|
function Dt() {
|
9962
|
-
var
|
9981
|
+
var _this47;
|
9963
9982
|
_classCallCheck(this, Dt);
|
9964
|
-
|
9965
|
-
return
|
9983
|
+
_this47 = _super39.apply(this, arguments), _this47._newTextPadding = "";
|
9984
|
+
return _this47;
|
9966
9985
|
}
|
9967
9986
|
_createClass(Dt, [{
|
9968
9987
|
key: "start",
|
@@ -10090,12 +10109,12 @@ var Dt = /*#__PURE__*/function (_ia$Speech) {
|
|
10090
10109
|
}, {
|
10091
10110
|
key: "retrieveTokenInterval",
|
10092
10111
|
value: function retrieveTokenInterval(e) {
|
10093
|
-
var
|
10112
|
+
var _this48 = this;
|
10094
10113
|
this._retrieveTokenInterval = setInterval(function () {
|
10095
10114
|
e == null || e().then(function (t) {
|
10096
|
-
|
10115
|
+
_this48._service && (_this48._service.authorizationToken = (t == null ? void 0 : t.trim()) || "");
|
10097
10116
|
})["catch"](function (t) {
|
10098
|
-
|
10117
|
+
_this48.error(t);
|
10099
10118
|
});
|
10100
10119
|
}, 1e4);
|
10101
10120
|
}
|
@@ -10177,18 +10196,18 @@ var jt = /*#__PURE__*/function (_tt) {
|
|
10177
10196
|
_inherits(jt, _tt);
|
10178
10197
|
var _super40 = _createSuper(jt);
|
10179
10198
|
function jt(e, t, i) {
|
10180
|
-
var
|
10199
|
+
var _this49;
|
10181
10200
|
_classCallCheck(this, jt);
|
10182
10201
|
var o;
|
10183
|
-
|
10202
|
+
_this49 = _super40.call(this, _typeof(e.speechToText) == "object" ? (o = e.speechToText) == null ? void 0 : o.button : {});
|
10184
10203
|
var _jt$processConfigurat = jt.processConfiguration(t, e.speechToText),
|
10185
10204
|
r = _jt$processConfigurat.serviceName,
|
10186
10205
|
s = _jt$processConfigurat.processedConfig;
|
10187
|
-
if (
|
10206
|
+
if (_this49._addErrorMessage = i, r === "webspeech" && !gi.isWebSpeechSupported()) _this49.changeToUnsupported();else {
|
10188
10207
|
var a = !e.textInput || !e.textInput.disabled;
|
10189
|
-
|
10208
|
+
_this49.elementRef.onclick = _this49.buttonClick.bind(_assertThisInitialized(_this49), t, a, r, s);
|
10190
10209
|
}
|
10191
|
-
return
|
10210
|
+
return _this49;
|
10192
10211
|
}
|
10193
10212
|
// prettier-ignore
|
10194
10213
|
_createClass(jt, [{
|
@@ -10269,11 +10288,11 @@ var sa = /*#__PURE__*/function (_tt2) {
|
|
10269
10288
|
_inherits(sa, _tt2);
|
10270
10289
|
var _super41 = _createSuper(sa);
|
10271
10290
|
function sa(e, t) {
|
10272
|
-
var
|
10291
|
+
var _this50;
|
10273
10292
|
_classCallCheck(this, sa);
|
10274
10293
|
var i, r;
|
10275
|
-
|
10276
|
-
return
|
10294
|
+
_this50 = _super41.call(this, t.button), _this50._waitingForBrowserApproval = !1, _this50._audioType = e, _this50._extension = ((i = t.files) == null ? void 0 : i.format) || "mp3", _this50._maxDurationSeconds = (r = t.files) == null ? void 0 : r.maxDurationSeconds, _this50.elementRef.onclick = _this50.buttonClick.bind(_assertThisInitialized(_this50));
|
10295
|
+
return _this50;
|
10277
10296
|
}
|
10278
10297
|
_createClass(sa, [{
|
10279
10298
|
key: "buttonClick",
|
@@ -10283,10 +10302,10 @@ var sa = /*#__PURE__*/function (_tt2) {
|
|
10283
10302
|
}, {
|
10284
10303
|
key: "stop",
|
10285
10304
|
value: function stop() {
|
10286
|
-
var
|
10305
|
+
var _this51 = this;
|
10287
10306
|
return new Promise(function (e) {
|
10288
10307
|
var t, i;
|
10289
|
-
|
10308
|
+
_this51.changeToDefault(), (t = _this51._mediaRecorder) == null || t.stop(), (i = _this51._mediaStream) == null || i.getTracks().forEach(function (r) {
|
10290
10309
|
return r.stop();
|
10291
10310
|
}), setTimeout(function () {
|
10292
10311
|
e();
|
@@ -10296,23 +10315,23 @@ var sa = /*#__PURE__*/function (_tt2) {
|
|
10296
10315
|
}, {
|
10297
10316
|
key: "record",
|
10298
10317
|
value: function record() {
|
10299
|
-
var
|
10318
|
+
var _this52 = this;
|
10300
10319
|
navigator.mediaDevices.getUserMedia({
|
10301
10320
|
audio: !0
|
10302
10321
|
}).then(function (e) {
|
10303
|
-
|
10304
|
-
|
10305
|
-
}),
|
10322
|
+
_this52.changeToActive(), _this52._mediaRecorder = new MediaRecorder(e), _this52._audioType.addPlaceholderAttachment(_this52.stop.bind(_this52), _this52._maxDurationSeconds), _this52._mediaStream = e, _this52._mediaRecorder.addEventListener("dataavailable", function (t) {
|
10323
|
+
_this52.createFile(t);
|
10324
|
+
}), _this52._mediaRecorder.start();
|
10306
10325
|
})["catch"](function (e) {
|
10307
|
-
console.error(e),
|
10326
|
+
console.error(e), _this52.stop();
|
10308
10327
|
})["finally"](function () {
|
10309
|
-
|
10328
|
+
_this52._waitingForBrowserApproval = !1;
|
10310
10329
|
});
|
10311
10330
|
}
|
10312
10331
|
}, {
|
10313
10332
|
key: "createFile",
|
10314
10333
|
value: function createFile(e) {
|
10315
|
-
var
|
10334
|
+
var _this53 = this;
|
10316
10335
|
var t = new Blob([e.data], {
|
10317
10336
|
type: "audio/".concat(this._extension)
|
10318
10337
|
}),
|
@@ -10322,7 +10341,7 @@ var sa = /*#__PURE__*/function (_tt2) {
|
|
10322
10341
|
}),
|
10323
10342
|
s = new FileReader();
|
10324
10343
|
s.readAsDataURL(r), s.onload = function (o) {
|
10325
|
-
|
10344
|
+
_this53._audioType.completePlaceholderAttachment(r, o.target.result);
|
10326
10345
|
};
|
10327
10346
|
}
|
10328
10347
|
}]);
|
@@ -10367,13 +10386,16 @@ var Pe = /*#__PURE__*/function (_ot4) {
|
|
10367
10386
|
var _super42 = _createSuper(Pe);
|
10368
10387
|
// prettier-ignore
|
10369
10388
|
function Pe(e, t, i, r, s) {
|
10370
|
-
var
|
10389
|
+
var _this54;
|
10371
10390
|
_classCallCheck(this, Pe);
|
10372
10391
|
var o;
|
10373
|
-
En.prepare(e),
|
10392
|
+
En.prepare(e), _this54 = _super42.call(this, Pe.createButtonContainerElement(), (o = e.submitButtonStyles) == null ? void 0 : o.position, e.submitButtonStyles), _this54._isRequestInProgress = !1, _this54._isLoadingActive = !1, _this54._isSVGLoadingIconOverriden = !1, _this54._messages = i, _this54._inputElementRef = t, _this54._fileAttachments = s, _this54._innerElements = _this54.createInnerElements(), _this54._abortStream = new AbortController(), _this54._stopClicked = {
|
10374
10393
|
listener: function listener() {}
|
10375
|
-
},
|
10376
|
-
|
10394
|
+
}, _this54._serviceIO = r, _this54.attemptOverwriteLoadingStyle(e), setTimeout(function () {
|
10395
|
+
var a;
|
10396
|
+
_this54._validationHandler = e._validationHandler, _this54.assignHandlers(_this54._validationHandler), (a = _this54._validationHandler) == null || a.call(_assertThisInitialized(_this54));
|
10397
|
+
});
|
10398
|
+
return _this54;
|
10377
10399
|
}
|
10378
10400
|
// prettier-ignore
|
10379
10401
|
_createClass(Pe, [{
|
@@ -10394,7 +10416,7 @@ var Pe = /*#__PURE__*/function (_ot4) {
|
|
10394
10416
|
}, {
|
10395
10417
|
key: "createDisabledIconElement",
|
10396
10418
|
value: function createDisabledIconElement(e) {
|
10397
|
-
return R.
|
10419
|
+
return R.createCustomElement("disabled", this._customStyles) || e.cloneNode(!0);
|
10398
10420
|
}
|
10399
10421
|
// prettier-ignore
|
10400
10422
|
}, {
|
@@ -10408,17 +10430,17 @@ var Pe = /*#__PURE__*/function (_ot4) {
|
|
10408
10430
|
}
|
10409
10431
|
}, {
|
10410
10432
|
key: "assignHandlers",
|
10411
|
-
value: function assignHandlers() {
|
10433
|
+
value: function assignHandlers(e) {
|
10412
10434
|
this._serviceIO.completionsHandlers = {
|
10413
|
-
onFinish:
|
10435
|
+
onFinish: e.bind(this)
|
10414
10436
|
}, this._serviceIO.streamHandlers = {
|
10415
10437
|
onOpen: this.changeToStopIcon.bind(this),
|
10416
|
-
onClose:
|
10438
|
+
onClose: e.bind(this),
|
10417
10439
|
abortStream: this._abortStream,
|
10418
10440
|
stopClicked: this._stopClicked
|
10419
10441
|
};
|
10420
|
-
var
|
10421
|
-
_typeof(
|
10442
|
+
var t = this._serviceIO.deepChat.stream;
|
10443
|
+
_typeof(t) == "object" && typeof t.simulation == "number" && (this._serviceIO.streamHandlers.simulationInterim = t.simulation);
|
10422
10444
|
}
|
10423
10445
|
}, {
|
10424
10446
|
key: "submitFromInput",
|
@@ -10441,60 +10463,54 @@ var Pe = /*#__PURE__*/function (_ot4) {
|
|
10441
10463
|
return _regeneratorRuntime().wrap(function _callee74$(_context74) {
|
10442
10464
|
while (1) switch (_context74.prev = _context74.next) {
|
10443
10465
|
case 0:
|
10466
|
+
console.log("call");
|
10444
10467
|
_context74.t0 = e;
|
10445
10468
|
if (_context74.t0) {
|
10446
|
-
_context74.next =
|
10469
|
+
_context74.next = 7;
|
10447
10470
|
break;
|
10448
10471
|
}
|
10449
|
-
_context74.next =
|
10472
|
+
_context74.next = 5;
|
10450
10473
|
return this._fileAttachments.completePlaceholders();
|
10451
|
-
case
|
10474
|
+
case 5:
|
10452
10475
|
i = this._fileAttachments.getAllFileData();
|
10453
10476
|
r = i == null ? void 0 : i.map(function (c) {
|
10454
10477
|
return c.file;
|
10455
10478
|
});
|
10456
|
-
case
|
10479
|
+
case 7:
|
10457
10480
|
s = t === "" ? void 0 : t;
|
10458
|
-
|
10459
|
-
|
10460
|
-
|
10461
|
-
}
|
10462
|
-
return _context74.abrupt("return");
|
10463
|
-
case 9:
|
10464
|
-
if (!((a = this._serviceIO.deepChat) != null && a.validateMessageBeforeSending)) {
|
10465
|
-
_context74.next = 14;
|
10481
|
+
_context74.t1 = this._isRequestInProgress || !K.canSendMessage(this._serviceIO.websocket);
|
10482
|
+
if (_context74.t1) {
|
10483
|
+
_context74.next = 15;
|
10466
10484
|
break;
|
10467
10485
|
}
|
10468
|
-
|
10469
|
-
|
10470
|
-
break;
|
10471
|
-
}
|
10472
|
-
return _context74.abrupt("return");
|
10486
|
+
_context74.next = 12;
|
10487
|
+
return (a = this._validationHandler) == null ? void 0 : a.call(this, e);
|
10473
10488
|
case 12:
|
10474
|
-
_context74.
|
10475
|
-
|
10476
|
-
|
10477
|
-
|
10478
|
-
|
10489
|
+
_context74.t2 = _context74.sent;
|
10490
|
+
_context74.t3 = !1;
|
10491
|
+
_context74.t1 = _context74.t2 === _context74.t3;
|
10492
|
+
case 15:
|
10493
|
+
if (!_context74.t1) {
|
10494
|
+
_context74.next = 17;
|
10479
10495
|
break;
|
10480
10496
|
}
|
10481
10497
|
return _context74.abrupt("return");
|
10482
|
-
case
|
10498
|
+
case 17:
|
10483
10499
|
this.changeToLoadingIcon();
|
10484
|
-
_context74.next =
|
10500
|
+
_context74.next = 20;
|
10485
10501
|
return this.addNewMessages(t, i);
|
10486
|
-
case
|
10502
|
+
case 20:
|
10487
10503
|
this._messages.addLoadingMessage();
|
10488
|
-
e ||
|
10504
|
+
e || Ti.clear(this._inputElementRef);
|
10489
10505
|
o = {
|
10490
10506
|
text: s,
|
10491
10507
|
files: r
|
10492
10508
|
};
|
10493
|
-
_context74.next =
|
10509
|
+
_context74.next = 25;
|
10494
10510
|
return this._serviceIO.callAPI(o, this._messages);
|
10495
|
-
case 24:
|
10496
|
-
e || (l = this._fileAttachments) == null || l.removeAllFiles();
|
10497
10511
|
case 25:
|
10512
|
+
e || (l = this._fileAttachments) == null || l.removeAllFiles();
|
10513
|
+
case 26:
|
10498
10514
|
case "end":
|
10499
10515
|
return _context74.stop();
|
10500
10516
|
}
|
@@ -10559,12 +10575,11 @@ var Pe = /*#__PURE__*/function (_ot4) {
|
|
10559
10575
|
value: function changeToSubmitIcon() {
|
10560
10576
|
this.elementRef.classList.remove("loading-button"), this.elementRef.replaceChildren(this._innerElements.submit), En.resetSubmit(this, this._isLoadingActive), this.elementRef.onclick = this.submitFromInput.bind(this), this._isRequestInProgress = !1, this._isLoadingActive = !1;
|
10561
10577
|
}
|
10562
|
-
|
10563
|
-
|
10564
|
-
|
10565
|
-
|
10566
|
-
|
10567
|
-
// }
|
10578
|
+
}, {
|
10579
|
+
key: "changeToDisabledIcon",
|
10580
|
+
value: function changeToDisabledIcon() {
|
10581
|
+
(this._isRequestInProgress || this._isLoadingActive) && this.changeToSubmitIcon(), this.elementRef.replaceChildren(this._innerElements.disabled), this.reapplyStateStyle("disabled", ["submit"]), this.elementRef.onclick = function () {};
|
10582
|
+
}
|
10568
10583
|
}], [{
|
10569
10584
|
key: "createButtonContainerElement",
|
10570
10585
|
value: function createButtonContainerElement() {
|
@@ -10596,28 +10611,28 @@ var aa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
10596
10611
|
la = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <title>capture</title>\n <path d=\"M0 16q0 3.264 1.28 6.208t3.392 5.12 5.12 3.424 6.208 1.248 6.208-1.248 5.12-3.424 3.392-5.12 1.28-6.208-1.28-6.208-3.392-5.12-5.088-3.392-6.24-1.28q-3.264 0-6.208 1.28t-5.12 3.392-3.392 5.12-1.28 6.208zM4 16q0-3.264 1.6-6.016t4.384-4.352 6.016-1.632 6.016 1.632 4.384 4.352 1.6 6.016-1.6 6.048-4.384 4.352-6.016 1.6-6.016-1.6-4.384-4.352-1.6-6.048z\"></path>\n</svg>\n",
|
10597
10612
|
ca = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 1024 1024\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M195.2 195.2a64 64 0 0 1 90.496 0L512 421.504 738.304 195.2a64 64 0 0 1 90.496 90.496L602.496 512 828.8 738.304a64 64 0 0 1-90.496 90.496L512 602.496 285.696 828.8a64 64 0 0 1-90.496-90.496L421.504 512 195.2 285.696a64 64 0 0 1 0-90.496z\"/>\n</svg>",
|
10598
10613
|
da = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M4.89163 13.2687L9.16582 17.5427L18.7085 8\" stroke=\"#000000\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>";
|
10599
|
-
var Ui = /*#__PURE__*/function (
|
10600
|
-
_inherits(Ui,
|
10614
|
+
var Ui = /*#__PURE__*/function (_Ke) {
|
10615
|
+
_inherits(Ui, _Ke);
|
10601
10616
|
var _super43 = _createSuper(Ui);
|
10602
10617
|
// prettier-ignore
|
10603
10618
|
function Ui(e, t, i, r) {
|
10604
|
-
var
|
10619
|
+
var _this55;
|
10605
10620
|
_classCallCheck(this, Ui);
|
10606
|
-
|
10607
|
-
var
|
10608
|
-
s =
|
10609
|
-
o =
|
10610
|
-
|
10611
|
-
return
|
10621
|
+
_this55 = _super43.call(this, e, ["modal-content", "modal-camera-content"], i), _this55._stopped = !1, _this55._format = "image/png", _this55._canvas = document.createElement("canvas"), _this55._canvas.classList.add("camera-modal-canvas");
|
10622
|
+
var _this55$addButtonsAnd = _this55.addButtonsAndTheirEvents(t),
|
10623
|
+
s = _this55$addButtonsAnd.captureButton,
|
10624
|
+
o = _this55$addButtonsAnd.submitButton;
|
10625
|
+
_this55._captureButton = s, _this55._submitButton = o, _this55._captureIcon = _this55._captureButton.children[0], _this55._refreshIcon = F.createSVGElement(aa), _this55._refreshIcon.classList.add("modal-svg-button-icon", "modal-svg-refresh-icon"), (r == null ? void 0 : r.format) === "jpeg" && (_this55._format = "image/jpeg"), r != null && r.dimensions && (_this55._dimensions = r.dimensions), _this55._contentRef.appendChild(_this55._canvas), _this55.extensionCloseCallback = _this55.stop;
|
10626
|
+
return _this55;
|
10612
10627
|
}
|
10613
10628
|
_createClass(Ui, [{
|
10614
10629
|
key: "addButtonsAndTheirEvents",
|
10615
10630
|
value: function addButtonsAndTheirEvents(e) {
|
10616
|
-
var t =
|
10631
|
+
var t = Ke.createSVGButton(la);
|
10617
10632
|
t.classList.add("modal-svg-camera-button"), t.children[0].classList.add("modal-svg-camera-icon");
|
10618
10633
|
var i = this.addCloseButton(ca, !0);
|
10619
10634
|
i.classList.add("modal-svg-close-button"), i.children[0].classList.add("modal-svg-close-icon");
|
10620
|
-
var r =
|
10635
|
+
var r = Ke.createSVGButton(da);
|
10621
10636
|
return r.classList.add("modal-svg-submit-button"), this.addButtons(t, r), this.addButtonEvents(t, i, r, e), {
|
10622
10637
|
captureButton: t,
|
10623
10638
|
submitButton: r
|
@@ -10627,38 +10642,38 @@ var Ui = /*#__PURE__*/function (_Ve) {
|
|
10627
10642
|
}, {
|
10628
10643
|
key: "addButtonEvents",
|
10629
10644
|
value: function addButtonEvents(e, t, i, r) {
|
10630
|
-
var
|
10645
|
+
var _this56 = this;
|
10631
10646
|
e.onclick = function () {
|
10632
|
-
|
10647
|
+
_this56.capture();
|
10633
10648
|
}, t.addEventListener("click", this.stop.bind(this)), i.onclick = function () {
|
10634
|
-
var s =
|
10635
|
-
s && at.addFilesToType([s], [r]),
|
10649
|
+
var s = _this56.getFile();
|
10650
|
+
s && at.addFilesToType([s], [r]), _this56.stop(), _this56.close();
|
10636
10651
|
};
|
10637
10652
|
}
|
10638
10653
|
}, {
|
10639
10654
|
key: "stop",
|
10640
10655
|
value: function stop() {
|
10641
|
-
var
|
10656
|
+
var _this57 = this;
|
10642
10657
|
this._mediaStream && this._mediaStream.getTracks().forEach(function (e) {
|
10643
10658
|
return e.stop();
|
10644
10659
|
}), this._stopped = !0, setTimeout(function () {
|
10645
|
-
|
10646
|
-
var e =
|
10647
|
-
e == null || e.clearRect(0, 0,
|
10648
|
-
},
|
10660
|
+
_this57._captureButton.replaceChildren(_this57._captureIcon), _this57._captureButton.classList.replace("modal-svg-refresh-button", "modal-svg-camera-button");
|
10661
|
+
var e = _this57._canvas.getContext("2d");
|
10662
|
+
e == null || e.clearRect(0, 0, _this57._canvas.width, _this57._canvas.height);
|
10663
|
+
}, Ke.MODAL_CLOSE_TIMEOUT_MS);
|
10649
10664
|
}
|
10650
10665
|
}, {
|
10651
10666
|
key: "start",
|
10652
10667
|
value: function start() {
|
10653
|
-
var
|
10668
|
+
var _this58 = this;
|
10654
10669
|
this._dataURL = void 0, this._submitButton.classList.add("modal-svg-submit-disabled"), this._stopped = !1, navigator.mediaDevices.getUserMedia({
|
10655
10670
|
video: this._dimensions || !0
|
10656
10671
|
}).then(function (e) {
|
10657
|
-
if (
|
10672
|
+
if (_this58._mediaStream = e, !_this58.isOpen()) return _this58.stop();
|
10658
10673
|
var t = document.createElement("video");
|
10659
|
-
t.srcObject = e, t.play(), requestAnimationFrame(
|
10674
|
+
t.srcObject = e, t.play(), requestAnimationFrame(_this58.updateCanvas.bind(_this58, t, _this58._canvas));
|
10660
10675
|
})["catch"](function (e) {
|
10661
|
-
console.error(e),
|
10676
|
+
console.error(e), _this58.stop(), _this58.close();
|
10662
10677
|
});
|
10663
10678
|
}
|
10664
10679
|
}, {
|
@@ -10710,19 +10725,19 @@ var Ui = /*#__PURE__*/function (_Ve) {
|
|
10710
10725
|
}
|
10711
10726
|
}]);
|
10712
10727
|
return Ui;
|
10713
|
-
}(
|
10728
|
+
}(Ke);
|
10714
10729
|
var ua = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M29 7h-4.599l-2.401-4h-12l-2.4 4h-4.6c-1 0-3 1-3 2.969v16.031c0 1.657 1.5 3 2.792 3h26.271c1.313 0 2.938-1.406 2.938-2.968v-16.032c0-1-1-3-3-3zM30 26.032c0 0.395-0.639 0.947-0.937 0.969h-26.265c-0.232-0.019-0.797-0.47-0.797-1v-16.031c0-0.634 0.851-0.953 1-0.969h5.732l2.4-4h9.802l1.785 3.030 0.55 0.97h5.731c0.705 0 0.99 0.921 1 1v16.032zM16 10c-3.866 0-7 3.134-7 7s3.134 7 7 7 7-3.134 7-7-3.134-7-7-7zM16 22c-2.757 0-5-2.243-5-5s2.243-5 5-5 5 2.243 5 5-2.243 5-5 5z\"></path>\n</svg>";
|
10715
10730
|
var zt = /*#__PURE__*/function (_ot5) {
|
10716
10731
|
_inherits(zt, _ot5);
|
10717
10732
|
var _super44 = _createSuper(zt);
|
10718
10733
|
function zt(e, t, i) {
|
10719
|
-
var
|
10734
|
+
var _this59;
|
10720
10735
|
_classCallCheck(this, zt);
|
10721
10736
|
var s;
|
10722
|
-
|
10723
|
-
var r =
|
10724
|
-
i &&
|
10725
|
-
return
|
10737
|
+
_this59 = _super44.call(this, zt.createButtonElement(), (s = i == null ? void 0 : i.button) == null ? void 0 : s.position, (i == null ? void 0 : i.button) || {}, "Photo");
|
10738
|
+
var r = _this59.createInnerElements(_this59._customStyles);
|
10739
|
+
i && _this59.addClickEvent(e, t, i.modalContainerStyle, i.files), _this59.elementRef.classList.add("upload-file-button"), _this59.elementRef.appendChild(r.styles), _this59.reapplyStateStyle("styles");
|
10740
|
+
return _this59;
|
10726
10741
|
}
|
10727
10742
|
_createClass(zt, [{
|
10728
10743
|
key: "createInnerElements",
|
@@ -10759,37 +10774,37 @@ var zt = /*#__PURE__*/function (_ot5) {
|
|
10759
10774
|
}]);
|
10760
10775
|
return zt;
|
10761
10776
|
}(ot);
|
10762
|
-
var
|
10777
|
+
var De = /*#__PURE__*/function () {
|
10763
10778
|
// prettier-ignore
|
10764
|
-
function
|
10765
|
-
_classCallCheck(this,
|
10766
|
-
this.elementRef =
|
10767
|
-
var s = new
|
10779
|
+
function De(e, t, i, r) {
|
10780
|
+
_classCallCheck(this, De);
|
10781
|
+
this.elementRef = De.createPanelElement(e.inputAreaStyle);
|
10782
|
+
var s = new Ti(e, i),
|
10768
10783
|
o = {},
|
10769
10784
|
a = this.createFileUploadComponents(e, i, r, o);
|
10770
10785
|
e.speechToText && !o.microphone && (o.microphone = {
|
10771
10786
|
button: new jt(e, s, t.addNewErrorMessage.bind(t))
|
10772
10787
|
});
|
10773
10788
|
var l = new Pe(e, s.inputElementRef, t, i, a);
|
10774
|
-
s.submit = l.submitFromInput.bind(l), e.submitUserMessage = l.submit.bind(l, !0), o.submit = {
|
10789
|
+
s.submit = l.submitFromInput.bind(l), De.attachValidationHandler(e, i, s, a, l), e.submitUserMessage = l.submit.bind(l, !0), o.submit = {
|
10775
10790
|
button: l
|
10776
|
-
},
|
10791
|
+
}, De.addElements(this.elementRef, s, o, r, a, e.dropupStyles);
|
10777
10792
|
}
|
10778
|
-
_createClass(
|
10793
|
+
_createClass(De, [{
|
10779
10794
|
key: "createFileUploadComponents",
|
10780
10795
|
value:
|
10781
10796
|
// prettier-ignore
|
10782
10797
|
function createFileUploadComponents(e, t, i, r) {
|
10783
10798
|
var o, a, l, c;
|
10784
10799
|
var s = new at(this.elementRef, e.attachmentContainerStyle, t.demo);
|
10785
|
-
if (
|
10786
|
-
var d = ((a = r.images) == null ? void 0 : a.fileType) || s.addType(t.camera.files, "images");
|
10800
|
+
if (De.createUploadButtons(e, t.fileTypes || {}, s, i, r), (o = t.camera) != null && o.files) {
|
10801
|
+
var d = ((a = r.images) == null ? void 0 : a.fileType) || s.addType(e, t.camera.files, "images");
|
10787
10802
|
r.camera = {
|
10788
10803
|
button: new zt(i, d, t.camera)
|
10789
10804
|
};
|
10790
10805
|
}
|
10791
10806
|
if ((l = t.recordAudio) != null && l.files) {
|
10792
|
-
var _d = ((c = r.audio) == null ? void 0 : c.fileType) || s.addType(t.recordAudio.files, "audio");
|
10807
|
+
var _d = ((c = r.audio) == null ? void 0 : c.fileType) || s.addType(e, t.recordAudio.files, "audio");
|
10793
10808
|
r.microphone = {
|
10794
10809
|
button: new sa(_d, t.recordAudio)
|
10795
10810
|
};
|
@@ -10805,20 +10820,20 @@ var $e = /*#__PURE__*/function () {
|
|
10805
10820
|
}
|
10806
10821
|
}, {
|
10807
10822
|
key: "createUploadButtons",
|
10808
|
-
value: function createUploadButtons(e, t, i, r) {
|
10809
|
-
Object.keys(
|
10810
|
-
var
|
10811
|
-
|
10812
|
-
if (
|
10813
|
-
var
|
10814
|
-
_jo$
|
10815
|
-
|
10816
|
-
|
10817
|
-
|
10818
|
-
|
10819
|
-
|
10820
|
-
button:
|
10821
|
-
fileType:
|
10823
|
+
value: function createUploadButtons(e, t, i, r, s) {
|
10824
|
+
Object.keys(t).forEach(function (o) {
|
10825
|
+
var a = o,
|
10826
|
+
l = t[a];
|
10827
|
+
if (l.files) {
|
10828
|
+
var c = i.addType(e, l.files, a),
|
10829
|
+
_jo$a = jo[a],
|
10830
|
+
d = _jo$a.id,
|
10831
|
+
u = _jo$a.svgString,
|
10832
|
+
p = _jo$a.dropupText,
|
10833
|
+
h = new Ye(r, c, l, d, u, p);
|
10834
|
+
s[a] = {
|
10835
|
+
button: h,
|
10836
|
+
fileType: c
|
10822
10837
|
};
|
10823
10838
|
}
|
10824
10839
|
});
|
@@ -10828,12 +10843,53 @@ var $e = /*#__PURE__*/function () {
|
|
10828
10843
|
key: "addElements",
|
10829
10844
|
value: function addElements(e, t, i, r, s, o) {
|
10830
10845
|
Vt.addElements(e, t.elementRef);
|
10831
|
-
var a =
|
10846
|
+
var a = Ue.create(),
|
10832
10847
|
l = N.addButtons(a, i, r, o);
|
10833
|
-
|
10848
|
+
Lo.set(t.inputElementRef, a, s.elementRef, l), Ue.add(e, a);
|
10849
|
+
}
|
10850
|
+
// private static defaultValidator(text?: string, files?: File[]) {
|
10851
|
+
// return (text && text.trim().length > 0) || (files && files.length > 0);
|
10852
|
+
// }
|
10853
|
+
// prettier-ignore
|
10854
|
+
}, {
|
10855
|
+
key: "attachValidationHandler",
|
10856
|
+
value: function attachValidationHandler(e, t, i, r, s) {
|
10857
|
+
e._validationHandler = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee76() {
|
10858
|
+
var o,
|
10859
|
+
a,
|
10860
|
+
c,
|
10861
|
+
d,
|
10862
|
+
u,
|
10863
|
+
p,
|
10864
|
+
_args76 = arguments;
|
10865
|
+
return _regeneratorRuntime().wrap(function _callee76$(_context76) {
|
10866
|
+
while (1) switch (_context76.prev = _context76.next) {
|
10867
|
+
case 0:
|
10868
|
+
o = _args76.length > 0 && _args76[0] !== undefined ? _args76[0] : !1;
|
10869
|
+
a = e.validateMessageBeforeSending || t.canSendMessage;
|
10870
|
+
if (!a) {
|
10871
|
+
_context76.next = 8;
|
10872
|
+
break;
|
10873
|
+
}
|
10874
|
+
c = i.inputElementRef.classList.contains("text-input-placeholder") ? "" : i.inputElementRef.textContent;
|
10875
|
+
_context76.next = 6;
|
10876
|
+
return r.completePlaceholders();
|
10877
|
+
case 6:
|
10878
|
+
d = r.getAllFileData(), u = d == null ? void 0 : d.map(function (h) {
|
10879
|
+
return h.file;
|
10880
|
+
}), p = a(c, u, o);
|
10881
|
+
return _context76.abrupt("return", (p ? s.changeToSubmitIcon() : s.changeToDisabledIcon(), p));
|
10882
|
+
case 8:
|
10883
|
+
return _context76.abrupt("return", null);
|
10884
|
+
case 9:
|
10885
|
+
case "end":
|
10886
|
+
return _context76.stop();
|
10887
|
+
}
|
10888
|
+
}, _callee76);
|
10889
|
+
}));
|
10834
10890
|
}
|
10835
10891
|
}]);
|
10836
|
-
return
|
10892
|
+
return De;
|
10837
10893
|
}();
|
10838
10894
|
var qi = /*#__PURE__*/function () {
|
10839
10895
|
function qi() {
|
@@ -10844,9 +10900,9 @@ var qi = /*#__PURE__*/function () {
|
|
10844
10900
|
value: function createElements(e, t, i) {
|
10845
10901
|
var r = document.createElement("div");
|
10846
10902
|
r.id = "chat-view";
|
10847
|
-
var s = new
|
10903
|
+
var s = new L(e, t, i);
|
10848
10904
|
t.websocket && K.createConnection(t, s);
|
10849
|
-
var o = new
|
10905
|
+
var o = new De(e, s, t, r);
|
10850
10906
|
return Vt.addElements(r, s.elementRef, o.elementRef), r;
|
10851
10907
|
}
|
10852
10908
|
}, {
|
@@ -10870,20 +10926,22 @@ var v = /*#__PURE__*/function (_Zs) {
|
|
10870
10926
|
var _super45 = _createSuper(v);
|
10871
10927
|
// TO-DO - key view style
|
10872
10928
|
function v() {
|
10873
|
-
var
|
10929
|
+
var _this60;
|
10874
10930
|
_classCallCheck(this, v);
|
10875
|
-
|
10931
|
+
_this60 = _super45.call(this), _this60.directConnection = {
|
10932
|
+
openAI: {}
|
10933
|
+
}, _this60.getMessages = function () {
|
10876
10934
|
return [];
|
10877
|
-
},
|
10935
|
+
}, _this60.submitUserMessage = function () {
|
10878
10936
|
return console.warn("submitUserMessage failed - please wait for chat view to render before calling this property.");
|
10879
|
-
},
|
10880
|
-
return Ft.focusFromParentElement(
|
10881
|
-
},
|
10937
|
+
}, _this60.focusInput = function () {
|
10938
|
+
return Ft.focusFromParentElement(_this60._elementRef);
|
10939
|
+
}, _this60.refreshMessages = function () {}, _this60.clearMessages = function () {}, _this60.scrollToBottom = function () {}, _this60.onNewMessage = function () {}, _this60.onClearMessages = function () {}, _this60.onComponentRender = function () {}, _this60._hasBeenRendered = !1, _this60._auxiliaryStyleApplied = !1, wo.appendStyleSheetToHead(), _this60._elementRef = document.createElement("div"), _this60._elementRef.id = "container", _this60.attachShadow({
|
10882
10940
|
mode: "open"
|
10883
|
-
}).appendChild(
|
10884
|
-
|
10941
|
+
}).appendChild(_this60._elementRef), oi.apply(ha, _this60.shadowRoot), setTimeout(function () {
|
10942
|
+
_this60._hasBeenRendered || _this60.onRender();
|
10885
10943
|
}, 20);
|
10886
|
-
return
|
10944
|
+
return _this60;
|
10887
10945
|
}
|
10888
10946
|
_createClass(v, [{
|
10889
10947
|
key: "changeToChatView",
|
@@ -10895,7 +10953,7 @@ var v = /*#__PURE__*/function (_Zs) {
|
|
10895
10953
|
key: "onRender",
|
10896
10954
|
value: function onRender() {
|
10897
10955
|
var _this$_activeService, _this$_childElement;
|
10898
|
-
(_this$_activeService = this._activeService) !== null && _this$_activeService !== void 0 ? _this$_activeService : this._activeService = So.create(this), this._activeService && (this.auxiliaryStyle && !this._auxiliaryStyleApplied && (oi.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), oi.applyDefaultStyleToComponent(this.style),
|
10956
|
+
(_this$_activeService = this._activeService) !== null && _this$_activeService !== void 0 ? _this$_activeService : this._activeService = So.create(this), this._activeService && (this.auxiliaryStyle && !this._auxiliaryStyleApplied && (oi.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), oi.applyDefaultStyleToComponent(this.style), Ci.checkForContainerStyles(this, this._elementRef), this._activeService.key && this._activeService.validateConfigKey ? Et.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : !(this._activeService instanceof B) || this._activeService.key ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], qi.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof B && I.render(this._elementRef, this.changeToChatView.bind(this), this._activeService), this._hasBeenRendered = !0, _i.onRender(this));
|
10899
10957
|
}
|
10900
10958
|
}]);
|
10901
10959
|
return v;
|
@@ -10920,6 +10978,7 @@ x([y("object")], v.prototype, "names", 2);
|
|
10920
10978
|
x([y("boolean")], v.prototype, "displayLoadingBubble", 2);
|
10921
10979
|
x([y("object")], v.prototype, "errorMessages", 2);
|
10922
10980
|
x([y("object")], v.prototype, "messageStyles", 2);
|
10981
|
+
x([y("object")], v.prototype, "_insertKeyViewStyles", 2);
|
10923
10982
|
x([y("object")], v.prototype, "textToSpeech", 2);
|
10924
10983
|
x([y("object")], v.prototype, "speechToText", 2);
|
10925
10984
|
x([y("object")], v.prototype, "images", 2);
|