deep-chat-dev 9.0.198 → 9.0.200
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +5125 -5049
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.d.ts +1 -0
- package/dist/deepChat.d.ts.map +1 -1
- package/dist/deepChat.js +611 -535
- package/dist/services/azure/azureOpenAIAssistantIO.d.ts +2 -0
- package/dist/services/azure/azureOpenAIAssistantIO.d.ts.map +1 -1
- package/dist/services/azure/azureOpenAIChatIO.d.ts.map +1 -1
- package/dist/services/openAI/assistant/openAIAssistantIO.d.ts.map +1 -1
- package/dist/services/openAI/assistant/openAIAssistantIOI.d.ts +6 -4
- package/dist/services/openAI/assistant/openAIAssistantIOI.d.ts.map +1 -1
- package/dist/services/openAI/openAIChatIO.d.ts +2 -2
- package/dist/services/openAI/openAIChatIO.d.ts.map +1 -1
- package/dist/services/utils/messageLimitUtils.d.ts.map +1 -1
- package/dist/types/messagesInternal.d.ts +2 -0
- package/dist/types/messagesInternal.d.ts.map +1 -1
- package/dist/utils/HTTP/stream.d.ts.map +1 -1
- package/dist/utils/demo/demo.d.ts.map +1 -1
- package/dist/views/chat/messages/avatar.d.ts.map +1 -1
- package/dist/views/chat/messages/history/history.d.ts.map +1 -1
- package/dist/views/chat/messages/html/htmlMessages.d.ts +2 -1
- package/dist/views/chat/messages/html/htmlMessages.d.ts.map +1 -1
- package/dist/views/chat/messages/messageUtils.d.ts +4 -3
- package/dist/views/chat/messages/messageUtils.d.ts.map +1 -1
- package/dist/views/chat/messages/messages.d.ts +1 -0
- package/dist/views/chat/messages/messages.d.ts.map +1 -1
- package/dist/views/chat/messages/messagesBase.d.ts +3 -2
- package/dist/views/chat/messages/messagesBase.d.ts.map +1 -1
- package/dist/views/chat/messages/stream/messageStream.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/deepChat.js
CHANGED
@@ -9,6 +9,10 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
9
9
|
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
10
10
|
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
11
11
|
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
12
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
13
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
14
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
15
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
12
16
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
13
17
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
14
18
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
@@ -490,11 +494,11 @@ var Ri = /*#__PURE__*/function () {
|
|
490
494
|
}();
|
491
495
|
Ri.LOAD_VOICES_MS = 200;
|
492
496
|
var bt = Ri;
|
493
|
-
var
|
494
|
-
function
|
495
|
-
_classCallCheck(this,
|
497
|
+
var le = /*#__PURE__*/function () {
|
498
|
+
function le() {
|
499
|
+
_classCallCheck(this, le);
|
496
500
|
}
|
497
|
-
return _createClass(
|
501
|
+
return _createClass(le, null, [{
|
498
502
|
key: "checkForContainerStyles",
|
499
503
|
value: function checkForContainerStyles(e, t) {
|
500
504
|
var i = e.containerStyle;
|
@@ -605,7 +609,7 @@ var ft = /*#__PURE__*/function () {
|
|
605
609
|
}]);
|
606
610
|
}();
|
607
611
|
ft.BUBBLE_CLASS = "deep-chat-loading-message-bubble", ft.DOTS_CONTAINER_CLASS = "deep-chat-loading-message-dots-container";
|
608
|
-
var
|
612
|
+
var Me = ft;
|
609
613
|
var Ln = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3csvg%20fill='%23000000'%20version='1.1'%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%2032%2032'%20xml:space='preserve'%3e%3cpath%20d='M23,30.36H9c-2.404,0-4.36-1.956-4.36-4.36V15c0-2.404,1.956-4.36,4.36-4.36h3.659%20c0.167-1.566,1.415-2.813,2.981-2.981V5.333c-1.131-0.174-2-1.154-2-2.333c0-1.301,1.059-2.36,2.36-2.36%20c1.302,0,2.36,1.059,2.36,2.36c0,1.179-0.869,2.159-2,2.333V7.66c1.566,0.167,2.814,1.415,2.981,2.981H23%20c2.404,0,4.36,1.956,4.36,4.36v11C27.36,28.404,25.404,30.36,23,30.36z%20M9,11.36c-2.007,0-3.64,1.633-3.64,3.64v11%20c0,2.007,1.633,3.64,3.64,3.64h14c2.007,0,3.64-1.633,3.64-3.64V15c0-2.007-1.633-3.64-3.64-3.64H9z%20M13.384,10.64h5.231%20C18.439,9.354,17.334,8.36,16,8.36C14.667,8.36,13.561,9.354,13.384,10.64z%20M16,1.36c-0.904,0-1.64,0.736-1.64,1.64%20S15.096,4.64,16,4.64c0.904,0,1.64-0.736,1.64-1.64S16.904,1.36,16,1.36z%20M20,27.36h-8c-1.301,0-2.36-1.059-2.36-2.36%20s1.059-2.36,2.36-2.36h8c1.302,0,2.36,1.059,2.36,2.36S21.302,27.36,20,27.36z%20M12,23.36c-0.904,0-1.64,0.735-1.64,1.64%20s0.736,1.64,1.64,1.64h8c0.904,0,1.64-0.735,1.64-1.64s-0.735-1.64-1.64-1.64H12z%20M31,23.86h-2c-0.199,0-0.36-0.161-0.36-0.36V15%20c0-0.199,0.161-0.36,0.36-0.36h2c0.199,0,0.36,0.161,0.36,0.36v8.5C31.36,23.699,31.199,23.86,31,23.86z%20M29.36,23.14h1.279v-7.78%20H29.36V23.14z%20M3,23.86H1c-0.199,0-0.36-0.161-0.36-0.36V15c0-0.199,0.161-0.36,0.36-0.36h2c0.199,0,0.36,0.161,0.36,0.36v8.5%20C3.36,23.699,3.199,23.86,3,23.86z%20M1.36,23.14h1.28v-7.78H1.36V23.14z%20M20,20.36c-1.302,0-2.36-1.059-2.36-2.36%20s1.059-2.36,2.36-2.36s2.36,1.059,2.36,2.36C22.36,19.302,21.302,20.36,20,20.36z%20M20,16.36c-0.904,0-1.64,0.736-1.64,1.64%20s0.735,1.64,1.64,1.64s1.64-0.735,1.64-1.64S20.904,16.36,20,16.36z%20M12,20.36c-1.301,0-2.36-1.059-2.36-2.36s1.059-2.36,2.36-2.36%20s2.36,1.059,2.36,2.36C14.36,19.302,13.301,20.36,12,20.36z%20M12,16.36c-0.904,0-1.64,0.736-1.64,1.64s0.736,1.64,1.64,1.64%20s1.64-0.735,1.64-1.64S12.904,16.36,12,16.36z'/%3e%3crect%20style='fill:none;'%20width='32'%20height='32'/%3e%3c/svg%3e",
|
610
614
|
Pn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6CAMAAAC/MqoPAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADNQTFRF////9vX18vLy/Pz86enp4+Li2tnZ1tbWzczM+fn57Ozs4N/f09LS0M/P5uXl7+/v3dzcwtncCAAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAEgAAABIAEbJaz4AAAZNSURBVHja7d3bdtsqEABQYABZSLH9/3+ZpnUsIcF5iOM6PfElNoMHMfPQdq3GmL0GkLhEUqLaUExnOtOZznSmM53pTGc605nOdKYznelMZzrTmV4LXSqllKyJDkob26xWq8Zae/iH0QoWTm9d1xur4WuypQJtTd+5dqn0VjcxzNO5/57mEBvdLo8Oron6aseWOjYOFkVvjQs3DmgyONMuht52EfztP+4hdu0i6LCO808/M8c1lE/fuPGej41uUzgdtoO/75N+2ELJ9I3b3//hPXbiMenm3pR/Jt4USgcLBIp4Bh10gqKVhvLo0klCxeSky96nKcj3siw6pJIL4XsoiQ7apyvMY/V3HHrSRioLopvEhSpTCn2TPEuwKYMOIX0tAxRBf/Hpa+lfSqBv9gi1FPsNfTrMAiVmIE/vJhz61FGnQxRIEYE4vfNYdN8Rp6MlHaHotHTn8ejekaZPAjEmyvQWdZFTtYTpXqCGJ0zvcek9Yfoel76nS0ffv1NMp1ca+pkgyfRCGind4L7OWWc605l+cxjsyhqy9AGbPpClc1/nvl5VX0c/3Alk6RU3+Am7shNZ+h6bvidLr7jBB+zKBrL0irOOudmIUDzTmf5gIP+iEuXtRuTVaEmY/oZLfyNMrzjryPc0gerMTdpVg0tvjJUU6bLPcGOoUv46SLL6Wi8yhLf06C7TUyekI0efRaaYqdFltkeNpPumRPSMDxgBYvSM035FrKAmH72hRW99PrpvSdEHkTEGUvSsK3yKVDkuJ92RohcZaehzzirPpOg+J92Tolfc4Cumx5xVXpGiZ34+ICX6W84qv5GiR5NPbiIpOv6BCoSvSkTX+eiaGP092zINvBOj4x8mSf9FqejvNo/cvpOji19ZbmviL0GPLsYMFzgzCor0+Bv/ePDvSJKOb9dJ5UlnbnEHiHgzv6cdTpJOWuc/u3FEucLDOL75xGtBiefrcwgoC9NDSH/jkH6pAuXmBqPQ9HSUPVdZBH1GGOrMXAQdYxcKZfxAoK+KKBKFLosoEoX+u4giUehz8jlcnAuhp78I46yDYNAd+QLR6K+pr+yvxdBTHyVDubQh0UfSxaHSd0lbvNkVRE87JGOtc+PQd2QLQ6fHhJkKsSh6yg13tO08JPprsgrrXWH0dJd2vH1MLPprot4eXoujpzrdhngiD40ek2y92lggPcnWa8qN1Yz0BFuvZhRl0uOfR0v4Ewuli/Bg4Qr3lArqGdndQ3UPO1EunXYwnelMZzrTmc50pjOd6UxnOtOZznSmM53pTGf6kuj6oedFKV0s3fX6sX1S3bsi6a4PD7+/YAqYeBw6pIB/4qEgOqxdSPbGiim4NRRCbzs3Jj0L4UfXtQXQVRfn5IdA/Bw7RZzurEV6EtdsLeGXkIPuA+K1UoVeA0l62zmN/LqfSSft9KkepmoRuvi3nd5uKNFB9zbbXEANqdr941XO0NJx2v2jdJenpf+/3bvn0ts16ph+sd6hX7dPo2+2cZzE02Ia43bzDHqr+2Evnhz74ZHU30ffbKOeng1/NPV30Ns1gYQnSP2P6e65Pfxc6h02XZqXQCjhJ6kPL6bFo4NrGvAU4UII4SE2P1vQuZkuOxckVfehisF1MjUddN/MZBN+kvq5uf0O/xa66gyNS9ktMWlz44rO1Z8C19i5FPdHzPamXn+F3hryPfxMr78+4F+kq22kO6Rf6fUQt+puuustyWv4rbG3l/duztFB96GYoe1cTBdXMr+nw9qVM6ZfxOvzezff0nXi/ZOndvrR6Zvpm0c3h6nhdb+5iS7tsIim/qXZD9+97/Jf+rpZ5BET1ayv0GUzLhEuhBBjIy/RdVPgndutIRt9nt7p5cKFEEJ3Z+jQFDZL+XnMDXxHB73gxn5s9Kc3d3/pFciFkN/QTSXHJpX5l66gDrkQoP6hL3xsPw39la4qOiV8tH78XeSbue6N9mvWa6J/ybpc1CT1Wnh5Qq9meP8IOKH3ddH7E/ri1iYux/SXDrXR4UiPdck/wUpU+FtPf6/orja6O9KL3l56LOvVxe5Ib2qjN0d6Vbex4ghWlU3bPqI90If66MNng680FNpbJijH6kCvaF3uMzQ3+IrpFerV4Y9dffQdN3im10ivbuImhD3Qq5u4HdZkua8znelMZ/pS4z9CPVKkxowNxgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNy0wMy0yN1QxNTo0NToxNSswMDowMN1xSg4AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTctMDMtMjdUMTU6NDU6MTUrMDA6MDCsLPKyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAABJRU5ErkJggg==",
|
611
615
|
Y = /*#__PURE__*/function () {
|
@@ -643,7 +647,7 @@ var Ln = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e
|
|
643
647
|
value: function createAvatar(e, t) {
|
644
648
|
var r, o, a, l, c;
|
645
649
|
var i = document.createElement("img");
|
646
|
-
e === b.USER_ROLE ? i.src = ((r = t == null ? void 0 : t.user) == null ? void 0 : r.src) || ((o = t == null ? void 0 : t["default"]) == null ? void 0 : o.src) || Pn : i.src = ((a = t == null ? void 0 : t[e]) == null ? void 0 : a.src) || ((l = t == null ? void 0 : t.ai) == null ? void 0 : l.src) || ((c = t == null ? void 0 : t["default"]) == null ? void 0 : c.src) || Ln, i.classList.add("avatar");
|
650
|
+
e === b.USER_ROLE ? i.src = ((r = t == null ? void 0 : t.user) == null ? void 0 : r.src) || ((o = t == null ? void 0 : t["default"]) == null ? void 0 : o.src) || Pn : i.src = ((a = t == null ? void 0 : t[e]) == null ? void 0 : a.src) || ((l = t == null ? void 0 : t.ai) == null ? void 0 : l.src) || ((c = t == null ? void 0 : t["default"]) == null ? void 0 : c.src) || Ln, i.classList.add("avatar"), i.alt = "".concat(e, " avatar");
|
647
651
|
var s = document.createElement("div");
|
648
652
|
return s.classList.add(Y.CONTAINER_CLASS), s.appendChild(i), t && Y.applyCustomStyles(s, i, t, e), s;
|
649
653
|
}
|
@@ -667,20 +671,20 @@ var Ln = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e
|
|
667
671
|
}();
|
668
672
|
Y.CONTAINER_CLASS = "avatar-container";
|
669
673
|
var Mt = Y;
|
670
|
-
var
|
671
|
-
function
|
672
|
-
_classCallCheck(this,
|
674
|
+
var ge = /*#__PURE__*/function () {
|
675
|
+
function ge() {
|
676
|
+
_classCallCheck(this, ge);
|
673
677
|
}
|
674
|
-
return _createClass(
|
678
|
+
return _createClass(ge, null, [{
|
675
679
|
key: "hide",
|
676
680
|
value: function hide(e) {
|
677
681
|
var t;
|
678
|
-
(t = e.getElementsByClassName(
|
682
|
+
(t = e.getElementsByClassName(ge.NAME_CLASS)[0].style).visibility || (t.visibility = "hidden");
|
679
683
|
}
|
680
684
|
}, {
|
681
685
|
key: "reveal",
|
682
686
|
value: function reveal(e) {
|
683
|
-
e.getElementsByClassName(
|
687
|
+
e.getElementsByClassName(ge.NAME_CLASS)[0].style.visibility = "";
|
684
688
|
}
|
685
689
|
}, {
|
686
690
|
key: "getPosition",
|
@@ -706,20 +710,20 @@ var pe = /*#__PURE__*/function () {
|
|
706
710
|
key: "createName",
|
707
711
|
value: function createName(e, t) {
|
708
712
|
var i = document.createElement("div");
|
709
|
-
return i.classList.add(
|
713
|
+
return i.classList.add(ge.NAME_CLASS), i.textContent = ge.getNameText(e, t), ge.applyStyle(i, e, t), i;
|
710
714
|
}
|
711
715
|
}, {
|
712
716
|
key: "add",
|
713
717
|
value: function add(e, t, i) {
|
714
718
|
var s = typeof i == "boolean" ? {} : i,
|
715
|
-
r =
|
716
|
-
o =
|
719
|
+
r = ge.createName(t, s),
|
720
|
+
o = ge.getPosition(t, s);
|
717
721
|
r.classList.add(o === "left" ? "left-item-position" : "right-item-position"), e.insertAdjacentElement(o === "left" ? "beforebegin" : "afterend", r);
|
718
722
|
}
|
719
723
|
}]);
|
720
724
|
}();
|
721
|
-
|
722
|
-
var Rt =
|
725
|
+
ge.NAME_CLASS = "name";
|
726
|
+
var Rt = ge;
|
723
727
|
var C = /*#__PURE__*/function () {
|
724
728
|
function C() {
|
725
729
|
_classCallCheck(this, C);
|
@@ -750,9 +754,9 @@ var C = /*#__PURE__*/function () {
|
|
750
754
|
}, {
|
751
755
|
key: "getLastMessage",
|
752
756
|
value: function getLastMessage(e, t, i) {
|
753
|
-
for (var s = e.length - 1; s >= 0; s -= 1) if (e[s].role === t) if (i) {
|
754
|
-
if (e[s][i]) return e[s];
|
755
|
-
} else return e[s];
|
757
|
+
for (var s = e.length - 1; s >= 0; s -= 1) if (e[s][0].role === t) if (i) {
|
758
|
+
if (e[s][0][i]) return e[s][0];
|
759
|
+
} else return e[s][0];
|
756
760
|
}
|
757
761
|
}, {
|
758
762
|
key: "getLastTextToElement",
|
@@ -765,7 +769,7 @@ var C = /*#__PURE__*/function () {
|
|
765
769
|
}, {
|
766
770
|
key: "overwriteMessage",
|
767
771
|
value: function overwriteMessage(e, t, i, s, r, o) {
|
768
|
-
var a = C.getLastElementsByClass(t, [C.getRoleClass(s), o], [
|
772
|
+
var a = C.getLastElementsByClass(t, [C.getRoleClass(s), o], [Me.BUBBLE_CLASS]),
|
769
773
|
l = C.getLastMessage(e, s, r);
|
770
774
|
return l && (l[r] = i), a;
|
771
775
|
}
|
@@ -830,6 +834,12 @@ var C = /*#__PURE__*/function () {
|
|
830
834
|
var _e$outerContainer$cla;
|
831
835
|
e.outerContainer.classList.remove(C.POSITION_TOP_MESSAGE_CLASS, C.POSITION_MIDDLE_MESSAGE_CLASS, C.POSITION_BOTTOM_MESSAGE_CLASS), (_e$outerContainer$cla = e.outerContainer.classList).add.apply(_e$outerContainer$cla, _toConsumableArray(t));
|
832
836
|
}
|
837
|
+
}, {
|
838
|
+
key: "getNumberOfElements",
|
839
|
+
value: function getNumberOfElements(e) {
|
840
|
+
var t = 0;
|
841
|
+
return e.text !== void 0 && (t += 1), e.html !== void 0 && (t += 1), e.files && (t += e.files.length), t;
|
842
|
+
}
|
833
843
|
}, {
|
834
844
|
key: "classifyMessages",
|
835
845
|
value: function classifyMessages(e, t) {
|
@@ -902,11 +912,11 @@ var On = "deep-chat-temporary-message",
|
|
902
912
|
}
|
903
913
|
},
|
904
914
|
Ds = Object.keys(ns);
|
905
|
-
var
|
906
|
-
function
|
907
|
-
_classCallCheck(this,
|
915
|
+
var Re = /*#__PURE__*/function () {
|
916
|
+
function Re() {
|
917
|
+
_classCallCheck(this, Re);
|
908
918
|
}
|
909
|
-
return _createClass(
|
919
|
+
return _createClass(Re, null, [{
|
910
920
|
key: "applySuggestionEvent",
|
911
921
|
value: function applySuggestionEvent(e, t) {
|
912
922
|
setTimeout(function () {
|
@@ -961,13 +971,13 @@ var Me = /*#__PURE__*/function () {
|
|
961
971
|
Ds.forEach(function (r) {
|
962
972
|
var o = i.getElementsByClassName(r);
|
963
973
|
Array.from(o || []).forEach(function (a) {
|
964
|
-
var l =
|
965
|
-
te.applyStylesToElement(a, l),
|
974
|
+
var l = Re.getProcessedStyles(t, a, r);
|
975
|
+
te.applyStylesToElement(a, l), Re.applyEvents(a, r);
|
966
976
|
});
|
967
977
|
});
|
968
978
|
var s = i.getElementsByClassName(Nn);
|
969
979
|
Array.from(s).forEach(function (r) {
|
970
|
-
return
|
980
|
+
return Re.applySuggestionEvent(e, r);
|
971
981
|
});
|
972
982
|
}
|
973
983
|
}]);
|
@@ -995,7 +1005,7 @@ var te = /*#__PURE__*/function () {
|
|
995
1005
|
value: function applyClassUtilitiesToElement(e, t) {
|
996
1006
|
var i = t.events,
|
997
1007
|
s = t.styles;
|
998
|
-
i && te.applyEventsToElement(e, i), s && !
|
1008
|
+
i && te.applyEventsToElement(e, i), s && !Re.doesElementContainDeepChatClass(e) && te.applyStylesToElement(e, s);
|
999
1009
|
}
|
1000
1010
|
}, {
|
1001
1011
|
key: "applyCustomClassUtilities",
|
@@ -1010,7 +1020,7 @@ var te = /*#__PURE__*/function () {
|
|
1010
1020
|
}, {
|
1011
1021
|
key: "apply",
|
1012
1022
|
value: function apply(e, t) {
|
1013
|
-
|
1023
|
+
Re.applyDeepChatUtilities(e, e.htmlClassUtilities, t), te.applyCustomClassUtilities(e.htmlClassUtilities, t);
|
1014
1024
|
}
|
1015
1025
|
}, {
|
1016
1026
|
key: "traverseNodes",
|
@@ -1030,11 +1040,11 @@ var te = /*#__PURE__*/function () {
|
|
1030
1040
|
}
|
1031
1041
|
}]);
|
1032
1042
|
}();
|
1033
|
-
var
|
1034
|
-
function
|
1035
|
-
_classCallCheck(this,
|
1043
|
+
var be = /*#__PURE__*/function () {
|
1044
|
+
function be() {
|
1045
|
+
_classCallCheck(this, be);
|
1036
1046
|
}
|
1037
|
-
return _createClass(
|
1047
|
+
return _createClass(be, null, [{
|
1038
1048
|
key: "addElement",
|
1039
1049
|
value: function addElement(e, t) {
|
1040
1050
|
e.elementRef.appendChild(t), e.elementRef.scrollTop = e.elementRef.scrollHeight;
|
@@ -1047,10 +1057,15 @@ var Be = /*#__PURE__*/function () {
|
|
1047
1057
|
}
|
1048
1058
|
}, {
|
1049
1059
|
key: "overwrite",
|
1050
|
-
value: function overwrite(e, t, i
|
1051
|
-
|
1060
|
+
value: function overwrite(e, t, i) {
|
1061
|
+
i.bubbleElement.innerHTML = t, te.apply(e, i.outerContainer), le.flagHTMLUpdateClass(i.bubbleElement);
|
1062
|
+
}
|
1063
|
+
}, {
|
1064
|
+
key: "overwriteLast",
|
1065
|
+
value: function overwriteLast(e, t, i, s) {
|
1066
|
+
var r = e.messageToElements,
|
1052
1067
|
o = b.overwriteMessage(r, s, t, i, "html", "html-message");
|
1053
|
-
return o &&
|
1068
|
+
return o && be.overwrite(e, t, o), o;
|
1054
1069
|
}
|
1055
1070
|
// prettier-ignore
|
1056
1071
|
}, {
|
@@ -1059,12 +1074,12 @@ var Be = /*#__PURE__*/function () {
|
|
1059
1074
|
var o = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : !1;
|
1060
1075
|
var l;
|
1061
1076
|
if (r != null && r.status) {
|
1062
|
-
var c = this.
|
1077
|
+
var c = this.overwriteLast(e, t, i, s);
|
1063
1078
|
if (c) return c;
|
1064
1079
|
r.status = !1;
|
1065
1080
|
}
|
1066
|
-
var a =
|
1067
|
-
return b.fillEmptyMessageElement(a.bubbleElement, t), te.apply(e, a.outerContainer),
|
1081
|
+
var a = be.createElements(e, t, i, o);
|
1082
|
+
return b.fillEmptyMessageElement(a.bubbleElement, t), te.apply(e, a.outerContainer), le.flagHTMLUpdateClass(a.bubbleElement), e.applyCustomStyles(a, i, !1, (l = e.messageStyles) == null ? void 0 : l.html), o || be.addElement(e, a.outerContainer), a;
|
1068
1083
|
}
|
1069
1084
|
}]);
|
1070
1085
|
}();
|
@@ -1720,11 +1735,11 @@ function ct(n, e, t) {
|
|
1720
1735
|
return n.substr(0, e) + t + n.substr(e + 1);
|
1721
1736
|
}
|
1722
1737
|
function ar(n) {
|
1723
|
-
var e, t, i, s, r, o, a, l, c, d, h, u, f, m, p,
|
1738
|
+
var e, t, i, s, r, o, a, l, c, d, h, u, f, m, p, v, x;
|
1724
1739
|
if (n.options.typographer) {
|
1725
1740
|
for (x = [], p = n.tokens.length - 1; p >= 0; p--) if (n.tokens[p].type === "inline") {
|
1726
|
-
for (
|
1727
|
-
for (a =
|
1741
|
+
for (v = n.tokens[p].children, x.length = 0, e = 0; e < v.length; e++) if (t = v[e], !(t.type !== "text" || rr.test(t.text))) {
|
1742
|
+
for (a = v[e].level, f = x.length - 1; f >= 0 && !(x[f].level <= a); f--);
|
1728
1743
|
x.length = f + 1, i = t.content, r = 0, o = i.length;
|
1729
1744
|
e: for (; r < o && (Bs.lastIndex = r, s = Bs.exec(i), !!s);) {
|
1730
1745
|
if (l = !js(i, s.index - 1), r = s.index + 1, m = s[0] === "'", c = !js(i, r), !c && !l) {
|
@@ -1733,7 +1748,7 @@ function ar(n) {
|
|
1733
1748
|
}
|
1734
1749
|
if (h = !c, u = !l, u) {
|
1735
1750
|
for (f = x.length - 1; f >= 0 && (d = x[f], !(x[f].level < a)); f--) if (d.single === m && x[f].level === a) {
|
1736
|
-
d = x[f], m ? (
|
1751
|
+
d = x[f], m ? (v[d.token].content = ct(v[d.token].content, d.pos, n.options.quotes[2]), t.content = ct(t.content, s.index, n.options.quotes[3])) : (v[d.token].content = ct(v[d.token].content, d.pos, n.options.quotes[0]), t.content = ct(t.content, s.index, n.options.quotes[1])), x.length = f;
|
1737
1752
|
continue e;
|
1738
1753
|
}
|
1739
1754
|
}
|
@@ -1858,12 +1873,12 @@ function dr(n, e, t, i) {
|
|
1858
1873
|
f,
|
1859
1874
|
m,
|
1860
1875
|
p = n.bMarks[e] + n.tShift[e],
|
1861
|
-
|
1862
|
-
if (p >
|
1876
|
+
v = n.eMarks[e];
|
1877
|
+
if (p > v || n.src.charCodeAt(p++) !== 62 || n.level >= n.options.maxNesting) return !1;
|
1863
1878
|
if (i) return !0;
|
1864
|
-
for (n.src.charCodeAt(p) === 32 && p++, l = n.blkIndent, n.blkIndent = 0, a = [n.bMarks[e]], n.bMarks[e] = p, p = p <
|
1879
|
+
for (n.src.charCodeAt(p) === 32 && p++, l = n.blkIndent, n.blkIndent = 0, a = [n.bMarks[e]], n.bMarks[e] = p, p = p < v ? n.skipSpaces(p) : p, r = p >= v, o = [n.tShift[e]], n.tShift[e] = p - n.bMarks[e], h = n.parser.ruler.getRules("blockquote"), s = e + 1; s < t && (p = n.bMarks[s] + n.tShift[s], v = n.eMarks[s], !(p >= v)); s++) {
|
1865
1880
|
if (n.src.charCodeAt(p++) === 62) {
|
1866
|
-
n.src.charCodeAt(p) === 32 && p++, a.push(n.bMarks[s]), n.bMarks[s] = p, p = p <
|
1881
|
+
n.src.charCodeAt(p) === 32 && p++, a.push(n.bMarks[s]), n.bMarks[s] = p, p = p < v ? n.skipSpaces(p) : p, r = p >= v, o.push(n.tShift[s]), n.tShift[s] = p - n.bMarks[s];
|
1867
1882
|
continue;
|
1868
1883
|
}
|
1869
1884
|
if (r) break;
|
@@ -1938,28 +1953,28 @@ function fr(n, e, t, i) {
|
|
1938
1953
|
f,
|
1939
1954
|
m,
|
1940
1955
|
p,
|
1941
|
-
|
1956
|
+
v,
|
1942
1957
|
x,
|
1943
1958
|
j,
|
1944
1959
|
G,
|
1945
|
-
|
1960
|
+
Pe,
|
1946
1961
|
I,
|
1947
1962
|
Z = !0,
|
1948
1963
|
X,
|
1949
1964
|
D,
|
1950
1965
|
je,
|
1951
1966
|
Tt;
|
1952
|
-
if ((h = qs(n, e)) >= 0)
|
1967
|
+
if ((h = qs(n, e)) >= 0) v = !0;else if ((h = Hs(n, e)) >= 0) v = !1;else return !1;
|
1953
1968
|
if (n.level >= n.options.maxNesting) return !1;
|
1954
1969
|
if (p = n.src.charCodeAt(h - 1), i) return !0;
|
1955
|
-
for (j = n.tokens.length,
|
1970
|
+
for (j = n.tokens.length, v ? (d = n.bMarks[e] + n.tShift[e], m = Number(n.src.substr(d, h - d - 1)), n.tokens.push({
|
1956
1971
|
type: "ordered_list_open",
|
1957
1972
|
order: m,
|
1958
|
-
lines:
|
1973
|
+
lines: Pe = [e, 0],
|
1959
1974
|
level: n.level++
|
1960
1975
|
})) : n.tokens.push({
|
1961
1976
|
type: "bullet_list_open",
|
1962
|
-
lines:
|
1977
|
+
lines: Pe = [e, 0],
|
1963
1978
|
level: n.level++
|
1964
1979
|
}), s = e, G = !1, X = n.parser.ruler.getRules("list"); s < t && (x = n.skipSpaces(h), u = n.eMarks[s], x >= u ? f = 1 : f = x - h, f > 4 && (f = 1), f < 1 && (f = 1), r = h - n.bMarks[s] + f, n.tokens.push({
|
1965
1980
|
type: "list_item_open",
|
@@ -1974,15 +1989,15 @@ function fr(n, e, t, i) {
|
|
1974
1989
|
break;
|
1975
1990
|
}
|
1976
1991
|
if (Tt) break;
|
1977
|
-
if (
|
1992
|
+
if (v) {
|
1978
1993
|
if (h = qs(n, s), h < 0) break;
|
1979
1994
|
} else if (h = Hs(n, s), h < 0) break;
|
1980
1995
|
if (p !== n.src.charCodeAt(h - 1)) break;
|
1981
1996
|
}
|
1982
1997
|
return n.tokens.push({
|
1983
|
-
type:
|
1998
|
+
type: v ? "ordered_list_close" : "bullet_list_close",
|
1984
1999
|
level: --n.level
|
1985
|
-
}),
|
2000
|
+
}), Pe[1] = s, n.line = s, Z && ur(n, j), !0;
|
1986
2001
|
}
|
1987
2002
|
function pr(n, e, t, i) {
|
1988
2003
|
var s,
|
@@ -2187,7 +2202,7 @@ function Sr(n, e) {
|
|
2187
2202
|
for (t = e + 2, i = n.tokens.length - 2; t < i; t++) n.tokens[t].level === s && n.tokens[t].type === "paragraph_open" && (n.tokens[t + 2].tight = !0, n.tokens[t].tight = !0, t += 2);
|
2188
2203
|
}
|
2189
2204
|
function _r(n, e, t, i) {
|
2190
|
-
var s, r, o, a, l, c, d, h, u, f, m, p,
|
2205
|
+
var s, r, o, a, l, c, d, h, u, f, m, p, v, x;
|
2191
2206
|
if (i) return n.ddIndent < 0 ? !1 : ni(n, e) >= 0;
|
2192
2207
|
if (d = e + 1, n.isEmpty(d) && ++d > t || n.tShift[d] < n.blkIndent || (s = ni(n, d), s < 0) || n.level >= n.options.maxNesting) return !1;
|
2193
2208
|
c = n.tokens.length, n.tokens.push({
|
@@ -2196,7 +2211,7 @@ function _r(n, e, t, i) {
|
|
2196
2211
|
level: n.level++
|
2197
2212
|
}), o = e, r = d;
|
2198
2213
|
e: for (;;) {
|
2199
|
-
for (x = !0,
|
2214
|
+
for (x = !0, v = !1, n.tokens.push({
|
2200
2215
|
type: "dt_open",
|
2201
2216
|
lines: [o, o],
|
2202
2217
|
level: n.level++
|
@@ -2214,7 +2229,7 @@ function _r(n, e, t, i) {
|
|
2214
2229
|
type: "dd_open",
|
2215
2230
|
lines: a = [d, 0],
|
2216
2231
|
level: n.level++
|
2217
|
-
}), p = n.tight, u = n.ddIndent, h = n.blkIndent, m = n.tShift[r], f = n.parentType, n.blkIndent = n.ddIndent = n.tShift[r] + 2, n.tShift[r] = s - n.bMarks[r], n.tight = !0, n.parentType = "deflist", n.parser.tokenize(n, r, t, !0), (!n.tight ||
|
2232
|
+
}), p = n.tight, u = n.ddIndent, h = n.blkIndent, m = n.tShift[r], f = n.parentType, n.blkIndent = n.ddIndent = n.tShift[r] + 2, n.tShift[r] = s - n.bMarks[r], n.tight = !0, n.parentType = "deflist", n.parser.tokenize(n, r, t, !0), (!n.tight || v) && (x = !1), v = n.line - r > 1 && n.isEmpty(n.line - 1), n.tShift[r] = m, n.tight = p, n.parentType = f, n.blkIndent = h, n.ddIndent = u, n.tokens.push({
|
2218
2233
|
type: "dd_close",
|
2219
2234
|
level: --n.level
|
2220
2235
|
}), a[1] = d = n.line, d >= t || n.tShift[d] < n.blkIndent) break e;
|
@@ -2906,34 +2921,34 @@ var po = {
|
|
2906
2921
|
function Sn(n, e, t) {
|
2907
2922
|
this.src = e, this.env = t, this.options = n.options, this.tokens = [], this.inlineMode = !1, this.inline = n.inline, this.block = n.block, this.renderer = n.renderer, this.typographer = n.typographer;
|
2908
2923
|
}
|
2909
|
-
function
|
2924
|
+
function Ie(n, e) {
|
2910
2925
|
typeof n != "string" && (e = n, n = "default"), e && e.linkify != null && console.warn("linkify option is removed. Use linkify plugin instead:\n\nimport Remarkable from 'remarkable';\nimport linkify from 'remarkable/linkify';\nnew Remarkable().use(linkify)\n"), this.inline = new Pi(), this.block = new _s(), this.core = new En(), this.renderer = new Ss(), this.ruler = new se(), this.options = {}, this.configure(bo[n]), this.set(e || {});
|
2911
2926
|
}
|
2912
|
-
|
2927
|
+
Ie.prototype.set = function (n) {
|
2913
2928
|
pn(this.options, n);
|
2914
2929
|
};
|
2915
|
-
|
2930
|
+
Ie.prototype.configure = function (n) {
|
2916
2931
|
var e = this;
|
2917
2932
|
if (!n) throw new Error("Wrong `remarkable` preset, check name/content");
|
2918
2933
|
n.options && e.set(n.options), n.components && Object.keys(n.components).forEach(function (t) {
|
2919
2934
|
n.components[t].rules && e[t].ruler.enable(n.components[t].rules, !0);
|
2920
2935
|
});
|
2921
2936
|
};
|
2922
|
-
|
2937
|
+
Ie.prototype.use = function (n, e) {
|
2923
2938
|
return n(this, e), this;
|
2924
2939
|
};
|
2925
|
-
|
2940
|
+
Ie.prototype.parse = function (n, e) {
|
2926
2941
|
var t = new Sn(this, n, e);
|
2927
2942
|
return this.core.process(t), t.tokens;
|
2928
2943
|
};
|
2929
|
-
|
2944
|
+
Ie.prototype.render = function (n, e) {
|
2930
2945
|
return e = e || {}, this.renderer.render(this.parse(n, e), this.options, e);
|
2931
2946
|
};
|
2932
|
-
|
2947
|
+
Ie.prototype.parseInline = function (n, e) {
|
2933
2948
|
var t = new Sn(this, n, e);
|
2934
2949
|
return t.inlineMode = !0, this.core.process(t), t.tokens;
|
2935
2950
|
};
|
2936
|
-
|
2951
|
+
Ie.prototype.renderInline = function (n, e) {
|
2937
2952
|
return e = e || {}, this.renderer.render(this.parseInline(n, e), this.options, e);
|
2938
2953
|
};
|
2939
2954
|
var jt = /*#__PURE__*/function () {
|
@@ -2944,7 +2959,7 @@ var jt = /*#__PURE__*/function () {
|
|
2944
2959
|
key: "instantiate",
|
2945
2960
|
value: function instantiate() {
|
2946
2961
|
var e = window.hljs;
|
2947
|
-
return e ? new
|
2962
|
+
return e ? new Ie({
|
2948
2963
|
highlight: function highlight(t, i) {
|
2949
2964
|
if (i && e.getLanguage(i)) try {
|
2950
2965
|
return e.highlight(i, t).value;
|
@@ -2970,7 +2985,7 @@ var jt = /*#__PURE__*/function () {
|
|
2970
2985
|
// set target to open in a new tab
|
2971
2986
|
typographer: !0
|
2972
2987
|
// Enable smartypants and other sweet transforms
|
2973
|
-
}) : new
|
2988
|
+
}) : new Ie({
|
2974
2989
|
breaks: !0,
|
2975
2990
|
linkTarget: "_blank"
|
2976
2991
|
// set target to open in a new tab
|
@@ -2986,11 +3001,11 @@ var jt = /*#__PURE__*/function () {
|
|
2986
3001
|
}
|
2987
3002
|
}]);
|
2988
3003
|
}();
|
2989
|
-
var
|
2990
|
-
function
|
2991
|
-
_classCallCheck(this,
|
3004
|
+
var Se = /*#__PURE__*/function () {
|
3005
|
+
function Se() {
|
3006
|
+
_classCallCheck(this, Se);
|
2992
3007
|
}
|
2993
|
-
return _createClass(
|
3008
|
+
return _createClass(Se, null, [{
|
2994
3009
|
key: "addMessage",
|
2995
3010
|
value:
|
2996
3011
|
// prettier-ignore
|
@@ -3002,7 +3017,7 @@ var xe = /*#__PURE__*/function () {
|
|
3002
3017
|
key: "wrapInLink",
|
3003
3018
|
value: function wrapInLink(e, t, i) {
|
3004
3019
|
var s = document.createElement("a");
|
3005
|
-
return s.href = t, s.download = i ||
|
3020
|
+
return s.href = t, s.download = i || Se.DEFAULT_FILE_NAME, s.target = "_blank", s.appendChild(e), s;
|
3006
3021
|
}
|
3007
3022
|
}, {
|
3008
3023
|
key: "isNonLinkableDataUrl",
|
@@ -3012,7 +3027,7 @@ var xe = /*#__PURE__*/function () {
|
|
3012
3027
|
}, {
|
3013
3028
|
key: "processContent",
|
3014
3029
|
value: function processContent(e, t, i, s) {
|
3015
|
-
return !i ||
|
3030
|
+
return !i || Se.isNonLinkableDataUrl(e, i) ? t : Se.wrapInLink(t, i, s);
|
3016
3031
|
}
|
3017
3032
|
}, {
|
3018
3033
|
key: "waitToLoadThenScroll",
|
@@ -3024,11 +3039,11 @@ var xe = /*#__PURE__*/function () {
|
|
3024
3039
|
}, {
|
3025
3040
|
key: "scrollDownOnImageLoad",
|
3026
3041
|
value: function scrollDownOnImageLoad(e, t) {
|
3027
|
-
if (e.startsWith("data"))
|
3042
|
+
if (e.startsWith("data")) Se.waitToLoadThenScroll(t);else try {
|
3028
3043
|
fetch(e, {
|
3029
3044
|
mode: "no-cors"
|
3030
3045
|
})["catch"](function () {})["finally"](function () {
|
3031
|
-
|
3046
|
+
Se.waitToLoadThenScroll(t);
|
3032
3047
|
});
|
3033
3048
|
} catch (_unused5) {
|
3034
3049
|
t.scrollTop = t.scrollHeight;
|
@@ -3066,7 +3081,7 @@ var xe = /*#__PURE__*/function () {
|
|
3066
3081
|
value: function isImageFile(e) {
|
3067
3082
|
var t = e.type,
|
3068
3083
|
i = e.src;
|
3069
|
-
return t === "image" || (i == null ? void 0 : i.startsWith("data:image")) || i &&
|
3084
|
+
return t === "image" || (i == null ? void 0 : i.startsWith("data:image")) || i && Se.isImageFileExtension(i);
|
3070
3085
|
}
|
3071
3086
|
}, {
|
3072
3087
|
key: "isImageFileExtension",
|
@@ -3075,8 +3090,8 @@ var xe = /*#__PURE__*/function () {
|
|
3075
3090
|
}
|
3076
3091
|
}]);
|
3077
3092
|
}();
|
3078
|
-
|
3079
|
-
var B =
|
3093
|
+
Se.DEFAULT_FILE_NAME = "file";
|
3094
|
+
var B = Se;
|
3080
3095
|
var hi = /*#__PURE__*/function () {
|
3081
3096
|
function hi() {
|
3082
3097
|
_classCallCheck(this, hi);
|
@@ -3092,7 +3107,7 @@ var hi = /*#__PURE__*/function () {
|
|
3092
3107
|
}));
|
3093
3108
|
B.reAddFileRefToObject(t, s), (r = e.onMessage) == null || r.call(e, s), e.dispatchEvent(new CustomEvent("message", {
|
3094
3109
|
detail: s
|
3095
|
-
})),
|
3110
|
+
})), le.fireOnNewMessage(e, s);
|
3096
3111
|
}
|
3097
3112
|
}, {
|
3098
3113
|
key: "onClearMessages",
|
@@ -3131,7 +3146,7 @@ var F = /*#__PURE__*/function () {
|
|
3131
3146
|
}, {
|
3132
3147
|
key: "apply",
|
3133
3148
|
value: function apply(e, t, i) {
|
3134
|
-
|
3149
|
+
Me.setRing(t.bubbleElement, i == null ? void 0 : i.bubble), i != null && i.bubble && (i = JSON.parse(JSON.stringify(i)), delete i.bubble), e.applyCustomStyles(t, "history", !1, i);
|
3135
3150
|
}
|
3136
3151
|
}, {
|
3137
3152
|
key: "addLoadHistoryMessage",
|
@@ -3158,7 +3173,7 @@ var F = /*#__PURE__*/function () {
|
|
3158
3173
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
3159
3174
|
var r, o, a, l;
|
3160
3175
|
var i = (l = (a = (o = (r = e.messageStyles) == null ? void 0 : r.loading) == null ? void 0 : o.history) == null ? void 0 : a.full) == null ? void 0 : l.html,
|
3161
|
-
s = i ?
|
3176
|
+
s = i ? be.createElements(e, i, b.AI_ROLE, !0) : F.createDefaultElements(e);
|
3162
3177
|
return F.addLoadHistoryMessage(s, e, t), s;
|
3163
3178
|
}
|
3164
3179
|
}, {
|
@@ -3226,15 +3241,15 @@ var q = /*#__PURE__*/function () {
|
|
3226
3241
|
}
|
3227
3242
|
}]);
|
3228
3243
|
}();
|
3229
|
-
var
|
3230
|
-
function
|
3244
|
+
var Be = /*#__PURE__*/function () {
|
3245
|
+
function Be(e) {
|
3231
3246
|
var _this3 = this;
|
3232
|
-
_classCallCheck(this,
|
3233
|
-
this.messageElementRefs = [], this.
|
3247
|
+
_classCallCheck(this, Be);
|
3248
|
+
this.messageElementRefs = [], this.htmlClassUtilities = {}, this.messageToElements = [], this.textElementsToText = [], this.htmlElementsToMessage = [], this.elementRef = Be.createContainerElement(), this.messageStyles = e.messageStyles, this._remarkable = jt.createNew(), this._avatars = e.avatars, this._names = e.names, this._onMessage = hi.onMessage.bind(this, e), e.htmlClassUtilities && (this.htmlClassUtilities = e.htmlClassUtilities), setTimeout(function () {
|
3234
3249
|
_this3.submitUserMessage = e.submitUserMessage;
|
3235
3250
|
});
|
3236
3251
|
}
|
3237
|
-
return _createClass(
|
3252
|
+
return _createClass(Be, [{
|
3238
3253
|
key: "addNewTextMessage",
|
3239
3254
|
value: function addNewTextMessage(e, t, i) {
|
3240
3255
|
var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
|
@@ -3251,7 +3266,7 @@ var Fe = /*#__PURE__*/function () {
|
|
3251
3266
|
}, {
|
3252
3267
|
key: "overwriteText",
|
3253
3268
|
value: function overwriteText(e, t, i) {
|
3254
|
-
var s = b.overwriteMessage(this.
|
3269
|
+
var s = b.overwriteMessage(this.messageToElements, i, t, e, "text", "text-message");
|
3255
3270
|
if (s) {
|
3256
3271
|
this.renderText(s.bubbleElement, t);
|
3257
3272
|
var r = b.getLastTextToElement(this.textElementsToText, s);
|
@@ -3292,7 +3307,7 @@ var Fe = /*#__PURE__*/function () {
|
|
3292
3307
|
var r;
|
3293
3308
|
(r = this._introPanel) == null || r.hide();
|
3294
3309
|
var s = this.messageElementRefs[this.messageElementRefs.length - 1];
|
3295
|
-
return Qe.changeFullViewToSmall(this, s),
|
3310
|
+
return Qe.changeFullViewToSmall(this, s), Be.isTemporaryElement(s) && (this.revealRoleElementsIfTempRemoved(s, t), s.outerContainer.remove(), this.messageElementRefs.pop()), this.createMessageElements(e, t, i);
|
3296
3311
|
}
|
3297
3312
|
// this can be tested by having an ai message, then a temp ai message with html that submits new user message:
|
3298
3313
|
// https://github.com/OvidijusParsiunas/deep-chat/issues/258
|
@@ -3300,16 +3315,16 @@ var Fe = /*#__PURE__*/function () {
|
|
3300
3315
|
}, {
|
3301
3316
|
key: "revealRoleElementsIfTempRemoved",
|
3302
3317
|
value: function revealRoleElementsIfTempRemoved(e, t) {
|
3303
|
-
if ((this._avatars || this._names) &&
|
3318
|
+
if ((this._avatars || this._names) && Re.isElementTemporary(e)) {
|
3304
3319
|
var i = this.messageElementRefs[this.messageElementRefs.length - 2];
|
3305
|
-
i && this.
|
3320
|
+
i && this.messageToElements.length > 0 && !e.bubbleElement.classList.contains(b.getRoleClass(t)) && b.revealRoleElements(i.innerContainer, this._avatars, this._names);
|
3306
3321
|
}
|
3307
3322
|
}
|
3308
3323
|
}, {
|
3309
3324
|
key: "createMessageElements",
|
3310
3325
|
value: function createMessageElements(e, t) {
|
3311
3326
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
|
3312
|
-
var s =
|
3327
|
+
var s = Be.createBaseElements(t),
|
3313
3328
|
r = s.outerContainer,
|
3314
3329
|
o = s.innerContainer,
|
3315
3330
|
a = s.bubbleElement;
|
@@ -3321,7 +3336,7 @@ var Fe = /*#__PURE__*/function () {
|
|
3321
3336
|
// prettier-ignore
|
3322
3337
|
function addInnerContainerElements(e, t, i) {
|
3323
3338
|
var s;
|
3324
|
-
return ((s = this.
|
3339
|
+
return ((s = this.messageToElements[this.messageToElements.length - 1]) == null ? void 0 : s[0].role) === i && !this.isLastMessageError() && b.hideRoleElements(this.messageElementRefs, !!this._avatars, !!this._names), e.classList.add("message-bubble", b.getRoleClass(i), i === b.USER_ROLE ? "user-message-text" : "ai-message-text"), this.renderText(e, t), b.addRoleElements(e, i, this._avatars, this._names), {
|
3325
3340
|
bubbleElement: e
|
3326
3341
|
};
|
3327
3342
|
}
|
@@ -3381,7 +3396,7 @@ var Fe = /*#__PURE__*/function () {
|
|
3381
3396
|
}, {
|
3382
3397
|
key: "isTemporaryElement",
|
3383
3398
|
value: function isTemporaryElement(e) {
|
3384
|
-
return
|
3399
|
+
return Be.isLoadingMessage(e) || Re.isElementTemporary(e);
|
3385
3400
|
}
|
3386
3401
|
}, {
|
3387
3402
|
key: "createBaseElements",
|
@@ -3412,17 +3427,17 @@ var Fe = /*#__PURE__*/function () {
|
|
3412
3427
|
}, {
|
3413
3428
|
key: "isLoadingMessage",
|
3414
3429
|
value: function isLoadingMessage(e) {
|
3415
|
-
return e == null ? void 0 : e.bubbleElement.classList.contains(
|
3430
|
+
return e == null ? void 0 : e.bubbleElement.classList.contains(Me.BUBBLE_CLASS);
|
3416
3431
|
}
|
3417
3432
|
}]);
|
3418
3433
|
}();
|
3419
|
-
var
|
3434
|
+
var _e = /*#__PURE__*/function () {
|
3420
3435
|
// used for extracting at end and for isStreaming
|
3421
|
-
function
|
3422
|
-
_classCallCheck(this,
|
3436
|
+
function _e(e) {
|
3437
|
+
_classCallCheck(this, _e);
|
3423
3438
|
this._fileAdded = !1, this._streamedContent = "", this._streamType = "", this._hasStreamEnded = !1, this._messages = e;
|
3424
3439
|
}
|
3425
|
-
return _createClass(
|
3440
|
+
return _createClass(_e, [{
|
3426
3441
|
key: "upsertStreamedMessage",
|
3427
3442
|
value: function upsertStreamedMessage(e) {
|
3428
3443
|
var r;
|
@@ -3441,9 +3456,9 @@ var Se = /*#__PURE__*/function () {
|
|
3441
3456
|
key: "setInitialState",
|
3442
3457
|
value: function setInitialState(e, t, i) {
|
3443
3458
|
var _i8;
|
3444
|
-
this._streamType = e, (_i8 = i) !== null && _i8 !== void 0 ? _i8 : i = b.AI_ROLE, this._elements = e === "text" ? this._messages.addNewTextMessage(t, i) :
|
3459
|
+
this._streamType = e, (_i8 = i) !== null && _i8 !== void 0 ? _i8 : i = b.AI_ROLE, this._elements = e === "text" ? this._messages.addNewTextMessage(t, i) : be.add(this._messages, t, i, this._messages.messageElementRefs), this._elements.bubbleElement.classList.add(_e.MESSAGE_CLASS), this._streamedContent = t, this._activeMessageRole = i, this._message = _defineProperty({
|
3445
3460
|
role: this._activeMessageRole
|
3446
|
-
}, e, this._streamedContent), this._messages.
|
3461
|
+
}, e, this._streamedContent), this._messages.messageToElements.push([this._message, [this._elements]]);
|
3447
3462
|
}
|
3448
3463
|
}, {
|
3449
3464
|
key: "updateBasedOnType",
|
@@ -3461,7 +3476,7 @@ var Se = /*#__PURE__*/function () {
|
|
3461
3476
|
value: function updateHTML(e, t, i) {
|
3462
3477
|
if (i) this._streamedContent = e, t.innerHTML = e;else {
|
3463
3478
|
var s = document.createElement("span");
|
3464
|
-
s.innerHTML = e, t.appendChild(s), this._streamedContent =
|
3479
|
+
s.innerHTML = e, t.appendChild(s), this._streamedContent = _e.HTML_CONTENT_PLACEHOLDER;
|
3465
3480
|
}
|
3466
3481
|
}
|
3467
3482
|
}, {
|
@@ -3471,7 +3486,7 @@ var Se = /*#__PURE__*/function () {
|
|
3471
3486
|
var e = this._messages.textElementsToText;
|
3472
3487
|
if (!this._endStreamAfterOperation && !(this._fileAdded && !this._elements)) {
|
3473
3488
|
if (!this._elements) throw Error(M.NO_VALID_STREAM_EVENTS_SENT);
|
3474
|
-
(t = this._elements.bubbleElement) != null && t.classList.contains(
|
3489
|
+
(t = this._elements.bubbleElement) != null && t.classList.contains(_e.MESSAGE_CLASS) && (this._streamType === "text" ? (e[e.length - 1][1] = this._streamedContent, this._message && (this._message.text = this._streamedContent), this._messages.textToSpeech && bt.speak(this._streamedContent, this._messages.textToSpeech)) : this._streamType === "html" && (this._streamedContent === _e.HTML_CONTENT_PLACEHOLDER && (this._streamedContent = ((i = this._elements.bubbleElement) == null ? void 0 : i.innerHTML) || ""), this._elements && te.apply(this._messages, this._elements.outerContainer), this._message && (this._message.html = this._streamedContent)), this._elements.bubbleElement.classList.remove(_e.MESSAGE_CLASS), this._message && this._messages.sendClientUpdate(Be.createMessageContent(this._message), !1), this._hasStreamEnded = !0);
|
3475
3490
|
}
|
3476
3491
|
}
|
3477
3492
|
}, {
|
@@ -3516,8 +3531,8 @@ var Se = /*#__PURE__*/function () {
|
|
3516
3531
|
}()
|
3517
3532
|
}]);
|
3518
3533
|
}();
|
3519
|
-
|
3520
|
-
var
|
3534
|
+
_e.MESSAGE_CLASS = "streamed-message", _e.HTML_CONTENT_PLACEHOLDER = "htmlplaceholder";
|
3535
|
+
var ve = _e;
|
3521
3536
|
var We = /*#__PURE__*/function () {
|
3522
3537
|
function We() {
|
3523
3538
|
_classCallCheck(this, We);
|
@@ -3646,7 +3661,7 @@ var We = /*#__PURE__*/function () {
|
|
3646
3661
|
}]);
|
3647
3662
|
}();
|
3648
3663
|
We.CONTENT_TYPE = "Content-Type";
|
3649
|
-
var
|
3664
|
+
var y = We;
|
3650
3665
|
function vo(_x12, _x13) {
|
3651
3666
|
return _vo.apply(this, arguments);
|
3652
3667
|
}
|
@@ -3770,7 +3785,7 @@ function wo(n, e) {
|
|
3770
3785
|
m.abort(), document.hidden || I();
|
3771
3786
|
}
|
3772
3787
|
l || document.addEventListener("visibilitychange", p);
|
3773
|
-
var
|
3788
|
+
var v = _o,
|
3774
3789
|
x = 0;
|
3775
3790
|
function j() {
|
3776
3791
|
document.removeEventListener("visibilitychange", p), window.clearTimeout(x), m.abort();
|
@@ -3779,7 +3794,7 @@ function wo(n, e) {
|
|
3779
3794
|
j(), h();
|
3780
3795
|
});
|
3781
3796
|
var G = c !== null && c !== void 0 ? c : window.fetch,
|
3782
|
-
|
3797
|
+
Pe = s !== null && s !== void 0 ? s : To;
|
3783
3798
|
function I() {
|
3784
3799
|
return _I.apply(this, arguments);
|
3785
3800
|
}
|
@@ -3799,13 +3814,13 @@ function wo(n, e) {
|
|
3799
3814
|
case 4:
|
3800
3815
|
X = _context4.sent;
|
3801
3816
|
_context4.next = 7;
|
3802
|
-
return
|
3817
|
+
return Pe(X);
|
3803
3818
|
case 7:
|
3804
3819
|
_context4.next = 9;
|
3805
3820
|
return vo(X.body, yo(Eo(function (D) {
|
3806
3821
|
D ? f[Ws] = D : delete f[Ws];
|
3807
3822
|
}, function (D) {
|
3808
|
-
|
3823
|
+
v = D;
|
3809
3824
|
}, r)));
|
3810
3825
|
case 9:
|
3811
3826
|
o == null || o();
|
@@ -3817,7 +3832,7 @@ function wo(n, e) {
|
|
3817
3832
|
_context4.prev = 14;
|
3818
3833
|
_context4.t0 = _context4["catch"](1);
|
3819
3834
|
if (!m.signal.aborted) try {
|
3820
|
-
D = (Z = a == null ? void 0 : a(_context4.t0)) !== null && Z !== void 0 ? Z :
|
3835
|
+
D = (Z = a == null ? void 0 : a(_context4.t0)) !== null && Z !== void 0 ? Z : v;
|
3821
3836
|
window.clearTimeout(x), x = window.setTimeout(I, D);
|
3822
3837
|
} catch (D) {
|
3823
3838
|
j(), u(D);
|
@@ -3849,13 +3864,13 @@ var A = /*#__PURE__*/function () {
|
|
3849
3864
|
var s,
|
3850
3865
|
r,
|
3851
3866
|
p,
|
3852
|
-
|
3867
|
+
v,
|
3853
3868
|
x,
|
3854
3869
|
j,
|
3855
3870
|
G,
|
3856
|
-
|
3871
|
+
Pe,
|
3857
3872
|
o,
|
3858
|
-
_yield$
|
3873
|
+
_yield$y$processReque,
|
3859
3874
|
a,
|
3860
3875
|
l,
|
3861
3876
|
c,
|
@@ -3876,12 +3891,12 @@ var A = /*#__PURE__*/function () {
|
|
3876
3891
|
headers: (p = e.connectSettings) == null ? void 0 : p.headers
|
3877
3892
|
};
|
3878
3893
|
_context7.next = 5;
|
3879
|
-
return
|
3894
|
+
return y.processRequestInterceptor(e.deepChat, o);
|
3880
3895
|
case 5:
|
3881
|
-
_yield$
|
3882
|
-
a = _yield$
|
3883
|
-
l = _yield$
|
3884
|
-
c = _yield$
|
3896
|
+
_yield$y$processReque = _context7.sent;
|
3897
|
+
a = _yield$y$processReque.body;
|
3898
|
+
l = _yield$y$processReque.headers;
|
3899
|
+
c = _yield$y$processReque.error;
|
3885
3900
|
_e$streamHandlers = e.streamHandlers;
|
3886
3901
|
d = _e$streamHandlers.onOpen;
|
3887
3902
|
h = _e$streamHandlers.onClose;
|
@@ -3890,25 +3905,25 @@ var A = /*#__PURE__*/function () {
|
|
3890
3905
|
_context7.next = 15;
|
3891
3906
|
break;
|
3892
3907
|
}
|
3893
|
-
return _context7.abrupt("return",
|
3908
|
+
return _context7.abrupt("return", y.onInterceptorError(i, c, h));
|
3894
3909
|
case 15:
|
3895
|
-
if (!((
|
3910
|
+
if (!((v = e.connectSettings) != null && v.handler)) {
|
3896
3911
|
_context7.next = 17;
|
3897
3912
|
break;
|
3898
3913
|
}
|
3899
|
-
return _context7.abrupt("return",
|
3914
|
+
return _context7.abrupt("return", Ae.stream(e, a, i));
|
3900
3915
|
case 17:
|
3901
|
-
if (!(((x = e.connectSettings) == null ? void 0 : x.url) ===
|
3916
|
+
if (!(((x = e.connectSettings) == null ? void 0 : x.url) === ye.URL)) {
|
3902
3917
|
_context7.next = 19;
|
3903
3918
|
break;
|
3904
3919
|
}
|
3905
|
-
return _context7.abrupt("return",
|
3920
|
+
return _context7.abrupt("return", ye.requestStream(i, e.streamHandlers));
|
3906
3921
|
case 19:
|
3907
|
-
f = new
|
3922
|
+
f = new ve(i), m = y.fetch.bind(this, e, l, s);
|
3908
3923
|
return _context7.abrupt("return", (wo(((j = e.connectSettings) == null ? void 0 : j.url) || e.url || "", {
|
3909
3924
|
method: ((G = e.connectSettings) == null ? void 0 : G.method) || "POST",
|
3910
3925
|
headers: l,
|
3911
|
-
credentials: (
|
3926
|
+
credentials: (Pe = e.connectSettings) == null ? void 0 : Pe.credentials,
|
3912
3927
|
body: s ? JSON.stringify(a) : a,
|
3913
3928
|
openWhenHidden: !0,
|
3914
3929
|
// keep stream open when browser tab not open
|
@@ -3924,7 +3939,7 @@ var A = /*#__PURE__*/function () {
|
|
3924
3939
|
return _context5.abrupt("return", d());
|
3925
3940
|
case 2:
|
3926
3941
|
_context5.next = 4;
|
3927
|
-
return
|
3942
|
+
return y.processResponseByType(I);
|
3928
3943
|
case 4:
|
3929
3944
|
throw _context5.sent;
|
3930
3945
|
case 5:
|
@@ -3963,7 +3978,7 @@ var A = /*#__PURE__*/function () {
|
|
3963
3978
|
(D = e.extractResultData) == null || D.call(e, Tt, m, a).then(function (He) {
|
3964
3979
|
e.asyncCallInProgress && He && He.text !== "" ? (A.simulate(i, e.streamHandlers, He), h(), e.asyncCallInProgress = !1) : A.upsertWFiles(i, f.upsertStreamedMessage.bind(f), f, He);
|
3965
3980
|
})["catch"](function (He) {
|
3966
|
-
return
|
3981
|
+
return y.displayError(i, He);
|
3967
3982
|
});
|
3968
3983
|
case 9:
|
3969
3984
|
case "end":
|
@@ -3986,9 +4001,9 @@ var A = /*#__PURE__*/function () {
|
|
3986
4001
|
})["catch"](function (I) {
|
3987
4002
|
var Z;
|
3988
4003
|
i.isLastMessageError() || (Z = e.extractResultData) == null || Z.call(e, I).then(function () {
|
3989
|
-
|
4004
|
+
y.displayError(i, I);
|
3990
4005
|
})["catch"](function (X) {
|
3991
|
-
|
4006
|
+
y.displayError(i, X);
|
3992
4007
|
});
|
3993
4008
|
}), f));
|
3994
4009
|
case 21:
|
@@ -4012,12 +4027,12 @@ var A = /*#__PURE__*/function () {
|
|
4012
4027
|
}, i), !1), i.text) {
|
4013
4028
|
t.onOpen();
|
4014
4029
|
var r = i.text.split("");
|
4015
|
-
A.populateMessages(r, new
|
4030
|
+
A.populateMessages(r, new ve(e), s, "text");
|
4016
4031
|
}
|
4017
4032
|
if (i.html) {
|
4018
4033
|
t.onOpen();
|
4019
4034
|
var _r2 = te.splitHTML(i.html);
|
4020
|
-
A.populateMessages(_r2, new
|
4035
|
+
_r2.length === 0 && (_r2 = i.html.split("")), A.populateMessages(_r2, new ve(e), s, "html");
|
4021
4036
|
}
|
4022
4037
|
}
|
4023
4038
|
// prettier-ignore
|
@@ -4072,7 +4087,7 @@ var Ke = /*#__PURE__*/function () {
|
|
4072
4087
|
return _createClass(Ke, null, [{
|
4073
4088
|
key: "generateResponse",
|
4074
4089
|
value: function generateResponse(e) {
|
4075
|
-
var t = e
|
4090
|
+
var t = e[e.length - 1][0];
|
4076
4091
|
if (t.files && t.files.length > 0) {
|
4077
4092
|
if (t.files.length > 1) return "These are interesting files!";
|
4078
4093
|
var i = t.files[0];
|
@@ -4091,9 +4106,11 @@ var Ke = /*#__PURE__*/function () {
|
|
4091
4106
|
}
|
4092
4107
|
}, {
|
4093
4108
|
key: "getResponse",
|
4094
|
-
value: function getResponse(
|
4095
|
-
|
4096
|
-
|
4109
|
+
value: function getResponse(_ref2) {
|
4110
|
+
var e = _ref2.customDemoResponse,
|
4111
|
+
t = _ref2.messageToElements;
|
4112
|
+
return e ? Ke.getCustomResponse(e, t[t.length - 1][0]) : {
|
4113
|
+
text: Ke.generateResponse(t)
|
4097
4114
|
};
|
4098
4115
|
}
|
4099
4116
|
// timeout is used to simulate a timeout for a response to come back
|
@@ -4137,7 +4154,7 @@ var Ke = /*#__PURE__*/function () {
|
|
4137
4154
|
}]);
|
4138
4155
|
}();
|
4139
4156
|
Ke.URL = "deep-chat-demo";
|
4140
|
-
var
|
4157
|
+
var ye = Ke;
|
4141
4158
|
var U = /*#__PURE__*/function () {
|
4142
4159
|
function U() {
|
4143
4160
|
_classCallCheck(this, U);
|
@@ -4145,7 +4162,7 @@ var U = /*#__PURE__*/function () {
|
|
4145
4162
|
return _createClass(U, null, [{
|
4146
4163
|
key: "setup",
|
4147
4164
|
value: function setup(e) {
|
4148
|
-
e.connectSettings.url !==
|
4165
|
+
e.connectSettings.url !== ye.URL && (e.permittedErrorPrefixes = ["Connection error", "Error in server message"], e.websocket = "pending");
|
4149
4166
|
}
|
4150
4167
|
}, {
|
4151
4168
|
key: "isElementPresentInDOM",
|
@@ -4160,7 +4177,7 @@ var U = /*#__PURE__*/function () {
|
|
4160
4177
|
if (!U.isElementPresentInDOM(e.deepChat)) return;
|
4161
4178
|
var i = e.connectSettings.websocket;
|
4162
4179
|
if (i) {
|
4163
|
-
if (e.connectSettings.handler) return
|
4180
|
+
if (e.connectSettings.handler) return Ae.websocket(e, t);
|
4164
4181
|
try {
|
4165
4182
|
var s = typeof i != "boolean" ? i : void 0,
|
4166
4183
|
r = new WebSocket(e.connectSettings.url || "", s);
|
@@ -4189,7 +4206,7 @@ var U = /*#__PURE__*/function () {
|
|
4189
4206
|
var _this6 = this;
|
4190
4207
|
var s = {};
|
4191
4208
|
t.onmessage = /*#__PURE__*/function () {
|
4192
|
-
var
|
4209
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(r) {
|
4193
4210
|
var o, a, l, c, d, h, u;
|
4194
4211
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
4195
4212
|
while (1) switch (_context9.prev = _context9.next) {
|
@@ -4230,7 +4247,7 @@ var U = /*#__PURE__*/function () {
|
|
4230
4247
|
case 17:
|
4231
4248
|
_context9.prev = 17;
|
4232
4249
|
_context9.t1 = _context9["catch"](1);
|
4233
|
-
|
4250
|
+
y.displayError(i, _context9.t1, "Error in server message");
|
4234
4251
|
case 20:
|
4235
4252
|
case "end":
|
4236
4253
|
return _context9.stop();
|
@@ -4238,7 +4255,7 @@ var U = /*#__PURE__*/function () {
|
|
4238
4255
|
}, _callee9, null, [[1, 17]]);
|
4239
4256
|
}));
|
4240
4257
|
return function (_x17) {
|
4241
|
-
return
|
4258
|
+
return _ref4.apply(this, arguments);
|
4242
4259
|
};
|
4243
4260
|
}(), t.onclose = function () {
|
4244
4261
|
console.error("Connection closed"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error"), e.stream && e.streamHandlers.abortStream.abort(), U.createConnection(e, i);
|
@@ -4253,7 +4270,7 @@ var U = /*#__PURE__*/function () {
|
|
4253
4270
|
h,
|
4254
4271
|
r,
|
4255
4272
|
o,
|
4256
|
-
_yield$
|
4273
|
+
_yield$y$processReque2,
|
4257
4274
|
a,
|
4258
4275
|
l,
|
4259
4276
|
c,
|
@@ -4274,11 +4291,11 @@ var U = /*#__PURE__*/function () {
|
|
4274
4291
|
headers: (d = e.connectSettings) == null ? void 0 : d.headers
|
4275
4292
|
};
|
4276
4293
|
_context10.next = 7;
|
4277
|
-
return
|
4294
|
+
return y.processRequestInterceptor(e.deepChat, o);
|
4278
4295
|
case 7:
|
4279
|
-
_yield$
|
4280
|
-
a = _yield$
|
4281
|
-
l = _yield$
|
4296
|
+
_yield$y$processReque2 = _context10.sent;
|
4297
|
+
a = _yield$y$processReque2.body;
|
4298
|
+
l = _yield$y$processReque2.error;
|
4282
4299
|
if (!l) {
|
4283
4300
|
_context10.next = 12;
|
4284
4301
|
break;
|
@@ -4292,11 +4309,11 @@ var U = /*#__PURE__*/function () {
|
|
4292
4309
|
return _context10.abrupt("return", r.newUserMessage.listener(a));
|
4293
4310
|
case 14:
|
4294
4311
|
c = s ? JSON.stringify(a) : a;
|
4295
|
-
if (!(((h = e.connectSettings) == null ? void 0 : h.url) ===
|
4312
|
+
if (!(((h = e.connectSettings) == null ? void 0 : h.url) === ye.URL)) {
|
4296
4313
|
_context10.next = 17;
|
4297
4314
|
break;
|
4298
4315
|
}
|
4299
|
-
return _context10.abrupt("return",
|
4316
|
+
return _context10.abrupt("return", ye.request(e, i));
|
4300
4317
|
case 17:
|
4301
4318
|
r.readyState === void 0 || r.readyState !== r.OPEN ? (console.error("Connection is not open"), i.isLastMessageError() || i.addNewErrorMessage("service", "Connection error")) : (r.send(JSON.stringify(c)), e.completionsHandlers.onFinish());
|
4302
4319
|
case 18:
|
@@ -4330,16 +4347,16 @@ var U = /*#__PURE__*/function () {
|
|
4330
4347
|
var _i$o;
|
4331
4348
|
var o = s.role || b.AI_ROLE,
|
4332
4349
|
a = i[o];
|
4333
|
-
s.text === r || s.html === r ? (a == null || a.finaliseStreamedMessage(), delete i[o]) : ((_i$o = i[o]) !== null && _i$o !== void 0 ? _i$o : i[o] = new
|
4350
|
+
s.text === r || s.html === r ? (a == null || a.finaliseStreamedMessage(), delete i[o]) : ((_i$o = i[o]) !== null && _i$o !== void 0 ? _i$o : i[o] = new ve(t), i[o].upsertStreamedMessage(s));
|
4334
4351
|
} else A.simulate(t, e.streamHandlers, s);
|
4335
4352
|
}
|
4336
4353
|
}]);
|
4337
4354
|
}();
|
4338
|
-
var
|
4339
|
-
function
|
4340
|
-
_classCallCheck(this,
|
4355
|
+
var Ae = /*#__PURE__*/function () {
|
4356
|
+
function Ae() {
|
4357
|
+
_classCallCheck(this, Ae);
|
4341
4358
|
}
|
4342
|
-
return _createClass(
|
4359
|
+
return _createClass(Ae, null, [{
|
4343
4360
|
key: "request",
|
4344
4361
|
value: function () {
|
4345
4362
|
var _request2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(e, t, i) {
|
@@ -4349,7 +4366,7 @@ var Ce = /*#__PURE__*/function () {
|
|
4349
4366
|
case 0:
|
4350
4367
|
s = !0;
|
4351
4368
|
r = /*#__PURE__*/function () {
|
4352
|
-
var
|
4369
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(c) {
|
4353
4370
|
var h, u, d;
|
4354
4371
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
4355
4372
|
while (1) switch (_context11.prev = _context11.next) {
|
@@ -4372,7 +4389,7 @@ var Ce = /*#__PURE__*/function () {
|
|
4372
4389
|
_context11.t0 = c;
|
4373
4390
|
case 8:
|
4374
4391
|
d = _context11.t0;
|
4375
|
-
|
4392
|
+
y.validateResponseFormat(d) ? typeof d.error == "string" ? (console.error(d.error), i.addNewErrorMessage("service", d.error), e.completionsHandlers.onFinish()) : A.isSimulatable(e.stream, d) ? A.simulate(i, e.streamHandlers, d) : (i.addNewMessage(d), e.completionsHandlers.onFinish()) : (console.error(M.INVALID_RESPONSE(c, "server", !!e.deepChat.responseInterceptor, d)), i.addNewErrorMessage("service", "Error in server message"), e.completionsHandlers.onFinish());
|
4376
4393
|
case 10:
|
4377
4394
|
case "end":
|
4378
4395
|
return _context11.stop();
|
@@ -4380,9 +4397,9 @@ var Ce = /*#__PURE__*/function () {
|
|
4380
4397
|
}, _callee11);
|
4381
4398
|
}));
|
4382
4399
|
return function r(_x24) {
|
4383
|
-
return
|
4400
|
+
return _ref5.apply(this, arguments);
|
4384
4401
|
};
|
4385
|
-
}(), o =
|
4402
|
+
}(), o = Ae.generateOptionalSignals();
|
4386
4403
|
(l = (a = e.connectSettings).handler) == null || l.call(a, t, _objectSpread(_objectSpread({}, o), {}, {
|
4387
4404
|
onResponse: r
|
4388
4405
|
}));
|
@@ -4402,7 +4419,7 @@ var Ce = /*#__PURE__*/function () {
|
|
4402
4419
|
value: function attemptToFinaliseStream(e, t) {
|
4403
4420
|
try {
|
4404
4421
|
var i = t.messageElementRefs[t.messageElementRefs.length - 1];
|
4405
|
-
|
4422
|
+
Be.isLoadingMessage(i) ? t.removeLastMessage() : e.finaliseStreamedMessage();
|
4406
4423
|
} catch (i) {
|
4407
4424
|
console.error(i), t.addNewErrorMessage("service", i);
|
4408
4425
|
}
|
@@ -4414,16 +4431,16 @@ var Ce = /*#__PURE__*/function () {
|
|
4414
4431
|
var h, u;
|
4415
4432
|
var s = !0,
|
4416
4433
|
r = !1;
|
4417
|
-
var o = new
|
4434
|
+
var o = new ve(i),
|
4418
4435
|
a = function a() {
|
4419
4436
|
r || !s || (e.streamHandlers.onOpen(), r = !0);
|
4420
4437
|
},
|
4421
4438
|
l = function l() {
|
4422
|
-
s && (
|
4439
|
+
s && (Ae.attemptToFinaliseStream(o, i), e.streamHandlers.onClose(), s = !1);
|
4423
4440
|
},
|
4424
4441
|
c = /*#__PURE__*/function () {
|
4425
|
-
var
|
4426
|
-
var p,
|
4442
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(f) {
|
4443
|
+
var p, v, m;
|
4427
4444
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
4428
4445
|
while (1) switch (_context13.prev = _context13.next) {
|
4429
4446
|
case 0:
|
@@ -4434,7 +4451,7 @@ var Ce = /*#__PURE__*/function () {
|
|
4434
4451
|
return _context13.abrupt("return");
|
4435
4452
|
case 2:
|
4436
4453
|
_context13.next = 4;
|
4437
|
-
return (
|
4454
|
+
return (v = (p = e.deepChat).responseInterceptor) == null ? void 0 : v.call(p, f);
|
4438
4455
|
case 4:
|
4439
4456
|
_context13.t0 = _context13.sent;
|
4440
4457
|
if (_context13.t0) {
|
@@ -4444,7 +4461,7 @@ var Ce = /*#__PURE__*/function () {
|
|
4444
4461
|
_context13.t0 = f;
|
4445
4462
|
case 7:
|
4446
4463
|
m = _context13.t0;
|
4447
|
-
|
4464
|
+
y.validateResponseFormat(m) ? m.error ? (console.error(m.error), o.finaliseStreamedMessage(), i.addNewErrorMessage("service", m.error), e.streamHandlers.onClose(), s = !1) : A.upsertWFiles(i, o.upsertStreamedMessage.bind(o), o, m) : console.error(M.INVALID_RESPONSE(f, "server", !!e.deepChat.responseInterceptor, m));
|
4448
4465
|
case 9:
|
4449
4466
|
case "end":
|
4450
4467
|
return _context13.stop();
|
@@ -4452,13 +4469,13 @@ var Ce = /*#__PURE__*/function () {
|
|
4452
4469
|
}, _callee13);
|
4453
4470
|
}));
|
4454
4471
|
return function c(_x25) {
|
4455
|
-
return
|
4472
|
+
return _ref6.apply(this, arguments);
|
4456
4473
|
};
|
4457
4474
|
}();
|
4458
4475
|
e.streamHandlers.abortStream.abort = function () {
|
4459
|
-
|
4476
|
+
Ae.attemptToFinaliseStream(o, i), e.streamHandlers.onClose(), s = !1;
|
4460
4477
|
};
|
4461
|
-
var d =
|
4478
|
+
var d = Ae.generateOptionalSignals();
|
4462
4479
|
(u = (h = e.connectSettings).handler) == null || u.call(h, t, _objectSpread(_objectSpread({}, d), {}, {
|
4463
4480
|
onOpen: a,
|
4464
4481
|
onResponse: c,
|
@@ -4487,7 +4504,7 @@ var Ce = /*#__PURE__*/function () {
|
|
4487
4504
|
i.isOpen = !1;
|
4488
4505
|
},
|
4489
4506
|
o = /*#__PURE__*/function () {
|
4490
|
-
var
|
4507
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(d) {
|
4491
4508
|
var u, f, h, m, p;
|
4492
4509
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
4493
4510
|
while (1) switch (_context14.prev = _context14.next) {
|
@@ -4509,7 +4526,7 @@ var Ce = /*#__PURE__*/function () {
|
|
4509
4526
|
_context14.t0 = d;
|
4510
4527
|
case 7:
|
4511
4528
|
h = _context14.t0;
|
4512
|
-
if (!
|
4529
|
+
if (!y.validateResponseFormat(h)) console.error(M.INVALID_RESPONSE(d, "server", !!e.deepChat.responseInterceptor, h)), t.addNewErrorMessage("service", "Error in server message");else if (typeof h.error == "string") console.error(h.error), t.isLastMessageError() || t.addNewErrorMessage("service", h.error);else if (A.isSimulation(e.stream)) {
|
4513
4530
|
m = U.stream.bind(_this7, e, t, i.roleToStream), p = i.roleToStream[d.role || b.AI_ROLE];
|
4514
4531
|
A.upsertWFiles(t, m, p, d);
|
4515
4532
|
} else t.addNewMessage(h);
|
@@ -4520,10 +4537,10 @@ var Ce = /*#__PURE__*/function () {
|
|
4520
4537
|
}, _callee14);
|
4521
4538
|
}));
|
4522
4539
|
return function o(_x26) {
|
4523
|
-
return
|
4540
|
+
return _ref7.apply(this, arguments);
|
4524
4541
|
};
|
4525
4542
|
}(),
|
4526
|
-
a =
|
4543
|
+
a = Ae.generateOptionalSignals();
|
4527
4544
|
(c = (l = e.connectSettings).handler) == null || c.call(l, void 0, _objectSpread(_objectSpread({}, a), {}, {
|
4528
4545
|
onOpen: s,
|
4529
4546
|
onResponse: o,
|
@@ -4561,7 +4578,7 @@ var T = /*#__PURE__*/function () {
|
|
4561
4578
|
f,
|
4562
4579
|
m,
|
4563
4580
|
r,
|
4564
|
-
_yield$
|
4581
|
+
_yield$y$processReque3,
|
4565
4582
|
o,
|
4566
4583
|
a,
|
4567
4584
|
l,
|
@@ -4578,40 +4595,40 @@ var T = /*#__PURE__*/function () {
|
|
4578
4595
|
headers: (u = e.connectSettings) == null ? void 0 : u.headers
|
4579
4596
|
};
|
4580
4597
|
_context16.next = 4;
|
4581
|
-
return
|
4598
|
+
return y.processRequestInterceptor(e.deepChat, r);
|
4582
4599
|
case 4:
|
4583
|
-
_yield$
|
4584
|
-
o = _yield$
|
4585
|
-
a = _yield$
|
4586
|
-
l = _yield$
|
4600
|
+
_yield$y$processReque3 = _context16.sent;
|
4601
|
+
o = _yield$y$processReque3.body;
|
4602
|
+
a = _yield$y$processReque3.headers;
|
4603
|
+
l = _yield$y$processReque3.error;
|
4587
4604
|
c = e.completionsHandlers.onFinish;
|
4588
4605
|
if (!l) {
|
4589
4606
|
_context16.next = 11;
|
4590
4607
|
break;
|
4591
4608
|
}
|
4592
|
-
return _context16.abrupt("return",
|
4609
|
+
return _context16.abrupt("return", y.onInterceptorError(i, l, c));
|
4593
4610
|
case 11:
|
4594
4611
|
if (!((f = e.connectSettings) != null && f.handler)) {
|
4595
4612
|
_context16.next = 13;
|
4596
4613
|
break;
|
4597
4614
|
}
|
4598
|
-
return _context16.abrupt("return",
|
4615
|
+
return _context16.abrupt("return", Ae.request(e, o, i));
|
4599
4616
|
case 13:
|
4600
|
-
if (!(((m = e.connectSettings) == null ? void 0 : m.url) ===
|
4617
|
+
if (!(((m = e.connectSettings) == null ? void 0 : m.url) === ye.URL)) {
|
4601
4618
|
_context16.next = 15;
|
4602
4619
|
break;
|
4603
4620
|
}
|
4604
|
-
return _context16.abrupt("return",
|
4621
|
+
return _context16.abrupt("return", ye.request(e, i));
|
4605
4622
|
case 15:
|
4606
4623
|
d = !0;
|
4607
|
-
h =
|
4624
|
+
h = y.fetch.bind(this, e, a, s);
|
4608
4625
|
h(o).then(function (p) {
|
4609
4626
|
return d = !!p.ok, p;
|
4610
4627
|
}).then(function (p) {
|
4611
|
-
return
|
4628
|
+
return y.processResponseByType(p);
|
4612
4629
|
}).then(/*#__PURE__*/function () {
|
4613
|
-
var
|
4614
|
-
var j, G,
|
4630
|
+
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(p) {
|
4631
|
+
var j, G, v, x;
|
4615
4632
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
4616
4633
|
while (1) switch (_context15.prev = _context15.next) {
|
4617
4634
|
case 0:
|
@@ -4631,9 +4648,9 @@ var T = /*#__PURE__*/function () {
|
|
4631
4648
|
}
|
4632
4649
|
_context15.t0 = p;
|
4633
4650
|
case 7:
|
4634
|
-
|
4651
|
+
v = _context15.t0;
|
4635
4652
|
_context15.next = 10;
|
4636
|
-
return e.extractResultData(
|
4653
|
+
return e.extractResultData(v, h, o);
|
4637
4654
|
case 10:
|
4638
4655
|
x = _context15.sent;
|
4639
4656
|
if (d) {
|
@@ -4646,7 +4663,7 @@ var T = /*#__PURE__*/function () {
|
|
4646
4663
|
_context15.next = 15;
|
4647
4664
|
break;
|
4648
4665
|
}
|
4649
|
-
throw Error(M.INVALID_RESPONSE(p, "response", !!e.deepChat.responseInterceptor,
|
4666
|
+
throw Error(M.INVALID_RESPONSE(p, "response", !!e.deepChat.responseInterceptor, v));
|
4650
4667
|
case 15:
|
4651
4668
|
x.makingAnotherRequest || (A.isSimulatable(e.stream, x) ? A.simulate(i, e.streamHandlers, x) : (i.addNewMessage(x), c()));
|
4652
4669
|
case 16:
|
@@ -4656,10 +4673,10 @@ var T = /*#__PURE__*/function () {
|
|
4656
4673
|
}, _callee15);
|
4657
4674
|
}));
|
4658
4675
|
return function (_x30) {
|
4659
|
-
return
|
4676
|
+
return _ref8.apply(this, arguments);
|
4660
4677
|
};
|
4661
4678
|
}())["catch"](function (p) {
|
4662
|
-
|
4679
|
+
y.displayError(i, p), c();
|
4663
4680
|
});
|
4664
4681
|
case 18:
|
4665
4682
|
case "end":
|
@@ -4679,7 +4696,7 @@ var T = /*#__PURE__*/function () {
|
|
4679
4696
|
fetch(t, i).then(function (o) {
|
4680
4697
|
return o.json();
|
4681
4698
|
}).then(/*#__PURE__*/function () {
|
4682
|
-
var
|
4699
|
+
var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(o) {
|
4683
4700
|
var l, c, a;
|
4684
4701
|
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
4685
4702
|
while (1) switch (_context17.prev = _context17.next) {
|
@@ -4716,10 +4733,10 @@ var T = /*#__PURE__*/function () {
|
|
4716
4733
|
}, _callee17);
|
4717
4734
|
}));
|
4718
4735
|
return function (_x31) {
|
4719
|
-
return
|
4736
|
+
return _ref9.apply(this, arguments);
|
4720
4737
|
};
|
4721
4738
|
}())["catch"](function (o) {
|
4722
|
-
|
4739
|
+
y.displayError(s, o), r();
|
4723
4740
|
});
|
4724
4741
|
}
|
4725
4742
|
// prettier-ignore
|
@@ -4732,7 +4749,7 @@ var T = /*#__PURE__*/function () {
|
|
4732
4749
|
m,
|
4733
4750
|
p,
|
4734
4751
|
r,
|
4735
|
-
_yield$
|
4752
|
+
_yield$y$processReque4,
|
4736
4753
|
o,
|
4737
4754
|
a,
|
4738
4755
|
l,
|
@@ -4750,17 +4767,17 @@ var T = /*#__PURE__*/function () {
|
|
4750
4767
|
headers: (f = e.connectSettings) == null ? void 0 : f.headers
|
4751
4768
|
};
|
4752
4769
|
_context18.next = 4;
|
4753
|
-
return
|
4770
|
+
return y.processRequestInterceptor(e.deepChat, r);
|
4754
4771
|
case 4:
|
4755
|
-
_yield$
|
4756
|
-
o = _yield$
|
4757
|
-
a = _yield$
|
4758
|
-
l = _yield$
|
4772
|
+
_yield$y$processReque4 = _context18.sent;
|
4773
|
+
o = _yield$y$processReque4.body;
|
4774
|
+
a = _yield$y$processReque4.headers;
|
4775
|
+
l = _yield$y$processReque4.error;
|
4759
4776
|
if (!l) {
|
4760
4777
|
_context18.next = 10;
|
4761
4778
|
break;
|
4762
4779
|
}
|
4763
|
-
return _context18.abrupt("return",
|
4780
|
+
return _context18.abrupt("return", y.onInterceptorError(i, l));
|
4764
4781
|
case 10:
|
4765
4782
|
c = ((m = e.connectSettings) == null ? void 0 : m.url) || e.url || "", d = ((p = e.connectSettings) == null ? void 0 : p.method) || "POST", h = s ? JSON.stringify(o) : o, u = {
|
4766
4783
|
method: d,
|
@@ -4788,7 +4805,7 @@ var T = /*#__PURE__*/function () {
|
|
4788
4805
|
headers: i,
|
4789
4806
|
body: c || null
|
4790
4807
|
}).then(function (d) {
|
4791
|
-
return
|
4808
|
+
return y.processResponseByType(d);
|
4792
4809
|
}).then(function (d) {
|
4793
4810
|
l(d, e, r, o);
|
4794
4811
|
})["catch"](function (d) {
|
@@ -4836,21 +4853,31 @@ var pt = /*#__PURE__*/function () {
|
|
4836
4853
|
key: "processLoadedHistory",
|
4837
4854
|
value: function processLoadedHistory(e) {
|
4838
4855
|
var _this9 = this;
|
4839
|
-
var
|
4840
|
-
var
|
4841
|
-
|
4842
|
-
|
4843
|
-
|
4844
|
-
|
4856
|
+
var c;
|
4857
|
+
var _this$_messages = this._messages,
|
4858
|
+
t = _this$_messages.messageElementRefs,
|
4859
|
+
i = _this$_messages.messageToElements,
|
4860
|
+
s = _this$_messages.elementRef,
|
4861
|
+
r = _this$_messages.addAnyMessage,
|
4862
|
+
o = _this$_messages.sendClientUpdate,
|
4863
|
+
a = (c = t[0]) == null ? void 0 : c.outerContainer,
|
4864
|
+
l = s.scrollTop;
|
4865
|
+
e == null || e.reverse().map(function (d) {
|
4866
|
+
if (d) {
|
4867
|
+
var h = r(_objectSpread(_objectSpread({}, d), {}, {
|
4845
4868
|
sendUpdate: !0
|
4846
4869
|
}), !0, !0);
|
4847
|
-
|
4870
|
+
if (h) {
|
4871
|
+
var u = b.getNumberOfElements(h);
|
4872
|
+
i.unshift([h, t.slice(0, u)]);
|
4873
|
+
}
|
4874
|
+
return h;
|
4848
4875
|
} else _this9._isPaginationComplete = !0;
|
4849
|
-
}).filter(function (
|
4850
|
-
return !!
|
4851
|
-
}).reverse().forEach(function (
|
4852
|
-
return
|
4853
|
-
}),
|
4876
|
+
}).filter(function (d) {
|
4877
|
+
return !!d;
|
4878
|
+
}).reverse().forEach(function (d) {
|
4879
|
+
return o(d, !0);
|
4880
|
+
}), a && (s.scrollTop = l + a.offsetTop);
|
4854
4881
|
}
|
4855
4882
|
}, {
|
4856
4883
|
key: "setupLoadHistoryOnScroll",
|
@@ -4905,7 +4932,7 @@ var pt = /*#__PURE__*/function () {
|
|
4905
4932
|
value: function populateInitialHistory(e) {
|
4906
4933
|
var _this11 = this;
|
4907
4934
|
e.forEach(function (t) {
|
4908
|
-
|
4935
|
+
le.processHistoryFile(t), _this11._messages.addNewMessage(t, !0);
|
4909
4936
|
});
|
4910
4937
|
}
|
4911
4938
|
}, {
|
@@ -4962,7 +4989,7 @@ var pt = /*#__PURE__*/function () {
|
|
4962
4989
|
while (1) switch (_context23.prev = _context23.next) {
|
4963
4990
|
case 0:
|
4964
4991
|
e.loadHistory && this.loadInitialHistory(e.loadHistory);
|
4965
|
-
t = e.history ||
|
4992
|
+
t = e.history || le.processHistory(e);
|
4966
4993
|
t && (this.populateInitialHistory(t), this._index += 1);
|
4967
4994
|
case 3:
|
4968
4995
|
case "end":
|
@@ -5010,7 +5037,6 @@ var St = /*#__PURE__*/function () {
|
|
5010
5037
|
value: function getMaxMessages(e, t) {
|
5011
5038
|
return e.slice(Math.max(e.length - t, 0));
|
5012
5039
|
}
|
5013
|
-
// prettier-ignore
|
5014
5040
|
// if maxMessages is not defined we send all messages
|
5015
5041
|
// if maxMessages above 0 we send that number
|
5016
5042
|
// if maxMessages 0 or below we send only what is in the request
|
@@ -5035,7 +5061,7 @@ var P = /*#__PURE__*/function () {
|
|
5035
5061
|
files: t
|
5036
5062
|
};
|
5037
5063
|
if (_typeof(s) == "object") {
|
5038
|
-
|
5064
|
+
le.processFileConfigConnect(s);
|
5039
5065
|
var a = s.files,
|
5040
5066
|
l = s.connect,
|
5041
5067
|
c = s.button;
|
@@ -5134,7 +5160,7 @@ var it = /*#__PURE__*/function () {
|
|
5134
5160
|
var _a$url;
|
5135
5161
|
_classCallCheck(this, it);
|
5136
5162
|
var s, r, o, a, l;
|
5137
|
-
this.rawBody = {}, this.validateKeyProperty = !1, this.canSendMessage = it.canSendMessage, this.connectSettings = {}, this.fileTypes = {}, this.completionsHandlers = {}, this.streamHandlers = {}, this.deepChat = e, this.demo = i, Object.assign(this.rawBody, (s = e.connect) == null ? void 0 : s.additionalBodyProps), this.totalMessagesMaxCharLength = (r = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : r.totalMessagesMaxCharLength, this.maxMessages = (o = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : o.maxMessages, P.set(e, this, t), e.connect && (this.connectSettings = e.connect), this.demo && ((_a$url = (a = this.connectSettings).url) !== null && _a$url !== void 0 ? _a$url : a.url =
|
5163
|
+
this.rawBody = {}, this.validateKeyProperty = !1, this.canSendMessage = it.canSendMessage, this.connectSettings = {}, this.fileTypes = {}, this.completionsHandlers = {}, this.streamHandlers = {}, this.deepChat = e, this.demo = i, Object.assign(this.rawBody, (s = e.connect) == null ? void 0 : s.additionalBodyProps), this.totalMessagesMaxCharLength = (r = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : r.totalMessagesMaxCharLength, this.maxMessages = (o = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : o.maxMessages, P.set(e, this, t), e.connect && (this.connectSettings = e.connect), this.demo && ((_a$url = (a = this.connectSettings).url) !== null && _a$url !== void 0 ? _a$url : a.url = ye.URL), this.connectSettings.websocket && U.setup(this), this.stream = ((l = this.deepChat.connect) == null ? void 0 : l.stream) || le.checkForStream(this.deepChat), e.loadHistory && Ht.addErrorPrefix(this);
|
5138
5164
|
}
|
5139
5165
|
return _createClass(it, [{
|
5140
5166
|
key: "verifyKey",
|
@@ -5259,7 +5285,11 @@ var it = /*#__PURE__*/function () {
|
|
5259
5285
|
}
|
5260
5286
|
throw new Error("Request settings have not been set up");
|
5261
5287
|
case 2:
|
5262
|
-
i = St.processMessages(t.
|
5288
|
+
i = St.processMessages(t.messageToElements.map(function (_ref11) {
|
5289
|
+
var _ref12 = _slicedToArray(_ref11, 1),
|
5290
|
+
s = _ref12[0];
|
5291
|
+
return s;
|
5292
|
+
}), this.maxMessages, this.totalMessagesMaxCharLength);
|
5263
5293
|
if (this.connectSettings.websocket) {
|
5264
5294
|
s = _objectSpread({
|
5265
5295
|
messages: i
|
@@ -5294,9 +5324,9 @@ var it = /*#__PURE__*/function () {
|
|
5294
5324
|
_context29.next = 4;
|
5295
5325
|
break;
|
5296
5326
|
}
|
5297
|
-
return _context29.abrupt("return",
|
5327
|
+
return _context29.abrupt("return", le.handleResponseProperty(e));
|
5298
5328
|
case 4:
|
5299
|
-
if (!
|
5329
|
+
if (!y.validateResponseFormat(e)) {
|
5300
5330
|
_context29.next = 6;
|
5301
5331
|
break;
|
5302
5332
|
}
|
@@ -5410,19 +5440,19 @@ var ui = /*#__PURE__*/function () {
|
|
5410
5440
|
}
|
5411
5441
|
}]);
|
5412
5442
|
}();
|
5413
|
-
var
|
5443
|
+
var we = /*#__PURE__*/function (_HTMLElement) {
|
5414
5444
|
// If this is not working, try using propertyName directly
|
5415
|
-
function
|
5445
|
+
function we() {
|
5416
5446
|
var _this14;
|
5417
|
-
_classCallCheck(this,
|
5418
|
-
_this14 = _callSuper(this,
|
5419
|
-
var t =
|
5447
|
+
_classCallCheck(this, we);
|
5448
|
+
_this14 = _callSuper(this, we), _this14._waitingToRender_ = !1, _this14._propUpdated_ = !1, Object.keys(we._attributeToProperty_).forEach(function (e) {
|
5449
|
+
var t = we._attributeToProperty_[e];
|
5420
5450
|
_this14.constructPropertyAccessors(t), _this14.hasOwnProperty(e) || _this14.constructPropertyAccessors(t, e);
|
5421
5451
|
});
|
5422
5452
|
return _this14;
|
5423
5453
|
}
|
5424
|
-
_inherits(
|
5425
|
-
return _createClass(
|
5454
|
+
_inherits(we, _HTMLElement);
|
5455
|
+
return _createClass(we, [{
|
5426
5456
|
key: "constructPropertyAccessors",
|
5427
5457
|
value:
|
5428
5458
|
// need to be called here as accessors need to be set for the class instance
|
@@ -5441,8 +5471,8 @@ var _e = /*#__PURE__*/function (_HTMLElement) {
|
|
5441
5471
|
key: "attributeChangedCallback",
|
5442
5472
|
value: function attributeChangedCallback(e, t, i) {
|
5443
5473
|
if (t === i) return;
|
5444
|
-
var s =
|
5445
|
-
r =
|
5474
|
+
var s = we._attributes_[e](i),
|
5475
|
+
r = we._attributeToProperty_[e];
|
5446
5476
|
this[r] = s;
|
5447
5477
|
}
|
5448
5478
|
}, {
|
@@ -5451,12 +5481,12 @@ var _e = /*#__PURE__*/function (_HTMLElement) {
|
|
5451
5481
|
}], [{
|
5452
5482
|
key: "observedAttributes",
|
5453
5483
|
get: function get() {
|
5454
|
-
return Object.keys(
|
5484
|
+
return Object.keys(we._attributes_) || [];
|
5455
5485
|
}
|
5456
5486
|
}]);
|
5457
5487
|
}(/*#__PURE__*/_wrapNativeSuper(HTMLElement));
|
5458
|
-
|
5459
|
-
var ls =
|
5488
|
+
we._attributes_ = {}, we._attributeToProperty_ = {};
|
5489
|
+
var ls = we;
|
5460
5490
|
var Co = "<?xml version=\"1.0\" standalone=\"no\"?>\n<svg version=\"1.1\"\n\txmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n\txmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"0.9em\" height=\"0.9em\"\n\tviewBox=\"0 0 1200 1200\" enable-background=\"new 0 0 1200 1200\">\n\t\t<path d=\"\n\t\t\tM669.727,273.516c-22.891-2.476-46.15-3.895-69.727-4.248c-103.025,0.457-209.823,25.517-310.913,73.536\n\t\t\tc-75.058,37.122-148.173,89.529-211.67,154.174C46.232,529.978,6.431,577.76,0,628.74c0.76,44.162,48.153,98.67,77.417,131.764\n\t\t\tc59.543,62.106,130.754,113.013,211.67,154.174c2.75,1.335,5.51,2.654,8.276,3.955l-75.072,131.102l102.005,60.286l551.416-960.033\n\t\t\tl-98.186-60.008L669.727,273.516z M902.563,338.995l-74.927,129.857c34.47,44.782,54.932,100.006,54.932,159.888\n\t\t\tc0,149.257-126.522,270.264-282.642,270.264c-6.749,0-13.29-0.728-19.922-1.172l-49.585,85.84c22.868,2.449,45.99,4.233,69.58,4.541\n\t\t\tc103.123-0.463,209.861-25.812,310.84-73.535c75.058-37.122,148.246-89.529,211.743-154.174\n\t\t\tc31.186-32.999,70.985-80.782,77.417-131.764c-0.76-44.161-48.153-98.669-77.417-131.763\n\t\t\tc-59.543-62.106-130.827-113.013-211.743-154.175C908.108,341.478,905.312,340.287,902.563,338.995L902.563,338.995z\n\t\t\tM599.927,358.478c6.846,0,13.638,0.274,20.361,0.732l-58.081,100.561c-81.514,16.526-142.676,85.88-142.676,168.897\n\t\t\tc0,20.854,3.841,40.819,10.913,59.325c0.008,0.021-0.008,0.053,0,0.074l-58.228,100.854\n\t\t\tc-34.551-44.823-54.932-100.229-54.932-160.182C317.285,479.484,443.808,358.477,599.927,358.478L599.927,358.478z M768.896,570.513\n\t\t\tL638.013,797.271c81.076-16.837,141.797-85.875,141.797-168.603C779.81,608.194,775.724,588.729,768.896,570.513L768.896,570.513z\"\n\t\t\t/>\n</svg>\n",
|
5461
5491
|
Ao = "<?xml version=\"1.0\" standalone=\"no\"?>\n<svg version=\"1.1\"\n\txmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n\txmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"0.9em\" height=\"0.9em\"\n\tviewBox=\"0 0 1200 1200\" enable-background=\"new 0 0 1200 1200\">\n\t\t<path id=\"path6686\" inkscape:connector-curvature=\"0\" d=\"M779.843,599.925c0,95.331-80.664,172.612-180.169,172.612\n\t\t\tc-99.504,0-180.168-77.281-180.168-172.612c0-95.332,80.664-172.612,180.168-172.612\n\t\t\tC699.179,427.312,779.843,504.594,779.843,599.925z M600,240.521c-103.025,0.457-209.814,25.538-310.904,73.557\n\t\t\tc-75.058,37.122-148.206,89.496-211.702,154.141C46.208,501.218,6.431,549,0,599.981c0.76,44.161,48.13,98.669,77.394,131.763\n\t\t\tc59.543,62.106,130.786,113.018,211.702,154.179c94.271,45.751,198.616,72.092,310.904,73.557\n\t\t\tc103.123-0.464,209.888-25.834,310.866-73.557c75.058-37.122,148.243-89.534,211.74-154.179\n\t\t\tc31.185-32.999,70.962-80.782,77.394-131.763c-0.76-44.161-48.13-98.671-77.394-131.764\n\t\t\tc-59.543-62.106-130.824-112.979-211.74-154.141C816.644,268.36,712.042,242.2,600,240.521z M599.924,329.769\n\t\t\tc156.119,0,282.675,120.994,282.675,270.251c0,149.256-126.556,270.25-282.675,270.25S317.249,749.275,317.249,600.02\n\t\t\tC317.249,450.763,443.805,329.769,599.924,329.769L599.924,329.769z\"/>\n</svg>\n";
|
5462
5492
|
var ie = /*#__PURE__*/function () {
|
@@ -5470,16 +5500,16 @@ var ie = /*#__PURE__*/function () {
|
|
5470
5500
|
}
|
5471
5501
|
}]);
|
5472
5502
|
}();
|
5473
|
-
var
|
5474
|
-
function
|
5475
|
-
_classCallCheck(this,
|
5503
|
+
var Ne = /*#__PURE__*/function () {
|
5504
|
+
function Ne() {
|
5505
|
+
_classCallCheck(this, Ne);
|
5476
5506
|
}
|
5477
|
-
return _createClass(
|
5507
|
+
return _createClass(Ne, null, [{
|
5478
5508
|
key: "changeVisibility",
|
5479
5509
|
value:
|
5480
5510
|
// prettier-ignore
|
5481
5511
|
function changeVisibility(e, t, i, s) {
|
5482
|
-
s.target.id ===
|
5512
|
+
s.target.id === Ne.VISIBLE_ICON_ID ? (t.style.display = "none", i.style.display = "block", e.type = "password") : (t.style.display = "block", i.style.display = "none", e.type = "text");
|
5483
5513
|
}
|
5484
5514
|
}, {
|
5485
5515
|
key: "createIconElement",
|
@@ -5493,15 +5523,15 @@ var Oe = /*#__PURE__*/function () {
|
|
5493
5523
|
value: function create(e) {
|
5494
5524
|
var t = document.createElement("div");
|
5495
5525
|
t.id = "visibility-icon-container";
|
5496
|
-
var i =
|
5526
|
+
var i = Ne.createIconElement(Ao, Ne.VISIBLE_ICON_ID);
|
5497
5527
|
i.style.display = "none", t.appendChild(i);
|
5498
|
-
var s =
|
5499
|
-
return t.appendChild(s), t.onclick =
|
5528
|
+
var s = Ne.createIconElement(Co, "not-visible-icon");
|
5529
|
+
return t.appendChild(s), t.onclick = Ne.changeVisibility.bind(this, e, i, s), t;
|
5500
5530
|
}
|
5501
5531
|
}]);
|
5502
5532
|
}();
|
5503
|
-
|
5504
|
-
var cs =
|
5533
|
+
Ne.VISIBLE_ICON_ID = "visible-icon";
|
5534
|
+
var cs = Ne;
|
5505
5535
|
var H = /*#__PURE__*/function () {
|
5506
5536
|
function H() {
|
5507
5537
|
_classCallCheck(this, H);
|
@@ -6110,10 +6140,10 @@ var Ks = {
|
|
6110
6140
|
this.streamHandlers.abortStream.abort = function () {
|
6111
6141
|
i.interruptGenerate();
|
6112
6142
|
}, this.streamHandlers.onOpen();
|
6113
|
-
s = new
|
6143
|
+
s = new ve(e);
|
6114
6144
|
_context36.next = 4;
|
6115
6145
|
return i.generate(t, /*#__PURE__*/function () {
|
6116
|
-
var
|
6146
|
+
var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35(r, o) {
|
6117
6147
|
var a;
|
6118
6148
|
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
6119
6149
|
while (1) switch (_context35.prev = _context35.next) {
|
@@ -6135,7 +6165,7 @@ var Ks = {
|
|
6135
6165
|
}, _callee35);
|
6136
6166
|
}));
|
6137
6167
|
return function (_x63, _x64) {
|
6138
|
-
return
|
6168
|
+
return _ref13.apply(this, arguments);
|
6139
6169
|
};
|
6140
6170
|
}());
|
6141
6171
|
case 4:
|
@@ -6195,30 +6225,30 @@ var Ks = {
|
|
6195
6225
|
key: "generateResp",
|
6196
6226
|
value: function () {
|
6197
6227
|
var _generateResp = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(e, t, i) {
|
6198
|
-
var s, _yield$
|
6228
|
+
var s, _yield$y$processReque5, r, o, a, l, c;
|
6199
6229
|
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
6200
6230
|
while (1) switch (_context38.prev = _context38.next) {
|
6201
6231
|
case 0:
|
6202
6232
|
s = t[t.length - 1].text;
|
6203
6233
|
_context38.next = 3;
|
6204
|
-
return
|
6234
|
+
return y.processRequestInterceptor(this.deepChat, {
|
6205
6235
|
body: {
|
6206
6236
|
text: s
|
6207
6237
|
}
|
6208
6238
|
});
|
6209
6239
|
case 3:
|
6210
|
-
_yield$
|
6211
|
-
r = _yield$
|
6212
|
-
o = _yield$
|
6240
|
+
_yield$y$processReque5 = _context38.sent;
|
6241
|
+
r = _yield$y$processReque5.body;
|
6242
|
+
o = _yield$y$processReque5.error;
|
6213
6243
|
a = !!this.stream;
|
6214
6244
|
try {
|
6215
|
-
if (o)
|
6245
|
+
if (o) y.displayError(e, new Error(o)), (a ? this.streamHandlers.onClose : this.completionsHandlers.onFinish)();else if (!r || !r.text) {
|
6216
6246
|
l = M.INVALID_MODEL_REQUEST({
|
6217
6247
|
body: r
|
6218
6248
|
}, !1);
|
6219
6249
|
console.error(l);
|
6220
6250
|
c = a ? this.streamHandlers.onClose : this.completionsHandlers.onFinish;
|
6221
|
-
|
6251
|
+
y.onInterceptorError(e, l, c);
|
6222
6252
|
} else this.generateRespByType(e, r.text, !!this.stream, i);
|
6223
6253
|
} catch (l) {
|
6224
6254
|
this.unloadChat(l);
|
@@ -6313,7 +6343,7 @@ var Ks = {
|
|
6313
6343
|
_context40.next = 11;
|
6314
6344
|
break;
|
6315
6345
|
}
|
6316
|
-
|
6346
|
+
y.displayError(t, new Error(s.error));
|
6317
6347
|
return _context40.abrupt("return");
|
6318
6348
|
case 11:
|
6319
6349
|
if (!(!s || !s.text)) {
|
@@ -6321,7 +6351,7 @@ var Ks = {
|
|
6321
6351
|
break;
|
6322
6352
|
}
|
6323
6353
|
o = M.INVALID_MODEL_RESPONSE(i, !!e.responseInterceptor, s);
|
6324
|
-
|
6354
|
+
y.displayError(t, new Error(o));
|
6325
6355
|
return _context40.abrupt("return");
|
6326
6356
|
case 15:
|
6327
6357
|
return _context40.abrupt("return", s);
|
@@ -6437,8 +6467,8 @@ var Nt = /*#__PURE__*/function (_z) {
|
|
6437
6467
|
}]);
|
6438
6468
|
}(z);
|
6439
6469
|
Nt.URL_PREFIX = "https://api-inference.huggingface.co/models/";
|
6440
|
-
var
|
6441
|
-
var Jt = /*#__PURE__*/function (
|
6470
|
+
var Le = Nt;
|
6471
|
+
var Jt = /*#__PURE__*/function (_Le) {
|
6442
6472
|
// prettier-ignore
|
6443
6473
|
function Jt(e, t, i, s, r, o) {
|
6444
6474
|
var _this22;
|
@@ -6446,7 +6476,7 @@ var Jt = /*#__PURE__*/function (_Ie) {
|
|
6446
6476
|
_this22 = _callSuper(this, Jt, [e, t, i, s, r, o]), _this22.isTextInputDisabled = !0, _this22.canSendMessage = Jt.canSendFile;
|
6447
6477
|
return _this22;
|
6448
6478
|
}
|
6449
|
-
_inherits(Jt,
|
6479
|
+
_inherits(Jt, _Le);
|
6450
6480
|
return _createClass(Jt, [{
|
6451
6481
|
key: "preprocessBody",
|
6452
6482
|
value: function preprocessBody(e, t, i) {
|
@@ -6490,7 +6520,7 @@ var Jt = /*#__PURE__*/function (_Ie) {
|
|
6490
6520
|
return !!(t != null && t[0]);
|
6491
6521
|
}
|
6492
6522
|
}]);
|
6493
|
-
}(
|
6523
|
+
}(Le);
|
6494
6524
|
var ko = /*#__PURE__*/function (_Jt) {
|
6495
6525
|
// prettier-ignore
|
6496
6526
|
function ko(e) {
|
@@ -6591,11 +6621,11 @@ var Mo = /*#__PURE__*/function (_Jt2) {
|
|
6591
6621
|
}]);
|
6592
6622
|
}(Jt);
|
6593
6623
|
var Zt = "data:image/png;base64,";
|
6594
|
-
var
|
6595
|
-
function
|
6596
|
-
_classCallCheck(this,
|
6624
|
+
var Ee = /*#__PURE__*/function () {
|
6625
|
+
function Ee() {
|
6626
|
+
_classCallCheck(this, Ee);
|
6597
6627
|
}
|
6598
|
-
return _createClass(
|
6628
|
+
return _createClass(Ee, null, [{
|
6599
6629
|
key: "buildHeaders",
|
6600
6630
|
value: function buildHeaders(e) {
|
6601
6631
|
return {
|
@@ -6615,7 +6645,7 @@ var ve = /*#__PURE__*/function () {
|
|
6615
6645
|
return {
|
6616
6646
|
url: "https://api.stability.ai/v1/engines/list",
|
6617
6647
|
method: "GET",
|
6618
|
-
handleVerificationResult:
|
6648
|
+
handleVerificationResult: Ee.handleVerificationResult
|
6619
6649
|
};
|
6620
6650
|
}
|
6621
6651
|
}]);
|
@@ -6646,7 +6676,7 @@ var mi = /*#__PURE__*/function (_Oi) {
|
|
6646
6676
|
}
|
6647
6677
|
}
|
6648
6678
|
};
|
6649
|
-
_this24 = _callSuper(this, mi, [e,
|
6679
|
+
_this24 = _callSuper(this, mi, [e, Ee.buildKeyVerificationDetails(), Ee.buildHeaders, i, s]), _this24.url = "https://api.stability.ai/v1/generation/esrgan-v1-x2plus/image-to-image/upscale", _this24.textInputPlaceholderText = "Describe image changes", _this24.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI</b></div>\n <div style=\"width: 100%; text-align: center; margin-left: -10px; margin-top: 5px\"><b>Image to Image Upscale</b></div>\n <p>Upload an image to generate a new one with higher resolution.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
6650
6680
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageUpscale;
|
6651
6681
|
_typeof(r) == "object" && (r.engine_id && (_this24.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/upscale")), mi.cleanConfig(r), Object.assign(_this24.rawBody, r)), _this24.canSendMessage = mi.canSendFileMessage;
|
6652
6682
|
return _this24;
|
@@ -6682,7 +6712,7 @@ var mi = /*#__PURE__*/function (_Oi) {
|
|
6682
6712
|
throw new Error("Image was not found");
|
6683
6713
|
case 4:
|
6684
6714
|
s = this.createFormDataBody(this.rawBody, i[0]);
|
6685
|
-
|
6715
|
+
y.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, s, e), !1);
|
6686
6716
|
case 6:
|
6687
6717
|
case "end":
|
6688
6718
|
return _context45.stop();
|
@@ -6753,7 +6783,7 @@ var gi = /*#__PURE__*/function (_Oi2) {
|
|
6753
6783
|
}
|
6754
6784
|
}
|
6755
6785
|
};
|
6756
|
-
_this25 = _callSuper(this, gi, [e,
|
6786
|
+
_this25 = _callSuper(this, gi, [e, Ee.buildKeyVerificationDetails(), Ee.buildHeaders, i, s]), _this25.url = "https://api.stability.ai/v1/generation/stable-diffusion-xl-1024-v1-0/image-to-image/masking", _this25._maskSource = "MASK_IMAGE_WHITE", _this25.textInputPlaceholderText = "Describe image changes", _this25.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI</b></div>\n <div style=\"width: 100%; text-align: center; margin-left: -10px; margin-top: 5px\"><b>Image to Image Masking</b></div>\n <p>Upload an image, its mask image to create a new one based on the changes you have described for the mask area.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
6757
6787
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageMasking;
|
6758
6788
|
_typeof(r) == "object" && (r.engine_id && (_this25.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/masking")), r.weight !== void 0 && r.weight !== null && (_this25._imageWeight = r.weight), r.mask_source !== void 0 && r.mask_source !== null && (_this25._maskSource = r.mask_source), gi.cleanConfig(r), Object.assign(_this25.rawBody, r)), _this25.canSendMessage = gi.canSendFileTextMessage;
|
6759
6789
|
return _this25;
|
@@ -6789,7 +6819,7 @@ var gi = /*#__PURE__*/function (_Oi2) {
|
|
6789
6819
|
throw new Error("Image was not found");
|
6790
6820
|
case 4:
|
6791
6821
|
s = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim(), r = this.createFormDataBody(this.rawBody, i[0], i[1], s);
|
6792
|
-
|
6822
|
+
y.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
6793
6823
|
case 6:
|
6794
6824
|
case "end":
|
6795
6825
|
return _context47.stop();
|
@@ -6893,7 +6923,7 @@ var Ro = /*#__PURE__*/function (_Jt3) {
|
|
6893
6923
|
}()
|
6894
6924
|
}]);
|
6895
6925
|
}(Jt);
|
6896
|
-
var Io = /*#__PURE__*/function (
|
6926
|
+
var Io = /*#__PURE__*/function (_Le2) {
|
6897
6927
|
function Io(e) {
|
6898
6928
|
_classCallCheck(this, Io);
|
6899
6929
|
var s, r, o;
|
@@ -6901,7 +6931,7 @@ var Io = /*#__PURE__*/function (_Ie2) {
|
|
6901
6931
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
6902
6932
|
return _callSuper(this, Io, [e, "Once upon a time", "gpt2", t, i]);
|
6903
6933
|
}
|
6904
|
-
_inherits(Io,
|
6934
|
+
_inherits(Io, _Le2);
|
6905
6935
|
return _createClass(Io, [{
|
6906
6936
|
key: "extractResultData",
|
6907
6937
|
value: function () {
|
@@ -6931,8 +6961,8 @@ var Io = /*#__PURE__*/function (_Ie2) {
|
|
6931
6961
|
return extractResultData;
|
6932
6962
|
}()
|
6933
6963
|
}]);
|
6934
|
-
}(
|
6935
|
-
var Lo = /*#__PURE__*/function (
|
6964
|
+
}(Le);
|
6965
|
+
var Lo = /*#__PURE__*/function (_Le3) {
|
6936
6966
|
function Lo(e) {
|
6937
6967
|
var _this26;
|
6938
6968
|
_classCallCheck(this, Lo);
|
@@ -6942,7 +6972,7 @@ var Lo = /*#__PURE__*/function (_Ie3) {
|
|
6942
6972
|
_this26 = _callSuper(this, Lo, [e, "Ask a question", "bert-large-uncased-whole-word-masking-finetuned-squad", t, i]), _this26.permittedErrorPrefixes = ["Authorization header", "Error in"], _this26.context = t.context;
|
6943
6973
|
return _this26;
|
6944
6974
|
}
|
6945
|
-
_inherits(Lo,
|
6975
|
+
_inherits(Lo, _Le3);
|
6946
6976
|
return _createClass(Lo, [{
|
6947
6977
|
key: "preprocessBody",
|
6948
6978
|
value: function preprocessBody(e, t) {
|
@@ -6985,8 +7015,8 @@ var Lo = /*#__PURE__*/function (_Ie3) {
|
|
6985
7015
|
return extractResultData;
|
6986
7016
|
}()
|
6987
7017
|
}]);
|
6988
|
-
}(
|
6989
|
-
var Po = /*#__PURE__*/function (
|
7018
|
+
}(Le);
|
7019
|
+
var Po = /*#__PURE__*/function (_Le4) {
|
6990
7020
|
function Po(e) {
|
6991
7021
|
_classCallCheck(this, Po);
|
6992
7022
|
var s, r, o;
|
@@ -6994,7 +7024,7 @@ var Po = /*#__PURE__*/function (_Ie4) {
|
|
6994
7024
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
6995
7025
|
return _callSuper(this, Po, [e, "Insert text to summarize", "facebook/bart-large-cnn", t, i]);
|
6996
7026
|
}
|
6997
|
-
_inherits(Po,
|
7027
|
+
_inherits(Po, _Le4);
|
6998
7028
|
return _createClass(Po, [{
|
6999
7029
|
key: "extractResultData",
|
7000
7030
|
value: function () {
|
@@ -7024,8 +7054,8 @@ var Po = /*#__PURE__*/function (_Ie4) {
|
|
7024
7054
|
return extractResultData;
|
7025
7055
|
}()
|
7026
7056
|
}]);
|
7027
|
-
}(
|
7028
|
-
var Oo = /*#__PURE__*/function (
|
7057
|
+
}(Le);
|
7058
|
+
var Oo = /*#__PURE__*/function (_Le5) {
|
7029
7059
|
function Oo(e) {
|
7030
7060
|
var _this27$maxMessages;
|
7031
7061
|
var _this27;
|
@@ -7037,7 +7067,7 @@ var Oo = /*#__PURE__*/function (_Ie5) {
|
|
7037
7067
|
return _this27;
|
7038
7068
|
}
|
7039
7069
|
// prettier-ignore
|
7040
|
-
_inherits(Oo,
|
7070
|
+
_inherits(Oo, _Le5);
|
7041
7071
|
return _createClass(Oo, [{
|
7042
7072
|
key: "processMessages",
|
7043
7073
|
value: function processMessages(e) {
|
@@ -7106,7 +7136,7 @@ var Oo = /*#__PURE__*/function (_Ie5) {
|
|
7106
7136
|
return extractResultData;
|
7107
7137
|
}()
|
7108
7138
|
}]);
|
7109
|
-
}(
|
7139
|
+
}(Le);
|
7110
7140
|
var bi = /*#__PURE__*/function (_Oi3) {
|
7111
7141
|
function bi(e) {
|
7112
7142
|
var _this28;
|
@@ -7122,7 +7152,7 @@ var bi = /*#__PURE__*/function (_Oi3) {
|
|
7122
7152
|
}
|
7123
7153
|
}
|
7124
7154
|
};
|
7125
|
-
_this28 = _callSuper(this, bi, [e,
|
7155
|
+
_this28 = _callSuper(this, bi, [e, Ee.buildKeyVerificationDetails(), Ee.buildHeaders, i, s]), _this28.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/image-to-image", _this28.textInputPlaceholderText = "Describe image changes", _this28.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI: Image to Image</b></div>\n <p>Upload an image to create a new one with the changes you have described.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
7126
7156
|
var r = (o = t.stabilityAI) == null ? void 0 : o.imageToImage;
|
7127
7157
|
_typeof(r) == "object" && (r.engine_id && (_this28.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/text-to-image")), r.weight !== void 0 && r.weight !== null && (_this28._imageWeight = r.weight), bi.cleanConfig(r), Object.assign(_this28.rawBody, r)), _this28.canSendMessage = bi.canSendFileTextMessage;
|
7128
7158
|
return _this28;
|
@@ -7158,7 +7188,7 @@ var bi = /*#__PURE__*/function (_Oi3) {
|
|
7158
7188
|
throw new Error("Image was not found");
|
7159
7189
|
case 4:
|
7160
7190
|
s = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim(), r = this.createFormDataBody(this.rawBody, i[0], s);
|
7161
|
-
|
7191
|
+
y.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
7162
7192
|
case 6:
|
7163
7193
|
case "end":
|
7164
7194
|
return _context54.stop();
|
@@ -7214,7 +7244,7 @@ var bi = /*#__PURE__*/function (_Oi3) {
|
|
7214
7244
|
}
|
7215
7245
|
}]);
|
7216
7246
|
}(Oi);
|
7217
|
-
var No = /*#__PURE__*/function (
|
7247
|
+
var No = /*#__PURE__*/function (_Le6) {
|
7218
7248
|
function No(e) {
|
7219
7249
|
_classCallCheck(this, No);
|
7220
7250
|
var s, r, o;
|
@@ -7222,7 +7252,7 @@ var No = /*#__PURE__*/function (_Ie6) {
|
|
7222
7252
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
7223
7253
|
return _callSuper(this, No, [e, "Insert text to translate", "Helsinki-NLP/opus-tatoeba-en-ja", t, i]);
|
7224
7254
|
}
|
7225
|
-
_inherits(No,
|
7255
|
+
_inherits(No, _Le6);
|
7226
7256
|
return _createClass(No, [{
|
7227
7257
|
key: "extractResultData",
|
7228
7258
|
value: function () {
|
@@ -7252,7 +7282,7 @@ var No = /*#__PURE__*/function (_Ie6) {
|
|
7252
7282
|
return extractResultData;
|
7253
7283
|
}()
|
7254
7284
|
}]);
|
7255
|
-
}(
|
7285
|
+
}(Le);
|
7256
7286
|
var vi = /*#__PURE__*/function (_Oi4) {
|
7257
7287
|
function vi(e) {
|
7258
7288
|
var _this29;
|
@@ -7260,7 +7290,7 @@ var vi = /*#__PURE__*/function (_Oi4) {
|
|
7260
7290
|
var r;
|
7261
7291
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
7262
7292
|
i = t.stabilityAI;
|
7263
|
-
_this29 = _callSuper(this, vi, [e,
|
7293
|
+
_this29 = _callSuper(this, vi, [e, Ee.buildKeyVerificationDetails(), Ee.buildHeaders, i]), _this29.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/text-to-image", _this29.textInputPlaceholderText = "Describe an image", _this29.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI: Text to Image</b></div>\n <p>Insert text to generate an image.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
7264
7294
|
var s = (r = t.stabilityAI) == null ? void 0 : r.textToImage;
|
7265
7295
|
_typeof(s) == "object" && (s.engine_id && (_this29.url = "https://api.stability.ai/v1/generation/".concat(s.engine_id, "/text-to-image")), s.weight !== void 0 && s.weight !== null && (_this29._imageWeight = s.weight), vi.cleanConfig(s), Object.assign(_this29.rawBody, s)), _this29.canSendMessage = vi.canSendTextMessage;
|
7266
7296
|
return _this29;
|
@@ -7346,7 +7376,7 @@ var vi = /*#__PURE__*/function (_Oi4) {
|
|
7346
7376
|
}
|
7347
7377
|
}]);
|
7348
7378
|
}(Oi);
|
7349
|
-
var Do = /*#__PURE__*/function (
|
7379
|
+
var Do = /*#__PURE__*/function (_Le7) {
|
7350
7380
|
function Do(e) {
|
7351
7381
|
var _this30;
|
7352
7382
|
_classCallCheck(this, Do);
|
@@ -7356,7 +7386,7 @@ var Do = /*#__PURE__*/function (_Ie7) {
|
|
7356
7386
|
_this30 = _callSuper(this, Do, [e, "The goal of life is [MASK].", "bert-base-uncased", t, i]), _this30.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Hugging Face</b></div>\n <p>Insert a sentence with the word [MASK] and the model will try to fill it for you. E.g. I want [MASK].</p>\n <p>First message may take an extented amount of time to complete as the model needs to be initialized.</p>", _this30.permittedErrorPrefixes = ["Authorization header", "No mask_token"];
|
7357
7387
|
return _this30;
|
7358
7388
|
}
|
7359
|
-
_inherits(Do,
|
7389
|
+
_inherits(Do, _Le7);
|
7360
7390
|
return _createClass(Do, [{
|
7361
7391
|
key: "extractResultData",
|
7362
7392
|
value: function () {
|
@@ -7386,7 +7416,7 @@ var Do = /*#__PURE__*/function (_Ie7) {
|
|
7386
7416
|
return extractResultData;
|
7387
7417
|
}()
|
7388
7418
|
}]);
|
7389
|
-
}(
|
7419
|
+
}(Le);
|
7390
7420
|
var L = /*#__PURE__*/function () {
|
7391
7421
|
function L() {
|
7392
7422
|
_classCallCheck(this, L);
|
@@ -7429,8 +7459,8 @@ var L = /*#__PURE__*/function () {
|
|
7429
7459
|
s = _args60.length > 3 && _args60[3] !== undefined ? _args60[3] : !0;
|
7430
7460
|
e.connectSettings.method = i;
|
7431
7461
|
_context60.next = 4;
|
7432
|
-
return
|
7433
|
-
return
|
7462
|
+
return y.fetch(e, e.connectSettings.headers, s, t).then(function (o) {
|
7463
|
+
return y.processResponseByType(o);
|
7434
7464
|
});
|
7435
7465
|
case 4:
|
7436
7466
|
r = _context60.sent;
|
@@ -7474,10 +7504,10 @@ var ee = /*#__PURE__*/function () {
|
|
7474
7504
|
return _context62.abrupt("return");
|
7475
7505
|
case 3:
|
7476
7506
|
e.url = s;
|
7477
|
-
o = r[
|
7478
|
-
delete r[
|
7507
|
+
o = r[y.CONTENT_TYPE];
|
7508
|
+
delete r[y.CONTENT_TYPE];
|
7479
7509
|
a = i.map(/*#__PURE__*/function () {
|
7480
|
-
var
|
7510
|
+
var _ref14 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee61(l) {
|
7481
7511
|
var c;
|
7482
7512
|
return _regeneratorRuntime().wrap(function _callee61$(_context61) {
|
7483
7513
|
while (1) switch (_context61.prev = _context61.next) {
|
@@ -7493,7 +7523,7 @@ var ee = /*#__PURE__*/function () {
|
|
7493
7523
|
}, _callee61);
|
7494
7524
|
}));
|
7495
7525
|
return function (_x114) {
|
7496
|
-
return
|
7526
|
+
return _ref14.apply(this, arguments);
|
7497
7527
|
};
|
7498
7528
|
}());
|
7499
7529
|
_context62.prev = 7;
|
@@ -7506,11 +7536,11 @@ var ee = /*#__PURE__*/function () {
|
|
7506
7536
|
name: c.filename
|
7507
7537
|
};
|
7508
7538
|
});
|
7509
|
-
return _context62.abrupt("return", (r[
|
7539
|
+
return _context62.abrupt("return", (r[y.CONTENT_TYPE] = o, l));
|
7510
7540
|
case 14:
|
7511
7541
|
_context62.prev = 14;
|
7512
7542
|
_context62.t0 = _context62["catch"](7);
|
7513
|
-
throw r[
|
7543
|
+
throw r[y.CONTENT_TYPE] = o, y.displayError(t, _context62.t0), e.completionsHandlers.onFinish(), _context62.t0;
|
7514
7544
|
case 17:
|
7515
7545
|
case "end":
|
7516
7546
|
return _context62.stop();
|
@@ -7536,8 +7566,8 @@ var ee = /*#__PURE__*/function () {
|
|
7536
7566
|
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
7537
7567
|
while (1) switch (_context63.prev = _context63.next) {
|
7538
7568
|
case 0:
|
7539
|
-
r = t.map(function (
|
7540
|
-
var l =
|
7569
|
+
r = t.map(function (_ref15) {
|
7570
|
+
var l = _ref15.fileId;
|
7541
7571
|
return e.url = "".concat(i).concat(l).concat(s), new Promise(function (c) {
|
7542
7572
|
c(L.directFetch(e, void 0, "GET", !1));
|
7543
7573
|
});
|
@@ -7687,7 +7717,7 @@ var ee = /*#__PURE__*/function () {
|
|
7687
7717
|
value: function parseMessages(e, t, i) {
|
7688
7718
|
var s = [];
|
7689
7719
|
return t.forEach(/*#__PURE__*/function () {
|
7690
|
-
var
|
7720
|
+
var _ref16 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee67(r) {
|
7691
7721
|
return _regeneratorRuntime().wrap(function _callee67$(_context67) {
|
7692
7722
|
while (1) switch (_context67.prev = _context67.next) {
|
7693
7723
|
case 0:
|
@@ -7696,7 +7726,7 @@ var ee = /*#__PURE__*/function () {
|
|
7696
7726
|
}).sort(function (o) {
|
7697
7727
|
return o.text ? -1 : o.image_file ? 1 : 0;
|
7698
7728
|
}).forEach(/*#__PURE__*/function () {
|
7699
|
-
var
|
7729
|
+
var _ref17 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee66(o) {
|
7700
7730
|
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
7701
7731
|
while (1) switch (_context66.prev = _context66.next) {
|
7702
7732
|
case 0:
|
@@ -7708,7 +7738,7 @@ var ee = /*#__PURE__*/function () {
|
|
7708
7738
|
}, _callee66);
|
7709
7739
|
}));
|
7710
7740
|
return function (_x129) {
|
7711
|
-
return
|
7741
|
+
return _ref17.apply(this, arguments);
|
7712
7742
|
};
|
7713
7743
|
}());
|
7714
7744
|
case 1:
|
@@ -7718,7 +7748,7 @@ var ee = /*#__PURE__*/function () {
|
|
7718
7748
|
}, _callee67);
|
7719
7749
|
}));
|
7720
7750
|
return function (_x128) {
|
7721
|
-
return
|
7751
|
+
return _ref16.apply(this, arguments);
|
7722
7752
|
};
|
7723
7753
|
}()), Promise.all(s);
|
7724
7754
|
}
|
@@ -7768,28 +7798,27 @@ var ee = /*#__PURE__*/function () {
|
|
7768
7798
|
}]);
|
7769
7799
|
}();
|
7770
7800
|
ee.FILES_WITH_TEXT_ERROR = "content with type `text` must have `text` values", ee.FUNCTION_TOOL_RESP_ERROR = "Response must contain an array of strings for each individual function/tool_call, see https://deepchat.dev/docs/directConnection/OpenAI/#assistant-functions.";
|
7771
|
-
var
|
7772
|
-
var
|
7773
|
-
|
7801
|
+
var xe = ee;
|
7802
|
+
var De = /*#__PURE__*/function (_z3) {
|
7803
|
+
// prettier-ignore
|
7804
|
+
function De(e, t, i, s, r, o) {
|
7774
7805
|
var _this31;
|
7775
|
-
_classCallCheck(this,
|
7776
|
-
if (_this31 = _callSuper(this,
|
7806
|
+
_classCallCheck(this, De);
|
7807
|
+
if (_this31 = _callSuper(this, De, [e, s, r, o]), _this31.insertKeyPlaceholderText = "OpenAI API Key", _this31.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this31.url = "", _this31.permittedErrorPrefixes = ["Incorrect", "Please send text", Ht.FAILED_ERROR_MESSAGE], _this31.shouldFetchHistory = !1, _this31.searchedForThreadId = !1, _this31.config = {}, _this31.newAssistantDetails = {
|
7777
7808
|
model: "gpt-4"
|
7778
7809
|
}, _this31.waitingForStreamResponse = !1, _this31.isSSEStream = !1, _this31.urlSegments = i, _typeof(t) == "object") {
|
7779
7810
|
_this31.config = t;
|
7780
7811
|
var _this31$config = _this31.config,
|
7781
|
-
|
7782
|
-
|
7783
|
-
|
7784
|
-
Object.assign(_this31.newAssistantDetails,
|
7785
|
-
var l = t.function_handler;
|
7786
|
-
l && (_this31._functionHandler = l), _this31.filesToolType = t.files_tool_type;
|
7812
|
+
a = _this31$config.new_assistant,
|
7813
|
+
l = _this31$config.thread_id,
|
7814
|
+
c = _this31$config.load_thread_history;
|
7815
|
+
Object.assign(_this31.newAssistantDetails, a), l && (_this31.sessionId = l), c && (_this31.shouldFetchHistory = !0), _this31.filesToolType = t.files_tool_type;
|
7787
7816
|
}
|
7788
7817
|
_this31.maxMessages = 1, _this31.isSSEStream = !!(_this31.stream && (_typeof(_this31.stream) != "object" || !_this31.stream.simulation));
|
7789
7818
|
return _assertThisInitialized(_this31);
|
7790
7819
|
}
|
7791
|
-
_inherits(
|
7792
|
-
return _createClass(
|
7820
|
+
_inherits(De, _z3);
|
7821
|
+
return _createClass(De, [{
|
7793
7822
|
key: "fetchHistoryFunc",
|
7794
7823
|
value: function () {
|
7795
7824
|
var _fetchHistoryFunc = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee70() {
|
@@ -7832,19 +7861,19 @@ var Ne = /*#__PURE__*/function (_z3) {
|
|
7832
7861
|
if (t && t.length > 0) {
|
7833
7862
|
var r = this.filesToolType;
|
7834
7863
|
if (typeof this.filesToolType == "function") {
|
7835
|
-
var a = this.filesToolType(t.map(function (
|
7836
|
-
var l =
|
7864
|
+
var a = this.filesToolType(t.map(function (_ref18) {
|
7865
|
+
var l = _ref18.name;
|
7837
7866
|
return l;
|
7838
7867
|
}));
|
7839
7868
|
a === "code_interpreter" || a === "file_search" || a === "images" ? r = a : (console.error("Tool type \"".concat(a, "\" is not valid")), console.error('Expected "code_interpreter" or "file_search" or "images". Going to default to "images"'));
|
7840
7869
|
}
|
7841
|
-
if (r === "file_search") return
|
7842
|
-
if (r === "code_interpreter") return
|
7843
|
-
if (t.find(function (
|
7844
|
-
var a =
|
7870
|
+
if (r === "file_search") return De.processAttachmentsMessage(s, t, "file_search");
|
7871
|
+
if (r === "code_interpreter") return De.processAttachmentsMessage(s, t, "code_interpreter");
|
7872
|
+
if (t.find(function (_ref19) {
|
7873
|
+
var a = _ref19.name;
|
7845
7874
|
return !B.isImageFileExtension(a);
|
7846
7875
|
})) console.error("The uploaded files contained a non-image file"), console.error('Make sure only images can be uploaded or define a "code_interpreter" or "file_search" value in the "files_tool_type" property'), console.warn('Make sure your existing assistant supports these "tools" or specify them in the "new_assistant" property');else {
|
7847
|
-
var _a2 =
|
7876
|
+
var _a2 = De.processImageMessage(s, t);
|
7848
7877
|
if (_a2) return _a2;
|
7849
7878
|
}
|
7850
7879
|
}
|
@@ -7910,13 +7939,13 @@ var Ne = /*#__PURE__*/function (_z3) {
|
|
7910
7939
|
case 11:
|
7911
7940
|
r.assistant_id = _context71.t0;
|
7912
7941
|
case 12:
|
7913
|
-
this.searchedForThreadId || this.searchPreviousMessagesForThreadId(e.
|
7942
|
+
this.searchedForThreadId || this.searchPreviousMessagesForThreadId(e.messageToElements);
|
7914
7943
|
if (!i) {
|
7915
7944
|
_context71.next = 19;
|
7916
7945
|
break;
|
7917
7946
|
}
|
7918
7947
|
_context71.next = 16;
|
7919
|
-
return
|
7948
|
+
return xe.storeFiles(this, e, i, this.urlSegments.storeFiles);
|
7920
7949
|
case 16:
|
7921
7950
|
_context71.t1 = _context71.sent;
|
7922
7951
|
_context71.next = 20;
|
@@ -7970,10 +7999,12 @@ var Ne = /*#__PURE__*/function (_z3) {
|
|
7970
7999
|
}, {
|
7971
8000
|
key: "searchPreviousMessagesForThreadId",
|
7972
8001
|
value: function searchPreviousMessagesForThreadId(e) {
|
7973
|
-
var t = e.find(function (
|
8002
|
+
var t = e.find(function (_ref20) {
|
8003
|
+
var _ref21 = _slicedToArray(_ref20, 1),
|
8004
|
+
i = _ref21[0];
|
7974
8005
|
return i._sessionId;
|
7975
8006
|
});
|
7976
|
-
t && (this.sessionId = t._sessionId), this.searchedForThreadId = !0;
|
8007
|
+
t && (this.sessionId = t[0]._sessionId), this.searchedForThreadId = !0;
|
7977
8008
|
}
|
7978
8009
|
// prettier-ignore
|
7979
8010
|
}, {
|
@@ -7997,7 +8028,7 @@ var Ne = /*#__PURE__*/function (_z3) {
|
|
7997
8028
|
_context73.next = 6;
|
7998
8029
|
break;
|
7999
8030
|
}
|
8000
|
-
throw e.error.message.startsWith(
|
8031
|
+
throw e.error.message.startsWith(xe.FILES_WITH_TEXT_ERROR) ? Error("Please send text with your file(s)") : e.error.message;
|
8001
8032
|
case 6:
|
8002
8033
|
_context73.next = 8;
|
8003
8034
|
return this.assignThreadAndRun(e);
|
@@ -8041,7 +8072,7 @@ var Ne = /*#__PURE__*/function (_z3) {
|
|
8041
8072
|
_context74.next = 9;
|
8042
8073
|
break;
|
8043
8074
|
case 8:
|
8044
|
-
this.sessionId = e.thread_id, this.run_id = e.id, this.messages && this.messages.
|
8075
|
+
this.sessionId = e.thread_id, this.run_id = e.id, this.messages && this.messages.messageToElements.length > 0 && (this.messages.messageToElements[this.messages.messageToElements.length - 1][0]._sessionId = this.sessionId);
|
8045
8076
|
case 9:
|
8046
8077
|
case "end":
|
8047
8078
|
return _context74.stop();
|
@@ -8081,7 +8112,7 @@ var Ne = /*#__PURE__*/function (_z3) {
|
|
8081
8112
|
case 9:
|
8082
8113
|
i = _context75.sent;
|
8083
8114
|
case 10:
|
8084
|
-
return _context75.abrupt("return",
|
8115
|
+
return _context75.abrupt("return", xe.processAPIMessages(this, i, t, this.urlSegments));
|
8085
8116
|
case 11:
|
8086
8117
|
case "end":
|
8087
8118
|
return _context75.stop();
|
@@ -8108,7 +8139,7 @@ var Ne = /*#__PURE__*/function (_z3) {
|
|
8108
8139
|
break;
|
8109
8140
|
}
|
8110
8141
|
return _context76.abrupt("return", {
|
8111
|
-
timeoutMS:
|
8142
|
+
timeoutMS: De.POLLING_TIMEOUT_MS
|
8112
8143
|
});
|
8113
8144
|
case 3:
|
8114
8145
|
if (!(t === "completed" && this.messages)) {
|
@@ -8182,7 +8213,7 @@ var Ne = /*#__PURE__*/function (_z3) {
|
|
8182
8213
|
_context77.next = 8;
|
8183
8214
|
break;
|
8184
8215
|
}
|
8185
|
-
throw Error(
|
8216
|
+
throw Error(xe.FUNCTION_TOOL_RESP_ERROR);
|
8186
8217
|
case 8:
|
8187
8218
|
_context77.next = 10;
|
8188
8219
|
return Promise.all(i);
|
@@ -8194,7 +8225,7 @@ var Ne = /*#__PURE__*/function (_z3) {
|
|
8194
8225
|
_context77.next = 13;
|
8195
8226
|
break;
|
8196
8227
|
}
|
8197
|
-
throw Error(
|
8228
|
+
throw Error(xe.FUNCTION_TOOL_RESP_ERROR);
|
8198
8229
|
case 13:
|
8199
8230
|
r = s.map(function (l, c) {
|
8200
8231
|
return {
|
@@ -8221,7 +8252,7 @@ var Ne = /*#__PURE__*/function (_z3) {
|
|
8221
8252
|
}, "POST");
|
8222
8253
|
case 22:
|
8223
8254
|
return _context77.abrupt("return", {
|
8224
|
-
timeoutMS:
|
8255
|
+
timeoutMS: De.POLLING_TIMEOUT_MS
|
8225
8256
|
});
|
8226
8257
|
case 23:
|
8227
8258
|
case "end":
|
@@ -8299,7 +8330,7 @@ var Ne = /*#__PURE__*/function (_z3) {
|
|
8299
8330
|
}
|
8300
8331
|
l = e.content.find(function (d) {
|
8301
8332
|
return !!d.text;
|
8302
|
-
}) || e.content[0], c =
|
8333
|
+
}) || e.content[0], c = xe.getFilesAndText.bind(this, this, {
|
8303
8334
|
role: "assistant",
|
8304
8335
|
content: e.content
|
8305
8336
|
}, this.urlSegments, l);
|
@@ -8323,7 +8354,7 @@ var Ne = /*#__PURE__*/function (_z3) {
|
|
8323
8354
|
break;
|
8324
8355
|
}
|
8325
8356
|
_context79.next = 11;
|
8326
|
-
return
|
8357
|
+
return xe.processStreamMessages(this, e.delta.content, this.urlSegments);
|
8327
8358
|
case 11:
|
8328
8359
|
_l = _context79.sent;
|
8329
8360
|
return _context79.abrupt("return", {
|
@@ -8416,19 +8447,23 @@ var Ne = /*#__PURE__*/function (_z3) {
|
|
8416
8447
|
}
|
8417
8448
|
}]);
|
8418
8449
|
}(z);
|
8419
|
-
|
8420
|
-
var yi =
|
8450
|
+
De.POLLING_TIMEOUT_MS = 800;
|
8451
|
+
var yi = De;
|
8421
8452
|
var Ii = /*#__PURE__*/function (_yi) {
|
8422
8453
|
function Ii(e) {
|
8423
8454
|
var _o$headers2, _a$OpenAIBeta;
|
8424
8455
|
var _this34;
|
8425
8456
|
_classCallCheck(this, Ii);
|
8426
|
-
var r, o, a;
|
8457
|
+
var r, o, a, l, c;
|
8427
8458
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
8428
8459
|
i = t.openAI,
|
8429
8460
|
s = (r = t.openAI) == null ? void 0 : r.assistant;
|
8430
|
-
_this34 = _callSuper(this, Ii, [e, s, Ii.URL_SEGMENTS, i]), (_o$headers2 = (o = _this34.connectSettings).headers) !== null && _o$headers2 !== void 0 ? _o$headers2 : o.headers = {}, (_a$OpenAIBeta = (a = _this34.connectSettings.headers)["OpenAI-Beta"]) !== null && _a$OpenAIBeta !== void 0 ? _a$OpenAIBeta : a["OpenAI-Beta"] = "assistants=v2", _this34.shouldFetchHistory && _this34.sessionId && (_this34.fetchHistory = _this34.fetchHistoryFunc.bind(_assertThisInitialized(_this34)))
|
8431
|
-
|
8461
|
+
if (_this34 = _callSuper(this, Ii, [e, s, Ii.URL_SEGMENTS, L.buildKeyVerificationDetails(), L.buildHeaders, i]), (_o$headers2 = (o = _this34.connectSettings).headers) !== null && _o$headers2 !== void 0 ? _o$headers2 : o.headers = {}, (_a$OpenAIBeta = (a = _this34.connectSettings.headers)["OpenAI-Beta"]) !== null && _a$OpenAIBeta !== void 0 ? _a$OpenAIBeta : a["OpenAI-Beta"] = "assistants=v2", _this34.shouldFetchHistory && _this34.sessionId && (_this34.fetchHistory = _this34.fetchHistoryFunc.bind(_assertThisInitialized(_this34))), _typeof(s) == "object") {
|
8462
|
+
var _ref22 = (c = (l = e.directConnection) == null ? void 0 : l.openAI) == null ? void 0 : c.assistant,
|
8463
|
+
d = _ref22.function_handler;
|
8464
|
+
d && (_this34._functionHandler = d);
|
8465
|
+
}
|
8466
|
+
return _assertThisInitialized(_this34);
|
8432
8467
|
}
|
8433
8468
|
_inherits(Ii, _yi);
|
8434
8469
|
return _createClass(Ii);
|
@@ -8595,13 +8630,13 @@ var Ls = /*#__PURE__*/function () {
|
|
8595
8630
|
}]);
|
8596
8631
|
}();
|
8597
8632
|
Ls.URL_DETAILS_ERROR_MESSAGE = "Please define the Azure URL Details. [More Information](https://deepchat.dev/docs/directConnection/Azure)";
|
8598
|
-
var
|
8633
|
+
var oe = Ls;
|
8599
8634
|
var mt = /*#__PURE__*/function (_yi2) {
|
8600
8635
|
function mt(e) {
|
8601
|
-
var
|
8636
|
+
var _p$headers;
|
8602
8637
|
var _this36;
|
8603
8638
|
_classCallCheck(this, mt);
|
8604
|
-
var c, d, h, u, f;
|
8639
|
+
var c, d, h, u, f, m, p;
|
8605
8640
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
8606
8641
|
i = t.azure,
|
8607
8642
|
s = (c = t.azure) == null ? void 0 : c.openAI,
|
@@ -8612,20 +8647,25 @@ var mt = /*#__PURE__*/function (_yi2) {
|
|
8612
8647
|
threadsPrefix: "".concat(o).concat(mt.THREAD_RESOURCE),
|
8613
8648
|
threadsPosfix: a,
|
8614
8649
|
newAssistantUrl: "".concat(o).concat(mt.NEW_ASSISTANT_RESOURCE).concat(a),
|
8615
|
-
createMessagePostfix:
|
8616
|
-
listMessagesPostfix:
|
8650
|
+
createMessagePostfix: a,
|
8651
|
+
listMessagesPostfix: "order=desc&api-version=".concat((u = s == null ? void 0 : s.urlDetails) == null ? void 0 : u.version),
|
8617
8652
|
storeFiles: "".concat(o, "files").concat(a),
|
8618
8653
|
getFilesPrefix: "".concat(o, "files/"),
|
8619
8654
|
getFilesPostfix: "/content".concat(a)
|
8620
8655
|
};
|
8621
|
-
_this36 = _callSuper(this, mt, [e, s == null ? void 0 : s.assistant, l, i]), _this36.permittedErrorPrefixes = [
|
8656
|
+
if (_this36 = _callSuper(this, mt, [e, s == null ? void 0 : s.assistant, l, oe.buildKeyVerificationDetails(r), oe.buildHeaders, i]), _this36.permittedErrorPrefixes = [oe.URL_DETAILS_ERROR_MESSAGE], _this36.insertKeyPlaceholderText = "Azure OpenAI API Key", _this36.keyHelpUrl = "https://learn.microsoft.com/en-us/answers/questions/1193991/how-to-get-the-value-of-openai-api-key", _this36.isTextInputDisabled = !1, _typeof(s) == "object") {
|
8657
|
+
var _ref23 = (m = (f = e.directConnection) == null ? void 0 : f.azure) == null ? void 0 : m.openAI,
|
8658
|
+
v = _ref23.function_handler;
|
8659
|
+
v && (_this36._functionHandler = v);
|
8660
|
+
}
|
8661
|
+
oe.validateURLDetails(r) ? (_p$headers = (p = _this36.connectSettings).headers) !== null && _p$headers !== void 0 ? _p$headers : p.headers = {} : (_this36.isTextInputDisabled = !0, _this36.canSendMessage = function () {
|
8622
8662
|
return !1;
|
8623
8663
|
}, setTimeout(function () {
|
8624
8664
|
e.addMessage({
|
8625
|
-
error:
|
8665
|
+
error: oe.URL_DETAILS_ERROR_MESSAGE
|
8626
8666
|
});
|
8627
8667
|
}));
|
8628
|
-
return _this36;
|
8668
|
+
return _assertThisInitialized(_this36);
|
8629
8669
|
}
|
8630
8670
|
_inherits(mt, _yi2);
|
8631
8671
|
return _createClass(mt);
|
@@ -8803,26 +8843,26 @@ var gt = /*#__PURE__*/function (_z5) {
|
|
8803
8843
|
}(z);
|
8804
8844
|
gt.DEFAULT_MODEL = "tts-1", gt.DEFAULT_VOIDE = "alloy";
|
8805
8845
|
var us = gt;
|
8806
|
-
var
|
8807
|
-
function
|
8846
|
+
var de = /*#__PURE__*/function (_z6) {
|
8847
|
+
function de(e) {
|
8808
8848
|
var _o$model2;
|
8809
8849
|
var _this38;
|
8810
|
-
_classCallCheck(this,
|
8850
|
+
_classCallCheck(this, de);
|
8811
8851
|
var r, o;
|
8812
8852
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
8813
8853
|
i = t == null ? void 0 : t.openAI;
|
8814
|
-
_this38 = _callSuper(this,
|
8854
|
+
_this38 = _callSuper(this, de, [e, L.buildKeyVerificationDetails(), L.buildHeaders, i, {
|
8815
8855
|
audio: {}
|
8816
|
-
}]), _this38.insertKeyPlaceholderText = "OpenAI API Key", _this38.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this38.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI : Speech To Text</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/guides/speech-to-text\">here</a> for more info.</p>", _this38.url = "", _this38.permittedErrorPrefixes = ["Invalid"], _this38.textInputPlaceholderText = "Upload an audio file", _this38._service_url =
|
8856
|
+
}]), _this38.insertKeyPlaceholderText = "OpenAI API Key", _this38.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this38.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI : Speech To Text</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/guides/speech-to-text\">here</a> for more info.</p>", _this38.url = "", _this38.permittedErrorPrefixes = ["Invalid"], _this38.textInputPlaceholderText = "Upload an audio file", _this38._service_url = de.AUDIO_TRANSCRIPTIONS_URL;
|
8817
8857
|
var s = (r = t == null ? void 0 : t.openAI) == null ? void 0 : r.audio;
|
8818
|
-
_typeof(s) == "object" && (_this38.processConfig(s),
|
8858
|
+
_typeof(s) == "object" && (_this38.processConfig(s), de.cleanConfig(s), Object.assign(_this38.rawBody, s)), (_o$model2 = (o = _this38.rawBody).model) !== null && _o$model2 !== void 0 ? _o$model2 : o.model = de.DEFAULT_MODEL, _this38.rawBody.response_format = "json", _this38.canSendMessage = de.canSendFileMessage;
|
8819
8859
|
return _this38;
|
8820
8860
|
}
|
8821
|
-
_inherits(
|
8822
|
-
return _createClass(
|
8861
|
+
_inherits(de, _z6);
|
8862
|
+
return _createClass(de, [{
|
8823
8863
|
key: "processConfig",
|
8824
8864
|
value: function processConfig(e) {
|
8825
|
-
e != null && e.type && e.type === "translation" && (this._service_url =
|
8865
|
+
e != null && e.type && e.type === "translation" && (this._service_url = de.AUDIO_TRANSLATIONS_URL, delete e.language);
|
8826
8866
|
}
|
8827
8867
|
}, {
|
8828
8868
|
key: "preprocessBody",
|
@@ -8854,8 +8894,8 @@ var ce = /*#__PURE__*/function (_z6) {
|
|
8854
8894
|
throw new Error("No file was added");
|
8855
8895
|
case 4:
|
8856
8896
|
this.url = this.connectSettings.url || this._service_url;
|
8857
|
-
s = this.preprocessBody(this.rawBody, t), r =
|
8858
|
-
|
8897
|
+
s = this.preprocessBody(this.rawBody, t), r = de.createFormDataBody(s, i[0]);
|
8898
|
+
y.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
8859
8899
|
case 7:
|
8860
8900
|
case "end":
|
8861
8901
|
return _context87.stop();
|
@@ -8914,13 +8954,13 @@ var ce = /*#__PURE__*/function (_z6) {
|
|
8914
8954
|
}
|
8915
8955
|
}]);
|
8916
8956
|
}(z);
|
8917
|
-
|
8918
|
-
var fs =
|
8919
|
-
var
|
8920
|
-
function
|
8921
|
-
_classCallCheck(this,
|
8957
|
+
de.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions", de.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations", de.DEFAULT_MODEL = "whisper-1";
|
8958
|
+
var fs = de;
|
8959
|
+
var ae = /*#__PURE__*/function () {
|
8960
|
+
function ae() {
|
8961
|
+
_classCallCheck(this, ae);
|
8922
8962
|
}
|
8923
|
-
return _createClass(
|
8963
|
+
return _createClass(ae, null, [{
|
8924
8964
|
key: "buildTextToSpeechHeaders",
|
8925
8965
|
value: function buildTextToSpeechHeaders(e, t) {
|
8926
8966
|
return {
|
@@ -8954,7 +8994,7 @@ var oe = /*#__PURE__*/function () {
|
|
8954
8994
|
"Ocp-Apim-Subscription-Key": "".concat(t)
|
8955
8995
|
};
|
8956
8996
|
},
|
8957
|
-
handleVerificationResult:
|
8997
|
+
handleVerificationResult: ae.handleSpeechVerificationResult
|
8958
8998
|
};
|
8959
8999
|
}
|
8960
9000
|
}, {
|
@@ -8983,7 +9023,7 @@ var oe = /*#__PURE__*/function () {
|
|
8983
9023
|
"Ocp-Apim-Subscription-Key": "".concat(t)
|
8984
9024
|
};
|
8985
9025
|
},
|
8986
|
-
handleVerificationResult:
|
9026
|
+
handleVerificationResult: ae.handleLanguageVerificationResult
|
8987
9027
|
};
|
8988
9028
|
}
|
8989
9029
|
// prettier-ignore
|
@@ -9001,9 +9041,9 @@ var oe = /*#__PURE__*/function () {
|
|
9001
9041
|
url: "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=es",
|
9002
9042
|
method: "POST",
|
9003
9043
|
createHeaders: function createHeaders(t) {
|
9004
|
-
return
|
9044
|
+
return ae.buildTranslationHeaders(e, t);
|
9005
9045
|
},
|
9006
|
-
handleVerificationResult:
|
9046
|
+
handleVerificationResult: ae.handleTranslationVerificationResult
|
9007
9047
|
};
|
9008
9048
|
}
|
9009
9049
|
}, {
|
@@ -9022,7 +9062,7 @@ var Uo = /*#__PURE__*/function (_z7) {
|
|
9022
9062
|
function Uo(e, t, i, s, r) {
|
9023
9063
|
var _this39;
|
9024
9064
|
_classCallCheck(this, Uo);
|
9025
|
-
_this39 = _callSuper(this, Uo, [e,
|
9065
|
+
_this39 = _callSuper(this, Uo, [e, ae.buildLanguageKeyVerificationDetails(i), t, s, r]), _this39.insertKeyPlaceholderText = "Azure Language Subscription Key", _this39.keyHelpUrl =
|
9026
9066
|
// eslint-disable-next-line max-len
|
9027
9067
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this39.permittedErrorPrefixes = ["Access"];
|
9028
9068
|
return _this39;
|
@@ -9038,7 +9078,7 @@ var Dt = /*#__PURE__*/function (_Uo) {
|
|
9038
9078
|
var s, r, o, a;
|
9039
9079
|
var t = (r = (s = e.directConnection) == null ? void 0 : s.azure) == null ? void 0 : r.summarization,
|
9040
9080
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
9041
|
-
_this40 = _callSuper(this, Dt, [e,
|
9081
|
+
_this40 = _callSuper(this, Dt, [e, ae.buildSummarizationHeader, t.endpoint, i]), _this40.permittedErrorPrefixes = [Dt.ENDPOINT_ERROR_MESSAGE], _this40.url = "", _this40.textInputPlaceholderText = "Insert text to summarize", _this40.isTextInputDisabled = !1, t.endpoint ? ((_a$language = (a = _this40.rawBody).language) !== null && _a$language !== void 0 ? _a$language : a.language = "en", Object.assign(_this40.rawBody, t), _this40.url = "".concat(t.endpoint, "/language/analyze-text/jobs?api-version=2022-10-01-preview")) : (_this40.isTextInputDisabled = !0, _this40.canSendMessage = function () {
|
9042
9082
|
return !1;
|
9043
9083
|
}, setTimeout(function () {
|
9044
9084
|
e.addMessage({
|
@@ -9387,7 +9427,7 @@ var _n = /*#__PURE__*/function (_z9) {
|
|
9387
9427
|
function _n(e, t, i, s, r) {
|
9388
9428
|
var _this42;
|
9389
9429
|
_classCallCheck(this, _n);
|
9390
|
-
_this42 = _callSuper(this, _n, [e,
|
9430
|
+
_this42 = _callSuper(this, _n, [e, ae.buildSpeechKeyVerificationDetails(i), t, s, r]), _this42.insertKeyPlaceholderText = "Azure Speech Subscription Key", _this42.keyHelpUrl =
|
9391
9431
|
// eslint-disable-next-line max-len
|
9392
9432
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal";
|
9393
9433
|
return _this42;
|
@@ -9404,7 +9444,7 @@ var Je = /*#__PURE__*/function (_n2) {
|
|
9404
9444
|
var s, r, o, a, l, c;
|
9405
9445
|
var t = (r = (s = e.directConnection) == null ? void 0 : s.azure) == null ? void 0 : r.textToSpeech,
|
9406
9446
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
9407
|
-
_this43 = _callSuper(this, Je, [e,
|
9447
|
+
_this43 = _callSuper(this, Je, [e, ae.buildTextToSpeechHeaders.bind({}, (t == null ? void 0 : t.outputFormat) || "audio-16khz-128kbitrate-mono-mp3"), t.region, i]), _this43.permittedErrorPrefixes = [Je.REGION_ERROR_MESSAGE], _this43.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Text To Speech</b></div>\n <p>Insert text to synthesize it to audio.\n <p>\n Click <a href=\"".concat(Je.HELP_LINK, "\">here</a> for more info.\n </p>"), _this43.isTextInputDisabled = !1, _this43.url = "", t.region ? (Object.assign(_this43.rawBody, t), (_a$lang = (a = _this43.rawBody).lang) !== null && _a$lang !== void 0 ? _a$lang : a.lang = "en-US", (_l$name = (l = _this43.rawBody).name) !== null && _l$name !== void 0 ? _l$name : l.name = "en-US-JennyNeural", (_c$gender = (c = _this43.rawBody).gender) !== null && _c$gender !== void 0 ? _c$gender : c.gender = "Female", _this43.url = "https://".concat(t.region, ".tts.speech.microsoft.com/cognitiveservices/v1")) : (_this43.isTextInputDisabled = !0, _this43.canSendMessage = function () {
|
9408
9448
|
return !1;
|
9409
9449
|
}, setTimeout(function () {
|
9410
9450
|
e.addMessage({
|
@@ -9484,10 +9524,10 @@ Je.HELP_LINK =
|
|
9484
9524
|
// eslint-disable-next-line max-len
|
9485
9525
|
"Please define a region config property. [More Information](https://deepchat.dev/docs/directConnection/Azure#TextToSpeech)";
|
9486
9526
|
var ms = Je;
|
9487
|
-
var
|
9488
|
-
function
|
9527
|
+
var Fe = /*#__PURE__*/function (_n3) {
|
9528
|
+
function Fe(e) {
|
9489
9529
|
var _this44;
|
9490
|
-
_classCallCheck(this,
|
9530
|
+
_classCallCheck(this, Fe);
|
9491
9531
|
var r, o, a;
|
9492
9532
|
var t = (o = (r = e.directConnection) == null ? void 0 : r.azure) == null ? void 0 : o.speechToText,
|
9493
9533
|
i = (a = e.directConnection) == null ? void 0 : a.azure,
|
@@ -9498,21 +9538,21 @@ var De = /*#__PURE__*/function (_n3) {
|
|
9498
9538
|
}
|
9499
9539
|
}
|
9500
9540
|
};
|
9501
|
-
if (_this44 = _callSuper(this,
|
9541
|
+
if (_this44 = _callSuper(this, Fe, [e, ae.buildSpeechToTextHeaders, t.region, i, s]), _this44.permittedErrorPrefixes = [Fe.REGION_ERROR_MESSAGE], _this44.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Speech To Text</b></div>\n <p><b>Upload a .wav or .ogg audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"".concat(Fe.HELP_LINK, "\">here</a> for more info.\n </p>"), _this44.url = "", _this44.isTextInputDisabled = !0, _this44.textInputPlaceholderText = "Upload an audio file", !t.region) _this44.isTextInputDisabled = !0, _this44.canSendMessage = function () {
|
9502
9542
|
return !1;
|
9503
9543
|
}, setTimeout(function () {
|
9504
9544
|
e.addMessage({
|
9505
|
-
error:
|
9545
|
+
error: Fe.REGION_ERROR_MESSAGE
|
9506
9546
|
});
|
9507
9547
|
});else {
|
9508
|
-
_this44.canSendMessage =
|
9548
|
+
_this44.canSendMessage = Fe.canFileSendMessage;
|
9509
9549
|
var l = t.lang || "en-US";
|
9510
9550
|
_this44.url = "https://".concat(t.region, ".stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=").concat(l, "&format=detailed"), _this44.recordAudio = void 0;
|
9511
9551
|
}
|
9512
9552
|
return _assertThisInitialized(_this44);
|
9513
9553
|
}
|
9514
|
-
_inherits(
|
9515
|
-
return _createClass(
|
9554
|
+
_inherits(Fe, _n3);
|
9555
|
+
return _createClass(Fe, [{
|
9516
9556
|
key: "callServiceAPI",
|
9517
9557
|
value: function () {
|
9518
9558
|
var _callServiceAPI17 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee97(e, t, i) {
|
@@ -9578,12 +9618,12 @@ var De = /*#__PURE__*/function (_n3) {
|
|
9578
9618
|
}
|
9579
9619
|
}]);
|
9580
9620
|
}(_n);
|
9581
|
-
|
9621
|
+
Fe.HELP_LINK =
|
9582
9622
|
// eslint-disable-next-line max-len
|
9583
|
-
"https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest",
|
9623
|
+
"https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest", Fe.REGION_ERROR_MESSAGE =
|
9584
9624
|
// eslint-disable-next-line max-len
|
9585
9625
|
"Please define a region config property. [More Information](https://deepchat.dev/docs/directConnection/Azure#SpeechToText)";
|
9586
|
-
var gs =
|
9626
|
+
var gs = Fe;
|
9587
9627
|
var jo = /*#__PURE__*/function (_z10) {
|
9588
9628
|
// prettier-ignore
|
9589
9629
|
function jo(e) {
|
@@ -9592,7 +9632,7 @@ var jo = /*#__PURE__*/function (_z10) {
|
|
9592
9632
|
var s, r, o;
|
9593
9633
|
var t = (r = (s = e.directConnection) == null ? void 0 : s.azure) == null ? void 0 : r.translation,
|
9594
9634
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
9595
|
-
_this45 = _callSuper(this, jo, [e,
|
9635
|
+
_this45 = _callSuper(this, jo, [e, ae.buildTranslationKeyVerificationDetails(t.region), ae.buildTranslationHeaders.bind({}, t == null ? void 0 : t.region), i]), _this45.insertKeyPlaceholderText = "Azure Translate Subscription Key", _this45.keyHelpUrl =
|
9596
9636
|
// eslint-disable-next-line max-len
|
9597
9637
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this45.url = "", _this45.url = "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=".concat(t.language || "es");
|
9598
9638
|
return _this45;
|
@@ -9678,8 +9718,8 @@ var vt = /*#__PURE__*/function (_z11) {
|
|
9678
9718
|
var d = r || ((h = o.openAI) == null ? void 0 : h.chat);
|
9679
9719
|
if (_typeof(d) == "object") {
|
9680
9720
|
d.system_prompt && (_this46._systemMessage = vt.generateSystemMessage(d.system_prompt));
|
9681
|
-
var
|
9682
|
-
p =
|
9721
|
+
var _ref24 = (f = (u = e.directConnection) == null ? void 0 : u.openAI) == null ? void 0 : f.chat,
|
9722
|
+
p = _ref24.function_handler;
|
9683
9723
|
p && (_this46._functionHandler = p), _this46.cleanConfig(d), Object.assign(_this46.rawBody, d);
|
9684
9724
|
}
|
9685
9725
|
(_this46$maxMessages = _this46.maxMessages) !== null && _this46$maxMessages !== void 0 ? _this46$maxMessages : _this46.maxMessages = -1, (_m$model = (m = _this46.rawBody).model) !== null && _m$model !== void 0 ? _m$model : m.model = "gpt-4o";
|
@@ -9870,7 +9910,7 @@ var vt = /*#__PURE__*/function (_z11) {
|
|
9870
9910
|
_context104.prev = 17;
|
9871
9911
|
_context104.next = 20;
|
9872
9912
|
return t == null ? void 0 : t(s).then(function (f) {
|
9873
|
-
return
|
9913
|
+
return y.processResponseByType(f);
|
9874
9914
|
});
|
9875
9915
|
case 20:
|
9876
9916
|
_u = _context104.sent;
|
@@ -9944,19 +9984,24 @@ var As = /*#__PURE__*/function (_vt) {
|
|
9944
9984
|
function As(e) {
|
9945
9985
|
var _this48;
|
9946
9986
|
_classCallCheck(this, As);
|
9947
|
-
var o, a, l, c;
|
9987
|
+
var o, a, l, c, d, h, u;
|
9948
9988
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
9949
9989
|
i = t.azure,
|
9950
9990
|
s = ((a = (o = t.azure) == null ? void 0 : o.openAI) == null ? void 0 : a.urlDetails) || {},
|
9951
9991
|
r = (c = (l = t.azure) == null ? void 0 : l.openAI) == null ? void 0 : c.chat;
|
9952
|
-
_this48 = _callSuper(this, As, [e,
|
9992
|
+
if (_this48 = _callSuper(this, As, [e, oe.buildKeyVerificationDetails(s), oe.buildHeaders, i, r]), _this48.permittedErrorPrefixes = [oe.URL_DETAILS_ERROR_MESSAGE], _this48.isTextInputDisabled = !1, _typeof(r) == "object") {
|
9993
|
+
var _ref25 = (u = (h = (d = e.directConnection) == null ? void 0 : d.azure) == null ? void 0 : h.openAI) == null ? void 0 : u.chat,
|
9994
|
+
f = _ref25.function_handler;
|
9995
|
+
f && (_this48._functionHandler = f);
|
9996
|
+
}
|
9997
|
+
oe.validateURLDetails(s) ? _this48.url = As.buildURL(s) : (_this48.isTextInputDisabled = !0, _this48.canSendMessage = function () {
|
9953
9998
|
return !1;
|
9954
9999
|
}, setTimeout(function () {
|
9955
10000
|
e.addMessage({
|
9956
|
-
error:
|
10001
|
+
error: oe.URL_DETAILS_ERROR_MESSAGE
|
9957
10002
|
});
|
9958
10003
|
}));
|
9959
|
-
return _this48;
|
10004
|
+
return _assertThisInitialized(_this48);
|
9960
10005
|
}
|
9961
10006
|
_inherits(As, _vt);
|
9962
10007
|
return _createClass(As, null, [{
|
@@ -9969,10 +10014,10 @@ var As = /*#__PURE__*/function (_vt) {
|
|
9969
10014
|
}
|
9970
10015
|
}]);
|
9971
10016
|
}(vt);
|
9972
|
-
var
|
9973
|
-
function
|
10017
|
+
var he = /*#__PURE__*/function (_z12) {
|
10018
|
+
function he(e) {
|
9974
10019
|
var _this49;
|
9975
|
-
_classCallCheck(this,
|
10020
|
+
_classCallCheck(this, he);
|
9976
10021
|
var o;
|
9977
10022
|
var t = e.directConnection,
|
9978
10023
|
i = t == null ? void 0 : t.openAI,
|
@@ -9984,7 +10029,7 @@ var de = /*#__PURE__*/function (_z12) {
|
|
9984
10029
|
}
|
9985
10030
|
}
|
9986
10031
|
};
|
9987
|
-
_this49 = _callSuper(this,
|
10032
|
+
_this49 = _callSuper(this, he, [e, L.buildKeyVerificationDetails(), L.buildHeaders, i, s]), _this49.insertKeyPlaceholderText = "OpenAI API Key", _this49.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this49.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>", _this49.url = "", _this49.permittedErrorPrefixes = ["Incorrect", "Invalid input image"];
|
9988
10033
|
var r = (o = t == null ? void 0 : t.openAI) == null ? void 0 : o.images;
|
9989
10034
|
if (_this49.camera) {
|
9990
10035
|
var a = _typeof(r) == "object" && r.size ? Number.parseInt(r.size) : 1024;
|
@@ -9995,11 +10040,11 @@ var de = /*#__PURE__*/function (_z12) {
|
|
9995
10040
|
}
|
9996
10041
|
};
|
9997
10042
|
}
|
9998
|
-
_typeof(r) == "object" && Object.assign(_this49.rawBody, r), _this49.canSendMessage =
|
10043
|
+
_typeof(r) == "object" && Object.assign(_this49.rawBody, r), _this49.canSendMessage = he.canFileSendMessage;
|
9999
10044
|
return _this49;
|
10000
10045
|
}
|
10001
|
-
_inherits(
|
10002
|
-
return _createClass(
|
10046
|
+
_inherits(he, _z12);
|
10047
|
+
return _createClass(he, [{
|
10003
10048
|
key: "preprocessBody",
|
10004
10049
|
value: function preprocessBody(e, t) {
|
10005
10050
|
var i = JSON.parse(JSON.stringify(e));
|
@@ -10013,11 +10058,11 @@ var de = /*#__PURE__*/function (_z12) {
|
|
10013
10058
|
var s;
|
10014
10059
|
var r = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim();
|
10015
10060
|
if (i[1] || r && r !== "") {
|
10016
|
-
this.url =
|
10061
|
+
this.url = he.IMAGE_EDIT_URL;
|
10017
10062
|
var l = this.preprocessBody(this.rawBody, r);
|
10018
|
-
s =
|
10019
|
-
} else this.url =
|
10020
|
-
|
10063
|
+
s = he.createFormDataBody(l, i[0], i[1]);
|
10064
|
+
} else this.url = he.IMAGE_VARIATIONS_URL, s = he.createFormDataBody(this.rawBody, i[0]);
|
10065
|
+
y.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, s, e), !1);
|
10021
10066
|
}
|
10022
10067
|
}, {
|
10023
10068
|
key: "callServiceAPI",
|
@@ -10047,7 +10092,7 @@ var de = /*#__PURE__*/function (_z12) {
|
|
10047
10092
|
}
|
10048
10093
|
throw new Error("Request settings have not been set up");
|
10049
10094
|
case 8:
|
10050
|
-
this.url =
|
10095
|
+
this.url = he.IMAGE_GENERATION_URL;
|
10051
10096
|
r = this.preprocessBody(this.rawBody, t[t.length - 1].text);
|
10052
10097
|
T.request(this, r, e);
|
10053
10098
|
case 11:
|
@@ -10119,8 +10164,8 @@ var de = /*#__PURE__*/function (_z12) {
|
|
10119
10164
|
}
|
10120
10165
|
}]);
|
10121
10166
|
}(z);
|
10122
|
-
|
10123
|
-
var bs =
|
10167
|
+
he.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations", he.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations", he.IMAGE_EDIT_URL = "https://api.openai.com/v1/images/edits";
|
10168
|
+
var bs = he;
|
10124
10169
|
var Ho = /*#__PURE__*/function (_Ts3) {
|
10125
10170
|
function Ho(e) {
|
10126
10171
|
var _this50$maxMessages;
|
@@ -10444,11 +10489,11 @@ var Go = /*#__PURE__*/function () {
|
|
10444
10489
|
}]);
|
10445
10490
|
}();
|
10446
10491
|
var Vo = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" \n\t viewBox=\"50 30 420 450\" xml:space=\"preserve\">\n<g filter=\"brightness(0) saturate(100%) invert(16%) sepia(0%) saturate(1942%) hue-rotate(215deg) brightness(99%) contrast(93%)\">\n\t<g>\n\t\t<path d=\"M447.933,103.629c-0.034-3.076-1.224-6.09-3.485-8.352L352.683,3.511c-0.004-0.004-0.007-0.005-0.011-0.008\n\t\t\tC350.505,1.338,347.511,0,344.206,0H89.278C75.361,0,64.04,11.32,64.04,25.237v461.525c0,13.916,11.32,25.237,25.237,25.237\n\t\t\th333.444c13.916,0,25.237-11.32,25.237-25.237V103.753C447.96,103.709,447.937,103.672,447.933,103.629z M356.194,40.931\n\t\t\tl50.834,50.834h-49.572c-0.695,0-1.262-0.567-1.262-1.262V40.931z M423.983,486.763c0,0.695-0.566,1.261-1.261,1.261H89.278\n\t\t\tc-0.695,0-1.261-0.566-1.261-1.261V25.237c0-0.695,0.566-1.261,1.261-1.261h242.94v66.527c0,13.916,11.322,25.239,25.239,25.239\n\t\t\th66.527V486.763z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,164.014H149.912c-6.62,0-11.988,5.367-11.988,11.988c0,6.62,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.368,11.988-11.988C374.076,169.381,368.707,164.014,362.088,164.014z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,236.353H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.62,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.368,11.988-11.988C374.076,241.721,368.707,236.353,362.088,236.353z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M362.088,308.691H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.621,5.368,11.988,11.988,11.988h212.175\n\t\t\tc6.62,0,11.988-5.367,11.988-11.988C374.076,314.06,368.707,308.691,362.088,308.691z\"/>\n\t</g>\n</g>\n<g>\n\t<g>\n\t\t<path d=\"M256,381.031H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.621,5.368,11.988,11.988,11.988H256\n\t\t\tc6.62,0,11.988-5.367,11.988-11.988C267.988,386.398,262.62,381.031,256,381.031z\"/>\n\t</g>\n</g>\n</svg>";
|
10447
|
-
var
|
10448
|
-
function
|
10449
|
-
_classCallCheck(this,
|
10492
|
+
var Oe = /*#__PURE__*/function () {
|
10493
|
+
function Oe() {
|
10494
|
+
_classCallCheck(this, Oe);
|
10450
10495
|
}
|
10451
|
-
return _createClass(
|
10496
|
+
return _createClass(Oe, null, [{
|
10452
10497
|
key: "createImage",
|
10453
10498
|
value: function createImage(e, t, i) {
|
10454
10499
|
var s = new Image();
|
@@ -10463,7 +10508,7 @@ var Pe = /*#__PURE__*/function () {
|
|
10463
10508
|
return _regeneratorRuntime().wrap(function _callee111$(_context111) {
|
10464
10509
|
while (1) switch (_context111.prev = _context111.next) {
|
10465
10510
|
case 0:
|
10466
|
-
r =
|
10511
|
+
r = Oe.createImage(t, e.elementRef, s), o = e.createNewMessageElement("", i);
|
10467
10512
|
o.bubbleElement.appendChild(r), o.bubbleElement.classList.add("image-message"), B.addMessage(e, o, "image", i, s);
|
10468
10513
|
case 2:
|
10469
10514
|
case "end":
|
@@ -10485,7 +10530,7 @@ var Pe = /*#__PURE__*/function () {
|
|
10485
10530
|
}, {
|
10486
10531
|
key: "addNewAudioMessage",
|
10487
10532
|
value: function addNewAudioMessage(e, t, i, s) {
|
10488
|
-
var r =
|
10533
|
+
var r = Oe.createAudioElement(t, i),
|
10489
10534
|
o = e.createMessageElementsOnOrientation("", i, s);
|
10490
10535
|
o.bubbleElement.appendChild(r), o.bubbleElement.classList.add("audio-message"), B.addMessage(e, o, "audio", i, s);
|
10491
10536
|
}
|
@@ -10505,7 +10550,7 @@ var Pe = /*#__PURE__*/function () {
|
|
10505
10550
|
key: "addNewAnyFileMessage",
|
10506
10551
|
value: function addNewAnyFileMessage(e, t, i, s) {
|
10507
10552
|
var r = e.createMessageElementsOnOrientation("", i, s),
|
10508
|
-
o =
|
10553
|
+
o = Oe.createAnyFile(t);
|
10509
10554
|
r.bubbleElement.classList.add("any-file-message-bubble"), r.bubbleElement.appendChild(o), B.addMessage(e, r, "file", i, s);
|
10510
10555
|
}
|
10511
10556
|
// no overwrite previous message logic as it is complex to track which files are to be overwritten
|
@@ -10513,33 +10558,37 @@ var Pe = /*#__PURE__*/function () {
|
|
10513
10558
|
key: "addMessages",
|
10514
10559
|
value: function addMessages(e, t, i, s) {
|
10515
10560
|
t.forEach(function (r) {
|
10516
|
-
r.ref && (r = B.removeFileRef(r)), B.isAudioFile(r) ?
|
10561
|
+
r.ref && (r = B.removeFileRef(r)), B.isAudioFile(r) ? Oe.addNewAudioMessage(e, r, i, s) : B.isImageFile(r) ? Oe.addNewImageMessage(e, r, i, s) : Oe.addNewAnyFileMessage(e, r, i, s);
|
10517
10562
|
});
|
10518
10563
|
}
|
10519
10564
|
}]);
|
10520
10565
|
}();
|
10521
|
-
var
|
10522
|
-
function
|
10566
|
+
var me = /*#__PURE__*/function (_Be) {
|
10567
|
+
function me(e, t, i) {
|
10523
10568
|
var _this52;
|
10524
|
-
_classCallCheck(this,
|
10569
|
+
_classCallCheck(this, me);
|
10525
10570
|
var a, l;
|
10526
|
-
_this52 = _callSuper(this,
|
10571
|
+
_this52 = _callSuper(this, me, [e]);
|
10527
10572
|
var s = t.permittedErrorPrefixes,
|
10528
10573
|
r = t.introPanelMarkUp,
|
10529
10574
|
o = t.demo;
|
10530
|
-
_this52._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, _this52._onClearMessages = hi.onClearMessages.bind(_this52, e), _this52._onError = hi.onError.bind(_this52, e), _this52._displayLoadingMessage =
|
10531
|
-
return JSON.parse(JSON.stringify(_this52.
|
10575
|
+
_this52._errorMessageOverrides = (a = e.errorMessages) == null ? void 0 : a.overrides, _this52._onClearMessages = hi.onClearMessages.bind(_this52, e), _this52._onError = hi.onError.bind(_this52, e), _this52._displayLoadingMessage = me.getDisplayLoadingMessage(e, t), _this52._permittedErrorPrefixes = s, _this52.addSetupMessageIfNeeded(e, t) || _this52.populateIntroPanel(i, r, e.introPanelStyle), _this52.addIntroductoryMessages(e, t), new Ht(e, _this52, t), _this52._displayServiceErrorMessages = (l = e.errorMessages) == null ? void 0 : l.displayServiceErrorMessages, e.getMessages = function () {
|
10576
|
+
return JSON.parse(JSON.stringify(_this52.messageToElements.map(function (_ref26) {
|
10577
|
+
var _ref27 = _slicedToArray(_ref26, 1),
|
10578
|
+
c = _ref27[0];
|
10579
|
+
return c;
|
10580
|
+
})));
|
10532
10581
|
}, e.clearMessages = _this52.clearMessages.bind(_this52, t), e.refreshMessages = _this52.refreshTextMessages.bind(_this52), e.scrollToBottom = J.scrollToBottom.bind(_this52, _this52.elementRef), e.addMessage = function (c, d) {
|
10533
10582
|
_this52.addAnyMessage(_objectSpread(_objectSpread({}, c), {}, {
|
10534
10583
|
sendUpdate: !!d
|
10535
10584
|
}), !d);
|
10536
|
-
}, t.isWebModel() && t.setUpMessages(_this52), o && _this52.prepareDemo(o), e.textToSpeech && bt.processConfig(e.textToSpeech, function (c) {
|
10585
|
+
}, e.updateHTMLMessage = _this52.updateHTMLMessage.bind(_this52), t.isWebModel() && t.setUpMessages(_this52), o && _this52.prepareDemo(o), e.textToSpeech && bt.processConfig(e.textToSpeech, function (c) {
|
10537
10586
|
_this52.textToSpeech = c;
|
10538
10587
|
});
|
10539
10588
|
return _this52;
|
10540
10589
|
}
|
10541
|
-
_inherits(
|
10542
|
-
return _createClass(
|
10590
|
+
_inherits(me, _Be);
|
10591
|
+
return _createClass(me, [{
|
10543
10592
|
key: "prepareDemo",
|
10544
10593
|
value: function prepareDemo(e) {
|
10545
10594
|
_typeof(e) == "object" && (e.response && (this.customDemoResponse = e.response), e.displayErrors && (e.displayErrors["default"] && this.addNewErrorMessage("", ""), e.displayErrors.service && this.addNewErrorMessage("service", ""), e.displayErrors.speechToText && this.addNewErrorMessage("speechToText", "")), e.displayLoadingBubble && this.addLoadingMessage());
|
@@ -10571,7 +10620,7 @@ var Ee = /*#__PURE__*/function (_Fe) {
|
|
10571
10620
|
value: function addIntroductoryMessage(e) {
|
10572
10621
|
var i;
|
10573
10622
|
var t;
|
10574
|
-
e != null && e.text ? t = this.createAndAppendNewMessageElement(e.text, b.AI_ROLE) : e != null && e.html && (t =
|
10623
|
+
e != null && e.text ? t = this.createAndAppendNewMessageElement(e.text, b.AI_ROLE) : e != null && e.html && (t = be.add(this, e.html, b.AI_ROLE, this.messageElementRefs)), t && (this.applyCustomStyles(t, b.AI_ROLE, !1, (i = this.messageStyles) == null ? void 0 : i.intro), t.outerContainer.classList.add("deep-chat-intro"));
|
10575
10624
|
}
|
10576
10625
|
}, {
|
10577
10626
|
key: "removeIntroductoryMessage",
|
@@ -10592,13 +10641,16 @@ var Ee = /*#__PURE__*/function (_Fe) {
|
|
10592
10641
|
value: function addNewMessage(e) {
|
10593
10642
|
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
10594
10643
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
|
10595
|
-
var s =
|
10644
|
+
var s = me.createMessageContent(e),
|
10596
10645
|
r = {
|
10597
10646
|
status: e.overwrite
|
10598
10647
|
};
|
10599
|
-
if (!e.ignoreText && s.text !== void 0 && e.text !== null && (this.addNewTextMessage(s.text, s.role, r, i), !t && this.textToSpeech && s.role !== b.USER_ROLE && bt.speak(s.text, this.textToSpeech)), s.files && Array.isArray(s.files) &&
|
10600
|
-
var o =
|
10601
|
-
|
10648
|
+
if (!e.ignoreText && s.text !== void 0 && e.text !== null && (this.addNewTextMessage(s.text, s.role, r, i), !t && this.textToSpeech && s.role !== b.USER_ROLE && bt.speak(s.text, this.textToSpeech)), s.files && Array.isArray(s.files) && Oe.addMessages(this, s.files, s.role, i), s.html !== void 0 && s.html !== null) {
|
10649
|
+
var o = be.add(this, s.html, s.role, this.messageElementRefs, r, i);
|
10650
|
+
if (Re.isElementTemporary(o) && delete s.html, s.html) {
|
10651
|
+
var a = [o, s];
|
10652
|
+
b.updateRefArr(this.htmlElementsToMessage, a, i);
|
10653
|
+
}
|
10602
10654
|
}
|
10603
10655
|
return this.isValidMessageContent(s) && !i && this.updateStateOnMessage(s, e.overwrite, e.sendUpdate, t), s;
|
10604
10656
|
}
|
@@ -10612,7 +10664,11 @@ var Ee = /*#__PURE__*/function (_Fe) {
|
|
10612
10664
|
value: function updateStateOnMessage(e, t) {
|
10613
10665
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
|
10614
10666
|
var s = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
|
10615
|
-
|
10667
|
+
if (!t) {
|
10668
|
+
var r = b.getNumberOfElements(e);
|
10669
|
+
this.messageToElements.push([e, this.messageElementRefs.slice(this.messageElementRefs.length - r)]);
|
10670
|
+
}
|
10671
|
+
i && this.sendClientUpdate(e, s);
|
10616
10672
|
}
|
10617
10673
|
// prettier-ignore
|
10618
10674
|
}, {
|
@@ -10620,7 +10676,7 @@ var Ee = /*#__PURE__*/function (_Fe) {
|
|
10620
10676
|
value: function removeMessageOnError() {
|
10621
10677
|
var e = this.messageElementRefs[this.messageElementRefs.length - 1],
|
10622
10678
|
t = e == null ? void 0 : e.bubbleElement;
|
10623
|
-
(t != null && t.classList.contains(
|
10679
|
+
(t != null && t.classList.contains(ve.MESSAGE_CLASS) && t.textContent === "" || me.isTemporaryElement(e)) && this.removeLastMessage();
|
10624
10680
|
}
|
10625
10681
|
// prettier-ignore
|
10626
10682
|
}, {
|
@@ -10642,13 +10698,13 @@ var Ee = /*#__PURE__*/function (_Fe) {
|
|
10642
10698
|
key: "getPermittedMessage",
|
10643
10699
|
value: function getPermittedMessage(e) {
|
10644
10700
|
if (e) {
|
10645
|
-
var t =
|
10701
|
+
var t = me.extractErrorMessages(e);
|
10646
10702
|
for (var _i13 = 0; _i13 < t.length; _i13 += 1) {
|
10647
10703
|
var s = t[_i13];
|
10648
10704
|
if (typeof s == "string") {
|
10649
10705
|
if (this._displayServiceErrorMessages) return s;
|
10650
10706
|
if (this._permittedErrorPrefixes) {
|
10651
|
-
var r =
|
10707
|
+
var r = me.checkPermittedErrorPrefixes(this._permittedErrorPrefixes, s);
|
10652
10708
|
if (r) return r;
|
10653
10709
|
}
|
10654
10710
|
}
|
@@ -10665,9 +10721,9 @@ var Ee = /*#__PURE__*/function (_Fe) {
|
|
10665
10721
|
value: function addDefaultLoadingMessage() {
|
10666
10722
|
var e = this.createMessageElements("", b.AI_ROLE),
|
10667
10723
|
t = e.bubbleElement;
|
10668
|
-
e.bubbleElement.classList.add(
|
10724
|
+
e.bubbleElement.classList.add(Me.DOTS_CONTAINER_CLASS);
|
10669
10725
|
var i = document.createElement("div");
|
10670
|
-
return i.classList.add("loading-message-dots"), t.appendChild(i),
|
10726
|
+
return i.classList.add("loading-message-dots"), t.appendChild(i), Me.setDots(t, this.messageStyles), e;
|
10671
10727
|
}
|
10672
10728
|
}, {
|
10673
10729
|
key: "addLoadingMessage",
|
@@ -10675,8 +10731,8 @@ var Ee = /*#__PURE__*/function (_Fe) {
|
|
10675
10731
|
var i, s, r, o, a, l;
|
10676
10732
|
if (!this._displayLoadingMessage) return;
|
10677
10733
|
var e = (r = (s = (i = this.messageStyles) == null ? void 0 : i.loading) == null ? void 0 : s.message) == null ? void 0 : r.html,
|
10678
|
-
t = e ?
|
10679
|
-
this.elementRef.appendChild(t.outerContainer), t.bubbleElement.classList.add(
|
10734
|
+
t = e ? be.createElements(this, e, b.AI_ROLE, !1) : this.addDefaultLoadingMessage();
|
10735
|
+
this.elementRef.appendChild(t.outerContainer), t.bubbleElement.classList.add(Me.BUBBLE_CLASS), this.applyCustomStyles(t, b.AI_ROLE, !1, (l = (a = (o = this.messageStyles) == null ? void 0 : o.loading) == null ? void 0 : a.message) == null ? void 0 : l.styles), J.scrollToBottom(this.elementRef);
|
10680
10736
|
}
|
10681
10737
|
}, {
|
10682
10738
|
key: "populateIntroPanel",
|
@@ -10726,21 +10782,41 @@ var Ee = /*#__PURE__*/function (_Fe) {
|
|
10726
10782
|
key: "clearMessages",
|
10727
10783
|
value:
|
10728
10784
|
// WORK - update all message classes to use deep-chat prefix
|
10785
|
+
// WORK - should retain the messages objects
|
10729
10786
|
function clearMessages(e, t) {
|
10730
|
-
var
|
10787
|
+
var _this$messageToElemen;
|
10788
|
+
var o, a;
|
10731
10789
|
var i = [],
|
10732
10790
|
s = [];
|
10733
|
-
this.messageElementRefs.forEach(function (
|
10734
|
-
|
10735
|
-
|
10736
|
-
|
10737
|
-
|
10738
|
-
|
10739
|
-
|
10740
|
-
var c;
|
10741
|
-
|
10742
|
-
|
10743
|
-
|
10791
|
+
this.messageElementRefs.forEach(function (l) {
|
10792
|
+
me.isActiveElement(l.bubbleElement.classList) ? i.push(l) : l.outerContainer.remove();
|
10793
|
+
}), this.textElementsToText.forEach(function (l) {
|
10794
|
+
var c = l[0].bubbleElement.classList;
|
10795
|
+
me.isActiveElement(c) && s.push(l);
|
10796
|
+
}), Array.from(this.elementRef.children).forEach(function (l) {
|
10797
|
+
var d;
|
10798
|
+
var c = (d = l.children[0]) == null ? void 0 : d.children[0];
|
10799
|
+
c != null && c.classList.contains("error-message-text") && l.remove();
|
10800
|
+
}), this.messageElementRefs = i;
|
10801
|
+
var r = this.messageToElements.filter(function (l) {
|
10802
|
+
return l[0].text !== void 0 || l[0].html !== void 0 ? l[1].find(function (c) {
|
10803
|
+
return me.isActiveElement(c.bubbleElement.classList);
|
10804
|
+
}) : !1;
|
10805
|
+
});
|
10806
|
+
(_this$messageToElemen = this.messageToElements).splice.apply(_this$messageToElemen, [0, this.messageToElements.length].concat(_toConsumableArray(r))), t !== !1 && ((o = this._introPanel) != null && o._elementRef && this._introPanel.display(), this.addIntroductoryMessages()), this.textElementsToText = s, (a = this._onClearMessages) == null || a.call(this), delete e.sessionId;
|
10807
|
+
}
|
10808
|
+
}, {
|
10809
|
+
key: "updateHTMLMessage",
|
10810
|
+
value: function updateHTMLMessage(e, t) {
|
10811
|
+
if (e === void 0 || typeof e != "string") return console.error("The first argument of updateHTMLMessage must be of type String");
|
10812
|
+
if (t === void 0 || typeof t != "number") return console.error("The second argument of updateHTMLMessage must be of type Number");
|
10813
|
+
var i = Math.floor(t),
|
10814
|
+
s = this.messageToElements[i][0];
|
10815
|
+
if (!(s != null && s.html)) return console.error("The message at index ".concat(i, " does not contain a 'html' message"));
|
10816
|
+
var r = this.htmlElementsToMessage.find(function (o) {
|
10817
|
+
return o[1] === s;
|
10818
|
+
});
|
10819
|
+
if (r) be.overwrite(this, e, r[0]), r[1].html = e;else return console.error("Deep Chat error - HTML message was not found");
|
10744
10820
|
}
|
10745
10821
|
}], [{
|
10746
10822
|
key: "getDisplayLoadingMessage",
|
@@ -10761,10 +10837,10 @@ var Ee = /*#__PURE__*/function (_Fe) {
|
|
10761
10837
|
}, {
|
10762
10838
|
key: "isActiveElement",
|
10763
10839
|
value: function isActiveElement(e) {
|
10764
|
-
return e.contains(
|
10840
|
+
return e.contains(Me.BUBBLE_CLASS) || e.contains(Qe.CLASS) || e.contains(ve.MESSAGE_CLASS);
|
10765
10841
|
}
|
10766
10842
|
}]);
|
10767
|
-
}(
|
10843
|
+
}(Be);
|
10768
10844
|
var N = /*#__PURE__*/function () {
|
10769
10845
|
function N() {
|
10770
10846
|
_classCallCheck(this, N);
|
@@ -10885,11 +10961,11 @@ var W = /*#__PURE__*/function () {
|
|
10885
10961
|
}]);
|
10886
10962
|
}();
|
10887
10963
|
var $o = "<?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=\"M16 0c-8.836 0-16 7.163-16 16s7.163 16 16 16c8.837 0 16-7.163 16-16s-7.163-16-16-16zM16 30.032c-7.72 0-14-6.312-14-14.032s6.28-14 14-14 14 6.28 14 14-6.28 14.032-14 14.032zM23 15h-6v-6c0-0.552-0.448-1-1-1s-1 0.448-1 1v6h-6c-0.552 0-1 0.448-1 1s0.448 1 1 1h6v6c0 0.552 0.448 1 1 1s1-0.448 1-1v-6h6c0.552 0 1-0.448 1-1s-0.448-1-1-1z\"></path>\n</svg>";
|
10888
|
-
var
|
10889
|
-
function
|
10890
|
-
_classCallCheck(this,
|
10964
|
+
var fe = /*#__PURE__*/function () {
|
10965
|
+
function fe() {
|
10966
|
+
_classCallCheck(this, fe);
|
10891
10967
|
}
|
10892
|
-
return _createClass(
|
10968
|
+
return _createClass(fe, null, [{
|
10893
10969
|
key: "unsetAllCSS",
|
10894
10970
|
value: function unsetAllCSS(e, t) {
|
10895
10971
|
var i, s;
|
@@ -10910,7 +10986,7 @@ var ue = /*#__PURE__*/function () {
|
|
10910
10986
|
}, {
|
10911
10987
|
key: "setElementCssUpToState",
|
10912
10988
|
value: function setElementCssUpToState(e, t, i) {
|
10913
|
-
|
10989
|
+
fe.setElementsCSS(e, t, "default"), i !== "default" && (fe.setElementsCSS(e, t, "hover"), i !== "hover" && fe.setElementsCSS(e, t, "click"));
|
10914
10990
|
}
|
10915
10991
|
}]);
|
10916
10992
|
}();
|
@@ -10924,22 +11000,22 @@ var Xt = /*#__PURE__*/function () {
|
|
10924
11000
|
return _createClass(Xt, [{
|
10925
11001
|
key: "buttonMouseLeave",
|
10926
11002
|
value: function buttonMouseLeave(e) {
|
10927
|
-
this._mouseState.state = "default", e && (
|
11003
|
+
this._mouseState.state = "default", e && (fe.unsetAllCSS(this.elementRef, e), fe.setElementsCSS(this.elementRef, e, "default"));
|
10928
11004
|
}
|
10929
11005
|
}, {
|
10930
11006
|
key: "buttonMouseEnter",
|
10931
11007
|
value: function buttonMouseEnter(e) {
|
10932
|
-
this._mouseState.state = "hover", e &&
|
11008
|
+
this._mouseState.state = "hover", e && fe.setElementsCSS(this.elementRef, e, "hover");
|
10933
11009
|
}
|
10934
11010
|
}, {
|
10935
11011
|
key: "buttonMouseUp",
|
10936
11012
|
value: function buttonMouseUp(e) {
|
10937
|
-
e &&
|
11013
|
+
e && fe.unsetActionCSS(this.elementRef, e), this.buttonMouseEnter(e);
|
10938
11014
|
}
|
10939
11015
|
}, {
|
10940
11016
|
key: "buttonMouseDown",
|
10941
11017
|
value: function buttonMouseDown(e) {
|
10942
|
-
this._mouseState.state = "click", e &&
|
11018
|
+
this._mouseState.state = "click", e && fe.setElementsCSS(this.elementRef, e, "click");
|
10943
11019
|
}
|
10944
11020
|
// be careful not to use onclick as that is used for button functionality
|
10945
11021
|
}, {
|
@@ -10953,7 +11029,7 @@ var Xt = /*#__PURE__*/function () {
|
|
10953
11029
|
if (this._customStyles) for (var t = 0; t < e.length; t += 1) {
|
10954
11030
|
var _i15 = e[t],
|
10955
11031
|
s = _i15 && this._customStyles[_i15];
|
10956
|
-
s &&
|
11032
|
+
s && fe.unsetActionCSS(this.elementRef, s);
|
10957
11033
|
}
|
10958
11034
|
}
|
10959
11035
|
}, {
|
@@ -10962,7 +11038,7 @@ var Xt = /*#__PURE__*/function () {
|
|
10962
11038
|
if (!this._customStyles) return;
|
10963
11039
|
t && this.unsetCustomStateStyles(t);
|
10964
11040
|
var i = this._customStyles[e];
|
10965
|
-
i &&
|
11041
|
+
i && fe.setElementCssUpToState(this.elementRef, i, this._mouseState.state), this.setEvents(i);
|
10966
11042
|
}
|
10967
11043
|
}]);
|
10968
11044
|
}();
|
@@ -11939,7 +12015,7 @@ var tn = Fi,
|
|
11939
12015
|
sn = ei,
|
11940
12016
|
oi = ti,
|
11941
12017
|
Yi = Ui,
|
11942
|
-
|
12018
|
+
pe = at,
|
11943
12019
|
Qi = ji,
|
11944
12020
|
nn = wt,
|
11945
12021
|
rn = lt,
|
@@ -11947,7 +12023,7 @@ var tn = Fi,
|
|
11947
12023
|
var ca = /*#__PURE__*/function () {
|
11948
12024
|
function ca() {
|
11949
12025
|
_classCallCheck(this, ca);
|
11950
|
-
this.finalTranscript = "", this.interimSpan =
|
12026
|
+
this.finalTranscript = "", this.interimSpan = pe.Elements.createInterimSpan(), this.finalSpan = pe.Elements.createGenericSpan(), this.scrollingSpan = pe.Elements.createGenericSpan(), this.isCursorAtEnd = !1, this.spansPopulated = !1, this.startPadding = "", this.endPadding = "", this.numberOfSpacesBeforeNewText = 0, this.numberOfSpacesAfterNewText = 0, this.isHighlighted = !1, this.primitiveTextRecorded = !1, this.recognizing = !1, this._displayInterimResults = !0, this.insertInCursorLocation = !0, this.autoScroll = !0, this.isRestarting = !1, this.isPaused = !1, this.isWaitingForCommand = !1, this.isTargetInShadow = !1, this.cannotBeStopped = !1, this.resetState();
|
11951
12027
|
}
|
11952
12028
|
return _createClass(ca, [{
|
11953
12029
|
key: "prepareBeforeStart",
|
@@ -11960,12 +12036,12 @@ var ca = /*#__PURE__*/function () {
|
|
11960
12036
|
if (!r) return;
|
11961
12037
|
this.prepare(r);
|
11962
12038
|
} else this.prepare(e.element);
|
11963
|
-
(e == null ? void 0 : e.displayInterimResults) !== void 0 && (this._displayInterimResults = e.displayInterimResults), e != null && e.textColor && (this._finalTextColor = (t = e == null ? void 0 : e.textColor) === null || t === void 0 ? void 0 : t["final"],
|
12039
|
+
(e == null ? void 0 : e.displayInterimResults) !== void 0 && (this._displayInterimResults = e.displayInterimResults), e != null && e.textColor && (this._finalTextColor = (t = e == null ? void 0 : e.textColor) === null || t === void 0 ? void 0 : t["final"], pe.Elements.applyCustomColors(this, e.textColor)), (e == null ? void 0 : e.insertInCursorLocation) !== void 0 && (this.insertInCursorLocation = e.insertInCursorLocation), (e == null ? void 0 : e.autoScroll) !== void 0 && (this.autoScroll = e.autoScroll), this._onResult = e == null ? void 0 : e.onResult, this._onPreResult = e == null ? void 0 : e.onPreResult, this._onStart = e == null ? void 0 : e.onStart, this._onStop = e == null ? void 0 : e.onStop, this._onError = e == null ? void 0 : e.onError, this.onCommandModeTrigger = e == null ? void 0 : e.onCommandModeTrigger, this.onPauseTrigger = e == null ? void 0 : e.onPauseTrigger, this._options = e, !((i = this._options) === null || i === void 0) && i.commands && (this.commands = sn.CommandUtils.process(this._options.commands));
|
11964
12040
|
}
|
11965
12041
|
}, {
|
11966
12042
|
key: "prepare",
|
11967
12043
|
value: function prepare(e) {
|
11968
|
-
Qi.Padding.setState(this, e), Yi.Highlight.setState(this, e), this.isTargetInShadow =
|
12044
|
+
Qi.Padding.setState(this, e), Yi.Highlight.setState(this, e), this.isTargetInShadow = pe.Elements.isInsideShadowDOM(e), pe.Elements.isPrimitiveElement(e) ? (this._primitiveElement = e, this._originalText = this._primitiveElement.value) : (this._genericElement = e, this._originalText = this._genericElement.textContent);
|
11969
12045
|
}
|
11970
12046
|
// there was an attempt to optimize this by not having to restart the service and just reset state:
|
11971
12047
|
// unfortunately it did not work because the service would still continue firing the intermediate and final results
|
@@ -12009,7 +12085,7 @@ var ca = /*#__PURE__*/function () {
|
|
12009
12085
|
}, {
|
12010
12086
|
key: "updateGenericElement",
|
12011
12087
|
value: function updateGenericElement(e, t, i) {
|
12012
|
-
this.isHighlighted && Yi.Highlight.removeForGeneric(this, e), this.spansPopulated ||
|
12088
|
+
this.isHighlighted && Yi.Highlight.removeForGeneric(this, e), this.spansPopulated || pe.Elements.appendSpans(this, e);
|
12013
12089
|
var s = (i ? "" : this.startPadding) + es.Text.lineBreak(this.finalTranscript);
|
12014
12090
|
this.finalSpan.innerHTML = s;
|
12015
12091
|
var r = oi.AutoScroll.isRequired(this.autoScroll, e);
|
@@ -12020,7 +12096,7 @@ var ca = /*#__PURE__*/function () {
|
|
12020
12096
|
}, {
|
12021
12097
|
key: "finalise",
|
12022
12098
|
value: function finalise(e) {
|
12023
|
-
this._genericElement && (e ? (this.finalSpan =
|
12099
|
+
this._genericElement && (e ? (this.finalSpan = pe.Elements.createGenericSpan(), this.setInterimColorToFinal(), this.interimSpan = pe.Elements.createInterimSpan(), this.scrollingSpan = pe.Elements.createGenericSpan()) : this._genericElement.textContent = this._genericElement.textContent, this.spansPopulated = !1), tn.EventListeners.remove(this);
|
12024
12100
|
}
|
12025
12101
|
}, {
|
12026
12102
|
key: "setInterimColorToFinal",
|
@@ -12484,7 +12560,7 @@ Object.defineProperty(wn, "__esModule", {
|
|
12484
12560
|
});
|
12485
12561
|
var hn = Ni,
|
12486
12562
|
ma = ei,
|
12487
|
-
|
12563
|
+
ce = Hi,
|
12488
12564
|
ga = qi;
|
12489
12565
|
var ht = /*#__PURE__*/function () {
|
12490
12566
|
function ht() {
|
@@ -12495,12 +12571,12 @@ var ht = /*#__PURE__*/function () {
|
|
12495
12571
|
value: function toggle(e, t) {
|
12496
12572
|
var i, s;
|
12497
12573
|
var r = e.toLocaleLowerCase().trim();
|
12498
|
-
!((i =
|
12574
|
+
!((i = ce.GlobalState.service) === null || i === void 0) && i.recognizing ? this.stop() : r === "webspeech" ? ht.startWebSpeech(t) : r === "azure" ? ht.startAzure(t) : (console.error("service not found - must be either 'webspeech' or 'azure'"), (s = t == null ? void 0 : t.onError) === null || s === void 0 || s.call(t, "service not found - must be either 'webspeech' or 'azure'"));
|
12499
12575
|
}
|
12500
12576
|
}, {
|
12501
12577
|
key: "startWebSpeech",
|
12502
12578
|
value: function startWebSpeech(e) {
|
12503
|
-
ht.stop() || (
|
12579
|
+
ht.stop() || (ce.GlobalState.service = new hn.WebSpeech(), ce.GlobalState.service.start(e));
|
12504
12580
|
}
|
12505
12581
|
}, {
|
12506
12582
|
key: "isWebSpeechSupported",
|
@@ -12511,18 +12587,18 @@ var ht = /*#__PURE__*/function () {
|
|
12511
12587
|
key: "startAzure",
|
12512
12588
|
value: function startAzure(e) {
|
12513
12589
|
var t;
|
12514
|
-
ht.stop() || !((t =
|
12590
|
+
ht.stop() || !((t = ce.GlobalState.service) === null || t === void 0) && t.cannotBeStopped || (ce.GlobalState.service = new ga.Azure(), ce.GlobalState.service.start(e));
|
12515
12591
|
}
|
12516
12592
|
}, {
|
12517
12593
|
key: "stop",
|
12518
12594
|
value: function stop() {
|
12519
12595
|
var e;
|
12520
|
-
return
|
12596
|
+
return ce.GlobalState.doubleClickDetector() ? !0 : (!((e = ce.GlobalState.service) === null || e === void 0) && e.recognizing && ce.GlobalState.service.stop(), !1);
|
12521
12597
|
}
|
12522
12598
|
}, {
|
12523
12599
|
key: "endCommandMode",
|
12524
12600
|
value: function endCommandMode() {
|
12525
|
-
|
12601
|
+
ce.GlobalState.service && ma.CommandUtils.toggleCommandModeOff(ce.GlobalState.service);
|
12526
12602
|
}
|
12527
12603
|
}]);
|
12528
12604
|
}();
|
@@ -12672,32 +12748,32 @@ var Ft = /*#__PURE__*/function (_Gt) {
|
|
12672
12748
|
}(Gt);
|
12673
12749
|
Ft.MICROPHONE_RESET_TIMEOUT_MS = 300;
|
12674
12750
|
var $t = Ft;
|
12675
|
-
var
|
12751
|
+
var ke = /*#__PURE__*/function () {
|
12676
12752
|
// prettier-ignore
|
12677
|
-
function
|
12753
|
+
function ke(e, t, i, s) {
|
12678
12754
|
var _this65 = this;
|
12679
|
-
_classCallCheck(this,
|
12755
|
+
_classCallCheck(this, ke);
|
12680
12756
|
this._attachments = [], this._fileCountLimit = 99, this._acceptedFormat = "", t.maxNumberOfFiles && (this._fileCountLimit = t.maxNumberOfFiles), this._toggleContainerDisplay = i, this._fileAttachmentsContainerRef = s, t.acceptedFormats && (this._acceptedFormat = t.acceptedFormats), setTimeout(function () {
|
12681
12757
|
_this65._validationHandler = e._validationHandler;
|
12682
12758
|
});
|
12683
12759
|
}
|
12684
|
-
return _createClass(
|
12760
|
+
return _createClass(ke, [{
|
12685
12761
|
key: "attemptAddFile",
|
12686
12762
|
value: function attemptAddFile(e, t) {
|
12687
|
-
return
|
12763
|
+
return ke.isFileTypeValid(e, this._acceptedFormat) ? (this.addAttachmentBasedOnType(e, t, !0), !0) : !1;
|
12688
12764
|
}
|
12689
12765
|
}, {
|
12690
12766
|
key: "addAttachmentBasedOnType",
|
12691
12767
|
value: function addAttachmentBasedOnType(e, t, i) {
|
12692
|
-
var s =
|
12768
|
+
var s = ke.getTypeFromBlob(e);
|
12693
12769
|
if (s === "image") {
|
12694
|
-
var r =
|
12770
|
+
var r = ke.createImageAttachment(t);
|
12695
12771
|
this.addFileAttachment(e, "image", r, i);
|
12696
12772
|
} else if (s === "audio") {
|
12697
12773
|
var _r3 = Wt.createAudioAttachment(t);
|
12698
12774
|
this.addFileAttachment(e, "audio", _r3, i);
|
12699
12775
|
} else {
|
12700
|
-
var _r4 =
|
12776
|
+
var _r4 = ke.createAnyFileAttachment(e.name);
|
12701
12777
|
this.addFileAttachment(e, "any", _r4, i);
|
12702
12778
|
}
|
12703
12779
|
}
|
@@ -12705,7 +12781,7 @@ var Ae = /*#__PURE__*/function () {
|
|
12705
12781
|
key: "addFileAttachment",
|
12706
12782
|
value: function addFileAttachment(e, t, i, s) {
|
12707
12783
|
var a;
|
12708
|
-
var r =
|
12784
|
+
var r = ke.createContainer(i);
|
12709
12785
|
if (this._attachments.length >= this._fileCountLimit) {
|
12710
12786
|
var l = this._attachments[this._attachments.length - 1].removeButton;
|
12711
12787
|
l == null || l.click();
|
@@ -12807,19 +12883,19 @@ var Ae = /*#__PURE__*/function () {
|
|
12807
12883
|
}();
|
12808
12884
|
var va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <title>play</title>\n <path d=\"M5.92 24.096q0 1.088 0.928 1.728 0.512 0.288 1.088 0.288 0.448 0 0.896-0.224l16.16-8.064q0.48-0.256 0.8-0.736t0.288-1.088-0.288-1.056-0.8-0.736l-16.16-8.064q-0.448-0.224-0.896-0.224-0.544 0-1.088 0.288-0.928 0.608-0.928 1.728v16.16z\"></path>\n</svg>",
|
12809
12885
|
un = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n<title>stop</title>\n<path d=\"M5.92 24.096q0 0.832 0.576 1.408t1.44 0.608h16.128q0.832 0 1.44-0.608t0.576-1.408v-16.16q0-0.832-0.576-1.44t-1.44-0.576h-16.128q-0.832 0-1.44 0.576t-0.576 1.44v16.16z\"></path>\n</svg>",
|
12810
|
-
|
12886
|
+
Te = /*#__PURE__*/function (_ke) {
|
12811
12887
|
// prettier-ignore
|
12812
|
-
function
|
12813
|
-
_classCallCheck(this,
|
12814
|
-
return _callSuper(this,
|
12888
|
+
function Te(e, t, i, s) {
|
12889
|
+
_classCallCheck(this, Te);
|
12890
|
+
return _callSuper(this, Te, [e, t, i, s]);
|
12815
12891
|
}
|
12816
|
-
_inherits(
|
12817
|
-
return _createClass(
|
12892
|
+
_inherits(Te, _ke);
|
12893
|
+
return _createClass(Te, [{
|
12818
12894
|
key: "createTimer",
|
12819
12895
|
value: function createTimer(e, t) {
|
12820
12896
|
var _this66 = this;
|
12821
12897
|
var i = 0;
|
12822
|
-
var s = t !== void 0 && t <
|
12898
|
+
var s = t !== void 0 && t < Te.TIMER_LIMIT_S ? t : Te.TIMER_LIMIT_S;
|
12823
12899
|
return setInterval(function () {
|
12824
12900
|
var a;
|
12825
12901
|
i += 1, i === s && ((a = _this66.stopPlaceholderCallback) == null || a.call(_this66), _this66.clearTimer()), i === 600 && e.classList.add("audio-placeholder-text-4-digits");
|
@@ -12831,7 +12907,7 @@ var va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12831
12907
|
}, {
|
12832
12908
|
key: "createPlaceholderAudioAttachment",
|
12833
12909
|
value: function createPlaceholderAudioAttachment(e) {
|
12834
|
-
var t =
|
12910
|
+
var t = Te.createAudioContainer(),
|
12835
12911
|
i = document.createElement("div");
|
12836
12912
|
i.classList.add("audio-placeholder-text-3-digits");
|
12837
12913
|
var s = document.createElement("div");
|
@@ -12868,7 +12944,7 @@ var va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12868
12944
|
key: "completePlaceholderAttachment",
|
12869
12945
|
value: function completePlaceholderAttachment(e, t) {
|
12870
12946
|
var i = this._activePlaceholderAttachment;
|
12871
|
-
i && (i.file = e,
|
12947
|
+
i && (i.file = e, Te.addAudioElements(i.attachmentContainerElement.children[0], t), i.removeButton = this.createRemoveAttachmentButton(i), i.attachmentContainerElement.appendChild(i.removeButton), this._activePlaceholderAttachment = void 0, this.clearTimer());
|
12872
12948
|
}
|
12873
12949
|
}, {
|
12874
12950
|
key: "removePlaceholderAttachment",
|
@@ -12908,8 +12984,8 @@ var va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12908
12984
|
}, {
|
12909
12985
|
key: "createAudioAttachment",
|
12910
12986
|
value: function createAudioAttachment(e) {
|
12911
|
-
var t =
|
12912
|
-
return
|
12987
|
+
var t = Te.createAudioContainer();
|
12988
|
+
return Te.addAudioElements(t, e), t;
|
12913
12989
|
}
|
12914
12990
|
}, {
|
12915
12991
|
key: "stopAttachmentPlayback",
|
@@ -12918,9 +12994,9 @@ var va = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12918
12994
|
(s = (i = (t = e.children[0]) == null ? void 0 : t.children) == null ? void 0 : i[0]) != null && s.classList.contains("stop-icon") && e.children[0].click();
|
12919
12995
|
}
|
12920
12996
|
}]);
|
12921
|
-
}(
|
12922
|
-
|
12923
|
-
var Wt =
|
12997
|
+
}(ke);
|
12998
|
+
Te.TIMER_LIMIT_S = 5999;
|
12999
|
+
var Wt = Te;
|
12924
13000
|
var ya = /*#__PURE__*/function () {
|
12925
13001
|
function ya() {
|
12926
13002
|
_classCallCheck(this, ya);
|
@@ -12930,7 +13006,7 @@ var ya = /*#__PURE__*/function () {
|
|
12930
13006
|
value:
|
12931
13007
|
// prettier-ignore
|
12932
13008
|
function create(e, t, i, s, r) {
|
12933
|
-
return r === "audio" ? new Wt(e, t, i, s) : new
|
13009
|
+
return r === "audio" ? new Wt(e, t, i, s) : new ke(e, t, i, s);
|
12934
13010
|
}
|
12935
13011
|
}]);
|
12936
13012
|
}();
|
@@ -12976,7 +13052,7 @@ var ii = /*#__PURE__*/function () {
|
|
12976
13052
|
case 0:
|
12977
13053
|
_context118.next = 2;
|
12978
13054
|
return Promise.all(this._fileAttachmentsTypes.map(/*#__PURE__*/function () {
|
12979
|
-
var
|
13055
|
+
var _ref28 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee117(e) {
|
12980
13056
|
var t;
|
12981
13057
|
return _regeneratorRuntime().wrap(function _callee117$(_context117) {
|
12982
13058
|
while (1) switch (_context117.prev = _context117.next) {
|
@@ -12989,7 +13065,7 @@ var ii = /*#__PURE__*/function () {
|
|
12989
13065
|
}, _callee117);
|
12990
13066
|
}));
|
12991
13067
|
return function (_x213) {
|
12992
|
-
return
|
13068
|
+
return _ref28.apply(this, arguments);
|
12993
13069
|
};
|
12994
13070
|
}()));
|
12995
13071
|
case 2:
|
@@ -13032,12 +13108,12 @@ var ii = /*#__PURE__*/function () {
|
|
13032
13108
|
}
|
13033
13109
|
}]);
|
13034
13110
|
}();
|
13035
|
-
var
|
13036
|
-
function
|
13037
|
-
_classCallCheck(this,
|
13038
|
-
this._isOpen = !1, this._contentRef =
|
13111
|
+
var ue = /*#__PURE__*/function () {
|
13112
|
+
function ue(e, t, i) {
|
13113
|
+
_classCallCheck(this, ue);
|
13114
|
+
this._isOpen = !1, this._contentRef = ue.createModalContent(t, i == null ? void 0 : i.backgroundColor), this._buttonPanel = ue.createButtonPanel(i == null ? void 0 : i.backgroundColor), this._elementRef = ue.createContainer(this._contentRef, i), this._elementRef.appendChild(this._buttonPanel), e.appendChild(this._elementRef), this._backgroundPanelRef = ue.createDarkBackgroundPanel(), e.appendChild(this._backgroundPanelRef), this.addWindowEvents(e);
|
13039
13115
|
}
|
13040
|
-
return _createClass(
|
13116
|
+
return _createClass(ue, [{
|
13041
13117
|
key: "isOpen",
|
13042
13118
|
value: function isOpen() {
|
13043
13119
|
return this._isOpen;
|
@@ -13059,7 +13135,7 @@ var he = /*#__PURE__*/function () {
|
|
13059
13135
|
var _this69 = this;
|
13060
13136
|
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 () {
|
13061
13137
|
_this69._elementRef.style.display = "none", _this69._backgroundPanelRef.style.display = "none";
|
13062
|
-
},
|
13138
|
+
}, ue.MODAL_CLOSE_TIMEOUT_MS);
|
13063
13139
|
}
|
13064
13140
|
}, {
|
13065
13141
|
key: "displayModalElements",
|
@@ -13075,7 +13151,7 @@ var he = /*#__PURE__*/function () {
|
|
13075
13151
|
key: "addCloseButton",
|
13076
13152
|
value: function addCloseButton(e, t, i) {
|
13077
13153
|
var _this70 = this;
|
13078
|
-
var s = t ?
|
13154
|
+
var s = t ? ue.createSVGButton(e) : ue.createTextButton(e);
|
13079
13155
|
return this.addButtons(s), s.onclick = function () {
|
13080
13156
|
_this70.close(), setTimeout(function () {
|
13081
13157
|
i == null || i();
|
@@ -13137,26 +13213,26 @@ var he = /*#__PURE__*/function () {
|
|
13137
13213
|
value: function createTextModalFunc(e, t, i) {
|
13138
13214
|
var s;
|
13139
13215
|
if (_typeof(t) == "object" && (s = t.files) != null && s.infoModal) {
|
13140
|
-
var r = new
|
13216
|
+
var r = new ue(e, ["modal-content"], t.files.infoModal.containerStyle);
|
13141
13217
|
return r.addCloseButton("OK", !1, i), r.openTextModal.bind(r, t.infoModalTextMarkUp || "");
|
13142
13218
|
}
|
13143
13219
|
}
|
13144
13220
|
}]);
|
13145
13221
|
}();
|
13146
|
-
|
13147
|
-
var Xe =
|
13222
|
+
ue.MODAL_CLOSE_TIMEOUT_MS = 190;
|
13223
|
+
var Xe = ue;
|
13148
13224
|
var Pt = /*#__PURE__*/function (_Xt3) {
|
13149
13225
|
// prettier-ignore
|
13150
13226
|
function Pt(e, t, i, s, r, o) {
|
13151
13227
|
var _this71;
|
13152
13228
|
_classCallCheck(this, Pt);
|
13153
|
-
var h, u, f, m, p,
|
13229
|
+
var h, u, f, m, p, v, x, j, G;
|
13154
13230
|
var a = (h = i == null ? void 0 : i.button) == null ? void 0 : h.position,
|
13155
13231
|
l = ((m = (f = (u = i == null ? void 0 : i.button) == null ? void 0 : u.styles) == null ? void 0 : f.text) == null ? void 0 : m.content) || o;
|
13156
13232
|
_this71 = _callSuper(this, Pt, [Pt.createButtonElement(), a, i.button, l]);
|
13157
13233
|
var c = a === "dropup-menu",
|
13158
13234
|
d = _this71.createInnerElements(s, r, _this71._customStyles, c);
|
13159
|
-
_this71._inputElement = Pt.createInputElement((p = i == null ? void 0 : i.files) == null ? void 0 : p.acceptedFormats), _this71.addClickEvent(e, i), _this71.elementRef.replaceChildren(d.styles), _this71.reapplyStateStyle("styles"), _this71._fileAttachmentsType = t, _this71._openModalOnce = ((x = (
|
13235
|
+
_this71._inputElement = Pt.createInputElement((p = i == null ? void 0 : i.files) == null ? void 0 : p.acceptedFormats), _this71.addClickEvent(e, i), _this71.elementRef.replaceChildren(d.styles), _this71.reapplyStateStyle("styles"), _this71._fileAttachmentsType = t, _this71._openModalOnce = ((x = (v = i.files) == null ? void 0 : v.infoModal) == null ? void 0 : x.openModalOnce) === !1 || (G = (j = i.files) == null ? void 0 : j.infoModal) == null ? void 0 : G.openModalOnce;
|
13160
13236
|
return _this71;
|
13161
13237
|
}
|
13162
13238
|
_inherits(Pt, _Xt3);
|
@@ -13211,15 +13287,15 @@ var Pt = /*#__PURE__*/function (_Xt3) {
|
|
13211
13287
|
}
|
13212
13288
|
}]);
|
13213
13289
|
}(Xt);
|
13214
|
-
var
|
13215
|
-
function
|
13216
|
-
_classCallCheck(this,
|
13290
|
+
var Ce = /*#__PURE__*/function () {
|
13291
|
+
function Ce() {
|
13292
|
+
_classCallCheck(this, Ce);
|
13217
13293
|
}
|
13218
|
-
return _createClass(
|
13294
|
+
return _createClass(Ce, null, [{
|
13219
13295
|
key: "create",
|
13220
13296
|
value: function create(e, t, i) {
|
13221
|
-
var s =
|
13222
|
-
|
13297
|
+
var s = Ce.createElement(i);
|
13298
|
+
Ce.addEvents(s, e, t), e.appendChild(s);
|
13223
13299
|
}
|
13224
13300
|
}, {
|
13225
13301
|
key: "createElement",
|
@@ -13231,13 +13307,13 @@ var Te = /*#__PURE__*/function () {
|
|
13231
13307
|
key: "addEvents",
|
13232
13308
|
value: function addEvents(e, t, i) {
|
13233
13309
|
t.ondragenter = function (s) {
|
13234
|
-
s.preventDefault(),
|
13310
|
+
s.preventDefault(), Ce.display(e);
|
13235
13311
|
}, e.ondragleave = function (s) {
|
13236
|
-
s.preventDefault(),
|
13312
|
+
s.preventDefault(), Ce.hide(e);
|
13237
13313
|
}, e.ondragover = function (s) {
|
13238
13314
|
s.preventDefault();
|
13239
13315
|
}, e.ondrop = function (s) {
|
13240
|
-
s.preventDefault(),
|
13316
|
+
s.preventDefault(), Ce.uploadFile(i, s), Ce.hide(e);
|
13241
13317
|
};
|
13242
13318
|
}
|
13243
13319
|
}, {
|
@@ -13336,9 +13412,9 @@ var ze = /*#__PURE__*/function () {
|
|
13336
13412
|
}, {
|
13337
13413
|
key: "attach",
|
13338
13414
|
value: function attach(e, t, i, s, r) {
|
13339
|
-
var o = e.validateInput ||
|
13415
|
+
var o = e.validateInput || le.processValidateInput(e);
|
13340
13416
|
e._validationHandler = /*#__PURE__*/function () {
|
13341
|
-
var
|
13417
|
+
var _ref29 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee121(a) {
|
13342
13418
|
var l;
|
13343
13419
|
return _regeneratorRuntime().wrap(function _callee121$(_context121) {
|
13344
13420
|
while (1) switch (_context121.prev = _context121.next) {
|
@@ -13358,7 +13434,7 @@ var ze = /*#__PURE__*/function () {
|
|
13358
13434
|
}, _callee121);
|
13359
13435
|
}));
|
13360
13436
|
return function (_x221) {
|
13361
|
-
return
|
13437
|
+
return _ref29.apply(this, arguments);
|
13362
13438
|
};
|
13363
13439
|
}();
|
13364
13440
|
}
|
@@ -13636,14 +13712,14 @@ var k = /*#__PURE__*/function (_Xt4) {
|
|
13636
13712
|
return _regeneratorRuntime().wrap(function _callee123$(_context123) {
|
13637
13713
|
while (1) switch (_context123.prev = _context123.next) {
|
13638
13714
|
case 0:
|
13639
|
-
typeof e == "string" && (e =
|
13715
|
+
typeof e == "string" && (e = le.processSubmitUserMessage(e));
|
13640
13716
|
t = {
|
13641
13717
|
text: e.text
|
13642
13718
|
};
|
13643
13719
|
e.files && (t.files = Array.from(e.files).map(function (i) {
|
13644
13720
|
return {
|
13645
13721
|
file: i,
|
13646
|
-
type:
|
13722
|
+
type: ke.getTypeFromBlob(i)
|
13647
13723
|
};
|
13648
13724
|
})), setTimeout(function () {
|
13649
13725
|
return _this78.attemptSubmit(t, !0);
|
@@ -13715,12 +13791,12 @@ var k = /*#__PURE__*/function (_Xt4) {
|
|
13715
13791
|
}, {
|
13716
13792
|
key: "addNewMessage",
|
13717
13793
|
value: function () {
|
13718
|
-
var _addNewMessage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee125(
|
13794
|
+
var _addNewMessage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee125(_ref30) {
|
13719
13795
|
var e, t, i;
|
13720
13796
|
return _regeneratorRuntime().wrap(function _callee125$(_context125) {
|
13721
13797
|
while (1) switch (_context125.prev = _context125.next) {
|
13722
13798
|
case 0:
|
13723
|
-
e =
|
13799
|
+
e = _ref30.text, t = _ref30.files;
|
13724
13800
|
i = {
|
13725
13801
|
role: b.USER_ROLE
|
13726
13802
|
};
|
@@ -14011,7 +14087,7 @@ var Ot = /*#__PURE__*/function () {
|
|
14011
14087
|
button: new Ea(_d, t.recordAudio)
|
14012
14088
|
};
|
14013
14089
|
}
|
14014
|
-
return
|
14090
|
+
return Ce.isEnabled(r, e.dragAndDrop) && Ce.create(i, r, e.dragAndDrop), r;
|
14015
14091
|
}
|
14016
14092
|
// prettier-ignore
|
14017
14093
|
}], [{
|
@@ -14060,7 +14136,7 @@ var Is = /*#__PURE__*/function () {
|
|
14060
14136
|
value: function createElements(e, t, i) {
|
14061
14137
|
var s = document.createElement("div");
|
14062
14138
|
s.id = "chat-view";
|
14063
|
-
var r = new
|
14139
|
+
var r = new me(e, t, i);
|
14064
14140
|
t.websocket && U.createConnection(t, r);
|
14065
14141
|
var o = new Ot(e, r, t, s);
|
14066
14142
|
return J.addElements(s, r.elementRef, o.elementRef), s;
|
@@ -14091,7 +14167,7 @@ var E = /*#__PURE__*/function (_ls) {
|
|
14091
14167
|
return console.warn("addMessage failed - please wait for chat view to render before calling this property.");
|
14092
14168
|
}, _this85.focusInput = function () {
|
14093
14169
|
return Kt.focusFromParentElement(_this85._elementRef);
|
14094
|
-
}, _this85.refreshMessages = function () {}, _this85.clearMessages = function () {}, _this85.scrollToBottom = function () {}, _this85.disableSubmitButton = function () {}, _this85.setPlaceholderText = function () {}, _this85._hasBeenRendered = !1, _this85._auxiliaryStyleApplied = !1, _this85._elementRef = document.createElement("div"), _this85._elementRef.id = "container", _this85.attachShadow({
|
14170
|
+
}, _this85.refreshMessages = function () {}, _this85.clearMessages = function () {}, _this85.scrollToBottom = function () {}, _this85.disableSubmitButton = function () {}, _this85.setPlaceholderText = function () {}, _this85.updateHTMLMessage = function () {}, _this85._hasBeenRendered = !1, _this85._auxiliaryStyleApplied = !1, _this85._elementRef = document.createElement("div"), _this85._elementRef.id = "container", _this85.attachShadow({
|
14095
14171
|
mode: "open"
|
14096
14172
|
}).appendChild(_this85._elementRef), kt.apply(Aa, _this85.shadowRoot), setTimeout(function () {
|
14097
14173
|
_this85._hasBeenRendered || _this85.onRender();
|
@@ -14109,7 +14185,7 @@ var E = /*#__PURE__*/function (_ls) {
|
|
14109
14185
|
key: "onRender",
|
14110
14186
|
value: function onRender() {
|
14111
14187
|
var _this$_childElement;
|
14112
|
-
ci.attemptAppendStyleSheetToHead(this.style),
|
14188
|
+
ci.attemptAppendStyleSheetToHead(this.style), le.processConnect(this), (!this._activeService || this._activeService.demo) && (this._activeService = zo.create(this)), this.auxiliaryStyle && !this._auxiliaryStyleApplied && (kt.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), kt.applyDefaultStyleToComponent(this.style, this.chatStyle), le.checkForContainerStyles(this, this._elementRef), this._activeService.key && this._activeService.validateKeyProperty ? li.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : !(this._activeService instanceof z) || this._activeService.key ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], Is.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof z && H.render(this._elementRef, this.changeToChatView.bind(this), this._activeService), this._hasBeenRendered = !0, hi.onRender(this);
|
14113
14189
|
}
|
14114
14190
|
}, {
|
14115
14191
|
key: "disconnectedCallback",
|