deep-chat-dev 9.0.3 → 9.0.4

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/dist/deepChat.js CHANGED
@@ -319,130 +319,38 @@ function getInvalidResponseMessage(r, e, t, n) {
319
319
  return "".concat(s + o, "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");
320
320
  }
321
321
  var ErrorMessages = {
322
- INVALID_KEY: "Invalid API Key",
323
- CONNECTION_FAILED: "Failed to connect",
324
- INVALID_RESPONSE: getInvalidResponseMessage,
325
- INVALID_STREAM_RESPONSE: "Make sure the events are using the Response format: https://deepchat.dev/docs/connect/#Response \nYou can also augment them using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor"
326
- },
327
- _RequestUtils = /*#__PURE__*/function () {
328
- function D() {
329
- _classCallCheck(this, D);
330
- }
331
- _createClass(D, null, [{
332
- key: "temporarilyRemoveHeader",
333
- value: // need to pass stringifyBody boolean separately as binding is throwing an error for some reason
334
- // prettier-ignore
335
- function () {
336
- var _temporarilyRemoveHeader = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e, t, n) {
337
- var s;
338
- return _regeneratorRuntime().wrap(function _callee$(_context) {
339
- while (1) switch (_context.prev = _context.next) {
340
- case 0:
341
- if (e != null && e.headers) {
342
- _context.next = 2;
343
- break;
344
- }
345
- throw new Error("Request settings have not been set up");
346
- case 2:
347
- s = e.headers[D.CONTENT_TYPE];
348
- delete e.headers[D.CONTENT_TYPE];
349
- _context.next = 6;
350
- return t(n);
351
- case 6:
352
- e.headers[D.CONTENT_TYPE] = s;
353
- case 7:
354
- case "end":
355
- return _context.stop();
356
- }
357
- }, _callee);
358
- }));
359
- function temporarilyRemoveHeader(_x, _x2, _x3) {
360
- return _temporarilyRemoveHeader.apply(this, arguments);
361
- }
362
- return temporarilyRemoveHeader;
363
- }()
364
- }, {
365
- key: "displayError",
366
- value: function displayError(e, t) {
367
- var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "Service error, please try again.";
368
- if (console.error(t), _typeof(t) == "object") return Object.keys(t).length === 0 ? e.addNewErrorMessage("service", n) : e.addNewErrorMessage("service", JSON.stringify(t));
369
- e.addNewErrorMessage("service", t);
370
- }
371
- }, {
372
- key: "processResponseByType",
373
- value: function processResponseByType(e) {
374
- var t = e.headers.get("content-type");
375
- return t != null && t.includes("application/json") ? e.json() : t != null && t.includes("text/plain") || !t ? e : e.blob();
376
- }
377
- }, {
378
- key: "processRequestInterceptor",
379
- value: function () {
380
- var _processRequestInterceptor = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e, t) {
381
- var a, n, s, o;
382
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
383
- while (1) switch (_context2.prev = _context2.next) {
384
- case 0:
385
- _context2.next = 2;
386
- return (a = e.requestInterceptor) == null ? void 0 : a.call(e, t);
387
- case 2:
388
- _context2.t0 = _context2.sent;
389
- if (_context2.t0) {
390
- _context2.next = 5;
391
- break;
392
- }
393
- _context2.t0 = t;
394
- case 5:
395
- n = _context2.t0;
396
- s = n;
397
- o = n;
398
- return _context2.abrupt("return", {
399
- body: s.body,
400
- headers: s.headers,
401
- error: o.error
402
- });
403
- case 9:
404
- case "end":
405
- return _context2.stop();
406
- }
407
- }, _callee2);
408
- }));
409
- function processRequestInterceptor(_x4, _x5) {
410
- return _processRequestInterceptor.apply(this, arguments);
411
- }
412
- return processRequestInterceptor;
413
- }()
414
- }]);
415
- return D;
416
- }();
417
- _RequestUtils.CONTENT_TYPE = "Content-Type";
418
- var RequestUtils = _RequestUtils;
419
- function getBytes(_x6, _x7) {
322
+ INVALID_KEY: "Invalid API Key",
323
+ CONNECTION_FAILED: "Failed to connect",
324
+ INVALID_RESPONSE: getInvalidResponseMessage,
325
+ INVALID_STREAM_RESPONSE: "Make sure the events are using the Response format: https://deepchat.dev/docs/connect/#Response \nYou can also augment them using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor"
326
+ };
327
+ function getBytes(_x, _x2) {
420
328
  return _getBytes.apply(this, arguments);
421
329
  }
422
330
  function _getBytes() {
423
- _getBytes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(r, e) {
331
+ _getBytes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(r, e) {
424
332
  var t, n;
425
- return _regeneratorRuntime().wrap(function _callee74$(_context74) {
426
- while (1) switch (_context74.prev = _context74.next) {
333
+ return _regeneratorRuntime().wrap(function _callee75$(_context75) {
334
+ while (1) switch (_context75.prev = _context75.next) {
427
335
  case 0:
428
336
  t = r.getReader();
429
337
  case 1:
430
- _context74.next = 3;
338
+ _context75.next = 3;
431
339
  return t.read();
432
340
  case 3:
433
- if ((n = _context74.sent).done) {
434
- _context74.next = 7;
341
+ if ((n = _context75.sent).done) {
342
+ _context75.next = 7;
435
343
  break;
436
344
  }
437
345
  e(n.value);
438
346
  case 5:
439
- _context74.next = 1;
347
+ _context75.next = 1;
440
348
  break;
441
349
  case 7:
442
350
  case "end":
443
- return _context74.stop();
351
+ return _context75.stop();
444
352
  }
445
- }, _callee74);
353
+ }, _callee75);
446
354
  }));
447
355
  return _getBytes.apply(this, arguments);
448
356
  }
@@ -531,9 +439,9 @@ function fetchEventSource(r, e) {
531
439
  c = e.openWhenHidden,
532
440
  u = e.fetch,
533
441
  d = __rest(e, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
534
- return new Promise(function (h, p) {
535
- var f = Object.assign({}, n);
536
- f.accept || (f.accept = EventStreamContentType);
442
+ return new Promise(function (h, f) {
443
+ var p = Object.assign({}, n);
444
+ p.accept || (p.accept = EventStreamContentType);
537
445
  var b;
538
446
  function m() {
539
447
  b.abort(), document.hidden || x();
@@ -550,29 +458,29 @@ function fetchEventSource(r, e) {
550
458
  var S = u !== null && u !== void 0 ? u : window.fetch,
551
459
  E = s !== null && s !== void 0 ? s : defaultOnOpen;
552
460
  function x() {
553
- return _x8.apply(this, arguments);
461
+ return _x3.apply(this, arguments);
554
462
  }
555
- function _x8() {
556
- _x8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
557
- var R, w, _;
558
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
559
- while (1) switch (_context3.prev = _context3.next) {
463
+ function _x3() {
464
+ _x3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
465
+ var R, C, _;
466
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
467
+ while (1) switch (_context.prev = _context.next) {
560
468
  case 0:
561
469
  b = new AbortController();
562
- _context3.prev = 1;
563
- _context3.next = 4;
470
+ _context.prev = 1;
471
+ _context.next = 4;
564
472
  return S(r, Object.assign(Object.assign({}, d), {
565
- headers: f,
473
+ headers: p,
566
474
  signal: b.signal
567
475
  }));
568
476
  case 4:
569
- w = _context3.sent;
570
- _context3.next = 7;
571
- return E(w);
477
+ C = _context.sent;
478
+ _context.next = 7;
479
+ return E(C);
572
480
  case 7:
573
- _context3.next = 9;
574
- return getBytes(w.body, getLines(getMessages(function (_) {
575
- _ ? f[LastEventId] = _ : delete f[LastEventId];
481
+ _context.next = 9;
482
+ return getBytes(C.body, getLines(getMessages(function (_) {
483
+ _ ? p[LastEventId] = _ : delete p[LastEventId];
576
484
  }, function (_) {
577
485
  g = _;
578
486
  }, o)));
@@ -580,24 +488,24 @@ function fetchEventSource(r, e) {
580
488
  a == null || a();
581
489
  y();
582
490
  h();
583
- _context3.next = 17;
491
+ _context.next = 17;
584
492
  break;
585
493
  case 14:
586
- _context3.prev = 14;
587
- _context3.t0 = _context3["catch"](1);
494
+ _context.prev = 14;
495
+ _context.t0 = _context["catch"](1);
588
496
  if (!b.signal.aborted) try {
589
- _ = (R = l == null ? void 0 : l(_context3.t0)) !== null && R !== void 0 ? R : g;
497
+ _ = (R = l == null ? void 0 : l(_context.t0)) !== null && R !== void 0 ? R : g;
590
498
  window.clearTimeout(v), v = window.setTimeout(x, _);
591
499
  } catch (_) {
592
- y(), p(_);
500
+ y(), f(_);
593
501
  }
594
502
  case 17:
595
503
  case "end":
596
- return _context3.stop();
504
+ return _context.stop();
597
505
  }
598
- }, _callee3, null, [[1, 14]]);
506
+ }, _callee, null, [[1, 14]]);
599
507
  }));
600
- return _x8.apply(this, arguments);
508
+ return _x3.apply(this, arguments);
601
509
  }
602
510
  x();
603
511
  });
@@ -606,6 +514,98 @@ function defaultOnOpen(r) {
606
514
  var e = r.headers.get("content-type");
607
515
  if (!(e != null && e.startsWith(EventStreamContentType))) throw new Error("Expected content-type to be ".concat(EventStreamContentType, ", Actual: ").concat(e));
608
516
  }
517
+ var _RequestUtils = /*#__PURE__*/function () {
518
+ function D() {
519
+ _classCallCheck(this, D);
520
+ }
521
+ _createClass(D, null, [{
522
+ key: "temporarilyRemoveHeader",
523
+ value: // need to pass stringifyBody boolean separately as binding is throwing an error for some reason
524
+ // prettier-ignore
525
+ function () {
526
+ var _temporarilyRemoveHeader = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e, t, n) {
527
+ var s;
528
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
529
+ while (1) switch (_context2.prev = _context2.next) {
530
+ case 0:
531
+ if (e != null && e.headers) {
532
+ _context2.next = 2;
533
+ break;
534
+ }
535
+ throw new Error("Request settings have not been set up");
536
+ case 2:
537
+ s = e.headers[D.CONTENT_TYPE];
538
+ delete e.headers[D.CONTENT_TYPE];
539
+ _context2.next = 6;
540
+ return t(n);
541
+ case 6:
542
+ e.headers[D.CONTENT_TYPE] = s;
543
+ case 7:
544
+ case "end":
545
+ return _context2.stop();
546
+ }
547
+ }, _callee2);
548
+ }));
549
+ function temporarilyRemoveHeader(_x4, _x5, _x6) {
550
+ return _temporarilyRemoveHeader.apply(this, arguments);
551
+ }
552
+ return temporarilyRemoveHeader;
553
+ }()
554
+ }, {
555
+ key: "displayError",
556
+ value: function displayError(e, t) {
557
+ var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "Service error, please try again.";
558
+ if (console.error(t), _typeof(t) == "object") return Object.keys(t).length === 0 ? e.addNewErrorMessage("service", n) : e.addNewErrorMessage("service", JSON.stringify(t));
559
+ e.addNewErrorMessage("service", t);
560
+ }
561
+ }, {
562
+ key: "processResponseByType",
563
+ value: function processResponseByType(e) {
564
+ var t = e.headers.get("content-type");
565
+ return t != null && t.includes("application/json") ? e.json() : t != null && t.includes("text/plain") || !t ? e : e.blob();
566
+ }
567
+ }, {
568
+ key: "processRequestInterceptor",
569
+ value: function () {
570
+ var _processRequestInterceptor = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(e, t) {
571
+ var a, n, s, o;
572
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
573
+ while (1) switch (_context3.prev = _context3.next) {
574
+ case 0:
575
+ _context3.next = 2;
576
+ return (a = e.requestInterceptor) == null ? void 0 : a.call(e, t);
577
+ case 2:
578
+ _context3.t0 = _context3.sent;
579
+ if (_context3.t0) {
580
+ _context3.next = 5;
581
+ break;
582
+ }
583
+ _context3.t0 = t;
584
+ case 5:
585
+ n = _context3.t0;
586
+ s = n;
587
+ o = n;
588
+ return _context3.abrupt("return", {
589
+ body: s.body,
590
+ headers: s.headers,
591
+ error: o.error
592
+ });
593
+ case 9:
594
+ case "end":
595
+ return _context3.stop();
596
+ }
597
+ }, _callee3);
598
+ }));
599
+ function processRequestInterceptor(_x7, _x8) {
600
+ return _processRequestInterceptor.apply(this, arguments);
601
+ }
602
+ return processRequestInterceptor;
603
+ }()
604
+ }]);
605
+ return D;
606
+ }();
607
+ _RequestUtils.CONTENT_TYPE = "Content-Type";
608
+ var RequestUtils = _RequestUtils;
609
609
  var _Demo = /*#__PURE__*/function () {
610
610
  function A() {
611
611
  _classCallCheck(this, A);
@@ -697,7 +697,7 @@ var Stream = /*#__PURE__*/function () {
697
697
  function () {
698
698
  var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(e, t, n) {
699
699
  var s,
700
- f,
700
+ p,
701
701
  b,
702
702
  m,
703
703
  g,
@@ -711,7 +711,7 @@ var Stream = /*#__PURE__*/function () {
711
711
  u,
712
712
  d,
713
713
  h,
714
- p,
714
+ f,
715
715
  _args6 = arguments;
716
716
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
717
717
  while (1) switch (_context6.prev = _context6.next) {
@@ -719,7 +719,7 @@ var Stream = /*#__PURE__*/function () {
719
719
  s = _args6.length > 3 && _args6[3] !== undefined ? _args6[3] : !0;
720
720
  o = {
721
721
  body: t,
722
- headers: (f = e.requestSettings) == null ? void 0 : f.headers
722
+ headers: (p = e.requestSettings) == null ? void 0 : p.headers
723
723
  };
724
724
  _context6.next = 4;
725
725
  return RequestUtils.processRequestInterceptor(e.deepChat, o);
@@ -738,7 +738,7 @@ var Stream = /*#__PURE__*/function () {
738
738
  }
739
739
  return _context6.abrupt("return", Stream.onInterceptorError(n, c, d));
740
740
  case 14:
741
- if (!((b = e.requestSettings) != null && b.streamHandler)) {
741
+ if (!((b = e.requestSettings) != null && b.handler)) {
742
742
  _context6.next = 16;
743
743
  break;
744
744
  }
@@ -750,7 +750,7 @@ var Stream = /*#__PURE__*/function () {
750
750
  }
751
751
  return _context6.abrupt("return", Demo.requestStream(n, e.streamHandlers));
752
752
  case 18:
753
- p = null;
753
+ f = null;
754
754
  fetchEventSource(((g = e.requestSettings) == null ? void 0 : g.url) || e.url || "", {
755
755
  method: ((v = e.requestSettings) == null ? void 0 : v.method) || "POST",
756
756
  headers: l,
@@ -766,7 +766,7 @@ var Stream = /*#__PURE__*/function () {
766
766
  _context5.next = 2;
767
767
  break;
768
768
  }
769
- return _context5.abrupt("return", (p = n.addNewStreamedMessage(), u()));
769
+ return _context5.abrupt("return", (f = n.addNewStreamedMessage(), u()));
770
770
  case 2:
771
771
  _context5.next = 4;
772
772
  return RequestUtils.processResponseByType(y);
@@ -784,7 +784,7 @@ var Stream = /*#__PURE__*/function () {
784
784
  if (JSON.stringify(y.data) !== JSON.stringify("[DONE]")) {
785
785
  var E = JSON.parse(y.data);
786
786
  (S = e.extractResultData) == null || S.call(e, E).then(function (x) {
787
- (x == null ? void 0 : x.text) === void 0 ? console.error("Response data: ".concat(y.data, " \n ").concat(ErrorMessages.INVALID_STREAM_RESPONSE)) : p && n.updateStreamedMessage(x.text, p);
787
+ (x == null ? void 0 : x.text) === void 0 ? console.error("Response data: ".concat(y.data, " \n ").concat(ErrorMessages.INVALID_STREAM_RESPONSE)) : f && n.updateStreamedMessage(x.text, f);
788
788
  })["catch"](function (x) {
789
789
  return RequestUtils.displayError(n, x);
790
790
  });
@@ -861,57 +861,42 @@ var CustomHandler = /*#__PURE__*/function () {
861
861
  key: "request",
862
862
  value: function () {
863
863
  var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(e, t, n) {
864
- var s, o;
864
+ var o, a, s;
865
865
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
866
866
  while (1) switch (_context8.prev = _context8.next) {
867
867
  case 0:
868
- (o = (s = e.requestSettings).handler) == null || o.call(s, t).then( /*#__PURE__*/function () {
869
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(a) {
870
- var u, d, l, c;
868
+ s = /*#__PURE__*/function () {
869
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(l) {
870
+ var u, d, c;
871
871
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
872
872
  while (1) switch (_context7.prev = _context7.next) {
873
873
  case 0:
874
- if (e.extractResultData) {
875
- _context7.next = 2;
876
- break;
877
- }
878
- return _context7.abrupt("return");
874
+ _context7.next = 2;
875
+ return (d = (u = e.deepChat).responseInterceptor) == null ? void 0 : d.call(u, l);
879
876
  case 2:
880
- _context7.next = 4;
881
- return (d = (u = e.deepChat).responseInterceptor) == null ? void 0 : d.call(u, a);
882
- case 4:
883
877
  _context7.t0 = _context7.sent;
884
878
  if (_context7.t0) {
885
- _context7.next = 7;
879
+ _context7.next = 5;
886
880
  break;
887
881
  }
888
- _context7.t0 = a;
882
+ _context7.t0 = l;
883
+ case 5:
884
+ c = _context7.t0;
885
+ !c || _typeof(c) != "object" || typeof c.error != "string" && typeof c.text != "string" ? (console.error(ErrorMessages.INVALID_RESPONSE(l, "server", !!e.deepChat.responseInterceptor, c)), n.addNewErrorMessage("service", "Error in server message"), e.completionsHandlers.onFinish()) : typeof c.error == "string" ? (console.error(c.error), n.addNewErrorMessage("service", c.error), e.completionsHandlers.onFinish()) : e.deepChat.stream && c.text ? Stream.simulate(n, e.streamHandlers, c.text) : (n.addNewMessage(c, !0, !0), e.completionsHandlers.onFinish());
889
886
  case 7:
890
- l = _context7.t0;
891
- _context7.next = 10;
892
- return e.extractResultData(l);
893
- case 10:
894
- c = _context7.sent;
895
- if (!(!c || _typeof(c) != "object")) {
896
- _context7.next = 13;
897
- break;
898
- }
899
- throw Error(ErrorMessages.INVALID_RESPONSE(a, "response", !!e.deepChat.responseInterceptor, c));
900
- case 13:
901
- e.deepChat.stream && c.text ? Stream.simulate(n, e.streamHandlers, c.text) : (n.addNewMessage(c, !0, !0), e.completionsHandlers.onFinish());
902
- case 14:
903
887
  case "end":
904
888
  return _context7.stop();
905
889
  }
906
890
  }, _callee7);
907
891
  }));
908
- return function (_x15) {
892
+ return function s(_x15) {
909
893
  return _ref2.apply(this, arguments);
910
894
  };
911
- }())["catch"](function (a) {
912
- RequestUtils.displayError(n, a), e.completionsHandlers.onFinish();
895
+ }();
896
+ (a = (o = e.requestSettings).handler) == null || a.call(o, t, {
897
+ onResponse: s
913
898
  });
914
- case 1:
899
+ case 2:
915
900
  case "end":
916
901
  return _context8.stop();
917
902
  }
@@ -926,7 +911,7 @@ var CustomHandler = /*#__PURE__*/function () {
926
911
  key: "stream",
927
912
  value: function () {
928
913
  var _stream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(e, t, n) {
929
- var d, h, s, o, a, l, c, u;
914
+ var h, f, s, o, a, l, c, u, d;
930
915
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
931
916
  while (1) switch (_context9.prev = _context9.next) {
932
917
  case 0:
@@ -936,17 +921,19 @@ var CustomHandler = /*#__PURE__*/function () {
936
921
  }, c = function c() {
937
922
  s && (n.finaliseStreamedMessage(), e.streamHandlers.onClose(), s = !1);
938
923
  }, u = function u(p) {
939
- s && (p.error ? (console.error(p.error), n.finaliseStreamedMessage(), e.streamHandlers.onClose(), n.addNewErrorMessage("service", p.error), s = !1) : p.text && a && n.updateStreamedMessage(p.text, a));
924
+ s && (!p || _typeof(p) != "object" || typeof p.error != "string" && typeof p.text != "string" ? console.error(ErrorMessages.INVALID_RESPONSE(p, "server", !1)) : p.error ? (console.error(p.error), n.finaliseStreamedMessage(), e.streamHandlers.onClose(), n.addNewErrorMessage("service", p.error), s = !1) : p.text && a && n.updateStreamedMessage(p.text, a));
940
925
  };
941
926
  e.streamHandlers.abortStream.abort = function () {
942
927
  n.finaliseStreamedMessage(), e.streamHandlers.onClose(), s = !1;
943
- }, (h = (d = e.requestSettings).streamHandler) == null || h.call(d, t, {
928
+ };
929
+ d = {
944
930
  onOpen: l,
945
- onResult: u,
931
+ onResponse: u,
946
932
  onClose: c,
947
933
  stopClicked: e.streamHandlers.stopClicked
948
- });
949
- case 3:
934
+ };
935
+ (f = (h = e.requestSettings).handler) == null || f.call(h, t, d);
936
+ case 5:
950
937
  case "end":
951
938
  return _context9.stop();
952
939
  }
@@ -957,6 +944,63 @@ var CustomHandler = /*#__PURE__*/function () {
957
944
  }
958
945
  return stream;
959
946
  }()
947
+ }, {
948
+ key: "websocket",
949
+ value: function websocket(e, t) {
950
+ var c, u;
951
+ var n = {
952
+ isOpen: !1,
953
+ newUserMessage: {
954
+ listener: function listener() {}
955
+ }
956
+ };
957
+ e.websocket = n;
958
+ var l = {
959
+ onOpen: function onOpen() {
960
+ t.removeError(), n.isOpen = !0;
961
+ },
962
+ onResponse: function () {
963
+ var _onResponse = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(d) {
964
+ var f, p, h;
965
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
966
+ while (1) switch (_context10.prev = _context10.next) {
967
+ case 0:
968
+ if (n.isOpen) {
969
+ _context10.next = 2;
970
+ break;
971
+ }
972
+ return _context10.abrupt("return");
973
+ case 2:
974
+ _context10.next = 4;
975
+ return (p = (f = e.deepChat).responseInterceptor) == null ? void 0 : p.call(f, d);
976
+ case 4:
977
+ _context10.t0 = _context10.sent;
978
+ if (_context10.t0) {
979
+ _context10.next = 7;
980
+ break;
981
+ }
982
+ _context10.t0 = d;
983
+ case 7:
984
+ h = _context10.t0;
985
+ !h || _typeof(h) != "object" || typeof h.error != "string" && typeof h.text != "string" ? (console.error(ErrorMessages.INVALID_RESPONSE(d, "server", !!e.deepChat.responseInterceptor, h)), t.addNewErrorMessage("service", "Error in server message")) : typeof h.error == "string" ? (console.error(h.error), t.isLastMessageError() || t.addNewErrorMessage("service", h.error)) : e.deepChat.stream ? Stream.simulate(t, e.streamHandlers, h.text) : t.addNewMessage(h, !0, !0);
986
+ case 9:
987
+ case "end":
988
+ return _context10.stop();
989
+ }
990
+ }, _callee10);
991
+ }));
992
+ function onResponse(_x19) {
993
+ return _onResponse.apply(this, arguments);
994
+ }
995
+ return onResponse;
996
+ }(),
997
+ onClose: function onClose() {
998
+ n.isOpen = !1;
999
+ },
1000
+ newUserMessage: n.newUserMessage
1001
+ };
1002
+ (u = (c = e.requestSettings).handler) == null || u.call(c, void 0, l);
1003
+ }
960
1004
  }]);
961
1005
  return CustomHandler;
962
1006
  }();
@@ -968,11 +1012,11 @@ var HTTPRequest = /*#__PURE__*/function () {
968
1012
  key: "request",
969
1013
  value: // prettier-ignore
970
1014
  function () {
971
- var _request3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(e, t, n) {
1015
+ var _request3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(e, t, n) {
972
1016
  var s,
973
1017
  h,
974
- p,
975
1018
  f,
1019
+ p,
976
1020
  b,
977
1021
  m,
978
1022
  o,
@@ -982,40 +1026,40 @@ var HTTPRequest = /*#__PURE__*/function () {
982
1026
  c,
983
1027
  u,
984
1028
  d,
985
- _args11 = arguments;
986
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
987
- while (1) switch (_context11.prev = _context11.next) {
1029
+ _args12 = arguments;
1030
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1031
+ while (1) switch (_context12.prev = _context12.next) {
988
1032
  case 0:
989
- s = _args11.length > 3 && _args11[3] !== undefined ? _args11[3] : !0;
1033
+ s = _args12.length > 3 && _args12[3] !== undefined ? _args12[3] : !0;
990
1034
  o = {
991
1035
  body: t,
992
1036
  headers: (h = e.requestSettings) == null ? void 0 : h.headers
993
1037
  };
994
- _context11.next = 4;
1038
+ _context12.next = 4;
995
1039
  return RequestUtils.processRequestInterceptor(e.deepChat, o);
996
1040
  case 4:
997
- _yield$RequestUtils$p2 = _context11.sent;
1041
+ _yield$RequestUtils$p2 = _context12.sent;
998
1042
  a = _yield$RequestUtils$p2.body;
999
1043
  l = _yield$RequestUtils$p2.headers;
1000
1044
  c = _yield$RequestUtils$p2.error;
1001
1045
  u = e.completionsHandlers.onFinish;
1002
1046
  if (!c) {
1003
- _context11.next = 11;
1047
+ _context12.next = 11;
1004
1048
  break;
1005
1049
  }
1006
- return _context11.abrupt("return", HTTPRequest.onInterceptorError(n, c, u));
1050
+ return _context12.abrupt("return", HTTPRequest.onInterceptorError(n, c, u));
1007
1051
  case 11:
1008
- if (!((p = e.requestSettings) != null && p.handler)) {
1009
- _context11.next = 13;
1052
+ if (!((f = e.requestSettings) != null && f.handler)) {
1053
+ _context12.next = 13;
1010
1054
  break;
1011
1055
  }
1012
- return _context11.abrupt("return", CustomHandler.request(e, a, n));
1056
+ return _context12.abrupt("return", CustomHandler.request(e, a, n));
1013
1057
  case 13:
1014
- if (!(((f = e.requestSettings) == null ? void 0 : f.url) === Demo.URL)) {
1015
- _context11.next = 15;
1058
+ if (!(((p = e.requestSettings) == null ? void 0 : p.url) === Demo.URL)) {
1059
+ _context12.next = 15;
1016
1060
  break;
1017
1061
  }
1018
- return _context11.abrupt("return", Demo.request(n, u, e.deepChat.responseInterceptor));
1062
+ return _context12.abrupt("return", Demo.request(n, u, e.deepChat.responseInterceptor));
1019
1063
  case 15:
1020
1064
  d = !0;
1021
1065
  fetch(((b = e.requestSettings) == null ? void 0 : b.url) || e.url || "", {
@@ -1027,40 +1071,40 @@ var HTTPRequest = /*#__PURE__*/function () {
1027
1071
  }).then(function (g) {
1028
1072
  return RequestUtils.processResponseByType(g);
1029
1073
  }).then( /*#__PURE__*/function () {
1030
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(g) {
1074
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(g) {
1031
1075
  var S, E, v, y;
1032
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1033
- while (1) switch (_context10.prev = _context10.next) {
1076
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1077
+ while (1) switch (_context11.prev = _context11.next) {
1034
1078
  case 0:
1035
1079
  if (e.extractResultData) {
1036
- _context10.next = 2;
1080
+ _context11.next = 2;
1037
1081
  break;
1038
1082
  }
1039
- return _context10.abrupt("return");
1083
+ return _context11.abrupt("return");
1040
1084
  case 2:
1041
- _context10.next = 4;
1085
+ _context11.next = 4;
1042
1086
  return (E = (S = e.deepChat).responseInterceptor) == null ? void 0 : E.call(S, g);
1043
1087
  case 4:
1044
- _context10.t0 = _context10.sent;
1045
- if (_context10.t0) {
1046
- _context10.next = 7;
1088
+ _context11.t0 = _context11.sent;
1089
+ if (_context11.t0) {
1090
+ _context11.next = 7;
1047
1091
  break;
1048
1092
  }
1049
- _context10.t0 = g;
1093
+ _context11.t0 = g;
1050
1094
  case 7:
1051
- v = _context10.t0;
1052
- _context10.next = 10;
1095
+ v = _context11.t0;
1096
+ _context11.next = 10;
1053
1097
  return e.extractResultData(v);
1054
1098
  case 10:
1055
- y = _context10.sent;
1099
+ y = _context11.sent;
1056
1100
  if (d) {
1057
- _context10.next = 13;
1101
+ _context11.next = 13;
1058
1102
  break;
1059
1103
  }
1060
1104
  throw g;
1061
1105
  case 13:
1062
1106
  if (!(!y || _typeof(y) != "object")) {
1063
- _context10.next = 15;
1107
+ _context11.next = 15;
1064
1108
  break;
1065
1109
  }
1066
1110
  throw Error(ErrorMessages.INVALID_RESPONSE(g, "response", !!e.deepChat.responseInterceptor, v));
@@ -1068,11 +1112,11 @@ var HTTPRequest = /*#__PURE__*/function () {
1068
1112
  y.pollingInAnotherRequest || (e.deepChat.stream && y.text ? Stream.simulate(n, e.streamHandlers, y.text) : (n.addNewMessage(y, !0, !0), u()));
1069
1113
  case 16:
1070
1114
  case "end":
1071
- return _context10.stop();
1115
+ return _context11.stop();
1072
1116
  }
1073
- }, _callee10);
1117
+ }, _callee11);
1074
1118
  }));
1075
- return function (_x22) {
1119
+ return function (_x23) {
1076
1120
  return _ref3.apply(this, arguments);
1077
1121
  };
1078
1122
  }())["catch"](function (g) {
@@ -1080,11 +1124,11 @@ var HTTPRequest = /*#__PURE__*/function () {
1080
1124
  });
1081
1125
  case 17:
1082
1126
  case "end":
1083
- return _context11.stop();
1127
+ return _context12.stop();
1084
1128
  }
1085
- }, _callee11);
1129
+ }, _callee12);
1086
1130
  }));
1087
- function request(_x19, _x20, _x21) {
1131
+ function request(_x20, _x21, _x22) {
1088
1132
  return _request3.apply(this, arguments);
1089
1133
  }
1090
1134
  return request;
@@ -1097,43 +1141,43 @@ var HTTPRequest = /*#__PURE__*/function () {
1097
1141
  fetch(t, n).then(function (a) {
1098
1142
  return a.json();
1099
1143
  }).then( /*#__PURE__*/function () {
1100
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(a) {
1144
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(a) {
1101
1145
  var c, u, l;
1102
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1103
- while (1) switch (_context12.prev = _context12.next) {
1146
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1147
+ while (1) switch (_context13.prev = _context13.next) {
1104
1148
  case 0:
1105
1149
  if (e.extractPollResultData) {
1106
- _context12.next = 2;
1150
+ _context13.next = 2;
1107
1151
  break;
1108
1152
  }
1109
- return _context12.abrupt("return");
1153
+ return _context13.abrupt("return");
1110
1154
  case 2:
1111
- _context12.t0 = e;
1112
- _context12.next = 5;
1155
+ _context13.t0 = e;
1156
+ _context13.next = 5;
1113
1157
  return (u = (c = e.deepChat).responseInterceptor) == null ? void 0 : u.call(c, a);
1114
1158
  case 5:
1115
- _context12.t1 = _context12.sent;
1116
- if (_context12.t1) {
1117
- _context12.next = 8;
1159
+ _context13.t1 = _context13.sent;
1160
+ if (_context13.t1) {
1161
+ _context13.next = 8;
1118
1162
  break;
1119
1163
  }
1120
- _context12.t1 = a;
1164
+ _context13.t1 = a;
1121
1165
  case 8:
1122
- _context12.t2 = _context12.t1;
1123
- _context12.next = 11;
1124
- return _context12.t0.extractPollResultData.call(_context12.t0, _context12.t2);
1166
+ _context13.t2 = _context13.t1;
1167
+ _context13.next = 11;
1168
+ return _context13.t0.extractPollResultData.call(_context13.t0, _context13.t2);
1125
1169
  case 11:
1126
- l = _context12.sent;
1170
+ l = _context13.sent;
1127
1171
  l.timeoutMS ? setTimeout(function () {
1128
1172
  HTTPRequest.executePollRequest(e, t, n, s);
1129
1173
  }, l.timeoutMS) : (console.log("finished polling"), s.addNewMessage(l, !0, !0), o());
1130
1174
  case 13:
1131
1175
  case "end":
1132
- return _context12.stop();
1176
+ return _context13.stop();
1133
1177
  }
1134
- }, _callee12);
1178
+ }, _callee13);
1135
1179
  }));
1136
- return function (_x23) {
1180
+ return function (_x24) {
1137
1181
  return _ref4.apply(this, arguments);
1138
1182
  };
1139
1183
  }())["catch"](function (a) {
@@ -1144,9 +1188,9 @@ var HTTPRequest = /*#__PURE__*/function () {
1144
1188
  }, {
1145
1189
  key: "poll",
1146
1190
  value: function () {
1147
- var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(e, t, n) {
1191
+ var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(e, t, n) {
1148
1192
  var s,
1149
- f,
1193
+ p,
1150
1194
  b,
1151
1195
  m,
1152
1196
  o,
@@ -1157,42 +1201,42 @@ var HTTPRequest = /*#__PURE__*/function () {
1157
1201
  u,
1158
1202
  d,
1159
1203
  h,
1160
- p,
1161
- _args13 = arguments;
1162
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1163
- while (1) switch (_context13.prev = _context13.next) {
1204
+ f,
1205
+ _args14 = arguments;
1206
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1207
+ while (1) switch (_context14.prev = _context14.next) {
1164
1208
  case 0:
1165
- s = _args13.length > 3 && _args13[3] !== undefined ? _args13[3] : !0;
1209
+ s = _args14.length > 3 && _args14[3] !== undefined ? _args14[3] : !0;
1166
1210
  o = {
1167
1211
  body: t,
1168
- headers: (f = e.requestSettings) == null ? void 0 : f.headers
1212
+ headers: (p = e.requestSettings) == null ? void 0 : p.headers
1169
1213
  };
1170
- _context13.next = 4;
1214
+ _context14.next = 4;
1171
1215
  return RequestUtils.processRequestInterceptor(e.deepChat, o);
1172
1216
  case 4:
1173
- _yield$RequestUtils$p3 = _context13.sent;
1217
+ _yield$RequestUtils$p3 = _context14.sent;
1174
1218
  a = _yield$RequestUtils$p3.body;
1175
1219
  l = _yield$RequestUtils$p3.headers;
1176
1220
  c = _yield$RequestUtils$p3.error;
1177
1221
  if (!c) {
1178
- _context13.next = 10;
1222
+ _context14.next = 10;
1179
1223
  break;
1180
1224
  }
1181
- return _context13.abrupt("return", HTTPRequest.onInterceptorError(n, c));
1225
+ return _context14.abrupt("return", HTTPRequest.onInterceptorError(n, c));
1182
1226
  case 10:
1183
- u = ((b = e.requestSettings) == null ? void 0 : b.url) || e.url || "", d = ((m = e.requestSettings) == null ? void 0 : m.method) || "POST", h = s ? JSON.stringify(a) : a, p = {
1227
+ u = ((b = e.requestSettings) == null ? void 0 : b.url) || e.url || "", d = ((m = e.requestSettings) == null ? void 0 : m.method) || "POST", h = s ? JSON.stringify(a) : a, f = {
1184
1228
  method: d,
1185
1229
  body: h,
1186
1230
  headers: l
1187
1231
  };
1188
- HTTPRequest.executePollRequest(e, u, p, n);
1232
+ HTTPRequest.executePollRequest(e, u, f, n);
1189
1233
  case 12:
1190
1234
  case "end":
1191
- return _context13.stop();
1235
+ return _context14.stop();
1192
1236
  }
1193
- }, _callee13);
1237
+ }, _callee14);
1194
1238
  }));
1195
- function poll(_x24, _x25, _x26) {
1239
+ function poll(_x25, _x26, _x27) {
1196
1240
  return _poll.apply(this, arguments);
1197
1241
  }
1198
1242
  return poll;
@@ -1285,15 +1329,19 @@ var Websocket = /*#__PURE__*/function () {
1285
1329
  value: function createConnection(e, t) {
1286
1330
  if (!document.body.contains(e.deepChat)) return;
1287
1331
  var n = e.requestSettings.websocket;
1288
- if (n) try {
1289
- var _s = typeof n != "boolean" ? n : void 0;
1290
- e.websocket = new WebSocket(e.requestSettings.url || "", _s), e.websocket.onopen = function () {
1291
- t.removeError(), e.websocket && _typeof(e.websocket) == "object" && Websocket.assignListeners(e, e.websocket, t);
1292
- }, e.websocket.onerror = function (o) {
1293
- console.error(o), Websocket.retryConnection(e, t);
1294
- };
1295
- } catch (s) {
1296
- console.error(s), Websocket.retryConnection(e, t);
1332
+ if (n) {
1333
+ if (e.requestSettings.handler) return CustomHandler.websocket(e, t);
1334
+ try {
1335
+ var _s = typeof n != "boolean" ? n : void 0,
1336
+ _o = new WebSocket(e.requestSettings.url || "", _s);
1337
+ e.websocket = _o, e.websocket.onopen = function () {
1338
+ t.removeError(), e.websocket && _typeof(e.websocket) == "object" && Websocket.assignListeners(e, _o, t);
1339
+ }, e.websocket.onerror = function (a) {
1340
+ console.error(a), Websocket.retryConnection(e, t);
1341
+ };
1342
+ } catch (s) {
1343
+ console.error(s), Websocket.retryConnection(e, t);
1344
+ }
1297
1345
  }
1298
1346
  }
1299
1347
  }, {
@@ -1307,112 +1355,135 @@ var Websocket = /*#__PURE__*/function () {
1307
1355
  key: "assignListeners",
1308
1356
  value: function assignListeners(e, t, n) {
1309
1357
  t.onmessage = /*#__PURE__*/function () {
1310
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(s) {
1358
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(s) {
1311
1359
  var o, a, l, c, u;
1312
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1313
- while (1) switch (_context14.prev = _context14.next) {
1360
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1361
+ while (1) switch (_context15.prev = _context15.next) {
1314
1362
  case 0:
1315
1363
  if (!e.extractResultData) {
1316
- _context14.next = 20;
1364
+ _context15.next = 20;
1317
1365
  break;
1318
1366
  }
1319
- _context14.prev = 1;
1367
+ _context15.prev = 1;
1320
1368
  l = JSON.parse(s.data);
1321
- _context14.next = 5;
1369
+ _context15.next = 5;
1322
1370
  return (a = (o = e.deepChat).responseInterceptor) == null ? void 0 : a.call(o, l);
1323
1371
  case 5:
1324
- _context14.t0 = _context14.sent;
1325
- if (_context14.t0) {
1326
- _context14.next = 8;
1372
+ _context15.t0 = _context15.sent;
1373
+ if (_context15.t0) {
1374
+ _context15.next = 8;
1327
1375
  break;
1328
1376
  }
1329
- _context14.t0 = l;
1377
+ _context15.t0 = l;
1330
1378
  case 8:
1331
- c = _context14.t0;
1332
- _context14.next = 11;
1379
+ c = _context15.t0;
1380
+ _context15.next = 11;
1333
1381
  return e.extractResultData(c);
1334
1382
  case 11:
1335
- u = _context14.sent;
1383
+ u = _context15.sent;
1336
1384
  if (!(!u || _typeof(u) != "object")) {
1337
- _context14.next = 14;
1385
+ _context15.next = 14;
1338
1386
  break;
1339
1387
  }
1340
1388
  throw Error(ErrorMessages.INVALID_RESPONSE(l, "server", !!e.deepChat.responseInterceptor, c));
1341
1389
  case 14:
1342
1390
  e.deepChat.stream && u.text ? Stream.simulate(n, e.streamHandlers, u.text) : n.addNewMessage(u, !0, !0);
1343
- _context14.next = 20;
1391
+ _context15.next = 20;
1344
1392
  break;
1345
1393
  case 17:
1346
- _context14.prev = 17;
1347
- _context14.t1 = _context14["catch"](1);
1348
- RequestUtils.displayError(n, _context14.t1, "Error in server message");
1394
+ _context15.prev = 17;
1395
+ _context15.t1 = _context15["catch"](1);
1396
+ RequestUtils.displayError(n, _context15.t1, "Error in server message");
1349
1397
  case 20:
1350
1398
  case "end":
1351
- return _context14.stop();
1399
+ return _context15.stop();
1352
1400
  }
1353
- }, _callee14, null, [[1, 17]]);
1401
+ }, _callee15, null, [[1, 17]]);
1354
1402
  }));
1355
- return function (_x27) {
1403
+ return function (_x28) {
1356
1404
  return _ref5.apply(this, arguments);
1357
1405
  };
1358
- }(), t.onerror = function (s) {
1359
- console.error(s), n.isLastMessageError() || n.addNewErrorMessage("service", "Connection error");
1360
- }, t.onclose = function () {
1406
+ }(), t.onclose = function () {
1361
1407
  console.error("Connection closed"), n.isLastMessageError() || n.addNewErrorMessage("service", "Connection error"), Websocket.createConnection(e, n);
1362
1408
  };
1363
1409
  }
1364
1410
  }, {
1365
1411
  key: "sendWebsocket",
1366
1412
  value: function () {
1367
- var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(e, t, n, s) {
1368
- var o,
1413
+ var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(e, t, n) {
1414
+ var s,
1369
1415
  d,
1370
1416
  h,
1417
+ o,
1371
1418
  a,
1372
1419
  _yield$RequestUtils$p4,
1373
1420
  l,
1374
1421
  c,
1375
1422
  u,
1376
- _args15 = arguments;
1377
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1378
- while (1) switch (_context15.prev = _context15.next) {
1423
+ _args16 = arguments;
1424
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1425
+ while (1) switch (_context16.prev = _context16.next) {
1379
1426
  case 0:
1380
- o = _args15.length > 4 && _args15[4] !== undefined ? _args15[4] : !0;
1427
+ s = _args16.length > 3 && _args16[3] !== undefined ? _args16[3] : !0;
1428
+ o = e.websocket;
1429
+ if (!(!o || o === "pending")) {
1430
+ _context16.next = 4;
1431
+ break;
1432
+ }
1433
+ return _context16.abrupt("return");
1434
+ case 4:
1381
1435
  a = {
1382
- body: n,
1383
- headers: (d = t.requestSettings) == null ? void 0 : d.headers
1436
+ body: t,
1437
+ headers: (d = e.requestSettings) == null ? void 0 : d.headers
1384
1438
  };
1385
- _context15.next = 4;
1386
- return RequestUtils.processRequestInterceptor(t.deepChat, a);
1387
- case 4:
1388
- _yield$RequestUtils$p4 = _context15.sent;
1439
+ _context16.next = 7;
1440
+ return RequestUtils.processRequestInterceptor(e.deepChat, a);
1441
+ case 7:
1442
+ _yield$RequestUtils$p4 = _context16.sent;
1389
1443
  l = _yield$RequestUtils$p4.body;
1390
1444
  c = _yield$RequestUtils$p4.error;
1391
1445
  if (!c) {
1392
- _context15.next = 9;
1446
+ _context16.next = 12;
1393
1447
  break;
1394
1448
  }
1395
- return _context15.abrupt("return", s.addNewErrorMessage("service", c));
1396
- case 9:
1397
- u = o ? JSON.stringify(l) : l;
1398
- if (!(((h = t.requestSettings) == null ? void 0 : h.url) === Demo.URL)) {
1399
- _context15.next = 12;
1449
+ return _context16.abrupt("return", n.addNewErrorMessage("service", c));
1450
+ case 12:
1451
+ if (Websocket.isWebSocket(o)) {
1452
+ _context16.next = 14;
1400
1453
  break;
1401
1454
  }
1402
- return _context15.abrupt("return", Demo.request(s, t.completionsHandlers.onFinish, t.deepChat.responseInterceptor));
1403
- case 12:
1404
- e.readyState === void 0 || e.readyState !== e.OPEN ? (console.error("Connection is not open"), s.isLastMessageError() || s.addNewErrorMessage("service", "Connection error")) : e.send(JSON.stringify(u));
1405
- case 13:
1455
+ return _context16.abrupt("return", o.newUserMessage.listener(l));
1456
+ case 14:
1457
+ u = s ? JSON.stringify(l) : l;
1458
+ if (!(((h = e.requestSettings) == null ? void 0 : h.url) === Demo.URL)) {
1459
+ _context16.next = 17;
1460
+ break;
1461
+ }
1462
+ return _context16.abrupt("return", Demo.request(n, e.completionsHandlers.onFinish, e.deepChat.responseInterceptor));
1463
+ case 17:
1464
+ o.readyState === void 0 || o.readyState !== o.OPEN ? (console.error("Connection is not open"), n.isLastMessageError() || n.addNewErrorMessage("service", "Connection error")) : o.send(JSON.stringify(u));
1465
+ case 18:
1406
1466
  case "end":
1407
- return _context15.stop();
1467
+ return _context16.stop();
1408
1468
  }
1409
- }, _callee15);
1469
+ }, _callee16);
1410
1470
  }));
1411
- function sendWebsocket(_x28, _x29, _x30, _x31) {
1471
+ function sendWebsocket(_x29, _x30, _x31) {
1412
1472
  return _sendWebsocket.apply(this, arguments);
1413
1473
  }
1414
1474
  return sendWebsocket;
1415
1475
  }()
1476
+ }, {
1477
+ key: "canSendMessage",
1478
+ value: function canSendMessage(e) {
1479
+ return e ? e === "pending" ? !1 : Websocket.isWebSocket(e) ? e.readyState !== void 0 && e.readyState === e.OPEN : e.isOpen : !0;
1480
+ }
1481
+ // if false then it is the internal websocket handler
1482
+ }, {
1483
+ key: "isWebSocket",
1484
+ value: function isWebSocket(e) {
1485
+ return e.send !== void 0;
1486
+ }
1416
1487
  }]);
1417
1488
  return Websocket;
1418
1489
  }();
@@ -1903,13 +1974,13 @@ function normalizeReference(r) {
1903
1974
  return r.trim().replace(/\s+/g, " ").toUpperCase();
1904
1975
  }
1905
1976
  function parseReference(r, e, t, n) {
1906
- var s, o, a, l, c, u, d, h, p;
1977
+ var s, o, a, l, c, u, d, h, f;
1907
1978
  if (r.charCodeAt(0) !== 91 || r.indexOf("]:") === -1 || (s = new StateInline(r, e, t, n, []), o = parseLinkLabel(s, 0), o < 0 || r.charCodeAt(o + 1) !== 58)) return -1;
1908
1979
  for (l = s.posMax, a = o + 2; a < l && (c = s.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);
1909
1980
  if (!parseLinkDestination(s, a)) return -1;
1910
1981
  for (d = s.linkContent, a = s.pos, u = a, a = a + 1; a < l && (c = s.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);
1911
1982
  for (a < l && u !== a && parseLinkTitle(s, a) ? (h = s.linkContent, a = s.pos) : (h = "", a = u); a < l && s.src.charCodeAt(a) === 32;) a++;
1912
- return a < l && s.src.charCodeAt(a) !== 10 ? -1 : (p = normalizeReference(r.slice(1, o)), _typeof(n.references[p]) > "u" && (n.references[p] = {
1983
+ return a < l && s.src.charCodeAt(a) !== 10 ? -1 : (f = normalizeReference(r.slice(1, o)), _typeof(n.references[f]) > "u" && (n.references[f] = {
1913
1984
  title: h,
1914
1985
  href: d
1915
1986
  }), a);
@@ -1946,9 +2017,9 @@ function footnote_block(r) {
1946
2017
  u,
1947
2018
  d = 0,
1948
2019
  h = !1,
1949
- p = {};
1950
- if (r.env.footnotes && (r.tokens = r.tokens.filter(function (f) {
1951
- return f.type === "footnote_reference_open" ? (h = !0, c = [], u = f.label, !1) : f.type === "footnote_reference_close" ? (h = !1, p[":" + u] = c, !1) : (h && c.push(f), !h);
2020
+ f = {};
2021
+ if (r.env.footnotes && (r.tokens = r.tokens.filter(function (p) {
2022
+ return p.type === "footnote_reference_open" ? (h = !0, c = [], u = p.label, !1) : p.type === "footnote_reference_close" ? (h = !1, f[":" + u] = c, !1) : (h && c.push(p), !h);
1952
2023
  }), !!r.env.footnotes.list)) {
1953
2024
  for (a = r.env.footnotes.list, r.tokens.push({
1954
2025
  type: "footnote_block_open",
@@ -1971,7 +2042,7 @@ function footnote_block(r) {
1971
2042
  type: "paragraph_close",
1972
2043
  tight: !1,
1973
2044
  level: --d
1974
- })) : a[e].label && (l = p[":" + a[e].label]), r.tokens = r.tokens.concat(l), r.tokens[r.tokens.length - 1].type === "paragraph_close" ? o = r.tokens.pop() : o = null, s = a[e].count > 0 ? a[e].count : 1, n = 0; n < s; n++) r.tokens.push({
2045
+ })) : a[e].label && (l = f[":" + a[e].label]), r.tokens = r.tokens.concat(l), r.tokens[r.tokens.length - 1].type === "paragraph_close" ? o = r.tokens.pop() : o = null, s = a[e].count > 0 ? a[e].count : 1, n = 0; n < s; n++) r.tokens.push({
1975
2046
  type: "footnote_anchor",
1976
2047
  id: e,
1977
2048
  subId: n,
@@ -2004,15 +2075,15 @@ function abbr2(r) {
2004
2075
  u,
2005
2076
  d,
2006
2077
  h,
2007
- p,
2008
- f = r.tokens;
2078
+ f,
2079
+ p = r.tokens;
2009
2080
  if (r.env.abbreviations) {
2010
- for (r.env.abbrRegExp || (p = "(^|[" + PUNCT_CHARS.split("").map(regEscape).join("") + "])(" + Object.keys(r.env.abbreviations).map(function (b) {
2081
+ for (r.env.abbrRegExp || (f = "(^|[" + PUNCT_CHARS.split("").map(regEscape).join("") + "])(" + Object.keys(r.env.abbreviations).map(function (b) {
2011
2082
  return b.substr(1);
2012
2083
  }).sort(function (b, m) {
2013
2084
  return m.length - b.length;
2014
- }).map(regEscape).join("|") + ")($|[" + PUNCT_CHARS.split("").map(regEscape).join("") + "])", r.env.abbrRegExp = new RegExp(p, "g")), d = r.env.abbrRegExp, t = 0, n = f.length; t < n; t++) if (f[t].type === "inline") {
2015
- for (s = f[t].children, e = s.length - 1; e >= 0; e--) if (o = s[e], o.type === "text") {
2085
+ }).map(regEscape).join("|") + ")($|[" + PUNCT_CHARS.split("").map(regEscape).join("") + "])", r.env.abbrRegExp = new RegExp(f, "g")), d = r.env.abbrRegExp, t = 0, n = p.length; t < n; t++) if (p[t].type === "inline") {
2086
+ for (s = p[t].children, e = s.length - 1; e >= 0; e--) if (o = s[e], o.type === "text") {
2016
2087
  for (c = 0, a = o.content, d.lastIndex = 0, u = o.level, l = []; h = d.exec(a);) d.lastIndex > c && l.push({
2017
2088
  type: "text",
2018
2089
  content: a.slice(c, h.index + h[1].length),
@@ -2033,7 +2104,7 @@ function abbr2(r) {
2033
2104
  type: "text",
2034
2105
  content: a.slice(c),
2035
2106
  level: u
2036
- }), f[t].children = s = [].concat(s.slice(0, e), l, s.slice(e + 1)));
2107
+ }), p[t].children = s = [].concat(s.slice(0, e), l, s.slice(e + 1)));
2037
2108
  }
2038
2109
  }
2039
2110
  }
@@ -2068,20 +2139,20 @@ function replaceAt(r, e, t) {
2068
2139
  return r.substr(0, e) + t + r.substr(e + 1);
2069
2140
  }
2070
2141
  function smartquotes(r) {
2071
- var e, t, n, s, o, a, l, c, u, d, h, p, f, b, m, g, v;
2142
+ var e, t, n, s, o, a, l, c, u, d, h, f, p, b, m, g, v;
2072
2143
  if (r.options.typographer) {
2073
2144
  for (v = [], m = r.tokens.length - 1; m >= 0; m--) if (r.tokens[m].type === "inline") {
2074
2145
  for (g = r.tokens[m].children, v.length = 0, e = 0; e < g.length; e++) if (t = g[e], !(t.type !== "text" || QUOTE_TEST_RE.test(t.text))) {
2075
- for (l = g[e].level, f = v.length - 1; f >= 0 && !(v[f].level <= l); f--);
2076
- v.length = f + 1, n = t.content, o = 0, a = n.length;
2146
+ for (l = g[e].level, p = v.length - 1; p >= 0 && !(v[p].level <= l); p--);
2147
+ v.length = p + 1, n = t.content, o = 0, a = n.length;
2077
2148
  e: for (; o < a && (QUOTE_RE.lastIndex = o, s = QUOTE_RE.exec(n), !!s);) {
2078
2149
  if (c = !isLetter(n, s.index - 1), o = s.index + 1, b = s[0] === "'", u = !isLetter(n, o), !u && !c) {
2079
2150
  b && (t.content = replaceAt(t.content, s.index, APOSTROPHE));
2080
2151
  continue;
2081
2152
  }
2082
- if (h = !u, p = !c, p) {
2083
- for (f = v.length - 1; f >= 0 && (d = v[f], !(v[f].level < l)); f--) if (d.single === b && v[f].level === l) {
2084
- d = v[f], b ? (g[d.token].content = replaceAt(g[d.token].content, d.pos, r.options.quotes[2]), t.content = replaceAt(t.content, s.index, r.options.quotes[3])) : (g[d.token].content = replaceAt(g[d.token].content, d.pos, r.options.quotes[0]), t.content = replaceAt(t.content, s.index, r.options.quotes[1])), v.length = f;
2153
+ if (h = !u, f = !c, f) {
2154
+ for (p = v.length - 1; p >= 0 && (d = v[p], !(v[p].level < l)); p--) if (d.single === b && v[p].level === l) {
2155
+ d = v[p], b ? (g[d.token].content = replaceAt(g[d.token].content, d.pos, r.options.quotes[2]), t.content = replaceAt(t.content, s.index, r.options.quotes[3])) : (g[d.token].content = replaceAt(g[d.token].content, d.pos, r.options.quotes[0]), t.content = replaceAt(t.content, s.index, r.options.quotes[1])), v.length = p;
2085
2156
  continue e;
2086
2157
  }
2087
2158
  }
@@ -2090,7 +2161,7 @@ function smartquotes(r) {
2090
2161
  pos: s.index,
2091
2162
  single: b,
2092
2163
  level: l
2093
- }) : p && b && (t.content = replaceAt(t.content, s.index, APOSTROPHE));
2164
+ }) : f && b && (t.content = replaceAt(t.content, s.index, APOSTROPHE));
2094
2165
  }
2095
2166
  }
2096
2167
  }
@@ -2202,8 +2273,8 @@ function blockquote(r, e, t, n) {
2202
2273
  u,
2203
2274
  d,
2204
2275
  h,
2205
- p,
2206
2276
  f,
2277
+ p,
2207
2278
  b,
2208
2279
  m = r.bMarks[e] + r.tShift[e],
2209
2280
  g = r.eMarks[e];
@@ -2215,7 +2286,7 @@ function blockquote(r, e, t, n) {
2215
2286
  continue;
2216
2287
  }
2217
2288
  if (o) break;
2218
- for (b = !1, p = 0, f = h.length; p < f; p++) if (h[p](r, s, t, !0)) {
2289
+ for (b = !1, f = 0, p = h.length; f < p; f++) if (h[f](r, s, t, !0)) {
2219
2290
  b = !0;
2220
2291
  break;
2221
2292
  }
@@ -2229,7 +2300,7 @@ function blockquote(r, e, t, n) {
2229
2300
  }), r.parser.tokenize(r, e, s), r.tokens.push({
2230
2301
  type: "blockquote_close",
2231
2302
  level: --r.level
2232
- }), r.parentType = u, d[1] = r.line, p = 0; p < a.length; p++) r.bMarks[p + e] = l[p], r.tShift[p + e] = a[p];
2303
+ }), r.parentType = u, d[1] = r.line, f = 0; f < a.length; f++) r.bMarks[f + e] = l[f], r.tShift[f + e] = a[f];
2233
2304
  return r.blkIndent = c, !0;
2234
2305
  }
2235
2306
  function hr(r, e, t, n) {
@@ -2282,8 +2353,8 @@ function list(r, e, t, n) {
2282
2353
  u,
2283
2354
  d,
2284
2355
  h,
2285
- p,
2286
2356
  f,
2357
+ p,
2287
2358
  b,
2288
2359
  m,
2289
2360
  g,
@@ -2293,7 +2364,7 @@ function list(r, e, t, n) {
2293
2364
  E,
2294
2365
  x,
2295
2366
  R = !0,
2296
- w,
2367
+ C,
2297
2368
  _,
2298
2369
  H,
2299
2370
  F;
@@ -2309,7 +2380,7 @@ function list(r, e, t, n) {
2309
2380
  type: "bullet_list_open",
2310
2381
  lines: E = [e, 0],
2311
2382
  level: r.level++
2312
- }), s = e, S = !1, w = r.parser.ruler.getRules("list"); s < t && (v = r.skipSpaces(h), p = r.eMarks[s], v >= p ? f = 1 : f = v - h, f > 4 && (f = 1), f < 1 && (f = 1), o = h - r.bMarks[s] + f, r.tokens.push({
2383
+ }), s = e, S = !1, C = r.parser.ruler.getRules("list"); s < t && (v = r.skipSpaces(h), f = r.eMarks[s], v >= f ? p = 1 : p = v - h, p > 4 && (p = 1), p < 1 && (p = 1), o = h - r.bMarks[s] + p, r.tokens.push({
2313
2384
  type: "list_item_open",
2314
2385
  lines: x = [e, 0],
2315
2386
  level: r.level++
@@ -2317,7 +2388,7 @@ function list(r, e, t, n) {
2317
2388
  type: "list_item_close",
2318
2389
  level: --r.level
2319
2390
  }), s = e = r.line, x[1] = s, v = r.bMarks[e], !(s >= t || r.isEmpty(s) || r.tShift[s] < r.blkIndent));) {
2320
- for (F = !1, _ = 0, H = w.length; _ < H; _++) if (w[_](r, s, t, !0)) {
2391
+ for (F = !1, _ = 0, H = C.length; _ < H; _++) if (C[_](r, s, t, !0)) {
2321
2392
  F = !0;
2322
2393
  break;
2323
2394
  }
@@ -2442,21 +2513,21 @@ function getLine(r, e) {
2442
2513
  return r.src.substr(t, n - t);
2443
2514
  }
2444
2515
  function table(r, e, t, n) {
2445
- var s, o, a, l, c, u, d, h, p, f, b;
2516
+ var s, o, a, l, c, u, d, h, f, p, b;
2446
2517
  if (e + 2 > t || (c = e + 1, r.tShift[c] < r.blkIndent) || (a = r.bMarks[c] + r.tShift[c], a >= r.eMarks[c]) || (s = r.src.charCodeAt(a), s !== 124 && s !== 45 && s !== 58) || (o = getLine(r, e + 1), !/^[-:| ]+$/.test(o)) || (u = o.split("|"), u <= 2)) return !1;
2447
2518
  for (h = [], l = 0; l < u.length; l++) {
2448
- if (p = u[l].trim(), !p) {
2519
+ if (f = u[l].trim(), !f) {
2449
2520
  if (l === 0 || l === u.length - 1) continue;
2450
2521
  return !1;
2451
2522
  }
2452
- if (!/^:?-+:?$/.test(p)) return !1;
2453
- p.charCodeAt(p.length - 1) === 58 ? h.push(p.charCodeAt(0) === 58 ? "center" : "right") : p.charCodeAt(0) === 58 ? h.push("left") : h.push("");
2523
+ if (!/^:?-+:?$/.test(f)) return !1;
2524
+ f.charCodeAt(f.length - 1) === 58 ? h.push(f.charCodeAt(0) === 58 ? "center" : "right") : f.charCodeAt(0) === 58 ? h.push("left") : h.push("");
2454
2525
  }
2455
2526
  if (o = getLine(r, e).trim(), o.indexOf("|") === -1 || (u = o.replace(/^\||\|$/g, "").split("|"), h.length !== u.length)) return !1;
2456
2527
  if (n) return !0;
2457
2528
  for (r.tokens.push({
2458
2529
  type: "table_open",
2459
- lines: f = [e, 0],
2530
+ lines: p = [e, 0],
2460
2531
  level: r.level++
2461
2532
  }), r.tokens.push({
2462
2533
  type: "thead_open",
@@ -2519,7 +2590,7 @@ function table(r, e, t, n) {
2519
2590
  }), r.tokens.push({
2520
2591
  type: "table_close",
2521
2592
  level: --r.level
2522
- }), f[1] = b[1] = c, r.line = c, !0;
2593
+ }), p[1] = b[1] = c, r.line = c, !0;
2523
2594
  }
2524
2595
  function skipMarker(r, e) {
2525
2596
  var t,
@@ -2535,7 +2606,7 @@ function markTightParagraphs$1(r, e) {
2535
2606
  for (t = e + 2, n = r.tokens.length - 2; t < n; t++) r.tokens[t].level === s && r.tokens[t].type === "paragraph_open" && (r.tokens[t + 2].tight = !0, r.tokens[t].tight = !0, t += 2);
2536
2607
  }
2537
2608
  function deflist(r, e, t, n) {
2538
- var s, o, a, l, c, u, d, h, p, f, b, m, g, v;
2609
+ var s, o, a, l, c, u, d, h, f, p, b, m, g, v;
2539
2610
  if (n) return r.ddIndent < 0 ? !1 : skipMarker(r, e) >= 0;
2540
2611
  if (d = e + 1, r.isEmpty(d) && ++d > t || r.tShift[d] < r.blkIndent || (s = skipMarker(r, d), s < 0) || r.level >= r.options.maxNesting) return !1;
2541
2612
  u = r.tokens.length, r.tokens.push({
@@ -2562,7 +2633,7 @@ function deflist(r, e, t, n) {
2562
2633
  type: "dd_open",
2563
2634
  lines: l = [d, 0],
2564
2635
  level: r.level++
2565
- }), m = r.tight, p = r.ddIndent, h = r.blkIndent, b = r.tShift[o], f = r.parentType, r.blkIndent = r.ddIndent = r.tShift[o] + 2, r.tShift[o] = s - r.bMarks[o], r.tight = !0, r.parentType = "deflist", r.parser.tokenize(r, o, t, !0), (!r.tight || g) && (v = !1), g = r.line - o > 1 && r.isEmpty(r.line - 1), r.tShift[o] = b, r.tight = m, r.parentType = f, r.blkIndent = h, r.ddIndent = p, r.tokens.push({
2636
+ }), m = r.tight, f = r.ddIndent, h = r.blkIndent, b = r.tShift[o], p = r.parentType, r.blkIndent = r.ddIndent = r.tShift[o] + 2, r.tShift[o] = s - r.bMarks[o], r.tight = !0, r.parentType = "deflist", r.parser.tokenize(r, o, t, !0), (!r.tight || g) && (v = !1), g = r.line - o > 1 && r.isEmpty(r.line - 1), r.tShift[o] = b, r.tight = m, r.parentType = p, r.blkIndent = h, r.ddIndent = f, r.tokens.push({
2566
2637
  type: "dd_close",
2567
2638
  level: --r.level
2568
2639
  }), l[1] = d = r.line, d >= t || r.tShift[d] < r.blkIndent) break e;
@@ -2939,21 +3010,21 @@ function links(r, e) {
2939
3010
  u,
2940
3011
  d = !1,
2941
3012
  h = r.pos,
2942
- p = r.posMax,
2943
- f = r.pos,
2944
- b = r.src.charCodeAt(f);
2945
- if (b === 33 && (d = !0, b = r.src.charCodeAt(++f)), b !== 91 || r.level >= r.options.maxNesting || (t = f + 1, n = parseLinkLabel(r, f), n < 0)) return !1;
2946
- if (l = n + 1, l < p && r.src.charCodeAt(l) === 40) {
2947
- for (l++; l < p && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
2948
- if (l >= p) return !1;
2949
- for (f = l, parseLinkDestination(r, l) ? (o = r.linkContent, l = r.pos) : o = "", f = l; l < p && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
2950
- if (l < p && f !== l && parseLinkTitle(r, l)) for (a = r.linkContent, l = r.pos; l < p && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);else a = "";
2951
- if (l >= p || r.src.charCodeAt(l) !== 41) return r.pos = h, !1;
3013
+ f = r.posMax,
3014
+ p = r.pos,
3015
+ b = r.src.charCodeAt(p);
3016
+ if (b === 33 && (d = !0, b = r.src.charCodeAt(++p)), b !== 91 || r.level >= r.options.maxNesting || (t = p + 1, n = parseLinkLabel(r, p), n < 0)) return !1;
3017
+ if (l = n + 1, l < f && r.src.charCodeAt(l) === 40) {
3018
+ for (l++; l < f && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
3019
+ if (l >= f) return !1;
3020
+ for (p = l, parseLinkDestination(r, l) ? (o = r.linkContent, l = r.pos) : o = "", p = l; l < f && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
3021
+ if (l < f && p !== l && parseLinkTitle(r, l)) for (a = r.linkContent, l = r.pos; l < f && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);else a = "";
3022
+ if (l >= f || r.src.charCodeAt(l) !== 41) return r.pos = h, !1;
2952
3023
  l++;
2953
3024
  } else {
2954
3025
  if (r.linkLevel > 0) return !1;
2955
- for (; l < p && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
2956
- if (l < p && r.src.charCodeAt(l) === 91 && (f = l + 1, l = parseLinkLabel(r, l), l >= 0 ? s = r.src.slice(f, l++) : l = f - 1), s || (_typeof(s) > "u" && (l = n + 1), s = r.src.slice(t, n)), c = r.env.references[normalizeReference(s)], !c) return r.pos = h, !1;
3026
+ for (; l < f && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
3027
+ if (l < f && r.src.charCodeAt(l) === 91 && (p = l + 1, l = parseLinkLabel(r, l), l >= 0 ? s = r.src.slice(p, l++) : l = p - 1), s || (_typeof(s) > "u" && (l = n + 1), s = r.src.slice(t, n)), c = r.env.references[normalizeReference(s)], !c) return r.pos = h, !1;
2957
3028
  o = c.href, a = c.title;
2958
3029
  }
2959
3030
  return e || (r.pos = t, r.posMax = n, d ? r.push({
@@ -2970,7 +3041,7 @@ function links(r, e) {
2970
3041
  }), r.linkLevel++, r.parser.tokenize(r), r.linkLevel--, r.push({
2971
3042
  type: "link_close",
2972
3043
  level: --r.level
2973
- }))), r.pos = l, r.posMax = p, !0;
3044
+ }))), r.pos = l, r.posMax = f, !0;
2974
3045
  }
2975
3046
  function footnote_inline(r, e) {
2976
3047
  var t,
@@ -3366,12 +3437,12 @@ var SetFileTypes = /*#__PURE__*/function () {
3366
3437
  }, {
3367
3438
  key: "processMicrophone",
3368
3439
  value: function processMicrophone(e, t, n, s) {
3369
- var _c$files, _p$maxNumberOfFiles;
3370
- var l, c, u, d, h, p;
3440
+ var _c$files, _f$maxNumberOfFiles;
3441
+ var l, c, u, d, h, f;
3371
3442
  var a = _objectSpread({
3372
3443
  acceptedFormats: "audio/*"
3373
3444
  }, ((l = e.fileTypes.audio) == null ? void 0 : l.files) || {});
3374
- n && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.recordAudio = SetFileTypes.parseConfig(e.requestSettings, a, t, n), _typeof(n) == "object" && n.files && ((_c$files = (c = e.recordAudio).files) !== null && _c$files !== void 0 ? _c$files : c.files = {}, e.recordAudio.files.format = (u = n.files) == null ? void 0 : u.format, e.recordAudio.files.maxDurationSeconds = (d = n.files) == null ? void 0 : d.maxDurationSeconds, (h = e.fileTypes.audio) != null && h.files && ((_p$maxNumberOfFiles = (p = e.fileTypes.audio.files).maxNumberOfFiles) !== null && _p$maxNumberOfFiles !== void 0 ? _p$maxNumberOfFiles : p.maxNumberOfFiles = n.files.maxNumberOfFiles))) : s || (e.fileTypes.audio = SetFileTypes.parseConfig(e.requestSettings, a, t, n)));
3445
+ n && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.recordAudio = SetFileTypes.parseConfig(e.requestSettings, a, t, n), _typeof(n) == "object" && n.files && ((_c$files = (c = e.recordAudio).files) !== null && _c$files !== void 0 ? _c$files : c.files = {}, e.recordAudio.files.format = (u = n.files) == null ? void 0 : u.format, e.recordAudio.files.maxDurationSeconds = (d = n.files) == null ? void 0 : d.maxDurationSeconds, (h = e.fileTypes.audio) != null && h.files && ((_f$maxNumberOfFiles = (f = e.fileTypes.audio.files).maxNumberOfFiles) !== null && _f$maxNumberOfFiles !== void 0 ? _f$maxNumberOfFiles : f.maxNumberOfFiles = n.files.maxNumberOfFiles))) : s || (e.fileTypes.audio = SetFileTypes.parseConfig(e.requestSettings, a, t, n)));
3375
3446
  }
3376
3447
  // prettier-ignore
3377
3448
  }, {
@@ -3457,11 +3528,11 @@ var BaseServiceIO = /*#__PURE__*/function () {
3457
3528
  }, {
3458
3529
  key: "callServiceAPI",
3459
3530
  value: function () {
3460
- var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(e, t, n) {
3531
+ var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(e, t, n) {
3461
3532
  var _c$headers, _u$ContentType;
3462
3533
  var l, c, u, d, s, o, a;
3463
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
3464
- while (1) switch (_context16.prev = _context16.next) {
3534
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
3535
+ while (1) switch (_context17.prev = _context17.next) {
3465
3536
  case 0:
3466
3537
  s = _objectSpread({
3467
3538
  messages: t
@@ -3470,24 +3541,24 @@ var BaseServiceIO = /*#__PURE__*/function () {
3470
3541
  (l = this.requestSettings.headers) != null && l["Content-Type"] || ((_c$headers = (c = this.requestSettings).headers) !== null && _c$headers !== void 0 ? _c$headers : c.headers = {}, (_u$ContentType = (u = this.requestSettings.headers)["Content-Type"]) !== null && _u$ContentType !== void 0 ? _u$ContentType : u["Content-Type"] = "application/json", o = !0);
3471
3542
  a = this.deepChat.stream;
3472
3543
  if (!(a && (this.demo || _typeof(a) != "object" || !a.simulation))) {
3473
- _context16.next = 9;
3544
+ _context17.next = 9;
3474
3545
  break;
3475
3546
  }
3476
- _context16.next = 7;
3547
+ _context17.next = 7;
3477
3548
  return Stream.request(this, s, e);
3478
3549
  case 7:
3479
- _context16.next = 11;
3550
+ _context17.next = 11;
3480
3551
  break;
3481
3552
  case 9:
3482
- _context16.next = 11;
3553
+ _context17.next = 11;
3483
3554
  return HTTPRequest.request(this, s, e);
3484
3555
  case 11:
3485
3556
  o && ((d = this.requestSettings.headers) == null || delete d["Content-Type"]);
3486
3557
  case 12:
3487
3558
  case "end":
3488
- return _context16.stop();
3559
+ return _context17.stop();
3489
3560
  }
3490
- }, _callee16, this);
3561
+ }, _callee17, this);
3491
3562
  }));
3492
3563
  function callServiceAPI(_x32, _x33, _x34) {
3493
3564
  return _callServiceAPI.apply(this, arguments);
@@ -3497,22 +3568,22 @@ var BaseServiceIO = /*#__PURE__*/function () {
3497
3568
  }, {
3498
3569
  key: "callApiWithFiles",
3499
3570
  value: function () {
3500
- var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(e, t, n, s) {
3571
+ var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(e, t, n, s) {
3501
3572
  var o, a, l;
3502
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
3503
- while (1) switch (_context17.prev = _context17.next) {
3573
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
3574
+ while (1) switch (_context18.prev = _context18.next) {
3504
3575
  case 0:
3505
3576
  o = BaseServiceIO.createCustomFormDataBody(e, n, s), a = this.requestSettings, l = this.getServiceIOByType(s[0]);
3506
3577
  this.requestSettings = (l == null ? void 0 : l.request) || this.requestSettings;
3507
- _context17.next = 4;
3578
+ _context18.next = 4;
3508
3579
  return HTTPRequest.request(this, o, t, !1);
3509
3580
  case 4:
3510
3581
  this.requestSettings = a;
3511
3582
  case 5:
3512
3583
  case "end":
3513
- return _context17.stop();
3584
+ return _context18.stop();
3514
3585
  }
3515
- }, _callee17, this);
3586
+ }, _callee18, this);
3516
3587
  }));
3517
3588
  function callApiWithFiles(_x35, _x36, _x37, _x38) {
3518
3589
  return _callApiWithFiles.apply(this, arguments);
@@ -3522,29 +3593,29 @@ var BaseServiceIO = /*#__PURE__*/function () {
3522
3593
  }, {
3523
3594
  key: "callAPI",
3524
3595
  value: function () {
3525
- var _callAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(e, t) {
3596
+ var _callAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(e, t) {
3526
3597
  var n, _s3;
3527
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
3528
- while (1) switch (_context18.prev = _context18.next) {
3598
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
3599
+ while (1) switch (_context19.prev = _context19.next) {
3529
3600
  case 0:
3530
3601
  if (this.requestSettings) {
3531
- _context18.next = 2;
3602
+ _context19.next = 2;
3532
3603
  break;
3533
3604
  }
3534
3605
  throw new Error("Request settings have not been set up");
3535
3606
  case 2:
3536
3607
  n = MessageLimitUtils.processMessages(e, t.messages, this.maxMessages, this.totalMessagesMaxCharLength);
3537
- if (this.websocket) {
3608
+ if (this.requestSettings.websocket) {
3538
3609
  _s3 = _objectSpread({
3539
3610
  messages: n
3540
3611
  }, this.rawBody);
3541
- Websocket.sendWebsocket(this.websocket, this, _s3, t, !1);
3612
+ Websocket.sendWebsocket(this, _s3, t, !1);
3542
3613
  } else e.files && !this._directServiceRequiresFiles ? this.callApiWithFiles(this.rawBody, t, n, e.files) : this.callServiceAPI(t, n, e.files);
3543
3614
  case 4:
3544
3615
  case "end":
3545
- return _context18.stop();
3616
+ return _context19.stop();
3546
3617
  }
3547
- }, _callee18, this);
3618
+ }, _callee19, this);
3548
3619
  }));
3549
3620
  function callAPI(_x39, _x40) {
3550
3621
  return _callAPI.apply(this, arguments);
@@ -3555,22 +3626,22 @@ var BaseServiceIO = /*#__PURE__*/function () {
3555
3626
  }, {
3556
3627
  key: "extractResultData",
3557
3628
  value: function () {
3558
- var _extractResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(e) {
3559
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
3560
- while (1) switch (_context19.prev = _context19.next) {
3629
+ var _extractResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(e) {
3630
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
3631
+ while (1) switch (_context20.prev = _context20.next) {
3561
3632
  case 0:
3562
3633
  if (!e.error) {
3563
- _context19.next = 2;
3634
+ _context20.next = 2;
3564
3635
  break;
3565
3636
  }
3566
3637
  throw e.error;
3567
3638
  case 2:
3568
- return _context19.abrupt("return", e.result ? (console.error("The {result: ....} response object type is deprecated since version 1.3.0."), console.error("Please change to using the new response object: https://deepchat.dev/docs/connect#Response"), e.result) : e);
3639
+ return _context20.abrupt("return", e.result ? (console.error("The {result: ....} response object type is deprecated since version 1.3.0."), console.error("Please change to using the new response object: https://deepchat.dev/docs/connect#Response"), e.result) : e);
3569
3640
  case 3:
3570
3641
  case "end":
3571
- return _context19.stop();
3642
+ return _context20.stop();
3572
3643
  }
3573
- }, _callee19);
3644
+ }, _callee20);
3574
3645
  }));
3575
3646
  function extractResultData(_x41) {
3576
3647
  return _extractResultData.apply(this, arguments);
@@ -3936,13 +4007,13 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
3936
4007
  }, {
3937
4008
  key: "callServiceAPI",
3938
4009
  value: function () {
3939
- var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(e, t, n) {
4010
+ var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(e, t, n) {
3940
4011
  var s;
3941
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
3942
- while (1) switch (_context20.prev = _context20.next) {
4012
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
4013
+ while (1) switch (_context21.prev = _context21.next) {
3943
4014
  case 0:
3944
4015
  if (this.requestSettings) {
3945
- _context20.next = 2;
4016
+ _context21.next = 2;
3946
4017
  break;
3947
4018
  }
3948
4019
  throw new Error("Request settings have not been set up");
@@ -3951,9 +4022,9 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
3951
4022
  HTTPRequest.request(this, s, e);
3952
4023
  case 4:
3953
4024
  case "end":
3954
- return _context20.stop();
4025
+ return _context21.stop();
3955
4026
  }
3956
- }, _callee20, this);
4027
+ }, _callee21, this);
3957
4028
  }));
3958
4029
  function callServiceAPI(_x42, _x43, _x44) {
3959
4030
  return _callServiceAPI2.apply(this, arguments);
@@ -3984,18 +4055,18 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
3984
4055
  }, {
3985
4056
  key: "callServiceAPI",
3986
4057
  value: function () {
3987
- var _callServiceAPI3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(e, t, n) {
3988
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
3989
- while (1) switch (_context21.prev = _context21.next) {
4058
+ var _callServiceAPI3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(e, t, n) {
4059
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
4060
+ while (1) switch (_context22.prev = _context22.next) {
3990
4061
  case 0:
3991
4062
  if (this.requestSettings) {
3992
- _context21.next = 2;
4063
+ _context22.next = 2;
3993
4064
  break;
3994
4065
  }
3995
4066
  throw new Error("Request settings have not been set up");
3996
4067
  case 2:
3997
4068
  if (n != null && n[0]) {
3998
- _context21.next = 4;
4069
+ _context22.next = 4;
3999
4070
  break;
4000
4071
  }
4001
4072
  throw new Error("No file was added");
@@ -4003,9 +4074,9 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
4003
4074
  HTTPRequest.poll(this, n[0], e, !1);
4004
4075
  case 5:
4005
4076
  case "end":
4006
- return _context21.stop();
4077
+ return _context22.stop();
4007
4078
  }
4008
- }, _callee21, this);
4079
+ }, _callee22, this);
4009
4080
  }));
4010
4081
  function callServiceAPI(_x45, _x46, _x47) {
4011
4082
  return _callServiceAPI3.apply(this, arguments);
@@ -4036,33 +4107,33 @@ var HuggingFaceAudioClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
4036
4107
  _createClass(HuggingFaceAudioClassificationIO, [{
4037
4108
  key: "extractPollResultData",
4038
4109
  value: function () {
4039
- var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(e) {
4110
+ var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(e) {
4040
4111
  var t;
4041
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
4042
- while (1) switch (_context22.prev = _context22.next) {
4112
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
4113
+ while (1) switch (_context23.prev = _context23.next) {
4043
4114
  case 0:
4044
4115
  if (!e.estimated_time) {
4045
- _context22.next = 2;
4116
+ _context23.next = 2;
4046
4117
  break;
4047
4118
  }
4048
- return _context22.abrupt("return", {
4119
+ return _context23.abrupt("return", {
4049
4120
  timeoutMS: (e.estimated_time + 1) * 1e3
4050
4121
  });
4051
4122
  case 2:
4052
4123
  if (!e.error) {
4053
- _context22.next = 4;
4124
+ _context23.next = 4;
4054
4125
  break;
4055
4126
  }
4056
4127
  throw e.error;
4057
4128
  case 4:
4058
- return _context22.abrupt("return", {
4129
+ return _context23.abrupt("return", {
4059
4130
  text: ((t = e[0]) == null ? void 0 : t.label) || ""
4060
4131
  });
4061
4132
  case 5:
4062
4133
  case "end":
4063
- return _context22.stop();
4134
+ return _context23.stop();
4064
4135
  }
4065
- }, _callee22);
4136
+ }, _callee23);
4066
4137
  }));
4067
4138
  function extractPollResultData(_x48) {
4068
4139
  return _extractPollResultData.apply(this, arguments);
@@ -4087,33 +4158,33 @@ var HuggingFaceImageClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
4087
4158
  _createClass(HuggingFaceImageClassificationIO, [{
4088
4159
  key: "extractPollResultData",
4089
4160
  value: function () {
4090
- var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(e) {
4161
+ var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(e) {
4091
4162
  var t;
4092
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
4093
- while (1) switch (_context23.prev = _context23.next) {
4163
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
4164
+ while (1) switch (_context24.prev = _context24.next) {
4094
4165
  case 0:
4095
4166
  if (!e.estimated_time) {
4096
- _context23.next = 2;
4167
+ _context24.next = 2;
4097
4168
  break;
4098
4169
  }
4099
- return _context23.abrupt("return", {
4170
+ return _context24.abrupt("return", {
4100
4171
  timeoutMS: (e.estimated_time + 1) * 1e3
4101
4172
  });
4102
4173
  case 2:
4103
4174
  if (!e.error) {
4104
- _context23.next = 4;
4175
+ _context24.next = 4;
4105
4176
  break;
4106
4177
  }
4107
4178
  throw e.error;
4108
4179
  case 4:
4109
- return _context23.abrupt("return", {
4180
+ return _context24.abrupt("return", {
4110
4181
  text: ((t = e[0]) == null ? void 0 : t.label) || ""
4111
4182
  });
4112
4183
  case 5:
4113
4184
  case "end":
4114
- return _context23.stop();
4185
+ return _context24.stop();
4115
4186
  }
4116
- }, _callee23);
4187
+ }, _callee24);
4117
4188
  }));
4118
4189
  function extractPollResultData(_x49) {
4119
4190
  return _extractPollResultData2.apply(this, arguments);
@@ -4200,19 +4271,19 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4200
4271
  }, {
4201
4272
  key: "callServiceAPI",
4202
4273
  value: function () {
4203
- var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(e, t, n) {
4274
+ var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(e, t, n) {
4204
4275
  var s;
4205
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
4206
- while (1) switch (_context24.prev = _context24.next) {
4276
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
4277
+ while (1) switch (_context25.prev = _context25.next) {
4207
4278
  case 0:
4208
4279
  if (this.requestSettings) {
4209
- _context24.next = 2;
4280
+ _context25.next = 2;
4210
4281
  break;
4211
4282
  }
4212
4283
  throw new Error("Request settings have not been set up");
4213
4284
  case 2:
4214
4285
  if (n) {
4215
- _context24.next = 4;
4286
+ _context25.next = 4;
4216
4287
  break;
4217
4288
  }
4218
4289
  throw new Error("Image was not found");
@@ -4221,9 +4292,9 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4221
4292
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, s, e), !1);
4222
4293
  case 6:
4223
4294
  case "end":
4224
- return _context24.stop();
4295
+ return _context25.stop();
4225
4296
  }
4226
- }, _callee24, this);
4297
+ }, _callee25, this);
4227
4298
  }));
4228
4299
  function callServiceAPI(_x50, _x51, _x52) {
4229
4300
  return _callServiceAPI4.apply(this, arguments);
@@ -4233,17 +4304,17 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4233
4304
  }, {
4234
4305
  key: "extractResultData",
4235
4306
  value: function () {
4236
- var _extractResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(e) {
4237
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
4238
- while (1) switch (_context25.prev = _context25.next) {
4307
+ var _extractResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(e) {
4308
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
4309
+ while (1) switch (_context26.prev = _context26.next) {
4239
4310
  case 0:
4240
4311
  if (!e.message) {
4241
- _context25.next = 2;
4312
+ _context26.next = 2;
4242
4313
  break;
4243
4314
  }
4244
4315
  throw e.message;
4245
4316
  case 2:
4246
- return _context25.abrupt("return", {
4317
+ return _context26.abrupt("return", {
4247
4318
  files: e.artifacts.map(function (n) {
4248
4319
  return {
4249
4320
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4253,9 +4324,9 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4253
4324
  });
4254
4325
  case 3:
4255
4326
  case "end":
4256
- return _context25.stop();
4327
+ return _context26.stop();
4257
4328
  }
4258
- }, _callee25);
4329
+ }, _callee26);
4259
4330
  }));
4260
4331
  function extractResultData(_x53) {
4261
4332
  return _extractResultData2.apply(this, arguments);
@@ -4309,19 +4380,19 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4309
4380
  }, {
4310
4381
  key: "callServiceAPI",
4311
4382
  value: function () {
4312
- var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(e, t, n) {
4383
+ var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(e, t, n) {
4313
4384
  var a, l, s, o;
4314
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
4315
- while (1) switch (_context26.prev = _context26.next) {
4385
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
4386
+ while (1) switch (_context27.prev = _context27.next) {
4316
4387
  case 0:
4317
4388
  if (this.requestSettings) {
4318
- _context26.next = 2;
4389
+ _context27.next = 2;
4319
4390
  break;
4320
4391
  }
4321
4392
  throw new Error("Request settings have not been set up");
4322
4393
  case 2:
4323
4394
  if (!(!n || !n[0] || !n[1])) {
4324
- _context26.next = 4;
4395
+ _context27.next = 4;
4325
4396
  break;
4326
4397
  }
4327
4398
  throw new Error("Image was not found");
@@ -4330,9 +4401,9 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4330
4401
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
4331
4402
  case 6:
4332
4403
  case "end":
4333
- return _context26.stop();
4404
+ return _context27.stop();
4334
4405
  }
4335
- }, _callee26, this);
4406
+ }, _callee27, this);
4336
4407
  }));
4337
4408
  function callServiceAPI(_x54, _x55, _x56) {
4338
4409
  return _callServiceAPI5.apply(this, arguments);
@@ -4342,17 +4413,17 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4342
4413
  }, {
4343
4414
  key: "extractResultData",
4344
4415
  value: function () {
4345
- var _extractResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(e) {
4346
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
4347
- while (1) switch (_context27.prev = _context27.next) {
4416
+ var _extractResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(e) {
4417
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
4418
+ while (1) switch (_context28.prev = _context28.next) {
4348
4419
  case 0:
4349
4420
  if (!e.message) {
4350
- _context27.next = 2;
4421
+ _context28.next = 2;
4351
4422
  break;
4352
4423
  }
4353
4424
  throw e.message;
4354
4425
  case 2:
4355
- return _context27.abrupt("return", {
4426
+ return _context28.abrupt("return", {
4356
4427
  files: e.artifacts.map(function (n) {
4357
4428
  return {
4358
4429
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4362,9 +4433,9 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4362
4433
  });
4363
4434
  case 3:
4364
4435
  case "end":
4365
- return _context27.stop();
4436
+ return _context28.stop();
4366
4437
  }
4367
- }, _callee27);
4438
+ }, _callee28);
4368
4439
  }));
4369
4440
  function extractResultData(_x57) {
4370
4441
  return _extractResultData3.apply(this, arguments);
@@ -4399,32 +4470,32 @@ var HuggingFaceAudioRecognitionIO = /*#__PURE__*/function (_HuggingFaceFileIO3)
4399
4470
  _createClass(HuggingFaceAudioRecognitionIO, [{
4400
4471
  key: "extractPollResultData",
4401
4472
  value: function () {
4402
- var _extractPollResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(e) {
4403
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
4404
- while (1) switch (_context28.prev = _context28.next) {
4473
+ var _extractPollResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(e) {
4474
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
4475
+ while (1) switch (_context29.prev = _context29.next) {
4405
4476
  case 0:
4406
4477
  if (!e.estimated_time) {
4407
- _context28.next = 2;
4478
+ _context29.next = 2;
4408
4479
  break;
4409
4480
  }
4410
- return _context28.abrupt("return", {
4481
+ return _context29.abrupt("return", {
4411
4482
  timeoutMS: (e.estimated_time + 1) * 1e3
4412
4483
  });
4413
4484
  case 2:
4414
4485
  if (!e.error) {
4415
- _context28.next = 4;
4486
+ _context29.next = 4;
4416
4487
  break;
4417
4488
  }
4418
4489
  throw e.error;
4419
4490
  case 4:
4420
- return _context28.abrupt("return", {
4491
+ return _context29.abrupt("return", {
4421
4492
  text: e.text || ""
4422
4493
  });
4423
4494
  case 5:
4424
4495
  case "end":
4425
- return _context28.stop();
4496
+ return _context29.stop();
4426
4497
  }
4427
- }, _callee28);
4498
+ }, _callee29);
4428
4499
  }));
4429
4500
  function extractPollResultData(_x58) {
4430
4501
  return _extractPollResultData3.apply(this, arguments);
@@ -4447,24 +4518,24 @@ var HuggingFaceTextGenerationIO = /*#__PURE__*/function (_HuggingFaceIO3) {
4447
4518
  _createClass(HuggingFaceTextGenerationIO, [{
4448
4519
  key: "extractResultData",
4449
4520
  value: function () {
4450
- var _extractResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(e) {
4451
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
4452
- while (1) switch (_context29.prev = _context29.next) {
4521
+ var _extractResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(e) {
4522
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
4523
+ while (1) switch (_context30.prev = _context30.next) {
4453
4524
  case 0:
4454
4525
  if (!e.error) {
4455
- _context29.next = 2;
4526
+ _context30.next = 2;
4456
4527
  break;
4457
4528
  }
4458
4529
  throw e.error;
4459
4530
  case 2:
4460
- return _context29.abrupt("return", {
4531
+ return _context30.abrupt("return", {
4461
4532
  text: e[0].generated_text || ""
4462
4533
  });
4463
4534
  case 3:
4464
4535
  case "end":
4465
- return _context29.stop();
4536
+ return _context30.stop();
4466
4537
  }
4467
- }, _callee29);
4538
+ }, _callee30);
4468
4539
  }));
4469
4540
  function extractResultData(_x59) {
4470
4541
  return _extractResultData4.apply(this, arguments);
@@ -4503,24 +4574,24 @@ var HuggingFaceQuestionAnswerIO = /*#__PURE__*/function (_HuggingFaceIO4) {
4503
4574
  }, {
4504
4575
  key: "extractResultData",
4505
4576
  value: function () {
4506
- var _extractResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(e) {
4507
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
4508
- while (1) switch (_context30.prev = _context30.next) {
4577
+ var _extractResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(e) {
4578
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
4579
+ while (1) switch (_context31.prev = _context31.next) {
4509
4580
  case 0:
4510
4581
  if (!e.error) {
4511
- _context30.next = 2;
4582
+ _context31.next = 2;
4512
4583
  break;
4513
4584
  }
4514
4585
  throw e.error;
4515
4586
  case 2:
4516
- return _context30.abrupt("return", {
4587
+ return _context31.abrupt("return", {
4517
4588
  text: e.answer || ""
4518
4589
  });
4519
4590
  case 3:
4520
4591
  case "end":
4521
- return _context30.stop();
4592
+ return _context31.stop();
4522
4593
  }
4523
- }, _callee30);
4594
+ }, _callee31);
4524
4595
  }));
4525
4596
  function extractResultData(_x60) {
4526
4597
  return _extractResultData5.apply(this, arguments);
@@ -4543,24 +4614,24 @@ var HuggingFaceSummarizationIO = /*#__PURE__*/function (_HuggingFaceIO5) {
4543
4614
  _createClass(HuggingFaceSummarizationIO, [{
4544
4615
  key: "extractResultData",
4545
4616
  value: function () {
4546
- var _extractResultData6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(e) {
4547
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
4548
- while (1) switch (_context31.prev = _context31.next) {
4617
+ var _extractResultData6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(e) {
4618
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
4619
+ while (1) switch (_context32.prev = _context32.next) {
4549
4620
  case 0:
4550
4621
  if (!e.error) {
4551
- _context31.next = 2;
4622
+ _context32.next = 2;
4552
4623
  break;
4553
4624
  }
4554
4625
  throw e.error;
4555
4626
  case 2:
4556
- return _context31.abrupt("return", {
4627
+ return _context32.abrupt("return", {
4557
4628
  text: e[0].summary_text || ""
4558
4629
  });
4559
4630
  case 3:
4560
4631
  case "end":
4561
- return _context31.stop();
4632
+ return _context32.stop();
4562
4633
  }
4563
- }, _callee31);
4634
+ }, _callee32);
4564
4635
  }));
4565
4636
  function extractResultData(_x61) {
4566
4637
  return _extractResultData6.apply(this, arguments);
@@ -4623,24 +4694,24 @@ var HuggingFaceConversationIO = /*#__PURE__*/function (_HuggingFaceIO6) {
4623
4694
  }, {
4624
4695
  key: "extractResultData",
4625
4696
  value: function () {
4626
- var _extractResultData7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(e) {
4627
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
4628
- while (1) switch (_context32.prev = _context32.next) {
4697
+ var _extractResultData7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(e) {
4698
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
4699
+ while (1) switch (_context33.prev = _context33.next) {
4629
4700
  case 0:
4630
4701
  if (!e.error) {
4631
- _context32.next = 2;
4702
+ _context33.next = 2;
4632
4703
  break;
4633
4704
  }
4634
4705
  throw e.error;
4635
4706
  case 2:
4636
- return _context32.abrupt("return", {
4707
+ return _context33.abrupt("return", {
4637
4708
  text: e.generated_text || ""
4638
4709
  });
4639
4710
  case 3:
4640
4711
  case "end":
4641
- return _context32.stop();
4712
+ return _context33.stop();
4642
4713
  }
4643
- }, _callee32);
4714
+ }, _callee33);
4644
4715
  }));
4645
4716
  function extractResultData(_x62) {
4646
4717
  return _extractResultData7.apply(this, arguments);
@@ -4684,19 +4755,19 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4684
4755
  }, {
4685
4756
  key: "callServiceAPI",
4686
4757
  value: function () {
4687
- var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(e, t, n) {
4758
+ var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(e, t, n) {
4688
4759
  var a, l, s, o;
4689
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
4690
- while (1) switch (_context33.prev = _context33.next) {
4760
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
4761
+ while (1) switch (_context34.prev = _context34.next) {
4691
4762
  case 0:
4692
4763
  if (this.requestSettings) {
4693
- _context33.next = 2;
4764
+ _context34.next = 2;
4694
4765
  break;
4695
4766
  }
4696
4767
  throw new Error("Request settings have not been set up");
4697
4768
  case 2:
4698
4769
  if (n) {
4699
- _context33.next = 4;
4770
+ _context34.next = 4;
4700
4771
  break;
4701
4772
  }
4702
4773
  throw new Error("Image was not found");
@@ -4705,9 +4776,9 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4705
4776
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
4706
4777
  case 6:
4707
4778
  case "end":
4708
- return _context33.stop();
4779
+ return _context34.stop();
4709
4780
  }
4710
- }, _callee33, this);
4781
+ }, _callee34, this);
4711
4782
  }));
4712
4783
  function callServiceAPI(_x63, _x64, _x65) {
4713
4784
  return _callServiceAPI6.apply(this, arguments);
@@ -4717,17 +4788,17 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4717
4788
  }, {
4718
4789
  key: "extractResultData",
4719
4790
  value: function () {
4720
- var _extractResultData8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(e) {
4721
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
4722
- while (1) switch (_context34.prev = _context34.next) {
4791
+ var _extractResultData8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(e) {
4792
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4793
+ while (1) switch (_context35.prev = _context35.next) {
4723
4794
  case 0:
4724
4795
  if (!e.message) {
4725
- _context34.next = 2;
4796
+ _context35.next = 2;
4726
4797
  break;
4727
4798
  }
4728
4799
  throw e.message;
4729
4800
  case 2:
4730
- return _context34.abrupt("return", {
4801
+ return _context35.abrupt("return", {
4731
4802
  files: e.artifacts.map(function (n) {
4732
4803
  return {
4733
4804
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4737,9 +4808,9 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4737
4808
  });
4738
4809
  case 3:
4739
4810
  case "end":
4740
- return _context34.stop();
4811
+ return _context35.stop();
4741
4812
  }
4742
- }, _callee34);
4813
+ }, _callee35);
4743
4814
  }));
4744
4815
  function extractResultData(_x66) {
4745
4816
  return _extractResultData8.apply(this, arguments);
@@ -4772,24 +4843,24 @@ var HuggingFaceTranslationIO = /*#__PURE__*/function (_HuggingFaceIO7) {
4772
4843
  _createClass(HuggingFaceTranslationIO, [{
4773
4844
  key: "extractResultData",
4774
4845
  value: function () {
4775
- var _extractResultData9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(e) {
4776
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4777
- while (1) switch (_context35.prev = _context35.next) {
4846
+ var _extractResultData9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(e) {
4847
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4848
+ while (1) switch (_context36.prev = _context36.next) {
4778
4849
  case 0:
4779
4850
  if (!e.error) {
4780
- _context35.next = 2;
4851
+ _context36.next = 2;
4781
4852
  break;
4782
4853
  }
4783
4854
  throw e.error;
4784
4855
  case 2:
4785
- return _context35.abrupt("return", {
4856
+ return _context36.abrupt("return", {
4786
4857
  text: e[0].translation_text || ""
4787
4858
  });
4788
4859
  case 3:
4789
4860
  case "end":
4790
- return _context35.stop();
4861
+ return _context36.stop();
4791
4862
  }
4792
- }, _callee35);
4863
+ }, _callee36);
4793
4864
  }));
4794
4865
  function extractResultData(_x67) {
4795
4866
  return _extractResultData9.apply(this, arguments);
@@ -4825,13 +4896,13 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4825
4896
  }, {
4826
4897
  key: "callServiceAPI",
4827
4898
  value: function () {
4828
- var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(e, t) {
4899
+ var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(e, t) {
4829
4900
  var n;
4830
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4831
- while (1) switch (_context36.prev = _context36.next) {
4901
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4902
+ while (1) switch (_context37.prev = _context37.next) {
4832
4903
  case 0:
4833
4904
  if (this.requestSettings) {
4834
- _context36.next = 2;
4905
+ _context37.next = 2;
4835
4906
  break;
4836
4907
  }
4837
4908
  throw new Error("Request settings have not been set up");
@@ -4840,9 +4911,9 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4840
4911
  HTTPRequest.request(this, n, e);
4841
4912
  case 4:
4842
4913
  case "end":
4843
- return _context36.stop();
4914
+ return _context37.stop();
4844
4915
  }
4845
- }, _callee36, this);
4916
+ }, _callee37, this);
4846
4917
  }));
4847
4918
  function callServiceAPI(_x68, _x69) {
4848
4919
  return _callServiceAPI7.apply(this, arguments);
@@ -4852,17 +4923,17 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4852
4923
  }, {
4853
4924
  key: "extractResultData",
4854
4925
  value: function () {
4855
- var _extractResultData10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(e) {
4856
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4857
- while (1) switch (_context37.prev = _context37.next) {
4926
+ var _extractResultData10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(e) {
4927
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4928
+ while (1) switch (_context38.prev = _context38.next) {
4858
4929
  case 0:
4859
4930
  if (!e.message) {
4860
- _context37.next = 2;
4931
+ _context38.next = 2;
4861
4932
  break;
4862
4933
  }
4863
4934
  throw e.message;
4864
4935
  case 2:
4865
- return _context37.abrupt("return", {
4936
+ return _context38.abrupt("return", {
4866
4937
  files: e.artifacts.map(function (n) {
4867
4938
  return {
4868
4939
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4872,9 +4943,9 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4872
4943
  });
4873
4944
  case 3:
4874
4945
  case "end":
4875
- return _context37.stop();
4946
+ return _context38.stop();
4876
4947
  }
4877
- }, _callee37);
4948
+ }, _callee38);
4878
4949
  }));
4879
4950
  function extractResultData(_x70) {
4880
4951
  return _extractResultData10.apply(this, arguments);
@@ -4909,24 +4980,24 @@ var HuggingFaceFillMaskIO = /*#__PURE__*/function (_HuggingFaceIO8) {
4909
4980
  _createClass(HuggingFaceFillMaskIO, [{
4910
4981
  key: "extractResultData",
4911
4982
  value: function () {
4912
- var _extractResultData11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(e) {
4913
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4914
- while (1) switch (_context38.prev = _context38.next) {
4983
+ var _extractResultData11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(e) {
4984
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4985
+ while (1) switch (_context39.prev = _context39.next) {
4915
4986
  case 0:
4916
4987
  if (!e.error) {
4917
- _context38.next = 2;
4988
+ _context39.next = 2;
4918
4989
  break;
4919
4990
  }
4920
4991
  throw e.error;
4921
4992
  case 2:
4922
- return _context38.abrupt("return", {
4993
+ return _context39.abrupt("return", {
4923
4994
  text: e[0].sequence || ""
4924
4995
  });
4925
4996
  case 3:
4926
4997
  case "end":
4927
- return _context38.stop();
4998
+ return _context39.stop();
4928
4999
  }
4929
- }, _callee38);
5000
+ }, _callee39);
4930
5001
  }));
4931
5002
  function extractResultData(_x71) {
4932
5003
  return _extractResultData11.apply(this, arguments);
@@ -5003,13 +5074,13 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
5003
5074
  }, {
5004
5075
  key: "callServiceAPI",
5005
5076
  value: function () {
5006
- var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(e, t) {
5077
+ var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(e, t) {
5007
5078
  var n;
5008
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
5009
- while (1) switch (_context39.prev = _context39.next) {
5079
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
5080
+ while (1) switch (_context40.prev = _context40.next) {
5010
5081
  case 0:
5011
5082
  if (this.requestSettings) {
5012
- _context39.next = 2;
5083
+ _context40.next = 2;
5013
5084
  break;
5014
5085
  }
5015
5086
  throw new Error("Request settings have not been set up");
@@ -5018,9 +5089,9 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
5018
5089
  HTTPRequest.request(this, n, e);
5019
5090
  case 4:
5020
5091
  case "end":
5021
- return _context39.stop();
5092
+ return _context40.stop();
5022
5093
  }
5023
- }, _callee39, this);
5094
+ }, _callee40, this);
5024
5095
  }));
5025
5096
  function callServiceAPI(_x72, _x73) {
5026
5097
  return _callServiceAPI8.apply(this, arguments);
@@ -5030,25 +5101,25 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
5030
5101
  }, {
5031
5102
  key: "extractResultData",
5032
5103
  value: function () {
5033
- var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(e) {
5104
+ var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(e) {
5034
5105
  var t;
5035
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
5036
- while (1) switch (_context40.prev = _context40.next) {
5106
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
5107
+ while (1) switch (_context41.prev = _context41.next) {
5037
5108
  case 0:
5038
5109
  if (!e.message) {
5039
- _context40.next = 2;
5110
+ _context41.next = 2;
5040
5111
  break;
5041
5112
  }
5042
5113
  throw e.message;
5043
5114
  case 2:
5044
- return _context40.abrupt("return", {
5115
+ return _context41.abrupt("return", {
5045
5116
  text: ((t = e.generations) == null ? void 0 : t[0].text) || ""
5046
5117
  });
5047
5118
  case 3:
5048
5119
  case "end":
5049
- return _context40.stop();
5120
+ return _context41.stop();
5050
5121
  }
5051
- }, _callee40);
5122
+ }, _callee41);
5052
5123
  }));
5053
5124
  function extractResultData(_x74) {
5054
5125
  return _extractResultData12.apply(this, arguments);
@@ -5080,13 +5151,13 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
5080
5151
  }, {
5081
5152
  key: "callServiceAPI",
5082
5153
  value: function () {
5083
- var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(e, t) {
5154
+ var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(e, t) {
5084
5155
  var n;
5085
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
5086
- while (1) switch (_context41.prev = _context41.next) {
5156
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
5157
+ while (1) switch (_context42.prev = _context42.next) {
5087
5158
  case 0:
5088
5159
  if (this.requestSettings) {
5089
- _context41.next = 2;
5160
+ _context42.next = 2;
5090
5161
  break;
5091
5162
  }
5092
5163
  throw new Error("Request settings have not been set up");
@@ -5095,9 +5166,9 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
5095
5166
  HTTPRequest.request(this, n, e);
5096
5167
  case 4:
5097
5168
  case "end":
5098
- return _context41.stop();
5169
+ return _context42.stop();
5099
5170
  }
5100
- }, _callee41, this);
5171
+ }, _callee42, this);
5101
5172
  }));
5102
5173
  function callServiceAPI(_x75, _x76) {
5103
5174
  return _callServiceAPI9.apply(this, arguments);
@@ -5107,24 +5178,24 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
5107
5178
  }, {
5108
5179
  key: "extractResultData",
5109
5180
  value: function () {
5110
- var _extractResultData13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(e) {
5111
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
5112
- while (1) switch (_context42.prev = _context42.next) {
5181
+ var _extractResultData13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(e) {
5182
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
5183
+ while (1) switch (_context43.prev = _context43.next) {
5113
5184
  case 0:
5114
5185
  if (!e.message) {
5115
- _context42.next = 2;
5186
+ _context43.next = 2;
5116
5187
  break;
5117
5188
  }
5118
5189
  throw e.message;
5119
5190
  case 2:
5120
- return _context42.abrupt("return", {
5191
+ return _context43.abrupt("return", {
5121
5192
  text: e.summary || ""
5122
5193
  });
5123
5194
  case 3:
5124
5195
  case "end":
5125
- return _context42.stop();
5196
+ return _context43.stop();
5126
5197
  }
5127
- }, _callee42);
5198
+ }, _callee43);
5128
5199
  }));
5129
5200
  function extractResultData(_x77) {
5130
5201
  return _extractResultData13.apply(this, arguments);
@@ -5283,13 +5354,13 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5283
5354
  }, {
5284
5355
  key: "callServiceAPI",
5285
5356
  value: function () {
5286
- var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(e, t) {
5357
+ var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(e, t) {
5287
5358
  var n;
5288
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
5289
- while (1) switch (_context43.prev = _context43.next) {
5359
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
5360
+ while (1) switch (_context44.prev = _context44.next) {
5290
5361
  case 0:
5291
5362
  if (this.requestSettings) {
5292
- _context43.next = 2;
5363
+ _context44.next = 2;
5293
5364
  break;
5294
5365
  }
5295
5366
  throw new Error("Request settings have not been set up");
@@ -5298,9 +5369,9 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5298
5369
  HTTPRequest.request(this, n, e), this.messages = e;
5299
5370
  case 4:
5300
5371
  case "end":
5301
- return _context43.stop();
5372
+ return _context44.stop();
5302
5373
  }
5303
- }, _callee43, this);
5374
+ }, _callee44, this);
5304
5375
  }));
5305
5376
  function callServiceAPI(_x78, _x79) {
5306
5377
  return _callServiceAPI10.apply(this, arguments);
@@ -5310,13 +5381,13 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5310
5381
  }, {
5311
5382
  key: "extractResultData",
5312
5383
  value: function () {
5313
- var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(e) {
5384
+ var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(e) {
5314
5385
  var t, n, _s4;
5315
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
5316
- while (1) switch (_context44.prev = _context44.next) {
5386
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
5387
+ while (1) switch (_context45.prev = _context45.next) {
5317
5388
  case 0:
5318
5389
  if (!e.error) {
5319
- _context44.next = 2;
5390
+ _context45.next = 2;
5320
5391
  break;
5321
5392
  }
5322
5393
  throw e.error.message;
@@ -5328,14 +5399,14 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5328
5399
  };
5329
5400
  HTTPRequest.executePollRequest(this, n, _s4, this.messages);
5330
5401
  }
5331
- return _context44.abrupt("return", {
5402
+ return _context45.abrupt("return", {
5332
5403
  pollingInAnotherRequest: !0
5333
5404
  });
5334
5405
  case 4:
5335
5406
  case "end":
5336
- return _context44.stop();
5407
+ return _context45.stop();
5337
5408
  }
5338
- }, _callee44, this);
5409
+ }, _callee45, this);
5339
5410
  }));
5340
5411
  function extractResultData(_x80) {
5341
5412
  return _extractResultData14.apply(this, arguments);
@@ -5345,33 +5416,33 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5345
5416
  }, {
5346
5417
  key: "extractPollResultData",
5347
5418
  value: function () {
5348
- var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(e) {
5419
+ var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(e) {
5349
5420
  var t, _iterator, _step, n;
5350
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
5351
- while (1) switch (_context45.prev = _context45.next) {
5421
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5422
+ while (1) switch (_context46.prev = _context46.next) {
5352
5423
  case 0:
5353
5424
  if (!e.error) {
5354
- _context45.next = 2;
5425
+ _context46.next = 2;
5355
5426
  break;
5356
5427
  }
5357
5428
  throw e.error;
5358
5429
  case 2:
5359
5430
  if (!(e.status === "running")) {
5360
- _context45.next = 4;
5431
+ _context46.next = 4;
5361
5432
  break;
5362
5433
  }
5363
- return _context45.abrupt("return", {
5434
+ return _context46.abrupt("return", {
5364
5435
  timeoutMS: 2e3
5365
5436
  });
5366
5437
  case 4:
5367
5438
  if (!(e.errors.length > 0)) {
5368
- _context45.next = 6;
5439
+ _context46.next = 6;
5369
5440
  break;
5370
5441
  }
5371
5442
  throw e.errors[0];
5372
5443
  case 6:
5373
5444
  if (!(e.tasks.items[0].results.errors.length > 0)) {
5374
- _context45.next = 8;
5445
+ _context46.next = 8;
5375
5446
  break;
5376
5447
  }
5377
5448
  throw e.tasks.items[0].results.errors[0];
@@ -5388,14 +5459,14 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5388
5459
  } finally {
5389
5460
  _iterator.f();
5390
5461
  }
5391
- return _context45.abrupt("return", {
5462
+ return _context46.abrupt("return", {
5392
5463
  text: t || ""
5393
5464
  });
5394
5465
  case 12:
5395
5466
  case "end":
5396
- return _context45.stop();
5467
+ return _context46.stop();
5397
5468
  }
5398
- }, _callee45);
5469
+ }, _callee46);
5399
5470
  }));
5400
5471
  function extractPollResultData(_x81) {
5401
5472
  return _extractPollResultData4.apply(this, arguments);
@@ -5496,13 +5567,13 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
5496
5567
  }, {
5497
5568
  key: "callServiceAPI",
5498
5569
  value: function () {
5499
- var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(e, t) {
5570
+ var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(e, t) {
5500
5571
  var n;
5501
- return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5502
- while (1) switch (_context46.prev = _context46.next) {
5572
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5573
+ while (1) switch (_context47.prev = _context47.next) {
5503
5574
  case 0:
5504
5575
  if (this.requestSettings) {
5505
- _context46.next = 2;
5576
+ _context47.next = 2;
5506
5577
  break;
5507
5578
  }
5508
5579
  throw new Error("Request settings have not been set up");
@@ -5511,9 +5582,9 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
5511
5582
  this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
5512
5583
  case 4:
5513
5584
  case "end":
5514
- return _context46.stop();
5585
+ return _context47.stop();
5515
5586
  }
5516
- }, _callee46, this);
5587
+ }, _callee47, this);
5517
5588
  }));
5518
5589
  function callServiceAPI(_x82, _x83) {
5519
5590
  return _callServiceAPI11.apply(this, arguments);
@@ -5523,25 +5594,25 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
5523
5594
  }, {
5524
5595
  key: "extractResultData",
5525
5596
  value: function () {
5526
- var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(e) {
5597
+ var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(e) {
5527
5598
  var t;
5528
- return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5529
- while (1) switch (_context47.prev = _context47.next) {
5599
+ return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5600
+ while (1) switch (_context48.prev = _context48.next) {
5530
5601
  case 0:
5531
5602
  if (!e.error) {
5532
- _context47.next = 2;
5603
+ _context48.next = 2;
5533
5604
  break;
5534
5605
  }
5535
5606
  throw e.error.message;
5536
5607
  case 2:
5537
- return _context47.abrupt("return", {
5608
+ return _context48.abrupt("return", {
5538
5609
  text: ((t = e.choices[0]) == null ? void 0 : t.text) || ""
5539
5610
  });
5540
5611
  case 3:
5541
5612
  case "end":
5542
- return _context47.stop();
5613
+ return _context48.stop();
5543
5614
  }
5544
- }, _callee47);
5615
+ }, _callee48);
5545
5616
  }));
5546
5617
  function extractResultData(_x84) {
5547
5618
  return _extractResultData15.apply(this, arguments);
@@ -5558,17 +5629,17 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
5558
5629
  _createClass(AssemblyAIUtils, null, [{
5559
5630
  key: "poll",
5560
5631
  value: function () {
5561
- var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(e, t) {
5632
+ var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(e, t) {
5562
5633
  var n, l, c, d;
5563
- return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5564
- while (1) switch (_context48.prev = _context48.next) {
5634
+ return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5635
+ while (1) switch (_context49.prev = _context49.next) {
5565
5636
  case 0:
5566
5637
  n = {
5567
5638
  authorization: e,
5568
5639
  "content-type": "application/json"
5569
5640
  };
5570
- _context48.t0 = "https://api.assemblyai.com/v2/transcript/";
5571
- _context48.next = 4;
5641
+ _context49.t0 = "https://api.assemblyai.com/v2/transcript/";
5642
+ _context49.next = 4;
5572
5643
  return fetch("https://api.assemblyai.com/v2/transcript", {
5573
5644
  method: "POST",
5574
5645
  body: JSON.stringify({
@@ -5577,53 +5648,53 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
5577
5648
  headers: n
5578
5649
  });
5579
5650
  case 4:
5580
- _context48.next = 6;
5581
- return _context48.sent.json();
5651
+ _context49.next = 6;
5652
+ return _context49.sent.json();
5582
5653
  case 6:
5583
- _context48.t1 = _context48.sent.id;
5584
- l = _context48.t0.concat.call(_context48.t0, _context48.t1);
5654
+ _context49.t1 = _context49.sent.id;
5655
+ l = _context49.t0.concat.call(_context49.t0, _context49.t1);
5585
5656
  case 8:
5586
5657
  if (c) {
5587
- _context48.next = 24;
5658
+ _context49.next = 24;
5588
5659
  break;
5589
5660
  }
5590
- _context48.next = 11;
5661
+ _context49.next = 11;
5591
5662
  return fetch(l, {
5592
5663
  headers: n
5593
5664
  });
5594
5665
  case 11:
5595
- _context48.next = 13;
5596
- return _context48.sent.json();
5666
+ _context49.next = 13;
5667
+ return _context49.sent.json();
5597
5668
  case 13:
5598
- d = _context48.sent;
5669
+ d = _context49.sent;
5599
5670
  if (!(d.status === "completed")) {
5600
- _context48.next = 18;
5671
+ _context49.next = 18;
5601
5672
  break;
5602
5673
  }
5603
5674
  c = d;
5604
- _context48.next = 22;
5675
+ _context49.next = 22;
5605
5676
  break;
5606
5677
  case 18:
5607
5678
  if (!(d.status === "error")) {
5608
- _context48.next = 20;
5679
+ _context49.next = 20;
5609
5680
  break;
5610
5681
  }
5611
5682
  throw new Error("Transcription failed: ".concat(d.error));
5612
5683
  case 20:
5613
- _context48.next = 22;
5684
+ _context49.next = 22;
5614
5685
  return new Promise(function (h) {
5615
5686
  return setTimeout(h, 3e3);
5616
5687
  });
5617
5688
  case 22:
5618
- _context48.next = 8;
5689
+ _context49.next = 8;
5619
5690
  break;
5620
5691
  case 24:
5621
- return _context48.abrupt("return", c);
5692
+ return _context49.abrupt("return", c);
5622
5693
  case 25:
5623
5694
  case "end":
5624
- return _context48.stop();
5695
+ return _context49.stop();
5625
5696
  }
5626
- }, _callee48);
5697
+ }, _callee49);
5627
5698
  }));
5628
5699
  function poll(_x85, _x86) {
5629
5700
  return _poll2.apply(this, arguments);
@@ -5673,19 +5744,19 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
5673
5744
  _createClass(AssemblyAIAudioIO, [{
5674
5745
  key: "callServiceAPI",
5675
5746
  value: function () {
5676
- var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(e, t, n) {
5747
+ var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(e, t, n) {
5677
5748
  var s;
5678
- return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5679
- while (1) switch (_context49.prev = _context49.next) {
5749
+ return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5750
+ while (1) switch (_context50.prev = _context50.next) {
5680
5751
  case 0:
5681
5752
  if ((s = this.requestSettings) != null && s.headers) {
5682
- _context49.next = 2;
5753
+ _context50.next = 2;
5683
5754
  break;
5684
5755
  }
5685
5756
  throw new Error("Request settings have not been set up");
5686
5757
  case 2:
5687
5758
  if (n != null && n[0]) {
5688
- _context49.next = 4;
5759
+ _context50.next = 4;
5689
5760
  break;
5690
5761
  }
5691
5762
  throw new Error("No file was added");
@@ -5693,9 +5764,9 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
5693
5764
  HTTPRequest.request(this, n[0], e, !1);
5694
5765
  case 5:
5695
5766
  case "end":
5696
- return _context49.stop();
5767
+ return _context50.stop();
5697
5768
  }
5698
- }, _callee49, this);
5769
+ }, _callee50, this);
5699
5770
  }));
5700
5771
  function callServiceAPI(_x87, _x88, _x89) {
5701
5772
  return _callServiceAPI12.apply(this, arguments);
@@ -5705,30 +5776,30 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
5705
5776
  }, {
5706
5777
  key: "extractResultData",
5707
5778
  value: function () {
5708
- var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(e) {
5779
+ var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(e) {
5709
5780
  var s, o, t;
5710
- return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5711
- while (1) switch (_context50.prev = _context50.next) {
5781
+ return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5782
+ while (1) switch (_context51.prev = _context51.next) {
5712
5783
  case 0:
5713
5784
  if (!e.error) {
5714
- _context50.next = 2;
5785
+ _context51.next = 2;
5715
5786
  break;
5716
5787
  }
5717
5788
  throw e.error;
5718
5789
  case 2:
5719
5790
  t = (o = (s = this.requestSettings) == null ? void 0 : s.headers) == null ? void 0 : o.Authorization;
5720
- _context50.next = 5;
5791
+ _context51.next = 5;
5721
5792
  return AssemblyAIUtils.poll(t, e.upload_url);
5722
5793
  case 5:
5723
- _context50.t0 = _context50.sent.text;
5724
- return _context50.abrupt("return", {
5725
- text: _context50.t0
5794
+ _context51.t0 = _context51.sent.text;
5795
+ return _context51.abrupt("return", {
5796
+ text: _context51.t0
5726
5797
  });
5727
5798
  case 7:
5728
5799
  case "end":
5729
- return _context50.stop();
5800
+ return _context51.stop();
5730
5801
  }
5731
- }, _callee50, this);
5802
+ }, _callee51, this);
5732
5803
  }));
5733
5804
  function extractResultData(_x90) {
5734
5805
  return _extractResultData16.apply(this, arguments);
@@ -5780,13 +5851,13 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5780
5851
  }, {
5781
5852
  key: "callServiceAPI",
5782
5853
  value: function () {
5783
- var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(e, t) {
5854
+ var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(e, t) {
5784
5855
  var n;
5785
- return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5786
- while (1) switch (_context51.prev = _context51.next) {
5856
+ return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5857
+ while (1) switch (_context52.prev = _context52.next) {
5787
5858
  case 0:
5788
5859
  if (this.requestSettings) {
5789
- _context51.next = 2;
5860
+ _context52.next = 2;
5790
5861
  break;
5791
5862
  }
5792
5863
  throw new Error("Request settings have not been set up");
@@ -5795,9 +5866,9 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5795
5866
  HTTPRequest.request(this, n, e, !1);
5796
5867
  case 4:
5797
5868
  case "end":
5798
- return _context51.stop();
5869
+ return _context52.stop();
5799
5870
  }
5800
- }, _callee51, this);
5871
+ }, _callee52, this);
5801
5872
  }));
5802
5873
  function callServiceAPI(_x91, _x92) {
5803
5874
  return _callServiceAPI13.apply(this, arguments);
@@ -5807,11 +5878,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5807
5878
  }, {
5808
5879
  key: "extractResultData",
5809
5880
  value: function () {
5810
- var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(e) {
5811
- return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5812
- while (1) switch (_context52.prev = _context52.next) {
5881
+ var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(e) {
5882
+ return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5883
+ while (1) switch (_context53.prev = _context53.next) {
5813
5884
  case 0:
5814
- return _context52.abrupt("return", new Promise(function (t) {
5885
+ return _context53.abrupt("return", new Promise(function (t) {
5815
5886
  var n = new FileReader();
5816
5887
  n.readAsDataURL(e), n.onload = function (s) {
5817
5888
  t({
@@ -5824,9 +5895,9 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5824
5895
  }));
5825
5896
  case 1:
5826
5897
  case "end":
5827
- return _context52.stop();
5898
+ return _context53.stop();
5828
5899
  }
5829
- }, _callee52);
5900
+ }, _callee53);
5830
5901
  }));
5831
5902
  function extractResultData(_x93) {
5832
5903
  return _extractResultData17.apply(this, arguments);
@@ -5864,19 +5935,19 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5864
5935
  _createClass(U, [{
5865
5936
  key: "callServiceAPI",
5866
5937
  value: function () {
5867
- var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(e, t, n) {
5938
+ var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(e, t, n) {
5868
5939
  var s, o;
5869
- return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5870
- while (1) switch (_context53.prev = _context53.next) {
5940
+ return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5941
+ while (1) switch (_context54.prev = _context54.next) {
5871
5942
  case 0:
5872
5943
  if ((s = this.requestSettings) != null && s.headers) {
5873
- _context53.next = 2;
5944
+ _context54.next = 2;
5874
5945
  break;
5875
5946
  }
5876
5947
  throw new Error("Request settings have not been set up");
5877
5948
  case 2:
5878
5949
  if (n != null && n[0]) {
5879
- _context53.next = 4;
5950
+ _context54.next = 4;
5880
5951
  break;
5881
5952
  }
5882
5953
  throw new Error("No file was added");
@@ -5884,9 +5955,9 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5884
5955
  (o = this.requestSettings) != null && o.headers && (this.requestSettings.headers["Content-Type"] = n[0].name.toLocaleLowerCase().endsWith(".wav") ? "audio/wav; codecs=audio/pcm; samplerate=16000" : "audio/ogg; codecs=opus"), HTTPRequest.request(this, n[0], e, !1);
5885
5956
  case 5:
5886
5957
  case "end":
5887
- return _context53.stop();
5958
+ return _context54.stop();
5888
5959
  }
5889
- }, _callee53, this);
5960
+ }, _callee54, this);
5890
5961
  }));
5891
5962
  function callServiceAPI(_x94, _x95, _x96) {
5892
5963
  return _callServiceAPI14.apply(this, arguments);
@@ -5896,24 +5967,24 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5896
5967
  }, {
5897
5968
  key: "extractResultData",
5898
5969
  value: function () {
5899
- var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(e) {
5900
- return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5901
- while (1) switch (_context54.prev = _context54.next) {
5970
+ var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(e) {
5971
+ return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5972
+ while (1) switch (_context55.prev = _context55.next) {
5902
5973
  case 0:
5903
5974
  if (!e.error) {
5904
- _context54.next = 2;
5975
+ _context55.next = 2;
5905
5976
  break;
5906
5977
  }
5907
5978
  throw e.error;
5908
5979
  case 2:
5909
- return _context54.abrupt("return", {
5980
+ return _context55.abrupt("return", {
5910
5981
  text: e.DisplayText || ""
5911
5982
  });
5912
5983
  case 3:
5913
5984
  case "end":
5914
- return _context54.stop();
5985
+ return _context55.stop();
5915
5986
  }
5916
- }, _callee54);
5987
+ }, _callee55);
5917
5988
  }));
5918
5989
  function extractResultData(_x97) {
5919
5990
  return _extractResultData18.apply(this, arguments);
@@ -5958,13 +6029,13 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
5958
6029
  }, {
5959
6030
  key: "callServiceAPI",
5960
6031
  value: function () {
5961
- var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(e, t) {
6032
+ var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(e, t) {
5962
6033
  var n;
5963
- return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5964
- while (1) switch (_context55.prev = _context55.next) {
6034
+ return _regeneratorRuntime().wrap(function _callee56$(_context56) {
6035
+ while (1) switch (_context56.prev = _context56.next) {
5965
6036
  case 0:
5966
6037
  if (this.requestSettings) {
5967
- _context55.next = 2;
6038
+ _context56.next = 2;
5968
6039
  break;
5969
6040
  }
5970
6041
  throw new Error("Request settings have not been set up");
@@ -5973,9 +6044,9 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
5973
6044
  HTTPRequest.request(this, n, e);
5974
6045
  case 4:
5975
6046
  case "end":
5976
- return _context55.stop();
6047
+ return _context56.stop();
5977
6048
  }
5978
- }, _callee55, this);
6049
+ }, _callee56, this);
5979
6050
  }));
5980
6051
  function callServiceAPI(_x98, _x99) {
5981
6052
  return _callServiceAPI15.apply(this, arguments);
@@ -5985,25 +6056,25 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
5985
6056
  }, {
5986
6057
  key: "extractResultData",
5987
6058
  value: function () {
5988
- var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(e) {
6059
+ var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(e) {
5989
6060
  var t;
5990
- return _regeneratorRuntime().wrap(function _callee56$(_context56) {
5991
- while (1) switch (_context56.prev = _context56.next) {
6061
+ return _regeneratorRuntime().wrap(function _callee57$(_context57) {
6062
+ while (1) switch (_context57.prev = _context57.next) {
5992
6063
  case 0:
5993
6064
  if (!Array.isArray(e)) {
5994
- _context56.next = 2;
6065
+ _context57.next = 2;
5995
6066
  break;
5996
6067
  }
5997
- return _context56.abrupt("return", {
6068
+ return _context57.abrupt("return", {
5998
6069
  text: ((t = e[0].translations) == null ? void 0 : t[0].text) || ""
5999
6070
  });
6000
6071
  case 2:
6001
6072
  throw e.error;
6002
6073
  case 3:
6003
6074
  case "end":
6004
- return _context56.stop();
6075
+ return _context57.stop();
6005
6076
  }
6006
- }, _callee56);
6077
+ }, _callee57);
6007
6078
  }));
6008
6079
  function extractResultData(_x100) {
6009
6080
  return _extractResultData19.apply(this, arguments);
@@ -6072,39 +6143,39 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
6072
6143
  }, {
6073
6144
  key: "callServiceAPI",
6074
6145
  value: function () {
6075
- var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(e, t, n) {
6076
- var s, _o;
6077
- return _regeneratorRuntime().wrap(function _callee57$(_context57) {
6078
- while (1) switch (_context57.prev = _context57.next) {
6146
+ var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(e, t, n) {
6147
+ var s, _o2;
6148
+ return _regeneratorRuntime().wrap(function _callee58$(_context58) {
6149
+ while (1) switch (_context58.prev = _context58.next) {
6079
6150
  case 0:
6080
6151
  if ((s = this.requestSettings) != null && s.headers) {
6081
- _context57.next = 2;
6152
+ _context58.next = 2;
6082
6153
  break;
6083
6154
  }
6084
6155
  throw new Error("Request settings have not been set up");
6085
6156
  case 2:
6086
6157
  if (!(n != null && n[0])) {
6087
- _context57.next = 6;
6158
+ _context58.next = 6;
6088
6159
  break;
6089
6160
  }
6090
6161
  this.callApiWithImage(e, t, n);
6091
- _context57.next = 11;
6162
+ _context58.next = 11;
6092
6163
  break;
6093
6164
  case 6:
6094
6165
  if (this.requestSettings) {
6095
- _context57.next = 8;
6166
+ _context58.next = 8;
6096
6167
  break;
6097
6168
  }
6098
6169
  throw new Error("Request settings have not been set up");
6099
6170
  case 8:
6100
6171
  this.url = M.IMAGE_GENERATION_URL;
6101
- _o = this.preprocessBody(this.rawBody, t[t.length - 1].text);
6102
- HTTPRequest.request(this, _o, e);
6172
+ _o2 = this.preprocessBody(this.rawBody, t[t.length - 1].text);
6173
+ HTTPRequest.request(this, _o2, e);
6103
6174
  case 11:
6104
6175
  case "end":
6105
- return _context57.stop();
6176
+ return _context58.stop();
6106
6177
  }
6107
- }, _callee57, this);
6178
+ }, _callee58, this);
6108
6179
  }));
6109
6180
  function callServiceAPI(_x101, _x102, _x103) {
6110
6181
  return _callServiceAPI16.apply(this, arguments);
@@ -6114,17 +6185,17 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
6114
6185
  }, {
6115
6186
  key: "extractResultData",
6116
6187
  value: function () {
6117
- var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(e) {
6118
- return _regeneratorRuntime().wrap(function _callee58$(_context58) {
6119
- while (1) switch (_context58.prev = _context58.next) {
6188
+ var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(e) {
6189
+ return _regeneratorRuntime().wrap(function _callee59$(_context59) {
6190
+ while (1) switch (_context59.prev = _context59.next) {
6120
6191
  case 0:
6121
6192
  if (!e.error) {
6122
- _context58.next = 2;
6193
+ _context59.next = 2;
6123
6194
  break;
6124
6195
  }
6125
6196
  throw e.error.message;
6126
6197
  case 2:
6127
- return _context58.abrupt("return", {
6198
+ return _context59.abrupt("return", {
6128
6199
  files: e.data.map(function (n) {
6129
6200
  return n.url ? {
6130
6201
  src: n.url,
@@ -6137,9 +6208,9 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
6137
6208
  });
6138
6209
  case 3:
6139
6210
  case "end":
6140
- return _context58.stop();
6211
+ return _context59.stop();
6141
6212
  }
6142
- }, _callee58);
6213
+ }, _callee59);
6143
6214
  }));
6144
6215
  function extractResultData(_x104) {
6145
6216
  return _extractResultData20.apply(this, arguments);
@@ -6213,19 +6284,19 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
6213
6284
  }, {
6214
6285
  key: "callServiceAPI",
6215
6286
  value: function () {
6216
- var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(e, t, n) {
6287
+ var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(e, t, n) {
6217
6288
  var a, s, o;
6218
- return _regeneratorRuntime().wrap(function _callee59$(_context59) {
6219
- while (1) switch (_context59.prev = _context59.next) {
6289
+ return _regeneratorRuntime().wrap(function _callee60$(_context60) {
6290
+ while (1) switch (_context60.prev = _context60.next) {
6220
6291
  case 0:
6221
6292
  if ((a = this.requestSettings) != null && a.headers) {
6222
- _context59.next = 2;
6293
+ _context60.next = 2;
6223
6294
  break;
6224
6295
  }
6225
6296
  throw new Error("Request settings have not been set up");
6226
6297
  case 2:
6227
6298
  if (n != null && n[0]) {
6228
- _context59.next = 4;
6299
+ _context60.next = 4;
6229
6300
  break;
6230
6301
  }
6231
6302
  throw new Error("No file was added");
@@ -6235,9 +6306,9 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
6235
6306
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
6236
6307
  case 7:
6237
6308
  case "end":
6238
- return _context59.stop();
6309
+ return _context60.stop();
6239
6310
  }
6240
- }, _callee59, this);
6311
+ }, _callee60, this);
6241
6312
  }));
6242
6313
  function callServiceAPI(_x105, _x106, _x107) {
6243
6314
  return _callServiceAPI17.apply(this, arguments);
@@ -6247,24 +6318,24 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
6247
6318
  }, {
6248
6319
  key: "extractResultData",
6249
6320
  value: function () {
6250
- var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(e) {
6251
- return _regeneratorRuntime().wrap(function _callee60$(_context60) {
6252
- while (1) switch (_context60.prev = _context60.next) {
6321
+ var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(e) {
6322
+ return _regeneratorRuntime().wrap(function _callee61$(_context61) {
6323
+ while (1) switch (_context61.prev = _context61.next) {
6253
6324
  case 0:
6254
6325
  if (!e.error) {
6255
- _context60.next = 2;
6326
+ _context61.next = 2;
6256
6327
  break;
6257
6328
  }
6258
6329
  throw e.error.message;
6259
6330
  case 2:
6260
- return _context60.abrupt("return", {
6331
+ return _context61.abrupt("return", {
6261
6332
  text: e.text
6262
6333
  });
6263
6334
  case 3:
6264
6335
  case "end":
6265
- return _context60.stop();
6336
+ return _context61.stop();
6266
6337
  }
6267
- }, _callee60);
6338
+ }, _callee61);
6268
6339
  }));
6269
6340
  function extractResultData(_x108) {
6270
6341
  return _extractResultData21.apply(this, arguments);
@@ -6332,13 +6403,13 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6332
6403
  }, {
6333
6404
  key: "callServiceAPI",
6334
6405
  value: function () {
6335
- var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(e, t) {
6406
+ var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(e, t) {
6336
6407
  var n;
6337
- return _regeneratorRuntime().wrap(function _callee61$(_context61) {
6338
- while (1) switch (_context61.prev = _context61.next) {
6408
+ return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6409
+ while (1) switch (_context62.prev = _context62.next) {
6339
6410
  case 0:
6340
6411
  if (this.requestSettings) {
6341
- _context61.next = 2;
6412
+ _context62.next = 2;
6342
6413
  break;
6343
6414
  }
6344
6415
  throw new Error("Request settings have not been set up");
@@ -6347,9 +6418,9 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6347
6418
  this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
6348
6419
  case 4:
6349
6420
  case "end":
6350
- return _context61.stop();
6421
+ return _context62.stop();
6351
6422
  }
6352
- }, _callee61, this);
6423
+ }, _callee62, this);
6353
6424
  }));
6354
6425
  function callServiceAPI(_x109, _x110) {
6355
6426
  return _callServiceAPI18.apply(this, arguments);
@@ -6359,17 +6430,17 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6359
6430
  }, {
6360
6431
  key: "extractResultData",
6361
6432
  value: function () {
6362
- var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(e) {
6363
- return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6364
- while (1) switch (_context62.prev = _context62.next) {
6433
+ var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(e) {
6434
+ return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6435
+ while (1) switch (_context63.prev = _context63.next) {
6365
6436
  case 0:
6366
6437
  if (!e.error) {
6367
- _context62.next = 2;
6438
+ _context63.next = 2;
6368
6439
  break;
6369
6440
  }
6370
6441
  throw e.error.message;
6371
6442
  case 2:
6372
- return _context62.abrupt("return", e.choices[0].delta ? {
6443
+ return _context63.abrupt("return", e.choices[0].delta ? {
6373
6444
  text: e.choices[0].delta.content || ""
6374
6445
  } : e.choices[0].message ? {
6375
6446
  text: e.choices[0].message.content
@@ -6378,9 +6449,9 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6378
6449
  });
6379
6450
  case 3:
6380
6451
  case "end":
6381
- return _context62.stop();
6452
+ return _context63.stop();
6382
6453
  }
6383
- }, _callee62);
6454
+ }, _callee63);
6384
6455
  }));
6385
6456
  function extractResultData(_x111) {
6386
6457
  return _extractResultData22.apply(this, arguments);
@@ -6430,13 +6501,13 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
6430
6501
  }, {
6431
6502
  key: "callServiceAPI",
6432
6503
  value: function () {
6433
- var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(e, t) {
6504
+ var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(e, t) {
6434
6505
  var n;
6435
- return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6436
- while (1) switch (_context63.prev = _context63.next) {
6506
+ return _regeneratorRuntime().wrap(function _callee64$(_context64) {
6507
+ while (1) switch (_context64.prev = _context64.next) {
6437
6508
  case 0:
6438
6509
  if (this.requestSettings) {
6439
- _context63.next = 2;
6510
+ _context64.next = 2;
6440
6511
  break;
6441
6512
  }
6442
6513
  throw new Error("Request settings have not been set up");
@@ -6445,9 +6516,9 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
6445
6516
  HTTPRequest.request(this, n, e);
6446
6517
  case 4:
6447
6518
  case "end":
6448
- return _context63.stop();
6519
+ return _context64.stop();
6449
6520
  }
6450
- }, _callee63, this);
6521
+ }, _callee64, this);
6451
6522
  }));
6452
6523
  function callServiceAPI(_x112, _x113) {
6453
6524
  return _callServiceAPI19.apply(this, arguments);
@@ -6457,24 +6528,24 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
6457
6528
  }, {
6458
6529
  key: "extractResultData",
6459
6530
  value: function () {
6460
- var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(e) {
6461
- return _regeneratorRuntime().wrap(function _callee64$(_context64) {
6462
- while (1) switch (_context64.prev = _context64.next) {
6531
+ var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(e) {
6532
+ return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6533
+ while (1) switch (_context65.prev = _context65.next) {
6463
6534
  case 0:
6464
6535
  if (!e.message) {
6465
- _context64.next = 2;
6536
+ _context65.next = 2;
6466
6537
  break;
6467
6538
  }
6468
6539
  throw e.message;
6469
6540
  case 2:
6470
- return _context64.abrupt("return", {
6541
+ return _context65.abrupt("return", {
6471
6542
  text: e.text
6472
6543
  });
6473
6544
  case 3:
6474
6545
  case "end":
6475
- return _context64.stop();
6546
+ return _context65.stop();
6476
6547
  }
6477
- }, _callee64);
6548
+ }, _callee65);
6478
6549
  }));
6479
6550
  function extractResultData(_x114) {
6480
6551
  return _extractResultData23.apply(this, arguments);
@@ -6690,8 +6761,8 @@ var MessageStyleUtils = /*#__PURE__*/function () {
6690
6761
  value: function applyCustomStylesToElements(e, t, n) {
6691
6762
  if (n && (Object.assign(e.outerContainer.style, n.outerContainer), Object.assign(e.innerContainer.style, n.innerContainer), Object.assign(e.bubbleElement.style, n.bubble), t)) {
6692
6763
  var _s7 = e.bubbleElement.children[0],
6693
- _o2 = _s7.tagName.toLocaleLowerCase() !== "a" ? _s7 : _s7.children[0];
6694
- Object.assign(_o2.style, n.media);
6764
+ _o3 = _s7.tagName.toLocaleLowerCase() !== "a" ? _s7 : _s7.children[0];
6765
+ Object.assign(_o3.style, n.media);
6695
6766
  }
6696
6767
  }
6697
6768
  }, {
@@ -6834,22 +6905,22 @@ var FileMessages = /*#__PURE__*/function () {
6834
6905
  }, {
6835
6906
  key: "addNewImageMessage",
6836
6907
  value: function () {
6837
- var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(e, t, n) {
6908
+ var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(e, t, n) {
6838
6909
  var s,
6839
6910
  o,
6840
6911
  a,
6841
- _args65 = arguments;
6842
- return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6843
- while (1) switch (_context65.prev = _context65.next) {
6912
+ _args66 = arguments;
6913
+ return _regeneratorRuntime().wrap(function _callee66$(_context66) {
6914
+ while (1) switch (_context66.prev = _context66.next) {
6844
6915
  case 0:
6845
- s = _args65.length > 3 && _args65[3] !== undefined ? _args65[3] : !1;
6916
+ s = _args66.length > 3 && _args66[3] !== undefined ? _args66[3] : !1;
6846
6917
  o = FileMessages.createImage(t, e.elementRef), a = e.createNewMessageElement("", n);
6847
6918
  a.bubbleElement.appendChild(o), a.bubbleElement.classList.add("image-message"), e.elementRef.appendChild(a.outerContainer), FileMessageUtils.updateMessages(e, a, t, "image", n, s);
6848
6919
  case 3:
6849
6920
  case "end":
6850
- return _context65.stop();
6921
+ return _context66.stop();
6851
6922
  }
6852
- }, _callee65);
6923
+ }, _callee66);
6853
6924
  }));
6854
6925
  function addNewImageMessage(_x115, _x116, _x117) {
6855
6926
  return _addNewImageMessage.apply(this, arguments);
@@ -7187,12 +7258,12 @@ var Messages = /*#__PURE__*/function () {
7187
7258
  }, {
7188
7259
  key: "addMultipleFiles",
7189
7260
  value: function () {
7190
- var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(e) {
7261
+ var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(e) {
7191
7262
  var _this31 = this;
7192
- return _regeneratorRuntime().wrap(function _callee66$(_context66) {
7193
- while (1) switch (_context66.prev = _context66.next) {
7263
+ return _regeneratorRuntime().wrap(function _callee67$(_context67) {
7264
+ while (1) switch (_context67.prev = _context67.next) {
7194
7265
  case 0:
7195
- return _context66.abrupt("return", Promise.all((e || []).map(function (t) {
7266
+ return _context67.abrupt("return", Promise.all((e || []).map(function (t) {
7196
7267
  return new Promise(function (n) {
7197
7268
  if (!t.type || t.type === "any") {
7198
7269
  var _s8 = t.file.name || FileMessageUtils.DEFAULT_FILE_NAME;
@@ -7217,15 +7288,15 @@ var Messages = /*#__PURE__*/function () {
7217
7288
  })));
7218
7289
  case 1:
7219
7290
  case "end":
7220
- return _context66.stop();
7291
+ return _context67.stop();
7221
7292
  }
7222
- }, _callee66);
7293
+ }, _callee67);
7223
7294
  }));
7224
7295
  function addMultipleFiles(_x118) {
7225
7296
  return _addMultipleFiles.apply(this, arguments);
7226
7297
  }
7227
7298
  return addMultipleFiles;
7228
- }()
7299
+ }() // WORK - need to clear the messages array
7229
7300
  }, {
7230
7301
  key: "clearMessages",
7231
7302
  value: function clearMessages(e) {
@@ -7927,14 +7998,14 @@ var FileAttachmentsType = /*#__PURE__*/function () {
7927
7998
  if (t === "") return !0;
7928
7999
  var n = t.split(",");
7929
8000
  for (var _s14 = 0; _s14 < n.length; _s14++) {
7930
- var _o3 = n[_s14].trim();
7931
- if (e.type === _o3) return !0;
7932
- if (_o3.startsWith(".")) {
7933
- var _a3 = _o3.slice(1);
8001
+ var _o4 = n[_s14].trim();
8002
+ if (e.type === _o4) return !0;
8003
+ if (_o4.startsWith(".")) {
8004
+ var _a3 = _o4.slice(1);
7934
8005
  if (e.name.endsWith(_a3)) return !0;
7935
8006
  } else {
7936
- if (e.name.endsWith(_o3)) return !0;
7937
- if (_o3.endsWith("/*") && e.type.startsWith(_o3.slice(0, -2))) return !0;
8007
+ if (e.name.endsWith(_o4)) return !0;
8008
+ if (_o4.endsWith("/*") && e.type.startsWith(_o4.slice(0, -2))) return !0;
7938
8009
  }
7939
8010
  }
7940
8011
  return !1;
@@ -8131,23 +8202,23 @@ var FileAttachments = /*#__PURE__*/function () {
8131
8202
  }, {
8132
8203
  key: "completePlaceholders",
8133
8204
  value: function () {
8134
- var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68() {
8135
- return _regeneratorRuntime().wrap(function _callee68$(_context68) {
8136
- while (1) switch (_context68.prev = _context68.next) {
8205
+ var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69() {
8206
+ return _regeneratorRuntime().wrap(function _callee69$(_context69) {
8207
+ while (1) switch (_context69.prev = _context69.next) {
8137
8208
  case 0:
8138
- _context68.next = 2;
8209
+ _context69.next = 2;
8139
8210
  return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
8140
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(e) {
8211
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(e) {
8141
8212
  var t;
8142
- return _regeneratorRuntime().wrap(function _callee67$(_context67) {
8143
- while (1) switch (_context67.prev = _context67.next) {
8213
+ return _regeneratorRuntime().wrap(function _callee68$(_context68) {
8214
+ while (1) switch (_context68.prev = _context68.next) {
8144
8215
  case 0:
8145
- return _context67.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
8216
+ return _context68.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
8146
8217
  case 1:
8147
8218
  case "end":
8148
- return _context67.stop();
8219
+ return _context68.stop();
8149
8220
  }
8150
- }, _callee67);
8221
+ }, _callee68);
8151
8222
  }));
8152
8223
  return function (_x119) {
8153
8224
  return _ref6.apply(this, arguments);
@@ -8155,9 +8226,9 @@ var FileAttachments = /*#__PURE__*/function () {
8155
8226
  }()));
8156
8227
  case 2:
8157
8228
  case "end":
8158
- return _context68.stop();
8229
+ return _context69.stop();
8159
8230
  }
8160
- }, _callee68, this);
8231
+ }, _callee69, this);
8161
8232
  }));
8162
8233
  function completePlaceholders() {
8163
8234
  return _completePlaceholders.apply(this, arguments);
@@ -8195,11 +8266,11 @@ var FileAttachments = /*#__PURE__*/function () {
8195
8266
  return FileAttachments;
8196
8267
  }();
8197
8268
  var _Modal = /*#__PURE__*/function () {
8198
- function C(e, t, n) {
8199
- _classCallCheck(this, C);
8200
- this._isOpen = !1, this._contentRef = C.createModalContent(t, n == null ? void 0 : n.backgroundColor), this._buttonPanel = C.createButtonPanel(n == null ? void 0 : n.backgroundColor), this._elementRef = C.createContainer(this._contentRef, n), this._elementRef.appendChild(this._buttonPanel), e.appendChild(this._elementRef), this._backgroundPanelRef = C.createDarkBackgroundPanel(), e.appendChild(this._backgroundPanelRef), this.addWindowEvents();
8269
+ function w(e, t, n) {
8270
+ _classCallCheck(this, w);
8271
+ this._isOpen = !1, this._contentRef = w.createModalContent(t, n == null ? void 0 : n.backgroundColor), this._buttonPanel = w.createButtonPanel(n == null ? void 0 : n.backgroundColor), this._elementRef = w.createContainer(this._contentRef, n), this._elementRef.appendChild(this._buttonPanel), e.appendChild(this._elementRef), this._backgroundPanelRef = w.createDarkBackgroundPanel(), e.appendChild(this._backgroundPanelRef), this.addWindowEvents();
8201
8272
  }
8202
- _createClass(C, [{
8273
+ _createClass(w, [{
8203
8274
  key: "isOpen",
8204
8275
  value: function isOpen() {
8205
8276
  return this._isOpen;
@@ -8221,7 +8292,7 @@ var _Modal = /*#__PURE__*/function () {
8221
8292
  var _this40 = this;
8222
8293
  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 () {
8223
8294
  _this40._elementRef.style.display = "none", _this40._backgroundPanelRef.style.display = "none";
8224
- }, C.MODAL_CLOSE_TIMEOUT_MS);
8295
+ }, w.MODAL_CLOSE_TIMEOUT_MS);
8225
8296
  }
8226
8297
  }, {
8227
8298
  key: "displayModalElements",
@@ -8237,7 +8308,7 @@ var _Modal = /*#__PURE__*/function () {
8237
8308
  key: "addCloseButton",
8238
8309
  value: function addCloseButton(e, t, n) {
8239
8310
  var _this41 = this;
8240
- var s = t ? C.createSVGButton(e) : C.createTextButton(e);
8311
+ var s = t ? w.createSVGButton(e) : w.createTextButton(e);
8241
8312
  return this.addButtons(s), s.onclick = function () {
8242
8313
  _this41.close(), setTimeout(function () {
8243
8314
  n == null || n();
@@ -8297,12 +8368,12 @@ var _Modal = /*#__PURE__*/function () {
8297
8368
  value: function createTextModalFunc(e, t, n) {
8298
8369
  var s;
8299
8370
  if (_typeof(t) == "object" && (s = t.files) != null && s.infoModal) {
8300
- var _o4 = new C(e, ["modal-content"], t.files.infoModal.containerStyle);
8301
- return _o4.addCloseButton("OK", !1, n), _o4.openTextModal.bind(_o4, t.infoModalTextMarkUp || "");
8371
+ var _o5 = new w(e, ["modal-content"], t.files.infoModal.containerStyle);
8372
+ return _o5.addCloseButton("OK", !1, n), _o5.openTextModal.bind(_o5, t.infoModalTextMarkUp || "");
8302
8373
  }
8303
8374
  }
8304
8375
  }]);
8305
- return C;
8376
+ return w;
8306
8377
  }();
8307
8378
  _Modal.MODAL_CLOSE_TIMEOUT_MS = 190;
8308
8379
  var Modal = _Modal;
@@ -8313,10 +8384,10 @@ var UploadFileButton = /*#__PURE__*/function (_InputButton2) {
8313
8384
  function UploadFileButton(e, t, n, s, o, a) {
8314
8385
  var _this43;
8315
8386
  _classCallCheck(this, UploadFileButton);
8316
- var c, u, d, h, p, f;
8387
+ var c, u, d, h, f, p;
8317
8388
  _this43 = _super36.call(this, UploadFileButton.createButtonElement(), (c = n.button) == null ? void 0 : c.position, n.button, a);
8318
8389
  var l = _this43.createInnerElements(s, o, _this43._customStyles);
8319
- _this43._inputElement = UploadFileButton.createInputElement((u = n == null ? void 0 : n.files) == null ? void 0 : u.acceptedFormats), _this43.addClickEvent(e, n), _this43.elementRef.replaceChildren(l.styles), _this43.reapplyStateStyle("styles"), _this43._fileAttachmentsType = t, _this43._openModalOnce = ((h = (d = n.files) == null ? void 0 : d.infoModal) == null ? void 0 : h.openModalOnce) === !1 || (f = (p = n.files) == null ? void 0 : p.infoModal) == null ? void 0 : f.openModalOnce;
8390
+ _this43._inputElement = UploadFileButton.createInputElement((u = n == null ? void 0 : n.files) == null ? void 0 : u.acceptedFormats), _this43.addClickEvent(e, n), _this43.elementRef.replaceChildren(l.styles), _this43.reapplyStateStyle("styles"), _this43._fileAttachmentsType = t, _this43._openModalOnce = ((h = (d = n.files) == null ? void 0 : d.infoModal) == null ? void 0 : h.openModalOnce) === !1 || (p = (f = n.files) == null ? void 0 : f.infoModal) == null ? void 0 : p.openModalOnce;
8320
8391
  return _this43;
8321
8392
  }
8322
8393
  _createClass(UploadFileButton, [{
@@ -8583,9 +8654,9 @@ var WebSpeechTranscript = /*#__PURE__*/function () {
8583
8654
  key: "extract",
8584
8655
  value: function extract(e, t, n) {
8585
8656
  var s = "";
8586
- for (var _o5 = e.resultIndex; _o5 < e.results.length; ++_o5) {
8587
- var _a5 = e.results[_o5][0].transcript;
8588
- n && (_a5 = translate_1$1.Translate.translate(_a5, n)), e.results[_o5].isFinal ? t += _a5 : s += _a5;
8657
+ for (var _o6 = e.resultIndex; _o6 < e.results.length; ++_o6) {
8658
+ var _a5 = e.results[_o6][0].transcript;
8659
+ n && (_a5 = translate_1$1.Translate.translate(_a5, n)), e.results[_o6].isFinal ? t += _a5 : s += _a5;
8589
8660
  }
8590
8661
  return {
8591
8662
  interimTranscript: s,
@@ -8806,8 +8877,8 @@ var Cursor = /*#__PURE__*/function () {
8806
8877
  value: function setOffsetForGeneric(e, t) {
8807
8878
  var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
8808
8879
  var s = 0;
8809
- for (var _o6 = 0; _o6 < e.childNodes.length; _o6 += 1) {
8810
- var _a7 = e.childNodes[_o6];
8880
+ for (var _o7 = 0; _o7 < e.childNodes.length; _o7 += 1) {
8881
+ var _a7 = e.childNodes[_o7];
8811
8882
  if (_a7.childNodes.length > 0) {
8812
8883
  var l = Cursor.setOffsetForGeneric(_a7, t, n);
8813
8884
  if (l === -1) return -1;
@@ -8869,9 +8940,9 @@ var Cursor = /*#__PURE__*/function () {
8869
8940
  value: function getGenericElementCursorOffset(e, t, n) {
8870
8941
  var s = 0;
8871
8942
  if (t.rangeCount > 0) {
8872
- var _o7 = t.getRangeAt(0),
8873
- _a8 = _o7.cloneRange();
8874
- _a8.selectNodeContents(e), n ? _a8.setEnd(_o7.startContainer, _o7.startOffset) : _a8.setEnd(_o7.endContainer, _o7.endOffset), s = _a8.toString().length;
8943
+ var _o8 = t.getRangeAt(0),
8944
+ _a8 = _o8.cloneRange();
8945
+ _a8.selectNodeContents(e), n ? _a8.setEnd(_o8.startContainer, _o8.startOffset) : _a8.setEnd(_o8.endContainer, _o8.endOffset), s = _a8.toString().length;
8875
8946
  }
8876
8947
  return s;
8877
8948
  }
@@ -8934,8 +9005,8 @@ var CommandUtils = /*#__PURE__*/function () {
8934
9005
  key: "checkIfMatchesWord",
8935
9006
  value: function checkIfMatchesWord(e, t, n) {
8936
9007
  var s = e;
8937
- for (var _o8 = n.length - 1; _o8 >= 0; _o8 -= 1) {
8938
- var _a9 = _o8,
9008
+ for (var _o9 = n.length - 1; _o9 >= 0; _o9 -= 1) {
9009
+ var _a9 = _o9,
8939
9010
  l = s.length - 1;
8940
9011
  for (; n[_a9] === s[l] && l >= 0;) _a9 -= 1, l -= 1;
8941
9012
  if (l < 0) return !0;
@@ -8951,31 +9022,31 @@ var CommandUtils = /*#__PURE__*/function () {
8951
9022
  if (!u || !s || !n) return;
8952
9023
  var d = ((a = u.settings) === null || a === void 0 ? void 0 : a.caseSensitive) === !0 ? t : t.toLowerCase(),
8953
9024
  h = text_1$2.Text.breakupIntoWordsArr(d),
8954
- p = ((l = u.settings) === null || l === void 0 ? void 0 : l.substrings) === !1 ? CommandUtils.checkIfMatchesWord : CommandUtils.checkIfMatchesSubstring;
8955
- if (u.commandMode && p(u.commandMode, d, h)) return e.setInterimColorToFinal(), setTimeout(function () {
9025
+ f = ((l = u.settings) === null || l === void 0 ? void 0 : l.substrings) === !1 ? CommandUtils.checkIfMatchesWord : CommandUtils.checkIfMatchesSubstring;
9026
+ if (u.commandMode && f(u.commandMode, d, h)) return e.setInterimColorToFinal(), setTimeout(function () {
8956
9027
  return CommandUtils.toggleCommandModeOn(e);
8957
9028
  }), {
8958
9029
  doNotProcessTranscription: !1
8959
9030
  };
8960
9031
  if (!(u.commandMode && !e.isWaitingForCommand)) {
8961
- if (u.stop && p(u.stop, d, h)) return CommandUtils.toggleCommandModeOff(e), setTimeout(function () {
9032
+ if (u.stop && f(u.stop, d, h)) return CommandUtils.toggleCommandModeOff(e), setTimeout(function () {
8962
9033
  return e.stop();
8963
9034
  }), {
8964
9035
  doNotProcessTranscription: !1
8965
9036
  };
8966
- if (u.pause && p(u.pause, d, h)) return CommandUtils.toggleCommandModeOff(e), e.setInterimColorToFinal(), setTimeout(function () {
8967
- var f;
8968
- e.isPaused = !0, (f = e.onPauseTrigger) === null || f === void 0 || f.call(e, !0);
9037
+ if (u.pause && f(u.pause, d, h)) return CommandUtils.toggleCommandModeOff(e), e.setInterimColorToFinal(), setTimeout(function () {
9038
+ var p;
9039
+ e.isPaused = !0, (p = e.onPauseTrigger) === null || p === void 0 || p.call(e, !0);
8969
9040
  }), {
8970
9041
  doNotProcessTranscription: !1
8971
9042
  };
8972
- if (u.resume && p(u.resume, d, h)) return e.isPaused = !1, (c = e.onPauseTrigger) === null || c === void 0 || c.call(e, !1), CommandUtils.toggleCommandModeOff(e), e.resetRecording(n), {
9043
+ if (u.resume && f(u.resume, d, h)) return e.isPaused = !1, (c = e.onPauseTrigger) === null || c === void 0 || c.call(e, !1), CommandUtils.toggleCommandModeOff(e), e.resetRecording(n), {
8973
9044
  doNotProcessTranscription: !0
8974
9045
  };
8975
- if (u.reset && p(u.reset, d, h)) return o !== void 0 && CommandUtils.setText(e, n, o, s), {
9046
+ if (u.reset && f(u.reset, d, h)) return o !== void 0 && CommandUtils.setText(e, n, o, s), {
8976
9047
  doNotProcessTranscription: !0
8977
9048
  };
8978
- if (u.removeAllText && p(u.removeAllText, d, h)) return CommandUtils.setText(e, n, "", s), {
9049
+ if (u.removeAllText && f(u.removeAllText, d, h)) return CommandUtils.setText(e, n, "", s), {
8979
9050
  doNotProcessTranscription: !0
8980
9051
  };
8981
9052
  }
@@ -9007,8 +9078,8 @@ var Highlight = /*#__PURE__*/function () {
9007
9078
  var n = window.getSelection();
9008
9079
  if (n != null && n.focusNode) {
9009
9080
  var _s18 = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !0),
9010
- _o9 = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !1);
9011
- e.isHighlighted = _s18 !== _o9;
9081
+ _o10 = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !1);
9082
+ e.isHighlighted = _s18 !== _o10;
9012
9083
  }
9013
9084
  }
9014
9085
  }, {
@@ -9058,10 +9129,10 @@ var Padding = /*#__PURE__*/function () {
9058
9129
  value: function setStateForPrimitiveElement(e, t) {
9059
9130
  if (document.activeElement === t && t.selectionStart !== null) {
9060
9131
  var _s20 = t.selectionStart,
9061
- _o10 = t.value[_s20 - 1],
9132
+ _o11 = t.value[_s20 - 1],
9062
9133
  _a11 = t.selectionEnd === null ? _s20 : t.selectionEnd,
9063
9134
  l = t.value[_a11];
9064
- text_1$1.Text.isCharDefined(_o10) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), text_1$1.Text.isCharDefined(l) && (e.endPadding = " ", e.numberOfSpacesAfterNewText = 1), e.isCursorAtEnd = t.value.length === _a11;
9135
+ text_1$1.Text.isCharDefined(_o11) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), text_1$1.Text.isCharDefined(l) && (e.endPadding = " ", e.numberOfSpacesAfterNewText = 1), e.isCursorAtEnd = t.value.length === _a11;
9065
9136
  return;
9066
9137
  }
9067
9138
  var n = t.value[t.value.length - 1];
@@ -9132,11 +9203,11 @@ var Speech = /*#__PURE__*/function () {
9132
9203
  value: function prepareBeforeStart(e) {
9133
9204
  var t, n;
9134
9205
  if (e != null && e.element) if (eventListeners_1.EventListeners.add(this, e), Array.isArray(e.element)) {
9135
- var _o11 = e.element.find(function (a) {
9206
+ var _o12 = e.element.find(function (a) {
9136
9207
  return a === document.activeElement;
9137
9208
  }) || e.element[0];
9138
- if (!_o11) return;
9139
- this.prepare(_o11);
9209
+ if (!_o12) return;
9210
+ this.prepare(_o12);
9140
9211
  } else this.prepare(e.element);
9141
9212
  (e == null ? void 0 : e.displayInterimResults) !== void 0 && (this._displayInterimResults = e.displayInterimResults), e != null && e.textColor && (this._finalTextColor = (t = e == null ? void 0 : e.textColor) === null || t === void 0 ? void 0 : t["final"], elements_1.Elements.applyCustomColors(this, e.textColor)), (e == null ? void 0 : e.insertInCursorLocation) !== void 0 && (this.insertInCursorLocation = e.insertInCursorLocation), (e == null ? void 0 : e.autoScroll) !== void 0 && (this.autoScroll = e.autoScroll), this._onResult = e == null ? void 0 : e.onResult, this._onPreResult = e == null ? void 0 : e.onPreResult, this._onStart = e == null ? void 0 : e.onStart, this._onStop = e == null ? void 0 : e.onStop, this._onError = e == null ? void 0 : e.onError, this.onCommandModeTrigger = e == null ? void 0 : e.onCommandModeTrigger, this.onPauseTrigger = e == null ? void 0 : e.onPauseTrigger, this._options = e, !((n = this._options) === null || n === void 0) && n.commands && (this.commands = commandUtils_1$1.CommandUtils.process(this._options.commands));
9142
9213
  }
@@ -9179,8 +9250,8 @@ var Speech = /*#__PURE__*/function () {
9179
9250
  this.isHighlighted && highlight_1.Highlight.removeForPrimitive(this, e), this.primitiveTextRecorded || padding_1.Padding.adjustStateAfterRecodingPrimitiveElement(this, e), n && padding_1.Padding.adjustSateForNoTextPrimitiveElement(this);
9180
9251
  var s = this.startPadding + this.finalTranscript + t;
9181
9252
  if (e.value = s + this.endPadding, !this.isTargetInShadow) {
9182
- var _o12 = s.length + this.numberOfSpacesAfterNewText;
9183
- cursor_1.Cursor.setOffsetForPrimitive(e, _o12, this.autoScroll);
9253
+ var _o13 = s.length + this.numberOfSpacesAfterNewText;
9254
+ cursor_1.Cursor.setOffsetForPrimitive(e, _o13, this.autoScroll);
9184
9255
  }
9185
9256
  this.autoScroll && browser_1$1.Browser.IS_SAFARI() && this.isCursorAtEnd && autoScroll_1.AutoScroll.scrollSafariPrimitiveToEnd(e);
9186
9257
  }
@@ -9377,24 +9448,24 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
9377
9448
  }, {
9378
9449
  key: "getNewSpeechConfig",
9379
9450
  value: function () {
9380
- var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(e, t) {
9381
- return _regeneratorRuntime().wrap(function _callee69$(_context69) {
9382
- while (1) switch (_context69.prev = _context69.next) {
9451
+ var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(e, t) {
9452
+ return _regeneratorRuntime().wrap(function _callee70$(_context70) {
9453
+ while (1) switch (_context70.prev = _context70.next) {
9383
9454
  case 0:
9384
9455
  if (!t.region) {
9385
- _context69.next = 2;
9456
+ _context70.next = 2;
9386
9457
  break;
9387
9458
  }
9388
- return _context69.abrupt("return", t.subscriptionKey ? e.fromSubscription(t.subscriptionKey.trim(), t.region.trim()) : t.token ? e.fromAuthorizationToken(t.token.trim(), t.region.trim()) : t.retrieveToken ? t.retrieveToken().then(function (n) {
9459
+ return _context70.abrupt("return", t.subscriptionKey ? e.fromSubscription(t.subscriptionKey.trim(), t.region.trim()) : t.token ? e.fromAuthorizationToken(t.token.trim(), t.region.trim()) : t.retrieveToken ? t.retrieveToken().then(function (n) {
9389
9460
  return t.region ? e.fromAuthorizationToken((n == null ? void 0 : n.trim()) || "", t.region.trim()) : null;
9390
9461
  })["catch"](function (n) {
9391
9462
  return console.error(n), null;
9392
9463
  }) : null);
9393
9464
  case 2:
9394
9465
  case "end":
9395
- return _context69.stop();
9466
+ return _context70.stop();
9396
9467
  }
9397
- }, _callee69);
9468
+ }, _callee70);
9398
9469
  }));
9399
9470
  function getNewSpeechConfig(_x120, _x121) {
9400
9471
  return _getNewSpeechConfig.apply(this, arguments);
@@ -9409,21 +9480,21 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
9409
9480
  }, {
9410
9481
  key: "get",
9411
9482
  value: function () {
9412
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(e, t) {
9483
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(e, t) {
9413
9484
  var n;
9414
- return _regeneratorRuntime().wrap(function _callee70$(_context70) {
9415
- while (1) switch (_context70.prev = _context70.next) {
9485
+ return _regeneratorRuntime().wrap(function _callee71$(_context71) {
9486
+ while (1) switch (_context71.prev = _context71.next) {
9416
9487
  case 0:
9417
- _context70.next = 2;
9488
+ _context71.next = 2;
9418
9489
  return AzureSpeechConfig.getNewSpeechConfig(e, t);
9419
9490
  case 2:
9420
- n = _context70.sent;
9421
- return _context70.abrupt("return", (n && AzureSpeechConfig.process(n, t), n));
9491
+ n = _context71.sent;
9492
+ return _context71.abrupt("return", (n && AzureSpeechConfig.process(n, t), n));
9422
9493
  case 4:
9423
9494
  case "end":
9424
- return _context70.stop();
9495
+ return _context71.stop();
9425
9496
  }
9426
- }, _callee70);
9497
+ }, _callee71);
9427
9498
  }));
9428
9499
  function get(_x122, _x123) {
9429
9500
  return _get.apply(this, arguments);
@@ -9515,26 +9586,26 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
9515
9586
  }, {
9516
9587
  key: "startAsync",
9517
9588
  value: function () {
9518
- var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(e) {
9589
+ var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(e) {
9519
9590
  var t;
9520
- return _regeneratorRuntime().wrap(function _callee71$(_context71) {
9521
- while (1) switch (_context71.prev = _context71.next) {
9591
+ return _regeneratorRuntime().wrap(function _callee72$(_context72) {
9592
+ while (1) switch (_context72.prev = _context72.next) {
9522
9593
  case 0:
9523
- _context71.t0 = this.validate(e);
9524
- if (!_context71.t0) {
9525
- _context71.next = 6;
9594
+ _context72.t0 = this.validate(e);
9595
+ if (!_context72.t0) {
9596
+ _context72.next = 6;
9526
9597
  break;
9527
9598
  }
9528
- _context71.next = 4;
9599
+ _context72.next = 4;
9529
9600
  return this.instantiateService(e);
9530
9601
  case 4:
9531
9602
  this._translations = e == null ? void 0 : e.translations;
9532
9603
  (t = this._service) === null || t === void 0 || t.startContinuousRecognitionAsync(function () {}, this.error);
9533
9604
  case 6:
9534
9605
  case "end":
9535
- return _context71.stop();
9606
+ return _context72.stop();
9536
9607
  }
9537
- }, _callee71, this);
9608
+ }, _callee72, this);
9538
9609
  }));
9539
9610
  function startAsync(_x124) {
9540
9611
  return _startAsync.apply(this, arguments);
@@ -9549,26 +9620,26 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
9549
9620
  }, {
9550
9621
  key: "instantiateService",
9551
9622
  value: function () {
9552
- var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(e) {
9553
- var t, n, s, _o13;
9554
- return _regeneratorRuntime().wrap(function _callee72$(_context72) {
9555
- while (1) switch (_context72.prev = _context72.next) {
9623
+ var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(e) {
9624
+ var t, n, s, _o14;
9625
+ return _regeneratorRuntime().wrap(function _callee73$(_context73) {
9626
+ while (1) switch (_context73.prev = _context73.next) {
9556
9627
  case 0:
9557
9628
  t = Azure.getAPI();
9558
9629
  n = t.AudioConfig.fromDefaultMicrophoneInput();
9559
- _context72.next = 4;
9630
+ _context73.next = 4;
9560
9631
  return azureSpeechConfig_1.AzureSpeechConfig.get(t.SpeechConfig, e);
9561
9632
  case 4:
9562
- s = _context72.sent;
9633
+ s = _context73.sent;
9563
9634
  if (s) {
9564
- _o13 = new t.SpeechRecognizer(s, n);
9565
- this.setEvents(_o13), this._service = _o13, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
9635
+ _o14 = new t.SpeechRecognizer(s, n);
9636
+ this.setEvents(_o14), this._service = _o14, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
9566
9637
  } else this.error("Unable to contact Azure server");
9567
9638
  case 6:
9568
9639
  case "end":
9569
- return _context72.stop();
9640
+ return _context73.stop();
9570
9641
  }
9571
- }, _callee72, this);
9642
+ }, _callee73, this);
9572
9643
  }));
9573
9644
  function instantiateService(_x125) {
9574
9645
  return _instantiateService.apply(this, arguments);
@@ -9608,9 +9679,9 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
9608
9679
  if (n.text && !this._stopping) {
9609
9680
  var _azureTranscript_1$Az2 = azureTranscript_1.AzureTranscript.extract(this._newTextPadding + n.text, this.finalTranscript, !0, this._translations),
9610
9681
  _s22 = _azureTranscript_1$Az2.interimTranscript,
9611
- _o14 = _azureTranscript_1$Az2.finalTranscript,
9682
+ _o15 = _azureTranscript_1$Az2.finalTranscript,
9612
9683
  _a12 = _azureTranscript_1$Az2.newText;
9613
- stopTimeout_1.StopTimeout.reset(this, this.stopTimeoutMS), this.updateElements(_s22, _o14, _a12), _o14 !== "" && (this._newTextPadding = " ");
9684
+ stopTimeout_1.StopTimeout.reset(this, this.stopTimeoutMS), this.updateElements(_s22, _o15, _a12), _o15 !== "" && (this._newTextPadding = " ");
9614
9685
  }
9615
9686
  break;
9616
9687
  }
@@ -9952,84 +10023,77 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
9952
10023
  }, {
9953
10024
  key: "submit",
9954
10025
  value: function () {
9955
- var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(e, t) {
9956
- var c, u, n, s, o, a, l;
9957
- return _regeneratorRuntime().wrap(function _callee73$(_context73) {
9958
- while (1) switch (_context73.prev = _context73.next) {
10026
+ var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(e, t) {
10027
+ var l, c, n, s, o, a;
10028
+ return _regeneratorRuntime().wrap(function _callee74$(_context74) {
10029
+ while (1) switch (_context74.prev = _context74.next) {
9959
10030
  case 0:
9960
- _context73.t0 = e;
9961
- if (_context73.t0) {
9962
- _context73.next = 6;
10031
+ _context74.t0 = e;
10032
+ if (_context74.t0) {
10033
+ _context74.next = 6;
9963
10034
  break;
9964
10035
  }
9965
- _context73.next = 4;
10036
+ _context74.next = 4;
9966
10037
  return this._fileAttachments.completePlaceholders();
9967
10038
  case 4:
9968
10039
  n = this._fileAttachments.getAllFileData();
9969
- s = n == null ? void 0 : n.map(function (d) {
9970
- return d.file;
10040
+ s = n == null ? void 0 : n.map(function (u) {
10041
+ return u.file;
9971
10042
  });
9972
10043
  case 6:
9973
10044
  o = t === "" ? void 0 : t;
9974
- if (!this._isRequestInProgress) {
9975
- _context73.next = 9;
10045
+ if (!(this._isRequestInProgress || !Websocket.canSendMessage(this._serviceIO.websocket))) {
10046
+ _context74.next = 9;
9976
10047
  break;
9977
10048
  }
9978
- return _context73.abrupt("return");
10049
+ return _context74.abrupt("return");
9979
10050
  case 9:
9980
- a = this._serviceIO.websocket;
9981
- if (!(a && (a === "pending" || a.readyState === void 0 || a.readyState !== a.OPEN))) {
9982
- _context73.next = 12;
9983
- break;
9984
- }
9985
- return _context73.abrupt("return");
9986
- case 12:
9987
- if (!((c = this._serviceIO.deepChat) != null && c.validateMessageBeforeSending)) {
9988
- _context73.next = 17;
10051
+ if (!((l = this._serviceIO.deepChat) != null && l.validateMessageBeforeSending)) {
10052
+ _context74.next = 14;
9989
10053
  break;
9990
10054
  }
9991
10055
  if (this._serviceIO.deepChat.validateMessageBeforeSending(o, s)) {
9992
- _context73.next = 15;
10056
+ _context74.next = 12;
9993
10057
  break;
9994
10058
  }
9995
- return _context73.abrupt("return");
9996
- case 15:
9997
- _context73.next = 19;
10059
+ return _context74.abrupt("return");
10060
+ case 12:
10061
+ _context74.next = 16;
9998
10062
  break;
9999
- case 17:
10063
+ case 14:
10000
10064
  if (this._serviceIO.canSendMessage(o, s)) {
10001
- _context73.next = 19;
10065
+ _context74.next = 16;
10002
10066
  break;
10003
10067
  }
10004
- return _context73.abrupt("return");
10005
- case 19:
10068
+ return _context74.abrupt("return");
10069
+ case 16:
10006
10070
  this.changeToLoadingIcon();
10007
10071
  t !== "" && this._messages.addNewMessage({
10008
10072
  text: t
10009
10073
  }, !1, !0);
10010
- _context73.t1 = n;
10011
- if (!_context73.t1) {
10012
- _context73.next = 25;
10074
+ _context74.t1 = n;
10075
+ if (!_context74.t1) {
10076
+ _context74.next = 22;
10013
10077
  break;
10014
10078
  }
10015
- _context73.next = 25;
10079
+ _context74.next = 22;
10016
10080
  return this._messages.addMultipleFiles(n);
10017
- case 25:
10081
+ case 22:
10018
10082
  this._messages.addLoadingMessage();
10019
10083
  e || TextInputEl.clear(this._inputElementRef);
10020
- l = {
10084
+ a = {
10021
10085
  text: o,
10022
10086
  files: s
10023
10087
  };
10024
- _context73.next = 30;
10025
- return this._serviceIO.callAPI(l, this._messages);
10026
- case 30:
10027
- e || (u = this._fileAttachments) == null || u.removeAllFiles();
10028
- case 31:
10088
+ _context74.next = 27;
10089
+ return this._serviceIO.callAPI(a, this._messages);
10090
+ case 27:
10091
+ e || (c = this._fileAttachments) == null || c.removeAllFiles();
10092
+ case 28:
10029
10093
  case "end":
10030
- return _context73.stop();
10094
+ return _context74.stop();
10031
10095
  }
10032
- }, _callee73, this);
10096
+ }, _callee74, this);
10033
10097
  }));
10034
10098
  function submit(_x126, _x127) {
10035
10099
  return _submit.apply(this, arguments);
@@ -10039,7 +10103,8 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
10039
10103
  }, {
10040
10104
  key: "stopStream",
10041
10105
  value: function stopStream() {
10042
- this._abortStream.abort(), this._stopClicked.listener(), this.changeToSubmitIcon();
10106
+ var e;
10107
+ this._abortStream.abort(), (e = this._stopClicked) == null || e.listener(), this.changeToSubmitIcon();
10043
10108
  }
10044
10109
  }, {
10045
10110
  key: "changeToStopIcon",
@@ -10168,8 +10233,8 @@ var CameraModal = /*#__PURE__*/function (_Modal2) {
10168
10233
  _s23 = new Blob([n], {
10169
10234
  type: this._format
10170
10235
  }),
10171
- _o15 = this._format === "image/jpeg" ? "jpeg" : "png",
10172
- _a13 = NewFileName.getFileName(this._newFilePrefix || "photo", _o15);
10236
+ _o16 = this._format === "image/jpeg" ? "jpeg" : "png",
10237
+ _a13 = NewFileName.getFileName(this._newFilePrefix || "photo", _o16);
10173
10238
  return new File([_s23], _a13, {
10174
10239
  type: _s23.type
10175
10240
  });
@@ -10306,9 +10371,9 @@ var Input = /*#__PURE__*/function () {
10306
10371
  u = _FILE_TYPE_BUTTON_ICO.id,
10307
10372
  d = _FILE_TYPE_BUTTON_ICO.svgString,
10308
10373
  h = _FILE_TYPE_BUTTON_ICO.dropupText,
10309
- p = new UploadFileButton(n, c, l, u, d, h);
10374
+ f = new UploadFileButton(n, c, l, u, d, h);
10310
10375
  s[a] = {
10311
- button: p,
10376
+ button: f,
10312
10377
  fileType: c
10313
10378
  };
10314
10379
  }