deep-chat-dev 9.0.167 → 9.0.169
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/README.md +11 -5
- package/custom-elements.json +5094 -5054
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.js +375 -344
- package/dist/types/microphone.d.ts +10 -1
- package/dist/types/microphone.d.ts.map +1 -1
- package/dist/utils/HTTP/stream.d.ts.map +1 -1
- package/dist/views/chat/input/buttons/microphone/speechToText/speechToText.d.ts.map +1 -1
- package/dist/views/chat/messages/html/htmlUtils.d.ts +2 -0
- package/dist/views/chat/messages/html/htmlUtils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/deepChat.js
CHANGED
@@ -2,7 +2,7 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableTo
|
|
2
2
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
3
3
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
4
4
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
5
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(
|
5
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e3) { throw _e3; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e4) { didErr = true; err = _e4; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
6
6
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
7
7
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
8
8
|
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
|
@@ -482,11 +482,11 @@ var bi = /*#__PURE__*/function () {
|
|
482
482
|
}();
|
483
483
|
bi.LOAD_VOICES_MS = 200;
|
484
484
|
var rt = bi;
|
485
|
-
var
|
486
|
-
function
|
487
|
-
_classCallCheck(this,
|
485
|
+
var ue = /*#__PURE__*/function () {
|
486
|
+
function ue() {
|
487
|
+
_classCallCheck(this, ue);
|
488
488
|
}
|
489
|
-
return _createClass(
|
489
|
+
return _createClass(ue, null, [{
|
490
490
|
key: "checkForContainerStyles",
|
491
491
|
value: function checkForContainerStyles(e, t) {
|
492
492
|
var i = e.containerStyle;
|
@@ -554,15 +554,15 @@ var he = /*#__PURE__*/function () {
|
|
554
554
|
}();
|
555
555
|
var bs = "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",
|
556
556
|
vs = "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==",
|
557
|
-
|
558
|
-
function
|
559
|
-
_classCallCheck(this,
|
557
|
+
ie = /*#__PURE__*/function () {
|
558
|
+
function ie() {
|
559
|
+
_classCallCheck(this, ie);
|
560
560
|
}
|
561
|
-
return _createClass(
|
561
|
+
return _createClass(ie, null, [{
|
562
562
|
key: "hide",
|
563
563
|
value: function hide(e) {
|
564
564
|
var t;
|
565
|
-
(t = e.getElementsByClassName(
|
565
|
+
(t = e.getElementsByClassName(ie.CONTAINER_CLASS)[0].style).visibility || (t.visibility = "hidden");
|
566
566
|
}
|
567
567
|
}, {
|
568
568
|
key: "applyCustomStylesToElements",
|
@@ -573,10 +573,10 @@ var bs = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e
|
|
573
573
|
key: "applyCustomStyles",
|
574
574
|
value: function applyCustomStyles(e, t, i, n) {
|
575
575
|
var r, o, a, l;
|
576
|
-
if ((r = i["default"]) != null && r.styles &&
|
577
|
-
(a = i.ai) != null && a.styles &&
|
576
|
+
if ((r = i["default"]) != null && r.styles && ie.applyCustomStylesToElements(e, t, i["default"].styles), n === b.USER_ROLE) (o = i.user) != null && o.styles && ie.applyCustomStylesToElements(e, t, i.user.styles);else {
|
577
|
+
(a = i.ai) != null && a.styles && ie.applyCustomStylesToElements(e, t, i.ai.styles);
|
578
578
|
var c = (l = i[n]) == null ? void 0 : l.styles;
|
579
|
-
c &&
|
579
|
+
c && ie.applyCustomStylesToElements(e, t, c);
|
580
580
|
}
|
581
581
|
}
|
582
582
|
}, {
|
@@ -586,7 +586,7 @@ var bs = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e
|
|
586
586
|
var i = document.createElement("img");
|
587
587
|
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) || vs : 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) || bs, i.classList.add("avatar");
|
588
588
|
var n = document.createElement("div");
|
589
|
-
return n.classList.add(
|
589
|
+
return n.classList.add(ie.CONTAINER_CLASS), n.appendChild(i), t && ie.applyCustomStyles(n, i, t, e), n;
|
590
590
|
}
|
591
591
|
}, {
|
592
592
|
key: "getPosition",
|
@@ -600,23 +600,23 @@ var bs = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e
|
|
600
600
|
key: "add",
|
601
601
|
value: function add(e, t, i) {
|
602
602
|
var n = typeof i == "boolean" ? void 0 : i,
|
603
|
-
r =
|
604
|
-
o =
|
603
|
+
r = ie.createAvatar(t, n),
|
604
|
+
o = ie.getPosition(t, n);
|
605
605
|
r.classList.add(o === "left" ? "left-item-position" : "right-item-position"), e.insertAdjacentElement(o === "left" ? "beforebegin" : "afterend", r);
|
606
606
|
}
|
607
607
|
}]);
|
608
608
|
}();
|
609
|
-
|
610
|
-
var Zt =
|
611
|
-
var
|
612
|
-
function
|
613
|
-
_classCallCheck(this,
|
609
|
+
ie.CONTAINER_CLASS = "avatar-container";
|
610
|
+
var Zt = ie;
|
611
|
+
var be = /*#__PURE__*/function () {
|
612
|
+
function be() {
|
613
|
+
_classCallCheck(this, be);
|
614
614
|
}
|
615
|
-
return _createClass(
|
615
|
+
return _createClass(be, null, [{
|
616
616
|
key: "hide",
|
617
617
|
value: function hide(e) {
|
618
618
|
var t;
|
619
|
-
(t = e.getElementsByClassName(
|
619
|
+
(t = e.getElementsByClassName(be.NAME_CLASS)[0].style).visibility || (t.visibility = "hidden");
|
620
620
|
}
|
621
621
|
}, {
|
622
622
|
key: "getPosition",
|
@@ -642,25 +642,25 @@ var ge = /*#__PURE__*/function () {
|
|
642
642
|
key: "createName",
|
643
643
|
value: function createName(e, t) {
|
644
644
|
var i = document.createElement("div");
|
645
|
-
return i.classList.add(
|
645
|
+
return i.classList.add(be.NAME_CLASS), i.textContent = be.getNameText(e, t), be.applyStyle(i, e, t), i;
|
646
646
|
}
|
647
647
|
}, {
|
648
648
|
key: "add",
|
649
649
|
value: function add(e, t, i) {
|
650
650
|
var n = typeof i == "boolean" ? {} : i,
|
651
|
-
r =
|
652
|
-
o =
|
651
|
+
r = be.createName(t, n),
|
652
|
+
o = be.getPosition(t, n);
|
653
653
|
r.classList.add(o === "left" ? "left-item-position" : "right-item-position"), e.insertAdjacentElement(o === "left" ? "beforebegin" : "afterend", r);
|
654
654
|
}
|
655
655
|
}]);
|
656
656
|
}();
|
657
|
-
|
658
|
-
var Yt =
|
659
|
-
var
|
660
|
-
function
|
661
|
-
_classCallCheck(this,
|
657
|
+
be.NAME_CLASS = "name";
|
658
|
+
var Yt = be;
|
659
|
+
var ae = /*#__PURE__*/function () {
|
660
|
+
function ae() {
|
661
|
+
_classCallCheck(this, ae);
|
662
662
|
}
|
663
|
-
return _createClass(
|
663
|
+
return _createClass(ae, null, [{
|
664
664
|
key: "getLastElementsByClass",
|
665
665
|
value: function getLastElementsByClass(e, t, i) {
|
666
666
|
var _loop = function _loop() {
|
@@ -701,8 +701,8 @@ var oe = /*#__PURE__*/function () {
|
|
701
701
|
}, {
|
702
702
|
key: "overwriteMessage",
|
703
703
|
value: function overwriteMessage(e, t, i, n, r, o) {
|
704
|
-
var a =
|
705
|
-
l =
|
704
|
+
var a = ae.getLastElementsByClass(t, [ae.getRoleClass(n), o], ["loading-message-text"]),
|
705
|
+
l = ae.getLastMessage(e, n, r);
|
706
706
|
return l && (l[r] = i), a;
|
707
707
|
}
|
708
708
|
}, {
|
@@ -714,18 +714,18 @@ var oe = /*#__PURE__*/function () {
|
|
714
714
|
}, {
|
715
715
|
key: "fillEmptyMessageElement",
|
716
716
|
value: function fillEmptyMessageElement(e, t) {
|
717
|
-
t.trim().length === 0 && (e.classList.add(
|
717
|
+
t.trim().length === 0 && (e.classList.add(ae.EMPTY_MESSAGE_CLASS), e.innerHTML = '<div style="color:#00000000">.</div>');
|
718
718
|
}
|
719
719
|
}, {
|
720
720
|
key: "unfillEmptyMessageElement",
|
721
721
|
value: function unfillEmptyMessageElement(e, t) {
|
722
|
-
e.classList.contains(
|
722
|
+
e.classList.contains(ae.EMPTY_MESSAGE_CLASS) && t.trim().length > 0 && e.replaceChildren();
|
723
723
|
}
|
724
724
|
}, {
|
725
725
|
key: "getLastMessageBubbleElement",
|
726
726
|
value: function getLastMessageBubbleElement(e) {
|
727
727
|
var t, i, n;
|
728
|
-
return Array.from(((n = (i = (t =
|
728
|
+
return Array.from(((n = (i = (t = ae.getLastMessageElement(e)) == null ? void 0 : t.children) == null ? void 0 : i[0]) == null ? void 0 : n.children) || []).find(function (r) {
|
729
729
|
return r.classList.contains("message-bubble");
|
730
730
|
});
|
731
731
|
}
|
@@ -747,8 +747,8 @@ var oe = /*#__PURE__*/function () {
|
|
747
747
|
}
|
748
748
|
}]);
|
749
749
|
}();
|
750
|
-
|
751
|
-
var b =
|
750
|
+
ae.AI_ROLE = "ai", ae.USER_ROLE = "user", ae.EMPTY_MESSAGE_CLASS = "empty-message";
|
751
|
+
var b = ae;
|
752
752
|
var qe = /*#__PURE__*/function () {
|
753
753
|
function qe() {
|
754
754
|
_classCallCheck(this, qe);
|
@@ -864,7 +864,7 @@ var Le = /*#__PURE__*/function () {
|
|
864
864
|
var o = i.getElementsByClassName(r);
|
865
865
|
Array.from(o || []).forEach(function (a) {
|
866
866
|
var l = Le.getProcessedStyles(t, a, r);
|
867
|
-
|
867
|
+
X.applyStylesToElement(a, l), Le.applyEvents(a, r);
|
868
868
|
});
|
869
869
|
});
|
870
870
|
var n = i.getElementsByClassName(xs);
|
@@ -874,11 +874,11 @@ var Le = /*#__PURE__*/function () {
|
|
874
874
|
}
|
875
875
|
}]);
|
876
876
|
}();
|
877
|
-
var
|
878
|
-
function
|
879
|
-
_classCallCheck(this,
|
877
|
+
var X = /*#__PURE__*/function () {
|
878
|
+
function X() {
|
879
|
+
_classCallCheck(this, X);
|
880
880
|
}
|
881
|
-
return _createClass(
|
881
|
+
return _createClass(X, null, [{
|
882
882
|
key: "applyStylesToElement",
|
883
883
|
value: function applyStylesToElement(e, t) {
|
884
884
|
var i = M.processStateful(t, {}, {});
|
@@ -897,7 +897,7 @@ var fe = /*#__PURE__*/function () {
|
|
897
897
|
value: function applyClassUtilitiesToElement(e, t) {
|
898
898
|
var i = t.events,
|
899
899
|
n = t.styles;
|
900
|
-
i &&
|
900
|
+
i && X.applyEventsToElement(e, i), n && !Le.doesElementContainDeepChatClass(e) && X.applyStylesToElement(e, n);
|
901
901
|
}
|
902
902
|
}, {
|
903
903
|
key: "applyCustomClassUtilities",
|
@@ -905,14 +905,30 @@ var fe = /*#__PURE__*/function () {
|
|
905
905
|
Object.keys(e).forEach(function (i) {
|
906
906
|
var n = t.getElementsByClassName(i);
|
907
907
|
Array.from(n).forEach(function (r) {
|
908
|
-
e[i] &&
|
908
|
+
e[i] && X.applyClassUtilitiesToElement(r, e[i]);
|
909
909
|
});
|
910
910
|
});
|
911
911
|
}
|
912
912
|
}, {
|
913
913
|
key: "apply",
|
914
914
|
value: function apply(e, t) {
|
915
|
-
Le.applyDeepChatUtilities(e, e.htmlClassUtilities, t),
|
915
|
+
Le.applyDeepChatUtilities(e, e.htmlClassUtilities, t), X.applyCustomClassUtilities(e.htmlClassUtilities, t);
|
916
|
+
}
|
917
|
+
}, {
|
918
|
+
key: "traverseNodes",
|
919
|
+
value: function traverseNodes(e, t) {
|
920
|
+
e.nodeType === Node.ELEMENT_NODE && t.push(e.outerHTML), e.childNodes.forEach(function (i) {
|
921
|
+
X.traverseNodes(i, t);
|
922
|
+
});
|
923
|
+
}
|
924
|
+
}, {
|
925
|
+
key: "splitHTML",
|
926
|
+
value: function splitHTML(e) {
|
927
|
+
var i = new DOMParser().parseFromString(e, "text/html"),
|
928
|
+
n = [];
|
929
|
+
return i.body.childNodes.forEach(function (r) {
|
930
|
+
X.traverseNodes(r, n);
|
931
|
+
}), n;
|
916
932
|
}
|
917
933
|
}]);
|
918
934
|
}();
|
@@ -936,7 +952,7 @@ var ct = /*#__PURE__*/function () {
|
|
936
952
|
value: function overwrite(e, t, i, n) {
|
937
953
|
var r = e.messages,
|
938
954
|
o = b.overwriteMessage(r, n, t, i, "html", "html-message");
|
939
|
-
return o && (o.bubbleElement.innerHTML = t,
|
955
|
+
return o && (o.bubbleElement.innerHTML = t, X.apply(e, o.outerContainer), ue.flagHTMLUpdateClass(o.bubbleElement)), o;
|
940
956
|
}
|
941
957
|
// prettier-ignore
|
942
958
|
}, {
|
@@ -949,7 +965,7 @@ var ct = /*#__PURE__*/function () {
|
|
949
965
|
r.status = !1;
|
950
966
|
}
|
951
967
|
var o = ct.createElements(e, t, i);
|
952
|
-
return b.fillEmptyMessageElement(o.bubbleElement, t),
|
968
|
+
return b.fillEmptyMessageElement(o.bubbleElement, t), X.apply(e, o.outerContainer), ue.flagHTMLUpdateClass(o.bubbleElement), e.applyCustomStyles(o, i, !1, (a = e.messageStyles) == null ? void 0 : a.html), ct.addElement(e, o.outerContainer), o;
|
953
969
|
}
|
954
970
|
}]);
|
955
971
|
}();
|
@@ -1242,14 +1258,14 @@ cn.prototype.render = function (s, e, t) {
|
|
1242
1258
|
for (var i = this.rules, n = s.length, r = -1, o = ""; ++r < n;) s[r].type === "inline" ? o += this.renderInline(s[r].children, e, t) : o += i[s[r].type](s, r, e, t, this);
|
1243
1259
|
return o;
|
1244
1260
|
};
|
1245
|
-
function
|
1261
|
+
function Q() {
|
1246
1262
|
this.__rules__ = [], this.__cache__ = null;
|
1247
1263
|
}
|
1248
|
-
|
1264
|
+
Q.prototype.__find__ = function (s) {
|
1249
1265
|
for (var e = this.__rules__.length, t = -1; e--;) if (this.__rules__[++t].name === s) return t;
|
1250
1266
|
return -1;
|
1251
1267
|
};
|
1252
|
-
|
1268
|
+
Q.prototype.__compile__ = function () {
|
1253
1269
|
var s = this,
|
1254
1270
|
e = [""];
|
1255
1271
|
s.__rules__.forEach(function (t) {
|
@@ -1262,13 +1278,13 @@ Y.prototype.__compile__ = function () {
|
|
1262
1278
|
});
|
1263
1279
|
});
|
1264
1280
|
};
|
1265
|
-
|
1281
|
+
Q.prototype.at = function (s, e, t) {
|
1266
1282
|
var i = this.__find__(s),
|
1267
1283
|
n = t || {};
|
1268
1284
|
if (i === -1) throw new Error("Parser rule not found: " + s);
|
1269
1285
|
this.__rules__[i].fn = e, this.__rules__[i].alt = n.alt || [], this.__cache__ = null;
|
1270
1286
|
};
|
1271
|
-
|
1287
|
+
Q.prototype.before = function (s, e, t, i) {
|
1272
1288
|
var n = this.__find__(s),
|
1273
1289
|
r = i || {};
|
1274
1290
|
if (n === -1) throw new Error("Parser rule not found: " + s);
|
@@ -1279,7 +1295,7 @@ Y.prototype.before = function (s, e, t, i) {
|
|
1279
1295
|
alt: r.alt || []
|
1280
1296
|
}), this.__cache__ = null;
|
1281
1297
|
};
|
1282
|
-
|
1298
|
+
Q.prototype.after = function (s, e, t, i) {
|
1283
1299
|
var n = this.__find__(s),
|
1284
1300
|
r = i || {};
|
1285
1301
|
if (n === -1) throw new Error("Parser rule not found: " + s);
|
@@ -1290,7 +1306,7 @@ Y.prototype.after = function (s, e, t, i) {
|
|
1290
1306
|
alt: r.alt || []
|
1291
1307
|
}), this.__cache__ = null;
|
1292
1308
|
};
|
1293
|
-
|
1309
|
+
Q.prototype.push = function (s, e, t) {
|
1294
1310
|
var i = t || {};
|
1295
1311
|
this.__rules__.push({
|
1296
1312
|
name: s,
|
@@ -1299,7 +1315,7 @@ Y.prototype.push = function (s, e, t) {
|
|
1299
1315
|
alt: i.alt || []
|
1300
1316
|
}), this.__cache__ = null;
|
1301
1317
|
};
|
1302
|
-
|
1318
|
+
Q.prototype.enable = function (s, e) {
|
1303
1319
|
s = Array.isArray(s) ? s : [s], e && this.__rules__.forEach(function (t) {
|
1304
1320
|
t.enabled = !1;
|
1305
1321
|
}), s.forEach(function (t) {
|
@@ -1308,14 +1324,14 @@ Y.prototype.enable = function (s, e) {
|
|
1308
1324
|
this.__rules__[i].enabled = !0;
|
1309
1325
|
}, this), this.__cache__ = null;
|
1310
1326
|
};
|
1311
|
-
|
1327
|
+
Q.prototype.disable = function (s) {
|
1312
1328
|
s = Array.isArray(s) ? s : [s], s.forEach(function (e) {
|
1313
1329
|
var t = this.__find__(e);
|
1314
1330
|
if (t < 0) throw new Error("Rules manager: invalid rule name " + e);
|
1315
1331
|
this.__rules__[t].enabled = !1;
|
1316
1332
|
}, this), this.__cache__ = null;
|
1317
1333
|
};
|
1318
|
-
|
1334
|
+
Q.prototype.getRules = function (s) {
|
1319
1335
|
return this.__cache__ === null && this.__compile__(), this.__cache__[s] || [];
|
1320
1336
|
};
|
1321
1337
|
function Is(s) {
|
@@ -1635,7 +1651,7 @@ function Ws(s) {
|
|
1635
1651
|
}
|
1636
1652
|
var Fi = [["block", Is], ["abbr", Ps], ["references", Ns], ["inline", Ds], ["footnote_tail", Fs], ["abbr2", Bs], ["replacements", zs], ["smartquotes", Ws]];
|
1637
1653
|
function rs() {
|
1638
|
-
this.options = {}, this.ruler = new
|
1654
|
+
this.options = {}, this.ruler = new Q();
|
1639
1655
|
for (var s = 0; s < Fi.length; s++) this.ruler.push(Fi[s][0], Fi[s][1]);
|
1640
1656
|
}
|
1641
1657
|
rs.prototype.process = function (s) {
|
@@ -1825,8 +1841,8 @@ function Ys(s, e, t, i) {
|
|
1825
1841
|
p,
|
1826
1842
|
x,
|
1827
1843
|
S,
|
1828
|
-
|
1829
|
-
|
1844
|
+
ee,
|
1845
|
+
re,
|
1830
1846
|
Te,
|
1831
1847
|
R,
|
1832
1848
|
$ = !0,
|
@@ -1837,7 +1853,7 @@ function Ys(s, e, t, i) {
|
|
1837
1853
|
if ((h = An(s, e)) >= 0) x = !0;else if ((h = kn(s, e)) >= 0) x = !1;else return !1;
|
1838
1854
|
if (s.level >= s.options.maxNesting) return !1;
|
1839
1855
|
if (p = s.src.charCodeAt(h - 1), i) return !0;
|
1840
|
-
for (
|
1856
|
+
for (ee = s.tokens.length, x ? (d = s.bMarks[e] + s.tShift[e], m = Number(s.src.substr(d, h - d - 1)), s.tokens.push({
|
1841
1857
|
type: "ordered_list_open",
|
1842
1858
|
order: m,
|
1843
1859
|
lines: Te = [e, 0],
|
@@ -1846,11 +1862,11 @@ function Ys(s, e, t, i) {
|
|
1846
1862
|
type: "bullet_list_open",
|
1847
1863
|
lines: Te = [e, 0],
|
1848
1864
|
level: s.level++
|
1849
|
-
}), n = e,
|
1865
|
+
}), n = e, re = !1, K = s.parser.ruler.getRules("list"); n < t && (S = s.skipSpaces(h), u = s.eMarks[n], S >= u ? f = 1 : f = S - h, f > 4 && (f = 1), f < 1 && (f = 1), r = h - s.bMarks[n] + f, s.tokens.push({
|
1850
1866
|
type: "list_item_open",
|
1851
1867
|
lines: R = [e, 0],
|
1852
1868
|
level: s.level++
|
1853
|
-
}), a = s.blkIndent, l = s.tight, o = s.tShift[e], c = s.parentType, s.tShift[e] = S - s.bMarks[e], s.blkIndent = r, s.tight = !0, s.parentType = "list", s.parser.tokenize(s, e, t, !0), (!s.tight ||
|
1869
|
+
}), a = s.blkIndent, l = s.tight, o = s.tShift[e], c = s.parentType, s.tShift[e] = S - s.bMarks[e], s.blkIndent = r, s.tight = !0, s.parentType = "list", s.parser.tokenize(s, e, t, !0), (!s.tight || re) && ($ = !1), re = s.line - e > 1 && s.isEmpty(s.line - 1), s.blkIndent = a, s.tShift[e] = o, s.tight = l, s.parentType = c, s.tokens.push({
|
1854
1870
|
type: "list_item_close",
|
1855
1871
|
level: --s.level
|
1856
1872
|
}), n = e = s.line, R[1] = n, S = s.bMarks[e], !(n >= t || s.isEmpty(n) || s.tShift[n] < s.blkIndent));) {
|
@@ -1867,7 +1883,7 @@ function Ys(s, e, t, i) {
|
|
1867
1883
|
return s.tokens.push({
|
1868
1884
|
type: x ? "ordered_list_close" : "bullet_list_close",
|
1869
1885
|
level: --s.level
|
1870
|
-
}), Te[1] = n, s.line = n, $ && Zs(s,
|
1886
|
+
}), Te[1] = n, s.line = n, $ && Zs(s, ee), !0;
|
1871
1887
|
}
|
1872
1888
|
function Qs(s, e, t, i) {
|
1873
1889
|
var n,
|
@@ -2149,7 +2165,7 @@ function cr(s, e) {
|
|
2149
2165
|
}
|
2150
2166
|
var Wt = [["code", $s], ["fences", Ks, ["paragraph", "blockquote", "list"]], ["blockquote", Js, ["paragraph", "blockquote", "list"]], ["hr", Xs, ["paragraph", "blockquote", "list"]], ["list", Ys, ["paragraph", "blockquote"]], ["footnote", Qs, ["paragraph"]], ["heading", er, ["paragraph", "blockquote"]], ["lheading", tr], ["htmlblock", rr, ["paragraph", "blockquote"]], ["table", or, ["paragraph"]], ["deflist", lr, ["paragraph"]], ["paragraph", cr]];
|
2151
2167
|
function dn() {
|
2152
|
-
this.ruler = new
|
2168
|
+
this.ruler = new Q();
|
2153
2169
|
for (var s = 0; s < Wt.length; s++) this.ruler.push(Wt[s][0], Wt[s][1], {
|
2154
2170
|
alt: (Wt[s][2] || []).slice()
|
2155
2171
|
});
|
@@ -2634,7 +2650,7 @@ function Xr(s, e) {
|
|
2634
2650
|
}
|
2635
2651
|
var ji = [["text", pr], ["newline", mr], ["escape", gr], ["backticks", br], ["del", vr], ["ins", yr], ["mark", xr], ["emphasis", Er], ["sub", Sr], ["sup", Tr], ["links", Cr], ["footnote_inline", kr], ["footnote_ref", Ar], ["autolink", Lr], ["htmltag", $r], ["entity", Xr]];
|
2636
2652
|
function Ei() {
|
2637
|
-
this.ruler = new
|
2653
|
+
this.ruler = new Q();
|
2638
2654
|
for (var s = 0; s < ji.length; s++) this.ruler.push(ji[s][0], ji[s][1]);
|
2639
2655
|
this.validateLink = Zr;
|
2640
2656
|
}
|
@@ -2791,34 +2807,34 @@ var Yr = {
|
|
2791
2807
|
function as(s, e, t) {
|
2792
2808
|
this.src = e, this.env = t, this.options = s.options, this.tokens = [], this.inlineMode = !1, this.inline = s.inline, this.block = s.block, this.renderer = s.renderer, this.typographer = s.typographer;
|
2793
2809
|
}
|
2794
|
-
function
|
2795
|
-
typeof s != "string" && (e = s, s = "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 Ei(), this.block = new dn(), this.core = new rs(), this.renderer = new cn(), this.ruler = new
|
2810
|
+
function Se(s, e) {
|
2811
|
+
typeof s != "string" && (e = s, s = "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 Ei(), this.block = new dn(), this.core = new rs(), this.renderer = new cn(), this.ruler = new Q(), this.options = {}, this.configure(to[s]), this.set(e || {});
|
2796
2812
|
}
|
2797
|
-
|
2813
|
+
Se.prototype.set = function (s) {
|
2798
2814
|
Qn(this.options, s);
|
2799
2815
|
};
|
2800
|
-
|
2816
|
+
Se.prototype.configure = function (s) {
|
2801
2817
|
var e = this;
|
2802
2818
|
if (!s) throw new Error("Wrong `remarkable` preset, check name/content");
|
2803
2819
|
s.options && e.set(s.options), s.components && Object.keys(s.components).forEach(function (t) {
|
2804
2820
|
s.components[t].rules && e[t].ruler.enable(s.components[t].rules, !0);
|
2805
2821
|
});
|
2806
2822
|
};
|
2807
|
-
|
2823
|
+
Se.prototype.use = function (s, e) {
|
2808
2824
|
return s(this, e), this;
|
2809
2825
|
};
|
2810
|
-
|
2826
|
+
Se.prototype.parse = function (s, e) {
|
2811
2827
|
var t = new as(this, s, e);
|
2812
2828
|
return this.core.process(t), t.tokens;
|
2813
2829
|
};
|
2814
|
-
|
2830
|
+
Se.prototype.render = function (s, e) {
|
2815
2831
|
return e = e || {}, this.renderer.render(this.parse(s, e), this.options, e);
|
2816
2832
|
};
|
2817
|
-
|
2833
|
+
Se.prototype.parseInline = function (s, e) {
|
2818
2834
|
var t = new as(this, s, e);
|
2819
2835
|
return t.inlineMode = !0, this.core.process(t), t.tokens;
|
2820
2836
|
};
|
2821
|
-
|
2837
|
+
Se.prototype.renderInline = function (s, e) {
|
2822
2838
|
return e = e || {}, this.renderer.render(this.parseInline(s, e), this.options, e);
|
2823
2839
|
};
|
2824
2840
|
var Mt = /*#__PURE__*/function () {
|
@@ -2829,7 +2845,7 @@ var Mt = /*#__PURE__*/function () {
|
|
2829
2845
|
key: "instantiate",
|
2830
2846
|
value: function instantiate() {
|
2831
2847
|
var e = window.hljs;
|
2832
|
-
return e ? new
|
2848
|
+
return e ? new Se({
|
2833
2849
|
highlight: function highlight(t, i) {
|
2834
2850
|
if (i && e.getLanguage(i)) try {
|
2835
2851
|
return e.highlight(i, t).value;
|
@@ -2855,7 +2871,7 @@ var Mt = /*#__PURE__*/function () {
|
|
2855
2871
|
// set target to open in a new tab
|
2856
2872
|
typographer: !0
|
2857
2873
|
// Enable smartypants and other sweet transforms
|
2858
|
-
}) : new
|
2874
|
+
}) : new Se({
|
2859
2875
|
linkTarget: "_blank"
|
2860
2876
|
// set target to open in a new tab
|
2861
2877
|
});
|
@@ -2970,7 +2986,7 @@ var Qt = /*#__PURE__*/function () {
|
|
2970
2986
|
}));
|
2971
2987
|
B.reAddFileRefToObject(t, n), (r = e.onMessage) == null || r.call(e, n), e.dispatchEvent(new CustomEvent("message", {
|
2972
2988
|
detail: n
|
2973
|
-
})),
|
2989
|
+
})), ue.fireOnNewMessage(e, n);
|
2974
2990
|
}
|
2975
2991
|
}, {
|
2976
2992
|
key: "onClearMessages",
|
@@ -3243,7 +3259,7 @@ var Re = /*#__PURE__*/function () {
|
|
3243
3259
|
var e = this._messages.textElementsToText;
|
3244
3260
|
if (!this._endStreamAfterOperation && !(this._fileAdded && !this._elements)) {
|
3245
3261
|
if (!this._elements) throw Error(A.NO_VALID_STREAM_EVENTS_SENT);
|
3246
|
-
(t = this._elements.bubbleElement) != null && t.classList.contains(Re.MESSAGE_CLASS) && (this._streamType === "text" ? (e[e.length - 1][1] = this._streamedContent, this._message && (this._message.text = this._streamedContent), this._messages.textToSpeech && rt.speak(this._streamedContent, this._messages.textToSpeech)) : this._streamType === "html" && (this._streamedContent === Re.HTML_CONTENT_PLACEHOLDER && (this._streamedContent = ((i = this._elements.bubbleElement) == null ? void 0 : i.innerHTML) || ""), this._elements &&
|
3262
|
+
(t = this._elements.bubbleElement) != null && t.classList.contains(Re.MESSAGE_CLASS) && (this._streamType === "text" ? (e[e.length - 1][1] = this._streamedContent, this._message && (this._message.text = this._streamedContent), this._messages.textToSpeech && rt.speak(this._streamedContent, this._messages.textToSpeech)) : this._streamType === "html" && (this._streamedContent === Re.HTML_CONTENT_PLACEHOLDER && (this._streamedContent = ((i = this._elements.bubbleElement) == null ? void 0 : i.innerHTML) || ""), this._elements && X.apply(this._messages, this._elements.outerContainer), this._message && (this._message.html = this._streamedContent)), this._message && this._messages.sendClientUpdate(ot.createMessageContent(this._message), !1), this._hasStreamEnded = !0);
|
3247
3263
|
}
|
3248
3264
|
}
|
3249
3265
|
}, {
|
@@ -3289,7 +3305,7 @@ var Re = /*#__PURE__*/function () {
|
|
3289
3305
|
}]);
|
3290
3306
|
}();
|
3291
3307
|
Re.MESSAGE_CLASS = "streamed-message", Re.HTML_CONTENT_PLACEHOLDER = "htmlplaceholder";
|
3292
|
-
var
|
3308
|
+
var pe = Re;
|
3293
3309
|
var Ue = /*#__PURE__*/function () {
|
3294
3310
|
function Ue() {
|
3295
3311
|
_classCallCheck(this, Ue);
|
@@ -3544,13 +3560,13 @@ function lo(s, e) {
|
|
3544
3560
|
l || document.addEventListener("visibilitychange", p);
|
3545
3561
|
var x = ao,
|
3546
3562
|
S = 0;
|
3547
|
-
function
|
3563
|
+
function ee() {
|
3548
3564
|
document.removeEventListener("visibilitychange", p), window.clearTimeout(S), m.abort();
|
3549
3565
|
}
|
3550
3566
|
t == null || t.addEventListener("abort", function () {
|
3551
|
-
|
3567
|
+
ee(), h();
|
3552
3568
|
});
|
3553
|
-
var
|
3569
|
+
var re = c !== null && c !== void 0 ? c : window.fetch,
|
3554
3570
|
Te = n !== null && n !== void 0 ? n : co;
|
3555
3571
|
function R() {
|
3556
3572
|
return _R.apply(this, arguments);
|
@@ -3564,7 +3580,7 @@ function lo(s, e) {
|
|
3564
3580
|
m = new AbortController();
|
3565
3581
|
_context4.prev = 1;
|
3566
3582
|
_context4.next = 4;
|
3567
|
-
return
|
3583
|
+
return re(s, Object.assign(Object.assign({}, d), {
|
3568
3584
|
headers: f,
|
3569
3585
|
signal: m.signal
|
3570
3586
|
}));
|
@@ -3581,7 +3597,7 @@ function lo(s, e) {
|
|
3581
3597
|
}, r)));
|
3582
3598
|
case 9:
|
3583
3599
|
o == null || o();
|
3584
|
-
|
3600
|
+
ee();
|
3585
3601
|
h();
|
3586
3602
|
_context4.next = 17;
|
3587
3603
|
break;
|
@@ -3592,7 +3608,7 @@ function lo(s, e) {
|
|
3592
3608
|
N = ($ = a == null ? void 0 : a(_context4.t0)) !== null && $ !== void 0 ? $ : x;
|
3593
3609
|
window.clearTimeout(S), S = window.setTimeout(R, N);
|
3594
3610
|
} catch (N) {
|
3595
|
-
|
3611
|
+
ee(), u(N);
|
3596
3612
|
}
|
3597
3613
|
case 17:
|
3598
3614
|
case "end":
|
@@ -3623,8 +3639,8 @@ var C = /*#__PURE__*/function () {
|
|
3623
3639
|
p,
|
3624
3640
|
x,
|
3625
3641
|
S,
|
3626
|
-
|
3627
|
-
|
3642
|
+
ee,
|
3643
|
+
re,
|
3628
3644
|
Te,
|
3629
3645
|
o,
|
3630
3646
|
_yield$v$processReque,
|
@@ -3668,17 +3684,17 @@ var C = /*#__PURE__*/function () {
|
|
3668
3684
|
_context7.next = 17;
|
3669
3685
|
break;
|
3670
3686
|
}
|
3671
|
-
return _context7.abrupt("return",
|
3687
|
+
return _context7.abrupt("return", Ee.stream(e, a, i));
|
3672
3688
|
case 17:
|
3673
|
-
if (!(((S = e.connectSettings) == null ? void 0 : S.url) ===
|
3689
|
+
if (!(((S = e.connectSettings) == null ? void 0 : S.url) === me.URL)) {
|
3674
3690
|
_context7.next = 19;
|
3675
3691
|
break;
|
3676
3692
|
}
|
3677
|
-
return _context7.abrupt("return",
|
3693
|
+
return _context7.abrupt("return", me.requestStream(i, e.streamHandlers));
|
3678
3694
|
case 19:
|
3679
|
-
f = new
|
3680
|
-
return _context7.abrupt("return", (lo(((
|
3681
|
-
method: ((
|
3695
|
+
f = new pe(i), m = v.fetch.bind(this, e, l, n);
|
3696
|
+
return _context7.abrupt("return", (lo(((ee = e.connectSettings) == null ? void 0 : ee.url) || e.url || "", {
|
3697
|
+
method: ((re = e.connectSettings) == null ? void 0 : re.method) || "POST",
|
3682
3698
|
headers: l,
|
3683
3699
|
credentials: (Te = e.connectSettings) == null ? void 0 : Te.credentials,
|
3684
3700
|
body: n ? JSON.stringify(a) : a,
|
@@ -3778,29 +3794,33 @@ var C = /*#__PURE__*/function () {
|
|
3778
3794
|
key: "simulate",
|
3779
3795
|
value: function simulate(e, t, i) {
|
3780
3796
|
var n = t;
|
3781
|
-
if (
|
3797
|
+
if (i.files && e.addNewMessage(_objectSpread({
|
3782
3798
|
sendUpdate: !1,
|
3783
3799
|
ignoreText: !0
|
3784
3800
|
}, i), !1), i.text) {
|
3785
3801
|
t.onOpen();
|
3786
3802
|
var r = i.text.split("");
|
3787
|
-
C.populateMessages(r, new
|
3803
|
+
C.populateMessages(r, new pe(e), n, "text");
|
3804
|
+
}
|
3805
|
+
if (i.html) {
|
3806
|
+
t.onOpen();
|
3807
|
+
var _r2 = X.splitHTML(i.html);
|
3808
|
+
C.populateMessages(_r2, new pe(e), n, "html");
|
3788
3809
|
}
|
3789
3810
|
}
|
3811
|
+
// prettier-ignore
|
3790
3812
|
}, {
|
3791
3813
|
key: "populateMessages",
|
3792
|
-
value: function populateMessages(e, t, i) {
|
3793
|
-
var
|
3794
|
-
var
|
3795
|
-
if (
|
3796
|
-
t.upsertStreamedMessage({
|
3797
|
-
|
3798
|
-
|
3799
|
-
var o = setTimeout(function () {
|
3800
|
-
C.populateMessages(e, t, i, n + 1);
|
3814
|
+
value: function populateMessages(e, t, i, n) {
|
3815
|
+
var r = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
3816
|
+
var o = e[r];
|
3817
|
+
if (o) {
|
3818
|
+
t.upsertStreamedMessage(_defineProperty({}, n, o));
|
3819
|
+
var a = setTimeout(function () {
|
3820
|
+
C.populateMessages(e, t, i, n, r + 1);
|
3801
3821
|
}, i.simulationInterim || 6);
|
3802
3822
|
i.abortStream.abort = function () {
|
3803
|
-
C.abort(
|
3823
|
+
C.abort(a, t, i.onClose);
|
3804
3824
|
};
|
3805
3825
|
} else t.finaliseStreamedMessage(), i.onClose();
|
3806
3826
|
}
|
@@ -3905,7 +3925,7 @@ var He = /*#__PURE__*/function () {
|
|
3905
3925
|
}]);
|
3906
3926
|
}();
|
3907
3927
|
He.URL = "deep-chat-demo";
|
3908
|
-
var
|
3928
|
+
var me = He;
|
3909
3929
|
var V = /*#__PURE__*/function () {
|
3910
3930
|
function V() {
|
3911
3931
|
_classCallCheck(this, V);
|
@@ -3913,7 +3933,7 @@ var V = /*#__PURE__*/function () {
|
|
3913
3933
|
return _createClass(V, null, [{
|
3914
3934
|
key: "setup",
|
3915
3935
|
value: function setup(e) {
|
3916
|
-
e.connectSettings.url !==
|
3936
|
+
e.connectSettings.url !== me.URL && (e.permittedErrorPrefixes = ["Connection error", "Error in server message"], e.websocket = "pending");
|
3917
3937
|
}
|
3918
3938
|
}, {
|
3919
3939
|
key: "createConnection",
|
@@ -3921,7 +3941,7 @@ var V = /*#__PURE__*/function () {
|
|
3921
3941
|
if (!document.body.contains(e.deepChat)) return;
|
3922
3942
|
var i = e.connectSettings.websocket;
|
3923
3943
|
if (i) {
|
3924
|
-
if (e.connectSettings.handler) return
|
3944
|
+
if (e.connectSettings.handler) return Ee.websocket(e, t);
|
3925
3945
|
try {
|
3926
3946
|
var n = typeof i != "boolean" ? i : void 0,
|
3927
3947
|
r = new WebSocket(e.connectSettings.url || "", n);
|
@@ -4053,11 +4073,11 @@ var V = /*#__PURE__*/function () {
|
|
4053
4073
|
return _context10.abrupt("return", r.newUserMessage.listener(a));
|
4054
4074
|
case 14:
|
4055
4075
|
c = n ? JSON.stringify(a) : a;
|
4056
|
-
if (!(((h = e.connectSettings) == null ? void 0 : h.url) ===
|
4076
|
+
if (!(((h = e.connectSettings) == null ? void 0 : h.url) === me.URL)) {
|
4057
4077
|
_context10.next = 17;
|
4058
4078
|
break;
|
4059
4079
|
}
|
4060
|
-
return _context10.abrupt("return",
|
4080
|
+
return _context10.abrupt("return", me.request(e, i));
|
4061
4081
|
case 17:
|
4062
4082
|
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());
|
4063
4083
|
case 18:
|
@@ -4091,16 +4111,16 @@ var V = /*#__PURE__*/function () {
|
|
4091
4111
|
var _i$o;
|
4092
4112
|
var o = n.role || b.AI_ROLE,
|
4093
4113
|
a = i[o];
|
4094
|
-
n.text === r || n.html === r ? (a == null || a.finaliseStreamedMessage(), delete i[o]) : ((_i$o = i[o]) !== null && _i$o !== void 0 ? _i$o : i[o] = new
|
4114
|
+
n.text === r || n.html === r ? (a == null || a.finaliseStreamedMessage(), delete i[o]) : ((_i$o = i[o]) !== null && _i$o !== void 0 ? _i$o : i[o] = new pe(t), i[o].upsertStreamedMessage(n));
|
4095
4115
|
} else C.simulate(t, e.streamHandlers, n);
|
4096
4116
|
}
|
4097
4117
|
}]);
|
4098
4118
|
}();
|
4099
|
-
var
|
4100
|
-
function
|
4101
|
-
_classCallCheck(this,
|
4119
|
+
var Ee = /*#__PURE__*/function () {
|
4120
|
+
function Ee() {
|
4121
|
+
_classCallCheck(this, Ee);
|
4102
4122
|
}
|
4103
|
-
return _createClass(
|
4123
|
+
return _createClass(Ee, null, [{
|
4104
4124
|
key: "request",
|
4105
4125
|
value: function () {
|
4106
4126
|
var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(e, t, i) {
|
@@ -4143,7 +4163,7 @@ var xe = /*#__PURE__*/function () {
|
|
4143
4163
|
return function r(_x24) {
|
4144
4164
|
return _ref3.apply(this, arguments);
|
4145
4165
|
};
|
4146
|
-
}(), o =
|
4166
|
+
}(), o = Ee.generateOptionalSignals();
|
4147
4167
|
(l = (a = e.connectSettings).handler) == null || l.call(a, t, _objectSpread(_objectSpread({}, o), {}, {
|
4148
4168
|
onResponse: r
|
4149
4169
|
}));
|
@@ -4174,12 +4194,12 @@ var xe = /*#__PURE__*/function () {
|
|
4174
4194
|
var h, u;
|
4175
4195
|
var n = !0,
|
4176
4196
|
r = !1;
|
4177
|
-
var o = new
|
4197
|
+
var o = new pe(i),
|
4178
4198
|
a = function a() {
|
4179
4199
|
r || !n || (e.streamHandlers.onOpen(), r = !0);
|
4180
4200
|
},
|
4181
4201
|
l = function l() {
|
4182
|
-
n && (
|
4202
|
+
n && (Ee.attemptToFinaliseStream(o, i), e.streamHandlers.onClose(), n = !1);
|
4183
4203
|
},
|
4184
4204
|
c = /*#__PURE__*/function () {
|
4185
4205
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(f) {
|
@@ -4216,9 +4236,9 @@ var xe = /*#__PURE__*/function () {
|
|
4216
4236
|
};
|
4217
4237
|
}();
|
4218
4238
|
e.streamHandlers.abortStream.abort = function () {
|
4219
|
-
|
4239
|
+
Ee.attemptToFinaliseStream(o, i), e.streamHandlers.onClose(), n = !1;
|
4220
4240
|
};
|
4221
|
-
var d =
|
4241
|
+
var d = Ee.generateOptionalSignals();
|
4222
4242
|
(u = (h = e.connectSettings).handler) == null || u.call(h, t, _objectSpread(_objectSpread({}, d), {}, {
|
4223
4243
|
onOpen: a,
|
4224
4244
|
onResponse: c,
|
@@ -4283,7 +4303,7 @@ var xe = /*#__PURE__*/function () {
|
|
4283
4303
|
return _ref5.apply(this, arguments);
|
4284
4304
|
};
|
4285
4305
|
}(),
|
4286
|
-
a =
|
4306
|
+
a = Ee.generateOptionalSignals();
|
4287
4307
|
(c = (l = e.connectSettings).handler) == null || c.call(l, void 0, _objectSpread(_objectSpread({}, a), {}, {
|
4288
4308
|
onOpen: n,
|
4289
4309
|
onResponse: o,
|
@@ -4355,13 +4375,13 @@ var T = /*#__PURE__*/function () {
|
|
4355
4375
|
_context16.next = 13;
|
4356
4376
|
break;
|
4357
4377
|
}
|
4358
|
-
return _context16.abrupt("return",
|
4378
|
+
return _context16.abrupt("return", Ee.request(e, o, i));
|
4359
4379
|
case 13:
|
4360
|
-
if (!(((m = e.connectSettings) == null ? void 0 : m.url) ===
|
4380
|
+
if (!(((m = e.connectSettings) == null ? void 0 : m.url) === me.URL)) {
|
4361
4381
|
_context16.next = 15;
|
4362
4382
|
break;
|
4363
4383
|
}
|
4364
|
-
return _context16.abrupt("return",
|
4384
|
+
return _context16.abrupt("return", me.request(e, i));
|
4365
4385
|
case 15:
|
4366
4386
|
d = !0;
|
4367
4387
|
h = v.fetch.bind(this, e, a, n);
|
@@ -4371,7 +4391,7 @@ var T = /*#__PURE__*/function () {
|
|
4371
4391
|
return v.processResponseByType(p);
|
4372
4392
|
}).then( /*#__PURE__*/function () {
|
4373
4393
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(p) {
|
4374
|
-
var
|
4394
|
+
var ee, re, x, S;
|
4375
4395
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
4376
4396
|
while (1) switch (_context15.prev = _context15.next) {
|
4377
4397
|
case 0:
|
@@ -4382,7 +4402,7 @@ var T = /*#__PURE__*/function () {
|
|
4382
4402
|
return _context15.abrupt("return");
|
4383
4403
|
case 2:
|
4384
4404
|
_context15.next = 4;
|
4385
|
-
return (
|
4405
|
+
return (re = (ee = e.deepChat).responseInterceptor) == null ? void 0 : re.call(ee, p);
|
4386
4406
|
case 4:
|
4387
4407
|
_context15.t0 = _context15.sent;
|
4388
4408
|
if (_context15.t0) {
|
@@ -4705,7 +4725,7 @@ var We = /*#__PURE__*/function () {
|
|
4705
4725
|
var _a$url;
|
4706
4726
|
_classCallCheck(this, We);
|
4707
4727
|
var n, r, o, a, l;
|
4708
|
-
this.rawBody = {}, this.validateKeyProperty = !1, this.canSendMessage = We.canSendMessage, this.connectSettings = {}, this.fileTypes = {}, this.completionsHandlers = {}, this.streamHandlers = {}, this.deepChat = e, this.demo = i, Object.assign(this.rawBody, (n = e.connect) == null ? void 0 : n.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, I.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 =
|
4728
|
+
this.rawBody = {}, this.validateKeyProperty = !1, this.canSendMessage = We.canSendMessage, this.connectSettings = {}, this.fileTypes = {}, this.completionsHandlers = {}, this.streamHandlers = {}, this.deepChat = e, this.demo = i, Object.assign(this.rawBody, (n = e.connect) == null ? void 0 : n.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, I.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 = me.URL), this.connectSettings.websocket && V.setup(this), this.stream = ((l = this.deepChat.connect) == null ? void 0 : l.stream) || ue.checkForStream(this.deepChat);
|
4709
4729
|
}
|
4710
4730
|
return _createClass(We, [{
|
4711
4731
|
key: "verifyKey",
|
@@ -4865,7 +4885,7 @@ var We = /*#__PURE__*/function () {
|
|
4865
4885
|
_context24.next = 4;
|
4866
4886
|
break;
|
4867
4887
|
}
|
4868
|
-
return _context24.abrupt("return",
|
4888
|
+
return _context24.abrupt("return", ue.handleResponseProperty(e));
|
4869
4889
|
case 4:
|
4870
4890
|
if (!v.validateResponseFormat(e)) {
|
4871
4891
|
_context24.next = 6;
|
@@ -4981,19 +5001,19 @@ var ei = /*#__PURE__*/function () {
|
|
4981
5001
|
}
|
4982
5002
|
}]);
|
4983
5003
|
}();
|
4984
|
-
var
|
5004
|
+
var ve = /*#__PURE__*/function (_HTMLElement) {
|
4985
5005
|
// If this is not working, try using propertyName directly
|
4986
|
-
function
|
5006
|
+
function ve() {
|
4987
5007
|
var _this9;
|
4988
|
-
_classCallCheck(this,
|
4989
|
-
_this9 = _callSuper(this,
|
4990
|
-
var t =
|
5008
|
+
_classCallCheck(this, ve);
|
5009
|
+
_this9 = _callSuper(this, ve), _this9._waitingToRender_ = !1, _this9._propUpdated_ = !1, Object.keys(ve._attributeToProperty_).forEach(function (e) {
|
5010
|
+
var t = ve._attributeToProperty_[e];
|
4991
5011
|
_this9.constructPropertyAccessors(t), _this9.hasOwnProperty(e) || _this9.constructPropertyAccessors(t, e);
|
4992
5012
|
});
|
4993
5013
|
return _this9;
|
4994
5014
|
}
|
4995
|
-
_inherits(
|
4996
|
-
return _createClass(
|
5015
|
+
_inherits(ve, _HTMLElement);
|
5016
|
+
return _createClass(ve, [{
|
4997
5017
|
key: "constructPropertyAccessors",
|
4998
5018
|
value:
|
4999
5019
|
// need to be called here as accessors need to be set for the class instance
|
@@ -5012,8 +5032,8 @@ var be = /*#__PURE__*/function (_HTMLElement) {
|
|
5012
5032
|
key: "attributeChangedCallback",
|
5013
5033
|
value: function attributeChangedCallback(e, t, i) {
|
5014
5034
|
if (t === i) return;
|
5015
|
-
var n =
|
5016
|
-
r =
|
5035
|
+
var n = ve._attributes_[e](i),
|
5036
|
+
r = ve._attributeToProperty_[e];
|
5017
5037
|
this[r] = n;
|
5018
5038
|
}
|
5019
5039
|
}, {
|
@@ -5022,19 +5042,19 @@ var be = /*#__PURE__*/function (_HTMLElement) {
|
|
5022
5042
|
}], [{
|
5023
5043
|
key: "observedAttributes",
|
5024
5044
|
get: function get() {
|
5025
|
-
return Object.keys(
|
5045
|
+
return Object.keys(ve._attributes_) || [];
|
5026
5046
|
}
|
5027
5047
|
}]);
|
5028
5048
|
}( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
|
5029
|
-
|
5030
|
-
var Xi =
|
5049
|
+
ve._attributes_ = {}, ve._attributeToProperty_ = {};
|
5050
|
+
var Xi = ve;
|
5031
5051
|
var ho = "<?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",
|
5032
5052
|
uo = "<?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";
|
5033
|
-
var
|
5034
|
-
function
|
5035
|
-
_classCallCheck(this,
|
5053
|
+
var Y = /*#__PURE__*/function () {
|
5054
|
+
function Y() {
|
5055
|
+
_classCallCheck(this, Y);
|
5036
5056
|
}
|
5037
|
-
return _createClass(
|
5057
|
+
return _createClass(Y, null, [{
|
5038
5058
|
key: "createSVGElement",
|
5039
5059
|
value: function createSVGElement(e) {
|
5040
5060
|
return new DOMParser().parseFromString(e, "image/svg+xml").documentElement;
|
@@ -5055,7 +5075,7 @@ var Ie = /*#__PURE__*/function () {
|
|
5055
5075
|
}, {
|
5056
5076
|
key: "createIconElement",
|
5057
5077
|
value: function createIconElement(e, t) {
|
5058
|
-
var i =
|
5078
|
+
var i = Y.createSVGElement(e);
|
5059
5079
|
return i.id = t, i.classList.add("visibility-icon"), i;
|
5060
5080
|
}
|
5061
5081
|
// prettier-ignore
|
@@ -5681,7 +5701,7 @@ var On = {
|
|
5681
5701
|
this.streamHandlers.abortStream.abort = function () {
|
5682
5702
|
i.interruptGenerate();
|
5683
5703
|
}, this.streamHandlers.onOpen();
|
5684
|
-
n = new
|
5704
|
+
n = new pe(e);
|
5685
5705
|
_context31.next = 4;
|
5686
5706
|
return i.generate(t, /*#__PURE__*/function () {
|
5687
5707
|
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(r, o) {
|
@@ -6162,11 +6182,11 @@ var po = /*#__PURE__*/function (_Dt2) {
|
|
6162
6182
|
}]);
|
6163
6183
|
}(Dt);
|
6164
6184
|
var Ft = "data:image/png;base64,";
|
6165
|
-
var
|
6166
|
-
function
|
6167
|
-
_classCallCheck(this,
|
6185
|
+
var ge = /*#__PURE__*/function () {
|
6186
|
+
function ge() {
|
6187
|
+
_classCallCheck(this, ge);
|
6168
6188
|
}
|
6169
|
-
return _createClass(
|
6189
|
+
return _createClass(ge, null, [{
|
6170
6190
|
key: "buildHeaders",
|
6171
6191
|
value: function buildHeaders(e) {
|
6172
6192
|
return {
|
@@ -6186,7 +6206,7 @@ var me = /*#__PURE__*/function () {
|
|
6186
6206
|
return {
|
6187
6207
|
url: "https://api.stability.ai/v1/engines/list",
|
6188
6208
|
method: "GET",
|
6189
|
-
handleVerificationResult:
|
6209
|
+
handleVerificationResult: ge.handleVerificationResult
|
6190
6210
|
};
|
6191
6211
|
}
|
6192
6212
|
}]);
|
@@ -6217,7 +6237,7 @@ var ni = /*#__PURE__*/function (_i10) {
|
|
6217
6237
|
}
|
6218
6238
|
}
|
6219
6239
|
};
|
6220
|
-
_this19 = _callSuper(this, ni, [e,
|
6240
|
+
_this19 = _callSuper(this, ni, [e, ge.buildKeyVerificationDetails(), ge.buildHeaders, i, n]), _this19.url = "https://api.stability.ai/v1/generation/esrgan-v1-x2plus/image-to-image/upscale", _this19.textInputPlaceholderText = "Describe image changes", _this19.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>";
|
6221
6241
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageUpscale;
|
6222
6242
|
_typeof(r) == "object" && (r.engine_id && (_this19.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/upscale")), ni.cleanConfig(r), Object.assign(_this19.rawBody, r)), _this19.canSendMessage = ni.canSendFileMessage;
|
6223
6243
|
return _this19;
|
@@ -6324,7 +6344,7 @@ var si = /*#__PURE__*/function (_i11) {
|
|
6324
6344
|
}
|
6325
6345
|
}
|
6326
6346
|
};
|
6327
|
-
_this20 = _callSuper(this, si, [e,
|
6347
|
+
_this20 = _callSuper(this, si, [e, ge.buildKeyVerificationDetails(), ge.buildHeaders, i, n]), _this20.url = "https://api.stability.ai/v1/generation/stable-diffusion-xl-1024-v1-0/image-to-image/masking", _this20._maskSource = "MASK_IMAGE_WHITE", _this20.textInputPlaceholderText = "Describe image changes", _this20.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>";
|
6328
6348
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageMasking;
|
6329
6349
|
_typeof(r) == "object" && (r.engine_id && (_this20.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/masking")), r.weight !== void 0 && r.weight !== null && (_this20._imageWeight = r.weight), r.mask_source !== void 0 && r.mask_source !== null && (_this20._maskSource = r.mask_source), si.cleanConfig(r), Object.assign(_this20.rawBody, r)), _this20.canSendMessage = si.canSendFileTextMessage;
|
6330
6350
|
return _this20;
|
@@ -6693,7 +6713,7 @@ var ri = /*#__PURE__*/function (_i12) {
|
|
6693
6713
|
}
|
6694
6714
|
}
|
6695
6715
|
};
|
6696
|
-
_this23 = _callSuper(this, ri, [e,
|
6716
|
+
_this23 = _callSuper(this, ri, [e, ge.buildKeyVerificationDetails(), ge.buildHeaders, i, n]), _this23.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/image-to-image", _this23.textInputPlaceholderText = "Describe image changes", _this23.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>";
|
6697
6717
|
var r = (o = t.stabilityAI) == null ? void 0 : o.imageToImage;
|
6698
6718
|
_typeof(r) == "object" && (r.engine_id && (_this23.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/text-to-image")), r.weight !== void 0 && r.weight !== null && (_this23._imageWeight = r.weight), ri.cleanConfig(r), Object.assign(_this23.rawBody, r)), _this23.canSendMessage = ri.canSendFileTextMessage;
|
6699
6719
|
return _this23;
|
@@ -6831,7 +6851,7 @@ var oi = /*#__PURE__*/function (_i13) {
|
|
6831
6851
|
var r;
|
6832
6852
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
6833
6853
|
i = t.stabilityAI;
|
6834
|
-
_this24 = _callSuper(this, oi, [e,
|
6854
|
+
_this24 = _callSuper(this, oi, [e, ge.buildKeyVerificationDetails(), ge.buildHeaders, i]), _this24.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/text-to-image", _this24.textInputPlaceholderText = "Describe an image", _this24.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>";
|
6835
6855
|
var n = (r = t.stabilityAI) == null ? void 0 : r.textToImage;
|
6836
6856
|
_typeof(n) == "object" && (n.engine_id && (_this24.url = "https://api.stability.ai/v1/generation/".concat(n.engine_id, "/text-to-image")), n.weight !== void 0 && n.weight !== null && (_this24._imageWeight = n.weight), oi.cleanConfig(n), Object.assign(_this24.rawBody, n)), _this24.canSendMessage = oi.canSendTextMessage;
|
6837
6857
|
return _this24;
|
@@ -7315,26 +7335,26 @@ var nt = /*#__PURE__*/function (_H4) {
|
|
7315
7335
|
}(H);
|
7316
7336
|
nt.DEFAULT_MODEL = "tts-1", nt.DEFAULT_VOIDE = "alloy";
|
7317
7337
|
var Yi = nt;
|
7318
|
-
var
|
7319
|
-
function
|
7338
|
+
var le = /*#__PURE__*/function (_H5) {
|
7339
|
+
function le(e) {
|
7320
7340
|
var _o$model2;
|
7321
7341
|
var _this28;
|
7322
|
-
_classCallCheck(this,
|
7342
|
+
_classCallCheck(this, le);
|
7323
7343
|
var r, o;
|
7324
7344
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
7325
7345
|
i = t == null ? void 0 : t.openAI;
|
7326
|
-
_this28 = _callSuper(this,
|
7346
|
+
_this28 = _callSuper(this, le, [e, P.buildKeyVerificationDetails(), P.buildHeaders, i, {
|
7327
7347
|
audio: {}
|
7328
|
-
}]), _this28.insertKeyPlaceholderText = "OpenAI API Key", _this28.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this28.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>", _this28.url = "", _this28.permittedErrorPrefixes = ["Invalid"], _this28.textInputPlaceholderText = "Upload an audio file", _this28._service_url =
|
7348
|
+
}]), _this28.insertKeyPlaceholderText = "OpenAI API Key", _this28.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this28.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>", _this28.url = "", _this28.permittedErrorPrefixes = ["Invalid"], _this28.textInputPlaceholderText = "Upload an audio file", _this28._service_url = le.AUDIO_TRANSCRIPTIONS_URL;
|
7329
7349
|
var n = (r = t == null ? void 0 : t.openAI) == null ? void 0 : r.audio;
|
7330
|
-
_typeof(n) == "object" && (_this28.processConfig(n),
|
7350
|
+
_typeof(n) == "object" && (_this28.processConfig(n), le.cleanConfig(n), Object.assign(_this28.rawBody, n)), (_o$model2 = (o = _this28.rawBody).model) !== null && _o$model2 !== void 0 ? _o$model2 : o.model = le.DEFAULT_MODEL, _this28.rawBody.response_format = "json", _this28.canSendMessage = le.canSendFileMessage;
|
7331
7351
|
return _this28;
|
7332
7352
|
}
|
7333
|
-
_inherits(
|
7334
|
-
return _createClass(
|
7353
|
+
_inherits(le, _H5);
|
7354
|
+
return _createClass(le, [{
|
7335
7355
|
key: "processConfig",
|
7336
7356
|
value: function processConfig(e) {
|
7337
|
-
e != null && e.type && e.type === "translation" && (this._service_url =
|
7357
|
+
e != null && e.type && e.type === "translation" && (this._service_url = le.AUDIO_TRANSLATIONS_URL, delete e.language);
|
7338
7358
|
}
|
7339
7359
|
}, {
|
7340
7360
|
key: "preprocessBody",
|
@@ -7366,7 +7386,7 @@ var ae = /*#__PURE__*/function (_H5) {
|
|
7366
7386
|
throw new Error("No file was added");
|
7367
7387
|
case 4:
|
7368
7388
|
this.url = this.connectSettings.url || this._service_url;
|
7369
|
-
n = this.preprocessBody(this.rawBody, t), r =
|
7389
|
+
n = this.preprocessBody(this.rawBody, t), r = le.createFormDataBody(n, i[0]);
|
7370
7390
|
v.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, r, e), !1);
|
7371
7391
|
case 7:
|
7372
7392
|
case "end":
|
@@ -7426,13 +7446,13 @@ var ae = /*#__PURE__*/function (_H5) {
|
|
7426
7446
|
}
|
7427
7447
|
}]);
|
7428
7448
|
}(H);
|
7429
|
-
|
7430
|
-
var Qi =
|
7431
|
-
var
|
7432
|
-
function
|
7433
|
-
_classCallCheck(this,
|
7449
|
+
le.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions", le.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations", le.DEFAULT_MODEL = "whisper-1";
|
7450
|
+
var Qi = le;
|
7451
|
+
var se = /*#__PURE__*/function () {
|
7452
|
+
function se() {
|
7453
|
+
_classCallCheck(this, se);
|
7434
7454
|
}
|
7435
|
-
return _createClass(
|
7455
|
+
return _createClass(se, null, [{
|
7436
7456
|
key: "buildTextToSpeechHeaders",
|
7437
7457
|
value: function buildTextToSpeechHeaders(e, t) {
|
7438
7458
|
return {
|
@@ -7466,7 +7486,7 @@ var ne = /*#__PURE__*/function () {
|
|
7466
7486
|
"Ocp-Apim-Subscription-Key": "".concat(t)
|
7467
7487
|
};
|
7468
7488
|
},
|
7469
|
-
handleVerificationResult:
|
7489
|
+
handleVerificationResult: se.handleSpeechVerificationResult
|
7470
7490
|
};
|
7471
7491
|
}
|
7472
7492
|
}, {
|
@@ -7495,7 +7515,7 @@ var ne = /*#__PURE__*/function () {
|
|
7495
7515
|
"Ocp-Apim-Subscription-Key": "".concat(t)
|
7496
7516
|
};
|
7497
7517
|
},
|
7498
|
-
handleVerificationResult:
|
7518
|
+
handleVerificationResult: se.handleLanguageVerificationResult
|
7499
7519
|
};
|
7500
7520
|
}
|
7501
7521
|
// prettier-ignore
|
@@ -7513,9 +7533,9 @@ var ne = /*#__PURE__*/function () {
|
|
7513
7533
|
url: "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=es",
|
7514
7534
|
method: "POST",
|
7515
7535
|
createHeaders: function createHeaders(t) {
|
7516
|
-
return
|
7536
|
+
return se.buildTranslationHeaders(e, t);
|
7517
7537
|
},
|
7518
|
-
handleVerificationResult:
|
7538
|
+
handleVerificationResult: se.handleTranslationVerificationResult
|
7519
7539
|
};
|
7520
7540
|
}
|
7521
7541
|
}, {
|
@@ -7534,7 +7554,7 @@ var wo = /*#__PURE__*/function (_H6) {
|
|
7534
7554
|
function wo(e, t, i, n, r) {
|
7535
7555
|
var _this29;
|
7536
7556
|
_classCallCheck(this, wo);
|
7537
|
-
_this29 = _callSuper(this, wo, [e,
|
7557
|
+
_this29 = _callSuper(this, wo, [e, se.buildLanguageKeyVerificationDetails(i), t, n, r]), _this29.insertKeyPlaceholderText = "Azure Language Subscription Key", _this29.keyHelpUrl =
|
7538
7558
|
// eslint-disable-next-line max-len
|
7539
7559
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this29.permittedErrorPrefixes = ["Access"];
|
7540
7560
|
return _this29;
|
@@ -7550,7 +7570,7 @@ var To = /*#__PURE__*/function (_wo) {
|
|
7550
7570
|
var n, r, o, a;
|
7551
7571
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.azure) == null ? void 0 : r.summarization,
|
7552
7572
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
7553
|
-
_this30 = _callSuper(this, To, [e,
|
7573
|
+
_this30 = _callSuper(this, To, [e, se.buildSummarizationHeader, t.endpoint, i]), _this30.url = "", _this30.textInputPlaceholderText = "Insert text to summarize", (_a$language = (a = _this30.rawBody).language) !== null && _a$language !== void 0 ? _a$language : a.language = "en", Object.assign(_this30.rawBody, t), _this30.url = "".concat(t.endpoint, "/language/analyze-text/jobs?api-version=2022-10-01-preview");
|
7554
7574
|
return _this30;
|
7555
7575
|
}
|
7556
7576
|
_inherits(To, _wo);
|
@@ -7889,7 +7909,7 @@ var ls = /*#__PURE__*/function (_H8) {
|
|
7889
7909
|
function ls(e, t, i, n, r) {
|
7890
7910
|
var _this32;
|
7891
7911
|
_classCallCheck(this, ls);
|
7892
|
-
_this32 = _callSuper(this, ls, [e,
|
7912
|
+
_this32 = _callSuper(this, ls, [e, se.buildSpeechKeyVerificationDetails(i), t, n, r]), _this32.insertKeyPlaceholderText = "Azure Speech Subscription Key", _this32.keyHelpUrl =
|
7893
7913
|
// eslint-disable-next-line max-len
|
7894
7914
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal";
|
7895
7915
|
return _this32;
|
@@ -7906,7 +7926,7 @@ var vi = /*#__PURE__*/function (_ls) {
|
|
7906
7926
|
var n, r, o, a, l, c;
|
7907
7927
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.azure) == null ? void 0 : r.textToSpeech,
|
7908
7928
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
7909
|
-
_this33 = _callSuper(this, vi, [e,
|
7929
|
+
_this33 = _callSuper(this, vi, [e, se.buildTextToSpeechHeaders.bind({}, (t == null ? void 0 : t.outputFormat) || "audio-16khz-128kbitrate-mono-mp3"), t.region, i]), _this33.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(vi.HELP_LINK, "\">here</a> for more info.\n </p>"), _this33.url = "", Object.assign(_this33.rawBody, t), (_a$lang = (a = _this33.rawBody).lang) !== null && _a$lang !== void 0 ? _a$lang : a.lang = "en-US", (_l$name = (l = _this33.rawBody).name) !== null && _l$name !== void 0 ? _l$name : l.name = "en-US-JennyNeural", (_c$gender = (c = _this33.rawBody).gender) !== null && _c$gender !== void 0 ? _c$gender : c.gender = "Female", _this33.url = "https://".concat(t.region, ".tts.speech.microsoft.com/cognitiveservices/v1");
|
7910
7930
|
return _this33;
|
7911
7931
|
}
|
7912
7932
|
_inherits(vi, _ls);
|
@@ -7992,7 +8012,7 @@ var wt = /*#__PURE__*/function (_ls2) {
|
|
7992
8012
|
}
|
7993
8013
|
}
|
7994
8014
|
};
|
7995
|
-
_this34 = _callSuper(this, wt, [e,
|
8015
|
+
_this34 = _callSuper(this, wt, [e, se.buildSpeechToTextHeaders, t.region, i, n]), _this34.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(wt.HELP_LINK, "\">here</a> for more info.\n </p>"), _this34.url = "", _this34.isTextInputDisabled = !0, _this34.textInputPlaceholderText = "Upload an audio file", _this34.canSendMessage = wt.canFileSendMessage;
|
7996
8016
|
var r = t.lang || "en-US";
|
7997
8017
|
_this34.url = "https://".concat(t.region, ".stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=").concat(r, "&format=detailed"), _this34.recordAudio = void 0;
|
7998
8018
|
return _this34;
|
@@ -8076,7 +8096,7 @@ var Co = /*#__PURE__*/function (_H9) {
|
|
8076
8096
|
var n, r, o;
|
8077
8097
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.azure) == null ? void 0 : r.translation,
|
8078
8098
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
8079
|
-
_this35 = _callSuper(this, Co, [e,
|
8099
|
+
_this35 = _callSuper(this, Co, [e, se.buildTranslationKeyVerificationDetails(t.region), se.buildTranslationHeaders.bind({}, t == null ? void 0 : t.region), i]), _this35.insertKeyPlaceholderText = "Azure Translate Subscription Key", _this35.keyHelpUrl =
|
8080
8100
|
// eslint-disable-next-line max-len
|
8081
8101
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this35.url = "", _this35.url = "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=".concat(t.language || "es");
|
8082
8102
|
return _this35;
|
@@ -9038,10 +9058,10 @@ var F = /*#__PURE__*/function (_H10) {
|
|
9038
9058
|
}(H);
|
9039
9059
|
F.THREAD_PREFIX = "https://api.openai.com/v1/threads", F.NEW_ASSISTANT_URL = "https://api.openai.com/v1/assistants", F.POLLING_TIMEOUT_MS = 800;
|
9040
9060
|
var nn = F;
|
9041
|
-
var
|
9042
|
-
function
|
9061
|
+
var ce = /*#__PURE__*/function (_H11) {
|
9062
|
+
function ce(e) {
|
9043
9063
|
var _this39;
|
9044
|
-
_classCallCheck(this,
|
9064
|
+
_classCallCheck(this, ce);
|
9045
9065
|
var o;
|
9046
9066
|
var t = e.directConnection,
|
9047
9067
|
i = t == null ? void 0 : t.openAI,
|
@@ -9053,7 +9073,7 @@ var le = /*#__PURE__*/function (_H11) {
|
|
9053
9073
|
}
|
9054
9074
|
}
|
9055
9075
|
};
|
9056
|
-
_this39 = _callSuper(this,
|
9076
|
+
_this39 = _callSuper(this, ce, [e, P.buildKeyVerificationDetails(), P.buildHeaders, i, n]), _this39.insertKeyPlaceholderText = "OpenAI API Key", _this39.keyHelpUrl = "https://platform.openai.com/account/api-keys", _this39.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI DALL\xB7E</b></div>\n <p><b>Insert text</b> to generate an image.</p>\n <p><b>Upload 1</b> PNG image to generate its variation and optionally insert text to specify the change.</p>\n <p><b>Upload 2</b> PNG images where the second is a copy of the first with a transparent area where the edit should\n take place and text to specify the edit.</p>\n <p>Click <a href=\"https://platform.openai.com/docs/guides/images/introduction\">here</a> for more info.</p>", _this39.url = "", _this39.permittedErrorPrefixes = ["Incorrect", "Invalid input image"];
|
9057
9077
|
var r = (o = t == null ? void 0 : t.openAI) == null ? void 0 : o.images;
|
9058
9078
|
if (_this39.camera) {
|
9059
9079
|
var a = _typeof(r) == "object" && r.size ? Number.parseInt(r.size) : 1024;
|
@@ -9064,11 +9084,11 @@ var le = /*#__PURE__*/function (_H11) {
|
|
9064
9084
|
}
|
9065
9085
|
};
|
9066
9086
|
}
|
9067
|
-
_typeof(r) == "object" && Object.assign(_this39.rawBody, r), _this39.canSendMessage =
|
9087
|
+
_typeof(r) == "object" && Object.assign(_this39.rawBody, r), _this39.canSendMessage = ce.canFileSendMessage;
|
9068
9088
|
return _this39;
|
9069
9089
|
}
|
9070
|
-
_inherits(
|
9071
|
-
return _createClass(
|
9090
|
+
_inherits(ce, _H11);
|
9091
|
+
return _createClass(ce, [{
|
9072
9092
|
key: "preprocessBody",
|
9073
9093
|
value: function preprocessBody(e, t) {
|
9074
9094
|
var i = JSON.parse(JSON.stringify(e));
|
@@ -9082,10 +9102,10 @@ var le = /*#__PURE__*/function (_H11) {
|
|
9082
9102
|
var n;
|
9083
9103
|
var r = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim();
|
9084
9104
|
if (i[1] || r && r !== "") {
|
9085
|
-
this.url =
|
9105
|
+
this.url = ce.IMAGE_EDIT_URL;
|
9086
9106
|
var l = this.preprocessBody(this.rawBody, r);
|
9087
|
-
n =
|
9088
|
-
} else this.url =
|
9107
|
+
n = ce.createFormDataBody(l, i[0], i[1]);
|
9108
|
+
} else this.url = ce.IMAGE_VARIATIONS_URL, n = ce.createFormDataBody(this.rawBody, i[0]);
|
9089
9109
|
v.tempRemoveContentHeader(this.connectSettings, T.request.bind(this, this, n, e), !1);
|
9090
9110
|
}
|
9091
9111
|
}, {
|
@@ -9116,7 +9136,7 @@ var le = /*#__PURE__*/function (_H11) {
|
|
9116
9136
|
}
|
9117
9137
|
throw new Error("Request settings have not been set up");
|
9118
9138
|
case 8:
|
9119
|
-
this.url =
|
9139
|
+
this.url = ce.IMAGE_GENERATION_URL;
|
9120
9140
|
r = this.preprocessBody(this.rawBody, t[t.length - 1].text);
|
9121
9141
|
T.request(this, r, e);
|
9122
9142
|
case 11:
|
@@ -9188,8 +9208,8 @@ var le = /*#__PURE__*/function (_H11) {
|
|
9188
9208
|
}
|
9189
9209
|
}]);
|
9190
9210
|
}(H);
|
9191
|
-
|
9192
|
-
var sn =
|
9211
|
+
ce.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations", ce.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations", ce.IMAGE_EDIT_URL = "https://api.openai.com/v1/images/edits";
|
9212
|
+
var sn = ce;
|
9193
9213
|
var yt = /*#__PURE__*/function (_H12) {
|
9194
9214
|
function yt(e) {
|
9195
9215
|
var _this40$maxMessages, _l$model;
|
@@ -9858,7 +9878,7 @@ var Ce = /*#__PURE__*/function () {
|
|
9858
9878
|
t.classList.add("any-file-message-contents");
|
9859
9879
|
var i = document.createElement("div");
|
9860
9880
|
i.classList.add("any-file-message-icon-container");
|
9861
|
-
var n =
|
9881
|
+
var n = Y.createSVGElement(Io);
|
9862
9882
|
n.classList.add("any-file-message-icon"), i.appendChild(n);
|
9863
9883
|
var r = document.createElement("div");
|
9864
9884
|
return r.classList.add("any-file-message-text"), r.textContent = e.name || B.DEFAULT_FILE_NAME, t.appendChild(i), t.appendChild(r), B.processContent("any", t, e.src, r.textContent);
|
@@ -9939,9 +9959,9 @@ var ke = /*#__PURE__*/function (_ot) {
|
|
9939
9959
|
key: "populateHistory",
|
9940
9960
|
value: function populateHistory(e) {
|
9941
9961
|
var _this45 = this;
|
9942
|
-
var t = e.history ||
|
9962
|
+
var t = e.history || ue.processHistory(e);
|
9943
9963
|
t && (t.forEach(function (i) {
|
9944
|
-
|
9964
|
+
ue.processHistoryFile(i), _this45.addNewMessage(i, !0);
|
9945
9965
|
}), setTimeout(function () {
|
9946
9966
|
return U.scrollToBottom(_this45.elementRef);
|
9947
9967
|
}, 0));
|
@@ -10013,7 +10033,7 @@ var ke = /*#__PURE__*/function (_ot) {
|
|
10013
10033
|
value: function removeMessageOnError() {
|
10014
10034
|
var e = this.messageElementRefs[this.messageElementRefs.length - 1],
|
10015
10035
|
t = e == null ? void 0 : e.bubbleElement;
|
10016
|
-
(t != null && t.classList.contains(
|
10036
|
+
(t != null && t.classList.contains(pe.MESSAGE_CLASS) && t.textContent === "" || ke.isTemporaryElement(e)) && this.removeLastMessage();
|
10017
10037
|
}
|
10018
10038
|
// prettier-ignore
|
10019
10039
|
}, {
|
@@ -10064,7 +10084,7 @@ var ke = /*#__PURE__*/function (_ot) {
|
|
10064
10084
|
}, {
|
10065
10085
|
key: "populateIntroPanel",
|
10066
10086
|
value: function populateIntroPanel(e, t, i) {
|
10067
|
-
(e || t) && (this._introPanel = new ci(e, t, i), this._introPanel._elementRef && (
|
10087
|
+
(e || t) && (this._introPanel = new ci(e, t, i), this._introPanel._elementRef && (X.apply(this, this._introPanel._elementRef), this.elementRef.appendChild(this._introPanel._elementRef)));
|
10068
10088
|
}
|
10069
10089
|
}, {
|
10070
10090
|
key: "addMultipleFiles",
|
@@ -10112,7 +10132,7 @@ var ke = /*#__PURE__*/function (_ot) {
|
|
10112
10132
|
var i = [];
|
10113
10133
|
this.messageElementRefs.forEach(function (o) {
|
10114
10134
|
var a = o.bubbleElement.classList;
|
10115
|
-
a.contains("loading-message-text") || a.contains(
|
10135
|
+
a.contains("loading-message-text") || a.contains(pe.MESSAGE_CLASS) ? i.push(o) : o.outerContainer.remove();
|
10116
10136
|
}), Array.from(this.elementRef.children).forEach(function (o) {
|
10117
10137
|
var l;
|
10118
10138
|
var a = (l = o.children[0]) == null ? void 0 : l.children[0];
|
@@ -10203,11 +10223,11 @@ var ht = /*#__PURE__*/function () {
|
|
10203
10223
|
}]);
|
10204
10224
|
}();
|
10205
10225
|
var Nn = ["camera", "gifs", "images", "audio", "mixedFiles", "submit", "microphone"];
|
10206
|
-
var
|
10207
|
-
function
|
10208
|
-
_classCallCheck(this,
|
10226
|
+
var Z = /*#__PURE__*/function () {
|
10227
|
+
function Z() {
|
10228
|
+
_classCallCheck(this, Z);
|
10209
10229
|
}
|
10210
|
-
return _createClass(
|
10230
|
+
return _createClass(Z, null, [{
|
10211
10231
|
key: "createTextElement",
|
10212
10232
|
value: function createTextElement(e) {
|
10213
10233
|
var t = document.createElement("div");
|
@@ -10216,15 +10236,15 @@ var X = /*#__PURE__*/function () {
|
|
10216
10236
|
}, {
|
10217
10237
|
key: "createElement",
|
10218
10238
|
value: function createElement(e, t) {
|
10219
|
-
return t ?
|
10239
|
+
return t ? Z.createTextElement(e) : Y.createSVGElement(e);
|
10220
10240
|
}
|
10221
10241
|
}, {
|
10222
10242
|
key: "createCustomElement",
|
10223
10243
|
value: function createCustomElement(e, t) {
|
10224
10244
|
var n, r, o, a;
|
10225
10245
|
var i = t == null ? void 0 : t[e];
|
10226
|
-
if ((n = i == null ? void 0 : i.text) != null && n.content) return
|
10227
|
-
if ((o = i == null ? void 0 : i.svg) != null && o.content) return
|
10246
|
+
if ((n = i == null ? void 0 : i.text) != null && n.content) return Z.createElement((r = i == null ? void 0 : i.text) == null ? void 0 : r.content, !0);
|
10247
|
+
if ((o = i == null ? void 0 : i.svg) != null && o.content) return Z.createElement((a = i == null ? void 0 : i.svg) == null ? void 0 : a.content, !1);
|
10228
10248
|
}
|
10229
10249
|
}, {
|
10230
10250
|
key: "processElement",
|
@@ -10237,16 +10257,16 @@ var X = /*#__PURE__*/function () {
|
|
10237
10257
|
key: "createSpecificStateElement",
|
10238
10258
|
value: function createSpecificStateElement(e, t, i) {
|
10239
10259
|
var n;
|
10240
|
-
return i && (n =
|
10260
|
+
return i && (n = Z.createCustomElement(t, i)), Z.processElement(e, n), n;
|
10241
10261
|
}
|
10242
10262
|
}]);
|
10243
10263
|
}();
|
10244
10264
|
var Lo = "<?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>";
|
10245
|
-
var
|
10246
|
-
function
|
10247
|
-
_classCallCheck(this,
|
10265
|
+
var he = /*#__PURE__*/function () {
|
10266
|
+
function he() {
|
10267
|
+
_classCallCheck(this, he);
|
10248
10268
|
}
|
10249
|
-
return _createClass(
|
10269
|
+
return _createClass(he, null, [{
|
10250
10270
|
key: "unsetAllCSS",
|
10251
10271
|
value: function unsetAllCSS(e, t) {
|
10252
10272
|
var i, n;
|
@@ -10267,7 +10287,7 @@ var de = /*#__PURE__*/function () {
|
|
10267
10287
|
}, {
|
10268
10288
|
key: "setElementCssUpToState",
|
10269
10289
|
value: function setElementCssUpToState(e, t, i) {
|
10270
|
-
|
10290
|
+
he.setElementsCSS(e, t, "default"), i !== "default" && (he.setElementsCSS(e, t, "hover"), i !== "hover" && he.setElementsCSS(e, t, "click"));
|
10271
10291
|
}
|
10272
10292
|
}]);
|
10273
10293
|
}();
|
@@ -10281,22 +10301,22 @@ var Bt = /*#__PURE__*/function () {
|
|
10281
10301
|
return _createClass(Bt, [{
|
10282
10302
|
key: "buttonMouseLeave",
|
10283
10303
|
value: function buttonMouseLeave(e) {
|
10284
|
-
this._mouseState.state = "default", e && (
|
10304
|
+
this._mouseState.state = "default", e && (he.unsetAllCSS(this.elementRef, e), he.setElementsCSS(this.elementRef, e, "default"));
|
10285
10305
|
}
|
10286
10306
|
}, {
|
10287
10307
|
key: "buttonMouseEnter",
|
10288
10308
|
value: function buttonMouseEnter(e) {
|
10289
|
-
this._mouseState.state = "hover", e &&
|
10309
|
+
this._mouseState.state = "hover", e && he.setElementsCSS(this.elementRef, e, "hover");
|
10290
10310
|
}
|
10291
10311
|
}, {
|
10292
10312
|
key: "buttonMouseUp",
|
10293
10313
|
value: function buttonMouseUp(e) {
|
10294
|
-
e &&
|
10314
|
+
e && he.unsetActionCSS(this.elementRef, e), this.buttonMouseEnter(e);
|
10295
10315
|
}
|
10296
10316
|
}, {
|
10297
10317
|
key: "buttonMouseDown",
|
10298
10318
|
value: function buttonMouseDown(e) {
|
10299
|
-
this._mouseState.state = "click", e &&
|
10319
|
+
this._mouseState.state = "click", e && he.setElementsCSS(this.elementRef, e, "click");
|
10300
10320
|
}
|
10301
10321
|
// be careful not to use onclick as that is used for button functionality
|
10302
10322
|
}, {
|
@@ -10310,7 +10330,7 @@ var Bt = /*#__PURE__*/function () {
|
|
10310
10330
|
if (this._customStyles) for (var t = 0; t < e.length; t += 1) {
|
10311
10331
|
var _i19 = e[t],
|
10312
10332
|
n = _i19 && this._customStyles[_i19];
|
10313
|
-
n &&
|
10333
|
+
n && he.unsetActionCSS(this.elementRef, n);
|
10314
10334
|
}
|
10315
10335
|
}
|
10316
10336
|
}, {
|
@@ -10319,7 +10339,7 @@ var Bt = /*#__PURE__*/function () {
|
|
10319
10339
|
if (!this._customStyles) return;
|
10320
10340
|
t && this.unsetCustomStateStyles(t);
|
10321
10341
|
var i = this._customStyles[e];
|
10322
|
-
i &&
|
10342
|
+
i && he.setElementCssUpToState(this.elementRef, i, this._mouseState.state), this.setEvents(i);
|
10323
10343
|
}
|
10324
10344
|
}]);
|
10325
10345
|
}();
|
@@ -10475,7 +10495,7 @@ var at = /*#__PURE__*/function (_Bt) {
|
|
10475
10495
|
}, {
|
10476
10496
|
key: "createInnerElement",
|
10477
10497
|
value: function createInnerElement(e, t, i) {
|
10478
|
-
return
|
10498
|
+
return Z.createSpecificStateElement(this.elementRef, t, i) || e;
|
10479
10499
|
}
|
10480
10500
|
}, {
|
10481
10501
|
key: "addClickEvent",
|
@@ -10504,7 +10524,7 @@ var at = /*#__PURE__*/function (_Bt) {
|
|
10504
10524
|
}, {
|
10505
10525
|
key: "createSVGIconElement",
|
10506
10526
|
value: function createSVGIconElement() {
|
10507
|
-
return
|
10527
|
+
return Y.createSVGElement(Lo);
|
10508
10528
|
}
|
10509
10529
|
}, {
|
10510
10530
|
key: "createButtonContainer",
|
@@ -10645,7 +10665,7 @@ var Lt = /*#__PURE__*/function (_Bt2) {
|
|
10645
10665
|
}, {
|
10646
10666
|
key: "createInnerElement",
|
10647
10667
|
value: function createInnerElement(e, t, i) {
|
10648
|
-
return
|
10668
|
+
return Z.createSpecificStateElement(this.elementRef, t, i) || e;
|
10649
10669
|
}
|
10650
10670
|
}, {
|
10651
10671
|
key: "changeToActive",
|
@@ -10692,7 +10712,7 @@ var Lt = /*#__PURE__*/function (_Bt2) {
|
|
10692
10712
|
}, {
|
10693
10713
|
key: "createSVGIconElement",
|
10694
10714
|
value: function createSVGIconElement() {
|
10695
|
-
var e =
|
10715
|
+
var e = Y.createSVGElement(Bo);
|
10696
10716
|
return e.id = "microphone-icon", e;
|
10697
10717
|
}
|
10698
10718
|
}]);
|
@@ -10817,11 +10837,11 @@ Object.defineProperty(Ti, "__esModule", {
|
|
10817
10837
|
value: !0
|
10818
10838
|
});
|
10819
10839
|
Ti.EventListeners = void 0;
|
10820
|
-
var
|
10821
|
-
function
|
10822
|
-
_classCallCheck(this,
|
10840
|
+
var ne = /*#__PURE__*/function () {
|
10841
|
+
function ne() {
|
10842
|
+
_classCallCheck(this, ne);
|
10823
10843
|
}
|
10824
|
-
return _createClass(
|
10844
|
+
return _createClass(ne, null, [{
|
10825
10845
|
key: "getElementIfFocusedOnAvailable",
|
10826
10846
|
value: function getElementIfFocusedOnAvailable(e, t) {
|
10827
10847
|
return Array.isArray(e) ? e.find(function (i) {
|
@@ -10832,14 +10852,14 @@ var ie = /*#__PURE__*/function () {
|
|
10832
10852
|
key: "keyDownWindow",
|
10833
10853
|
value: function keyDownWindow(e) {
|
10834
10854
|
var _this51 = this;
|
10835
|
-
e.element &&
|
10836
|
-
|
10855
|
+
e.element && ne.getElementIfFocusedOnAvailable(e.element, document.activeElement) && (ne.KEY_DOWN_TIMEOUT !== null && clearTimeout(ne.KEY_DOWN_TIMEOUT), ne.KEY_DOWN_TIMEOUT = setTimeout(function () {
|
10856
|
+
ne.KEY_DOWN_TIMEOUT = null, _this51.resetRecording(e);
|
10837
10857
|
}, 500));
|
10838
10858
|
}
|
10839
10859
|
}, {
|
10840
10860
|
key: "mouseDownWindow",
|
10841
10861
|
value: function mouseDownWindow(e, t) {
|
10842
|
-
this.mouseDownElement =
|
10862
|
+
this.mouseDownElement = ne.getElementIfFocusedOnAvailable(e, t.target);
|
10843
10863
|
}
|
10844
10864
|
}, {
|
10845
10865
|
key: "mouseUpWindow",
|
@@ -10850,7 +10870,7 @@ var ie = /*#__PURE__*/function () {
|
|
10850
10870
|
key: "add",
|
10851
10871
|
value: function add(e, t) {
|
10852
10872
|
var i = (t == null ? void 0 : t.insertInCursorLocation) === void 0 || (t == null ? void 0 : t.insertInCursorLocation);
|
10853
|
-
t != null && t.element && i && (e.mouseDownEvent =
|
10873
|
+
t != null && t.element && i && (e.mouseDownEvent = ne.mouseDownWindow.bind(e, t.element), document.addEventListener("mousedown", e.mouseDownEvent), e.mouseUpEvent = ne.mouseUpWindow.bind(e, t), document.addEventListener("mouseup", e.mouseUpEvent), e.keyDownEvent = ne.keyDownWindow.bind(e, t), document.addEventListener("keydown", e.keyDownEvent));
|
10854
10874
|
}
|
10855
10875
|
}, {
|
10856
10876
|
key: "remove",
|
@@ -10859,8 +10879,8 @@ var ie = /*#__PURE__*/function () {
|
|
10859
10879
|
}
|
10860
10880
|
}]);
|
10861
10881
|
}();
|
10862
|
-
Ti.EventListeners =
|
10863
|
-
|
10882
|
+
Ti.EventListeners = ne;
|
10883
|
+
ne.KEY_DOWN_TIMEOUT = null;
|
10864
10884
|
var Ci = {};
|
10865
10885
|
Object.defineProperty(Ci, "__esModule", {
|
10866
10886
|
value: !0
|
@@ -11070,11 +11090,11 @@ var Fn = qt,
|
|
11070
11090
|
Go = ft,
|
11071
11091
|
Bn = Ye,
|
11072
11092
|
jn = Xe;
|
11073
|
-
var
|
11074
|
-
function
|
11075
|
-
_classCallCheck(this,
|
11093
|
+
var te = /*#__PURE__*/function () {
|
11094
|
+
function te() {
|
11095
|
+
_classCallCheck(this, te);
|
11076
11096
|
}
|
11077
|
-
return _createClass(
|
11097
|
+
return _createClass(te, null, [{
|
11078
11098
|
key: "processCommand",
|
11079
11099
|
value: function processCommand(e, t) {
|
11080
11100
|
return (!t || !t.caseSensitive) && (e = e.toLowerCase()), (t == null ? void 0 : t.substrings) === !1 ? jn.Text.breakupIntoWordsArr(e) : e;
|
@@ -11085,7 +11105,7 @@ var ee = /*#__PURE__*/function () {
|
|
11085
11105
|
var t;
|
11086
11106
|
return ((t = e.settings) === null || t === void 0 ? void 0 : t.caseSensitive) === !0 ? e : Object.keys(e).reduce(function (n, r) {
|
11087
11107
|
var o = e[r];
|
11088
|
-
return n[r] = typeof o == "string" ?
|
11108
|
+
return n[r] = typeof o == "string" ? te.processCommand(o, e.settings) : o, n;
|
11089
11109
|
}, {});
|
11090
11110
|
}
|
11091
11111
|
}, {
|
@@ -11103,7 +11123,7 @@ var ee = /*#__PURE__*/function () {
|
|
11103
11123
|
}, {
|
11104
11124
|
key: "setText",
|
11105
11125
|
value: function setText(e, t, i, n) {
|
11106
|
-
|
11126
|
+
te.toggleCommandModeOff(e), Vo.Elements.isPrimitiveElement(n) ? (n.value = i, e.isTargetInShadow || Bn.Cursor.setOffsetForPrimitive(n, i.length, !0), Go.Browser.IS_SAFARI() && e.autoScroll && Fn.AutoScroll.scrollSafariPrimitiveToEnd(n)) : (n.textContent = i, e.isTargetInShadow || Bn.Cursor.focusEndOfGeneric(n), setTimeout(function () {
|
11107
11127
|
return Fn.AutoScroll.scrollGeneric(e, n);
|
11108
11128
|
})), e.resetRecording(t);
|
11109
11129
|
}
|
@@ -11133,38 +11153,38 @@ var ee = /*#__PURE__*/function () {
|
|
11133
11153
|
if (!c || !n || !i) return;
|
11134
11154
|
var d = ((o = c.settings) === null || o === void 0 ? void 0 : o.caseSensitive) === !0 ? t : t.toLowerCase(),
|
11135
11155
|
h = jn.Text.breakupIntoWordsArr(d),
|
11136
|
-
u = ((a = c.settings) === null || a === void 0 ? void 0 : a.substrings) === !1 ?
|
11156
|
+
u = ((a = c.settings) === null || a === void 0 ? void 0 : a.substrings) === !1 ? te.checkIfMatchesWord : te.checkIfMatchesSubstring;
|
11137
11157
|
if (c.commandMode && u(c.commandMode, d, h)) return e.setInterimColorToFinal(), setTimeout(function () {
|
11138
|
-
return
|
11158
|
+
return te.toggleCommandModeOn(e);
|
11139
11159
|
}), {
|
11140
11160
|
doNotProcessTranscription: !1
|
11141
11161
|
};
|
11142
11162
|
if (!(c.commandMode && !e.isWaitingForCommand)) {
|
11143
|
-
if (c.stop && u(c.stop, d, h)) return
|
11163
|
+
if (c.stop && u(c.stop, d, h)) return te.toggleCommandModeOff(e), setTimeout(function () {
|
11144
11164
|
return e.stop();
|
11145
11165
|
}), {
|
11146
11166
|
doNotProcessTranscription: !1
|
11147
11167
|
};
|
11148
|
-
if (c.pause && u(c.pause, d, h)) return
|
11168
|
+
if (c.pause && u(c.pause, d, h)) return te.toggleCommandModeOff(e), e.setInterimColorToFinal(), setTimeout(function () {
|
11149
11169
|
var f;
|
11150
11170
|
e.isPaused = !0, (f = e.onPauseTrigger) === null || f === void 0 || f.call(e, !0);
|
11151
11171
|
}), {
|
11152
11172
|
doNotProcessTranscription: !1
|
11153
11173
|
};
|
11154
|
-
if (c.resume && u(c.resume, d, h)) return e.isPaused = !1, (l = e.onPauseTrigger) === null || l === void 0 || l.call(e, !1),
|
11174
|
+
if (c.resume && u(c.resume, d, h)) return e.isPaused = !1, (l = e.onPauseTrigger) === null || l === void 0 || l.call(e, !1), te.toggleCommandModeOff(e), e.resetRecording(i), {
|
11155
11175
|
doNotProcessTranscription: !0
|
11156
11176
|
};
|
11157
|
-
if (c.reset && u(c.reset, d, h)) return r !== void 0 &&
|
11177
|
+
if (c.reset && u(c.reset, d, h)) return r !== void 0 && te.setText(e, i, r, n), {
|
11158
11178
|
doNotProcessTranscription: !0
|
11159
11179
|
};
|
11160
|
-
if (c.removeAllText && u(c.removeAllText, d, h)) return
|
11180
|
+
if (c.removeAllText && u(c.removeAllText, d, h)) return te.setText(e, i, "", n), {
|
11161
11181
|
doNotProcessTranscription: !0
|
11162
11182
|
};
|
11163
11183
|
}
|
11164
11184
|
}
|
11165
11185
|
}]);
|
11166
11186
|
}();
|
11167
|
-
Ht.CommandUtils =
|
11187
|
+
Ht.CommandUtils = te;
|
11168
11188
|
var ki = {};
|
11169
11189
|
Object.defineProperty(ki, "__esModule", {
|
11170
11190
|
value: !0
|
@@ -11296,7 +11316,7 @@ var Hn = Ti,
|
|
11296
11316
|
qn = Ht,
|
11297
11317
|
$t = qt,
|
11298
11318
|
Ui = ki,
|
11299
|
-
|
11319
|
+
fe = Ze,
|
11300
11320
|
Hi = Ai,
|
11301
11321
|
zn = ft,
|
11302
11322
|
Vn = Ye,
|
@@ -11304,7 +11324,7 @@ var Hn = Ti,
|
|
11304
11324
|
var Jo = /*#__PURE__*/function () {
|
11305
11325
|
function Jo() {
|
11306
11326
|
_classCallCheck(this, Jo);
|
11307
|
-
this.finalTranscript = "", this.interimSpan =
|
11327
|
+
this.finalTranscript = "", this.interimSpan = fe.Elements.createInterimSpan(), this.finalSpan = fe.Elements.createGenericSpan(), this.scrollingSpan = fe.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();
|
11308
11328
|
}
|
11309
11329
|
return _createClass(Jo, [{
|
11310
11330
|
key: "prepareBeforeStart",
|
@@ -11317,12 +11337,12 @@ var Jo = /*#__PURE__*/function () {
|
|
11317
11337
|
if (!r) return;
|
11318
11338
|
this.prepare(r);
|
11319
11339
|
} else this.prepare(e.element);
|
11320
|
-
(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"],
|
11340
|
+
(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"], fe.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 = qn.CommandUtils.process(this._options.commands));
|
11321
11341
|
}
|
11322
11342
|
}, {
|
11323
11343
|
key: "prepare",
|
11324
11344
|
value: function prepare(e) {
|
11325
|
-
Hi.Padding.setState(this, e), Ui.Highlight.setState(this, e), this.isTargetInShadow =
|
11345
|
+
Hi.Padding.setState(this, e), Ui.Highlight.setState(this, e), this.isTargetInShadow = fe.Elements.isInsideShadowDOM(e), fe.Elements.isPrimitiveElement(e) ? (this._primitiveElement = e, this._originalText = this._primitiveElement.value) : (this._genericElement = e, this._originalText = this._genericElement.textContent);
|
11326
11346
|
}
|
11327
11347
|
// there was an attempt to optimize this by not having to restart the service and just reset state:
|
11328
11348
|
// unfortunately it did not work because the service would still continue firing the intermediate and final results
|
@@ -11366,7 +11386,7 @@ var Jo = /*#__PURE__*/function () {
|
|
11366
11386
|
}, {
|
11367
11387
|
key: "updateGenericElement",
|
11368
11388
|
value: function updateGenericElement(e, t, i) {
|
11369
|
-
this.isHighlighted && Ui.Highlight.removeForGeneric(this, e), this.spansPopulated ||
|
11389
|
+
this.isHighlighted && Ui.Highlight.removeForGeneric(this, e), this.spansPopulated || fe.Elements.appendSpans(this, e);
|
11370
11390
|
var n = (i ? "" : this.startPadding) + qi.Text.lineBreak(this.finalTranscript);
|
11371
11391
|
this.finalSpan.innerHTML = n;
|
11372
11392
|
var r = $t.AutoScroll.isRequired(this.autoScroll, e);
|
@@ -11377,7 +11397,7 @@ var Jo = /*#__PURE__*/function () {
|
|
11377
11397
|
}, {
|
11378
11398
|
key: "finalise",
|
11379
11399
|
value: function finalise(e) {
|
11380
|
-
this._genericElement && (e ? (this.finalSpan =
|
11400
|
+
this._genericElement && (e ? (this.finalSpan = fe.Elements.createGenericSpan(), this.setInterimColorToFinal(), this.interimSpan = fe.Elements.createInterimSpan(), this.scrollingSpan = fe.Elements.createGenericSpan()) : this._genericElement.textContent = this._genericElement.textContent, this.spansPopulated = !1), Hn.EventListeners.remove(this);
|
11381
11401
|
}
|
11382
11402
|
}, {
|
11383
11403
|
key: "setInterimColorToFinal",
|
@@ -11841,7 +11861,7 @@ Object.defineProperty(cs, "__esModule", {
|
|
11841
11861
|
});
|
11842
11862
|
var Xn = Si,
|
11843
11863
|
ta = Ht,
|
11844
|
-
|
11864
|
+
oe = Mi,
|
11845
11865
|
ia = Ri;
|
11846
11866
|
var tt = /*#__PURE__*/function () {
|
11847
11867
|
function tt() {
|
@@ -11852,12 +11872,12 @@ var tt = /*#__PURE__*/function () {
|
|
11852
11872
|
value: function toggle(e, t) {
|
11853
11873
|
var i, n;
|
11854
11874
|
var r = e.toLocaleLowerCase().trim();
|
11855
|
-
!((i =
|
11875
|
+
!((i = oe.GlobalState.service) === null || i === void 0) && i.recognizing ? this.stop() : r === "webspeech" ? tt.startWebSpeech(t) : r === "azure" ? tt.startAzure(t) : (console.error("service not found - must be either 'webspeech' or 'azure'"), (n = t == null ? void 0 : t.onError) === null || n === void 0 || n.call(t, "service not found - must be either 'webspeech' or 'azure'"));
|
11856
11876
|
}
|
11857
11877
|
}, {
|
11858
11878
|
key: "startWebSpeech",
|
11859
11879
|
value: function startWebSpeech(e) {
|
11860
|
-
tt.stop() || (
|
11880
|
+
tt.stop() || (oe.GlobalState.service = new Xn.WebSpeech(), oe.GlobalState.service.start(e));
|
11861
11881
|
}
|
11862
11882
|
}, {
|
11863
11883
|
key: "isWebSpeechSupported",
|
@@ -11868,18 +11888,18 @@ var tt = /*#__PURE__*/function () {
|
|
11868
11888
|
key: "startAzure",
|
11869
11889
|
value: function startAzure(e) {
|
11870
11890
|
var t;
|
11871
|
-
tt.stop() || !((t =
|
11891
|
+
tt.stop() || !((t = oe.GlobalState.service) === null || t === void 0) && t.cannotBeStopped || (oe.GlobalState.service = new ia.Azure(), oe.GlobalState.service.start(e));
|
11872
11892
|
}
|
11873
11893
|
}, {
|
11874
11894
|
key: "stop",
|
11875
11895
|
value: function stop() {
|
11876
11896
|
var e;
|
11877
|
-
return
|
11897
|
+
return oe.GlobalState.doubleClickDetector() ? !0 : (!((e = oe.GlobalState.service) === null || e === void 0) && e.recognizing && oe.GlobalState.service.stop(), !1);
|
11878
11898
|
}
|
11879
11899
|
}, {
|
11880
11900
|
key: "endCommandMode",
|
11881
11901
|
value: function endCommandMode() {
|
11882
|
-
|
11902
|
+
oe.GlobalState.service && ta.CommandUtils.toggleCommandModeOff(oe.GlobalState.service);
|
11883
11903
|
}
|
11884
11904
|
}]);
|
11885
11905
|
}();
|
@@ -11919,14 +11939,14 @@ var Tt = /*#__PURE__*/function (_Lt) {
|
|
11919
11939
|
function Tt(e, t, i) {
|
11920
11940
|
var _this56;
|
11921
11941
|
_classCallCheck(this, Tt);
|
11922
|
-
var
|
11923
|
-
_this56 = _callSuper(this, Tt, [
|
11942
|
+
var n = _typeof(e.speechToText) == "object" ? e.speechToText : {};
|
11943
|
+
_this56 = _callSuper(this, Tt, [n == null ? void 0 : n.button]);
|
11924
11944
|
var _this56$processConfig = _this56.processConfiguration(t, e.speechToText),
|
11925
|
-
|
11926
|
-
|
11927
|
-
if (_this56._addErrorMessage = i,
|
11945
|
+
r = _this56$processConfig.serviceName,
|
11946
|
+
o = _this56$processConfig.processedConfig;
|
11947
|
+
if (_this56._addErrorMessage = i, r === "webspeech" && !Kt.isWebSpeechSupported()) _this56.changeToUnsupported();else {
|
11928
11948
|
var a = !e.textInput || !e.textInput.disabled;
|
11929
|
-
_this56.elementRef.onclick = _this56.buttonClick.bind(_this56, t, a,
|
11949
|
+
_this56.elementRef.onclick = _this56.buttonClick.bind(_this56, t, a, r, o);
|
11930
11950
|
}
|
11931
11951
|
setTimeout(function () {
|
11932
11952
|
_this56._validationHandler = e._validationHandler;
|
@@ -11967,27 +11987,38 @@ var Tt = /*#__PURE__*/function (_Lt) {
|
|
11967
11987
|
key: "buttonClick",
|
11968
11988
|
value: function buttonClick(e, t, i, n) {
|
11969
11989
|
var _this57 = this;
|
11990
|
+
var r = n == null ? void 0 : n.speechEvents;
|
11970
11991
|
e.removeTextIfPlaceholder(), Kt.toggle(i, _objectSpread({
|
11971
11992
|
insertInCursorLocation: !1,
|
11972
11993
|
element: t ? e.inputElementRef : void 0,
|
11973
11994
|
onError: function onError() {
|
11974
|
-
var
|
11975
|
-
_this57.onError(), (
|
11976
|
-
},
|
11977
|
-
onStart: this.changeToActive.bind(this),
|
11978
|
-
onStop: function onStop() {
|
11979
|
-
var r, o;
|
11980
|
-
(r = _this57._validationHandler) == null || r.call(_this57), (o = _this57._silenceSubmit) == null || o.clearSilenceTimeout(), _this57.changeToDefault();
|
11995
|
+
var o;
|
11996
|
+
_this57.onError(), (o = _this57._silenceSubmit) == null || o.clearSilenceTimeout();
|
11981
11997
|
},
|
11982
|
-
|
11998
|
+
onStart: function onStart() {
|
11983
11999
|
var o;
|
11984
|
-
(o =
|
12000
|
+
_this57.changeToActive(), (o = r == null ? void 0 : r.onStart) == null || o.call(r);
|
12001
|
+
},
|
12002
|
+
onStop: function onStop() {
|
12003
|
+
var o, a, l;
|
12004
|
+
(o = _this57._validationHandler) == null || o.call(_this57), (a = _this57._silenceSubmit) == null || a.clearSilenceTimeout(), _this57.changeToDefault(), (l = r == null ? void 0 : r.onStop) == null || l.call(r);
|
11985
12005
|
},
|
11986
|
-
|
12006
|
+
onPauseTrigger: function onPauseTrigger(o) {
|
11987
12007
|
var a, l;
|
11988
|
-
|
12008
|
+
(a = _this57._silenceSubmit) == null || a.onPause(o, e, _this57.elementRef.onclick), (l = r == null ? void 0 : r.onPauseTrigger) == null || l.call(r, o);
|
12009
|
+
},
|
12010
|
+
onPreResult: function onPreResult(o, a) {
|
12011
|
+
var l;
|
12012
|
+
(l = r == null ? void 0 : r.onPreResult) == null || l.call(r, o, a);
|
12013
|
+
},
|
12014
|
+
onResult: function onResult(o, a) {
|
12015
|
+
var l, c, d;
|
12016
|
+
a && ((l = _this57._validationHandler) == null || l.call(_this57)), (c = _this57._silenceSubmit) == null || c.resetSilenceTimeout(e, _this57.elementRef.onclick), (d = r == null ? void 0 : r.onResult) == null || d.call(r, o, a);
|
11989
12017
|
},
|
11990
|
-
onCommandModeTrigger:
|
12018
|
+
onCommandModeTrigger: function onCommandModeTrigger(o) {
|
12019
|
+
var a;
|
12020
|
+
_this57.onCommandModeTrigger(o), (a = r == null ? void 0 : r.onCommandModeTrigger) == null || a.call(r, o);
|
12021
|
+
}
|
11991
12022
|
}, n));
|
11992
12023
|
}
|
11993
12024
|
}, {
|
@@ -12017,40 +12048,40 @@ var Tt = /*#__PURE__*/function (_Lt) {
|
|
12017
12048
|
}(Lt);
|
12018
12049
|
Tt.MICROPHONE_RESET_TIMEOUT_MS = 300;
|
12019
12050
|
var Ot = Tt;
|
12020
|
-
var
|
12051
|
+
var _e = /*#__PURE__*/function () {
|
12021
12052
|
// prettier-ignore
|
12022
|
-
function
|
12053
|
+
function _e(e, t, i, n) {
|
12023
12054
|
var _this58 = this;
|
12024
|
-
_classCallCheck(this,
|
12055
|
+
_classCallCheck(this, _e);
|
12025
12056
|
this._attachments = [], this._fileCountLimit = 99, this._acceptedFormat = "", t.maxNumberOfFiles && (this._fileCountLimit = t.maxNumberOfFiles), this._toggleContainerDisplay = i, this._fileAttachmentsContainerRef = n, t.acceptedFormats && (this._acceptedFormat = t.acceptedFormats), setTimeout(function () {
|
12026
12057
|
_this58._validationHandler = e._validationHandler;
|
12027
12058
|
});
|
12028
12059
|
}
|
12029
|
-
return _createClass(
|
12060
|
+
return _createClass(_e, [{
|
12030
12061
|
key: "attemptAddFile",
|
12031
12062
|
value: function attemptAddFile(e, t) {
|
12032
|
-
return
|
12063
|
+
return _e.isFileTypeValid(e, this._acceptedFormat) ? (this.addAttachmentBasedOnType(e, t, !0), !0) : !1;
|
12033
12064
|
}
|
12034
12065
|
}, {
|
12035
12066
|
key: "addAttachmentBasedOnType",
|
12036
12067
|
value: function addAttachmentBasedOnType(e, t, i) {
|
12037
|
-
var n =
|
12068
|
+
var n = _e.getTypeFromBlob(e);
|
12038
12069
|
if (n === "image") {
|
12039
|
-
var r =
|
12070
|
+
var r = _e.createImageAttachment(t);
|
12040
12071
|
this.addFileAttachment(e, "image", r, i);
|
12041
12072
|
} else if (n === "audio") {
|
12042
|
-
var
|
12043
|
-
this.addFileAttachment(e, "audio",
|
12073
|
+
var _r3 = Nt.createAudioAttachment(t);
|
12074
|
+
this.addFileAttachment(e, "audio", _r3, i);
|
12044
12075
|
} else {
|
12045
|
-
var
|
12046
|
-
this.addFileAttachment(e, "any",
|
12076
|
+
var _r4 = _e.createAnyFileAttachment(e.name);
|
12077
|
+
this.addFileAttachment(e, "any", _r4, i);
|
12047
12078
|
}
|
12048
12079
|
}
|
12049
12080
|
}, {
|
12050
12081
|
key: "addFileAttachment",
|
12051
12082
|
value: function addFileAttachment(e, t, i, n) {
|
12052
12083
|
var a;
|
12053
|
-
var r =
|
12084
|
+
var r = _e.createContainer(i);
|
12054
12085
|
if (this._attachments.length >= this._fileCountLimit) {
|
12055
12086
|
var l = this._attachments[this._attachments.length - 1].removeButton;
|
12056
12087
|
l == null || l.click();
|
@@ -12152,19 +12183,19 @@ var Ee = /*#__PURE__*/function () {
|
|
12152
12183
|
}();
|
12153
12184
|
var sa = "<?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>",
|
12154
12185
|
Zn = "<?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>",
|
12155
|
-
|
12186
|
+
ye = /*#__PURE__*/function (_e2) {
|
12156
12187
|
// prettier-ignore
|
12157
|
-
function
|
12158
|
-
_classCallCheck(this,
|
12159
|
-
return _callSuper(this,
|
12188
|
+
function ye(e, t, i, n) {
|
12189
|
+
_classCallCheck(this, ye);
|
12190
|
+
return _callSuper(this, ye, [e, t, i, n]);
|
12160
12191
|
}
|
12161
|
-
_inherits(
|
12162
|
-
return _createClass(
|
12192
|
+
_inherits(ye, _e2);
|
12193
|
+
return _createClass(ye, [{
|
12163
12194
|
key: "createTimer",
|
12164
12195
|
value: function createTimer(e, t) {
|
12165
12196
|
var _this59 = this;
|
12166
12197
|
var i = 0;
|
12167
|
-
var n = t !== void 0 && t <
|
12198
|
+
var n = t !== void 0 && t < ye.TIMER_LIMIT_S ? t : ye.TIMER_LIMIT_S;
|
12168
12199
|
return setInterval(function () {
|
12169
12200
|
var a;
|
12170
12201
|
i += 1, i === n && ((a = _this59.stopPlaceholderCallback) == null || a.call(_this59), _this59.clearTimer()), i === 600 && e.classList.add("audio-placeholder-text-4-digits");
|
@@ -12176,12 +12207,12 @@ var sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12176
12207
|
}, {
|
12177
12208
|
key: "createPlaceholderAudioAttachment",
|
12178
12209
|
value: function createPlaceholderAudioAttachment(e) {
|
12179
|
-
var t =
|
12210
|
+
var t = ye.createAudioContainer(),
|
12180
12211
|
i = document.createElement("div");
|
12181
12212
|
i.classList.add("audio-placeholder-text-3-digits");
|
12182
12213
|
var n = document.createElement("div");
|
12183
12214
|
n.classList.add("file-attachment-text-container", "audio-placeholder-text-3-digits-container"), n.appendChild(i);
|
12184
|
-
var r =
|
12215
|
+
var r = Y.createSVGElement(Zn);
|
12185
12216
|
return r.classList.add("attachment-icon", "stop-icon", "not-removable-attachment-icon"), i.textContent = "0:00", this._activePlaceholderTimer = this.createTimer(i, e), t.appendChild(n), this.addPlaceholderAudioAttachmentEvents(t, r, n), t;
|
12186
12217
|
}
|
12187
12218
|
}, {
|
@@ -12213,7 +12244,7 @@ var sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12213
12244
|
key: "completePlaceholderAttachment",
|
12214
12245
|
value: function completePlaceholderAttachment(e, t) {
|
12215
12246
|
var i = this._activePlaceholderAttachment;
|
12216
|
-
i && (i.file = e,
|
12247
|
+
i && (i.file = e, ye.addAudioElements(i.attachmentContainerElement.children[0], t), i.removeButton = this.createRemoveAttachmentButton(i), i.attachmentContainerElement.appendChild(i.removeButton), this._activePlaceholderAttachment = void 0, this.clearTimer());
|
12217
12248
|
}
|
12218
12249
|
}, {
|
12219
12250
|
key: "removePlaceholderAttachment",
|
@@ -12237,9 +12268,9 @@ var sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12237
12268
|
var i = e.parentElement ? U.cloneElement(e) : e,
|
12238
12269
|
n = document.createElement("audio");
|
12239
12270
|
n.src = t;
|
12240
|
-
var r =
|
12271
|
+
var r = Y.createSVGElement(sa);
|
12241
12272
|
r.classList.add("attachment-icon", "play-icon");
|
12242
|
-
var o =
|
12273
|
+
var o = Y.createSVGElement(Zn);
|
12243
12274
|
o.classList.add("attachment-icon", "stop-icon"), i.replaceChildren(r), n.onplay = function () {
|
12244
12275
|
i.replaceChildren(o);
|
12245
12276
|
}, n.onpause = function () {
|
@@ -12253,8 +12284,8 @@ var sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12253
12284
|
}, {
|
12254
12285
|
key: "createAudioAttachment",
|
12255
12286
|
value: function createAudioAttachment(e) {
|
12256
|
-
var t =
|
12257
|
-
return
|
12287
|
+
var t = ye.createAudioContainer();
|
12288
|
+
return ye.addAudioElements(t, e), t;
|
12258
12289
|
}
|
12259
12290
|
}, {
|
12260
12291
|
key: "stopAttachmentPlayback",
|
@@ -12263,9 +12294,9 @@ var sa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
12263
12294
|
(n = (i = (t = e.children[0]) == null ? void 0 : t.children) == null ? void 0 : i[0]) != null && n.classList.contains("stop-icon") && e.children[0].click();
|
12264
12295
|
}
|
12265
12296
|
}]);
|
12266
|
-
}(
|
12267
|
-
|
12268
|
-
var Nt =
|
12297
|
+
}(_e);
|
12298
|
+
ye.TIMER_LIMIT_S = 5999;
|
12299
|
+
var Nt = ye;
|
12269
12300
|
var ra = /*#__PURE__*/function () {
|
12270
12301
|
function ra() {
|
12271
12302
|
_classCallCheck(this, ra);
|
@@ -12275,7 +12306,7 @@ var ra = /*#__PURE__*/function () {
|
|
12275
12306
|
value:
|
12276
12307
|
// prettier-ignore
|
12277
12308
|
function create(e, t, i, n, r) {
|
12278
|
-
return r === "audio" ? new Nt(e, t, i, n) : new
|
12309
|
+
return r === "audio" ? new Nt(e, t, i, n) : new _e(e, t, i, n);
|
12279
12310
|
}
|
12280
12311
|
}]);
|
12281
12312
|
}();
|
@@ -12377,12 +12408,12 @@ var zt = /*#__PURE__*/function () {
|
|
12377
12408
|
}
|
12378
12409
|
}]);
|
12379
12410
|
}();
|
12380
|
-
var
|
12381
|
-
function
|
12382
|
-
_classCallCheck(this,
|
12383
|
-
this._isOpen = !1, this._contentRef =
|
12411
|
+
var de = /*#__PURE__*/function () {
|
12412
|
+
function de(e, t, i) {
|
12413
|
+
_classCallCheck(this, de);
|
12414
|
+
this._isOpen = !1, this._contentRef = de.createModalContent(t, i == null ? void 0 : i.backgroundColor), this._buttonPanel = de.createButtonPanel(i == null ? void 0 : i.backgroundColor), this._elementRef = de.createContainer(this._contentRef, i), this._elementRef.appendChild(this._buttonPanel), e.appendChild(this._elementRef), this._backgroundPanelRef = de.createDarkBackgroundPanel(), e.appendChild(this._backgroundPanelRef), this.addWindowEvents(e);
|
12384
12415
|
}
|
12385
|
-
return _createClass(
|
12416
|
+
return _createClass(de, [{
|
12386
12417
|
key: "isOpen",
|
12387
12418
|
value: function isOpen() {
|
12388
12419
|
return this._isOpen;
|
@@ -12404,7 +12435,7 @@ var ce = /*#__PURE__*/function () {
|
|
12404
12435
|
var _this62 = this;
|
12405
12436
|
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 () {
|
12406
12437
|
_this62._elementRef.style.display = "none", _this62._backgroundPanelRef.style.display = "none";
|
12407
|
-
},
|
12438
|
+
}, de.MODAL_CLOSE_TIMEOUT_MS);
|
12408
12439
|
}
|
12409
12440
|
}, {
|
12410
12441
|
key: "displayModalElements",
|
@@ -12420,7 +12451,7 @@ var ce = /*#__PURE__*/function () {
|
|
12420
12451
|
key: "addCloseButton",
|
12421
12452
|
value: function addCloseButton(e, t, i) {
|
12422
12453
|
var _this63 = this;
|
12423
|
-
var n = t ?
|
12454
|
+
var n = t ? de.createSVGButton(e) : de.createTextButton(e);
|
12424
12455
|
return this.addButtons(n), n.onclick = function () {
|
12425
12456
|
_this63.close(), setTimeout(function () {
|
12426
12457
|
i == null || i();
|
@@ -12474,7 +12505,7 @@ var ce = /*#__PURE__*/function () {
|
|
12474
12505
|
value: function createSVGButton(e) {
|
12475
12506
|
var t = document.createElement("div");
|
12476
12507
|
t.classList.add("modal-button", "modal-svg-button");
|
12477
|
-
var i =
|
12508
|
+
var i = Y.createSVGElement(e);
|
12478
12509
|
return i.classList.add("modal-svg-button-icon"), t.appendChild(i), t;
|
12479
12510
|
}
|
12480
12511
|
}, {
|
@@ -12482,14 +12513,14 @@ var ce = /*#__PURE__*/function () {
|
|
12482
12513
|
value: function createTextModalFunc(e, t, i) {
|
12483
12514
|
var n;
|
12484
12515
|
if (_typeof(t) == "object" && (n = t.files) != null && n.infoModal) {
|
12485
|
-
var r = new
|
12516
|
+
var r = new de(e, ["modal-content"], t.files.infoModal.containerStyle);
|
12486
12517
|
return r.addCloseButton("OK", !1, i), r.openTextModal.bind(r, t.infoModalTextMarkUp || "");
|
12487
12518
|
}
|
12488
12519
|
}
|
12489
12520
|
}]);
|
12490
12521
|
}();
|
12491
|
-
|
12492
|
-
var ze =
|
12522
|
+
de.MODAL_CLOSE_TIMEOUT_MS = 190;
|
12523
|
+
var ze = de;
|
12493
12524
|
var Et = /*#__PURE__*/function (_Bt3) {
|
12494
12525
|
// prettier-ignore
|
12495
12526
|
function Et(e, t, i, n, r, o) {
|
@@ -12523,7 +12554,7 @@ var Et = /*#__PURE__*/function (_Bt3) {
|
|
12523
12554
|
}, {
|
12524
12555
|
key: "createInnerElement",
|
12525
12556
|
value: function createInnerElement(e, t, i) {
|
12526
|
-
return
|
12557
|
+
return Z.createSpecificStateElement(this.elementRef, t, i) || e;
|
12527
12558
|
}
|
12528
12559
|
}, {
|
12529
12560
|
key: "addClickEvent",
|
@@ -12552,20 +12583,20 @@ var Et = /*#__PURE__*/function (_Bt3) {
|
|
12552
12583
|
}, {
|
12553
12584
|
key: "createSVGIconElement",
|
12554
12585
|
value: function createSVGIconElement(e, t) {
|
12555
|
-
var i =
|
12586
|
+
var i = Y.createSVGElement(t);
|
12556
12587
|
return i.id = e, i;
|
12557
12588
|
}
|
12558
12589
|
}]);
|
12559
12590
|
}(Bt);
|
12560
|
-
var
|
12561
|
-
function
|
12562
|
-
_classCallCheck(this,
|
12591
|
+
var xe = /*#__PURE__*/function () {
|
12592
|
+
function xe() {
|
12593
|
+
_classCallCheck(this, xe);
|
12563
12594
|
}
|
12564
|
-
return _createClass(
|
12595
|
+
return _createClass(xe, null, [{
|
12565
12596
|
key: "create",
|
12566
12597
|
value: function create(e, t, i) {
|
12567
|
-
var n =
|
12568
|
-
|
12598
|
+
var n = xe.createElement(i);
|
12599
|
+
xe.addEvents(n, e, t), e.appendChild(n);
|
12569
12600
|
}
|
12570
12601
|
}, {
|
12571
12602
|
key: "createElement",
|
@@ -12577,13 +12608,13 @@ var ye = /*#__PURE__*/function () {
|
|
12577
12608
|
key: "addEvents",
|
12578
12609
|
value: function addEvents(e, t, i) {
|
12579
12610
|
t.ondragenter = function (n) {
|
12580
|
-
n.preventDefault(),
|
12611
|
+
n.preventDefault(), xe.display(e);
|
12581
12612
|
}, e.ondragleave = function (n) {
|
12582
|
-
n.preventDefault(),
|
12613
|
+
n.preventDefault(), xe.hide(e);
|
12583
12614
|
}, e.ondragover = function (n) {
|
12584
12615
|
n.preventDefault();
|
12585
12616
|
}, e.ondrop = function (n) {
|
12586
|
-
n.preventDefault(),
|
12617
|
+
n.preventDefault(), xe.uploadFile(i, n), xe.hide(e);
|
12587
12618
|
};
|
12588
12619
|
}
|
12589
12620
|
}, {
|
@@ -12682,7 +12713,7 @@ var Fe = /*#__PURE__*/function () {
|
|
12682
12713
|
}, {
|
12683
12714
|
key: "attach",
|
12684
12715
|
value: function attach(e, t, i, n, r) {
|
12685
|
-
var o = e.validateInput ||
|
12716
|
+
var o = e.validateInput || ue.processValidateInput(e);
|
12686
12717
|
e._validationHandler = /*#__PURE__*/function () {
|
12687
12718
|
var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee117(a) {
|
12688
12719
|
var l;
|
@@ -12890,21 +12921,21 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12890
12921
|
key: "createCustomElements",
|
12891
12922
|
value: function createCustomElements() {
|
12892
12923
|
var _this70 = this;
|
12893
|
-
var e =
|
12924
|
+
var e = Z.createSpecificStateElement(this.elementRef, "submit", this._customStyles),
|
12894
12925
|
t = {
|
12895
12926
|
loading: void 0,
|
12896
12927
|
stop: void 0
|
12897
12928
|
};
|
12898
12929
|
return Object.keys(t).forEach(function (i) {
|
12899
12930
|
var n = i,
|
12900
|
-
r =
|
12931
|
+
r = Z.createCustomElement(n, _this70._customStyles);
|
12901
12932
|
r && (t[n] = r);
|
12902
12933
|
}), t.submit = e, t;
|
12903
12934
|
}
|
12904
12935
|
}, {
|
12905
12936
|
key: "createDisabledIconElement",
|
12906
12937
|
value: function createDisabledIconElement(e) {
|
12907
|
-
return
|
12938
|
+
return Z.createCustomElement("disabled", this._customStyles) || e.cloneNode(!0);
|
12908
12939
|
}
|
12909
12940
|
// prettier-ignore
|
12910
12941
|
}, {
|
@@ -12982,14 +13013,14 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
12982
13013
|
return _regeneratorRuntime().wrap(function _callee119$(_context119) {
|
12983
13014
|
while (1) switch (_context119.prev = _context119.next) {
|
12984
13015
|
case 0:
|
12985
|
-
typeof e == "string" && (e =
|
13016
|
+
typeof e == "string" && (e = ue.processSubmitUserMessage(e));
|
12986
13017
|
t = {
|
12987
13018
|
text: e.text
|
12988
13019
|
};
|
12989
13020
|
e.files && (t.files = Array.from(e.files).map(function (i) {
|
12990
13021
|
return {
|
12991
13022
|
file: i,
|
12992
|
-
type:
|
13023
|
+
type: _e.getTypeFromBlob(i)
|
12993
13024
|
};
|
12994
13025
|
})), setTimeout(function () {
|
12995
13026
|
return _this71.attemptSubmit(t, !0);
|
@@ -13142,7 +13173,7 @@ var k = /*#__PURE__*/function (_Bt4) {
|
|
13142
13173
|
}, {
|
13143
13174
|
key: "createSubmitIconElement",
|
13144
13175
|
value: function createSubmitIconElement() {
|
13145
|
-
var e =
|
13176
|
+
var e = Y.createSVGElement(aa);
|
13146
13177
|
return e.id = "submit-icon", e;
|
13147
13178
|
}
|
13148
13179
|
}, {
|
@@ -13174,7 +13205,7 @@ var bn = /*#__PURE__*/function (_ze) {
|
|
13174
13205
|
var _this73$addButtonsAnd = _this73.addButtonsAndTheirEvents(t),
|
13175
13206
|
r = _this73$addButtonsAnd.captureButton,
|
13176
13207
|
o = _this73$addButtonsAnd.submitButton;
|
13177
|
-
_this73._captureButton = r, _this73._submitButton = o, _this73._captureIcon = _this73._captureButton.children[0], _this73._refreshIcon =
|
13208
|
+
_this73._captureButton = r, _this73._submitButton = o, _this73._captureIcon = _this73._captureButton.children[0], _this73._refreshIcon = Y.createSVGElement(la), _this73._refreshIcon.classList.add("modal-svg-button-icon", "modal-svg-refresh-icon"), (n == null ? void 0 : n.format) === "jpeg" && (_this73._format = "image/jpeg"), n != null && n.dimensions && (_this73._dimensions = n.dimensions), _this73._contentRef.appendChild(_this73._canvas), _this73.extensionCloseCallback = _this73.stop;
|
13178
13209
|
return _this73;
|
13179
13210
|
}
|
13180
13211
|
_inherits(bn, _ze);
|
@@ -13301,7 +13332,7 @@ var mi = /*#__PURE__*/function (_Bt5) {
|
|
13301
13332
|
}, {
|
13302
13333
|
key: "createInnerElement",
|
13303
13334
|
value: function createInnerElement(e, t, i) {
|
13304
|
-
return
|
13335
|
+
return Z.createSpecificStateElement(this.elementRef, t, i) || e;
|
13305
13336
|
}
|
13306
13337
|
}, {
|
13307
13338
|
key: "addClickEvent",
|
@@ -13320,7 +13351,7 @@ var mi = /*#__PURE__*/function (_Bt5) {
|
|
13320
13351
|
}, {
|
13321
13352
|
key: "createSVGIconElement",
|
13322
13353
|
value: function createSVGIconElement() {
|
13323
|
-
var e =
|
13354
|
+
var e = Y.createSVGElement(ua);
|
13324
13355
|
return e.id = "camera-icon", e;
|
13325
13356
|
}
|
13326
13357
|
}]);
|
@@ -13359,7 +13390,7 @@ var _t = /*#__PURE__*/function () {
|
|
13359
13390
|
button: new oa(_d, t.recordAudio)
|
13360
13391
|
};
|
13361
13392
|
}
|
13362
|
-
return
|
13393
|
+
return xe.isEnabled(r, e.dragAndDrop) && xe.create(i, r, e.dragAndDrop), r;
|
13363
13394
|
}
|
13364
13395
|
// prettier-ignore
|
13365
13396
|
}], [{
|
@@ -13458,7 +13489,7 @@ var y = /*#__PURE__*/function (_Xi) {
|
|
13458
13489
|
key: "onRender",
|
13459
13490
|
value: function onRender() {
|
13460
13491
|
var _this$_childElement;
|
13461
|
-
Xt.attemptAppendStyleSheetToHead(this.style),
|
13492
|
+
Xt.attemptAppendStyleSheetToHead(this.style), ue.processConnect(this), (!this._activeService || this._activeService.demo) && (this._activeService = Mo.create(this)), this.auxiliaryStyle && !this._auxiliaryStyleApplied && (bt.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), bt.applyDefaultStyleToComponent(this.style, this.chatStyle), ue.checkForContainerStyles(this, this._elementRef), this._activeService.key && this._activeService.validateKeyProperty ? Jt.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : !(this._activeService instanceof H) || this._activeService.key ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], vn.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof H && D.render(this._elementRef, this.changeToChatView.bind(this), this._activeService), this._hasBeenRendered = !0, Qt.onRender(this);
|
13462
13493
|
}
|
13463
13494
|
}, {
|
13464
13495
|
key: "disconnectedCallback",
|