deep-chat-dev 9.0.156 → 9.0.157

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
@@ -3383,29 +3383,29 @@ function io(_x10, _x11) {
3383
3383
  return _io.apply(this, arguments);
3384
3384
  }
3385
3385
  function _io() {
3386
- _io = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee117(s, e) {
3386
+ _io = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee118(s, e) {
3387
3387
  var t, i;
3388
- return _regeneratorRuntime().wrap(function _callee117$(_context117) {
3389
- while (1) switch (_context117.prev = _context117.next) {
3388
+ return _regeneratorRuntime().wrap(function _callee118$(_context118) {
3389
+ while (1) switch (_context118.prev = _context118.next) {
3390
3390
  case 0:
3391
3391
  t = s.getReader();
3392
3392
  case 1:
3393
- _context117.next = 3;
3393
+ _context118.next = 3;
3394
3394
  return t.read();
3395
3395
  case 3:
3396
- if ((i = _context117.sent).done) {
3397
- _context117.next = 7;
3396
+ if ((i = _context118.sent).done) {
3397
+ _context118.next = 7;
3398
3398
  break;
3399
3399
  }
3400
3400
  e(i.value);
3401
3401
  case 5:
3402
- _context117.next = 1;
3402
+ _context118.next = 1;
3403
3403
  break;
3404
3404
  case 7:
3405
3405
  case "end":
3406
- return _context117.stop();
3406
+ return _context118.stop();
3407
3407
  }
3408
- }, _callee117);
3408
+ }, _callee118);
3409
3409
  }));
3410
3410
  return _io.apply(this, arguments);
3411
3411
  }
@@ -4691,7 +4691,7 @@ var We = /*#__PURE__*/function () {
4691
4691
  while (1) switch (_context18.prev = _context18.next) {
4692
4692
  case 0:
4693
4693
  i = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : !0;
4694
- return _context18.abrupt("return", this.stream && !C.isSimulation(this.stream) ? C.request(this, e, t) : T.request(this, e, t, i));
4694
+ return _context18.abrupt("return", this.stream && !C.isSimulation(this.stream) ? C.request(this, e, t, i) : T.request(this, e, t, i));
4695
4695
  case 2:
4696
4696
  case "end":
4697
4697
  return _context18.stop();
@@ -8595,6 +8595,9 @@ var F = /*#__PURE__*/function (_U10) {
8595
8595
  o,
8596
8596
  a,
8597
8597
  i,
8598
+ n,
8599
+ l,
8600
+ c,
8598
8601
  r,
8599
8602
  _args86 = arguments;
8600
8603
  return _regeneratorRuntime().wrap(function _callee86$(_context86) {
@@ -8616,7 +8619,38 @@ var F = /*#__PURE__*/function (_U10) {
8616
8619
  case 9:
8617
8620
  i = _context86.sent;
8618
8621
  case 10:
8619
- r = (t ? i.data : [i.data[0]]).map( /*#__PURE__*/function () {
8622
+ n = [];
8623
+ if (!t) {
8624
+ _context86.next = 15;
8625
+ break;
8626
+ }
8627
+ n = i.data;
8628
+ _context86.next = 27;
8629
+ break;
8630
+ case 15:
8631
+ console.log(i.data);
8632
+ l = 0;
8633
+ case 17:
8634
+ if (!(l < i.data.length)) {
8635
+ _context86.next = 27;
8636
+ break;
8637
+ }
8638
+ c = i.data[l];
8639
+ if (!(c.role === "assistant")) {
8640
+ _context86.next = 23;
8641
+ break;
8642
+ }
8643
+ n.push(c);
8644
+ _context86.next = 24;
8645
+ break;
8646
+ case 23:
8647
+ return _context86.abrupt("break", 27);
8648
+ case 24:
8649
+ l += 1;
8650
+ _context86.next = 17;
8651
+ break;
8652
+ case 27:
8653
+ r = n.map( /*#__PURE__*/function () {
8620
8654
  var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee85(l) {
8621
8655
  var c;
8622
8656
  return _regeneratorRuntime().wrap(function _callee85$(_context85) {
@@ -8640,7 +8674,7 @@ var F = /*#__PURE__*/function (_U10) {
8640
8674
  };
8641
8675
  }());
8642
8676
  return _context86.abrupt("return", Promise.all(r));
8643
- case 12:
8677
+ case 29:
8644
8678
  case "end":
8645
8679
  return _context86.stop();
8646
8680
  }
@@ -8655,7 +8689,8 @@ var F = /*#__PURE__*/function (_U10) {
8655
8689
  key: "extractPollResultData",
8656
8690
  value: function () {
8657
8691
  var _extractPollResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee87(e) {
8658
- var r, t, i, o, _o$, a, l, n;
8692
+ var _this39 = this;
8693
+ var r, t, i, o, _o$pop, a, l, n;
8659
8694
  return _regeneratorRuntime().wrap(function _callee87$(_context87) {
8660
8695
  while (1) switch (_context87.prev = _context87.next) {
8661
8696
  case 0:
@@ -8669,34 +8704,37 @@ var F = /*#__PURE__*/function (_U10) {
8669
8704
  });
8670
8705
  case 3:
8671
8706
  if (!(t === "completed" && this.messages)) {
8672
- _context87.next = 11;
8707
+ _context87.next = 10;
8673
8708
  break;
8674
8709
  }
8675
8710
  _context87.next = 6;
8676
8711
  return this.getThreadMessages(e.thread_id);
8677
8712
  case 6:
8678
8713
  o = _context87.sent;
8679
- _o$ = o[0];
8680
- a = _o$.text;
8681
- l = _o$.files;
8682
- return _context87.abrupt("return", {
8714
+ console.log(o);
8715
+ _o$pop = o.pop(), a = _o$pop.text, l = _o$pop.files;
8716
+ return _context87.abrupt("return", (setTimeout(function () {
8717
+ o.forEach(function (c) {
8718
+ return _this39.deepChat.addMessage(c);
8719
+ });
8720
+ }), {
8683
8721
  text: a,
8684
8722
  _sessionId: this.sessionId,
8685
8723
  files: l
8686
- });
8687
- case 11:
8724
+ }));
8725
+ case 10:
8688
8726
  n = (r = i == null ? void 0 : i.submit_tool_outputs) == null ? void 0 : r.tool_calls;
8689
8727
  if (!(t === "requires_action" && n)) {
8690
- _context87.next = 16;
8728
+ _context87.next = 15;
8691
8729
  break;
8692
8730
  }
8693
- _context87.next = 15;
8731
+ _context87.next = 14;
8694
8732
  return this.handleTools(n);
8695
- case 15:
8733
+ case 14:
8696
8734
  return _context87.abrupt("return", _context87.sent);
8697
- case 16:
8735
+ case 15:
8698
8736
  throw Error("Thread run status: ".concat(t));
8699
- case 17:
8737
+ case 16:
8700
8738
  case "end":
8701
8739
  return _context87.stop();
8702
8740
  }
@@ -8776,7 +8814,7 @@ var F = /*#__PURE__*/function (_U10) {
8776
8814
  return _handleTools.apply(this, arguments);
8777
8815
  }
8778
8816
  return handleTools;
8779
- }() // Playground?
8817
+ }()
8780
8818
  }, {
8781
8819
  key: "handleStream",
8782
8820
  value: function () {
@@ -8823,34 +8861,47 @@ var F = /*#__PURE__*/function (_U10) {
8823
8861
  }()
8824
8862
  }, {
8825
8863
  key: "parseStreamResult",
8826
- value: function parseStreamResult(e) {
8827
- var t;
8828
- return (t = e.delta) != null && t.content ? {
8829
- text: e.delta.content[0].text.value
8830
- } : (!this.sessionId && e.thread_id && (this.sessionId = e.thread_id), {
8831
- makingAnotherRequest: !0
8832
- });
8833
- }
8834
- // https://platform.openai.com/docs/api-reference/assistants-streaming
8864
+ value: function () {
8865
+ var _parseStreamResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee90(e) {
8866
+ var t;
8867
+ return _regeneratorRuntime().wrap(function _callee90$(_context90) {
8868
+ while (1) switch (_context90.prev = _context90.next) {
8869
+ case 0:
8870
+ return _context90.abrupt("return", (console.log(e), (t = e.delta) != null && t.content ? {
8871
+ text: e.delta.content[0].text.value
8872
+ } : (!this.sessionId && e.thread_id && (this.sessionId = e.thread_id), e.file_ids, {
8873
+ makingAnotherRequest: !0
8874
+ })));
8875
+ case 1:
8876
+ case "end":
8877
+ return _context90.stop();
8878
+ }
8879
+ }, _callee90, this);
8880
+ }));
8881
+ function parseStreamResult(_x160) {
8882
+ return _parseStreamResult.apply(this, arguments);
8883
+ }
8884
+ return parseStreamResult;
8885
+ }() // https://platform.openai.com/docs/api-reference/assistants-streaming
8835
8886
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
8836
8887
  }, {
8837
8888
  key: "createStreamRun",
8838
8889
  value: function () {
8839
- var _createStreamRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee90(e) {
8840
- return _regeneratorRuntime().wrap(function _callee90$(_context90) {
8841
- while (1) switch (_context90.prev = _context90.next) {
8890
+ var _createStreamRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee91(e) {
8891
+ return _regeneratorRuntime().wrap(function _callee91$(_context91) {
8892
+ while (1) switch (_context91.prev = _context91.next) {
8842
8893
  case 0:
8843
8894
  e.stream = !0;
8844
8895
  this.waitingForStreamResponse = !0;
8845
- _context90.next = 4;
8896
+ _context91.next = 4;
8846
8897
  return C.request(this, e, this.messages, !0, !0);
8847
8898
  case 4:
8848
8899
  case "end":
8849
- return _context90.stop();
8900
+ return _context91.stop();
8850
8901
  }
8851
- }, _callee90, this);
8902
+ }, _callee91, this);
8852
8903
  }));
8853
- function createStreamRun(_x160) {
8904
+ function createStreamRun(_x161) {
8854
8905
  return _createStreamRun.apply(this, arguments);
8855
8906
  }
8856
8907
  return createStreamRun;
@@ -8861,7 +8912,7 @@ F.THREAD_PREFIX = "https://api.openai.com/v1/threads", F.NEW_ASSISTANT_URL = "ht
8861
8912
  var nn = F;
8862
8913
  var ae = /*#__PURE__*/function (_U11) {
8863
8914
  function ae(e) {
8864
- var _this39;
8915
+ var _this40;
8865
8916
  _classCallCheck(this, ae);
8866
8917
  var o;
8867
8918
  var t = e.directConnection,
@@ -8874,19 +8925,19 @@ var ae = /*#__PURE__*/function (_U11) {
8874
8925
  }
8875
8926
  }
8876
8927
  };
8877
- _this39 = _callSuper(this, ae, [e, P.buildKeyVerificationDetails(), P.buildHeaders, i, n]), _this39.insertKeyPlaceholderText = "OpenAI API Key", _this39.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this39.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI DALL\xB7E</b></div>\n <p><b>Insert text</b> to generate an image.</p>\n <p><b>Upload 1</b> PNG image to generate its variation and optionally insert text to specify the change.</p>\n <p><b>Upload 2</b> PNG images where the second is a copy of the first with a transparent area where the edit should\n take place and text to specify the edit.</p>\n <p>Click <a href=\"https://platform.openai.com/docs/guides/images/introduction\">here</a> for more info.</p>", _this39.url = "", _this39.permittedErrorPrefixes = ["Incorrect", "Invalid input image"];
8928
+ _this40 = _callSuper(this, ae, [e, P.buildKeyVerificationDetails(), P.buildHeaders, i, n]), _this40.insertKeyPlaceholderText = "OpenAI API Key", _this40.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this40.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI DALL\xB7E</b></div>\n <p><b>Insert text</b> to generate an image.</p>\n <p><b>Upload 1</b> PNG image to generate its variation and optionally insert text to specify the change.</p>\n <p><b>Upload 2</b> PNG images where the second is a copy of the first with a transparent area where the edit should\n take place and text to specify the edit.</p>\n <p>Click <a href=\"https://platform.openai.com/docs/guides/images/introduction\">here</a> for more info.</p>", _this40.url = "", _this40.permittedErrorPrefixes = ["Incorrect", "Invalid input image"];
8878
8929
  var r = (o = t == null ? void 0 : t.openAI) == null ? void 0 : o.images;
8879
- if (_this39.camera) {
8930
+ if (_this40.camera) {
8880
8931
  var a = _typeof(r) == "object" && r.size ? Number.parseInt(r.size) : 1024;
8881
- _this39.camera.files = {
8932
+ _this40.camera.files = {
8882
8933
  dimensions: {
8883
8934
  width: a,
8884
8935
  height: a
8885
8936
  }
8886
8937
  };
8887
8938
  }
8888
- _typeof(r) == "object" && Object.assign(_this39.rawBody, r), _this39.canSendMessage = ae.canFileSendMessage;
8889
- return _this39;
8939
+ _typeof(r) == "object" && Object.assign(_this40.rawBody, r), _this40.canSendMessage = ae.canFileSendMessage;
8940
+ return _this40;
8890
8941
  }
8891
8942
  _inherits(ae, _U11);
8892
8943
  return _createClass(ae, [{
@@ -8912,27 +8963,27 @@ var ae = /*#__PURE__*/function (_U11) {
8912
8963
  }, {
8913
8964
  key: "callServiceAPI",
8914
8965
  value: function () {
8915
- var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee91(e, t, i) {
8966
+ var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee92(e, t, i) {
8916
8967
  var n, r;
8917
- return _regeneratorRuntime().wrap(function _callee91$(_context91) {
8918
- while (1) switch (_context91.prev = _context91.next) {
8968
+ return _regeneratorRuntime().wrap(function _callee92$(_context92) {
8969
+ while (1) switch (_context92.prev = _context92.next) {
8919
8970
  case 0:
8920
8971
  if ((n = this.connectSettings) != null && n.headers) {
8921
- _context91.next = 2;
8972
+ _context92.next = 2;
8922
8973
  break;
8923
8974
  }
8924
8975
  throw new Error("Request settings have not been set up");
8925
8976
  case 2:
8926
8977
  if (!(i != null && i[0])) {
8927
- _context91.next = 6;
8978
+ _context92.next = 6;
8928
8979
  break;
8929
8980
  }
8930
8981
  this.callApiWithImage(e, t, i);
8931
- _context91.next = 11;
8982
+ _context92.next = 11;
8932
8983
  break;
8933
8984
  case 6:
8934
8985
  if (this.connectSettings) {
8935
- _context91.next = 8;
8986
+ _context92.next = 8;
8936
8987
  break;
8937
8988
  }
8938
8989
  throw new Error("Request settings have not been set up");
@@ -8942,11 +8993,11 @@ var ae = /*#__PURE__*/function (_U11) {
8942
8993
  T.request(this, r, e);
8943
8994
  case 11:
8944
8995
  case "end":
8945
- return _context91.stop();
8996
+ return _context92.stop();
8946
8997
  }
8947
- }, _callee91, this);
8998
+ }, _callee92, this);
8948
8999
  }));
8949
- function callServiceAPI(_x161, _x162, _x163) {
9000
+ function callServiceAPI(_x162, _x163, _x164) {
8950
9001
  return _callServiceAPI19.apply(this, arguments);
8951
9002
  }
8952
9003
  return callServiceAPI;
@@ -8954,17 +9005,17 @@ var ae = /*#__PURE__*/function (_U11) {
8954
9005
  }, {
8955
9006
  key: "extractResultData",
8956
9007
  value: function () {
8957
- var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee92(e) {
8958
- return _regeneratorRuntime().wrap(function _callee92$(_context92) {
8959
- while (1) switch (_context92.prev = _context92.next) {
9008
+ var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee93(e) {
9009
+ return _regeneratorRuntime().wrap(function _callee93$(_context93) {
9010
+ while (1) switch (_context93.prev = _context93.next) {
8960
9011
  case 0:
8961
9012
  if (!e.error) {
8962
- _context92.next = 2;
9013
+ _context93.next = 2;
8963
9014
  break;
8964
9015
  }
8965
9016
  throw e.error.message;
8966
9017
  case 2:
8967
- return _context92.abrupt("return", {
9018
+ return _context93.abrupt("return", {
8968
9019
  files: e.data.map(function (i) {
8969
9020
  return i.url ? {
8970
9021
  src: i.url,
@@ -8977,11 +9028,11 @@ var ae = /*#__PURE__*/function (_U11) {
8977
9028
  });
8978
9029
  case 3:
8979
9030
  case "end":
8980
- return _context92.stop();
9031
+ return _context93.stop();
8981
9032
  }
8982
- }, _callee92);
9033
+ }, _callee93);
8983
9034
  }));
8984
- function extractResultData(_x164) {
9035
+ function extractResultData(_x165) {
8985
9036
  return _extractResultData22.apply(this, arguments);
8986
9037
  }
8987
9038
  return extractResultData;
@@ -9013,22 +9064,22 @@ ae.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations", ae.IMA
9013
9064
  var sn = ae;
9014
9065
  var yt = /*#__PURE__*/function (_U12) {
9015
9066
  function yt(e) {
9016
- var _this40$maxMessages, _l$model;
9017
- var _this40;
9067
+ var _this41$maxMessages, _l$model;
9068
+ var _this41;
9018
9069
  _classCallCheck(this, yt);
9019
9070
  var r, o, a, l;
9020
9071
  var t = JSON.parse(JSON.stringify(e.directConnection)),
9021
9072
  i = t.openAI;
9022
- _this40 = _callSuper(this, yt, [e, P.buildKeyVerificationDetails(), P.buildHeaders, i]), _this40.insertKeyPlaceholderText = "OpenAI API Key", _this40.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this40.url = "https://api.openai.com/v1/chat/completions", _this40.permittedErrorPrefixes = ["Incorrect"], _this40.asyncCallInProgress = !1, _this40._systemMessage = yt.generateSystemMessage("You are a helpful assistant.");
9073
+ _this41 = _callSuper(this, yt, [e, P.buildKeyVerificationDetails(), P.buildHeaders, i]), _this41.insertKeyPlaceholderText = "OpenAI API Key", _this41.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this41.url = "https://api.openai.com/v1/chat/completions", _this41.permittedErrorPrefixes = ["Incorrect"], _this41.asyncCallInProgress = !1, _this41._systemMessage = yt.generateSystemMessage("You are a helpful assistant.");
9023
9074
  var n = (r = t.openAI) == null ? void 0 : r.chat;
9024
9075
  if (_typeof(n) == "object") {
9025
- n.system_prompt && (_this40._systemMessage = yt.generateSystemMessage(n.system_prompt));
9076
+ n.system_prompt && (_this41._systemMessage = yt.generateSystemMessage(n.system_prompt));
9026
9077
  var _ref13 = (a = (o = e.directConnection) == null ? void 0 : o.openAI) == null ? void 0 : a.chat,
9027
9078
  c = _ref13.function_handler;
9028
- c && (_this40._functionHandler = c), _this40.cleanConfig(n), Object.assign(_this40.rawBody, n);
9079
+ c && (_this41._functionHandler = c), _this41.cleanConfig(n), Object.assign(_this41.rawBody, n);
9029
9080
  }
9030
- (_this40$maxMessages = _this40.maxMessages) !== null && _this40$maxMessages !== void 0 ? _this40$maxMessages : _this40.maxMessages = -1, (_l$model = (l = _this40.rawBody).model) !== null && _l$model !== void 0 ? _l$model : l.model = "gpt-3.5-turbo";
9031
- return _this40;
9081
+ (_this41$maxMessages = _this41.maxMessages) !== null && _this41$maxMessages !== void 0 ? _this41$maxMessages : _this41.maxMessages = -1, (_l$model = (l = _this41.rawBody).model) !== null && _l$model !== void 0 ? _l$model : l.model = "gpt-3.5-turbo";
9082
+ return _this41;
9032
9083
  }
9033
9084
  _inherits(yt, _U12);
9034
9085
  return _createClass(yt, [{
@@ -9056,13 +9107,13 @@ var yt = /*#__PURE__*/function (_U12) {
9056
9107
  }, {
9057
9108
  key: "callServiceAPI",
9058
9109
  value: function () {
9059
- var _callServiceAPI20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee93(e, t) {
9110
+ var _callServiceAPI20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee94(e, t) {
9060
9111
  var i, n;
9061
- return _regeneratorRuntime().wrap(function _callee93$(_context93) {
9062
- while (1) switch (_context93.prev = _context93.next) {
9112
+ return _regeneratorRuntime().wrap(function _callee94$(_context94) {
9113
+ while (1) switch (_context94.prev = _context94.next) {
9063
9114
  case 0:
9064
9115
  if (this.connectSettings) {
9065
- _context93.next = 2;
9116
+ _context94.next = 2;
9066
9117
  break;
9067
9118
  }
9068
9119
  throw new Error("Request settings have not been set up");
@@ -9071,11 +9122,11 @@ var yt = /*#__PURE__*/function (_U12) {
9071
9122
  n && (_typeof(n) != "object" || !n.simulation) || i.stream ? (i.stream = !0, C.request(this, i, e)) : T.request(this, i, e);
9072
9123
  case 4:
9073
9124
  case "end":
9074
- return _context93.stop();
9125
+ return _context94.stop();
9075
9126
  }
9076
- }, _callee93, this);
9127
+ }, _callee94, this);
9077
9128
  }));
9078
- function callServiceAPI(_x165, _x166) {
9129
+ function callServiceAPI(_x166, _x167) {
9079
9130
  return _callServiceAPI20.apply(this, arguments);
9080
9131
  }
9081
9132
  return callServiceAPI;
@@ -9083,29 +9134,29 @@ var yt = /*#__PURE__*/function (_U12) {
9083
9134
  }, {
9084
9135
  key: "extractResultData",
9085
9136
  value: function () {
9086
- var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee94(e, t, i) {
9137
+ var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee95(e, t, i) {
9087
9138
  var n, r, o, a;
9088
- return _regeneratorRuntime().wrap(function _callee94$(_context94) {
9089
- while (1) switch (_context94.prev = _context94.next) {
9139
+ return _regeneratorRuntime().wrap(function _callee95$(_context95) {
9140
+ while (1) switch (_context95.prev = _context95.next) {
9090
9141
  case 0:
9091
9142
  if (!e.error) {
9092
- _context94.next = 2;
9143
+ _context95.next = 2;
9093
9144
  break;
9094
9145
  }
9095
9146
  throw e.error.message;
9096
9147
  case 2:
9097
- return _context94.abrupt("return", (r = (n = e.choices) == null ? void 0 : n[0]) != null && r.delta ? this.extractStreamResult(e.choices[0], t, i) : (a = (o = e.choices) == null ? void 0 : o[0]) != null && a.message ? e.choices[0].message.tool_calls ? this.handleTools(e.choices[0].message, t, i) : {
9148
+ return _context95.abrupt("return", (r = (n = e.choices) == null ? void 0 : n[0]) != null && r.delta ? this.extractStreamResult(e.choices[0], t, i) : (a = (o = e.choices) == null ? void 0 : o[0]) != null && a.message ? e.choices[0].message.tool_calls ? this.handleTools(e.choices[0].message, t, i) : {
9098
9149
  text: e.choices[0].message.content
9099
9150
  } : {
9100
9151
  text: ""
9101
9152
  });
9102
9153
  case 3:
9103
9154
  case "end":
9104
- return _context94.stop();
9155
+ return _context95.stop();
9105
9156
  }
9106
- }, _callee94, this);
9157
+ }, _callee95, this);
9107
9158
  }));
9108
- function extractResultData(_x167, _x168, _x169) {
9159
+ function extractResultData(_x168, _x169, _x170) {
9109
9160
  return _extractResultData23.apply(this, arguments);
9110
9161
  }
9111
9162
  return extractResultData;
@@ -9113,37 +9164,37 @@ var yt = /*#__PURE__*/function (_U12) {
9113
9164
  }, {
9114
9165
  key: "extractStreamResult",
9115
9166
  value: function () {
9116
- var _extractStreamResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee95(e, t, i) {
9117
- var _this41 = this;
9167
+ var _extractStreamResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee96(e, t, i) {
9168
+ var _this42 = this;
9118
9169
  var n, r, o;
9119
- return _regeneratorRuntime().wrap(function _callee95$(_context95) {
9120
- while (1) switch (_context95.prev = _context95.next) {
9170
+ return _regeneratorRuntime().wrap(function _callee96$(_context96) {
9171
+ while (1) switch (_context96.prev = _context96.next) {
9121
9172
  case 0:
9122
9173
  n = e.delta, r = e.finish_reason;
9123
9174
  if (!(r === "tool_calls")) {
9124
- _context95.next = 7;
9175
+ _context96.next = 7;
9125
9176
  break;
9126
9177
  }
9127
9178
  this.asyncCallInProgress = !0;
9128
9179
  o = {
9129
9180
  tool_calls: this._streamToolCalls
9130
9181
  };
9131
- return _context95.abrupt("return", (this._streamToolCalls = void 0, this.handleTools(o, t, i)));
9182
+ return _context96.abrupt("return", (this._streamToolCalls = void 0, this.handleTools(o, t, i)));
9132
9183
  case 7:
9133
9184
  n != null && n.tool_calls && (this._streamToolCalls ? n.tool_calls.forEach(function (o, a) {
9134
- _this41._streamToolCalls && (_this41._streamToolCalls[a]["function"].arguments += o["function"].arguments);
9185
+ _this42._streamToolCalls && (_this42._streamToolCalls[a]["function"].arguments += o["function"].arguments);
9135
9186
  }) : this._streamToolCalls = n.tool_calls);
9136
9187
  case 8:
9137
- return _context95.abrupt("return", {
9188
+ return _context96.abrupt("return", {
9138
9189
  text: (n == null ? void 0 : n.content) || ""
9139
9190
  });
9140
9191
  case 9:
9141
9192
  case "end":
9142
- return _context95.stop();
9193
+ return _context96.stop();
9143
9194
  }
9144
- }, _callee95, this);
9195
+ }, _callee96, this);
9145
9196
  }));
9146
- function extractStreamResult(_x170, _x171, _x172) {
9197
+ function extractStreamResult(_x171, _x172, _x173) {
9147
9198
  return _extractStreamResult.apply(this, arguments);
9148
9199
  }
9149
9200
  return extractStreamResult;
@@ -9151,13 +9202,13 @@ var yt = /*#__PURE__*/function (_U12) {
9151
9202
  }, {
9152
9203
  key: "handleTools",
9153
9204
  value: function () {
9154
- var _handleTools2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee96(e, t, i) {
9205
+ var _handleTools2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee97(e, t, i) {
9155
9206
  var a, l, c, d, h, n, r, o, u, _u;
9156
- return _regeneratorRuntime().wrap(function _callee96$(_context96) {
9157
- while (1) switch (_context96.prev = _context96.next) {
9207
+ return _regeneratorRuntime().wrap(function _callee97$(_context97) {
9208
+ while (1) switch (_context97.prev = _context97.next) {
9158
9209
  case 0:
9159
9210
  if (!(!e.tool_calls || !t || !i || !this._functionHandler)) {
9160
- _context96.next = 2;
9211
+ _context97.next = 2;
9161
9212
  break;
9162
9213
  }
9163
9214
  throw Error("Please define the `function_handler` property inside the [openAI](https://deepchat.dev/docs/directConnection/openAI#Chat) object.");
@@ -9169,28 +9220,28 @@ var yt = /*#__PURE__*/function (_U12) {
9169
9220
  arguments: u["function"].arguments
9170
9221
  };
9171
9222
  });
9172
- _context96.next = 6;
9223
+ _context97.next = 6;
9173
9224
  return (a = this._functionHandler) == null ? void 0 : a.call(this, r);
9174
9225
  case 6:
9175
- o = _context96.sent;
9226
+ o = _context97.sent;
9176
9227
  if (!o.text) {
9177
- _context96.next = 15;
9228
+ _context97.next = 15;
9178
9229
  break;
9179
9230
  }
9180
9231
  u = {
9181
9232
  text: o.text
9182
9233
  };
9183
- _context96.next = 11;
9234
+ _context97.next = 11;
9184
9235
  return (c = (l = this.deepChat).responseInterceptor) == null ? void 0 : c.call(l, u);
9185
9236
  case 11:
9186
- _context96.t0 = _context96.sent;
9187
- if (_context96.t0) {
9188
- _context96.next = 14;
9237
+ _context97.t0 = _context97.sent;
9238
+ if (_context97.t0) {
9239
+ _context97.next = 14;
9189
9240
  break;
9190
9241
  }
9191
- _context96.t0 = u;
9242
+ _context97.t0 = u;
9192
9243
  case 14:
9193
- return _context96.abrupt("return", _context96.t0);
9244
+ return _context97.abrupt("return", _context97.t0);
9194
9245
  case 15:
9195
9246
  if (!(n.messages.push({
9196
9247
  tool_calls: e.tool_calls,
@@ -9199,7 +9250,7 @@ var yt = /*#__PURE__*/function (_U12) {
9199
9250
  }), Array.isArray(o) && !o.find(function (u) {
9200
9251
  return typeof u != "string";
9201
9252
  }) || r.length === o.length)) {
9202
- _context96.next = 35;
9253
+ _context97.next = 35;
9203
9254
  break;
9204
9255
  }
9205
9256
  o.forEach(function (u, f) {
@@ -9212,46 +9263,46 @@ var yt = /*#__PURE__*/function (_U12) {
9212
9263
  content: u.response
9213
9264
  });
9214
9265
  }), delete n.tools, delete n.tool_choice, delete n.stream;
9215
- _context96.prev = 17;
9216
- _context96.next = 20;
9266
+ _context97.prev = 17;
9267
+ _context97.next = 20;
9217
9268
  return t == null ? void 0 : t(n).then(function (f) {
9218
9269
  return v.processResponseByType(f);
9219
9270
  });
9220
9271
  case 20:
9221
- _u = _context96.sent;
9222
- _context96.next = 23;
9272
+ _u = _context97.sent;
9273
+ _context97.next = 23;
9223
9274
  return (h = (d = this.deepChat).responseInterceptor) == null ? void 0 : h.call(d, _u);
9224
9275
  case 23:
9225
- _context96.t1 = _context96.sent;
9226
- if (_context96.t1) {
9227
- _context96.next = 26;
9276
+ _context97.t1 = _context97.sent;
9277
+ if (_context97.t1) {
9278
+ _context97.next = 26;
9228
9279
  break;
9229
9280
  }
9230
- _context96.t1 = _u;
9281
+ _context97.t1 = _u;
9231
9282
  case 26:
9232
- _u = _context96.t1;
9283
+ _u = _context97.t1;
9233
9284
  if (!_u.error) {
9234
- _context96.next = 29;
9285
+ _context97.next = 29;
9235
9286
  break;
9236
9287
  }
9237
9288
  throw _u.error.message;
9238
9289
  case 29:
9239
- return _context96.abrupt("return", {
9290
+ return _context97.abrupt("return", {
9240
9291
  text: _u.choices[0].message.content || ""
9241
9292
  });
9242
9293
  case 32:
9243
- _context96.prev = 32;
9244
- _context96.t2 = _context96["catch"](17);
9245
- throw this.asyncCallInProgress = !1, _context96.t2;
9294
+ _context97.prev = 32;
9295
+ _context97.t2 = _context97["catch"](17);
9296
+ throw this.asyncCallInProgress = !1, _context97.t2;
9246
9297
  case 35:
9247
9298
  throw Error("Response object must either be {response: string}[] for each individual function or {text: string} for a direct response, see https://deepchat.dev/docs/directConnection/OpenAI#FunctionHandler.");
9248
9299
  case 36:
9249
9300
  case "end":
9250
- return _context96.stop();
9301
+ return _context97.stop();
9251
9302
  }
9252
- }, _callee96, this, [[17, 32]]);
9303
+ }, _callee97, this, [[17, 32]]);
9253
9304
  }));
9254
- function handleTools(_x173, _x174, _x175) {
9305
+ function handleTools(_x174, _x175, _x176) {
9255
9306
  return _handleTools2.apply(this, arguments);
9256
9307
  }
9257
9308
  return handleTools;
@@ -9287,15 +9338,15 @@ var yt = /*#__PURE__*/function (_U12) {
9287
9338
  }(U);
9288
9339
  var ko = /*#__PURE__*/function (_un3) {
9289
9340
  function ko(e) {
9290
- var _this42$maxMessages;
9291
- var _this42;
9341
+ var _this43$maxMessages;
9342
+ var _this43;
9292
9343
  _classCallCheck(this, ko);
9293
9344
  var r;
9294
9345
  var t = JSON.parse(JSON.stringify(e.directConnection)),
9295
9346
  i = (r = t.cohere) == null ? void 0 : r.chat,
9296
9347
  n = t.cohere;
9297
- _this42 = _callSuper(this, ko, [e, "https://api.cohere.ai/v1/chat", "Ask me anything!", i, n]), _typeof(i) == "object" && Object.assign(_this42.rawBody, i), (_this42$maxMessages = _this42.maxMessages) !== null && _this42$maxMessages !== void 0 ? _this42$maxMessages : _this42.maxMessages = -1;
9298
- return _this42;
9348
+ _this43 = _callSuper(this, ko, [e, "https://api.cohere.ai/v1/chat", "Ask me anything!", i, n]), _typeof(i) == "object" && Object.assign(_this43.rawBody, i), (_this43$maxMessages = _this43.maxMessages) !== null && _this43$maxMessages !== void 0 ? _this43$maxMessages : _this43.maxMessages = -1;
9349
+ return _this43;
9299
9350
  }
9300
9351
  _inherits(ko, _un3);
9301
9352
  return _createClass(ko, [{
@@ -9315,13 +9366,13 @@ var ko = /*#__PURE__*/function (_un3) {
9315
9366
  }, {
9316
9367
  key: "callServiceAPI",
9317
9368
  value: function () {
9318
- var _callServiceAPI21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee97(e, t) {
9369
+ var _callServiceAPI21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee98(e, t) {
9319
9370
  var i;
9320
- return _regeneratorRuntime().wrap(function _callee97$(_context97) {
9321
- while (1) switch (_context97.prev = _context97.next) {
9371
+ return _regeneratorRuntime().wrap(function _callee98$(_context98) {
9372
+ while (1) switch (_context98.prev = _context98.next) {
9322
9373
  case 0:
9323
9374
  if (this.connectSettings) {
9324
- _context97.next = 2;
9375
+ _context98.next = 2;
9325
9376
  break;
9326
9377
  }
9327
9378
  throw new Error("Request settings have not been set up");
@@ -9330,11 +9381,11 @@ var ko = /*#__PURE__*/function (_un3) {
9330
9381
  T.request(this, i, e);
9331
9382
  case 4:
9332
9383
  case "end":
9333
- return _context97.stop();
9384
+ return _context98.stop();
9334
9385
  }
9335
- }, _callee97, this);
9386
+ }, _callee98, this);
9336
9387
  }));
9337
- function callServiceAPI(_x176, _x177) {
9388
+ function callServiceAPI(_x177, _x178) {
9338
9389
  return _callServiceAPI21.apply(this, arguments);
9339
9390
  }
9340
9391
  return callServiceAPI;
@@ -9342,26 +9393,26 @@ var ko = /*#__PURE__*/function (_un3) {
9342
9393
  }, {
9343
9394
  key: "extractResultData",
9344
9395
  value: function () {
9345
- var _extractResultData24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee98(e) {
9346
- return _regeneratorRuntime().wrap(function _callee98$(_context98) {
9347
- while (1) switch (_context98.prev = _context98.next) {
9396
+ var _extractResultData24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee99(e) {
9397
+ return _regeneratorRuntime().wrap(function _callee99$(_context99) {
9398
+ while (1) switch (_context99.prev = _context99.next) {
9348
9399
  case 0:
9349
9400
  if (!e.message) {
9350
- _context98.next = 2;
9401
+ _context99.next = 2;
9351
9402
  break;
9352
9403
  }
9353
9404
  throw e.message;
9354
9405
  case 2:
9355
- return _context98.abrupt("return", {
9406
+ return _context99.abrupt("return", {
9356
9407
  text: e.text
9357
9408
  });
9358
9409
  case 3:
9359
9410
  case "end":
9360
- return _context98.stop();
9411
+ return _context99.stop();
9361
9412
  }
9362
- }, _callee98);
9413
+ }, _callee99);
9363
9414
  }));
9364
- function extractResultData(_x178) {
9415
+ function extractResultData(_x179) {
9365
9416
  return _extractResultData24.apply(this, arguments);
9366
9417
  }
9367
9418
  return extractResultData;
@@ -9401,13 +9452,13 @@ var li = /*#__PURE__*/function () {
9401
9452
  }();
9402
9453
  var Ao = /*#__PURE__*/function (_U13) {
9403
9454
  function Ao(e) {
9404
- var _this43$maxMessages, _n$model;
9405
- var _this43;
9455
+ var _this44$maxMessages, _n$model;
9456
+ var _this44;
9406
9457
  _classCallCheck(this, Ao);
9407
9458
  var n;
9408
9459
  var i = JSON.parse(JSON.stringify(e.directConnection)).mistral;
9409
- _this43 = _callSuper(this, Ao, [e, li.buildKeyVerificationDetails(), li.buildHeaders, i]), _this43.insertKeyPlaceholderText = "Mistral API Key", _this43.keyHelpUrl = "https://console.mistral.ai/api-keys/", _this43.url = "https://api.mistral.ai/v1/chat/completions", _this43.permittedErrorPrefixes = ["invalid"], i && (_this43.cleanConfig(i), Object.assign(_this43.rawBody, i)), (_this43$maxMessages = _this43.maxMessages) !== null && _this43$maxMessages !== void 0 ? _this43$maxMessages : _this43.maxMessages = -1, (_n$model = (n = _this43.rawBody).model) !== null && _n$model !== void 0 ? _n$model : n.model = "open-mistral-7b";
9410
- return _this43;
9460
+ _this44 = _callSuper(this, Ao, [e, li.buildKeyVerificationDetails(), li.buildHeaders, i]), _this44.insertKeyPlaceholderText = "Mistral API Key", _this44.keyHelpUrl = "https://console.mistral.ai/api-keys/", _this44.url = "https://api.mistral.ai/v1/chat/completions", _this44.permittedErrorPrefixes = ["invalid"], i && (_this44.cleanConfig(i), Object.assign(_this44.rawBody, i)), (_this44$maxMessages = _this44.maxMessages) !== null && _this44$maxMessages !== void 0 ? _this44$maxMessages : _this44.maxMessages = -1, (_n$model = (n = _this44.rawBody).model) !== null && _n$model !== void 0 ? _n$model : n.model = "open-mistral-7b";
9461
+ return _this44;
9411
9462
  }
9412
9463
  _inherits(Ao, _U13);
9413
9464
  return _createClass(Ao, [{
@@ -9433,13 +9484,13 @@ var Ao = /*#__PURE__*/function (_U13) {
9433
9484
  }, {
9434
9485
  key: "callServiceAPI",
9435
9486
  value: function () {
9436
- var _callServiceAPI22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee99(e, t) {
9487
+ var _callServiceAPI22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee100(e, t) {
9437
9488
  var i;
9438
- return _regeneratorRuntime().wrap(function _callee99$(_context99) {
9439
- while (1) switch (_context99.prev = _context99.next) {
9489
+ return _regeneratorRuntime().wrap(function _callee100$(_context100) {
9490
+ while (1) switch (_context100.prev = _context100.next) {
9440
9491
  case 0:
9441
9492
  if (this.connectSettings) {
9442
- _context99.next = 2;
9493
+ _context100.next = 2;
9443
9494
  break;
9444
9495
  }
9445
9496
  throw new Error("Request settings have not been set up");
@@ -9448,11 +9499,11 @@ var Ao = /*#__PURE__*/function (_U13) {
9448
9499
  T.request(this, i, e);
9449
9500
  case 4:
9450
9501
  case "end":
9451
- return _context99.stop();
9502
+ return _context100.stop();
9452
9503
  }
9453
- }, _callee99, this);
9504
+ }, _callee100, this);
9454
9505
  }));
9455
- function callServiceAPI(_x179, _x180) {
9506
+ function callServiceAPI(_x180, _x181) {
9456
9507
  return _callServiceAPI22.apply(this, arguments);
9457
9508
  }
9458
9509
  return callServiceAPI;
@@ -9460,26 +9511,26 @@ var Ao = /*#__PURE__*/function (_U13) {
9460
9511
  }, {
9461
9512
  key: "extractResultData",
9462
9513
  value: function () {
9463
- var _extractResultData25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee100(e) {
9464
- return _regeneratorRuntime().wrap(function _callee100$(_context100) {
9465
- while (1) switch (_context100.prev = _context100.next) {
9514
+ var _extractResultData25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee101(e) {
9515
+ return _regeneratorRuntime().wrap(function _callee101$(_context101) {
9516
+ while (1) switch (_context101.prev = _context101.next) {
9466
9517
  case 0:
9467
9518
  if (!e.message) {
9468
- _context100.next = 2;
9519
+ _context101.next = 2;
9469
9520
  break;
9470
9521
  }
9471
9522
  throw e.message;
9472
9523
  case 2:
9473
- return _context100.abrupt("return", {
9524
+ return _context101.abrupt("return", {
9474
9525
  text: e.text
9475
9526
  });
9476
9527
  case 3:
9477
9528
  case "end":
9478
- return _context100.stop();
9529
+ return _context101.stop();
9479
9530
  }
9480
- }, _callee100);
9531
+ }, _callee101);
9481
9532
  }));
9482
- function extractResultData(_x181) {
9533
+ function extractResultData(_x182) {
9483
9534
  return _extractResultData25.apply(this, arguments);
9484
9535
  }
9485
9536
  return extractResultData;
@@ -9641,20 +9692,20 @@ var Te = /*#__PURE__*/function () {
9641
9692
  }, {
9642
9693
  key: "addNewImageMessage",
9643
9694
  value: function () {
9644
- var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee101(e, t, i) {
9695
+ var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee102(e, t, i) {
9645
9696
  var n, r;
9646
- return _regeneratorRuntime().wrap(function _callee101$(_context101) {
9647
- while (1) switch (_context101.prev = _context101.next) {
9697
+ return _regeneratorRuntime().wrap(function _callee102$(_context102) {
9698
+ while (1) switch (_context102.prev = _context102.next) {
9648
9699
  case 0:
9649
9700
  n = Te.createImage(t, e.elementRef), r = e.createNewMessageElement("", i);
9650
9701
  r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("image-message"), q.addMessage(e, r, "image", i);
9651
9702
  case 2:
9652
9703
  case "end":
9653
- return _context101.stop();
9704
+ return _context102.stop();
9654
9705
  }
9655
- }, _callee101);
9706
+ }, _callee102);
9656
9707
  }));
9657
- function addNewImageMessage(_x182, _x183, _x184) {
9708
+ function addNewImageMessage(_x183, _x184, _x185) {
9658
9709
  return _addNewImageMessage.apply(this, arguments);
9659
9710
  }
9660
9711
  return addNewImageMessage;
@@ -9703,23 +9754,23 @@ var Te = /*#__PURE__*/function () {
9703
9754
  }();
9704
9755
  var Ce = /*#__PURE__*/function (_ot) {
9705
9756
  function Ce(e, t, i) {
9706
- var _this44;
9757
+ var _this45;
9707
9758
  _classCallCheck(this, Ce);
9708
9759
  var a, l;
9709
- _this44 = _callSuper(this, Ce, [e]);
9760
+ _this45 = _callSuper(this, Ce, [e]);
9710
9761
  var n = t.permittedErrorPrefixes,
9711
9762
  r = t.introPanelMarkUp,
9712
9763
  o = t.demo;
9713
- _this44._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, _this44._onClearMessages = Qt.onClearMessages.bind(_this44, e), _this44._onError = Qt.onError.bind(_this44, e), _this44._displayLoadingMessage = Ce.getDisplayLoadingMessage(e, t), _this44._permittedErrorPrefixes = n, _this44.addSetupMessageIfNeeded(e, t) || _this44.populateIntroPanel(i, r, e.introPanelStyle), _this44.addIntroductoryMessage(e, t), _this44.populateHistory(e), _this44._displayServiceErrorMessages = (l = e.errorMessages) == null ? void 0 : l.displayServiceErrorMessages, e.getMessages = function () {
9714
- return JSON.parse(JSON.stringify(_this44.messages));
9715
- }, e.clearMessages = _this44.clearMessages.bind(_this44, t), e.refreshMessages = _this44.refreshTextMessages.bind(_this44), e.scrollToBottom = j.scrollToBottom.bind(_this44, _this44.elementRef), e.addMessage = function (c, d) {
9716
- _this44.addAnyMessage(_objectSpread(_objectSpread({}, c), {}, {
9764
+ _this45._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, _this45._onClearMessages = Qt.onClearMessages.bind(_this45, e), _this45._onError = Qt.onError.bind(_this45, e), _this45._displayLoadingMessage = Ce.getDisplayLoadingMessage(e, t), _this45._permittedErrorPrefixes = n, _this45.addSetupMessageIfNeeded(e, t) || _this45.populateIntroPanel(i, r, e.introPanelStyle), _this45.addIntroductoryMessage(e, t), _this45.populateHistory(e), _this45._displayServiceErrorMessages = (l = e.errorMessages) == null ? void 0 : l.displayServiceErrorMessages, e.getMessages = function () {
9765
+ return JSON.parse(JSON.stringify(_this45.messages));
9766
+ }, e.clearMessages = _this45.clearMessages.bind(_this45, t), e.refreshMessages = _this45.refreshTextMessages.bind(_this45), e.scrollToBottom = j.scrollToBottom.bind(_this45, _this45.elementRef), e.addMessage = function (c, d) {
9767
+ _this45.addAnyMessage(_objectSpread(_objectSpread({}, c), {}, {
9717
9768
  sendUpdate: !!d
9718
9769
  }), !d);
9719
- }, t.isWebModel() && t.setUpMessages(_this44), o && _this44.prepareDemo(o), e.textToSpeech && rt.processConfig(e.textToSpeech, function (c) {
9720
- _this44.textToSpeech = c;
9721
- }), t.fetchHistory && _this44.fetchHistory(t.fetchHistory);
9722
- return _this44;
9770
+ }, t.isWebModel() && t.setUpMessages(_this45), o && _this45.prepareDemo(o), e.textToSpeech && rt.processConfig(e.textToSpeech, function (c) {
9771
+ _this45.textToSpeech = c;
9772
+ }), t.fetchHistory && _this45.fetchHistory(t.fetchHistory);
9773
+ return _this45;
9723
9774
  }
9724
9775
  _inherits(Ce, _ot);
9725
9776
  return _createClass(Ce, [{
@@ -9759,38 +9810,38 @@ var Ce = /*#__PURE__*/function (_ot) {
9759
9810
  }, {
9760
9811
  key: "populateHistory",
9761
9812
  value: function populateHistory(e) {
9762
- var _this45 = this;
9813
+ var _this46 = this;
9763
9814
  var t = e.history || de.processHistory(e);
9764
9815
  t && (t.forEach(function (i) {
9765
- de.processHistoryFile(i), _this45.addNewMessage(i, !0);
9816
+ de.processHistoryFile(i), _this46.addNewMessage(i, !0);
9766
9817
  }), setTimeout(function () {
9767
- return j.scrollToBottom(_this45.elementRef);
9818
+ return j.scrollToBottom(_this46.elementRef);
9768
9819
  }, 0));
9769
9820
  }
9770
9821
  }, {
9771
9822
  key: "fetchHistory",
9772
9823
  value: function () {
9773
- var _fetchHistory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee102(e) {
9774
- var _this46 = this;
9775
- return _regeneratorRuntime().wrap(function _callee102$(_context102) {
9776
- while (1) switch (_context102.prev = _context102.next) {
9824
+ var _fetchHistory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee103(e) {
9825
+ var _this47 = this;
9826
+ return _regeneratorRuntime().wrap(function _callee103$(_context103) {
9827
+ while (1) switch (_context103.prev = _context103.next) {
9777
9828
  case 0:
9778
- _context102.next = 2;
9829
+ _context103.next = 2;
9779
9830
  return e();
9780
9831
  case 2:
9781
- _context102.sent.forEach(function (i) {
9782
- return _this46.addAnyMessage(i, !0);
9832
+ _context103.sent.forEach(function (i) {
9833
+ return _this47.addAnyMessage(i, !0);
9783
9834
  });
9784
9835
  setTimeout(function () {
9785
- return j.scrollToBottom(_this46.elementRef);
9836
+ return j.scrollToBottom(_this47.elementRef);
9786
9837
  }, 0);
9787
9838
  case 4:
9788
9839
  case "end":
9789
- return _context102.stop();
9840
+ return _context103.stop();
9790
9841
  }
9791
- }, _callee102);
9842
+ }, _callee103);
9792
9843
  }));
9793
- function fetchHistory(_x185) {
9844
+ function fetchHistory(_x186) {
9794
9845
  return _fetchHistory.apply(this, arguments);
9795
9846
  }
9796
9847
  return fetchHistory;
@@ -9890,11 +9941,11 @@ var Ce = /*#__PURE__*/function (_ot) {
9890
9941
  }, {
9891
9942
  key: "addMultipleFiles",
9892
9943
  value: function () {
9893
- var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee103(e) {
9894
- return _regeneratorRuntime().wrap(function _callee103$(_context103) {
9895
- while (1) switch (_context103.prev = _context103.next) {
9944
+ var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee104(e) {
9945
+ return _regeneratorRuntime().wrap(function _callee104$(_context104) {
9946
+ while (1) switch (_context104.prev = _context104.next) {
9896
9947
  case 0:
9897
- return _context103.abrupt("return", Promise.all((e || []).map(function (t) {
9948
+ return _context104.abrupt("return", Promise.all((e || []).map(function (t) {
9898
9949
  return new Promise(function (i) {
9899
9950
  if (!t.type || t.type === "any") {
9900
9951
  var n = t.file.name || q.DEFAULT_FILE_NAME;
@@ -9917,11 +9968,11 @@ var Ce = /*#__PURE__*/function (_ot) {
9917
9968
  })));
9918
9969
  case 1:
9919
9970
  case "end":
9920
- return _context103.stop();
9971
+ return _context104.stop();
9921
9972
  }
9922
- }, _callee103);
9973
+ }, _callee104);
9923
9974
  }));
9924
- function addMultipleFiles(_x186) {
9975
+ function addMultipleFiles(_x187) {
9925
9976
  return _addMultipleFiles.apply(this, arguments);
9926
9977
  }
9927
9978
  return addMultipleFiles;
@@ -10218,11 +10269,11 @@ var De = /*#__PURE__*/function () {
10218
10269
  }();
10219
10270
  var mn = /*#__PURE__*/function () {
10220
10271
  function mn(e, t) {
10221
- var _this47 = this;
10272
+ var _this48 = this;
10222
10273
  _classCallCheck(this, mn);
10223
10274
  var i;
10224
10275
  this._isOpen = !0, this._styles = t, this.elementRef = mn.createElement((i = this._styles) == null ? void 0 : i.container), this.close(), setTimeout(function () {
10225
- return _this47.addWindowEvents(e);
10276
+ return _this48.addWindowEvents(e);
10226
10277
  });
10227
10278
  }
10228
10279
  return _createClass(mn, [{
@@ -10275,15 +10326,15 @@ var mn = /*#__PURE__*/function () {
10275
10326
  }();
10276
10327
  var at = /*#__PURE__*/function (_Bt) {
10277
10328
  function at(e, t) {
10278
- var _this48;
10329
+ var _this49;
10279
10330
  _classCallCheck(this, at);
10280
10331
  var n;
10281
- _this48 = _callSuper(this, at, [at.createButtonElement(), void 0, {
10332
+ _this49 = _callSuper(this, at, [at.createButtonElement(), void 0, {
10282
10333
  styles: (n = t == null ? void 0 : t.button) == null ? void 0 : n.styles
10283
10334
  }]);
10284
- var i = _this48.createInnerElements(_this48._customStyles);
10285
- _this48._menu = new mn(e, t == null ? void 0 : t.menu), _this48.addClickEvent(), _this48.buttonContainer = at.createButtonContainer(), _this48.elementRef.appendChild(i.styles), _this48.buttonContainer.appendChild(_this48.elementRef), _this48.elementRef.classList.add("dropup-icon", "upload-file-button"), _this48.elementRef.children[0].id = "dropup-icon", _this48.buttonContainer.appendChild(_this48._menu.elementRef), _this48.reapplyStateStyle("styles"), _this48.addContainerEvents(e);
10286
- return _this48;
10335
+ var i = _this49.createInnerElements(_this49._customStyles);
10336
+ _this49._menu = new mn(e, t == null ? void 0 : t.menu), _this49.addClickEvent(), _this49.buttonContainer = at.createButtonContainer(), _this49.elementRef.appendChild(i.styles), _this49.buttonContainer.appendChild(_this49.elementRef), _this49.elementRef.classList.add("dropup-icon", "upload-file-button"), _this49.elementRef.children[0].id = "dropup-icon", _this49.buttonContainer.appendChild(_this49._menu.elementRef), _this49.reapplyStateStyle("styles"), _this49.addContainerEvents(e);
10337
+ return _this49;
10287
10338
  }
10288
10339
  _inherits(at, _Bt);
10289
10340
  return _createClass(at, [{
@@ -10311,9 +10362,9 @@ var at = /*#__PURE__*/function (_Bt) {
10311
10362
  }, {
10312
10363
  key: "addContainerEvents",
10313
10364
  value: function addContainerEvents(e) {
10314
- var _this49 = this;
10365
+ var _this50 = this;
10315
10366
  e.addEventListener("click", function (t) {
10316
- t.target.classList.contains("dropup-icon") || _this49._menu.close();
10367
+ t.target.classList.contains("dropup-icon") || _this50._menu.close();
10317
10368
  });
10318
10369
  }
10319
10370
  }], [{
@@ -10445,10 +10496,10 @@ var Po = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 24 24\"
10445
10496
  Bo = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg height=\"1.4em\" width=\"1.4em\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n\t viewBox=\"0 0 490.9 490.9\" xml:space=\"preserve\">\n\t<g>\n\t\t<g>\n\t\t\t<path d=\"M245.5,322.9c53,0,96.2-43.2,96.2-96.2V96.2c0-53-43.2-96.2-96.2-96.2s-96.2,43.2-96.2,96.2v130.5\n\t\t\t\tC149.3,279.8,192.5,322.9,245.5,322.9z M173.8,96.2c0-39.5,32.2-71.7,71.7-71.7s71.7,32.2,71.7,71.7v130.5\n\t\t\t\tc0,39.5-32.2,71.7-71.7,71.7s-71.7-32.2-71.7-71.7V96.2z\"/>\n\t\t\t<path d=\"M94.4,214.5c-6.8,0-12.3,5.5-12.3,12.3c0,85.9,66.7,156.6,151.1,162.8v76.7h-63.9c-6.8,0-12.3,5.5-12.3,12.3\n\t\t\t\ts5.5,12.3,12.3,12.3h152.3c6.8,0,12.3-5.5,12.3-12.3s-5.5-12.3-12.3-12.3h-63.9v-76.7c84.4-6.3,151.1-76.9,151.1-162.8\n\t\t\t\tc0-6.8-5.5-12.3-12.3-12.3s-12.3,5.5-12.3,12.3c0,76.6-62.3,138.9-138.9,138.9s-138.9-62.3-138.9-138.9\n\t\t\t\tC106.6,220,101.2,214.5,94.4,214.5z\"/>\n\t\t</g>\n\t</g>\n</svg>\n";
10446
10497
  var Lt = /*#__PURE__*/function (_Bt2) {
10447
10498
  function Lt(e) {
10448
- var _this50;
10499
+ var _this51;
10449
10500
  _classCallCheck(this, Lt);
10450
- (e == null ? void 0 : e.position) === "dropup-menu" && (e.position = "outside-right"), _this50 = _callSuper(this, Lt, [Lt.createMicrophoneElement(), e == null ? void 0 : e.position, e]), _this50.isActive = !1, _this50._innerElements = _this50.createInnerElements(_this50._customStyles), _this50.changeToDefault();
10451
- return _this50;
10501
+ (e == null ? void 0 : e.position) === "dropup-menu" && (e.position = "outside-right"), _this51 = _callSuper(this, Lt, [Lt.createMicrophoneElement(), e == null ? void 0 : e.position, e]), _this51.isActive = !1, _this51._innerElements = _this51.createInnerElements(_this51._customStyles), _this51.changeToDefault();
10502
+ return _this51;
10452
10503
  }
10453
10504
  _inherits(Lt, _Bt2);
10454
10505
  return _createClass(Lt, [{
@@ -10652,9 +10703,9 @@ var te = /*#__PURE__*/function () {
10652
10703
  }, {
10653
10704
  key: "keyDownWindow",
10654
10705
  value: function keyDownWindow(e) {
10655
- var _this51 = this;
10706
+ var _this52 = this;
10656
10707
  e.element && te.getElementIfFocusedOnAvailable(e.element, document.activeElement) && (te.KEY_DOWN_TIMEOUT !== null && clearTimeout(te.KEY_DOWN_TIMEOUT), te.KEY_DOWN_TIMEOUT = setTimeout(function () {
10657
- te.KEY_DOWN_TIMEOUT = null, _this51.resetRecording(e);
10708
+ te.KEY_DOWN_TIMEOUT = null, _this52.resetRecording(e);
10658
10709
  }, 500));
10659
10710
  }
10660
10711
  }, {
@@ -11265,22 +11316,22 @@ var ui = /*#__PURE__*/function (_Xo$Speech) {
11265
11316
  }, {
11266
11317
  key: "setEvents",
11267
11318
  value: function setEvents() {
11268
- var _this52 = this;
11319
+ var _this53 = this;
11269
11320
  this._service && (this._service.onstart = function () {
11270
- _this52.setStateOnStart();
11321
+ _this53.setStateOnStart();
11271
11322
  }, this._service.onerror = function (e) {
11272
- Wn.Browser.IS_SAFARI() && e.message === "Another request is started" || e.error === "aborted" && _this52.isRestarting || e.error !== "no-speech" && _this52.error(e.message || e.error);
11323
+ Wn.Browser.IS_SAFARI() && e.message === "Another request is started" || e.error === "aborted" && _this53.isRestarting || e.error !== "no-speech" && _this53.error(e.message || e.error);
11273
11324
  }, this._service.onaudioend = function () {
11274
- _this52.setStateOnStop();
11325
+ _this53.setStateOnStop();
11275
11326
  }, this._service.onend = function () {
11276
- _this52._stopping = !1;
11327
+ _this53._stopping = !1;
11277
11328
  }, this._service.onresult = function (e) {
11278
- if (_typeof(e.results) > "u" && _this52._service) _this52._service.onend = null, _this52._service.stop();else if (_this52._extractText && !_this52._stopping) {
11279
- var _this52$_extractText = _this52._extractText(e, _this52.finalTranscript, _this52._translations),
11280
- t = _this52$_extractText.interimTranscript,
11281
- _i21 = _this52$_extractText.finalTranscript,
11282
- n = _this52$_extractText.newText;
11283
- _this52.updateElements(t, _i21, n);
11329
+ if (_typeof(e.results) > "u" && _this53._service) _this53._service.onend = null, _this53._service.stop();else if (_this53._extractText && !_this53._stopping) {
11330
+ var _this53$_extractText = _this53._extractText(e, _this53.finalTranscript, _this53._translations),
11331
+ t = _this53$_extractText.interimTranscript,
11332
+ _i21 = _this53$_extractText.finalTranscript,
11333
+ n = _this53$_extractText.newText;
11334
+ _this53.updateElements(t, _i21, n);
11284
11335
  }
11285
11336
  });
11286
11337
  }
@@ -11372,26 +11423,26 @@ var fi = /*#__PURE__*/function () {
11372
11423
  }, {
11373
11424
  key: "getNewSpeechConfig",
11374
11425
  value: function () {
11375
- var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee104(e, t) {
11376
- return _regeneratorRuntime().wrap(function _callee104$(_context104) {
11377
- while (1) switch (_context104.prev = _context104.next) {
11426
+ var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee105(e, t) {
11427
+ return _regeneratorRuntime().wrap(function _callee105$(_context105) {
11428
+ while (1) switch (_context105.prev = _context105.next) {
11378
11429
  case 0:
11379
11430
  if (!t.region) {
11380
- _context104.next = 2;
11431
+ _context105.next = 2;
11381
11432
  break;
11382
11433
  }
11383
- return _context104.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 (i) {
11434
+ return _context105.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 (i) {
11384
11435
  return t.region ? e.fromAuthorizationToken((i == null ? void 0 : i.trim()) || "", t.region.trim()) : null;
11385
11436
  })["catch"](function (i) {
11386
11437
  return console.error(i), null;
11387
11438
  }) : null);
11388
11439
  case 2:
11389
11440
  case "end":
11390
- return _context104.stop();
11441
+ return _context105.stop();
11391
11442
  }
11392
- }, _callee104);
11443
+ }, _callee105);
11393
11444
  }));
11394
- function getNewSpeechConfig(_x187, _x188) {
11445
+ function getNewSpeechConfig(_x188, _x189) {
11395
11446
  return _getNewSpeechConfig.apply(this, arguments);
11396
11447
  }
11397
11448
  return getNewSpeechConfig;
@@ -11404,23 +11455,23 @@ var fi = /*#__PURE__*/function () {
11404
11455
  }, {
11405
11456
  key: "get",
11406
11457
  value: function () {
11407
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee105(e, t) {
11458
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee106(e, t) {
11408
11459
  var i;
11409
- return _regeneratorRuntime().wrap(function _callee105$(_context105) {
11410
- while (1) switch (_context105.prev = _context105.next) {
11460
+ return _regeneratorRuntime().wrap(function _callee106$(_context106) {
11461
+ while (1) switch (_context106.prev = _context106.next) {
11411
11462
  case 0:
11412
- _context105.next = 2;
11463
+ _context106.next = 2;
11413
11464
  return fi.getNewSpeechConfig(e, t);
11414
11465
  case 2:
11415
- i = _context105.sent;
11416
- return _context105.abrupt("return", (i && fi.process(i, t), i));
11466
+ i = _context106.sent;
11467
+ return _context106.abrupt("return", (i && fi.process(i, t), i));
11417
11468
  case 4:
11418
11469
  case "end":
11419
- return _context105.stop();
11470
+ return _context106.stop();
11420
11471
  }
11421
- }, _callee105);
11472
+ }, _callee106);
11422
11473
  }));
11423
- function get(_x189, _x190) {
11474
+ function get(_x190, _x191) {
11424
11475
  return _get.apply(this, arguments);
11425
11476
  }
11426
11477
  return get;
@@ -11492,10 +11543,10 @@ var $n = Ii,
11492
11543
  ea = Ut;
11493
11544
  var pi = /*#__PURE__*/function (_ea$Speech) {
11494
11545
  function pi() {
11495
- var _this53;
11546
+ var _this54;
11496
11547
  _classCallCheck(this, pi);
11497
- _this53 = _callSuper(this, pi, arguments), _this53._newTextPadding = "";
11498
- return _this53;
11548
+ _this54 = _callSuper(this, pi, arguments), _this54._newTextPadding = "";
11549
+ return _this54;
11499
11550
  }
11500
11551
  _inherits(pi, _ea$Speech);
11501
11552
  return _createClass(pi, [{
@@ -11506,28 +11557,28 @@ var pi = /*#__PURE__*/function (_ea$Speech) {
11506
11557
  }, {
11507
11558
  key: "startAsync",
11508
11559
  value: function () {
11509
- var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee106(e) {
11560
+ var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee107(e) {
11510
11561
  var t;
11511
- return _regeneratorRuntime().wrap(function _callee106$(_context106) {
11512
- while (1) switch (_context106.prev = _context106.next) {
11562
+ return _regeneratorRuntime().wrap(function _callee107$(_context107) {
11563
+ while (1) switch (_context107.prev = _context107.next) {
11513
11564
  case 0:
11514
- _context106.t0 = this.validate(e);
11515
- if (!_context106.t0) {
11516
- _context106.next = 6;
11565
+ _context107.t0 = this.validate(e);
11566
+ if (!_context107.t0) {
11567
+ _context107.next = 6;
11517
11568
  break;
11518
11569
  }
11519
- _context106.next = 4;
11570
+ _context107.next = 4;
11520
11571
  return this.instantiateService(e);
11521
11572
  case 4:
11522
11573
  this._translations = e == null ? void 0 : e.translations;
11523
11574
  (t = this._service) === null || t === void 0 || t.startContinuousRecognitionAsync(function () {}, this.error);
11524
11575
  case 6:
11525
11576
  case "end":
11526
- return _context106.stop();
11577
+ return _context107.stop();
11527
11578
  }
11528
- }, _callee106, this);
11579
+ }, _callee107, this);
11529
11580
  }));
11530
- function startAsync(_x191) {
11581
+ function startAsync(_x192) {
11531
11582
  return _startAsync.apply(this, arguments);
11532
11583
  }
11533
11584
  return startAsync;
@@ -11540,28 +11591,28 @@ var pi = /*#__PURE__*/function (_ea$Speech) {
11540
11591
  }, {
11541
11592
  key: "instantiateService",
11542
11593
  value: function () {
11543
- var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee107(e) {
11594
+ var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee108(e) {
11544
11595
  var t, i, n, r;
11545
- return _regeneratorRuntime().wrap(function _callee107$(_context107) {
11546
- while (1) switch (_context107.prev = _context107.next) {
11596
+ return _regeneratorRuntime().wrap(function _callee108$(_context108) {
11597
+ while (1) switch (_context108.prev = _context108.next) {
11547
11598
  case 0:
11548
11599
  t = pi.getAPI();
11549
11600
  i = t.AudioConfig.fromDefaultMicrophoneInput();
11550
- _context107.next = 4;
11601
+ _context108.next = 4;
11551
11602
  return Kn.AzureSpeechConfig.get(t.SpeechConfig, e);
11552
11603
  case 4:
11553
- n = _context107.sent;
11604
+ n = _context108.sent;
11554
11605
  if (n) {
11555
11606
  r = new t.SpeechRecognizer(n, i);
11556
11607
  this.setEvents(r), this._service = r, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
11557
11608
  } else this.error("Unable to contact Azure server");
11558
11609
  case 6:
11559
11610
  case "end":
11560
- return _context107.stop();
11611
+ return _context108.stop();
11561
11612
  }
11562
- }, _callee107, this);
11613
+ }, _callee108, this);
11563
11614
  }));
11564
- function instantiateService(_x192) {
11615
+ function instantiateService(_x193) {
11565
11616
  return _instantiateService.apply(this, arguments);
11566
11617
  }
11567
11618
  return instantiateService;
@@ -11624,12 +11675,12 @@ var pi = /*#__PURE__*/function (_ea$Speech) {
11624
11675
  }, {
11625
11676
  key: "retrieveTokenInterval",
11626
11677
  value: function retrieveTokenInterval(e) {
11627
- var _this54 = this;
11678
+ var _this55 = this;
11628
11679
  this._retrieveTokenInterval = setInterval(function () {
11629
11680
  e == null || e().then(function (t) {
11630
- _this54._service && (_this54._service.authorizationToken = (t == null ? void 0 : t.trim()) || "");
11681
+ _this55._service && (_this55._service.authorizationToken = (t == null ? void 0 : t.trim()) || "");
11631
11682
  })["catch"](function (t) {
11632
- _this54.error(t);
11683
+ _this55.error(t);
11633
11684
  });
11634
11685
  }, 1e4);
11635
11686
  }
@@ -11713,10 +11764,10 @@ var na = /*#__PURE__*/function () {
11713
11764
  return _createClass(na, [{
11714
11765
  key: "setSilenceTimeout",
11715
11766
  value: function setSilenceTimeout(e, t) {
11716
- var _this55 = this;
11767
+ var _this56 = this;
11717
11768
  this._silenceTimeout = setTimeout(function () {
11718
11769
  var i;
11719
- (i = e.submit) == null || i.call(e), Kt.stop(), _this55.stop || setTimeout(t, Ot.MICROPHONE_RESET_TIMEOUT_MS);
11770
+ (i = e.submit) == null || i.call(e), Kt.stop(), _this56.stop || setTimeout(t, Ot.MICROPHONE_RESET_TIMEOUT_MS);
11720
11771
  }, this.silenceMS);
11721
11772
  }
11722
11773
  }, {
@@ -11738,21 +11789,21 @@ var na = /*#__PURE__*/function () {
11738
11789
  }();
11739
11790
  var Tt = /*#__PURE__*/function (_Lt) {
11740
11791
  function Tt(e, t, i) {
11741
- var _this56;
11792
+ var _this57;
11742
11793
  _classCallCheck(this, Tt);
11743
11794
  var o;
11744
- _this56 = _callSuper(this, Tt, [_typeof(e.speechToText) == "object" ? (o = e.speechToText) == null ? void 0 : o.button : {}]);
11745
- var _this56$processConfig = _this56.processConfiguration(t, e.speechToText),
11746
- n = _this56$processConfig.serviceName,
11747
- r = _this56$processConfig.processedConfig;
11748
- if (_this56._addErrorMessage = i, n === "webspeech" && !Kt.isWebSpeechSupported()) _this56.changeToUnsupported();else {
11795
+ _this57 = _callSuper(this, Tt, [_typeof(e.speechToText) == "object" ? (o = e.speechToText) == null ? void 0 : o.button : {}]);
11796
+ var _this57$processConfig = _this57.processConfiguration(t, e.speechToText),
11797
+ n = _this57$processConfig.serviceName,
11798
+ r = _this57$processConfig.processedConfig;
11799
+ if (_this57._addErrorMessage = i, n === "webspeech" && !Kt.isWebSpeechSupported()) _this57.changeToUnsupported();else {
11749
11800
  var a = !e.textInput || !e.textInput.disabled;
11750
- _this56.elementRef.onclick = _this56.buttonClick.bind(_this56, t, a, n, r);
11801
+ _this57.elementRef.onclick = _this57.buttonClick.bind(_this57, t, a, n, r);
11751
11802
  }
11752
11803
  setTimeout(function () {
11753
- _this56._validationHandler = e._validationHandler;
11804
+ _this57._validationHandler = e._validationHandler;
11754
11805
  });
11755
- return _this56;
11806
+ return _this57;
11756
11807
  }
11757
11808
  // prettier-ignore
11758
11809
  _inherits(Tt, _Lt);
@@ -11787,26 +11838,26 @@ var Tt = /*#__PURE__*/function (_Lt) {
11787
11838
  }, {
11788
11839
  key: "buttonClick",
11789
11840
  value: function buttonClick(e, t, i, n) {
11790
- var _this57 = this;
11841
+ var _this58 = this;
11791
11842
  e.removeTextIfPlaceholder(), Kt.toggle(i, _objectSpread({
11792
11843
  insertInCursorLocation: !1,
11793
11844
  element: t ? e.inputElementRef : void 0,
11794
11845
  onError: function onError() {
11795
11846
  var r;
11796
- _this57.onError(), (r = _this57._silenceSubmit) == null || r.clearSilenceTimeout();
11847
+ _this58.onError(), (r = _this58._silenceSubmit) == null || r.clearSilenceTimeout();
11797
11848
  },
11798
11849
  onStart: this.changeToActive.bind(this),
11799
11850
  onStop: function onStop() {
11800
11851
  var r, o;
11801
- (r = _this57._validationHandler) == null || r.call(_this57), (o = _this57._silenceSubmit) == null || o.clearSilenceTimeout(), _this57.changeToDefault();
11852
+ (r = _this58._validationHandler) == null || r.call(_this58), (o = _this58._silenceSubmit) == null || o.clearSilenceTimeout(), _this58.changeToDefault();
11802
11853
  },
11803
11854
  onPauseTrigger: function onPauseTrigger(r) {
11804
11855
  var o;
11805
- (o = _this57._silenceSubmit) == null || o.onPause(r, e, _this57.elementRef.onclick);
11856
+ (o = _this58._silenceSubmit) == null || o.onPause(r, e, _this58.elementRef.onclick);
11806
11857
  },
11807
11858
  onResult: function onResult(r, o) {
11808
11859
  var a, l;
11809
- o && ((a = _this57._validationHandler) == null || a.call(_this57)), (l = _this57._silenceSubmit) == null || l.resetSilenceTimeout(e, _this57.elementRef.onclick);
11860
+ o && ((a = _this58._validationHandler) == null || a.call(_this58)), (l = _this58._silenceSubmit) == null || l.resetSilenceTimeout(e, _this58.elementRef.onclick);
11810
11861
  },
11811
11862
  onCommandModeTrigger: this.onCommandModeTrigger.bind(this)
11812
11863
  }, n));
@@ -11841,10 +11892,10 @@ var Ot = Tt;
11841
11892
  var Ee = /*#__PURE__*/function () {
11842
11893
  // prettier-ignore
11843
11894
  function Ee(e, t, i, n) {
11844
- var _this58 = this;
11895
+ var _this59 = this;
11845
11896
  _classCallCheck(this, Ee);
11846
11897
  this._attachments = [], this._fileCountLimit = 99, this._acceptedFormat = "", t.maxNumberOfFiles && (this._fileCountLimit = t.maxNumberOfFiles), this._toggleContainerDisplay = i, this._fileAttachmentsContainerRef = n, t.acceptedFormats && (this._acceptedFormat = t.acceptedFormats), setTimeout(function () {
11847
- _this58._validationHandler = e._validationHandler;
11898
+ _this59._validationHandler = e._validationHandler;
11848
11899
  });
11849
11900
  }
11850
11901
  return _createClass(Ee, [{
@@ -11983,12 +12034,12 @@ var sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
11983
12034
  return _createClass(be, [{
11984
12035
  key: "createTimer",
11985
12036
  value: function createTimer(e, t) {
11986
- var _this59 = this;
12037
+ var _this60 = this;
11987
12038
  var i = 0;
11988
12039
  var n = t !== void 0 && t < be.TIMER_LIMIT_S ? t : be.TIMER_LIMIT_S;
11989
12040
  return setInterval(function () {
11990
12041
  var a;
11991
- i += 1, i === n && ((a = _this59.stopPlaceholderCallback) == null || a.call(_this59), _this59.clearTimer()), i === 600 && e.classList.add("audio-placeholder-text-4-digits");
12042
+ i += 1, i === n && ((a = _this60.stopPlaceholderCallback) == null || a.call(_this60), _this60.clearTimer()), i === 600 && e.classList.add("audio-placeholder-text-4-digits");
11992
12043
  var r = Math.floor(i / 60),
11993
12044
  o = (i % 60).toString().padStart(2, "0");
11994
12045
  e.textContent = "".concat(r, ":").concat(o);
@@ -12008,7 +12059,7 @@ var sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
12008
12059
  }, {
12009
12060
  key: "addPlaceholderAudioAttachmentEvents",
12010
12061
  value: function addPlaceholderAudioAttachmentEvents(e, t, i) {
12011
- var _this60 = this;
12062
+ var _this61 = this;
12012
12063
  var n = function n() {
12013
12064
  return e.replaceChildren(t);
12014
12065
  };
@@ -12019,7 +12070,7 @@ var sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
12019
12070
  e.addEventListener("mouseleave", r);
12020
12071
  var o = function o() {
12021
12072
  var a;
12022
- return (a = _this60.stopPlaceholderCallback) == null ? void 0 : a.call(_this60);
12073
+ return (a = _this61.stopPlaceholderCallback) == null ? void 0 : a.call(_this61);
12023
12074
  };
12024
12075
  e.addEventListener("click", o);
12025
12076
  }
@@ -12136,33 +12187,33 @@ var zt = /*#__PURE__*/function () {
12136
12187
  }, {
12137
12188
  key: "completePlaceholders",
12138
12189
  value: function () {
12139
- var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee109() {
12140
- return _regeneratorRuntime().wrap(function _callee109$(_context109) {
12141
- while (1) switch (_context109.prev = _context109.next) {
12190
+ var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee110() {
12191
+ return _regeneratorRuntime().wrap(function _callee110$(_context110) {
12192
+ while (1) switch (_context110.prev = _context110.next) {
12142
12193
  case 0:
12143
- _context109.next = 2;
12194
+ _context110.next = 2;
12144
12195
  return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
12145
- var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee108(e) {
12196
+ var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee109(e) {
12146
12197
  var t;
12147
- return _regeneratorRuntime().wrap(function _callee108$(_context108) {
12148
- while (1) switch (_context108.prev = _context108.next) {
12198
+ return _regeneratorRuntime().wrap(function _callee109$(_context109) {
12199
+ while (1) switch (_context109.prev = _context109.next) {
12149
12200
  case 0:
12150
- return _context108.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
12201
+ return _context109.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
12151
12202
  case 1:
12152
12203
  case "end":
12153
- return _context108.stop();
12204
+ return _context109.stop();
12154
12205
  }
12155
- }, _callee108);
12206
+ }, _callee109);
12156
12207
  }));
12157
- return function (_x193) {
12208
+ return function (_x194) {
12158
12209
  return _ref14.apply(this, arguments);
12159
12210
  };
12160
12211
  }()));
12161
12212
  case 2:
12162
12213
  case "end":
12163
- return _context109.stop();
12214
+ return _context110.stop();
12164
12215
  }
12165
- }, _callee109, this);
12216
+ }, _callee110, this);
12166
12217
  }));
12167
12218
  function completePlaceholders() {
12168
12219
  return _completePlaceholders.apply(this, arguments);
@@ -12211,20 +12262,20 @@ var le = /*#__PURE__*/function () {
12211
12262
  }, {
12212
12263
  key: "addButtons",
12213
12264
  value: function addButtons() {
12214
- var _this61 = this;
12265
+ var _this62 = this;
12215
12266
  for (var _len2 = arguments.length, e = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
12216
12267
  e[_key2] = arguments[_key2];
12217
12268
  }
12218
12269
  e.forEach(function (t) {
12219
- return _this61._buttonPanel.appendChild(t);
12270
+ return _this62._buttonPanel.appendChild(t);
12220
12271
  });
12221
12272
  }
12222
12273
  }, {
12223
12274
  key: "close",
12224
12275
  value: function close() {
12225
- var _this62 = this;
12276
+ var _this63 = this;
12226
12277
  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 () {
12227
- _this62._elementRef.style.display = "none", _this62._backgroundPanelRef.style.display = "none";
12278
+ _this63._elementRef.style.display = "none", _this63._backgroundPanelRef.style.display = "none";
12228
12279
  }, le.MODAL_CLOSE_TIMEOUT_MS);
12229
12280
  }
12230
12281
  }, {
@@ -12240,10 +12291,10 @@ var le = /*#__PURE__*/function () {
12240
12291
  }, {
12241
12292
  key: "addCloseButton",
12242
12293
  value: function addCloseButton(e, t, i) {
12243
- var _this63 = this;
12294
+ var _this64 = this;
12244
12295
  var n = t ? le.createSVGButton(e) : le.createTextButton(e);
12245
12296
  return this.addButtons(n), n.onclick = function () {
12246
- _this63.close(), setTimeout(function () {
12297
+ _this64.close(), setTimeout(function () {
12247
12298
  i == null || i();
12248
12299
  }, 140);
12249
12300
  }, n;
@@ -12314,13 +12365,13 @@ var ze = le;
12314
12365
  var xt = /*#__PURE__*/function (_Bt3) {
12315
12366
  // prettier-ignore
12316
12367
  function xt(e, t, i, n, r, o) {
12317
- var _this64;
12368
+ var _this65;
12318
12369
  _classCallCheck(this, xt);
12319
12370
  var l, c, d, h, u, f;
12320
- _this64 = _callSuper(this, xt, [xt.createButtonElement(), (l = i.button) == null ? void 0 : l.position, i.button, o]);
12321
- var a = _this64.createInnerElements(n, r, _this64._customStyles);
12322
- _this64._inputElement = xt.createInputElement((c = i == null ? void 0 : i.files) == null ? void 0 : c.acceptedFormats), _this64.addClickEvent(e, i), _this64.elementRef.replaceChildren(a.styles), _this64.reapplyStateStyle("styles"), _this64._fileAttachmentsType = t, _this64._openModalOnce = ((h = (d = i.files) == null ? void 0 : d.infoModal) == null ? void 0 : h.openModalOnce) === !1 || (f = (u = i.files) == null ? void 0 : u.infoModal) == null ? void 0 : f.openModalOnce;
12323
- return _this64;
12371
+ _this65 = _callSuper(this, xt, [xt.createButtonElement(), (l = i.button) == null ? void 0 : l.position, i.button, o]);
12372
+ var a = _this65.createInnerElements(n, r, _this65._customStyles);
12373
+ _this65._inputElement = xt.createInputElement((c = i == null ? void 0 : i.files) == null ? void 0 : c.acceptedFormats), _this65.addClickEvent(e, i), _this65.elementRef.replaceChildren(a.styles), _this65.reapplyStateStyle("styles"), _this65._fileAttachmentsType = t, _this65._openModalOnce = ((h = (d = i.files) == null ? void 0 : d.infoModal) == null ? void 0 : h.openModalOnce) === !1 || (f = (u = i.files) == null ? void 0 : u.infoModal) == null ? void 0 : f.openModalOnce;
12374
+ return _this65;
12324
12375
  }
12325
12376
  _inherits(xt, _Bt3);
12326
12377
  return _createClass(xt, [{
@@ -12447,26 +12498,26 @@ var Fe = /*#__PURE__*/function () {
12447
12498
  }, {
12448
12499
  key: "useValidationFunc",
12449
12500
  value: function () {
12450
- var _useValidationFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee110(e, t, i, n) {
12501
+ var _useValidationFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee111(e, t, i, n) {
12451
12502
  var r, o, a, l;
12452
- return _regeneratorRuntime().wrap(function _callee110$(_context110) {
12453
- while (1) switch (_context110.prev = _context110.next) {
12503
+ return _regeneratorRuntime().wrap(function _callee111$(_context111) {
12504
+ while (1) switch (_context111.prev = _context111.next) {
12454
12505
  case 0:
12455
12506
  r = t.inputElementRef, o = r.classList.contains("text-input-placeholder") ? "" : r.textContent;
12456
- _context110.next = 3;
12507
+ _context111.next = 3;
12457
12508
  return i.completePlaceholders();
12458
12509
  case 3:
12459
12510
  a = i.getAllFileData(), l = a == null ? void 0 : a.map(function (c) {
12460
12511
  return c.file;
12461
12512
  });
12462
- return _context110.abrupt("return", Fe.validate(e, n, o, l));
12513
+ return _context111.abrupt("return", Fe.validate(e, n, o, l));
12463
12514
  case 5:
12464
12515
  case "end":
12465
- return _context110.stop();
12516
+ return _context111.stop();
12466
12517
  }
12467
- }, _callee110);
12518
+ }, _callee111);
12468
12519
  }));
12469
- function useValidationFunc(_x194, _x195, _x196, _x197) {
12520
+ function useValidationFunc(_x195, _x196, _x197, _x198) {
12470
12521
  return _useValidationFunc.apply(this, arguments);
12471
12522
  }
12472
12523
  return useValidationFunc;
@@ -12474,22 +12525,22 @@ var Fe = /*#__PURE__*/function () {
12474
12525
  }, {
12475
12526
  key: "useValidationFuncProgrammatic",
12476
12527
  value: function () {
12477
- var _useValidationFuncProgrammatic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee111(e, t, i) {
12528
+ var _useValidationFuncProgrammatic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee112(e, t, i) {
12478
12529
  var r, n;
12479
- return _regeneratorRuntime().wrap(function _callee111$(_context111) {
12480
- while (1) switch (_context111.prev = _context111.next) {
12530
+ return _regeneratorRuntime().wrap(function _callee112$(_context112) {
12531
+ while (1) switch (_context112.prev = _context112.next) {
12481
12532
  case 0:
12482
12533
  n = (r = t.files) == null ? void 0 : r.map(function (o) {
12483
12534
  return o.file;
12484
12535
  });
12485
- return _context111.abrupt("return", Fe.validate(e, i, t.text, n, !0));
12536
+ return _context112.abrupt("return", Fe.validate(e, i, t.text, n, !0));
12486
12537
  case 2:
12487
12538
  case "end":
12488
- return _context111.stop();
12539
+ return _context112.stop();
12489
12540
  }
12490
- }, _callee111);
12541
+ }, _callee112);
12491
12542
  }));
12492
- function useValidationFuncProgrammatic(_x198, _x199, _x200) {
12543
+ function useValidationFuncProgrammatic(_x199, _x200, _x201) {
12493
12544
  return _useValidationFuncProgrammatic.apply(this, arguments);
12494
12545
  }
12495
12546
  return useValidationFuncProgrammatic;
@@ -12505,26 +12556,26 @@ var Fe = /*#__PURE__*/function () {
12505
12556
  value: function attach(e, t, i, n, r) {
12506
12557
  var o = e.validateInput || de.processValidateInput(e);
12507
12558
  e._validationHandler = /*#__PURE__*/function () {
12508
- var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee112(a) {
12559
+ var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee113(a) {
12509
12560
  var l;
12510
- return _regeneratorRuntime().wrap(function _callee112$(_context112) {
12511
- while (1) switch (_context112.prev = _context112.next) {
12561
+ return _regeneratorRuntime().wrap(function _callee113$(_context113) {
12562
+ while (1) switch (_context113.prev = _context113.next) {
12512
12563
  case 0:
12513
12564
  if (!(r.status.loadingActive || r.status.requestInProgress || t.isSubmitProgrammaticallyDisabled === !0 || !Fe.validateWebsocket(t, r))) {
12514
- _context112.next = 2;
12565
+ _context113.next = 2;
12515
12566
  break;
12516
12567
  }
12517
- return _context112.abrupt("return", !1);
12568
+ return _context113.abrupt("return", !1);
12518
12569
  case 2:
12519
12570
  l = o || t.canSendMessage;
12520
- return _context112.abrupt("return", l ? a ? Fe.useValidationFuncProgrammatic(l, a, r) : Fe.useValidationFunc(l, i, n, r) : null);
12571
+ return _context113.abrupt("return", l ? a ? Fe.useValidationFuncProgrammatic(l, a, r) : Fe.useValidationFunc(l, i, n, r) : null);
12521
12572
  case 4:
12522
12573
  case "end":
12523
- return _context112.stop();
12574
+ return _context113.stop();
12524
12575
  }
12525
- }, _callee112);
12576
+ }, _callee113);
12526
12577
  }));
12527
- return function (_x201) {
12578
+ return function (_x202) {
12528
12579
  return _ref15.apply(this, arguments);
12529
12580
  };
12530
12581
  }();
@@ -12548,11 +12599,11 @@ var ds = /*#__PURE__*/function () {
12548
12599
  }();
12549
12600
  var oa = /*#__PURE__*/function (_Lt2) {
12550
12601
  function oa(e, t) {
12551
- var _this65;
12602
+ var _this66;
12552
12603
  _classCallCheck(this, oa);
12553
12604
  var i, n;
12554
- _this65 = _callSuper(this, oa, [t.button]), _this65._waitingForBrowserApproval = !1, _this65._audioType = e, _this65._extension = ((i = t.files) == null ? void 0 : i.format) || "mp3", _this65._maxDurationSeconds = (n = t.files) == null ? void 0 : n.maxDurationSeconds, _this65.elementRef.onclick = _this65.buttonClick.bind(_assertThisInitialized(_this65));
12555
- return _this65;
12605
+ _this66 = _callSuper(this, oa, [t.button]), _this66._waitingForBrowserApproval = !1, _this66._audioType = e, _this66._extension = ((i = t.files) == null ? void 0 : i.format) || "mp3", _this66._maxDurationSeconds = (n = t.files) == null ? void 0 : n.maxDurationSeconds, _this66.elementRef.onclick = _this66.buttonClick.bind(_assertThisInitialized(_this66));
12606
+ return _this66;
12556
12607
  }
12557
12608
  _inherits(oa, _Lt2);
12558
12609
  return _createClass(oa, [{
@@ -12563,10 +12614,10 @@ var oa = /*#__PURE__*/function (_Lt2) {
12563
12614
  }, {
12564
12615
  key: "stop",
12565
12616
  value: function stop() {
12566
- var _this66 = this;
12617
+ var _this67 = this;
12567
12618
  return new Promise(function (e) {
12568
12619
  var t, i;
12569
- _this66.changeToDefault(), (t = _this66._mediaRecorder) == null || t.stop(), (i = _this66._mediaStream) == null || i.getTracks().forEach(function (n) {
12620
+ _this67.changeToDefault(), (t = _this67._mediaRecorder) == null || t.stop(), (i = _this67._mediaStream) == null || i.getTracks().forEach(function (n) {
12570
12621
  return n.stop();
12571
12622
  }), setTimeout(function () {
12572
12623
  e();
@@ -12576,23 +12627,23 @@ var oa = /*#__PURE__*/function (_Lt2) {
12576
12627
  }, {
12577
12628
  key: "record",
12578
12629
  value: function record() {
12579
- var _this67 = this;
12630
+ var _this68 = this;
12580
12631
  navigator.mediaDevices.getUserMedia({
12581
12632
  audio: !0
12582
12633
  }).then(function (e) {
12583
- _this67.changeToActive(), _this67._mediaRecorder = new MediaRecorder(e), _this67._audioType.addPlaceholderAttachment(_this67.stop.bind(_this67), _this67._maxDurationSeconds), _this67._mediaStream = e, _this67._mediaRecorder.addEventListener("dataavailable", function (t) {
12584
- _this67.createFile(t);
12585
- }), _this67._mediaRecorder.start();
12634
+ _this68.changeToActive(), _this68._mediaRecorder = new MediaRecorder(e), _this68._audioType.addPlaceholderAttachment(_this68.stop.bind(_this68), _this68._maxDurationSeconds), _this68._mediaStream = e, _this68._mediaRecorder.addEventListener("dataavailable", function (t) {
12635
+ _this68.createFile(t);
12636
+ }), _this68._mediaRecorder.start();
12586
12637
  })["catch"](function (e) {
12587
- console.error(e), _this67.stop();
12638
+ console.error(e), _this68.stop();
12588
12639
  })["finally"](function () {
12589
- _this67._waitingForBrowserApproval = !1;
12640
+ _this68._waitingForBrowserApproval = !1;
12590
12641
  });
12591
12642
  }
12592
12643
  }, {
12593
12644
  key: "createFile",
12594
12645
  value: function createFile(e) {
12595
- var _this68 = this;
12646
+ var _this69 = this;
12596
12647
  var t = new Blob([e.data], {
12597
12648
  type: "audio/".concat(this._extension)
12598
12649
  }),
@@ -12602,7 +12653,7 @@ var oa = /*#__PURE__*/function (_Lt2) {
12602
12653
  }),
12603
12654
  r = new FileReader();
12604
12655
  r.readAsDataURL(n), r.onload = function (o) {
12605
- _this68._audioType.completePlaceholderAttachment(n, o.target.result);
12656
+ _this69._audioType.completePlaceholderAttachment(n, o.target.result);
12606
12657
  };
12607
12658
  }
12608
12659
  }]);
@@ -12677,19 +12728,19 @@ var Ve = /*#__PURE__*/function () {
12677
12728
  var k = /*#__PURE__*/function (_Bt4) {
12678
12729
  // prettier-ignore
12679
12730
  function k(e, t, i, n, r, o) {
12680
- var _this69;
12731
+ var _this70;
12681
12732
  _classCallCheck(this, k);
12682
12733
  var a = Ve.process(e.submitButtonStyles);
12683
- _this69 = _callSuper(this, k, [k.createButtonContainerElement(), a == null ? void 0 : a.position, a]), _this69._isSVGLoadingIconOverriden = !1, _this69.status = {
12734
+ _this70 = _callSuper(this, k, [k.createButtonContainerElement(), a == null ? void 0 : a.position, a]), _this70._isSVGLoadingIconOverriden = !1, _this70.status = {
12684
12735
  requestInProgress: !1,
12685
12736
  loadingActive: !1
12686
- }, _this69._messages = i, _this69._inputElementRef = t, _this69._fileAttachments = r, _this69._innerElements = _this69.createInnerElements(), _this69._abortStream = new AbortController(), _this69._stopClicked = {
12737
+ }, _this70._messages = i, _this70._inputElementRef = t, _this70._fileAttachments = r, _this70._innerElements = _this70.createInnerElements(), _this70._abortStream = new AbortController(), _this70._stopClicked = {
12687
12738
  listener: function listener() {}
12688
- }, _this69._serviceIO = n, _this69._alwaysEnabled = !!(a != null && a.alwaysEnabled), e.disableSubmitButton = _this69.disableSubmitButton.bind(_assertThisInitialized(_this69), n), _this69.attemptOverwriteLoadingStyle(e), o.microphone && _this69.setUpSpeechToText(o.microphone.button, e.speechToText), setTimeout(function () {
12739
+ }, _this70._serviceIO = n, _this70._alwaysEnabled = !!(a != null && a.alwaysEnabled), e.disableSubmitButton = _this70.disableSubmitButton.bind(_assertThisInitialized(_this70), n), _this70.attemptOverwriteLoadingStyle(e), o.microphone && _this70.setUpSpeechToText(o.microphone.button, e.speechToText), setTimeout(function () {
12689
12740
  var l;
12690
- _this69._validationHandler = e._validationHandler, _this69.assignHandlers(_this69._validationHandler), (l = _this69._validationHandler) == null || l.call(_assertThisInitialized(_this69));
12741
+ _this70._validationHandler = e._validationHandler, _this70.assignHandlers(_this70._validationHandler), (l = _this70._validationHandler) == null || l.call(_assertThisInitialized(_this70));
12691
12742
  });
12692
- return _this69;
12743
+ return _this70;
12693
12744
  }
12694
12745
  _inherits(k, _Bt4);
12695
12746
  return _createClass(k, [{
@@ -12710,7 +12761,7 @@ var k = /*#__PURE__*/function (_Bt4) {
12710
12761
  }, {
12711
12762
  key: "createCustomElements",
12712
12763
  value: function createCustomElements() {
12713
- var _this70 = this;
12764
+ var _this71 = this;
12714
12765
  var e = J.createSpecificStateElement(this.elementRef, "submit", this._customStyles),
12715
12766
  t = {
12716
12767
  loading: void 0,
@@ -12718,7 +12769,7 @@ var k = /*#__PURE__*/function (_Bt4) {
12718
12769
  };
12719
12770
  return Object.keys(t).forEach(function (i) {
12720
12771
  var n = i,
12721
- r = J.createCustomElement(n, _this70._customStyles);
12772
+ r = J.createCustomElement(n, _this71._customStyles);
12722
12773
  r && (t[n] = r);
12723
12774
  }), t.submit = e, t;
12724
12775
  }
@@ -12764,12 +12815,12 @@ var k = /*#__PURE__*/function (_Bt4) {
12764
12815
  }, {
12765
12816
  key: "submitFromInput",
12766
12817
  value: function () {
12767
- var _submitFromInput = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee113() {
12818
+ var _submitFromInput = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee114() {
12768
12819
  var t, e, _i22;
12769
- return _regeneratorRuntime().wrap(function _callee113$(_context113) {
12770
- while (1) switch (_context113.prev = _context113.next) {
12820
+ return _regeneratorRuntime().wrap(function _callee114$(_context114) {
12821
+ while (1) switch (_context114.prev = _context114.next) {
12771
12822
  case 0:
12772
- _context113.next = 2;
12823
+ _context114.next = 2;
12773
12824
  return this._fileAttachments.completePlaceholders();
12774
12825
  case 2:
12775
12826
  e = this._fileAttachments.getAllFileData();
@@ -12785,9 +12836,9 @@ var k = /*#__PURE__*/function (_Bt4) {
12785
12836
  }
12786
12837
  case 4:
12787
12838
  case "end":
12788
- return _context113.stop();
12839
+ return _context114.stop();
12789
12840
  }
12790
- }, _callee113, this);
12841
+ }, _callee114, this);
12791
12842
  }));
12792
12843
  function submitFromInput() {
12793
12844
  return _submitFromInput.apply(this, arguments);
@@ -12797,11 +12848,11 @@ var k = /*#__PURE__*/function (_Bt4) {
12797
12848
  }, {
12798
12849
  key: "programmaticSubmit",
12799
12850
  value: function () {
12800
- var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee114(e) {
12801
- var _this71 = this;
12851
+ var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee115(e) {
12852
+ var _this72 = this;
12802
12853
  var t;
12803
- return _regeneratorRuntime().wrap(function _callee114$(_context114) {
12804
- while (1) switch (_context114.prev = _context114.next) {
12854
+ return _regeneratorRuntime().wrap(function _callee115$(_context115) {
12855
+ while (1) switch (_context115.prev = _context115.next) {
12805
12856
  case 0:
12806
12857
  typeof e == "string" && (e = de.processSubmitUserMessage(e));
12807
12858
  t = {
@@ -12813,15 +12864,15 @@ var k = /*#__PURE__*/function (_Bt4) {
12813
12864
  type: Ee.getTypeFromBlob(i)
12814
12865
  };
12815
12866
  })), setTimeout(function () {
12816
- return _this71.attemptSubmit(t, !0);
12867
+ return _this72.attemptSubmit(t, !0);
12817
12868
  });
12818
12869
  case 3:
12819
12870
  case "end":
12820
- return _context114.stop();
12871
+ return _context115.stop();
12821
12872
  }
12822
- }, _callee114);
12873
+ }, _callee115);
12823
12874
  }));
12824
- function programmaticSubmit(_x202) {
12875
+ function programmaticSubmit(_x203) {
12825
12876
  return _programmaticSubmit.apply(this, arguments);
12826
12877
  }
12827
12878
  return programmaticSubmit;
@@ -12829,31 +12880,31 @@ var k = /*#__PURE__*/function (_Bt4) {
12829
12880
  }, {
12830
12881
  key: "attemptSubmit",
12831
12882
  value: function () {
12832
- var _attemptSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee115(e) {
12883
+ var _attemptSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee116(e) {
12833
12884
  var t,
12834
12885
  r,
12835
12886
  o,
12836
12887
  a,
12837
12888
  i,
12838
12889
  n,
12839
- _args115 = arguments;
12840
- return _regeneratorRuntime().wrap(function _callee115$(_context115) {
12841
- while (1) switch (_context115.prev = _context115.next) {
12890
+ _args116 = arguments;
12891
+ return _regeneratorRuntime().wrap(function _callee116$(_context116) {
12892
+ while (1) switch (_context116.prev = _context116.next) {
12842
12893
  case 0:
12843
- t = _args115.length > 1 && _args115[1] !== undefined ? _args115[1] : !1;
12844
- _context115.next = 3;
12894
+ t = _args116.length > 1 && _args116[1] !== undefined ? _args116[1] : !1;
12895
+ _context116.next = 3;
12845
12896
  return (r = this._validationHandler) == null ? void 0 : r.call(this, t ? e : void 0);
12846
12897
  case 3:
12847
- _context115.t0 = _context115.sent;
12848
- _context115.t1 = !1;
12849
- if (!(_context115.t0 === _context115.t1)) {
12850
- _context115.next = 7;
12898
+ _context116.t0 = _context116.sent;
12899
+ _context116.t1 = !1;
12900
+ if (!(_context116.t0 === _context116.t1)) {
12901
+ _context116.next = 7;
12851
12902
  break;
12852
12903
  }
12853
- return _context115.abrupt("return");
12904
+ return _context116.abrupt("return");
12854
12905
  case 7:
12855
12906
  this.changeToLoadingIcon();
12856
- _context115.next = 10;
12907
+ _context116.next = 10;
12857
12908
  return this.addNewMessage(e);
12858
12909
  case 10:
12859
12910
  this._serviceIO.isWebModel() || this._messages.addLoadingMessage();
@@ -12864,17 +12915,17 @@ var k = /*#__PURE__*/function (_Bt4) {
12864
12915
  text: e.text === "" ? void 0 : e.text,
12865
12916
  files: i
12866
12917
  };
12867
- _context115.next = 15;
12918
+ _context116.next = 15;
12868
12919
  return this._serviceIO.callAPI(n, this._messages);
12869
12920
  case 15:
12870
12921
  (a = this._fileAttachments) == null || a.removeAllFiles();
12871
12922
  case 16:
12872
12923
  case "end":
12873
- return _context115.stop();
12924
+ return _context116.stop();
12874
12925
  }
12875
- }, _callee115, this);
12926
+ }, _callee116, this);
12876
12927
  }));
12877
- function attemptSubmit(_x203) {
12928
+ function attemptSubmit(_x204) {
12878
12929
  return _attemptSubmit.apply(this, arguments);
12879
12930
  }
12880
12931
  return attemptSubmit;
@@ -12882,35 +12933,35 @@ var k = /*#__PURE__*/function (_Bt4) {
12882
12933
  }, {
12883
12934
  key: "addNewMessage",
12884
12935
  value: function () {
12885
- var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee116(_ref16) {
12936
+ var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee117(_ref16) {
12886
12937
  var e, t, i;
12887
- return _regeneratorRuntime().wrap(function _callee116$(_context116) {
12888
- while (1) switch (_context116.prev = _context116.next) {
12938
+ return _regeneratorRuntime().wrap(function _callee117$(_context117) {
12939
+ while (1) switch (_context117.prev = _context117.next) {
12889
12940
  case 0:
12890
12941
  e = _ref16.text, t = _ref16.files;
12891
12942
  i = {
12892
12943
  role: b.USER_ROLE
12893
12944
  };
12894
12945
  e && (i.text = e);
12895
- _context116.t0 = t;
12896
- if (!_context116.t0) {
12897
- _context116.next = 8;
12946
+ _context117.t0 = t;
12947
+ if (!_context117.t0) {
12948
+ _context117.next = 8;
12898
12949
  break;
12899
12950
  }
12900
- _context116.next = 7;
12951
+ _context117.next = 7;
12901
12952
  return this._messages.addMultipleFiles(t);
12902
12953
  case 7:
12903
- i.files = _context116.sent;
12954
+ i.files = _context117.sent;
12904
12955
  case 8:
12905
12956
  this._serviceIO.sessionId && (i._sessionId = this._serviceIO.sessionId);
12906
12957
  Object.keys(i).length > 0 && this._messages.addNewMessage(i);
12907
12958
  case 10:
12908
12959
  case "end":
12909
- return _context116.stop();
12960
+ return _context117.stop();
12910
12961
  }
12911
- }, _callee116, this);
12962
+ }, _callee117, this);
12912
12963
  }));
12913
- function addNewMessage(_x204) {
12964
+ function addNewMessage(_x205) {
12914
12965
  return _addNewMessage.apply(this, arguments);
12915
12966
  }
12916
12967
  return addNewMessage;
@@ -12935,10 +12986,10 @@ var k = /*#__PURE__*/function (_Bt4) {
12935
12986
  }, {
12936
12987
  key: "changeToSubmitIcon",
12937
12988
  value: function changeToSubmitIcon() {
12938
- var _this72 = this;
12989
+ var _this73 = this;
12939
12990
  this.elementRef.classList.contains(k.SUBMIT_CLASS) || (this.elementRef.classList.remove(k.LOADING_CLASS, k.DISABLED_CLASS), this.elementRef.classList.add(k.SUBMIT_CLASS), this.elementRef.replaceChildren(this._innerElements.submit), Ve.resetSubmit(this, this.status.loadingActive), this.elementRef.onclick = function () {
12940
12991
  var e;
12941
- _this72.submitFromInput(), (e = _this72._microphoneButton) != null && e.isActive && Ot.toggleSpeechAfterSubmit(_this72._microphoneButton.elementRef, !!_this72._stopSTTAfterSubmit);
12992
+ _this73.submitFromInput(), (e = _this73._microphoneButton) != null && e.isActive && Ot.toggleSpeechAfterSubmit(_this73._microphoneButton.elementRef, !!_this73._stopSTTAfterSubmit);
12942
12993
  });
12943
12994
  }
12944
12995
  // called every time when user triggers an input via ValidationHandler - hence use class to check if not already present
@@ -12989,14 +13040,14 @@ var la = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
12989
13040
  var bn = /*#__PURE__*/function (_ze) {
12990
13041
  // prettier-ignore
12991
13042
  function bn(e, t, i, n) {
12992
- var _this73;
13043
+ var _this74;
12993
13044
  _classCallCheck(this, bn);
12994
- _this73 = _callSuper(this, bn, [e, ["modal-content", "modal-camera-content"], i]), _this73._stopped = !1, _this73._format = "image/png", _this73._canvas = document.createElement("canvas"), _this73._canvas.classList.add("camera-modal-canvas");
12995
- var _this73$addButtonsAnd = _this73.addButtonsAndTheirEvents(t),
12996
- r = _this73$addButtonsAnd.captureButton,
12997
- o = _this73$addButtonsAnd.submitButton;
12998
- _this73._captureButton = r, _this73._submitButton = o, _this73._captureIcon = _this73._captureButton.children[0], _this73._refreshIcon = X.createSVGElement(la), _this73._refreshIcon.classList.add("modal-svg-button-icon", "modal-svg-refresh-icon"), (n == null ? void 0 : n.format) === "jpeg" && (_this73._format = "image/jpeg"), n != null && n.dimensions && (_this73._dimensions = n.dimensions), _this73._contentRef.appendChild(_this73._canvas), _this73.extensionCloseCallback = _this73.stop;
12999
- return _this73;
13045
+ _this74 = _callSuper(this, bn, [e, ["modal-content", "modal-camera-content"], i]), _this74._stopped = !1, _this74._format = "image/png", _this74._canvas = document.createElement("canvas"), _this74._canvas.classList.add("camera-modal-canvas");
13046
+ var _this74$addButtonsAnd = _this74.addButtonsAndTheirEvents(t),
13047
+ r = _this74$addButtonsAnd.captureButton,
13048
+ o = _this74$addButtonsAnd.submitButton;
13049
+ _this74._captureButton = r, _this74._submitButton = o, _this74._captureIcon = _this74._captureButton.children[0], _this74._refreshIcon = X.createSVGElement(la), _this74._refreshIcon.classList.add("modal-svg-button-icon", "modal-svg-refresh-icon"), (n == null ? void 0 : n.format) === "jpeg" && (_this74._format = "image/jpeg"), n != null && n.dimensions && (_this74._dimensions = n.dimensions), _this74._contentRef.appendChild(_this74._canvas), _this74.extensionCloseCallback = _this74.stop;
13050
+ return _this74;
13000
13051
  }
13001
13052
  _inherits(bn, _ze);
13002
13053
  return _createClass(bn, [{
@@ -13016,38 +13067,38 @@ var bn = /*#__PURE__*/function (_ze) {
13016
13067
  }, {
13017
13068
  key: "addButtonEvents",
13018
13069
  value: function addButtonEvents(e, t, i, n) {
13019
- var _this74 = this;
13070
+ var _this75 = this;
13020
13071
  e.onclick = function () {
13021
- _this74.capture();
13072
+ _this75.capture();
13022
13073
  }, t.addEventListener("click", this.stop.bind(this)), i.onclick = function () {
13023
- var r = _this74.getFile();
13024
- r && zt.addFilesToType([r], [n]), _this74.stop(), _this74.close();
13074
+ var r = _this75.getFile();
13075
+ r && zt.addFilesToType([r], [n]), _this75.stop(), _this75.close();
13025
13076
  };
13026
13077
  }
13027
13078
  }, {
13028
13079
  key: "stop",
13029
13080
  value: function stop() {
13030
- var _this75 = this;
13081
+ var _this76 = this;
13031
13082
  this._mediaStream && this._mediaStream.getTracks().forEach(function (e) {
13032
13083
  return e.stop();
13033
13084
  }), this._stopped = !0, setTimeout(function () {
13034
- _this75._captureButton.replaceChildren(_this75._captureIcon), _this75._captureButton.classList.replace("modal-svg-refresh-button", "modal-svg-camera-button");
13035
- var e = _this75._canvas.getContext("2d");
13036
- e == null || e.clearRect(0, 0, _this75._canvas.width, _this75._canvas.height);
13085
+ _this76._captureButton.replaceChildren(_this76._captureIcon), _this76._captureButton.classList.replace("modal-svg-refresh-button", "modal-svg-camera-button");
13086
+ var e = _this76._canvas.getContext("2d");
13087
+ e == null || e.clearRect(0, 0, _this76._canvas.width, _this76._canvas.height);
13037
13088
  }, ze.MODAL_CLOSE_TIMEOUT_MS);
13038
13089
  }
13039
13090
  }, {
13040
13091
  key: "start",
13041
13092
  value: function start() {
13042
- var _this76 = this;
13093
+ var _this77 = this;
13043
13094
  this._dataURL = void 0, this._submitButton.classList.add("modal-svg-submit-disabled"), this._stopped = !1, navigator.mediaDevices.getUserMedia({
13044
13095
  video: this._dimensions || !0
13045
13096
  }).then(function (e) {
13046
- if (_this76._mediaStream = e, !_this76.isOpen()) return _this76.stop();
13097
+ if (_this77._mediaStream = e, !_this77.isOpen()) return _this77.stop();
13047
13098
  var t = document.createElement("video");
13048
- t.srcObject = e, t.play(), requestAnimationFrame(_this76.updateCanvas.bind(_this76, t, _this76._canvas));
13099
+ t.srcObject = e, t.play(), requestAnimationFrame(_this77.updateCanvas.bind(_this77, t, _this77._canvas));
13049
13100
  })["catch"](function (e) {
13050
- console.error(e), _this76.stop(), _this76.close();
13101
+ console.error(e), _this77.stop(), _this77.close();
13051
13102
  });
13052
13103
  }
13053
13104
  }, {
@@ -13102,13 +13153,13 @@ var bn = /*#__PURE__*/function (_ze) {
13102
13153
  var ua = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M29 7h-4.599l-2.401-4h-12l-2.4 4h-4.6c-1 0-3 1-3 2.969v16.031c0 1.657 1.5 3 2.792 3h26.271c1.313 0 2.938-1.406 2.938-2.968v-16.032c0-1-1-3-3-3zM30 26.032c0 0.395-0.639 0.947-0.937 0.969h-26.265c-0.232-0.019-0.797-0.47-0.797-1v-16.031c0-0.634 0.851-0.953 1-0.969h5.732l2.4-4h9.802l1.785 3.030 0.55 0.97h5.731c0.705 0 0.99 0.921 1 1v16.032zM16 10c-3.866 0-7 3.134-7 7s3.134 7 7 7 7-3.134 7-7-3.134-7-7-7zM16 22c-2.757 0-5-2.243-5-5s2.243-5 5-5 5 2.243 5 5-2.243 5-5 5z\"></path>\n</svg>";
13103
13154
  var mi = /*#__PURE__*/function (_Bt5) {
13104
13155
  function mi(e, t, i) {
13105
- var _this77;
13156
+ var _this78;
13106
13157
  _classCallCheck(this, mi);
13107
13158
  var r;
13108
- _this77 = _callSuper(this, mi, [mi.createButtonElement(), (r = i == null ? void 0 : i.button) == null ? void 0 : r.position, (i == null ? void 0 : i.button) || {}, "Photo"]);
13109
- var n = _this77.createInnerElements(_this77._customStyles);
13110
- i && _this77.addClickEvent(e, t, i.modalContainerStyle, i.files), _this77.elementRef.classList.add("upload-file-button"), _this77.elementRef.appendChild(n.styles), _this77.reapplyStateStyle("styles");
13111
- return _this77;
13159
+ _this78 = _callSuper(this, mi, [mi.createButtonElement(), (r = i == null ? void 0 : i.button) == null ? void 0 : r.position, (i == null ? void 0 : i.button) || {}, "Photo"]);
13160
+ var n = _this78.createInnerElements(_this78._customStyles);
13161
+ i && _this78.addClickEvent(e, t, i.modalContainerStyle, i.files), _this78.elementRef.classList.add("upload-file-button"), _this78.elementRef.appendChild(n.styles), _this78.reapplyStateStyle("styles");
13162
+ return _this78;
13112
13163
  }
13113
13164
  _inherits(mi, _Bt5);
13114
13165
  return _createClass(mi, [{
@@ -13250,22 +13301,22 @@ var pa = Object.defineProperty,
13250
13301
  };
13251
13302
  var y = /*#__PURE__*/function (_Xi) {
13252
13303
  function y() {
13253
- var _this78;
13304
+ var _this79;
13254
13305
  _classCallCheck(this, y);
13255
- _this78 = _callSuper(this, y), _this78.getMessages = function () {
13306
+ _this79 = _callSuper(this, y), _this79.getMessages = function () {
13256
13307
  return [];
13257
- }, _this78.submitUserMessage = function () {
13308
+ }, _this79.submitUserMessage = function () {
13258
13309
  return console.warn("submitUserMessage failed - please wait for chat view to render before calling this property.");
13259
- }, _this78.addMessage = function () {
13310
+ }, _this79.addMessage = function () {
13260
13311
  return console.warn("addMessage failed - please wait for chat view to render before calling this property.");
13261
- }, _this78.focusInput = function () {
13262
- return yi.focusFromParentElement(_this78._elementRef);
13263
- }, _this78.refreshMessages = function () {}, _this78.clearMessages = function () {}, _this78.scrollToBottom = function () {}, _this78.disableSubmitButton = function () {}, _this78._hasBeenRendered = !1, _this78._auxiliaryStyleApplied = !1, _this78._elementRef = document.createElement("div"), _this78._elementRef.id = "container", _this78.attachShadow({
13312
+ }, _this79.focusInput = function () {
13313
+ return yi.focusFromParentElement(_this79._elementRef);
13314
+ }, _this79.refreshMessages = function () {}, _this79.clearMessages = function () {}, _this79.scrollToBottom = function () {}, _this79.disableSubmitButton = function () {}, _this79._hasBeenRendered = !1, _this79._auxiliaryStyleApplied = !1, _this79._elementRef = document.createElement("div"), _this79._elementRef.id = "container", _this79.attachShadow({
13264
13315
  mode: "open"
13265
- }).appendChild(_this78._elementRef), bt.apply(fa, _this78.shadowRoot), setTimeout(function () {
13266
- _this78._hasBeenRendered || _this78.onRender();
13316
+ }).appendChild(_this79._elementRef), bt.apply(fa, _this79.shadowRoot), setTimeout(function () {
13317
+ _this79._hasBeenRendered || _this79.onRender();
13267
13318
  }, 20);
13268
- return _this78;
13319
+ return _this79;
13269
13320
  }
13270
13321
  _inherits(y, _Xi);
13271
13322
  return _createClass(y, [{