deep-chat-dev 9.0.2 → 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: "processResponseInterceptor",
379
- value: function () {
380
- var _processResponseInterceptor = _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 processResponseInterceptor(_x4, _x5) {
410
- return _processResponseInterceptor.apply(this, arguments);
411
- }
412
- return processResponseInterceptor;
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 _callee73(r, e) {
331
+ _getBytes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(r, e) {
424
332
  var t, n;
425
- return _regeneratorRuntime().wrap(function _callee73$(_context73) {
426
- while (1) switch (_context73.prev = _context73.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
- _context73.next = 3;
338
+ _context75.next = 3;
431
339
  return t.read();
432
340
  case 3:
433
- if ((n = _context73.sent).done) {
434
- _context73.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
- _context73.next = 1;
347
+ _context75.next = 1;
440
348
  break;
441
349
  case 7:
442
350
  case "end":
443
- return _context73.stop();
351
+ return _context75.stop();
444
352
  }
445
- }, _callee73);
353
+ }, _callee75);
446
354
  }));
447
355
  return _getBytes.apply(this, arguments);
448
356
  }
@@ -531,12 +439,12 @@ 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
- b.abort(), document.hidden || I();
447
+ b.abort(), document.hidden || x();
540
448
  }
541
449
  c || document.addEventListener("visibilitychange", m);
542
450
  var g = DefaultRetryInterval,
@@ -547,70 +455,162 @@ function fetchEventSource(r, e) {
547
455
  t == null || t.addEventListener("abort", function () {
548
456
  y(), h();
549
457
  });
550
- var _ = u !== null && u !== void 0 ? u : window.fetch,
551
- S = s !== null && s !== void 0 ? s : defaultOnOpen;
552
- function I() {
553
- return _I.apply(this, arguments);
554
- }
555
- function _I() {
556
- _I = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
557
- var R, w, x;
558
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
559
- while (1) switch (_context3.prev = _context3.next) {
458
+ var S = u !== null && u !== void 0 ? u : window.fetch,
459
+ E = s !== null && s !== void 0 ? s : defaultOnOpen;
460
+ function x() {
461
+ return _x3.apply(this, arguments);
462
+ }
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;
564
- return _(r, Object.assign(Object.assign({}, d), {
565
- headers: f,
470
+ _context.prev = 1;
471
+ _context.next = 4;
472
+ return S(r, Object.assign(Object.assign({}, d), {
473
+ headers: p,
566
474
  signal: b.signal
567
475
  }));
568
476
  case 4:
569
- w = _context3.sent;
570
- _context3.next = 7;
571
- return S(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 (x) {
575
- x ? f[LastEventId] = x : delete f[LastEventId];
576
- }, function (x) {
577
- g = x;
481
+ _context.next = 9;
482
+ return getBytes(C.body, getLines(getMessages(function (_) {
483
+ _ ? p[LastEventId] = _ : delete p[LastEventId];
484
+ }, function (_) {
485
+ g = _;
578
486
  }, o)));
579
487
  case 9:
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
- x = (R = l == null ? void 0 : l(_context3.t0)) !== null && R !== void 0 ? R : g;
590
- window.clearTimeout(v), v = window.setTimeout(I, x);
591
- } catch (x) {
592
- y(), p(x);
497
+ _ = (R = l == null ? void 0 : l(_context.t0)) !== null && R !== void 0 ? R : g;
498
+ window.clearTimeout(v), v = window.setTimeout(x, _);
499
+ } catch (_) {
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 _I.apply(this, arguments);
508
+ return _x3.apply(this, arguments);
601
509
  }
602
- I();
510
+ x();
603
511
  });
604
512
  }
605
513
  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
- function C() {
611
- _classCallCheck(this, C);
610
+ function A() {
611
+ _classCallCheck(this, A);
612
612
  }
613
- _createClass(C, null, [{
613
+ _createClass(A, null, [{
614
614
  key: "generateResponseForOneMessage",
615
615
  value: function generateResponseForOneMessage(e) {
616
616
  if (e.file) return e.file.type === "image" ? "That is a nice image!" : e.file.type === "audio" ? "I like the sound of that!" : e.file.type === "gif" ? "That is a nice gif!" : "That is an interesting file!";
@@ -625,11 +625,11 @@ var _Demo = /*#__PURE__*/function () {
625
625
  value: function generateResponse(e) {
626
626
  var t = [];
627
627
  for (var s = e.messages.length - 1; s >= 0 && e.messages[s].role !== "ai"; s -= 1) t.push(e.messages[s]);
628
- if (t.length === 1) return C.generateResponseForOneMessage(e.messages[e.messages.length - 1]);
628
+ if (t.length === 1) return A.generateResponseForOneMessage(e.messages[e.messages.length - 1]);
629
629
  var n = e.messages.findIndex(function (s) {
630
630
  return s.text;
631
631
  });
632
- return n !== -1 && t.splice(n, 1), t.length === 1 ? C.generateResponseForOneMessage(e.messages[e.messages.length - 1]) : "Wow, very cool files!";
632
+ return n !== -1 && t.splice(n, 1), t.length === 1 ? A.generateResponseForOneMessage(e.messages[e.messages.length - 1]) : "Wow, very cool files!";
633
633
  }
634
634
  }, {
635
635
  key: "getCustomResponse",
@@ -639,15 +639,15 @@ var _Demo = /*#__PURE__*/function () {
639
639
  }, {
640
640
  key: "getResponse",
641
641
  value: function getResponse(e) {
642
- return e.customDemoResponse ? C.getCustomResponse(e.customDemoResponse, e.messages[e.messages.length - 1]) : {
643
- text: C.generateResponse(e)
642
+ return e.customDemoResponse ? A.getCustomResponse(e.customDemoResponse, e.messages[e.messages.length - 1]) : {
643
+ text: A.generateResponse(e)
644
644
  };
645
645
  }
646
646
  // timeout is used to simulate a timeout for a response to come back
647
647
  }, {
648
648
  key: "request",
649
649
  value: function request(e, t, n) {
650
- var s = C.getResponse(e);
650
+ var s = A.getResponse(e);
651
651
  setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
652
652
  var o;
653
653
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
@@ -678,12 +678,12 @@ var _Demo = /*#__PURE__*/function () {
678
678
  value: function requestStream(e, t) {
679
679
  setTimeout(function () {
680
680
  var s;
681
- var n = (s = C.getResponse(e)) == null ? void 0 : s.text;
681
+ var n = (s = A.getResponse(e)) == null ? void 0 : s.text;
682
682
  Stream.simulate(e, t, n);
683
683
  }, 400);
684
684
  }
685
685
  }]);
686
- return C;
686
+ return A;
687
687
  }();
688
688
  _Demo.URL = "deep-chat-demo";
689
689
  var Demo = _Demo;
@@ -697,10 +697,11 @@ 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,
704
+ v,
704
705
  o,
705
706
  _yield$RequestUtils$p,
706
707
  a,
@@ -710,7 +711,7 @@ var Stream = /*#__PURE__*/function () {
710
711
  u,
711
712
  d,
712
713
  h,
713
- p,
714
+ f,
714
715
  _args6 = arguments;
715
716
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
716
717
  while (1) switch (_context6.prev = _context6.next) {
@@ -718,10 +719,10 @@ var Stream = /*#__PURE__*/function () {
718
719
  s = _args6.length > 3 && _args6[3] !== undefined ? _args6[3] : !0;
719
720
  o = {
720
721
  body: t,
721
- headers: (f = e.requestSettings) == null ? void 0 : f.headers
722
+ headers: (p = e.requestSettings) == null ? void 0 : p.headers
722
723
  };
723
724
  _context6.next = 4;
724
- return RequestUtils.processResponseInterceptor(e.deepChat, o);
725
+ return RequestUtils.processRequestInterceptor(e.deepChat, o);
725
726
  case 4:
726
727
  _yield$RequestUtils$p = _context6.sent;
727
728
  a = _yield$RequestUtils$p.body;
@@ -737,32 +738,38 @@ var Stream = /*#__PURE__*/function () {
737
738
  }
738
739
  return _context6.abrupt("return", Stream.onInterceptorError(n, c, d));
739
740
  case 14:
740
- if (!(((b = e.requestSettings) == null ? void 0 : b.url) === Demo.URL)) {
741
+ if (!((b = e.requestSettings) != null && b.handler)) {
741
742
  _context6.next = 16;
742
743
  break;
743
744
  }
744
- return _context6.abrupt("return", Demo.requestStream(n, e.streamHandlers));
745
+ return _context6.abrupt("return", CustomHandler.stream(e, a, n));
745
746
  case 16:
746
- p = null;
747
- fetchEventSource(((m = e.requestSettings) == null ? void 0 : m.url) || e.url || "", {
748
- method: ((g = e.requestSettings) == null ? void 0 : g.method) || "POST",
747
+ if (!(((m = e.requestSettings) == null ? void 0 : m.url) === Demo.URL)) {
748
+ _context6.next = 18;
749
+ break;
750
+ }
751
+ return _context6.abrupt("return", Demo.requestStream(n, e.streamHandlers));
752
+ case 18:
753
+ f = null;
754
+ fetchEventSource(((g = e.requestSettings) == null ? void 0 : g.url) || e.url || "", {
755
+ method: ((v = e.requestSettings) == null ? void 0 : v.method) || "POST",
749
756
  headers: l,
750
757
  body: s ? JSON.stringify(a) : a,
751
758
  openWhenHidden: !0,
752
759
  // keep stream open when browser tab not open
753
- onopen: function onopen(v) {
760
+ onopen: function onopen(y) {
754
761
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
755
762
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
756
763
  while (1) switch (_context5.prev = _context5.next) {
757
764
  case 0:
758
- if (!v.ok) {
765
+ if (!y.ok) {
759
766
  _context5.next = 2;
760
767
  break;
761
768
  }
762
- return _context5.abrupt("return", (p = n.addNewStreamedMessage(), u()));
769
+ return _context5.abrupt("return", (f = n.addNewStreamedMessage(), u()));
763
770
  case 2:
764
771
  _context5.next = 4;
765
- return RequestUtils.processResponseByType(v);
772
+ return RequestUtils.processResponseByType(y);
766
773
  case 4:
767
774
  throw _context5.sent;
768
775
  case 5:
@@ -772,39 +779,39 @@ var Stream = /*#__PURE__*/function () {
772
779
  }, _callee5);
773
780
  }))();
774
781
  },
775
- onmessage: function onmessage(v) {
776
- var y;
777
- if (JSON.stringify(v.data) !== JSON.stringify("[DONE]")) {
778
- var _ = JSON.parse(v.data);
779
- (y = e.extractResultData) == null || y.call(e, _).then(function (S) {
780
- (S == null ? void 0 : S.text) === void 0 ? console.error("Response data: ".concat(v.data, " \n ").concat(ErrorMessages.INVALID_STREAM_RESPONSE)) : p && n.updateStreamedMessage(S.text, p);
781
- })["catch"](function (S) {
782
- return RequestUtils.displayError(n, S);
782
+ onmessage: function onmessage(y) {
783
+ var S;
784
+ if (JSON.stringify(y.data) !== JSON.stringify("[DONE]")) {
785
+ var E = JSON.parse(y.data);
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)) : f && n.updateStreamedMessage(x.text, f);
788
+ })["catch"](function (x) {
789
+ return RequestUtils.displayError(n, x);
783
790
  });
784
791
  }
785
792
  },
786
- onerror: function onerror(v) {
787
- throw d(), v;
793
+ onerror: function onerror(y) {
794
+ throw d(), y;
788
795
  },
789
796
  onclose: function onclose() {
790
797
  n.finaliseStreamedMessage(), d();
791
798
  },
792
799
  signal: h.signal
793
- })["catch"](function (v) {
794
- var y;
795
- (y = e.extractResultData) == null || y.call(e, v).then(function () {
796
- RequestUtils.displayError(n, v);
797
- })["catch"](function (_) {
798
- RequestUtils.displayError(n, _);
800
+ })["catch"](function (y) {
801
+ var S;
802
+ (S = e.extractResultData) == null || S.call(e, y).then(function () {
803
+ RequestUtils.displayError(n, y);
804
+ })["catch"](function (E) {
805
+ RequestUtils.displayError(n, E);
799
806
  });
800
807
  });
801
- case 18:
808
+ case 20:
802
809
  case "end":
803
810
  return _context6.stop();
804
811
  }
805
812
  }, _callee6);
806
813
  }));
807
- function request(_x8, _x9, _x10) {
814
+ function request(_x9, _x10, _x11) {
808
815
  return _request.apply(this, arguments);
809
816
  }
810
817
  return request;
@@ -846,77 +853,156 @@ var Stream = /*#__PURE__*/function () {
846
853
  }]);
847
854
  return Stream;
848
855
  }();
849
- var CustomRequest = /*#__PURE__*/function () {
850
- function CustomRequest() {
851
- _classCallCheck(this, CustomRequest);
856
+ var CustomHandler = /*#__PURE__*/function () {
857
+ function CustomHandler() {
858
+ _classCallCheck(this, CustomHandler);
852
859
  }
853
- _createClass(CustomRequest, null, [{
860
+ _createClass(CustomHandler, null, [{
854
861
  key: "request",
855
862
  value: function () {
856
863
  var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(e, t, n) {
857
- var s, o;
864
+ var o, a, s;
858
865
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
859
866
  while (1) switch (_context8.prev = _context8.next) {
860
867
  case 0:
861
- (o = (s = e.requestSettings).handler) == null || o.call(s, t).then( /*#__PURE__*/function () {
862
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(a) {
863
- var u, d, l, c;
868
+ s = /*#__PURE__*/function () {
869
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(l) {
870
+ var u, d, c;
864
871
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
865
872
  while (1) switch (_context7.prev = _context7.next) {
866
873
  case 0:
867
- if (e.extractResultData) {
868
- _context7.next = 2;
869
- break;
870
- }
871
- return _context7.abrupt("return");
874
+ _context7.next = 2;
875
+ return (d = (u = e.deepChat).responseInterceptor) == null ? void 0 : d.call(u, l);
872
876
  case 2:
873
- _context7.next = 4;
874
- return (d = (u = e.deepChat).responseInterceptor) == null ? void 0 : d.call(u, a);
875
- case 4:
876
877
  _context7.t0 = _context7.sent;
877
878
  if (_context7.t0) {
878
- _context7.next = 7;
879
+ _context7.next = 5;
879
880
  break;
880
881
  }
881
- _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());
882
886
  case 7:
883
- l = _context7.t0;
884
- _context7.next = 10;
885
- return e.extractResultData(l);
886
- case 10:
887
- c = _context7.sent;
888
- if (!(!c || _typeof(c) != "object")) {
889
- _context7.next = 13;
890
- break;
891
- }
892
- throw Error(ErrorMessages.INVALID_RESPONSE(a, "response", !!e.deepChat.responseInterceptor, c));
893
- case 13:
894
- e.deepChat.stream && c.text ? Stream.simulate(n, e.streamHandlers, c.text) : (n.addNewMessage(c, !0, !0), e.completionsHandlers.onFinish());
895
- case 14:
896
887
  case "end":
897
888
  return _context7.stop();
898
889
  }
899
890
  }, _callee7);
900
891
  }));
901
- return function (_x14) {
892
+ return function s(_x15) {
902
893
  return _ref2.apply(this, arguments);
903
894
  };
904
- }())["catch"](function (a) {
905
- RequestUtils.displayError(n, a), e.completionsHandlers.onFinish();
895
+ }();
896
+ (a = (o = e.requestSettings).handler) == null || a.call(o, t, {
897
+ onResponse: s
906
898
  });
907
- case 1:
899
+ case 2:
908
900
  case "end":
909
901
  return _context8.stop();
910
902
  }
911
903
  }, _callee8);
912
904
  }));
913
- function request(_x11, _x12, _x13) {
905
+ function request(_x12, _x13, _x14) {
914
906
  return _request2.apply(this, arguments);
915
907
  }
916
908
  return request;
917
909
  }()
910
+ }, {
911
+ key: "stream",
912
+ value: function () {
913
+ var _stream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(e, t, n) {
914
+ var h, f, s, o, a, l, c, u, d;
915
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
916
+ while (1) switch (_context9.prev = _context9.next) {
917
+ case 0:
918
+ s = !0, o = !1, a = null;
919
+ l = function l() {
920
+ o || !s || (a = n.addNewStreamedMessage(), e.streamHandlers.onOpen(), o = !0);
921
+ }, c = function c() {
922
+ s && (n.finaliseStreamedMessage(), e.streamHandlers.onClose(), s = !1);
923
+ }, u = function u(p) {
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));
925
+ };
926
+ e.streamHandlers.abortStream.abort = function () {
927
+ n.finaliseStreamedMessage(), e.streamHandlers.onClose(), s = !1;
928
+ };
929
+ d = {
930
+ onOpen: l,
931
+ onResponse: u,
932
+ onClose: c,
933
+ stopClicked: e.streamHandlers.stopClicked
934
+ };
935
+ (f = (h = e.requestSettings).handler) == null || f.call(h, t, d);
936
+ case 5:
937
+ case "end":
938
+ return _context9.stop();
939
+ }
940
+ }, _callee9);
941
+ }));
942
+ function stream(_x16, _x17, _x18) {
943
+ return _stream.apply(this, arguments);
944
+ }
945
+ return stream;
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
+ }
918
1004
  }]);
919
- return CustomRequest;
1005
+ return CustomHandler;
920
1006
  }();
921
1007
  var HTTPRequest = /*#__PURE__*/function () {
922
1008
  function HTTPRequest() {
@@ -926,11 +1012,11 @@ var HTTPRequest = /*#__PURE__*/function () {
926
1012
  key: "request",
927
1013
  value: // prettier-ignore
928
1014
  function () {
929
- var _request3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(e, t, n) {
1015
+ var _request3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(e, t, n) {
930
1016
  var s,
931
1017
  h,
932
- p,
933
1018
  f,
1019
+ p,
934
1020
  b,
935
1021
  m,
936
1022
  o,
@@ -940,40 +1026,40 @@ var HTTPRequest = /*#__PURE__*/function () {
940
1026
  c,
941
1027
  u,
942
1028
  d,
943
- _args10 = arguments;
944
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
945
- while (1) switch (_context10.prev = _context10.next) {
1029
+ _args12 = arguments;
1030
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1031
+ while (1) switch (_context12.prev = _context12.next) {
946
1032
  case 0:
947
- s = _args10.length > 3 && _args10[3] !== undefined ? _args10[3] : !0;
1033
+ s = _args12.length > 3 && _args12[3] !== undefined ? _args12[3] : !0;
948
1034
  o = {
949
1035
  body: t,
950
1036
  headers: (h = e.requestSettings) == null ? void 0 : h.headers
951
1037
  };
952
- _context10.next = 4;
953
- return RequestUtils.processResponseInterceptor(e.deepChat, o);
1038
+ _context12.next = 4;
1039
+ return RequestUtils.processRequestInterceptor(e.deepChat, o);
954
1040
  case 4:
955
- _yield$RequestUtils$p2 = _context10.sent;
1041
+ _yield$RequestUtils$p2 = _context12.sent;
956
1042
  a = _yield$RequestUtils$p2.body;
957
1043
  l = _yield$RequestUtils$p2.headers;
958
1044
  c = _yield$RequestUtils$p2.error;
959
1045
  u = e.completionsHandlers.onFinish;
960
1046
  if (!c) {
961
- _context10.next = 11;
1047
+ _context12.next = 11;
962
1048
  break;
963
1049
  }
964
- return _context10.abrupt("return", HTTPRequest.onInterceptorError(n, c, u));
1050
+ return _context12.abrupt("return", HTTPRequest.onInterceptorError(n, c, u));
965
1051
  case 11:
966
- if (!((p = e.requestSettings) != null && p.handler)) {
967
- _context10.next = 13;
1052
+ if (!((f = e.requestSettings) != null && f.handler)) {
1053
+ _context12.next = 13;
968
1054
  break;
969
1055
  }
970
- return _context10.abrupt("return", CustomRequest.request(e, a, n));
1056
+ return _context12.abrupt("return", CustomHandler.request(e, a, n));
971
1057
  case 13:
972
- if (!(((f = e.requestSettings) == null ? void 0 : f.url) === Demo.URL)) {
973
- _context10.next = 15;
1058
+ if (!(((p = e.requestSettings) == null ? void 0 : p.url) === Demo.URL)) {
1059
+ _context12.next = 15;
974
1060
  break;
975
1061
  }
976
- return _context10.abrupt("return", Demo.request(n, u, e.deepChat.responseInterceptor));
1062
+ return _context12.abrupt("return", Demo.request(n, u, e.deepChat.responseInterceptor));
977
1063
  case 15:
978
1064
  d = !0;
979
1065
  fetch(((b = e.requestSettings) == null ? void 0 : b.url) || e.url || "", {
@@ -985,40 +1071,40 @@ var HTTPRequest = /*#__PURE__*/function () {
985
1071
  }).then(function (g) {
986
1072
  return RequestUtils.processResponseByType(g);
987
1073
  }).then( /*#__PURE__*/function () {
988
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(g) {
989
- var _, S, v, y;
990
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
991
- while (1) switch (_context9.prev = _context9.next) {
1074
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(g) {
1075
+ var S, E, v, y;
1076
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1077
+ while (1) switch (_context11.prev = _context11.next) {
992
1078
  case 0:
993
1079
  if (e.extractResultData) {
994
- _context9.next = 2;
1080
+ _context11.next = 2;
995
1081
  break;
996
1082
  }
997
- return _context9.abrupt("return");
1083
+ return _context11.abrupt("return");
998
1084
  case 2:
999
- _context9.next = 4;
1000
- return (S = (_ = e.deepChat).responseInterceptor) == null ? void 0 : S.call(_, g);
1085
+ _context11.next = 4;
1086
+ return (E = (S = e.deepChat).responseInterceptor) == null ? void 0 : E.call(S, g);
1001
1087
  case 4:
1002
- _context9.t0 = _context9.sent;
1003
- if (_context9.t0) {
1004
- _context9.next = 7;
1088
+ _context11.t0 = _context11.sent;
1089
+ if (_context11.t0) {
1090
+ _context11.next = 7;
1005
1091
  break;
1006
1092
  }
1007
- _context9.t0 = g;
1093
+ _context11.t0 = g;
1008
1094
  case 7:
1009
- v = _context9.t0;
1010
- _context9.next = 10;
1095
+ v = _context11.t0;
1096
+ _context11.next = 10;
1011
1097
  return e.extractResultData(v);
1012
1098
  case 10:
1013
- y = _context9.sent;
1099
+ y = _context11.sent;
1014
1100
  if (d) {
1015
- _context9.next = 13;
1101
+ _context11.next = 13;
1016
1102
  break;
1017
1103
  }
1018
1104
  throw g;
1019
1105
  case 13:
1020
1106
  if (!(!y || _typeof(y) != "object")) {
1021
- _context9.next = 15;
1107
+ _context11.next = 15;
1022
1108
  break;
1023
1109
  }
1024
1110
  throw Error(ErrorMessages.INVALID_RESPONSE(g, "response", !!e.deepChat.responseInterceptor, v));
@@ -1026,11 +1112,11 @@ var HTTPRequest = /*#__PURE__*/function () {
1026
1112
  y.pollingInAnotherRequest || (e.deepChat.stream && y.text ? Stream.simulate(n, e.streamHandlers, y.text) : (n.addNewMessage(y, !0, !0), u()));
1027
1113
  case 16:
1028
1114
  case "end":
1029
- return _context9.stop();
1115
+ return _context11.stop();
1030
1116
  }
1031
- }, _callee9);
1117
+ }, _callee11);
1032
1118
  }));
1033
- return function (_x18) {
1119
+ return function (_x23) {
1034
1120
  return _ref3.apply(this, arguments);
1035
1121
  };
1036
1122
  }())["catch"](function (g) {
@@ -1038,11 +1124,11 @@ var HTTPRequest = /*#__PURE__*/function () {
1038
1124
  });
1039
1125
  case 17:
1040
1126
  case "end":
1041
- return _context10.stop();
1127
+ return _context12.stop();
1042
1128
  }
1043
- }, _callee10);
1129
+ }, _callee12);
1044
1130
  }));
1045
- function request(_x15, _x16, _x17) {
1131
+ function request(_x20, _x21, _x22) {
1046
1132
  return _request3.apply(this, arguments);
1047
1133
  }
1048
1134
  return request;
@@ -1055,43 +1141,43 @@ var HTTPRequest = /*#__PURE__*/function () {
1055
1141
  fetch(t, n).then(function (a) {
1056
1142
  return a.json();
1057
1143
  }).then( /*#__PURE__*/function () {
1058
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(a) {
1144
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(a) {
1059
1145
  var c, u, l;
1060
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1061
- while (1) switch (_context11.prev = _context11.next) {
1146
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1147
+ while (1) switch (_context13.prev = _context13.next) {
1062
1148
  case 0:
1063
1149
  if (e.extractPollResultData) {
1064
- _context11.next = 2;
1150
+ _context13.next = 2;
1065
1151
  break;
1066
1152
  }
1067
- return _context11.abrupt("return");
1153
+ return _context13.abrupt("return");
1068
1154
  case 2:
1069
- _context11.t0 = e;
1070
- _context11.next = 5;
1155
+ _context13.t0 = e;
1156
+ _context13.next = 5;
1071
1157
  return (u = (c = e.deepChat).responseInterceptor) == null ? void 0 : u.call(c, a);
1072
1158
  case 5:
1073
- _context11.t1 = _context11.sent;
1074
- if (_context11.t1) {
1075
- _context11.next = 8;
1159
+ _context13.t1 = _context13.sent;
1160
+ if (_context13.t1) {
1161
+ _context13.next = 8;
1076
1162
  break;
1077
1163
  }
1078
- _context11.t1 = a;
1164
+ _context13.t1 = a;
1079
1165
  case 8:
1080
- _context11.t2 = _context11.t1;
1081
- _context11.next = 11;
1082
- return _context11.t0.extractPollResultData.call(_context11.t0, _context11.t2);
1166
+ _context13.t2 = _context13.t1;
1167
+ _context13.next = 11;
1168
+ return _context13.t0.extractPollResultData.call(_context13.t0, _context13.t2);
1083
1169
  case 11:
1084
- l = _context11.sent;
1170
+ l = _context13.sent;
1085
1171
  l.timeoutMS ? setTimeout(function () {
1086
1172
  HTTPRequest.executePollRequest(e, t, n, s);
1087
1173
  }, l.timeoutMS) : (console.log("finished polling"), s.addNewMessage(l, !0, !0), o());
1088
1174
  case 13:
1089
1175
  case "end":
1090
- return _context11.stop();
1176
+ return _context13.stop();
1091
1177
  }
1092
- }, _callee11);
1178
+ }, _callee13);
1093
1179
  }));
1094
- return function (_x19) {
1180
+ return function (_x24) {
1095
1181
  return _ref4.apply(this, arguments);
1096
1182
  };
1097
1183
  }())["catch"](function (a) {
@@ -1102,9 +1188,9 @@ var HTTPRequest = /*#__PURE__*/function () {
1102
1188
  }, {
1103
1189
  key: "poll",
1104
1190
  value: function () {
1105
- var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(e, t, n) {
1191
+ var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(e, t, n) {
1106
1192
  var s,
1107
- f,
1193
+ p,
1108
1194
  b,
1109
1195
  m,
1110
1196
  o,
@@ -1115,42 +1201,42 @@ var HTTPRequest = /*#__PURE__*/function () {
1115
1201
  u,
1116
1202
  d,
1117
1203
  h,
1118
- p,
1119
- _args12 = arguments;
1120
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1121
- while (1) switch (_context12.prev = _context12.next) {
1204
+ f,
1205
+ _args14 = arguments;
1206
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1207
+ while (1) switch (_context14.prev = _context14.next) {
1122
1208
  case 0:
1123
- s = _args12.length > 3 && _args12[3] !== undefined ? _args12[3] : !0;
1209
+ s = _args14.length > 3 && _args14[3] !== undefined ? _args14[3] : !0;
1124
1210
  o = {
1125
1211
  body: t,
1126
- headers: (f = e.requestSettings) == null ? void 0 : f.headers
1212
+ headers: (p = e.requestSettings) == null ? void 0 : p.headers
1127
1213
  };
1128
- _context12.next = 4;
1129
- return RequestUtils.processResponseInterceptor(e.deepChat, o);
1214
+ _context14.next = 4;
1215
+ return RequestUtils.processRequestInterceptor(e.deepChat, o);
1130
1216
  case 4:
1131
- _yield$RequestUtils$p3 = _context12.sent;
1217
+ _yield$RequestUtils$p3 = _context14.sent;
1132
1218
  a = _yield$RequestUtils$p3.body;
1133
1219
  l = _yield$RequestUtils$p3.headers;
1134
1220
  c = _yield$RequestUtils$p3.error;
1135
1221
  if (!c) {
1136
- _context12.next = 10;
1222
+ _context14.next = 10;
1137
1223
  break;
1138
1224
  }
1139
- return _context12.abrupt("return", HTTPRequest.onInterceptorError(n, c));
1225
+ return _context14.abrupt("return", HTTPRequest.onInterceptorError(n, c));
1140
1226
  case 10:
1141
- 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 = {
1142
1228
  method: d,
1143
1229
  body: h,
1144
1230
  headers: l
1145
1231
  };
1146
- HTTPRequest.executePollRequest(e, u, p, n);
1232
+ HTTPRequest.executePollRequest(e, u, f, n);
1147
1233
  case 12:
1148
1234
  case "end":
1149
- return _context12.stop();
1235
+ return _context14.stop();
1150
1236
  }
1151
- }, _callee12);
1237
+ }, _callee14);
1152
1238
  }));
1153
- function poll(_x20, _x21, _x22) {
1239
+ function poll(_x25, _x26, _x27) {
1154
1240
  return _poll.apply(this, arguments);
1155
1241
  }
1156
1242
  return poll;
@@ -1191,9 +1277,9 @@ var MessageLimitUtils = /*#__PURE__*/function () {
1191
1277
  var n = 0,
1192
1278
  s = e.length - 1;
1193
1279
  for (s; s >= 0; s -= 1) {
1194
- var a = (o = e[s]) == null ? void 0 : o.text;
1195
- if (a !== void 0 && (n += a.length, n > t)) {
1196
- e[s].text = a.substring(0, a.length - (n - t));
1280
+ var _a = (o = e[s]) == null ? void 0 : o.text;
1281
+ if (_a !== void 0 && (n += _a.length, n > t)) {
1282
+ e[s].text = _a.substring(0, _a.length - (n - t));
1197
1283
  break;
1198
1284
  }
1199
1285
  }
@@ -1243,15 +1329,19 @@ var Websocket = /*#__PURE__*/function () {
1243
1329
  value: function createConnection(e, t) {
1244
1330
  if (!document.body.contains(e.deepChat)) return;
1245
1331
  var n = e.requestSettings.websocket;
1246
- if (n) try {
1247
- var s = typeof n != "boolean" ? n : void 0;
1248
- e.websocket = new WebSocket(e.requestSettings.url || "", s), e.websocket.onopen = function () {
1249
- t.removeError(), e.websocket && _typeof(e.websocket) == "object" && Websocket.assignListeners(e, e.websocket, t);
1250
- }, e.websocket.onerror = function (o) {
1251
- console.error(o), Websocket.retryConnection(e, t);
1252
- };
1253
- } catch (s) {
1254
- 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
+ }
1255
1345
  }
1256
1346
  }
1257
1347
  }, {
@@ -1265,112 +1355,135 @@ var Websocket = /*#__PURE__*/function () {
1265
1355
  key: "assignListeners",
1266
1356
  value: function assignListeners(e, t, n) {
1267
1357
  t.onmessage = /*#__PURE__*/function () {
1268
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(s) {
1358
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(s) {
1269
1359
  var o, a, l, c, u;
1270
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1271
- while (1) switch (_context13.prev = _context13.next) {
1360
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1361
+ while (1) switch (_context15.prev = _context15.next) {
1272
1362
  case 0:
1273
1363
  if (!e.extractResultData) {
1274
- _context13.next = 20;
1364
+ _context15.next = 20;
1275
1365
  break;
1276
1366
  }
1277
- _context13.prev = 1;
1367
+ _context15.prev = 1;
1278
1368
  l = JSON.parse(s.data);
1279
- _context13.next = 5;
1369
+ _context15.next = 5;
1280
1370
  return (a = (o = e.deepChat).responseInterceptor) == null ? void 0 : a.call(o, l);
1281
1371
  case 5:
1282
- _context13.t0 = _context13.sent;
1283
- if (_context13.t0) {
1284
- _context13.next = 8;
1372
+ _context15.t0 = _context15.sent;
1373
+ if (_context15.t0) {
1374
+ _context15.next = 8;
1285
1375
  break;
1286
1376
  }
1287
- _context13.t0 = l;
1377
+ _context15.t0 = l;
1288
1378
  case 8:
1289
- c = _context13.t0;
1290
- _context13.next = 11;
1379
+ c = _context15.t0;
1380
+ _context15.next = 11;
1291
1381
  return e.extractResultData(c);
1292
1382
  case 11:
1293
- u = _context13.sent;
1383
+ u = _context15.sent;
1294
1384
  if (!(!u || _typeof(u) != "object")) {
1295
- _context13.next = 14;
1385
+ _context15.next = 14;
1296
1386
  break;
1297
1387
  }
1298
1388
  throw Error(ErrorMessages.INVALID_RESPONSE(l, "server", !!e.deepChat.responseInterceptor, c));
1299
1389
  case 14:
1300
1390
  e.deepChat.stream && u.text ? Stream.simulate(n, e.streamHandlers, u.text) : n.addNewMessage(u, !0, !0);
1301
- _context13.next = 20;
1391
+ _context15.next = 20;
1302
1392
  break;
1303
1393
  case 17:
1304
- _context13.prev = 17;
1305
- _context13.t1 = _context13["catch"](1);
1306
- RequestUtils.displayError(n, _context13.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");
1307
1397
  case 20:
1308
1398
  case "end":
1309
- return _context13.stop();
1399
+ return _context15.stop();
1310
1400
  }
1311
- }, _callee13, null, [[1, 17]]);
1401
+ }, _callee15, null, [[1, 17]]);
1312
1402
  }));
1313
- return function (_x23) {
1403
+ return function (_x28) {
1314
1404
  return _ref5.apply(this, arguments);
1315
1405
  };
1316
- }(), t.onerror = function (s) {
1317
- console.error(s), n.isLastMessageError() || n.addNewErrorMessage("service", "Connection error");
1318
- }, t.onclose = function () {
1406
+ }(), t.onclose = function () {
1319
1407
  console.error("Connection closed"), n.isLastMessageError() || n.addNewErrorMessage("service", "Connection error"), Websocket.createConnection(e, n);
1320
1408
  };
1321
1409
  }
1322
1410
  }, {
1323
1411
  key: "sendWebsocket",
1324
1412
  value: function () {
1325
- var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(e, t, n, s) {
1326
- var o,
1413
+ var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(e, t, n) {
1414
+ var s,
1327
1415
  d,
1328
1416
  h,
1417
+ o,
1329
1418
  a,
1330
1419
  _yield$RequestUtils$p4,
1331
1420
  l,
1332
1421
  c,
1333
1422
  u,
1334
- _args14 = arguments;
1335
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1336
- while (1) switch (_context14.prev = _context14.next) {
1423
+ _args16 = arguments;
1424
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1425
+ while (1) switch (_context16.prev = _context16.next) {
1337
1426
  case 0:
1338
- o = _args14.length > 4 && _args14[4] !== undefined ? _args14[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:
1339
1435
  a = {
1340
- body: n,
1341
- headers: (d = t.requestSettings) == null ? void 0 : d.headers
1436
+ body: t,
1437
+ headers: (d = e.requestSettings) == null ? void 0 : d.headers
1342
1438
  };
1343
- _context14.next = 4;
1344
- return RequestUtils.processResponseInterceptor(t.deepChat, a);
1345
- case 4:
1346
- _yield$RequestUtils$p4 = _context14.sent;
1439
+ _context16.next = 7;
1440
+ return RequestUtils.processRequestInterceptor(e.deepChat, a);
1441
+ case 7:
1442
+ _yield$RequestUtils$p4 = _context16.sent;
1347
1443
  l = _yield$RequestUtils$p4.body;
1348
1444
  c = _yield$RequestUtils$p4.error;
1349
1445
  if (!c) {
1350
- _context14.next = 9;
1446
+ _context16.next = 12;
1351
1447
  break;
1352
1448
  }
1353
- return _context14.abrupt("return", s.addNewErrorMessage("service", c));
1354
- case 9:
1355
- u = o ? JSON.stringify(l) : l;
1356
- if (!(((h = t.requestSettings) == null ? void 0 : h.url) === Demo.URL)) {
1357
- _context14.next = 12;
1449
+ return _context16.abrupt("return", n.addNewErrorMessage("service", c));
1450
+ case 12:
1451
+ if (Websocket.isWebSocket(o)) {
1452
+ _context16.next = 14;
1358
1453
  break;
1359
1454
  }
1360
- return _context14.abrupt("return", Demo.request(s, t.completionsHandlers.onFinish, t.deepChat.responseInterceptor));
1361
- case 12:
1362
- 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));
1363
- 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:
1364
1466
  case "end":
1365
- return _context14.stop();
1467
+ return _context16.stop();
1366
1468
  }
1367
- }, _callee14);
1469
+ }, _callee16);
1368
1470
  }));
1369
- function sendWebsocket(_x24, _x25, _x26, _x27) {
1471
+ function sendWebsocket(_x29, _x30, _x31) {
1370
1472
  return _sendWebsocket.apply(this, arguments);
1371
1473
  }
1372
1474
  return sendWebsocket;
1373
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
+ }
1374
1487
  }]);
1375
1488
  return Websocket;
1376
1489
  }();
@@ -1861,13 +1974,13 @@ function normalizeReference(r) {
1861
1974
  return r.trim().replace(/\s+/g, " ").toUpperCase();
1862
1975
  }
1863
1976
  function parseReference(r, e, t, n) {
1864
- var s, o, a, l, c, u, d, h, p;
1977
+ var s, o, a, l, c, u, d, h, f;
1865
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;
1866
1979
  for (l = s.posMax, a = o + 2; a < l && (c = s.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);
1867
1980
  if (!parseLinkDestination(s, a)) return -1;
1868
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++);
1869
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++;
1870
- 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] = {
1871
1984
  title: h,
1872
1985
  href: d
1873
1986
  }), a);
@@ -1904,9 +2017,9 @@ function footnote_block(r) {
1904
2017
  u,
1905
2018
  d = 0,
1906
2019
  h = !1,
1907
- p = {};
1908
- if (r.env.footnotes && (r.tokens = r.tokens.filter(function (f) {
1909
- 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);
1910
2023
  }), !!r.env.footnotes.list)) {
1911
2024
  for (a = r.env.footnotes.list, r.tokens.push({
1912
2025
  type: "footnote_block_open",
@@ -1929,7 +2042,7 @@ function footnote_block(r) {
1929
2042
  type: "paragraph_close",
1930
2043
  tight: !1,
1931
2044
  level: --d
1932
- })) : 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({
1933
2046
  type: "footnote_anchor",
1934
2047
  id: e,
1935
2048
  subId: n,
@@ -1962,15 +2075,15 @@ function abbr2(r) {
1962
2075
  u,
1963
2076
  d,
1964
2077
  h,
1965
- p,
1966
- f = r.tokens;
2078
+ f,
2079
+ p = r.tokens;
1967
2080
  if (r.env.abbreviations) {
1968
- 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) {
1969
2082
  return b.substr(1);
1970
2083
  }).sort(function (b, m) {
1971
2084
  return m.length - b.length;
1972
- }).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") {
1973
- 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") {
1974
2087
  for (c = 0, a = o.content, d.lastIndex = 0, u = o.level, l = []; h = d.exec(a);) d.lastIndex > c && l.push({
1975
2088
  type: "text",
1976
2089
  content: a.slice(c, h.index + h[1].length),
@@ -1991,7 +2104,7 @@ function abbr2(r) {
1991
2104
  type: "text",
1992
2105
  content: a.slice(c),
1993
2106
  level: u
1994
- }), 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)));
1995
2108
  }
1996
2109
  }
1997
2110
  }
@@ -2026,20 +2139,20 @@ function replaceAt(r, e, t) {
2026
2139
  return r.substr(0, e) + t + r.substr(e + 1);
2027
2140
  }
2028
2141
  function smartquotes(r) {
2029
- 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;
2030
2143
  if (r.options.typographer) {
2031
2144
  for (v = [], m = r.tokens.length - 1; m >= 0; m--) if (r.tokens[m].type === "inline") {
2032
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))) {
2033
- for (l = g[e].level, f = v.length - 1; f >= 0 && !(v[f].level <= l); f--);
2034
- 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;
2035
2148
  e: for (; o < a && (QUOTE_RE.lastIndex = o, s = QUOTE_RE.exec(n), !!s);) {
2036
2149
  if (c = !isLetter(n, s.index - 1), o = s.index + 1, b = s[0] === "'", u = !isLetter(n, o), !u && !c) {
2037
2150
  b && (t.content = replaceAt(t.content, s.index, APOSTROPHE));
2038
2151
  continue;
2039
2152
  }
2040
- if (h = !u, p = !c, p) {
2041
- for (f = v.length - 1; f >= 0 && (d = v[f], !(v[f].level < l)); f--) if (d.single === b && v[f].level === l) {
2042
- 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;
2043
2156
  continue e;
2044
2157
  }
2045
2158
  }
@@ -2048,7 +2161,7 @@ function smartquotes(r) {
2048
2161
  pos: s.index,
2049
2162
  single: b,
2050
2163
  level: l
2051
- }) : p && b && (t.content = replaceAt(t.content, s.index, APOSTROPHE));
2164
+ }) : f && b && (t.content = replaceAt(t.content, s.index, APOSTROPHE));
2052
2165
  }
2053
2166
  }
2054
2167
  }
@@ -2160,8 +2273,8 @@ function blockquote(r, e, t, n) {
2160
2273
  u,
2161
2274
  d,
2162
2275
  h,
2163
- p,
2164
2276
  f,
2277
+ p,
2165
2278
  b,
2166
2279
  m = r.bMarks[e] + r.tShift[e],
2167
2280
  g = r.eMarks[e];
@@ -2173,7 +2286,7 @@ function blockquote(r, e, t, n) {
2173
2286
  continue;
2174
2287
  }
2175
2288
  if (o) break;
2176
- 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)) {
2177
2290
  b = !0;
2178
2291
  break;
2179
2292
  }
@@ -2187,7 +2300,7 @@ function blockquote(r, e, t, n) {
2187
2300
  }), r.parser.tokenize(r, e, s), r.tokens.push({
2188
2301
  type: "blockquote_close",
2189
2302
  level: --r.level
2190
- }), 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];
2191
2304
  return r.blkIndent = c, !0;
2192
2305
  }
2193
2306
  function hr(r, e, t, n) {
@@ -2240,19 +2353,19 @@ function list(r, e, t, n) {
2240
2353
  u,
2241
2354
  d,
2242
2355
  h,
2243
- p,
2244
2356
  f,
2357
+ p,
2245
2358
  b,
2246
2359
  m,
2247
2360
  g,
2248
2361
  v,
2249
2362
  y,
2250
- _,
2251
2363
  S,
2252
- I,
2253
- R = !0,
2254
- w,
2364
+ E,
2255
2365
  x,
2366
+ R = !0,
2367
+ C,
2368
+ _,
2256
2369
  H,
2257
2370
  F;
2258
2371
  if ((h = skipOrderedListMarker(r, e)) >= 0) g = !0;else if ((h = skipBulletListMarker(r, e)) >= 0) g = !1;else return !1;
@@ -2261,21 +2374,21 @@ function list(r, e, t, n) {
2261
2374
  for (y = r.tokens.length, g ? (d = r.bMarks[e] + r.tShift[e], b = Number(r.src.substr(d, h - d - 1)), r.tokens.push({
2262
2375
  type: "ordered_list_open",
2263
2376
  order: b,
2264
- lines: S = [e, 0],
2377
+ lines: E = [e, 0],
2265
2378
  level: r.level++
2266
2379
  })) : r.tokens.push({
2267
2380
  type: "bullet_list_open",
2268
- lines: S = [e, 0],
2381
+ lines: E = [e, 0],
2269
2382
  level: r.level++
2270
- }), s = e, _ = !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({
2271
2384
  type: "list_item_open",
2272
- lines: I = [e, 0],
2385
+ lines: x = [e, 0],
2273
2386
  level: r.level++
2274
- }), l = r.blkIndent, c = r.tight, a = r.tShift[e], u = r.parentType, r.tShift[e] = v - r.bMarks[e], r.blkIndent = o, r.tight = !0, r.parentType = "list", r.parser.tokenize(r, e, t, !0), (!r.tight || _) && (R = !1), _ = r.line - e > 1 && r.isEmpty(r.line - 1), r.blkIndent = l, r.tShift[e] = a, r.tight = c, r.parentType = u, r.tokens.push({
2387
+ }), l = r.blkIndent, c = r.tight, a = r.tShift[e], u = r.parentType, r.tShift[e] = v - r.bMarks[e], r.blkIndent = o, r.tight = !0, r.parentType = "list", r.parser.tokenize(r, e, t, !0), (!r.tight || S) && (R = !1), S = r.line - e > 1 && r.isEmpty(r.line - 1), r.blkIndent = l, r.tShift[e] = a, r.tight = c, r.parentType = u, r.tokens.push({
2275
2388
  type: "list_item_close",
2276
2389
  level: --r.level
2277
- }), s = e = r.line, I[1] = s, v = r.bMarks[e], !(s >= t || r.isEmpty(s) || r.tShift[s] < r.blkIndent));) {
2278
- for (F = !1, x = 0, H = w.length; x < H; x++) if (w[x](r, s, t, !0)) {
2390
+ }), s = e = r.line, x[1] = s, v = r.bMarks[e], !(s >= t || r.isEmpty(s) || r.tShift[s] < r.blkIndent));) {
2391
+ for (F = !1, _ = 0, H = C.length; _ < H; _++) if (C[_](r, s, t, !0)) {
2279
2392
  F = !0;
2280
2393
  break;
2281
2394
  }
@@ -2288,7 +2401,7 @@ function list(r, e, t, n) {
2288
2401
  return r.tokens.push({
2289
2402
  type: g ? "ordered_list_close" : "bullet_list_close",
2290
2403
  level: --r.level
2291
- }), S[1] = s, r.line = s, R && markTightParagraphs(r, y), !0;
2404
+ }), E[1] = s, r.line = s, R && markTightParagraphs(r, y), !0;
2292
2405
  }
2293
2406
  function footnote(r, e, t, n) {
2294
2407
  var s,
@@ -2400,21 +2513,21 @@ function getLine(r, e) {
2400
2513
  return r.src.substr(t, n - t);
2401
2514
  }
2402
2515
  function table(r, e, t, n) {
2403
- 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;
2404
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;
2405
2518
  for (h = [], l = 0; l < u.length; l++) {
2406
- if (p = u[l].trim(), !p) {
2519
+ if (f = u[l].trim(), !f) {
2407
2520
  if (l === 0 || l === u.length - 1) continue;
2408
2521
  return !1;
2409
2522
  }
2410
- if (!/^:?-+:?$/.test(p)) return !1;
2411
- 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("");
2412
2525
  }
2413
2526
  if (o = getLine(r, e).trim(), o.indexOf("|") === -1 || (u = o.replace(/^\||\|$/g, "").split("|"), h.length !== u.length)) return !1;
2414
2527
  if (n) return !0;
2415
2528
  for (r.tokens.push({
2416
2529
  type: "table_open",
2417
- lines: f = [e, 0],
2530
+ lines: p = [e, 0],
2418
2531
  level: r.level++
2419
2532
  }), r.tokens.push({
2420
2533
  type: "thead_open",
@@ -2477,7 +2590,7 @@ function table(r, e, t, n) {
2477
2590
  }), r.tokens.push({
2478
2591
  type: "table_close",
2479
2592
  level: --r.level
2480
- }), f[1] = b[1] = c, r.line = c, !0;
2593
+ }), p[1] = b[1] = c, r.line = c, !0;
2481
2594
  }
2482
2595
  function skipMarker(r, e) {
2483
2596
  var t,
@@ -2493,7 +2606,7 @@ function markTightParagraphs$1(r, e) {
2493
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);
2494
2607
  }
2495
2608
  function deflist(r, e, t, n) {
2496
- 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;
2497
2610
  if (n) return r.ddIndent < 0 ? !1 : skipMarker(r, e) >= 0;
2498
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;
2499
2612
  u = r.tokens.length, r.tokens.push({
@@ -2520,7 +2633,7 @@ function deflist(r, e, t, n) {
2520
2633
  type: "dd_open",
2521
2634
  lines: l = [d, 0],
2522
2635
  level: r.level++
2523
- }), 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({
2524
2637
  type: "dd_close",
2525
2638
  level: --r.level
2526
2639
  }), l[1] = d = r.line, d >= t || r.tShift[d] < r.blkIndent) break e;
@@ -2897,21 +3010,21 @@ function links(r, e) {
2897
3010
  u,
2898
3011
  d = !1,
2899
3012
  h = r.pos,
2900
- p = r.posMax,
2901
- f = r.pos,
2902
- b = r.src.charCodeAt(f);
2903
- 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;
2904
- if (l = n + 1, l < p && r.src.charCodeAt(l) === 40) {
2905
- for (l++; l < p && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
2906
- if (l >= p) return !1;
2907
- 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++);
2908
- 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 = "";
2909
- 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;
2910
3023
  l++;
2911
3024
  } else {
2912
3025
  if (r.linkLevel > 0) return !1;
2913
- for (; l < p && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
2914
- 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;
2915
3028
  o = c.href, a = c.title;
2916
3029
  }
2917
3030
  return e || (r.pos = t, r.posMax = n, d ? r.push({
@@ -2928,7 +3041,7 @@ function links(r, e) {
2928
3041
  }), r.linkLevel++, r.parser.tokenize(r), r.linkLevel--, r.push({
2929
3042
  type: "link_close",
2930
3043
  level: --r.level
2931
- }))), r.pos = l, r.posMax = p, !0;
3044
+ }))), r.pos = l, r.posMax = f, !0;
2932
3045
  }
2933
3046
  function footnote_inline(r, e) {
2934
3047
  var t,
@@ -3313,10 +3426,10 @@ var SetFileTypes = /*#__PURE__*/function () {
3313
3426
  key: "processMixedFiles",
3314
3427
  value: function processMixedFiles(e, t, n) {
3315
3428
  if (n) {
3316
- var s = {
3429
+ var _s2 = {
3317
3430
  acceptedFormats: ""
3318
3431
  };
3319
- e.fileTypes.mixedFiles = SetFileTypes.parseConfig(e.requestSettings, s, t, n);
3432
+ e.fileTypes.mixedFiles = SetFileTypes.parseConfig(e.requestSettings, _s2, t, n);
3320
3433
  }
3321
3434
  }
3322
3435
  // needs to be set after audio to overwrite maxNumberOfFiles
@@ -3324,12 +3437,12 @@ var SetFileTypes = /*#__PURE__*/function () {
3324
3437
  }, {
3325
3438
  key: "processMicrophone",
3326
3439
  value: function processMicrophone(e, t, n, s) {
3327
- var _c$files, _p$maxNumberOfFiles;
3328
- var l, c, u, d, h, p;
3440
+ var _c$files, _f$maxNumberOfFiles;
3441
+ var l, c, u, d, h, f;
3329
3442
  var a = _objectSpread({
3330
3443
  acceptedFormats: "audio/*"
3331
3444
  }, ((l = e.fileTypes.audio) == null ? void 0 : l.files) || {});
3332
- 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)));
3333
3446
  }
3334
3447
  // prettier-ignore
3335
3448
  }, {
@@ -3415,11 +3528,11 @@ var BaseServiceIO = /*#__PURE__*/function () {
3415
3528
  }, {
3416
3529
  key: "callServiceAPI",
3417
3530
  value: function () {
3418
- var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(e, t, n) {
3531
+ var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(e, t, n) {
3419
3532
  var _c$headers, _u$ContentType;
3420
3533
  var l, c, u, d, s, o, a;
3421
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
3422
- while (1) switch (_context15.prev = _context15.next) {
3534
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
3535
+ while (1) switch (_context17.prev = _context17.next) {
3423
3536
  case 0:
3424
3537
  s = _objectSpread({
3425
3538
  messages: t
@@ -3428,26 +3541,26 @@ var BaseServiceIO = /*#__PURE__*/function () {
3428
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);
3429
3542
  a = this.deepChat.stream;
3430
3543
  if (!(a && (this.demo || _typeof(a) != "object" || !a.simulation))) {
3431
- _context15.next = 9;
3544
+ _context17.next = 9;
3432
3545
  break;
3433
3546
  }
3434
- _context15.next = 7;
3547
+ _context17.next = 7;
3435
3548
  return Stream.request(this, s, e);
3436
3549
  case 7:
3437
- _context15.next = 11;
3550
+ _context17.next = 11;
3438
3551
  break;
3439
3552
  case 9:
3440
- _context15.next = 11;
3553
+ _context17.next = 11;
3441
3554
  return HTTPRequest.request(this, s, e);
3442
3555
  case 11:
3443
3556
  o && ((d = this.requestSettings.headers) == null || delete d["Content-Type"]);
3444
3557
  case 12:
3445
3558
  case "end":
3446
- return _context15.stop();
3559
+ return _context17.stop();
3447
3560
  }
3448
- }, _callee15, this);
3561
+ }, _callee17, this);
3449
3562
  }));
3450
- function callServiceAPI(_x28, _x29, _x30) {
3563
+ function callServiceAPI(_x32, _x33, _x34) {
3451
3564
  return _callServiceAPI.apply(this, arguments);
3452
3565
  }
3453
3566
  return callServiceAPI;
@@ -3455,24 +3568,24 @@ var BaseServiceIO = /*#__PURE__*/function () {
3455
3568
  }, {
3456
3569
  key: "callApiWithFiles",
3457
3570
  value: function () {
3458
- var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(e, t, n, s) {
3571
+ var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(e, t, n, s) {
3459
3572
  var o, a, l;
3460
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
3461
- while (1) switch (_context16.prev = _context16.next) {
3573
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
3574
+ while (1) switch (_context18.prev = _context18.next) {
3462
3575
  case 0:
3463
3576
  o = BaseServiceIO.createCustomFormDataBody(e, n, s), a = this.requestSettings, l = this.getServiceIOByType(s[0]);
3464
3577
  this.requestSettings = (l == null ? void 0 : l.request) || this.requestSettings;
3465
- _context16.next = 4;
3578
+ _context18.next = 4;
3466
3579
  return HTTPRequest.request(this, o, t, !1);
3467
3580
  case 4:
3468
3581
  this.requestSettings = a;
3469
3582
  case 5:
3470
3583
  case "end":
3471
- return _context16.stop();
3584
+ return _context18.stop();
3472
3585
  }
3473
- }, _callee16, this);
3586
+ }, _callee18, this);
3474
3587
  }));
3475
- function callApiWithFiles(_x31, _x32, _x33, _x34) {
3588
+ function callApiWithFiles(_x35, _x36, _x37, _x38) {
3476
3589
  return _callApiWithFiles.apply(this, arguments);
3477
3590
  }
3478
3591
  return callApiWithFiles;
@@ -3480,31 +3593,31 @@ var BaseServiceIO = /*#__PURE__*/function () {
3480
3593
  }, {
3481
3594
  key: "callAPI",
3482
3595
  value: function () {
3483
- var _callAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(e, t) {
3484
- var n, s;
3485
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
3486
- while (1) switch (_context17.prev = _context17.next) {
3596
+ var _callAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(e, t) {
3597
+ var n, _s3;
3598
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
3599
+ while (1) switch (_context19.prev = _context19.next) {
3487
3600
  case 0:
3488
3601
  if (this.requestSettings) {
3489
- _context17.next = 2;
3602
+ _context19.next = 2;
3490
3603
  break;
3491
3604
  }
3492
3605
  throw new Error("Request settings have not been set up");
3493
3606
  case 2:
3494
3607
  n = MessageLimitUtils.processMessages(e, t.messages, this.maxMessages, this.totalMessagesMaxCharLength);
3495
- if (this.websocket) {
3496
- s = _objectSpread({
3608
+ if (this.requestSettings.websocket) {
3609
+ _s3 = _objectSpread({
3497
3610
  messages: n
3498
3611
  }, this.rawBody);
3499
- Websocket.sendWebsocket(this.websocket, this, s, t, !1);
3612
+ Websocket.sendWebsocket(this, _s3, t, !1);
3500
3613
  } else e.files && !this._directServiceRequiresFiles ? this.callApiWithFiles(this.rawBody, t, n, e.files) : this.callServiceAPI(t, n, e.files);
3501
3614
  case 4:
3502
3615
  case "end":
3503
- return _context17.stop();
3616
+ return _context19.stop();
3504
3617
  }
3505
- }, _callee17, this);
3618
+ }, _callee19, this);
3506
3619
  }));
3507
- function callAPI(_x35, _x36) {
3620
+ function callAPI(_x39, _x40) {
3508
3621
  return _callAPI.apply(this, arguments);
3509
3622
  }
3510
3623
  return callAPI;
@@ -3513,24 +3626,24 @@ var BaseServiceIO = /*#__PURE__*/function () {
3513
3626
  }, {
3514
3627
  key: "extractResultData",
3515
3628
  value: function () {
3516
- var _extractResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(e) {
3517
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
3518
- while (1) switch (_context18.prev = _context18.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) {
3519
3632
  case 0:
3520
3633
  if (!e.error) {
3521
- _context18.next = 2;
3634
+ _context20.next = 2;
3522
3635
  break;
3523
3636
  }
3524
3637
  throw e.error;
3525
3638
  case 2:
3526
- return _context18.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);
3527
3640
  case 3:
3528
3641
  case "end":
3529
- return _context18.stop();
3642
+ return _context20.stop();
3530
3643
  }
3531
- }, _callee18);
3644
+ }, _callee20);
3532
3645
  }));
3533
- function extractResultData(_x37) {
3646
+ function extractResultData(_x41) {
3534
3647
  return _extractResultData.apply(this, arguments);
3535
3648
  }
3536
3649
  return extractResultData;
@@ -3747,8 +3860,8 @@ var InsertKeyView = /*#__PURE__*/function () {
3747
3860
  n.id = "insert-key-help-text-contents";
3748
3861
  var s = InsertKeyView.createFailText();
3749
3862
  if (n.appendChild(s), e) {
3750
- var a = InsertKeyView.createHelpLink(e);
3751
- n.appendChild(a);
3863
+ var _a2 = InsertKeyView.createHelpLink(e);
3864
+ n.appendChild(_a2);
3752
3865
  }
3753
3866
  var o = InsertKeyView.createCautionText();
3754
3867
  return n.appendChild(o), t.appendChild(n), {
@@ -3894,13 +4007,13 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
3894
4007
  }, {
3895
4008
  key: "callServiceAPI",
3896
4009
  value: function () {
3897
- var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(e, t, n) {
4010
+ var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(e, t, n) {
3898
4011
  var s;
3899
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
3900
- while (1) switch (_context19.prev = _context19.next) {
4012
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
4013
+ while (1) switch (_context21.prev = _context21.next) {
3901
4014
  case 0:
3902
4015
  if (this.requestSettings) {
3903
- _context19.next = 2;
4016
+ _context21.next = 2;
3904
4017
  break;
3905
4018
  }
3906
4019
  throw new Error("Request settings have not been set up");
@@ -3909,11 +4022,11 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
3909
4022
  HTTPRequest.request(this, s, e);
3910
4023
  case 4:
3911
4024
  case "end":
3912
- return _context19.stop();
4025
+ return _context21.stop();
3913
4026
  }
3914
- }, _callee19, this);
4027
+ }, _callee21, this);
3915
4028
  }));
3916
- function callServiceAPI(_x38, _x39, _x40) {
4029
+ function callServiceAPI(_x42, _x43, _x44) {
3917
4030
  return _callServiceAPI2.apply(this, arguments);
3918
4031
  }
3919
4032
  return callServiceAPI;
@@ -3942,18 +4055,18 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
3942
4055
  }, {
3943
4056
  key: "callServiceAPI",
3944
4057
  value: function () {
3945
- var _callServiceAPI3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(e, t, n) {
3946
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
3947
- while (1) switch (_context20.prev = _context20.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) {
3948
4061
  case 0:
3949
4062
  if (this.requestSettings) {
3950
- _context20.next = 2;
4063
+ _context22.next = 2;
3951
4064
  break;
3952
4065
  }
3953
4066
  throw new Error("Request settings have not been set up");
3954
4067
  case 2:
3955
4068
  if (n != null && n[0]) {
3956
- _context20.next = 4;
4069
+ _context22.next = 4;
3957
4070
  break;
3958
4071
  }
3959
4072
  throw new Error("No file was added");
@@ -3961,11 +4074,11 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
3961
4074
  HTTPRequest.poll(this, n[0], e, !1);
3962
4075
  case 5:
3963
4076
  case "end":
3964
- return _context20.stop();
4077
+ return _context22.stop();
3965
4078
  }
3966
- }, _callee20, this);
4079
+ }, _callee22, this);
3967
4080
  }));
3968
- function callServiceAPI(_x41, _x42, _x43) {
4081
+ function callServiceAPI(_x45, _x46, _x47) {
3969
4082
  return _callServiceAPI3.apply(this, arguments);
3970
4083
  }
3971
4084
  return callServiceAPI;
@@ -3994,35 +4107,35 @@ var HuggingFaceAudioClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
3994
4107
  _createClass(HuggingFaceAudioClassificationIO, [{
3995
4108
  key: "extractPollResultData",
3996
4109
  value: function () {
3997
- var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(e) {
4110
+ var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(e) {
3998
4111
  var t;
3999
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
4000
- while (1) switch (_context21.prev = _context21.next) {
4112
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
4113
+ while (1) switch (_context23.prev = _context23.next) {
4001
4114
  case 0:
4002
4115
  if (!e.estimated_time) {
4003
- _context21.next = 2;
4116
+ _context23.next = 2;
4004
4117
  break;
4005
4118
  }
4006
- return _context21.abrupt("return", {
4119
+ return _context23.abrupt("return", {
4007
4120
  timeoutMS: (e.estimated_time + 1) * 1e3
4008
4121
  });
4009
4122
  case 2:
4010
4123
  if (!e.error) {
4011
- _context21.next = 4;
4124
+ _context23.next = 4;
4012
4125
  break;
4013
4126
  }
4014
4127
  throw e.error;
4015
4128
  case 4:
4016
- return _context21.abrupt("return", {
4129
+ return _context23.abrupt("return", {
4017
4130
  text: ((t = e[0]) == null ? void 0 : t.label) || ""
4018
4131
  });
4019
4132
  case 5:
4020
4133
  case "end":
4021
- return _context21.stop();
4134
+ return _context23.stop();
4022
4135
  }
4023
- }, _callee21);
4136
+ }, _callee23);
4024
4137
  }));
4025
- function extractPollResultData(_x44) {
4138
+ function extractPollResultData(_x48) {
4026
4139
  return _extractPollResultData.apply(this, arguments);
4027
4140
  }
4028
4141
  return extractPollResultData;
@@ -4045,35 +4158,35 @@ var HuggingFaceImageClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
4045
4158
  _createClass(HuggingFaceImageClassificationIO, [{
4046
4159
  key: "extractPollResultData",
4047
4160
  value: function () {
4048
- var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(e) {
4161
+ var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(e) {
4049
4162
  var t;
4050
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
4051
- while (1) switch (_context22.prev = _context22.next) {
4163
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
4164
+ while (1) switch (_context24.prev = _context24.next) {
4052
4165
  case 0:
4053
4166
  if (!e.estimated_time) {
4054
- _context22.next = 2;
4167
+ _context24.next = 2;
4055
4168
  break;
4056
4169
  }
4057
- return _context22.abrupt("return", {
4170
+ return _context24.abrupt("return", {
4058
4171
  timeoutMS: (e.estimated_time + 1) * 1e3
4059
4172
  });
4060
4173
  case 2:
4061
4174
  if (!e.error) {
4062
- _context22.next = 4;
4175
+ _context24.next = 4;
4063
4176
  break;
4064
4177
  }
4065
4178
  throw e.error;
4066
4179
  case 4:
4067
- return _context22.abrupt("return", {
4180
+ return _context24.abrupt("return", {
4068
4181
  text: ((t = e[0]) == null ? void 0 : t.label) || ""
4069
4182
  });
4070
4183
  case 5:
4071
4184
  case "end":
4072
- return _context22.stop();
4185
+ return _context24.stop();
4073
4186
  }
4074
- }, _callee22);
4187
+ }, _callee24);
4075
4188
  }));
4076
- function extractPollResultData(_x45) {
4189
+ function extractPollResultData(_x49) {
4077
4190
  return _extractPollResultData2.apply(this, arguments);
4078
4191
  }
4079
4192
  return extractPollResultData;
@@ -4158,19 +4271,19 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4158
4271
  }, {
4159
4272
  key: "callServiceAPI",
4160
4273
  value: function () {
4161
- var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(e, t, n) {
4274
+ var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(e, t, n) {
4162
4275
  var s;
4163
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
4164
- while (1) switch (_context23.prev = _context23.next) {
4276
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
4277
+ while (1) switch (_context25.prev = _context25.next) {
4165
4278
  case 0:
4166
4279
  if (this.requestSettings) {
4167
- _context23.next = 2;
4280
+ _context25.next = 2;
4168
4281
  break;
4169
4282
  }
4170
4283
  throw new Error("Request settings have not been set up");
4171
4284
  case 2:
4172
4285
  if (n) {
4173
- _context23.next = 4;
4286
+ _context25.next = 4;
4174
4287
  break;
4175
4288
  }
4176
4289
  throw new Error("Image was not found");
@@ -4179,11 +4292,11 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4179
4292
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, s, e), !1);
4180
4293
  case 6:
4181
4294
  case "end":
4182
- return _context23.stop();
4295
+ return _context25.stop();
4183
4296
  }
4184
- }, _callee23, this);
4297
+ }, _callee25, this);
4185
4298
  }));
4186
- function callServiceAPI(_x46, _x47, _x48) {
4299
+ function callServiceAPI(_x50, _x51, _x52) {
4187
4300
  return _callServiceAPI4.apply(this, arguments);
4188
4301
  }
4189
4302
  return callServiceAPI;
@@ -4191,17 +4304,17 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4191
4304
  }, {
4192
4305
  key: "extractResultData",
4193
4306
  value: function () {
4194
- var _extractResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(e) {
4195
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
4196
- while (1) switch (_context24.prev = _context24.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) {
4197
4310
  case 0:
4198
4311
  if (!e.message) {
4199
- _context24.next = 2;
4312
+ _context26.next = 2;
4200
4313
  break;
4201
4314
  }
4202
4315
  throw e.message;
4203
4316
  case 2:
4204
- return _context24.abrupt("return", {
4317
+ return _context26.abrupt("return", {
4205
4318
  files: e.artifacts.map(function (n) {
4206
4319
  return {
4207
4320
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4211,11 +4324,11 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4211
4324
  });
4212
4325
  case 3:
4213
4326
  case "end":
4214
- return _context24.stop();
4327
+ return _context26.stop();
4215
4328
  }
4216
- }, _callee24);
4329
+ }, _callee26);
4217
4330
  }));
4218
- function extractResultData(_x49) {
4331
+ function extractResultData(_x53) {
4219
4332
  return _extractResultData2.apply(this, arguments);
4220
4333
  }
4221
4334
  return extractResultData;
@@ -4267,19 +4380,19 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4267
4380
  }, {
4268
4381
  key: "callServiceAPI",
4269
4382
  value: function () {
4270
- var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(e, t, n) {
4383
+ var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(e, t, n) {
4271
4384
  var a, l, s, o;
4272
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
4273
- while (1) switch (_context25.prev = _context25.next) {
4385
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
4386
+ while (1) switch (_context27.prev = _context27.next) {
4274
4387
  case 0:
4275
4388
  if (this.requestSettings) {
4276
- _context25.next = 2;
4389
+ _context27.next = 2;
4277
4390
  break;
4278
4391
  }
4279
4392
  throw new Error("Request settings have not been set up");
4280
4393
  case 2:
4281
4394
  if (!(!n || !n[0] || !n[1])) {
4282
- _context25.next = 4;
4395
+ _context27.next = 4;
4283
4396
  break;
4284
4397
  }
4285
4398
  throw new Error("Image was not found");
@@ -4288,11 +4401,11 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4288
4401
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
4289
4402
  case 6:
4290
4403
  case "end":
4291
- return _context25.stop();
4404
+ return _context27.stop();
4292
4405
  }
4293
- }, _callee25, this);
4406
+ }, _callee27, this);
4294
4407
  }));
4295
- function callServiceAPI(_x50, _x51, _x52) {
4408
+ function callServiceAPI(_x54, _x55, _x56) {
4296
4409
  return _callServiceAPI5.apply(this, arguments);
4297
4410
  }
4298
4411
  return callServiceAPI;
@@ -4300,17 +4413,17 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4300
4413
  }, {
4301
4414
  key: "extractResultData",
4302
4415
  value: function () {
4303
- var _extractResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(e) {
4304
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
4305
- while (1) switch (_context26.prev = _context26.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) {
4306
4419
  case 0:
4307
4420
  if (!e.message) {
4308
- _context26.next = 2;
4421
+ _context28.next = 2;
4309
4422
  break;
4310
4423
  }
4311
4424
  throw e.message;
4312
4425
  case 2:
4313
- return _context26.abrupt("return", {
4426
+ return _context28.abrupt("return", {
4314
4427
  files: e.artifacts.map(function (n) {
4315
4428
  return {
4316
4429
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4320,11 +4433,11 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4320
4433
  });
4321
4434
  case 3:
4322
4435
  case "end":
4323
- return _context26.stop();
4436
+ return _context28.stop();
4324
4437
  }
4325
- }, _callee26);
4438
+ }, _callee28);
4326
4439
  }));
4327
- function extractResultData(_x53) {
4440
+ function extractResultData(_x57) {
4328
4441
  return _extractResultData3.apply(this, arguments);
4329
4442
  }
4330
4443
  return extractResultData;
@@ -4357,34 +4470,34 @@ var HuggingFaceAudioRecognitionIO = /*#__PURE__*/function (_HuggingFaceFileIO3)
4357
4470
  _createClass(HuggingFaceAudioRecognitionIO, [{
4358
4471
  key: "extractPollResultData",
4359
4472
  value: function () {
4360
- var _extractPollResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(e) {
4361
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
4362
- while (1) switch (_context27.prev = _context27.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) {
4363
4476
  case 0:
4364
4477
  if (!e.estimated_time) {
4365
- _context27.next = 2;
4478
+ _context29.next = 2;
4366
4479
  break;
4367
4480
  }
4368
- return _context27.abrupt("return", {
4481
+ return _context29.abrupt("return", {
4369
4482
  timeoutMS: (e.estimated_time + 1) * 1e3
4370
4483
  });
4371
4484
  case 2:
4372
4485
  if (!e.error) {
4373
- _context27.next = 4;
4486
+ _context29.next = 4;
4374
4487
  break;
4375
4488
  }
4376
4489
  throw e.error;
4377
4490
  case 4:
4378
- return _context27.abrupt("return", {
4491
+ return _context29.abrupt("return", {
4379
4492
  text: e.text || ""
4380
4493
  });
4381
4494
  case 5:
4382
4495
  case "end":
4383
- return _context27.stop();
4496
+ return _context29.stop();
4384
4497
  }
4385
- }, _callee27);
4498
+ }, _callee29);
4386
4499
  }));
4387
- function extractPollResultData(_x54) {
4500
+ function extractPollResultData(_x58) {
4388
4501
  return _extractPollResultData3.apply(this, arguments);
4389
4502
  }
4390
4503
  return extractPollResultData;
@@ -4405,26 +4518,26 @@ var HuggingFaceTextGenerationIO = /*#__PURE__*/function (_HuggingFaceIO3) {
4405
4518
  _createClass(HuggingFaceTextGenerationIO, [{
4406
4519
  key: "extractResultData",
4407
4520
  value: function () {
4408
- var _extractResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(e) {
4409
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
4410
- while (1) switch (_context28.prev = _context28.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) {
4411
4524
  case 0:
4412
4525
  if (!e.error) {
4413
- _context28.next = 2;
4526
+ _context30.next = 2;
4414
4527
  break;
4415
4528
  }
4416
4529
  throw e.error;
4417
4530
  case 2:
4418
- return _context28.abrupt("return", {
4531
+ return _context30.abrupt("return", {
4419
4532
  text: e[0].generated_text || ""
4420
4533
  });
4421
4534
  case 3:
4422
4535
  case "end":
4423
- return _context28.stop();
4536
+ return _context30.stop();
4424
4537
  }
4425
- }, _callee28);
4538
+ }, _callee30);
4426
4539
  }));
4427
- function extractResultData(_x55) {
4540
+ function extractResultData(_x59) {
4428
4541
  return _extractResultData4.apply(this, arguments);
4429
4542
  }
4430
4543
  return extractResultData;
@@ -4461,26 +4574,26 @@ var HuggingFaceQuestionAnswerIO = /*#__PURE__*/function (_HuggingFaceIO4) {
4461
4574
  }, {
4462
4575
  key: "extractResultData",
4463
4576
  value: function () {
4464
- var _extractResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(e) {
4465
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
4466
- while (1) switch (_context29.prev = _context29.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) {
4467
4580
  case 0:
4468
4581
  if (!e.error) {
4469
- _context29.next = 2;
4582
+ _context31.next = 2;
4470
4583
  break;
4471
4584
  }
4472
4585
  throw e.error;
4473
4586
  case 2:
4474
- return _context29.abrupt("return", {
4587
+ return _context31.abrupt("return", {
4475
4588
  text: e.answer || ""
4476
4589
  });
4477
4590
  case 3:
4478
4591
  case "end":
4479
- return _context29.stop();
4592
+ return _context31.stop();
4480
4593
  }
4481
- }, _callee29);
4594
+ }, _callee31);
4482
4595
  }));
4483
- function extractResultData(_x56) {
4596
+ function extractResultData(_x60) {
4484
4597
  return _extractResultData5.apply(this, arguments);
4485
4598
  }
4486
4599
  return extractResultData;
@@ -4501,26 +4614,26 @@ var HuggingFaceSummarizationIO = /*#__PURE__*/function (_HuggingFaceIO5) {
4501
4614
  _createClass(HuggingFaceSummarizationIO, [{
4502
4615
  key: "extractResultData",
4503
4616
  value: function () {
4504
- var _extractResultData6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(e) {
4505
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
4506
- while (1) switch (_context30.prev = _context30.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) {
4507
4620
  case 0:
4508
4621
  if (!e.error) {
4509
- _context30.next = 2;
4622
+ _context32.next = 2;
4510
4623
  break;
4511
4624
  }
4512
4625
  throw e.error;
4513
4626
  case 2:
4514
- return _context30.abrupt("return", {
4627
+ return _context32.abrupt("return", {
4515
4628
  text: e[0].summary_text || ""
4516
4629
  });
4517
4630
  case 3:
4518
4631
  case "end":
4519
- return _context30.stop();
4632
+ return _context32.stop();
4520
4633
  }
4521
- }, _callee30);
4634
+ }, _callee32);
4522
4635
  }));
4523
- function extractResultData(_x57) {
4636
+ function extractResultData(_x61) {
4524
4637
  return _extractResultData6.apply(this, arguments);
4525
4638
  }
4526
4639
  return extractResultData;
@@ -4581,26 +4694,26 @@ var HuggingFaceConversationIO = /*#__PURE__*/function (_HuggingFaceIO6) {
4581
4694
  }, {
4582
4695
  key: "extractResultData",
4583
4696
  value: function () {
4584
- var _extractResultData7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(e) {
4585
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
4586
- while (1) switch (_context31.prev = _context31.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) {
4587
4700
  case 0:
4588
4701
  if (!e.error) {
4589
- _context31.next = 2;
4702
+ _context33.next = 2;
4590
4703
  break;
4591
4704
  }
4592
4705
  throw e.error;
4593
4706
  case 2:
4594
- return _context31.abrupt("return", {
4707
+ return _context33.abrupt("return", {
4595
4708
  text: e.generated_text || ""
4596
4709
  });
4597
4710
  case 3:
4598
4711
  case "end":
4599
- return _context31.stop();
4712
+ return _context33.stop();
4600
4713
  }
4601
- }, _callee31);
4714
+ }, _callee33);
4602
4715
  }));
4603
- function extractResultData(_x58) {
4716
+ function extractResultData(_x62) {
4604
4717
  return _extractResultData7.apply(this, arguments);
4605
4718
  }
4606
4719
  return extractResultData;
@@ -4642,19 +4755,19 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4642
4755
  }, {
4643
4756
  key: "callServiceAPI",
4644
4757
  value: function () {
4645
- var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(e, t, n) {
4758
+ var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(e, t, n) {
4646
4759
  var a, l, s, o;
4647
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
4648
- while (1) switch (_context32.prev = _context32.next) {
4760
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
4761
+ while (1) switch (_context34.prev = _context34.next) {
4649
4762
  case 0:
4650
4763
  if (this.requestSettings) {
4651
- _context32.next = 2;
4764
+ _context34.next = 2;
4652
4765
  break;
4653
4766
  }
4654
4767
  throw new Error("Request settings have not been set up");
4655
4768
  case 2:
4656
4769
  if (n) {
4657
- _context32.next = 4;
4770
+ _context34.next = 4;
4658
4771
  break;
4659
4772
  }
4660
4773
  throw new Error("Image was not found");
@@ -4663,11 +4776,11 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4663
4776
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
4664
4777
  case 6:
4665
4778
  case "end":
4666
- return _context32.stop();
4779
+ return _context34.stop();
4667
4780
  }
4668
- }, _callee32, this);
4781
+ }, _callee34, this);
4669
4782
  }));
4670
- function callServiceAPI(_x59, _x60, _x61) {
4783
+ function callServiceAPI(_x63, _x64, _x65) {
4671
4784
  return _callServiceAPI6.apply(this, arguments);
4672
4785
  }
4673
4786
  return callServiceAPI;
@@ -4675,17 +4788,17 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4675
4788
  }, {
4676
4789
  key: "extractResultData",
4677
4790
  value: function () {
4678
- var _extractResultData8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(e) {
4679
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
4680
- while (1) switch (_context33.prev = _context33.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) {
4681
4794
  case 0:
4682
4795
  if (!e.message) {
4683
- _context33.next = 2;
4796
+ _context35.next = 2;
4684
4797
  break;
4685
4798
  }
4686
4799
  throw e.message;
4687
4800
  case 2:
4688
- return _context33.abrupt("return", {
4801
+ return _context35.abrupt("return", {
4689
4802
  files: e.artifacts.map(function (n) {
4690
4803
  return {
4691
4804
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4695,11 +4808,11 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4695
4808
  });
4696
4809
  case 3:
4697
4810
  case "end":
4698
- return _context33.stop();
4811
+ return _context35.stop();
4699
4812
  }
4700
- }, _callee33);
4813
+ }, _callee35);
4701
4814
  }));
4702
- function extractResultData(_x62) {
4815
+ function extractResultData(_x66) {
4703
4816
  return _extractResultData8.apply(this, arguments);
4704
4817
  }
4705
4818
  return extractResultData;
@@ -4730,26 +4843,26 @@ var HuggingFaceTranslationIO = /*#__PURE__*/function (_HuggingFaceIO7) {
4730
4843
  _createClass(HuggingFaceTranslationIO, [{
4731
4844
  key: "extractResultData",
4732
4845
  value: function () {
4733
- var _extractResultData9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(e) {
4734
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
4735
- while (1) switch (_context34.prev = _context34.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) {
4736
4849
  case 0:
4737
4850
  if (!e.error) {
4738
- _context34.next = 2;
4851
+ _context36.next = 2;
4739
4852
  break;
4740
4853
  }
4741
4854
  throw e.error;
4742
4855
  case 2:
4743
- return _context34.abrupt("return", {
4856
+ return _context36.abrupt("return", {
4744
4857
  text: e[0].translation_text || ""
4745
4858
  });
4746
4859
  case 3:
4747
4860
  case "end":
4748
- return _context34.stop();
4861
+ return _context36.stop();
4749
4862
  }
4750
- }, _callee34);
4863
+ }, _callee36);
4751
4864
  }));
4752
- function extractResultData(_x63) {
4865
+ function extractResultData(_x67) {
4753
4866
  return _extractResultData9.apply(this, arguments);
4754
4867
  }
4755
4868
  return extractResultData;
@@ -4783,13 +4896,13 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4783
4896
  }, {
4784
4897
  key: "callServiceAPI",
4785
4898
  value: function () {
4786
- var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(e, t) {
4899
+ var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(e, t) {
4787
4900
  var n;
4788
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4789
- while (1) switch (_context35.prev = _context35.next) {
4901
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4902
+ while (1) switch (_context37.prev = _context37.next) {
4790
4903
  case 0:
4791
4904
  if (this.requestSettings) {
4792
- _context35.next = 2;
4905
+ _context37.next = 2;
4793
4906
  break;
4794
4907
  }
4795
4908
  throw new Error("Request settings have not been set up");
@@ -4798,11 +4911,11 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4798
4911
  HTTPRequest.request(this, n, e);
4799
4912
  case 4:
4800
4913
  case "end":
4801
- return _context35.stop();
4914
+ return _context37.stop();
4802
4915
  }
4803
- }, _callee35, this);
4916
+ }, _callee37, this);
4804
4917
  }));
4805
- function callServiceAPI(_x64, _x65) {
4918
+ function callServiceAPI(_x68, _x69) {
4806
4919
  return _callServiceAPI7.apply(this, arguments);
4807
4920
  }
4808
4921
  return callServiceAPI;
@@ -4810,17 +4923,17 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4810
4923
  }, {
4811
4924
  key: "extractResultData",
4812
4925
  value: function () {
4813
- var _extractResultData10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(e) {
4814
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4815
- while (1) switch (_context36.prev = _context36.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) {
4816
4929
  case 0:
4817
4930
  if (!e.message) {
4818
- _context36.next = 2;
4931
+ _context38.next = 2;
4819
4932
  break;
4820
4933
  }
4821
4934
  throw e.message;
4822
4935
  case 2:
4823
- return _context36.abrupt("return", {
4936
+ return _context38.abrupt("return", {
4824
4937
  files: e.artifacts.map(function (n) {
4825
4938
  return {
4826
4939
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4830,11 +4943,11 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4830
4943
  });
4831
4944
  case 3:
4832
4945
  case "end":
4833
- return _context36.stop();
4946
+ return _context38.stop();
4834
4947
  }
4835
- }, _callee36);
4948
+ }, _callee38);
4836
4949
  }));
4837
- function extractResultData(_x66) {
4950
+ function extractResultData(_x70) {
4838
4951
  return _extractResultData10.apply(this, arguments);
4839
4952
  }
4840
4953
  return extractResultData;
@@ -4867,26 +4980,26 @@ var HuggingFaceFillMaskIO = /*#__PURE__*/function (_HuggingFaceIO8) {
4867
4980
  _createClass(HuggingFaceFillMaskIO, [{
4868
4981
  key: "extractResultData",
4869
4982
  value: function () {
4870
- var _extractResultData11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(e) {
4871
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4872
- while (1) switch (_context37.prev = _context37.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) {
4873
4986
  case 0:
4874
4987
  if (!e.error) {
4875
- _context37.next = 2;
4988
+ _context39.next = 2;
4876
4989
  break;
4877
4990
  }
4878
4991
  throw e.error;
4879
4992
  case 2:
4880
- return _context37.abrupt("return", {
4993
+ return _context39.abrupt("return", {
4881
4994
  text: e[0].sequence || ""
4882
4995
  });
4883
4996
  case 3:
4884
4997
  case "end":
4885
- return _context37.stop();
4998
+ return _context39.stop();
4886
4999
  }
4887
- }, _callee37);
5000
+ }, _callee39);
4888
5001
  }));
4889
- function extractResultData(_x67) {
5002
+ function extractResultData(_x71) {
4890
5003
  return _extractResultData11.apply(this, arguments);
4891
5004
  }
4892
5005
  return extractResultData;
@@ -4961,13 +5074,13 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
4961
5074
  }, {
4962
5075
  key: "callServiceAPI",
4963
5076
  value: function () {
4964
- var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(e, t) {
5077
+ var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(e, t) {
4965
5078
  var n;
4966
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4967
- while (1) switch (_context38.prev = _context38.next) {
5079
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
5080
+ while (1) switch (_context40.prev = _context40.next) {
4968
5081
  case 0:
4969
5082
  if (this.requestSettings) {
4970
- _context38.next = 2;
5083
+ _context40.next = 2;
4971
5084
  break;
4972
5085
  }
4973
5086
  throw new Error("Request settings have not been set up");
@@ -4976,11 +5089,11 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
4976
5089
  HTTPRequest.request(this, n, e);
4977
5090
  case 4:
4978
5091
  case "end":
4979
- return _context38.stop();
5092
+ return _context40.stop();
4980
5093
  }
4981
- }, _callee38, this);
5094
+ }, _callee40, this);
4982
5095
  }));
4983
- function callServiceAPI(_x68, _x69) {
5096
+ function callServiceAPI(_x72, _x73) {
4984
5097
  return _callServiceAPI8.apply(this, arguments);
4985
5098
  }
4986
5099
  return callServiceAPI;
@@ -4988,27 +5101,27 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
4988
5101
  }, {
4989
5102
  key: "extractResultData",
4990
5103
  value: function () {
4991
- var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(e) {
5104
+ var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(e) {
4992
5105
  var t;
4993
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4994
- while (1) switch (_context39.prev = _context39.next) {
5106
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
5107
+ while (1) switch (_context41.prev = _context41.next) {
4995
5108
  case 0:
4996
5109
  if (!e.message) {
4997
- _context39.next = 2;
5110
+ _context41.next = 2;
4998
5111
  break;
4999
5112
  }
5000
5113
  throw e.message;
5001
5114
  case 2:
5002
- return _context39.abrupt("return", {
5115
+ return _context41.abrupt("return", {
5003
5116
  text: ((t = e.generations) == null ? void 0 : t[0].text) || ""
5004
5117
  });
5005
5118
  case 3:
5006
5119
  case "end":
5007
- return _context39.stop();
5120
+ return _context41.stop();
5008
5121
  }
5009
- }, _callee39);
5122
+ }, _callee41);
5010
5123
  }));
5011
- function extractResultData(_x70) {
5124
+ function extractResultData(_x74) {
5012
5125
  return _extractResultData12.apply(this, arguments);
5013
5126
  }
5014
5127
  return extractResultData;
@@ -5038,13 +5151,13 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
5038
5151
  }, {
5039
5152
  key: "callServiceAPI",
5040
5153
  value: function () {
5041
- var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(e, t) {
5154
+ var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(e, t) {
5042
5155
  var n;
5043
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
5044
- while (1) switch (_context40.prev = _context40.next) {
5156
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
5157
+ while (1) switch (_context42.prev = _context42.next) {
5045
5158
  case 0:
5046
5159
  if (this.requestSettings) {
5047
- _context40.next = 2;
5160
+ _context42.next = 2;
5048
5161
  break;
5049
5162
  }
5050
5163
  throw new Error("Request settings have not been set up");
@@ -5053,11 +5166,11 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
5053
5166
  HTTPRequest.request(this, n, e);
5054
5167
  case 4:
5055
5168
  case "end":
5056
- return _context40.stop();
5169
+ return _context42.stop();
5057
5170
  }
5058
- }, _callee40, this);
5171
+ }, _callee42, this);
5059
5172
  }));
5060
- function callServiceAPI(_x71, _x72) {
5173
+ function callServiceAPI(_x75, _x76) {
5061
5174
  return _callServiceAPI9.apply(this, arguments);
5062
5175
  }
5063
5176
  return callServiceAPI;
@@ -5065,26 +5178,26 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
5065
5178
  }, {
5066
5179
  key: "extractResultData",
5067
5180
  value: function () {
5068
- var _extractResultData13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(e) {
5069
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
5070
- while (1) switch (_context41.prev = _context41.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) {
5071
5184
  case 0:
5072
5185
  if (!e.message) {
5073
- _context41.next = 2;
5186
+ _context43.next = 2;
5074
5187
  break;
5075
5188
  }
5076
5189
  throw e.message;
5077
5190
  case 2:
5078
- return _context41.abrupt("return", {
5191
+ return _context43.abrupt("return", {
5079
5192
  text: e.summary || ""
5080
5193
  });
5081
5194
  case 3:
5082
5195
  case "end":
5083
- return _context41.stop();
5196
+ return _context43.stop();
5084
5197
  }
5085
- }, _callee41);
5198
+ }, _callee43);
5086
5199
  }));
5087
- function extractResultData(_x73) {
5200
+ function extractResultData(_x77) {
5088
5201
  return _extractResultData13.apply(this, arguments);
5089
5202
  }
5090
5203
  return extractResultData;
@@ -5241,13 +5354,13 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5241
5354
  }, {
5242
5355
  key: "callServiceAPI",
5243
5356
  value: function () {
5244
- var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(e, t) {
5357
+ var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(e, t) {
5245
5358
  var n;
5246
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
5247
- while (1) switch (_context42.prev = _context42.next) {
5359
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
5360
+ while (1) switch (_context44.prev = _context44.next) {
5248
5361
  case 0:
5249
5362
  if (this.requestSettings) {
5250
- _context42.next = 2;
5363
+ _context44.next = 2;
5251
5364
  break;
5252
5365
  }
5253
5366
  throw new Error("Request settings have not been set up");
@@ -5256,11 +5369,11 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5256
5369
  HTTPRequest.request(this, n, e), this.messages = e;
5257
5370
  case 4:
5258
5371
  case "end":
5259
- return _context42.stop();
5372
+ return _context44.stop();
5260
5373
  }
5261
- }, _callee42, this);
5374
+ }, _callee44, this);
5262
5375
  }));
5263
- function callServiceAPI(_x74, _x75) {
5376
+ function callServiceAPI(_x78, _x79) {
5264
5377
  return _callServiceAPI10.apply(this, arguments);
5265
5378
  }
5266
5379
  return callServiceAPI;
@@ -5268,34 +5381,34 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5268
5381
  }, {
5269
5382
  key: "extractResultData",
5270
5383
  value: function () {
5271
- var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(e) {
5272
- var t, n, s;
5273
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
5274
- while (1) switch (_context43.prev = _context43.next) {
5384
+ var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(e) {
5385
+ var t, n, _s4;
5386
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
5387
+ while (1) switch (_context45.prev = _context45.next) {
5275
5388
  case 0:
5276
5389
  if (!e.error) {
5277
- _context43.next = 2;
5390
+ _context45.next = 2;
5278
5391
  break;
5279
5392
  }
5280
5393
  throw e.error.message;
5281
5394
  case 2:
5282
5395
  if (this.messages && this.completionsHandlers) {
5283
- n = e.headers.get("operation-location"), s = {
5396
+ n = e.headers.get("operation-location"), _s4 = {
5284
5397
  method: "GET",
5285
5398
  headers: (t = this.requestSettings) == null ? void 0 : t.headers
5286
5399
  };
5287
- HTTPRequest.executePollRequest(this, n, s, this.messages);
5400
+ HTTPRequest.executePollRequest(this, n, _s4, this.messages);
5288
5401
  }
5289
- return _context43.abrupt("return", {
5402
+ return _context45.abrupt("return", {
5290
5403
  pollingInAnotherRequest: !0
5291
5404
  });
5292
5405
  case 4:
5293
5406
  case "end":
5294
- return _context43.stop();
5407
+ return _context45.stop();
5295
5408
  }
5296
- }, _callee43, this);
5409
+ }, _callee45, this);
5297
5410
  }));
5298
- function extractResultData(_x76) {
5411
+ function extractResultData(_x80) {
5299
5412
  return _extractResultData14.apply(this, arguments);
5300
5413
  }
5301
5414
  return extractResultData;
@@ -5303,33 +5416,33 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5303
5416
  }, {
5304
5417
  key: "extractPollResultData",
5305
5418
  value: function () {
5306
- var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(e) {
5419
+ var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(e) {
5307
5420
  var t, _iterator, _step, n;
5308
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
5309
- while (1) switch (_context44.prev = _context44.next) {
5421
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5422
+ while (1) switch (_context46.prev = _context46.next) {
5310
5423
  case 0:
5311
5424
  if (!e.error) {
5312
- _context44.next = 2;
5425
+ _context46.next = 2;
5313
5426
  break;
5314
5427
  }
5315
5428
  throw e.error;
5316
5429
  case 2:
5317
5430
  if (!(e.status === "running")) {
5318
- _context44.next = 4;
5431
+ _context46.next = 4;
5319
5432
  break;
5320
5433
  }
5321
- return _context44.abrupt("return", {
5434
+ return _context46.abrupt("return", {
5322
5435
  timeoutMS: 2e3
5323
5436
  });
5324
5437
  case 4:
5325
5438
  if (!(e.errors.length > 0)) {
5326
- _context44.next = 6;
5439
+ _context46.next = 6;
5327
5440
  break;
5328
5441
  }
5329
5442
  throw e.errors[0];
5330
5443
  case 6:
5331
5444
  if (!(e.tasks.items[0].results.errors.length > 0)) {
5332
- _context44.next = 8;
5445
+ _context46.next = 8;
5333
5446
  break;
5334
5447
  }
5335
5448
  throw e.tasks.items[0].results.errors[0];
@@ -5346,16 +5459,16 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5346
5459
  } finally {
5347
5460
  _iterator.f();
5348
5461
  }
5349
- return _context44.abrupt("return", {
5462
+ return _context46.abrupt("return", {
5350
5463
  text: t || ""
5351
5464
  });
5352
5465
  case 12:
5353
5466
  case "end":
5354
- return _context44.stop();
5467
+ return _context46.stop();
5355
5468
  }
5356
- }, _callee44);
5469
+ }, _callee46);
5357
5470
  }));
5358
- function extractPollResultData(_x77) {
5471
+ function extractPollResultData(_x81) {
5359
5472
  return _extractPollResultData4.apply(this, arguments);
5360
5473
  }
5361
5474
  return extractPollResultData;
@@ -5454,13 +5567,13 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
5454
5567
  }, {
5455
5568
  key: "callServiceAPI",
5456
5569
  value: function () {
5457
- var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(e, t) {
5570
+ var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(e, t) {
5458
5571
  var n;
5459
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
5460
- while (1) switch (_context45.prev = _context45.next) {
5572
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5573
+ while (1) switch (_context47.prev = _context47.next) {
5461
5574
  case 0:
5462
5575
  if (this.requestSettings) {
5463
- _context45.next = 2;
5576
+ _context47.next = 2;
5464
5577
  break;
5465
5578
  }
5466
5579
  throw new Error("Request settings have not been set up");
@@ -5469,11 +5582,11 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
5469
5582
  this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
5470
5583
  case 4:
5471
5584
  case "end":
5472
- return _context45.stop();
5585
+ return _context47.stop();
5473
5586
  }
5474
- }, _callee45, this);
5587
+ }, _callee47, this);
5475
5588
  }));
5476
- function callServiceAPI(_x78, _x79) {
5589
+ function callServiceAPI(_x82, _x83) {
5477
5590
  return _callServiceAPI11.apply(this, arguments);
5478
5591
  }
5479
5592
  return callServiceAPI;
@@ -5481,27 +5594,27 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
5481
5594
  }, {
5482
5595
  key: "extractResultData",
5483
5596
  value: function () {
5484
- var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(e) {
5597
+ var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(e) {
5485
5598
  var t;
5486
- return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5487
- while (1) switch (_context46.prev = _context46.next) {
5599
+ return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5600
+ while (1) switch (_context48.prev = _context48.next) {
5488
5601
  case 0:
5489
5602
  if (!e.error) {
5490
- _context46.next = 2;
5603
+ _context48.next = 2;
5491
5604
  break;
5492
5605
  }
5493
5606
  throw e.error.message;
5494
5607
  case 2:
5495
- return _context46.abrupt("return", {
5608
+ return _context48.abrupt("return", {
5496
5609
  text: ((t = e.choices[0]) == null ? void 0 : t.text) || ""
5497
5610
  });
5498
5611
  case 3:
5499
5612
  case "end":
5500
- return _context46.stop();
5613
+ return _context48.stop();
5501
5614
  }
5502
- }, _callee46);
5615
+ }, _callee48);
5503
5616
  }));
5504
- function extractResultData(_x80) {
5617
+ function extractResultData(_x84) {
5505
5618
  return _extractResultData15.apply(this, arguments);
5506
5619
  }
5507
5620
  return extractResultData;
@@ -5516,17 +5629,17 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
5516
5629
  _createClass(AssemblyAIUtils, null, [{
5517
5630
  key: "poll",
5518
5631
  value: function () {
5519
- var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(e, t) {
5632
+ var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(e, t) {
5520
5633
  var n, l, c, d;
5521
- return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5522
- while (1) switch (_context47.prev = _context47.next) {
5634
+ return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5635
+ while (1) switch (_context49.prev = _context49.next) {
5523
5636
  case 0:
5524
5637
  n = {
5525
5638
  authorization: e,
5526
5639
  "content-type": "application/json"
5527
5640
  };
5528
- _context47.t0 = "https://api.assemblyai.com/v2/transcript/";
5529
- _context47.next = 4;
5641
+ _context49.t0 = "https://api.assemblyai.com/v2/transcript/";
5642
+ _context49.next = 4;
5530
5643
  return fetch("https://api.assemblyai.com/v2/transcript", {
5531
5644
  method: "POST",
5532
5645
  body: JSON.stringify({
@@ -5535,55 +5648,55 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
5535
5648
  headers: n
5536
5649
  });
5537
5650
  case 4:
5538
- _context47.next = 6;
5539
- return _context47.sent.json();
5651
+ _context49.next = 6;
5652
+ return _context49.sent.json();
5540
5653
  case 6:
5541
- _context47.t1 = _context47.sent.id;
5542
- l = _context47.t0.concat.call(_context47.t0, _context47.t1);
5654
+ _context49.t1 = _context49.sent.id;
5655
+ l = _context49.t0.concat.call(_context49.t0, _context49.t1);
5543
5656
  case 8:
5544
5657
  if (c) {
5545
- _context47.next = 24;
5658
+ _context49.next = 24;
5546
5659
  break;
5547
5660
  }
5548
- _context47.next = 11;
5661
+ _context49.next = 11;
5549
5662
  return fetch(l, {
5550
5663
  headers: n
5551
5664
  });
5552
5665
  case 11:
5553
- _context47.next = 13;
5554
- return _context47.sent.json();
5666
+ _context49.next = 13;
5667
+ return _context49.sent.json();
5555
5668
  case 13:
5556
- d = _context47.sent;
5669
+ d = _context49.sent;
5557
5670
  if (!(d.status === "completed")) {
5558
- _context47.next = 18;
5671
+ _context49.next = 18;
5559
5672
  break;
5560
5673
  }
5561
5674
  c = d;
5562
- _context47.next = 22;
5675
+ _context49.next = 22;
5563
5676
  break;
5564
5677
  case 18:
5565
5678
  if (!(d.status === "error")) {
5566
- _context47.next = 20;
5679
+ _context49.next = 20;
5567
5680
  break;
5568
5681
  }
5569
5682
  throw new Error("Transcription failed: ".concat(d.error));
5570
5683
  case 20:
5571
- _context47.next = 22;
5684
+ _context49.next = 22;
5572
5685
  return new Promise(function (h) {
5573
5686
  return setTimeout(h, 3e3);
5574
5687
  });
5575
5688
  case 22:
5576
- _context47.next = 8;
5689
+ _context49.next = 8;
5577
5690
  break;
5578
5691
  case 24:
5579
- return _context47.abrupt("return", c);
5692
+ return _context49.abrupt("return", c);
5580
5693
  case 25:
5581
5694
  case "end":
5582
- return _context47.stop();
5695
+ return _context49.stop();
5583
5696
  }
5584
- }, _callee47);
5697
+ }, _callee49);
5585
5698
  }));
5586
- function poll(_x81, _x82) {
5699
+ function poll(_x85, _x86) {
5587
5700
  return _poll2.apply(this, arguments);
5588
5701
  }
5589
5702
  return poll;
@@ -5631,19 +5744,19 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
5631
5744
  _createClass(AssemblyAIAudioIO, [{
5632
5745
  key: "callServiceAPI",
5633
5746
  value: function () {
5634
- var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(e, t, n) {
5747
+ var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(e, t, n) {
5635
5748
  var s;
5636
- return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5637
- while (1) switch (_context48.prev = _context48.next) {
5749
+ return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5750
+ while (1) switch (_context50.prev = _context50.next) {
5638
5751
  case 0:
5639
5752
  if ((s = this.requestSettings) != null && s.headers) {
5640
- _context48.next = 2;
5753
+ _context50.next = 2;
5641
5754
  break;
5642
5755
  }
5643
5756
  throw new Error("Request settings have not been set up");
5644
5757
  case 2:
5645
5758
  if (n != null && n[0]) {
5646
- _context48.next = 4;
5759
+ _context50.next = 4;
5647
5760
  break;
5648
5761
  }
5649
5762
  throw new Error("No file was added");
@@ -5651,11 +5764,11 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
5651
5764
  HTTPRequest.request(this, n[0], e, !1);
5652
5765
  case 5:
5653
5766
  case "end":
5654
- return _context48.stop();
5767
+ return _context50.stop();
5655
5768
  }
5656
- }, _callee48, this);
5769
+ }, _callee50, this);
5657
5770
  }));
5658
- function callServiceAPI(_x83, _x84, _x85) {
5771
+ function callServiceAPI(_x87, _x88, _x89) {
5659
5772
  return _callServiceAPI12.apply(this, arguments);
5660
5773
  }
5661
5774
  return callServiceAPI;
@@ -5663,32 +5776,32 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
5663
5776
  }, {
5664
5777
  key: "extractResultData",
5665
5778
  value: function () {
5666
- var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(e) {
5779
+ var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(e) {
5667
5780
  var s, o, t;
5668
- return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5669
- while (1) switch (_context49.prev = _context49.next) {
5781
+ return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5782
+ while (1) switch (_context51.prev = _context51.next) {
5670
5783
  case 0:
5671
5784
  if (!e.error) {
5672
- _context49.next = 2;
5785
+ _context51.next = 2;
5673
5786
  break;
5674
5787
  }
5675
5788
  throw e.error;
5676
5789
  case 2:
5677
5790
  t = (o = (s = this.requestSettings) == null ? void 0 : s.headers) == null ? void 0 : o.Authorization;
5678
- _context49.next = 5;
5791
+ _context51.next = 5;
5679
5792
  return AssemblyAIUtils.poll(t, e.upload_url);
5680
5793
  case 5:
5681
- _context49.t0 = _context49.sent.text;
5682
- return _context49.abrupt("return", {
5683
- text: _context49.t0
5794
+ _context51.t0 = _context51.sent.text;
5795
+ return _context51.abrupt("return", {
5796
+ text: _context51.t0
5684
5797
  });
5685
5798
  case 7:
5686
5799
  case "end":
5687
- return _context49.stop();
5800
+ return _context51.stop();
5688
5801
  }
5689
- }, _callee49, this);
5802
+ }, _callee51, this);
5690
5803
  }));
5691
- function extractResultData(_x86) {
5804
+ function extractResultData(_x90) {
5692
5805
  return _extractResultData16.apply(this, arguments);
5693
5806
  }
5694
5807
  return extractResultData;
@@ -5738,13 +5851,13 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5738
5851
  }, {
5739
5852
  key: "callServiceAPI",
5740
5853
  value: function () {
5741
- var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(e, t) {
5854
+ var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(e, t) {
5742
5855
  var n;
5743
- return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5744
- while (1) switch (_context50.prev = _context50.next) {
5856
+ return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5857
+ while (1) switch (_context52.prev = _context52.next) {
5745
5858
  case 0:
5746
5859
  if (this.requestSettings) {
5747
- _context50.next = 2;
5860
+ _context52.next = 2;
5748
5861
  break;
5749
5862
  }
5750
5863
  throw new Error("Request settings have not been set up");
@@ -5753,11 +5866,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5753
5866
  HTTPRequest.request(this, n, e, !1);
5754
5867
  case 4:
5755
5868
  case "end":
5756
- return _context50.stop();
5869
+ return _context52.stop();
5757
5870
  }
5758
- }, _callee50, this);
5871
+ }, _callee52, this);
5759
5872
  }));
5760
- function callServiceAPI(_x87, _x88) {
5873
+ function callServiceAPI(_x91, _x92) {
5761
5874
  return _callServiceAPI13.apply(this, arguments);
5762
5875
  }
5763
5876
  return callServiceAPI;
@@ -5765,11 +5878,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5765
5878
  }, {
5766
5879
  key: "extractResultData",
5767
5880
  value: function () {
5768
- var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(e) {
5769
- return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5770
- while (1) switch (_context51.prev = _context51.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) {
5771
5884
  case 0:
5772
- return _context51.abrupt("return", new Promise(function (t) {
5885
+ return _context53.abrupt("return", new Promise(function (t) {
5773
5886
  var n = new FileReader();
5774
5887
  n.readAsDataURL(e), n.onload = function (s) {
5775
5888
  t({
@@ -5782,11 +5895,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5782
5895
  }));
5783
5896
  case 1:
5784
5897
  case "end":
5785
- return _context51.stop();
5898
+ return _context53.stop();
5786
5899
  }
5787
- }, _callee51);
5900
+ }, _callee53);
5788
5901
  }));
5789
- function extractResultData(_x89) {
5902
+ function extractResultData(_x93) {
5790
5903
  return _extractResultData17.apply(this, arguments);
5791
5904
  }
5792
5905
  return extractResultData;
@@ -5822,19 +5935,19 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5822
5935
  _createClass(U, [{
5823
5936
  key: "callServiceAPI",
5824
5937
  value: function () {
5825
- var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(e, t, n) {
5938
+ var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(e, t, n) {
5826
5939
  var s, o;
5827
- return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5828
- while (1) switch (_context52.prev = _context52.next) {
5940
+ return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5941
+ while (1) switch (_context54.prev = _context54.next) {
5829
5942
  case 0:
5830
5943
  if ((s = this.requestSettings) != null && s.headers) {
5831
- _context52.next = 2;
5944
+ _context54.next = 2;
5832
5945
  break;
5833
5946
  }
5834
5947
  throw new Error("Request settings have not been set up");
5835
5948
  case 2:
5836
5949
  if (n != null && n[0]) {
5837
- _context52.next = 4;
5950
+ _context54.next = 4;
5838
5951
  break;
5839
5952
  }
5840
5953
  throw new Error("No file was added");
@@ -5842,11 +5955,11 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5842
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);
5843
5956
  case 5:
5844
5957
  case "end":
5845
- return _context52.stop();
5958
+ return _context54.stop();
5846
5959
  }
5847
- }, _callee52, this);
5960
+ }, _callee54, this);
5848
5961
  }));
5849
- function callServiceAPI(_x90, _x91, _x92) {
5962
+ function callServiceAPI(_x94, _x95, _x96) {
5850
5963
  return _callServiceAPI14.apply(this, arguments);
5851
5964
  }
5852
5965
  return callServiceAPI;
@@ -5854,26 +5967,26 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5854
5967
  }, {
5855
5968
  key: "extractResultData",
5856
5969
  value: function () {
5857
- var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(e) {
5858
- return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5859
- while (1) switch (_context53.prev = _context53.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) {
5860
5973
  case 0:
5861
5974
  if (!e.error) {
5862
- _context53.next = 2;
5975
+ _context55.next = 2;
5863
5976
  break;
5864
5977
  }
5865
5978
  throw e.error;
5866
5979
  case 2:
5867
- return _context53.abrupt("return", {
5980
+ return _context55.abrupt("return", {
5868
5981
  text: e.DisplayText || ""
5869
5982
  });
5870
5983
  case 3:
5871
5984
  case "end":
5872
- return _context53.stop();
5985
+ return _context55.stop();
5873
5986
  }
5874
- }, _callee53);
5987
+ }, _callee55);
5875
5988
  }));
5876
- function extractResultData(_x93) {
5989
+ function extractResultData(_x97) {
5877
5990
  return _extractResultData18.apply(this, arguments);
5878
5991
  }
5879
5992
  return extractResultData;
@@ -5916,13 +6029,13 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
5916
6029
  }, {
5917
6030
  key: "callServiceAPI",
5918
6031
  value: function () {
5919
- var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(e, t) {
6032
+ var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(e, t) {
5920
6033
  var n;
5921
- return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5922
- while (1) switch (_context54.prev = _context54.next) {
6034
+ return _regeneratorRuntime().wrap(function _callee56$(_context56) {
6035
+ while (1) switch (_context56.prev = _context56.next) {
5923
6036
  case 0:
5924
6037
  if (this.requestSettings) {
5925
- _context54.next = 2;
6038
+ _context56.next = 2;
5926
6039
  break;
5927
6040
  }
5928
6041
  throw new Error("Request settings have not been set up");
@@ -5931,11 +6044,11 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
5931
6044
  HTTPRequest.request(this, n, e);
5932
6045
  case 4:
5933
6046
  case "end":
5934
- return _context54.stop();
6047
+ return _context56.stop();
5935
6048
  }
5936
- }, _callee54, this);
6049
+ }, _callee56, this);
5937
6050
  }));
5938
- function callServiceAPI(_x94, _x95) {
6051
+ function callServiceAPI(_x98, _x99) {
5939
6052
  return _callServiceAPI15.apply(this, arguments);
5940
6053
  }
5941
6054
  return callServiceAPI;
@@ -5943,27 +6056,27 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
5943
6056
  }, {
5944
6057
  key: "extractResultData",
5945
6058
  value: function () {
5946
- var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(e) {
6059
+ var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(e) {
5947
6060
  var t;
5948
- return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5949
- while (1) switch (_context55.prev = _context55.next) {
6061
+ return _regeneratorRuntime().wrap(function _callee57$(_context57) {
6062
+ while (1) switch (_context57.prev = _context57.next) {
5950
6063
  case 0:
5951
6064
  if (!Array.isArray(e)) {
5952
- _context55.next = 2;
6065
+ _context57.next = 2;
5953
6066
  break;
5954
6067
  }
5955
- return _context55.abrupt("return", {
6068
+ return _context57.abrupt("return", {
5956
6069
  text: ((t = e[0].translations) == null ? void 0 : t[0].text) || ""
5957
6070
  });
5958
6071
  case 2:
5959
6072
  throw e.error;
5960
6073
  case 3:
5961
6074
  case "end":
5962
- return _context55.stop();
6075
+ return _context57.stop();
5963
6076
  }
5964
- }, _callee55);
6077
+ }, _callee57);
5965
6078
  }));
5966
- function extractResultData(_x96) {
6079
+ function extractResultData(_x100) {
5967
6080
  return _extractResultData19.apply(this, arguments);
5968
6081
  }
5969
6082
  return extractResultData;
@@ -5972,11 +6085,11 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
5972
6085
  return AzureTranslationIO;
5973
6086
  }(DirectServiceIO);
5974
6087
  var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
5975
- _inherits(A, _DirectServiceIO9);
5976
- var _super30 = _createSuper(A);
5977
- function A(e) {
6088
+ _inherits(M, _DirectServiceIO9);
6089
+ var _super30 = _createSuper(M);
6090
+ function M(e) {
5978
6091
  var _this23;
5979
- _classCallCheck(this, A);
6092
+ _classCallCheck(this, M);
5980
6093
  var l;
5981
6094
  var t = e.directConnection,
5982
6095
  n = e.textInput,
@@ -6000,16 +6113,16 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
6000
6113
  }
6001
6114
  };
6002
6115
  }
6003
- _typeof(a) == "object" && Object.assign(_this23.rawBody, a), _this23.canSendMessage = A.canFileSendMessage;
6116
+ _typeof(a) == "object" && Object.assign(_this23.rawBody, a), _this23.canSendMessage = M.canFileSendMessage;
6004
6117
  return _this23;
6005
6118
  }
6006
- _createClass(A, [{
6119
+ _createClass(M, [{
6007
6120
  key: "preprocessBody",
6008
6121
  value: function preprocessBody(e, t) {
6009
6122
  var n = JSON.parse(JSON.stringify(e));
6010
6123
  if (t && t !== "") {
6011
- var s = t.substring(0, this._maxCharLength);
6012
- n.prompt = s;
6124
+ var _s5 = t.substring(0, this._maxCharLength);
6125
+ n.prompt = _s5;
6013
6126
  }
6014
6127
  return n;
6015
6128
  }
@@ -6021,50 +6134,50 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
6021
6134
  var s;
6022
6135
  var o = (l = (a = t[t.length - 1]) == null ? void 0 : a.text) == null ? void 0 : l.trim();
6023
6136
  if (n[1] || o && o !== "") {
6024
- this.url = A.IMAGE_EDIT_URL;
6137
+ this.url = M.IMAGE_EDIT_URL;
6025
6138
  var c = this.preprocessBody(this.rawBody, o);
6026
- s = A.createFormDataBody(c, n[0], n[1]);
6027
- } else this.url = A.IMAGE_VARIATIONS_URL, s = A.createFormDataBody(this.rawBody, n[0]);
6139
+ s = M.createFormDataBody(c, n[0], n[1]);
6140
+ } else this.url = M.IMAGE_VARIATIONS_URL, s = M.createFormDataBody(this.rawBody, n[0]);
6028
6141
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, s, e), !1);
6029
6142
  }
6030
6143
  }, {
6031
6144
  key: "callServiceAPI",
6032
6145
  value: function () {
6033
- var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(e, t, n) {
6034
- var s, o;
6035
- return _regeneratorRuntime().wrap(function _callee56$(_context56) {
6036
- while (1) switch (_context56.prev = _context56.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) {
6037
6150
  case 0:
6038
6151
  if ((s = this.requestSettings) != null && s.headers) {
6039
- _context56.next = 2;
6152
+ _context58.next = 2;
6040
6153
  break;
6041
6154
  }
6042
6155
  throw new Error("Request settings have not been set up");
6043
6156
  case 2:
6044
6157
  if (!(n != null && n[0])) {
6045
- _context56.next = 6;
6158
+ _context58.next = 6;
6046
6159
  break;
6047
6160
  }
6048
6161
  this.callApiWithImage(e, t, n);
6049
- _context56.next = 11;
6162
+ _context58.next = 11;
6050
6163
  break;
6051
6164
  case 6:
6052
6165
  if (this.requestSettings) {
6053
- _context56.next = 8;
6166
+ _context58.next = 8;
6054
6167
  break;
6055
6168
  }
6056
6169
  throw new Error("Request settings have not been set up");
6057
6170
  case 8:
6058
- this.url = A.IMAGE_GENERATION_URL;
6059
- o = this.preprocessBody(this.rawBody, t[t.length - 1].text);
6060
- HTTPRequest.request(this, o, e);
6171
+ this.url = M.IMAGE_GENERATION_URL;
6172
+ _o2 = this.preprocessBody(this.rawBody, t[t.length - 1].text);
6173
+ HTTPRequest.request(this, _o2, e);
6061
6174
  case 11:
6062
6175
  case "end":
6063
- return _context56.stop();
6176
+ return _context58.stop();
6064
6177
  }
6065
- }, _callee56, this);
6178
+ }, _callee58, this);
6066
6179
  }));
6067
- function callServiceAPI(_x97, _x98, _x99) {
6180
+ function callServiceAPI(_x101, _x102, _x103) {
6068
6181
  return _callServiceAPI16.apply(this, arguments);
6069
6182
  }
6070
6183
  return callServiceAPI;
@@ -6072,17 +6185,17 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
6072
6185
  }, {
6073
6186
  key: "extractResultData",
6074
6187
  value: function () {
6075
- var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(e) {
6076
- return _regeneratorRuntime().wrap(function _callee57$(_context57) {
6077
- while (1) switch (_context57.prev = _context57.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) {
6078
6191
  case 0:
6079
6192
  if (!e.error) {
6080
- _context57.next = 2;
6193
+ _context59.next = 2;
6081
6194
  break;
6082
6195
  }
6083
6196
  throw e.error.message;
6084
6197
  case 2:
6085
- return _context57.abrupt("return", {
6198
+ return _context59.abrupt("return", {
6086
6199
  files: e.data.map(function (n) {
6087
6200
  return n.url ? {
6088
6201
  src: n.url,
@@ -6095,11 +6208,11 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
6095
6208
  });
6096
6209
  case 3:
6097
6210
  case "end":
6098
- return _context57.stop();
6211
+ return _context59.stop();
6099
6212
  }
6100
- }, _callee57);
6213
+ }, _callee59);
6101
6214
  }));
6102
- function extractResultData(_x100) {
6215
+ function extractResultData(_x104) {
6103
6216
  return _extractResultData20.apply(this, arguments);
6104
6217
  }
6105
6218
  return extractResultData;
@@ -6126,34 +6239,34 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
6126
6239
  }), s;
6127
6240
  }
6128
6241
  }]);
6129
- return A;
6242
+ return M;
6130
6243
  }(DirectServiceIO);
6131
6244
  _OpenAIImagesIO.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations";
6132
6245
  _OpenAIImagesIO.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations";
6133
6246
  _OpenAIImagesIO.IMAGE_EDIT_URL = "https://api.openai.com/v1/images/edits";
6134
6247
  var OpenAIImagesIO = _OpenAIImagesIO;
6135
6248
  var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
6136
- _inherits(M, _DirectServiceIO10);
6137
- var _super31 = _createSuper(M);
6138
- function M(e) {
6249
+ _inherits(k, _DirectServiceIO10);
6250
+ var _super31 = _createSuper(k);
6251
+ function k(e) {
6139
6252
  var _l$model2;
6140
6253
  var _this24;
6141
- _classCallCheck(this, M);
6254
+ _classCallCheck(this, k);
6142
6255
  var a, l;
6143
6256
  var t = e.directConnection,
6144
6257
  n = e.textInput,
6145
6258
  s = t == null ? void 0 : t.openAI;
6146
6259
  _this24 = _super31.call(this, e, OpenAIUtils.buildKeyVerificationDetails(), OpenAIUtils.buildHeaders, s, {
6147
6260
  audio: {}
6148
- }), _this24.insertKeyPlaceholderText = "OpenAI API Key", _this24.getKeyLink = "https://platform.openai.com/account/api-keys", _this24.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI Whisper</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/api-reference/audio/create\">here</a> for more info.</p>", _this24.url = "", _this24.permittedErrorPrefixes = ["Invalid"], _this24._maxCharLength = OpenAIUtils.FILE_MAX_CHAR_LENGTH, _this24._service_url = M.AUDIO_TRANSCRIPTIONS_URL, n != null && n.characterLimit && (_this24._maxCharLength = n.characterLimit);
6261
+ }), _this24.insertKeyPlaceholderText = "OpenAI API Key", _this24.getKeyLink = "https://platform.openai.com/account/api-keys", _this24.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI Whisper</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/api-reference/audio/create\">here</a> for more info.</p>", _this24.url = "", _this24.permittedErrorPrefixes = ["Invalid"], _this24._maxCharLength = OpenAIUtils.FILE_MAX_CHAR_LENGTH, _this24._service_url = k.AUDIO_TRANSCRIPTIONS_URL, n != null && n.characterLimit && (_this24._maxCharLength = n.characterLimit);
6149
6262
  var o = (a = t == null ? void 0 : t.openAI) == null ? void 0 : a.audio;
6150
- _typeof(o) == "object" && (_this24.processConfig(o), M.cleanConfig(o), Object.assign(_this24.rawBody, o)), (_l$model2 = (l = _this24.rawBody).model) !== null && _l$model2 !== void 0 ? _l$model2 : l.model = M.DEFAULT_MODEL, _this24.rawBody.response_format = "json", _this24.canSendMessage = M.canSendFileMessage;
6263
+ _typeof(o) == "object" && (_this24.processConfig(o), k.cleanConfig(o), Object.assign(_this24.rawBody, o)), (_l$model2 = (l = _this24.rawBody).model) !== null && _l$model2 !== void 0 ? _l$model2 : l.model = k.DEFAULT_MODEL, _this24.rawBody.response_format = "json", _this24.canSendMessage = k.canSendFileMessage;
6151
6264
  return _this24;
6152
6265
  }
6153
- _createClass(M, [{
6266
+ _createClass(k, [{
6154
6267
  key: "processConfig",
6155
6268
  value: function processConfig(e) {
6156
- e != null && e.type && e.type === "translation" && (this._service_url = M.AUDIO_TRANSLATIONS_URL, delete e.language);
6269
+ e != null && e.type && e.type === "translation" && (this._service_url = k.AUDIO_TRANSLATIONS_URL, delete e.language);
6157
6270
  }
6158
6271
  }, {
6159
6272
  key: "preprocessBody",
@@ -6171,33 +6284,33 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
6171
6284
  }, {
6172
6285
  key: "callServiceAPI",
6173
6286
  value: function () {
6174
- var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(e, t, n) {
6287
+ var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(e, t, n) {
6175
6288
  var a, s, o;
6176
- return _regeneratorRuntime().wrap(function _callee58$(_context58) {
6177
- while (1) switch (_context58.prev = _context58.next) {
6289
+ return _regeneratorRuntime().wrap(function _callee60$(_context60) {
6290
+ while (1) switch (_context60.prev = _context60.next) {
6178
6291
  case 0:
6179
6292
  if ((a = this.requestSettings) != null && a.headers) {
6180
- _context58.next = 2;
6293
+ _context60.next = 2;
6181
6294
  break;
6182
6295
  }
6183
6296
  throw new Error("Request settings have not been set up");
6184
6297
  case 2:
6185
6298
  if (n != null && n[0]) {
6186
- _context58.next = 4;
6299
+ _context60.next = 4;
6187
6300
  break;
6188
6301
  }
6189
6302
  throw new Error("No file was added");
6190
6303
  case 4:
6191
6304
  this.url = this.requestSettings.url || this._service_url;
6192
- s = this.preprocessBody(this.rawBody, t, n), o = M.createFormDataBody(s, n[0]);
6305
+ s = this.preprocessBody(this.rawBody, t, n), o = k.createFormDataBody(s, n[0]);
6193
6306
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
6194
6307
  case 7:
6195
6308
  case "end":
6196
- return _context58.stop();
6309
+ return _context60.stop();
6197
6310
  }
6198
- }, _callee58, this);
6311
+ }, _callee60, this);
6199
6312
  }));
6200
- function callServiceAPI(_x101, _x102, _x103) {
6313
+ function callServiceAPI(_x105, _x106, _x107) {
6201
6314
  return _callServiceAPI17.apply(this, arguments);
6202
6315
  }
6203
6316
  return callServiceAPI;
@@ -6205,26 +6318,26 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
6205
6318
  }, {
6206
6319
  key: "extractResultData",
6207
6320
  value: function () {
6208
- var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(e) {
6209
- return _regeneratorRuntime().wrap(function _callee59$(_context59) {
6210
- while (1) switch (_context59.prev = _context59.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) {
6211
6324
  case 0:
6212
6325
  if (!e.error) {
6213
- _context59.next = 2;
6326
+ _context61.next = 2;
6214
6327
  break;
6215
6328
  }
6216
6329
  throw e.error.message;
6217
6330
  case 2:
6218
- return _context59.abrupt("return", {
6331
+ return _context61.abrupt("return", {
6219
6332
  text: e.text
6220
6333
  });
6221
6334
  case 3:
6222
6335
  case "end":
6223
- return _context59.stop();
6336
+ return _context61.stop();
6224
6337
  }
6225
- }, _callee59);
6338
+ }, _callee61);
6226
6339
  }));
6227
- function extractResultData(_x104) {
6340
+ function extractResultData(_x108) {
6228
6341
  return _extractResultData21.apply(this, arguments);
6229
6342
  }
6230
6343
  return extractResultData;
@@ -6248,7 +6361,7 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
6248
6361
  }), n;
6249
6362
  }
6250
6363
  }]);
6251
- return M;
6364
+ return k;
6252
6365
  }(DirectServiceIO);
6253
6366
  _OpenAIAudioIO.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions";
6254
6367
  _OpenAIAudioIO.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations";
@@ -6290,13 +6403,13 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6290
6403
  }, {
6291
6404
  key: "callServiceAPI",
6292
6405
  value: function () {
6293
- var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(e, t) {
6406
+ var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(e, t) {
6294
6407
  var n;
6295
- return _regeneratorRuntime().wrap(function _callee60$(_context60) {
6296
- while (1) switch (_context60.prev = _context60.next) {
6408
+ return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6409
+ while (1) switch (_context62.prev = _context62.next) {
6297
6410
  case 0:
6298
6411
  if (this.requestSettings) {
6299
- _context60.next = 2;
6412
+ _context62.next = 2;
6300
6413
  break;
6301
6414
  }
6302
6415
  throw new Error("Request settings have not been set up");
@@ -6305,11 +6418,11 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6305
6418
  this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
6306
6419
  case 4:
6307
6420
  case "end":
6308
- return _context60.stop();
6421
+ return _context62.stop();
6309
6422
  }
6310
- }, _callee60, this);
6423
+ }, _callee62, this);
6311
6424
  }));
6312
- function callServiceAPI(_x105, _x106) {
6425
+ function callServiceAPI(_x109, _x110) {
6313
6426
  return _callServiceAPI18.apply(this, arguments);
6314
6427
  }
6315
6428
  return callServiceAPI;
@@ -6317,17 +6430,17 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6317
6430
  }, {
6318
6431
  key: "extractResultData",
6319
6432
  value: function () {
6320
- var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(e) {
6321
- return _regeneratorRuntime().wrap(function _callee61$(_context61) {
6322
- while (1) switch (_context61.prev = _context61.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) {
6323
6436
  case 0:
6324
6437
  if (!e.error) {
6325
- _context61.next = 2;
6438
+ _context63.next = 2;
6326
6439
  break;
6327
6440
  }
6328
6441
  throw e.error.message;
6329
6442
  case 2:
6330
- return _context61.abrupt("return", e.choices[0].delta ? {
6443
+ return _context63.abrupt("return", e.choices[0].delta ? {
6331
6444
  text: e.choices[0].delta.content || ""
6332
6445
  } : e.choices[0].message ? {
6333
6446
  text: e.choices[0].message.content
@@ -6336,11 +6449,11 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6336
6449
  });
6337
6450
  case 3:
6338
6451
  case "end":
6339
- return _context61.stop();
6452
+ return _context63.stop();
6340
6453
  }
6341
- }, _callee61);
6454
+ }, _callee63);
6342
6455
  }));
6343
- function extractResultData(_x107) {
6456
+ function extractResultData(_x111) {
6344
6457
  return _extractResultData22.apply(this, arguments);
6345
6458
  }
6346
6459
  return extractResultData;
@@ -6388,13 +6501,13 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
6388
6501
  }, {
6389
6502
  key: "callServiceAPI",
6390
6503
  value: function () {
6391
- var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(e, t) {
6504
+ var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(e, t) {
6392
6505
  var n;
6393
- return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6394
- while (1) switch (_context62.prev = _context62.next) {
6506
+ return _regeneratorRuntime().wrap(function _callee64$(_context64) {
6507
+ while (1) switch (_context64.prev = _context64.next) {
6395
6508
  case 0:
6396
6509
  if (this.requestSettings) {
6397
- _context62.next = 2;
6510
+ _context64.next = 2;
6398
6511
  break;
6399
6512
  }
6400
6513
  throw new Error("Request settings have not been set up");
@@ -6403,11 +6516,11 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
6403
6516
  HTTPRequest.request(this, n, e);
6404
6517
  case 4:
6405
6518
  case "end":
6406
- return _context62.stop();
6519
+ return _context64.stop();
6407
6520
  }
6408
- }, _callee62, this);
6521
+ }, _callee64, this);
6409
6522
  }));
6410
- function callServiceAPI(_x108, _x109) {
6523
+ function callServiceAPI(_x112, _x113) {
6411
6524
  return _callServiceAPI19.apply(this, arguments);
6412
6525
  }
6413
6526
  return callServiceAPI;
@@ -6415,26 +6528,26 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
6415
6528
  }, {
6416
6529
  key: "extractResultData",
6417
6530
  value: function () {
6418
- var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(e) {
6419
- return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6420
- while (1) switch (_context63.prev = _context63.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) {
6421
6534
  case 0:
6422
6535
  if (!e.message) {
6423
- _context63.next = 2;
6536
+ _context65.next = 2;
6424
6537
  break;
6425
6538
  }
6426
6539
  throw e.message;
6427
6540
  case 2:
6428
- return _context63.abrupt("return", {
6541
+ return _context65.abrupt("return", {
6429
6542
  text: e.text
6430
6543
  });
6431
6544
  case 3:
6432
6545
  case "end":
6433
- return _context63.stop();
6546
+ return _context65.stop();
6434
6547
  }
6435
- }, _callee63);
6548
+ }, _callee65);
6436
6549
  }));
6437
- function extractResultData(_x110) {
6550
+ function extractResultData(_x114) {
6438
6551
  return _extractResultData23.apply(this, arguments);
6439
6552
  }
6440
6553
  return extractResultData;
@@ -6601,11 +6714,11 @@ var _TextToSpeech = /*#__PURE__*/function () {
6601
6714
  var n = {};
6602
6715
  setTimeout(function () {
6603
6716
  if (_typeof(e) == "object" && (e.lang && (n.lang = e.lang), e.pitch && (n.pitch = e.pitch), e.rate && (n.rate = e.rate), e.volume && (n.volume = e.volume), e.voiceName)) {
6604
- var s = window.speechSynthesis.getVoices().find(function (o) {
6717
+ var _s6 = window.speechSynthesis.getVoices().find(function (o) {
6605
6718
  var a;
6606
6719
  return o.name.toLocaleLowerCase() === ((a = e.voiceName) == null ? void 0 : a.toLocaleLowerCase());
6607
6720
  });
6608
- s && (n.voice = s);
6721
+ _s6 && (n.voice = _s6);
6609
6722
  }
6610
6723
  t(n);
6611
6724
  }, $.LOAD_VOICES_MS);
@@ -6647,9 +6760,9 @@ var MessageStyleUtils = /*#__PURE__*/function () {
6647
6760
  key: "applyCustomStylesToElements",
6648
6761
  value: function applyCustomStylesToElements(e, t, n) {
6649
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)) {
6650
- var s = e.bubbleElement.children[0],
6651
- o = s.tagName.toLocaleLowerCase() !== "a" ? s : s.children[0];
6652
- Object.assign(o.style, n.media);
6763
+ var _s7 = e.bubbleElement.children[0],
6764
+ _o3 = _s7.tagName.toLocaleLowerCase() !== "a" ? _s7 : _s7.children[0];
6765
+ Object.assign(_o3.style, n.media);
6653
6766
  }
6654
6767
  }
6655
6768
  }, {
@@ -6792,24 +6905,24 @@ var FileMessages = /*#__PURE__*/function () {
6792
6905
  }, {
6793
6906
  key: "addNewImageMessage",
6794
6907
  value: function () {
6795
- var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(e, t, n) {
6908
+ var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(e, t, n) {
6796
6909
  var s,
6797
6910
  o,
6798
6911
  a,
6799
- _args64 = arguments;
6800
- return _regeneratorRuntime().wrap(function _callee64$(_context64) {
6801
- while (1) switch (_context64.prev = _context64.next) {
6912
+ _args66 = arguments;
6913
+ return _regeneratorRuntime().wrap(function _callee66$(_context66) {
6914
+ while (1) switch (_context66.prev = _context66.next) {
6802
6915
  case 0:
6803
- s = _args64.length > 3 && _args64[3] !== undefined ? _args64[3] : !1;
6916
+ s = _args66.length > 3 && _args66[3] !== undefined ? _args66[3] : !1;
6804
6917
  o = FileMessages.createImage(t, e.elementRef), a = e.createNewMessageElement("", n);
6805
6918
  a.bubbleElement.appendChild(o), a.bubbleElement.classList.add("image-message"), e.elementRef.appendChild(a.outerContainer), FileMessageUtils.updateMessages(e, a, t, "image", n, s);
6806
6919
  case 3:
6807
6920
  case "end":
6808
- return _context64.stop();
6921
+ return _context66.stop();
6809
6922
  }
6810
- }, _callee64);
6923
+ }, _callee66);
6811
6924
  }));
6812
- function addNewImageMessage(_x111, _x112, _x113) {
6925
+ function addNewImageMessage(_x115, _x116, _x117) {
6813
6926
  return _addNewImageMessage.apply(this, arguments);
6814
6927
  }
6815
6928
  return addNewImageMessage;
@@ -7080,16 +7193,27 @@ var Messages = /*#__PURE__*/function () {
7080
7193
  }
7081
7194
  }
7082
7195
  }
7196
+ }, {
7197
+ key: "getLastMessageElement",
7198
+ value: function getLastMessageElement() {
7199
+ return this.elementRef.children[this.elementRef.children.length - 1];
7200
+ }
7201
+ }, {
7202
+ key: "getLastMessageBubbleElement",
7203
+ value: function getLastMessageBubbleElement() {
7204
+ var e, t, n, s;
7205
+ return (s = (n = (t = (e = this.getLastMessageElement()) == null ? void 0 : e.children) == null ? void 0 : t[0]) == null ? void 0 : n.children) == null ? void 0 : s[0];
7206
+ }
7083
7207
  }, {
7084
7208
  key: "isLastMessageError",
7085
7209
  value: function isLastMessageError() {
7086
- var e, t, n, s, o;
7087
- return (o = (s = (n = (t = (e = this.elementRef.children[this.elementRef.children.length - 1]) == null ? void 0 : e.children) == null ? void 0 : t[0]) == null ? void 0 : n.children) == null ? void 0 : s[0]) == null ? void 0 : o.classList.contains("error-message-text");
7210
+ var e;
7211
+ return (e = this.getLastMessageBubbleElement()) == null ? void 0 : e.classList.contains("error-message-text");
7088
7212
  }
7089
7213
  }, {
7090
7214
  key: "removeError",
7091
7215
  value: function removeError() {
7092
- this.isLastMessageError() && this.elementRef.children[this.elementRef.children.length - 1].remove();
7216
+ this.isLastMessageError() && this.getLastMessageElement().remove();
7093
7217
  }
7094
7218
  }, {
7095
7219
  key: "addLoadingMessage",
@@ -7124,7 +7248,7 @@ var Messages = /*#__PURE__*/function () {
7124
7248
  }, {
7125
7249
  key: "finaliseStreamedMessage",
7126
7250
  value: function finaliseStreamedMessage() {
7127
- this.messages[this.messages.length - 1].text = this._streamedText, this.sendClientUpdate(Messages.createMessageContent(!0, this._streamedText), !1), this._textToSpeech && TextToSpeech.speak(this._streamedText, this._textToSpeech), this._streamedText = "";
7251
+ this.getLastMessageBubbleElement().classList.contains("streamed-message") && (this.messages[this.messages.length - 1].text = this._streamedText, this.sendClientUpdate(Messages.createMessageContent(!0, this._streamedText), !1), this._textToSpeech && TextToSpeech.speak(this._streamedText, this._textToSpeech), this._streamedText = "");
7128
7252
  }
7129
7253
  }, {
7130
7254
  key: "populateIntroPanel",
@@ -7134,27 +7258,27 @@ var Messages = /*#__PURE__*/function () {
7134
7258
  }, {
7135
7259
  key: "addMultipleFiles",
7136
7260
  value: function () {
7137
- var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(e) {
7261
+ var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(e) {
7138
7262
  var _this31 = this;
7139
- return _regeneratorRuntime().wrap(function _callee65$(_context65) {
7140
- while (1) switch (_context65.prev = _context65.next) {
7263
+ return _regeneratorRuntime().wrap(function _callee67$(_context67) {
7264
+ while (1) switch (_context67.prev = _context67.next) {
7141
7265
  case 0:
7142
- return _context65.abrupt("return", Promise.all((e || []).map(function (t) {
7266
+ return _context67.abrupt("return", Promise.all((e || []).map(function (t) {
7143
7267
  return new Promise(function (n) {
7144
7268
  if (!t.type || t.type === "any") {
7145
- var s = t.file.name || FileMessageUtils.DEFAULT_FILE_NAME;
7269
+ var _s8 = t.file.name || FileMessageUtils.DEFAULT_FILE_NAME;
7146
7270
  _this31.addNewMessage({
7147
7271
  files: [{
7148
- name: s,
7272
+ name: _s8,
7149
7273
  type: "any"
7150
7274
  }]
7151
7275
  }, !1, !0), n(!0);
7152
7276
  } else {
7153
- var _s = new FileReader();
7154
- _s.readAsDataURL(t.file), _s.onload = function () {
7277
+ var _s9 = new FileReader();
7278
+ _s9.readAsDataURL(t.file), _s9.onload = function () {
7155
7279
  _this31.addNewMessage({
7156
7280
  files: [{
7157
- src: _s.result,
7281
+ src: _s9.result,
7158
7282
  type: t.type
7159
7283
  }]
7160
7284
  }, !1, !0), n(!0);
@@ -7164,15 +7288,15 @@ var Messages = /*#__PURE__*/function () {
7164
7288
  })));
7165
7289
  case 1:
7166
7290
  case "end":
7167
- return _context65.stop();
7291
+ return _context67.stop();
7168
7292
  }
7169
- }, _callee65);
7293
+ }, _callee67);
7170
7294
  }));
7171
- function addMultipleFiles(_x114) {
7295
+ function addMultipleFiles(_x118) {
7172
7296
  return _addMultipleFiles.apply(this, arguments);
7173
7297
  }
7174
7298
  return addMultipleFiles;
7175
- }()
7299
+ }() // WORK - need to clear the messages array
7176
7300
  }, {
7177
7301
  key: "clearMessages",
7178
7302
  value: function clearMessages(e) {
@@ -7242,10 +7366,10 @@ var Messages = /*#__PURE__*/function () {
7242
7366
  return Messages;
7243
7367
  }();
7244
7368
  var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
7245
- function E() {
7246
- _classCallCheck(this, E);
7369
+ function T() {
7370
+ _classCallCheck(this, T);
7247
7371
  }
7248
- _createClass(E, null, [{
7372
+ _createClass(T, null, [{
7249
7373
  key: "adjustInputPadding",
7250
7374
  value: function adjustInputPadding(e, t) {
7251
7375
  t["inside-left"].length > 0 && e.classList.add("text-input-inner-left-adjustment"), t["inside-right"].length > 0 && e.classList.add("text-input-inner-right-adjustment");
@@ -7253,7 +7377,7 @@ var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
7253
7377
  }, {
7254
7378
  key: "adjustForOutsideButton",
7255
7379
  value: function adjustForOutsideButton(e, t, n) {
7256
- n["outside-right"].length === 0 && n["outside-left"].length > 0 ? (e[0].classList.add(E.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS), t.classList.add(E.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS)) : n["outside-left"].length === 0 && n["outside-right"].length > 0 && (e[3].classList.add(E.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS), t.classList.add(E.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS));
7380
+ n["outside-right"].length === 0 && n["outside-left"].length > 0 ? (e[0].classList.add(T.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS), t.classList.add(T.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS)) : n["outside-left"].length === 0 && n["outside-right"].length > 0 && (e[3].classList.add(T.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS), t.classList.add(T.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS));
7257
7381
  }
7258
7382
  // when submit is the only button
7259
7383
  // when submit button is outside by itself - we increase the height for a better look
@@ -7261,10 +7385,10 @@ var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
7261
7385
  key: "adjustOutsideSubmit",
7262
7386
  value: function adjustOutsideSubmit(e, t, n) {
7263
7387
  if (!(n["inside-left"].length > 0 || n["inside-right"].length > 0)) {
7264
- if (n["outside-right"].length === 0 && n["outside-left"].length > 0) return e[0].classList.add(E.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), t.classList.add(E.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), n["outside-left"].map(function (s) {
7388
+ if (n["outside-right"].length === 0 && n["outside-left"].length > 0) return e[0].classList.add(T.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), t.classList.add(T.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), n["outside-left"].map(function (s) {
7265
7389
  return s.button.elementRef.classList.add("submit-button-enlarged");
7266
7390
  });
7267
- if (n["outside-left"].length === 0 && n["outside-right"].length > 0) return e[3].classList.add(E.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), t.classList.add(E.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), n["outside-right"].map(function (s) {
7391
+ if (n["outside-left"].length === 0 && n["outside-right"].length > 0) return e[3].classList.add(T.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), t.classList.add(T.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), n["outside-right"].map(function (s) {
7268
7392
  return s.button.elementRef.classList.add("submit-button-enlarged");
7269
7393
  });
7270
7394
  }
@@ -7272,10 +7396,10 @@ var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
7272
7396
  }, {
7273
7397
  key: "set",
7274
7398
  value: function set(e, t, n, s) {
7275
- !!E.adjustOutsideSubmit(t, n, s) || E.adjustForOutsideButton(t, n, s), E.adjustInputPadding(e, s);
7399
+ !!T.adjustOutsideSubmit(t, n, s) || T.adjustForOutsideButton(t, n, s), T.adjustInputPadding(e, s);
7276
7400
  }
7277
7401
  }]);
7278
- return E;
7402
+ return T;
7279
7403
  }();
7280
7404
  _InputButtonStyleAdjustments.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS = "text-input-container-left-adjustment";
7281
7405
  _InputButtonStyleAdjustments.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS = "text-input-container-right-adjustment";
@@ -7439,8 +7563,8 @@ var InputButton = /*#__PURE__*/function () {
7439
7563
  value: function unsetCustomStateStyles(e) {
7440
7564
  if (this._customStyles) for (var t = 0; t < e.length; t += 1) {
7441
7565
  var n = e[t],
7442
- s = n && this._customStyles[n];
7443
- s && ButtonCSS.unsetActionCSS(this.elementRef, s);
7566
+ _s10 = n && this._customStyles[n];
7567
+ _s10 && ButtonCSS.unsetActionCSS(this.elementRef, _s10);
7444
7568
  }
7445
7569
  }
7446
7570
  }, {
@@ -7804,14 +7928,14 @@ var FileAttachmentsType = /*#__PURE__*/function () {
7804
7928
  key: "addAttachmentBasedOnType",
7805
7929
  value: function addAttachmentBasedOnType(e, t, n) {
7806
7930
  if (e.type.startsWith("image")) {
7807
- var s = FileAttachmentsType.createImageAttachment(t);
7808
- this.addFileAttachment(e, "image", s, n);
7931
+ var _s11 = FileAttachmentsType.createImageAttachment(t);
7932
+ this.addFileAttachment(e, "image", _s11, n);
7809
7933
  } else if (e.type.startsWith("audio")) {
7810
- var _s2 = AudioFileAttachmentType.createAudioAttachment(t);
7811
- this.addFileAttachment(e, "audio", _s2, n);
7934
+ var _s12 = AudioFileAttachmentType.createAudioAttachment(t);
7935
+ this.addFileAttachment(e, "audio", _s12, n);
7812
7936
  } else {
7813
- var _s3 = FileAttachmentsType.createAnyFileAttachment(e.name);
7814
- this.addFileAttachment(e, "any", _s3, n);
7937
+ var _s13 = FileAttachmentsType.createAnyFileAttachment(e.name);
7938
+ this.addFileAttachment(e, "any", _s13, n);
7815
7939
  }
7816
7940
  }
7817
7941
  }, {
@@ -7873,15 +7997,15 @@ var FileAttachmentsType = /*#__PURE__*/function () {
7873
7997
  value: function isFileTypeValid(e, t) {
7874
7998
  if (t === "") return !0;
7875
7999
  var n = t.split(",");
7876
- for (var s = 0; s < n.length; s++) {
7877
- var o = n[s].trim();
7878
- if (e.type === o) return !0;
7879
- if (o.startsWith(".")) {
7880
- var a = o.slice(1);
7881
- if (e.name.endsWith(a)) return !0;
8000
+ for (var _s14 = 0; _s14 < n.length; _s14++) {
8001
+ var _o4 = n[_s14].trim();
8002
+ if (e.type === _o4) return !0;
8003
+ if (_o4.startsWith(".")) {
8004
+ var _a3 = _o4.slice(1);
8005
+ if (e.name.endsWith(_a3)) return !0;
7882
8006
  } else {
7883
- if (e.name.endsWith(o)) return !0;
7884
- if (o.endsWith("/*") && e.type.startsWith(o.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;
7885
8009
  }
7886
8010
  }
7887
8011
  return !1;
@@ -7914,18 +8038,18 @@ var FileAttachmentsType = /*#__PURE__*/function () {
7914
8038
  var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <title>play</title>\n <path d=\"M5.92 24.096q0 1.088 0.928 1.728 0.512 0.288 1.088 0.288 0.448 0 0.896-0.224l16.16-8.064q0.48-0.256 0.8-0.736t0.288-1.088-0.288-1.056-0.8-0.736l-16.16-8.064q-0.448-0.224-0.896-0.224-0.544 0-1.088 0.288-0.928 0.608-0.928 1.728v16.16z\"></path>\n</svg>",
7915
8039
  STOP_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n<title>stop</title>\n<path d=\"M5.92 24.096q0 0.832 0.576 1.408t1.44 0.608h16.128q0.832 0 1.44-0.608t0.576-1.408v-16.16q0-0.832-0.576-1.44t-1.44-0.576h-16.128q-0.832 0-1.44 0.576t-0.576 1.44v16.16z\"></path>\n</svg>",
7916
8040
  _AudioFileAttachmentType = /*#__PURE__*/function (_FileAttachmentsType) {
7917
- _inherits(k, _FileAttachmentsType);
7918
- var _super35 = _createSuper(k);
7919
- function k(e, t, n) {
7920
- _classCallCheck(this, k);
8041
+ _inherits(I, _FileAttachmentsType);
8042
+ var _super35 = _createSuper(I);
8043
+ function I(e, t, n) {
8044
+ _classCallCheck(this, I);
7921
8045
  return _super35.call(this, e, t, n);
7922
8046
  }
7923
- _createClass(k, [{
8047
+ _createClass(I, [{
7924
8048
  key: "createTimer",
7925
8049
  value: function createTimer(e, t) {
7926
8050
  var _this37 = this;
7927
8051
  var n = 0;
7928
- var s = t !== void 0 && t < k.TIMER_LIMIT_S ? t : k.TIMER_LIMIT_S;
8052
+ var s = t !== void 0 && t < I.TIMER_LIMIT_S ? t : I.TIMER_LIMIT_S;
7929
8053
  return setInterval(function () {
7930
8054
  var l;
7931
8055
  n += 1, n === s && ((l = _this37.stopPlaceholderCallback) == null || l.call(_this37), _this37.clearTimer()), n === 600 && e.classList.add("audio-placeholder-text-4-digits");
@@ -7937,7 +8061,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
7937
8061
  }, {
7938
8062
  key: "createPlaceholderAudioAttachment",
7939
8063
  value: function createPlaceholderAudioAttachment(e) {
7940
- var t = k.createAudioContainer(),
8064
+ var t = I.createAudioContainer(),
7941
8065
  n = document.createElement("div");
7942
8066
  n.classList.add("audio-placeholder-text-3-digits");
7943
8067
  var s = document.createElement("div");
@@ -7974,7 +8098,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
7974
8098
  key: "completePlaceholderAttachment",
7975
8099
  value: function completePlaceholderAttachment(e, t) {
7976
8100
  var n = this._activePlaceholderAttachment;
7977
- n && (n.file = e, k.addAudioElements(n.attachmentContainerElement.children[0], t), n.removeButton = this.createRemoveAttachmentButton(n), n.attachmentContainerElement.appendChild(n.removeButton), this._activePlaceholderAttachment = void 0, this.clearTimer());
8101
+ n && (n.file = e, I.addAudioElements(n.attachmentContainerElement.children[0], t), n.removeButton = this.createRemoveAttachmentButton(n), n.attachmentContainerElement.appendChild(n.removeButton), this._activePlaceholderAttachment = void 0, this.clearTimer());
7978
8102
  }
7979
8103
  }, {
7980
8104
  key: "removePlaceholderAttachment",
@@ -8014,8 +8138,8 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
8014
8138
  }, {
8015
8139
  key: "createAudioAttachment",
8016
8140
  value: function createAudioAttachment(e) {
8017
- var t = k.createAudioContainer();
8018
- return k.addAudioElements(t, e), t;
8141
+ var t = I.createAudioContainer();
8142
+ return I.addAudioElements(t, e), t;
8019
8143
  }
8020
8144
  }, {
8021
8145
  key: "stopAttachmentPlayback",
@@ -8024,7 +8148,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
8024
8148
  (s = (n = (t = e.children[0]) == null ? void 0 : t.children) == null ? void 0 : n[0]) != null && s.classList.contains("stop-icon") && e.children[0].click();
8025
8149
  }
8026
8150
  }]);
8027
- return k;
8151
+ return I;
8028
8152
  }(FileAttachmentsType);
8029
8153
  _AudioFileAttachmentType.TIMER_LIMIT_S = 5999;
8030
8154
  var AudioFileAttachmentType = _AudioFileAttachmentType;
@@ -8078,33 +8202,33 @@ var FileAttachments = /*#__PURE__*/function () {
8078
8202
  }, {
8079
8203
  key: "completePlaceholders",
8080
8204
  value: function () {
8081
- var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67() {
8082
- return _regeneratorRuntime().wrap(function _callee67$(_context67) {
8083
- while (1) switch (_context67.prev = _context67.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) {
8084
8208
  case 0:
8085
- _context67.next = 2;
8209
+ _context69.next = 2;
8086
8210
  return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
8087
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(e) {
8211
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(e) {
8088
8212
  var t;
8089
- return _regeneratorRuntime().wrap(function _callee66$(_context66) {
8090
- while (1) switch (_context66.prev = _context66.next) {
8213
+ return _regeneratorRuntime().wrap(function _callee68$(_context68) {
8214
+ while (1) switch (_context68.prev = _context68.next) {
8091
8215
  case 0:
8092
- return _context66.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));
8093
8217
  case 1:
8094
8218
  case "end":
8095
- return _context66.stop();
8219
+ return _context68.stop();
8096
8220
  }
8097
- }, _callee66);
8221
+ }, _callee68);
8098
8222
  }));
8099
- return function (_x115) {
8223
+ return function (_x119) {
8100
8224
  return _ref6.apply(this, arguments);
8101
8225
  };
8102
8226
  }()));
8103
8227
  case 2:
8104
8228
  case "end":
8105
- return _context67.stop();
8229
+ return _context69.stop();
8106
8230
  }
8107
- }, _callee67, this);
8231
+ }, _callee69, this);
8108
8232
  }));
8109
8233
  function completePlaceholders() {
8110
8234
  return _completePlaceholders.apply(this, arguments);
@@ -8134,7 +8258,7 @@ var FileAttachments = /*#__PURE__*/function () {
8134
8258
  e.forEach(function (n) {
8135
8259
  var s = new FileReader();
8136
8260
  s.readAsDataURL(n), s.onload = function (o) {
8137
- for (var a = 0; a < t.length && !t[a].attemptAddFile(n, o.target.result); a += 1);
8261
+ for (var _a4 = 0; _a4 < t.length && !t[_a4].attemptAddFile(n, o.target.result); _a4 += 1);
8138
8262
  };
8139
8263
  });
8140
8264
  }
@@ -8142,11 +8266,11 @@ var FileAttachments = /*#__PURE__*/function () {
8142
8266
  return FileAttachments;
8143
8267
  }();
8144
8268
  var _Modal = /*#__PURE__*/function () {
8145
- function T(e, t, n) {
8146
- _classCallCheck(this, T);
8147
- this._isOpen = !1, this._contentRef = T.createModalContent(t, n == null ? void 0 : n.backgroundColor), this._buttonPanel = T.createButtonPanel(n == null ? void 0 : n.backgroundColor), this._elementRef = T.createContainer(this._contentRef, n), this._elementRef.appendChild(this._buttonPanel), e.appendChild(this._elementRef), this._backgroundPanelRef = T.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();
8148
8272
  }
8149
- _createClass(T, [{
8273
+ _createClass(w, [{
8150
8274
  key: "isOpen",
8151
8275
  value: function isOpen() {
8152
8276
  return this._isOpen;
@@ -8168,7 +8292,7 @@ var _Modal = /*#__PURE__*/function () {
8168
8292
  var _this40 = this;
8169
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 () {
8170
8294
  _this40._elementRef.style.display = "none", _this40._backgroundPanelRef.style.display = "none";
8171
- }, T.MODAL_CLOSE_TIMEOUT_MS);
8295
+ }, w.MODAL_CLOSE_TIMEOUT_MS);
8172
8296
  }
8173
8297
  }, {
8174
8298
  key: "displayModalElements",
@@ -8184,7 +8308,7 @@ var _Modal = /*#__PURE__*/function () {
8184
8308
  key: "addCloseButton",
8185
8309
  value: function addCloseButton(e, t, n) {
8186
8310
  var _this41 = this;
8187
- var s = t ? T.createSVGButton(e) : T.createTextButton(e);
8311
+ var s = t ? w.createSVGButton(e) : w.createTextButton(e);
8188
8312
  return this.addButtons(s), s.onclick = function () {
8189
8313
  _this41.close(), setTimeout(function () {
8190
8314
  n == null || n();
@@ -8244,12 +8368,12 @@ var _Modal = /*#__PURE__*/function () {
8244
8368
  value: function createTextModalFunc(e, t, n) {
8245
8369
  var s;
8246
8370
  if (_typeof(t) == "object" && (s = t.files) != null && s.infoModal) {
8247
- var o = new T(e, ["modal-content"], t.files.infoModal.containerStyle);
8248
- return o.addCloseButton("OK", !1, n), o.openTextModal.bind(o, 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 || "");
8249
8373
  }
8250
8374
  }
8251
8375
  }]);
8252
- return T;
8376
+ return w;
8253
8377
  }();
8254
8378
  _Modal.MODAL_CLOSE_TIMEOUT_MS = 190;
8255
8379
  var Modal = _Modal;
@@ -8260,10 +8384,10 @@ var UploadFileButton = /*#__PURE__*/function (_InputButton2) {
8260
8384
  function UploadFileButton(e, t, n, s, o, a) {
8261
8385
  var _this43;
8262
8386
  _classCallCheck(this, UploadFileButton);
8263
- var c, u, d, h, p, f;
8387
+ var c, u, d, h, f, p;
8264
8388
  _this43 = _super36.call(this, UploadFileButton.createButtonElement(), (c = n.button) == null ? void 0 : c.position, n.button, a);
8265
8389
  var l = _this43.createInnerElements(s, o, _this43._customStyles);
8266
- _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;
8267
8391
  return _this43;
8268
8392
  }
8269
8393
  _createClass(UploadFileButton, [{
@@ -8510,7 +8634,7 @@ var Translate = /*#__PURE__*/function () {
8510
8634
  key: "translate",
8511
8635
  value: function translate(e, t) {
8512
8636
  var n = text_1$3.Text.breakupIntoWordsArr(e);
8513
- for (var s = 0; s < n.length; s += 1) t[n[s]] && (n[s] = t[n[s]]);
8637
+ for (var _s15 = 0; _s15 < n.length; _s15 += 1) t[n[_s15]] && (n[_s15] = t[n[_s15]]);
8514
8638
  return n.join("");
8515
8639
  }
8516
8640
  }]);
@@ -8530,9 +8654,9 @@ var WebSpeechTranscript = /*#__PURE__*/function () {
8530
8654
  key: "extract",
8531
8655
  value: function extract(e, t, n) {
8532
8656
  var s = "";
8533
- for (var o = e.resultIndex; o < e.results.length; ++o) {
8534
- var a = e.results[o][0].transcript;
8535
- n && (a = translate_1$1.Translate.translate(a, n)), e.results[o].isFinal ? t += a : s += a;
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;
8536
8660
  }
8537
8661
  return {
8538
8662
  interimTranscript: s,
@@ -8545,8 +8669,8 @@ var WebSpeechTranscript = /*#__PURE__*/function () {
8545
8669
  value: function extractSafari(e, t, n) {
8546
8670
  var s = "";
8547
8671
  var o = "";
8548
- for (var a = e.resultIndex; a < e.results.length; ++a) {
8549
- var l = e.results[a][0].transcript;
8672
+ for (var _a6 = e.resultIndex; _a6 < e.results.length; ++_a6) {
8673
+ var l = e.results[_a6][0].transcript;
8550
8674
  n && (l = translate_1$1.Translate.translate(l, n)), s += l;
8551
8675
  }
8552
8676
  return {
@@ -8718,8 +8842,8 @@ var Elements = /*#__PURE__*/function () {
8718
8842
  if (e.spansPopulated = !0, e.insertInCursorLocation && document.activeElement === t) {
8719
8843
  var n = window.getSelection();
8720
8844
  if (n != null && n.focusNode) {
8721
- var s = n.getRangeAt(0);
8722
- s.insertNode(e.scrollingSpan), s.insertNode(e.interimSpan), s.insertNode(e.finalSpan), s.collapse(!1), n.removeAllRanges(), n.addRange(s);
8845
+ var _s16 = n.getRangeAt(0);
8846
+ _s16.insertNode(e.scrollingSpan), _s16.insertNode(e.interimSpan), _s16.insertNode(e.finalSpan), _s16.collapse(!1), n.removeAllRanges(), n.addRange(_s16);
8723
8847
  return;
8724
8848
  }
8725
8849
  }
@@ -8753,20 +8877,20 @@ var Cursor = /*#__PURE__*/function () {
8753
8877
  value: function setOffsetForGeneric(e, t) {
8754
8878
  var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
8755
8879
  var s = 0;
8756
- for (var o = 0; o < e.childNodes.length; o += 1) {
8757
- var a = e.childNodes[o];
8758
- if (a.childNodes.length > 0) {
8759
- var l = Cursor.setOffsetForGeneric(a, t, n);
8880
+ for (var _o7 = 0; _o7 < e.childNodes.length; _o7 += 1) {
8881
+ var _a7 = e.childNodes[_o7];
8882
+ if (_a7.childNodes.length > 0) {
8883
+ var l = Cursor.setOffsetForGeneric(_a7, t, n);
8760
8884
  if (l === -1) return -1;
8761
8885
  n += l;
8762
- } else if (a.textContent !== null) {
8763
- if (n + a.textContent.length > t) {
8886
+ } else if (_a7.textContent !== null) {
8887
+ if (n + _a7.textContent.length > t) {
8764
8888
  var _l = document.createRange();
8765
- _l.setStart(a, t - n), _l.collapse(!0);
8889
+ _l.setStart(_a7, t - n), _l.collapse(!0);
8766
8890
  var c = window.getSelection();
8767
8891
  return c == null || c.removeAllRanges(), c == null || c.addRange(_l), e.focus(), -1;
8768
8892
  }
8769
- n += a.textContent.length, s += a.textContent.length;
8893
+ n += _a7.textContent.length, s += _a7.textContent.length;
8770
8894
  }
8771
8895
  }
8772
8896
  return s;
@@ -8784,8 +8908,8 @@ var Cursor = /*#__PURE__*/function () {
8784
8908
  value: function setOffsetForSafariGeneric(e, t) {
8785
8909
  var n = window.getSelection();
8786
8910
  if (n) {
8787
- var s = Cursor.getGenericElementCursorOffset(e, n, !0);
8788
- console.log(s), setTimeout(function () {}, 100), Cursor.setOffsetForGeneric(e, s + t);
8911
+ var _s17 = Cursor.getGenericElementCursorOffset(e, n, !0);
8912
+ console.log(_s17), setTimeout(function () {}, 100), Cursor.setOffsetForGeneric(e, _s17 + t);
8789
8913
  }
8790
8914
  }
8791
8915
  // set to automatically scroll to cursor (scroll does not work in Safari)
@@ -8816,9 +8940,9 @@ var Cursor = /*#__PURE__*/function () {
8816
8940
  value: function getGenericElementCursorOffset(e, t, n) {
8817
8941
  var s = 0;
8818
8942
  if (t.rangeCount > 0) {
8819
- var o = t.getRangeAt(0),
8820
- a = o.cloneRange();
8821
- a.selectNodeContents(e), n ? a.setEnd(o.startContainer, o.startOffset) : a.setEnd(o.endContainer, o.endOffset), s = a.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;
8822
8946
  }
8823
8947
  return s;
8824
8948
  }
@@ -8881,10 +9005,10 @@ var CommandUtils = /*#__PURE__*/function () {
8881
9005
  key: "checkIfMatchesWord",
8882
9006
  value: function checkIfMatchesWord(e, t, n) {
8883
9007
  var s = e;
8884
- for (var o = n.length - 1; o >= 0; o -= 1) {
8885
- var a = o,
9008
+ for (var _o9 = n.length - 1; _o9 >= 0; _o9 -= 1) {
9009
+ var _a9 = _o9,
8886
9010
  l = s.length - 1;
8887
- for (; n[a] === s[l] && l >= 0;) a -= 1, l -= 1;
9011
+ for (; n[_a9] === s[l] && l >= 0;) _a9 -= 1, l -= 1;
8888
9012
  if (l < 0) return !0;
8889
9013
  }
8890
9014
  return !1;
@@ -8898,31 +9022,31 @@ var CommandUtils = /*#__PURE__*/function () {
8898
9022
  if (!u || !s || !n) return;
8899
9023
  var d = ((a = u.settings) === null || a === void 0 ? void 0 : a.caseSensitive) === !0 ? t : t.toLowerCase(),
8900
9024
  h = text_1$2.Text.breakupIntoWordsArr(d),
8901
- p = ((l = u.settings) === null || l === void 0 ? void 0 : l.substrings) === !1 ? CommandUtils.checkIfMatchesWord : CommandUtils.checkIfMatchesSubstring;
8902
- 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 () {
8903
9027
  return CommandUtils.toggleCommandModeOn(e);
8904
9028
  }), {
8905
9029
  doNotProcessTranscription: !1
8906
9030
  };
8907
9031
  if (!(u.commandMode && !e.isWaitingForCommand)) {
8908
- 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 () {
8909
9033
  return e.stop();
8910
9034
  }), {
8911
9035
  doNotProcessTranscription: !1
8912
9036
  };
8913
- if (u.pause && p(u.pause, d, h)) return CommandUtils.toggleCommandModeOff(e), e.setInterimColorToFinal(), setTimeout(function () {
8914
- var f;
8915
- 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);
8916
9040
  }), {
8917
9041
  doNotProcessTranscription: !1
8918
9042
  };
8919
- 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), {
8920
9044
  doNotProcessTranscription: !0
8921
9045
  };
8922
- 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), {
8923
9047
  doNotProcessTranscription: !0
8924
9048
  };
8925
- 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), {
8926
9050
  doNotProcessTranscription: !0
8927
9051
  };
8928
9052
  }
@@ -8953,9 +9077,9 @@ var Highlight = /*#__PURE__*/function () {
8953
9077
  value: function setStateForGeneric(e, t) {
8954
9078
  var n = window.getSelection();
8955
9079
  if (n != null && n.focusNode) {
8956
- var s = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !0),
8957
- o = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !1);
8958
- e.isHighlighted = s !== o;
9080
+ var _s18 = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !0),
9081
+ _o10 = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !1);
9082
+ e.isHighlighted = _s18 !== _o10;
8959
9083
  }
8960
9084
  }
8961
9085
  }, {
@@ -8968,8 +9092,8 @@ var Highlight = /*#__PURE__*/function () {
8968
9092
  value: function removeForGeneric(e, t) {
8969
9093
  var n = window.getSelection();
8970
9094
  if (n) {
8971
- var s = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !0);
8972
- n.deleteFromDocument(), cursor_1$2.Cursor.setOffsetForGeneric(t, s), e.isHighlighted = !1;
9095
+ var _s19 = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !0);
9096
+ n.deleteFromDocument(), cursor_1$2.Cursor.setOffsetForGeneric(t, _s19), e.isHighlighted = !1;
8973
9097
  }
8974
9098
  }
8975
9099
  }, {
@@ -8979,8 +9103,8 @@ var Highlight = /*#__PURE__*/function () {
8979
9103
  s = t.selectionEnd,
8980
9104
  o = t.value;
8981
9105
  if (n && s) {
8982
- var a = o.substring(0, n) + o.substring(s);
8983
- t.value = a, cursor_1$2.Cursor.setOffsetForPrimitive(t, n, e.autoScroll);
9106
+ var _a10 = o.substring(0, n) + o.substring(s);
9107
+ t.value = _a10, cursor_1$2.Cursor.setOffsetForPrimitive(t, n, e.autoScroll);
8984
9108
  }
8985
9109
  e.isHighlighted = !1;
8986
9110
  }
@@ -9004,11 +9128,11 @@ var Padding = /*#__PURE__*/function () {
9004
9128
  key: "setStateForPrimitiveElement",
9005
9129
  value: function setStateForPrimitiveElement(e, t) {
9006
9130
  if (document.activeElement === t && t.selectionStart !== null) {
9007
- var s = t.selectionStart,
9008
- o = t.value[s - 1],
9009
- a = t.selectionEnd === null ? s : t.selectionEnd,
9010
- l = t.value[a];
9011
- text_1$1.Text.isCharDefined(o) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), text_1$1.Text.isCharDefined(l) && (e.endPadding = " ", e.numberOfSpacesAfterNewText = 1), e.isCursorAtEnd = t.value.length === a;
9131
+ var _s20 = t.selectionStart,
9132
+ _o11 = t.value[_s20 - 1],
9133
+ _a11 = t.selectionEnd === null ? _s20 : t.selectionEnd,
9134
+ l = t.value[_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;
9012
9136
  return;
9013
9137
  }
9014
9138
  var n = t.value[t.value.length - 1];
@@ -9079,11 +9203,11 @@ var Speech = /*#__PURE__*/function () {
9079
9203
  value: function prepareBeforeStart(e) {
9080
9204
  var t, n;
9081
9205
  if (e != null && e.element) if (eventListeners_1.EventListeners.add(this, e), Array.isArray(e.element)) {
9082
- var o = e.element.find(function (a) {
9206
+ var _o12 = e.element.find(function (a) {
9083
9207
  return a === document.activeElement;
9084
9208
  }) || e.element[0];
9085
- if (!o) return;
9086
- this.prepare(o);
9209
+ if (!_o12) return;
9210
+ this.prepare(_o12);
9087
9211
  } else this.prepare(e.element);
9088
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));
9089
9213
  }
@@ -9126,8 +9250,8 @@ var Speech = /*#__PURE__*/function () {
9126
9250
  this.isHighlighted && highlight_1.Highlight.removeForPrimitive(this, e), this.primitiveTextRecorded || padding_1.Padding.adjustStateAfterRecodingPrimitiveElement(this, e), n && padding_1.Padding.adjustSateForNoTextPrimitiveElement(this);
9127
9251
  var s = this.startPadding + this.finalTranscript + t;
9128
9252
  if (e.value = s + this.endPadding, !this.isTargetInShadow) {
9129
- var o = s.length + this.numberOfSpacesAfterNewText;
9130
- cursor_1.Cursor.setOffsetForPrimitive(e, o, this.autoScroll);
9253
+ var _o13 = s.length + this.numberOfSpacesAfterNewText;
9254
+ cursor_1.Cursor.setOffsetForPrimitive(e, _o13, this.autoScroll);
9131
9255
  }
9132
9256
  this.autoScroll && browser_1$1.Browser.IS_SAFARI() && this.isCursorAtEnd && autoScroll_1.AutoScroll.scrollSafariPrimitiveToEnd(e);
9133
9257
  }
@@ -9228,8 +9352,8 @@ var WebSpeech = /*#__PURE__*/function (_speech_1$1$Speech) {
9228
9352
  var _this46$_extractText = _this46._extractText(e, _this46.finalTranscript, _this46._translations),
9229
9353
  t = _this46$_extractText.interimTranscript,
9230
9354
  n = _this46$_extractText.finalTranscript,
9231
- s = _this46$_extractText.newText;
9232
- _this46.updateElements(t, n, s);
9355
+ _s21 = _this46$_extractText.newText;
9356
+ _this46.updateElements(t, n, _s21);
9233
9357
  }
9234
9358
  });
9235
9359
  }
@@ -9324,26 +9448,26 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
9324
9448
  }, {
9325
9449
  key: "getNewSpeechConfig",
9326
9450
  value: function () {
9327
- var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(e, t) {
9328
- return _regeneratorRuntime().wrap(function _callee68$(_context68) {
9329
- while (1) switch (_context68.prev = _context68.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) {
9330
9454
  case 0:
9331
9455
  if (!t.region) {
9332
- _context68.next = 2;
9456
+ _context70.next = 2;
9333
9457
  break;
9334
9458
  }
9335
- return _context68.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) {
9336
9460
  return t.region ? e.fromAuthorizationToken((n == null ? void 0 : n.trim()) || "", t.region.trim()) : null;
9337
9461
  })["catch"](function (n) {
9338
9462
  return console.error(n), null;
9339
9463
  }) : null);
9340
9464
  case 2:
9341
9465
  case "end":
9342
- return _context68.stop();
9466
+ return _context70.stop();
9343
9467
  }
9344
- }, _callee68);
9468
+ }, _callee70);
9345
9469
  }));
9346
- function getNewSpeechConfig(_x116, _x117) {
9470
+ function getNewSpeechConfig(_x120, _x121) {
9347
9471
  return _getNewSpeechConfig.apply(this, arguments);
9348
9472
  }
9349
9473
  return getNewSpeechConfig;
@@ -9356,23 +9480,23 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
9356
9480
  }, {
9357
9481
  key: "get",
9358
9482
  value: function () {
9359
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(e, t) {
9483
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(e, t) {
9360
9484
  var n;
9361
- return _regeneratorRuntime().wrap(function _callee69$(_context69) {
9362
- while (1) switch (_context69.prev = _context69.next) {
9485
+ return _regeneratorRuntime().wrap(function _callee71$(_context71) {
9486
+ while (1) switch (_context71.prev = _context71.next) {
9363
9487
  case 0:
9364
- _context69.next = 2;
9488
+ _context71.next = 2;
9365
9489
  return AzureSpeechConfig.getNewSpeechConfig(e, t);
9366
9490
  case 2:
9367
- n = _context69.sent;
9368
- return _context69.abrupt("return", (n && AzureSpeechConfig.process(n, t), n));
9491
+ n = _context71.sent;
9492
+ return _context71.abrupt("return", (n && AzureSpeechConfig.process(n, t), n));
9369
9493
  case 4:
9370
9494
  case "end":
9371
- return _context69.stop();
9495
+ return _context71.stop();
9372
9496
  }
9373
- }, _callee69);
9497
+ }, _callee71);
9374
9498
  }));
9375
- function get(_x118, _x119) {
9499
+ function get(_x122, _x123) {
9376
9500
  return _get.apply(this, arguments);
9377
9501
  }
9378
9502
  return get;
@@ -9462,28 +9586,28 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
9462
9586
  }, {
9463
9587
  key: "startAsync",
9464
9588
  value: function () {
9465
- var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(e) {
9589
+ var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(e) {
9466
9590
  var t;
9467
- return _regeneratorRuntime().wrap(function _callee70$(_context70) {
9468
- while (1) switch (_context70.prev = _context70.next) {
9591
+ return _regeneratorRuntime().wrap(function _callee72$(_context72) {
9592
+ while (1) switch (_context72.prev = _context72.next) {
9469
9593
  case 0:
9470
- _context70.t0 = this.validate(e);
9471
- if (!_context70.t0) {
9472
- _context70.next = 6;
9594
+ _context72.t0 = this.validate(e);
9595
+ if (!_context72.t0) {
9596
+ _context72.next = 6;
9473
9597
  break;
9474
9598
  }
9475
- _context70.next = 4;
9599
+ _context72.next = 4;
9476
9600
  return this.instantiateService(e);
9477
9601
  case 4:
9478
9602
  this._translations = e == null ? void 0 : e.translations;
9479
9603
  (t = this._service) === null || t === void 0 || t.startContinuousRecognitionAsync(function () {}, this.error);
9480
9604
  case 6:
9481
9605
  case "end":
9482
- return _context70.stop();
9606
+ return _context72.stop();
9483
9607
  }
9484
- }, _callee70, this);
9608
+ }, _callee72, this);
9485
9609
  }));
9486
- function startAsync(_x120) {
9610
+ function startAsync(_x124) {
9487
9611
  return _startAsync.apply(this, arguments);
9488
9612
  }
9489
9613
  return startAsync;
@@ -9496,28 +9620,28 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
9496
9620
  }, {
9497
9621
  key: "instantiateService",
9498
9622
  value: function () {
9499
- var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(e) {
9500
- var t, n, s, o;
9501
- return _regeneratorRuntime().wrap(function _callee71$(_context71) {
9502
- while (1) switch (_context71.prev = _context71.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) {
9503
9627
  case 0:
9504
9628
  t = Azure.getAPI();
9505
9629
  n = t.AudioConfig.fromDefaultMicrophoneInput();
9506
- _context71.next = 4;
9630
+ _context73.next = 4;
9507
9631
  return azureSpeechConfig_1.AzureSpeechConfig.get(t.SpeechConfig, e);
9508
9632
  case 4:
9509
- s = _context71.sent;
9633
+ s = _context73.sent;
9510
9634
  if (s) {
9511
- o = new t.SpeechRecognizer(s, n);
9512
- this.setEvents(o), this._service = o, 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);
9513
9637
  } else this.error("Unable to contact Azure server");
9514
9638
  case 6:
9515
9639
  case "end":
9516
- return _context71.stop();
9640
+ return _context73.stop();
9517
9641
  }
9518
- }, _callee71, this);
9642
+ }, _callee73, this);
9519
9643
  }));
9520
- function instantiateService(_x121) {
9644
+ function instantiateService(_x125) {
9521
9645
  return _instantiateService.apply(this, arguments);
9522
9646
  }
9523
9647
  return instantiateService;
@@ -9554,10 +9678,10 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
9554
9678
  case window.SpeechSDK.ResultReason.RecognizedSpeech:
9555
9679
  if (n.text && !this._stopping) {
9556
9680
  var _azureTranscript_1$Az2 = azureTranscript_1.AzureTranscript.extract(this._newTextPadding + n.text, this.finalTranscript, !0, this._translations),
9557
- s = _azureTranscript_1$Az2.interimTranscript,
9558
- o = _azureTranscript_1$Az2.finalTranscript,
9559
- a = _azureTranscript_1$Az2.newText;
9560
- stopTimeout_1.StopTimeout.reset(this, this.stopTimeoutMS), this.updateElements(s, o, a), o !== "" && (this._newTextPadding = " ");
9681
+ _s22 = _azureTranscript_1$Az2.interimTranscript,
9682
+ _o15 = _azureTranscript_1$Az2.finalTranscript,
9683
+ _a12 = _azureTranscript_1$Az2.newText;
9684
+ stopTimeout_1.StopTimeout.reset(this, this.stopTimeoutMS), this.updateElements(_s22, _o15, _a12), _o15 !== "" && (this._newTextPadding = " ");
9561
9685
  }
9562
9686
  break;
9563
9687
  }
@@ -9839,7 +9963,9 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
9839
9963
  var _this54;
9840
9964
  _classCallCheck(this, SubmitButton);
9841
9965
  var a;
9842
- _this54 = _super42.call(this, SubmitButton.createButtonContainerElement(), (a = e.submitButtonStyles) == null ? void 0 : a.position, e.submitButtonStyles), _this54._isRequestInProgress = !1, _this54._isLoadingActive = !1, _this54._isSVGLoadingIconOverriden = !1, _this54._messages = n, _this54._inputElementRef = t, _this54._fileAttachments = o, _this54._innerElements = _this54.createInnerElements(), _this54._abortStream = new AbortController(), _this54._serviceIO = s, _this54.attemptOverwriteLoadingStyle(e), _this54.changeToSubmitIcon(), _this54.assignHandlers();
9966
+ _this54 = _super42.call(this, SubmitButton.createButtonContainerElement(), (a = e.submitButtonStyles) == null ? void 0 : a.position, e.submitButtonStyles), _this54._isRequestInProgress = !1, _this54._isLoadingActive = !1, _this54._isSVGLoadingIconOverriden = !1, _this54._messages = n, _this54._inputElementRef = t, _this54._fileAttachments = o, _this54._innerElements = _this54.createInnerElements(), _this54._abortStream = new AbortController(), _this54._stopClicked = {
9967
+ listener: function listener() {}
9968
+ }, _this54._serviceIO = s, _this54.attemptOverwriteLoadingStyle(e), _this54.changeToSubmitIcon(), _this54.assignHandlers();
9843
9969
  return _this54;
9844
9970
  }
9845
9971
  // prettier-ignore
@@ -9875,7 +10001,8 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
9875
10001
  }, this._serviceIO.streamHandlers = {
9876
10002
  onOpen: this.changeToStopIcon.bind(this),
9877
10003
  onClose: this.changeToSubmitIcon.bind(this),
9878
- abortStream: this._abortStream
10004
+ abortStream: this._abortStream,
10005
+ stopClicked: this._stopClicked
9879
10006
  };
9880
10007
  var e = this._serviceIO.deepChat.stream;
9881
10008
  _typeof(e) == "object" && typeof e.simulation == "number" && (this._serviceIO.streamHandlers.simulationInterim = e.simulation);
@@ -9896,94 +10023,88 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
9896
10023
  }, {
9897
10024
  key: "submit",
9898
10025
  value: function () {
9899
- var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(e, t) {
9900
- var c, u, n, s, o, a, l;
9901
- return _regeneratorRuntime().wrap(function _callee72$(_context72) {
9902
- while (1) switch (_context72.prev = _context72.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) {
9903
10030
  case 0:
9904
- _context72.t0 = e;
9905
- if (_context72.t0) {
9906
- _context72.next = 6;
10031
+ _context74.t0 = e;
10032
+ if (_context74.t0) {
10033
+ _context74.next = 6;
9907
10034
  break;
9908
10035
  }
9909
- _context72.next = 4;
10036
+ _context74.next = 4;
9910
10037
  return this._fileAttachments.completePlaceholders();
9911
10038
  case 4:
9912
10039
  n = this._fileAttachments.getAllFileData();
9913
- s = n == null ? void 0 : n.map(function (d) {
9914
- return d.file;
10040
+ s = n == null ? void 0 : n.map(function (u) {
10041
+ return u.file;
9915
10042
  });
9916
10043
  case 6:
9917
10044
  o = t === "" ? void 0 : t;
9918
- if (!this._isRequestInProgress) {
9919
- _context72.next = 9;
10045
+ if (!(this._isRequestInProgress || !Websocket.canSendMessage(this._serviceIO.websocket))) {
10046
+ _context74.next = 9;
9920
10047
  break;
9921
10048
  }
9922
- return _context72.abrupt("return");
10049
+ return _context74.abrupt("return");
9923
10050
  case 9:
9924
- a = this._serviceIO.websocket;
9925
- if (!(a && (a === "pending" || a.readyState === void 0 || a.readyState !== a.OPEN))) {
9926
- _context72.next = 12;
9927
- break;
9928
- }
9929
- return _context72.abrupt("return");
9930
- case 12:
9931
- if (!((c = this._serviceIO.deepChat) != null && c.validateMessageBeforeSending)) {
9932
- _context72.next = 17;
10051
+ if (!((l = this._serviceIO.deepChat) != null && l.validateMessageBeforeSending)) {
10052
+ _context74.next = 14;
9933
10053
  break;
9934
10054
  }
9935
10055
  if (this._serviceIO.deepChat.validateMessageBeforeSending(o, s)) {
9936
- _context72.next = 15;
10056
+ _context74.next = 12;
9937
10057
  break;
9938
10058
  }
9939
- return _context72.abrupt("return");
9940
- case 15:
9941
- _context72.next = 19;
10059
+ return _context74.abrupt("return");
10060
+ case 12:
10061
+ _context74.next = 16;
9942
10062
  break;
9943
- case 17:
10063
+ case 14:
9944
10064
  if (this._serviceIO.canSendMessage(o, s)) {
9945
- _context72.next = 19;
10065
+ _context74.next = 16;
9946
10066
  break;
9947
10067
  }
9948
- return _context72.abrupt("return");
9949
- case 19:
10068
+ return _context74.abrupt("return");
10069
+ case 16:
9950
10070
  this.changeToLoadingIcon();
9951
10071
  t !== "" && this._messages.addNewMessage({
9952
10072
  text: t
9953
10073
  }, !1, !0);
9954
- _context72.t1 = n;
9955
- if (!_context72.t1) {
9956
- _context72.next = 25;
10074
+ _context74.t1 = n;
10075
+ if (!_context74.t1) {
10076
+ _context74.next = 22;
9957
10077
  break;
9958
10078
  }
9959
- _context72.next = 25;
10079
+ _context74.next = 22;
9960
10080
  return this._messages.addMultipleFiles(n);
9961
- case 25:
10081
+ case 22:
9962
10082
  this._messages.addLoadingMessage();
9963
10083
  e || TextInputEl.clear(this._inputElementRef);
9964
- l = {
10084
+ a = {
9965
10085
  text: o,
9966
10086
  files: s
9967
10087
  };
9968
- _context72.next = 30;
9969
- return this._serviceIO.callAPI(l, this._messages);
9970
- case 30:
9971
- e || (u = this._fileAttachments) == null || u.removeAllFiles();
9972
- 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:
9973
10093
  case "end":
9974
- return _context72.stop();
10094
+ return _context74.stop();
9975
10095
  }
9976
- }, _callee72, this);
10096
+ }, _callee74, this);
9977
10097
  }));
9978
- function submit(_x122, _x123) {
10098
+ function submit(_x126, _x127) {
9979
10099
  return _submit.apply(this, arguments);
9980
10100
  }
9981
10101
  return submit;
9982
- }() // This will not stop the stream on the server side
10102
+ }()
9983
10103
  }, {
9984
10104
  key: "stopStream",
9985
10105
  value: function stopStream() {
9986
- this._abortStream.abort(), this.changeToSubmitIcon();
10106
+ var e;
10107
+ this._abortStream.abort(), (e = this._stopClicked) == null || e.listener(), this.changeToSubmitIcon();
9987
10108
  }
9988
10109
  }, {
9989
10110
  key: "changeToStopIcon",
@@ -10109,13 +10230,13 @@ var CameraModal = /*#__PURE__*/function (_Modal2) {
10109
10230
  t = new Array(e.length);
10110
10231
  for (var l = 0; l < e.length; l++) t[l] = e.charCodeAt(l);
10111
10232
  var n = new Uint8Array(t),
10112
- s = new Blob([n], {
10233
+ _s23 = new Blob([n], {
10113
10234
  type: this._format
10114
10235
  }),
10115
- o = this._format === "image/jpeg" ? "jpeg" : "png",
10116
- a = NewFileName.getFileName(this._newFilePrefix || "photo", o);
10117
- return new File([s], a, {
10118
- type: s.type
10236
+ _o16 = this._format === "image/jpeg" ? "jpeg" : "png",
10237
+ _a13 = NewFileName.getFileName(this._newFilePrefix || "photo", _o16);
10238
+ return new File([_s23], _a13, {
10239
+ type: _s23.type
10119
10240
  });
10120
10241
  }
10121
10242
  }
@@ -10250,9 +10371,9 @@ var Input = /*#__PURE__*/function () {
10250
10371
  u = _FILE_TYPE_BUTTON_ICO.id,
10251
10372
  d = _FILE_TYPE_BUTTON_ICO.svgString,
10252
10373
  h = _FILE_TYPE_BUTTON_ICO.dropupText,
10253
- p = new UploadFileButton(n, c, l, u, d, h);
10374
+ f = new UploadFileButton(n, c, l, u, d, h);
10254
10375
  s[a] = {
10255
- button: p,
10376
+ button: f,
10256
10377
  fileType: c
10257
10378
  };
10258
10379
  }