find message fetch mechanism in here:


"""

(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push([
    [1931], {
        68577: function() {},
        58870: function(e, t, a) {
            "use strict";
            var i, n, o = a(52846);

            function r() {
                return (r = Object.assign ? Object.assign.bind() : function(e) {
                    for (var t = 1; t < arguments.length; t++) {
                        var a = arguments[t];
                        for (var i in a) Object.prototype.hasOwnProperty.call(a, i) && (e[i] = a[i])
                    }
                    return e
                }).apply(this, arguments)
            }
            t.Z = function(e) {
                return o.createElement("svg", r({
                    xmlns: "http://www.w3.org/2000/svg",
                    xmlnsXlink: "http://www.w3.org/1999/xlink",
                    width: 16,
                    height: 16,
                    fill: "none"
                }, e), i || (i = o.createElement("defs", null, o.createElement("path", {
                    id: "add_svg__a",
                    d: "M0 0h16v16H0z"
                }))), o.createElement("g", null, n || (n = o.createElement("mask", {
                    id: "add_svg__b",
                    fill: "#fff"
                }, o.createElement("use", {
                    xlinkHref: "#add_svg__a"
                }))), o.createElement("g", {
                    mask: "url(#add_svg__b)"
                }, o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M13.33 6.67A6.66 6.66 0 0 0 6.67 0C2.98 0 0 2.98 0 6.67a6.66 6.66 0 0 0 6.67 6.66c3.68 0 6.66-2.98 6.66-6.66Z",
                    transform: "translate(1.333 1.333)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M0 0v5.33",
                    transform: "translate(8 5.333)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M0 0h5.33",
                    transform: "translate(5.333 8)"
                }))))
            }
        },
        30217: function(e, t, a) {
            "use strict";
            var i, n, o, r, l = a(52846);

            function s() {
                return (s = Object.assign ? Object.assign.bind() : function(e) {
                    for (var t = 1; t < arguments.length; t++) {
                        var a = arguments[t];
                        for (var i in a) Object.prototype.hasOwnProperty.call(a, i) && (e[i] = a[i])
                    }
                    return e
                }).apply(this, arguments)
            }
            t.Z = function(e) {
                return l.createElement("svg", s({
                    xmlns: "http://www.w3.org/2000/svg",
                    xmlnsXlink: "http://www.w3.org/1999/xlink",
                    width: 30,
                    height: 30,
                    fill: "none"
                }, e), i || (i = l.createElement("defs", null, l.createElement("path", {
                    id: "bot_svg__a",
                    d: "M0 0h30v30H0z"
                }), l.createElement("path", {
                    id: "bot_svg__c",
                    d: "M0 0h20.455v20.455H0z"
                }))), l.createElement("g", null, n || (n = l.createElement("rect", {
                    width: 30,
                    height: 30,
                    fill: "#E7F8FF",
                    rx: 10
                })), o || (o = l.createElement("mask", {
                    id: "bot_svg__b",
                    fill: "#fff"
                }, l.createElement("use", {
                    xlinkHref: "#bot_svg__a"
                }))), l.createElement("g", {
                    mask: "url(#bot_svg__b)"
                }, l.createElement("g", {
                    transform: "translate(4.773 4.773)"
                }, r || (r = l.createElement("mask", {
                    id: "bot_svg__d",
                    fill: "#fff"
                }, l.createElement("use", {
                    xlinkHref: "#bot_svg__c"
                }))), l.createElement("g", {
                    mask: "url(#bot_svg__d)"
                }, l.createElement("path", {
                    fillRule: "evenodd",
                    style: {
                        fill: "#1f948c"
                    },
                    d: "M19.11 8.37c.17-.52.26-1.06.26-1.61 0-.9-.24-1.79-.71-2.57a5.24 5.24 0 0 0-4.53-2.59c-.37 0-.73.04-1.09.11A5.201 5.201 0 0 0 9.17 0h-.04C6.86 0 4.86 1.44 4.16 3.57A5.11 5.11 0 0 0 .71 6.04C.24 6.83 0 7.72 0 8.63c0 1.27.48 2.51 1.35 3.45-.18.52-.27 1.07-.27 1.61 0 .91.25 1.8.71 2.58 1.13 1.94 3.41 2.94 5.63 2.47a5.18 5.18 0 0 0 3.86 1.71h.05c2.26 0 4.27-1.44 4.97-3.57a5.132 5.132 0 0 0 3.45-2.47c.46-.78.7-1.67.7-2.58 0-1.28-.48-2.51-1.34-3.46ZM8.947 18.158c-.04.03-.08.05-.12.07.7.58 1.57.89 2.48.89h.01c2.14 0 3.88-1.72 3.88-3.83v-4.76c0-.02-.02-.04-.04-.05l-1.74-.99v5.75c0 .23-.13.45-.34.57l-4.13 2.35Zm-.67-1.153 4.17-2.38c.02-.01.03-.03.03-.05v-1.99l-5.04 2.87c-.21.12-.47.12-.68 0l-4.13-2.35c-.04-.02-.09-.06-.12-.07-.04.21-.06.43-.06.65 0 .67.18 1.33.52 1.92v-.01c.7 1.19 1.98 1.92 3.37 1.92.68 0 1.35-.18 1.94-.51ZM3.903 5.168v-.14c-.85.31-1.57.9-2.02 1.68a3.78 3.78 0 0 0-.52 1.91c0 1.37.74 2.64 1.94 3.33l4.17 2.37c.02.01.04.01.06 0l1.75-1-5.04-2.87a.64.64 0 0 1-.34-.57v-4.71Zm13.253 3.337-4.18-2.38c-.02 0-.04 0-.06.01l-1.74.99 5.04 2.87c.21.12.34.34.34.58v4.85c1.52-.56 2.54-1.99 2.54-3.6 0-1.37-.74-2.63-1.94-3.32ZM8.014 5.83c-.02.01-.03.03-.03.05v1.99L13.024 5a.692.692 0 0 1 .68 0l4.13 2.35c.04.02.08.05.12.07.03-.21.05-.43.05-.65 0-2.11-1.74-3.83-3.88-3.83-.68 0-1.35.18-1.94.51l-4.17 2.38Zm1.133-4.492c-2.15 0-3.89 1.72-3.89 3.83v4.76c0 .02.02.03.03.04l1.75 1v-5.75c0-.23.13-.45.34-.57l4.13-2.35c.04-.03.09-.06.12-.07-.7-.58-1.58-.89-2.48-.89ZM7.983 11.51l2.24 1.27 2.25-1.27V8.95l-2.25-1.28-2.24 1.28v2.56Z"
                }))))))
            }
        },
        82985: function(e, t, a) {
            "use strict";
            var i, n, o = a(52846);

            function r() {
                return (r = Object.assign ? Object.assign.bind() : function(e) {
                    for (var t = 1; t < arguments.length; t++) {
                        var a = arguments[t];
                        for (var i in a) Object.prototype.hasOwnProperty.call(a, i) && (e[i] = a[i])
                    }
                    return e
                }).apply(this, arguments)
            }
            t.Z = function(e) {
                return o.createElement("svg", r({
                    xmlns: "http://www.w3.org/2000/svg",
                    xmlnsXlink: "http://www.w3.org/1999/xlink",
                    width: 16,
                    height: 16,
                    fill: "none"
                }, e), o.createElement("g", null, i || (i = o.createElement("mask", {
                    id: "cancel_svg__b",
                    fill: "#fff"
                }, o.createElement("use", {
                    xlinkHref: "#cancel_svg__a"
                }))), o.createElement("g", {
                    mask: "url(#cancel_svg__b)"
                }, o.createElement("path", {
                    style: {
                        fill: "#333",
                        opacity: 1
                    },
                    d: "M13.997 8.003c0-.816-.157-1.596-.471-2.34a5.947 5.947 0 0 0-1.284-1.907 5.938 5.938 0 0 0-1.905-1.285A5.93 5.93 0 0 0 8.003 2c-.816 0-1.596.157-2.34.47a5.943 5.943 0 0 0-1.907 1.286 5.942 5.942 0 0 0-1.285 1.908A5.955 5.955 0 0 0 2 8.004c0 .813.157 1.591.47 2.333a5.938 5.938 0 0 0 1.286 1.905c.553.553 1.19.98 1.908 1.284.743.314 1.523.47 2.34.47.813 0 1.59-.156 2.333-.47a5.944 5.944 0 0 0 1.905-1.284 5.944 5.944 0 0 0 1.284-1.905c.314-.742.47-1.52.47-2.334zm1.333 0c0 .994-.192 1.945-.576 2.853a7.265 7.265 0 0 1-1.57 2.329 7.265 7.265 0 0 1-2.328 1.57 7.253 7.253 0 0 1-2.853.575 7.278 7.278 0 0 1-2.858-.576 7.27 7.27 0 0 1-2.332-1.569 7.26 7.26 0 0 1-1.57-2.329 7.25 7.25 0 0 1-.576-2.853c0-.996.192-1.949.575-2.858a7.264 7.264 0 0 1 1.571-2.332 7.264 7.264 0 0 1 2.332-1.57A7.275 7.275 0 0 1 8.003.666a7.25 7.25 0 0 1 2.853.576 7.26 7.26 0 0 1 2.329 1.57 7.27 7.27 0 0 1 1.57 2.332c.383.91.575 1.862.575 2.858z"
                }), o.createElement("path", {
                    style: {
                        fill: "#333",
                        opacity: 1
                    },
                    d: "m5.471 4.529 6 6a.666.666 0 1 1-.942.942l-6-6a.665.665 0 1 1 .942-.942z"
                }))), n || (n = o.createElement("defs", null, o.createElement("path", {
                    id: "cancel_svg__a",
                    d: "M0 0h16v16H0z"
                }))))
            }
        },
        38669: function(e, t, a) {
            "use strict";
            var i, n, o = a(52846);

            function r() {
                return (r = Object.assign ? Object.assign.bind() : function(e) {
                    for (var t = 1; t < arguments.length; t++) {
                        var a = arguments[t];
                        for (var i in a) Object.prototype.hasOwnProperty.call(a, i) && (e[i] = a[i])
                    }
                    return e
                }).apply(this, arguments)
            }
            t.Z = function(e) {
                return o.createElement("svg", r({
                    xmlns: "http://www.w3.org/2000/svg",
                    xmlnsXlink: "http://www.w3.org/1999/xlink",
                    width: 16,
                    height: 16,
                    fill: "none"
                }, e), i || (i = o.createElement("defs", null, o.createElement("path", {
                    id: "close_svg__a",
                    d: "M0 0h16v16H0z"
                }))), o.createElement("g", null, n || (n = o.createElement("mask", {
                    id: "close_svg__b",
                    fill: "#fff"
                }, o.createElement("use", {
                    xlinkHref: "#close_svg__a"
                }))), o.createElement("g", {
                    mask: "url(#close_svg__b)"
                }, o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "m0 0 10.67 10.67M0 10.67 10.67 0",
                    transform: "translate(2.667 2.667)"
                }))))
            }
        },
        12402: function(e, t, a) {
            "use strict";
            var i, n, o = a(52846);

            function r() {
                return (r = Object.assign ? Object.assign.bind() : function(e) {
                    for (var t = 1; t < arguments.length; t++) {
                        var a = arguments[t];
                        for (var i in a) Object.prototype.hasOwnProperty.call(a, i) && (e[i] = a[i])
                    }
                    return e
                }).apply(this, arguments)
            }
            t.Z = function(e) {
                return o.createElement("svg", r({
                    xmlns: "http://www.w3.org/2000/svg",
                    xmlnsXlink: "http://www.w3.org/1999/xlink",
                    width: 16,
                    height: 16,
                    fill: "none"
                }, e), o.createElement("g", null, i || (i = o.createElement("mask", {
                    id: "confirm_svg__b",
                    fill: "#fff"
                }, o.createElement("use", {
                    xlinkHref: "#confirm_svg__a"
                }))), o.createElement("g", {
                    mask: "url(#confirm_svg__b)"
                }, o.createElement("path", {
                    style: {
                        fill: "#333",
                        opacity: 1
                    },
                    d: "M5.996 12.892a.67.67 0 0 1-.84-.083l-3.96-3.94a.665.665 0 0 1 .339-1.126.665.665 0 0 1 .602.181l3.49 3.472 8.24-8.202a.663.663 0 0 1 .841-.08.664.664 0 0 1 .244.81.661.661 0 0 1-.145.215l-8.71 8.67a.666.666 0 0 1-.1.083z"
                }))), n || (n = o.createElement("defs", null, o.createElement("path", {
                    id: "confirm_svg__a",
                    d: "M0 0h16v16H0z"
                }))))
            }
        },
        15592: function(e, t, a) {
            "use strict";
            var i, n, o = a(52846);

            function r() {
                return (r = Object.assign ? Object.assign.bind() : function(e) {
                    for (var t = 1; t < arguments.length; t++) {
                        var a = arguments[t];
                        for (var i in a) Object.prototype.hasOwnProperty.call(a, i) && (e[i] = a[i])
                    }
                    return e
                }).apply(this, arguments)
            }
            t.Z = function(e) {
                return o.createElement("svg", r({
                    xmlns: "http://www.w3.org/2000/svg",
                    width: 14.663,
                    height: 14.663,
                    fill: "none"
                }, e), o.createElement("g", {
                    style: {
                        mixBlendMode: "passthrough"
                    }
                }, i || (i = o.createElement("path", {
                    fill: "#D8D8D8",
                    fillOpacity: .01,
                    fillRule: "evenodd",
                    d: "M7.337.667c-3.69 0-6.67 2.98-6.67 6.67a6.66 6.66 0 0 0 6.67 6.66c3.68 0 6.66-2.98 6.66-6.66a6.66 6.66 0 0 0-6.66-6.67Z"
                })), n || (n = o.createElement("path", {
                    fill: "#333",
                    d: "m10.138 5.471-4.667 4.667q-.046.046-.1.083-.055.036-.116.062-.06.025-.125.038-.064.012-.13.012t-.13-.012q-.064-.013-.125-.038-.06-.026-.115-.062-.055-.037-.101-.083-.047-.046-.083-.101-.037-.055-.062-.115-.025-.06-.038-.125-.013-.065-.013-.13 0-.066.013-.13.013-.065.038-.125.025-.061.062-.116.036-.054.083-.1l4.666-4.667q.047-.047.101-.083.055-.037.116-.062.06-.025.125-.038.064-.013.13-.013.065 0 .13.013.064.013.125.038.06.025.115.062.055.036.101.083.046.046.083.1.036.055.062.116.025.06.038.125.012.064.012.13t-.012.13q-.013.064-.038.125-.026.06-.062.115-.037.055-.083.101ZM5.471 4.53l.667.666q.046.047.083.101.036.055.062.116.025.06.038.125.012.064.012.13 0 .065-.012.13-.013.064-.038.125-.026.06-.062.115-.036.055-.083.101-.046.046-.1.083-.056.036-.116.062-.06.025-.125.038-.065.012-.13.012-.066 0-.13-.012-.065-.013-.125-.038-.061-.026-.116-.062-.054-.036-.1-.083l-.667-.667q-.047-.046-.083-.1-.037-.055-.062-.116-.025-.06-.038-.125-.013-.064-.013-.13t.013-.13q.013-.064.038-.125.025-.06.062-.115.036-.055.083-.101.046-.047.1-.083.055-.037.116-.062.06-.025.125-.038.064-.013.13-.013t.13.013q.064.013.125.038.06.025.115.062.055.036.101.083Zm4 4 .667.666q.046.047.083.101.036.055.062.116.025.06.038.125.012.064.012.13 0 .065-.012.13-.013.064-.038.125-.026.06-.062.115-.036.055-.083.101-.046.046-.1.083-.056.036-.116.062-.06.025-.125.038-.065.012-.13.012-.066 0-.13-.012-.065-.013-.125-.038-.061-.026-.116-.062-.054-.036-.1-.083l-.667-.667q-.047-.046-.083-.1-.037-.055-.062-.116-.025-.06-.038-.125-.013-.064-.013-.13t.013-.13q.013-.064.038-.125.025-.06.062-.115.036-.055.083-.101.046-.047.1-.083.055-.037.116-.062.06-.025.125-.038.064-.013.13-.013t.13.013q.064.013.125.038.06.025.115.062.055.036.101.083Zm3.859-1.192q0-2.491-1.755-4.248-1.754-1.756-4.238-1.756-2.492 0-4.248 1.756-1.756 1.756-1.756 4.248 0 2.484 1.756 4.238 1.757 1.755 4.248 1.755 2.484 0 4.238-1.755 1.755-1.754 1.755-4.238Zm1.333 0q0 3.036-2.145 5.181t-5.181 2.145q-3.043 0-5.19-2.145Q0 10.374 0 7.337q0-3.044 2.147-5.19Q4.293 0 7.337 0q3.037 0 5.181 2.147 2.145 2.147 2.145 5.19ZM10.332 5q0 .066-.013.13t-.038.125q-.025.06-.061.114-.037.055-.083.101-.046.047-.1.083-.055.036-.116.061-.06.025-.125.038-.064.013-.13.013-.065 0-.13-.013-.063-.013-.124-.038-.06-.025-.115-.061-.054-.036-.1-.083-.047-.046-.083-.1-.037-.055-.062-.115-.025-.061-.038-.125-.012-.064-.012-.13 0-.065.012-.13.013-.064.038-.124.025-.061.062-.115.036-.055.082-.101.047-.047.101-.083.055-.036.115-.061.06-.025.125-.038.064-.013.13-.013.065 0 .13.013.064.013.124.038t.115.061q.055.036.1.083.047.046.084.1.036.055.061.116.025.06.038.124.013.065.013.13ZM5.665 9.667q0 .065-.013.13-.013.064-.038.124t-.061.115q-.036.055-.083.1-.046.047-.1.084-.055.036-.116.061-.06.025-.124.038-.064.013-.13.013-.065 0-.13-.013-.064-.013-.124-.038-.061-.025-.115-.061-.055-.037-.101-.083-.047-.046-.083-.1-.036-.055-.061-.116-.025-.06-.038-.125-.013-.064-.013-.13 0-.065.013-.13.013-.063.038-.124.025-.06.061-.115.036-.054.083-.1.046-.047.1-.083.055-.037.116-.062.06-.025.124-.038.065-.012.13-.012.066 0 .13.012.064.013.124.038.061.025.115.062.055.036.101.082.047.047.083.101.036.055.061.115.025.06.038.125.013.064.013.13Zm0-4.667q0 .066-.013.13t-.038.125q-.025.06-.061.114-.036.055-.083.101-.046.047-.1.083-.055.036-.116.061-.06.025-.124.038-.064.013-.13.013-.065 0-.13-.013-.064-.013-.124-.038-.061-.025-.115-.061-.055-.036-.101-.083-.047-.046-.083-.1-.036-.055-.061-.115-.025-.061-.038-.125-.013-.064-.013-.13 0-.065.013-.13.013-.064.038-.124.025-.061.061-.115.036-.055.083-.101.046-.047.1-.083.055-.036.116-.061.06-.025.124-.038.065-.013.13-.013.066 0 .13.013t.124.038q.061.025.115.061.055.036.101.083.047.046.083.1.036.055.061.116.025.06.038.124.013.065.013.13Zm.667.667q0 .065-.013.13-.013.064-.038.124t-.061.115q-.037.055-.083.1-.046.047-.1.084-.055.036-.116.061-.06.025-.125.038-.064.013-.13.013-.065 0-.13-.013-.063-.013-.124-.038-.06-.025-.115-.061-.054-.037-.1-.083-.047-.046-.083-.1-.037-.055-.062-.116-.025-.06-.038-.125-.012-.064-.012-.13 0-.065.012-.13.013-.063.038-.124.025-.06.062-.115.036-.054.082-.1.047-.047.101-.083.055-.037.115-.062.06-.025.125-.038.064-.012.13-.012.065 0 .13.012.064.013.124.038t.115.062q.055.036.1.082.047.047.084.101.036.055.061.115.025.06.038.125.013.064.013.13ZM9.665 9q0 .066-.013.13t-.038.125q-.025.06-.061.114-.036.055-.083.101-.046.047-.1.083-.055.036-.116.061-.06.025-.124.038-.064.013-.13.013-.065 0-.13-.013-.064-.013-.124-.038-.061-.025-.115-.061-.055-.036-.101-.083-.047-.046-.083-.1-.036-.055-.061-.115-.025-.061-.038-.125-.013-.064-.013-.13 0-.065.013-.13.013-.064.038-.124.025-.061.061-.115.036-.055.083-.101.046-.047.1-.083.055-.036.116-.061.06-.025.124-.038.065-.013.13-.013.066 0 .13.013t.124.038q.061.025.115.061.055.036.101.083.047.046.083.1.036.055.061.116.025.06.038.124.013.065.013.13Zm.667.667q0 .065-.013.13-.013.064-.038.124t-.061.115q-.037.055-.083.1-.046.047-.1.084-.055.036-.116.061-.06.025-.125.038-.064.013-.13.013-.065 0-.13-.013-.063-.013-.124-.038-.06-.025-.115-.061-.054-.037-.1-.083-.047-.046-.083-.1-.037-.055-.062-.116-.025-.06-.038-.125-.012-.064-.012-.13 0-.065.012-.13.013-.063.038-.124.025-.06.062-.115.036-.054.082-.1.047-.047.101-.083.055-.037.115-.062.06-.025.125-.038.064-.012.13-.012.065 0 .13.012.064.013.124.038t.115.062q.055.036.1.082.047.047.084.101.036.055.061.115.025.06.038.125.013.064.013.13Z"
                }))))
            }
        },
        36177: function(e, t, a) {
            "use strict";
            var i, n, o = a(52846);

            function r() {
                return (r = Object.assign ? Object.assign.bind() : function(e) {
                    for (var t = 1; t < arguments.length; t++) {
                        var a = arguments[t];
                        for (var i in a) Object.prototype.hasOwnProperty.call(a, i) && (e[i] = a[i])
                    }
                    return e
                }).apply(this, arguments)
            }
            t.Z = function(e) {
                return o.createElement("svg", r({
                    xmlns: "http://www.w3.org/2000/svg",
                    xmlnsXlink: "http://www.w3.org/1999/xlink",
                    width: 16,
                    height: 16,
                    fill: "none"
                }, e), o.createElement("g", null, i || (i = o.createElement("mask", {
                    id: "drag_svg__b",
                    fill: "#fff"
                }, o.createElement("use", {
                    xlinkHref: "#drag_svg__a"
                }))), o.createElement("g", {
                    mask: "url(#drag_svg__b)",
                    fillRule: "evenodd"
                }, o.createElement("path", {
                    style: {
                        fill: "#333"
                    },
                    d: "M6.337 3.33c0 .74-.6 1.34-1.34 1.34a1.336 1.336 0 1 1 1.34-1.34zm-1.34 6a1.33 1.33 0 1 1 0-2.66c.74 0 1.34.59 1.34 1.33 0 .74-.6 1.33-1.34 1.33zm0 4.67a1.336 1.336 0 0 1 0-2.67c.74 0 1.34.6 1.34 1.34 0 .73-.6 1.33-1.34 1.33zM12.337 3.33c0 .74-.6 1.34-1.34 1.34a1.336 1.336 0 1 1 1.34-1.34zm-1.34 6a1.33 1.33 0 1 1 0-2.66c.74 0 1.34.59 1.34 1.33 0 .74-.6 1.33-1.34 1.33zm0 4.67a1.336 1.336 0 0 1 0-2.67c.74 0 1.34.6 1.34 1.34 0 .73-.6 1.33-1.34 1.33z"
                }))), n || (n = o.createElement("defs", null, o.createElement("path", {
                    id: "drag_svg__a",
                    d: "M0 0h16v16H0z"
                }))))
            }
        },
        56073: function(e, t, a) {
            "use strict";
            var i, n = a(52846);

            function o() {
                return (o = Object.assign ? Object.assign.bind() : function(e) {
                    for (var t = 1; t < arguments.length; t++) {
                        var a = arguments[t];
                        for (var i in a) Object.prototype.hasOwnProperty.call(a, i) && (e[i] = a[i])
                    }
                    return e
                }).apply(this, arguments)
            }
            t.Z = function(e) {
                return n.createElement("svg", o({
                    xmlns: "http://www.w3.org/2000/svg",
                    width: 800,
                    height: 800,
                    fill: "none",
                    viewBox: "0 0 24 24"
                }, e), i || (i = n.createElement("path", {
                    fill: "#000",
                    fillRule: "evenodd",
                    d: "M6.301 15.577C4.778 14.268 3.691 12.773 3.18 12c.51-.773 1.598-2.268 3.121-3.577C7.874 7.072 9.816 6 12 6c2.184 0 4.126 1.072 5.699 2.423 1.523 1.309 2.61 2.804 3.121 3.577-.51.773-1.598 2.268-3.121 3.577C16.126 16.928 14.184 18 12 18c-2.184 0-4.126-1.072-5.699-2.423ZM12 4C9.148 4 6.757 5.395 4.998 6.906c-1.765 1.517-2.99 3.232-3.534 4.064a1.876 1.876 0 0 0 0 2.06c.544.832 1.769 2.547 3.534 4.064C6.758 18.605 9.148 20 12 20c2.852 0 5.243-1.395 7.002-2.906 1.765-1.517 2.99-3.232 3.534-4.064.411-.628.411-1.431 0-2.06-.544-.832-1.769-2.547-3.534-4.064C17.242 5.395 14.852 4 12 4Zm-2 8a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm2-4a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z",
                    clipRule: "evenodd"
                })))
            }
        },
        59566: function(e, t, a) {
            "use strict";
            var i, n, o = a(52846);

            function r() {
                return (r = Object.assign ? Object.assign.bind() : function(e) {
                    for (var t = 1; t < arguments.length; t++) {
                        var a = arguments[t];
                        for (var i in a) Object.prototype.hasOwnProperty.call(a, i) && (e[i] = a[i])
                    }
                    return e
                }).apply(this, arguments)
            }
            t.Z = function(e) {
                return o.createElement("svg", r({
                    xmlns: "http://www.w3.org/2000/svg",
                    xmlnsXlink: "http://www.w3.org/1999/xlink",
                    width: 16,
                    height: 16,
                    fill: "none"
                }, e), i || (i = o.createElement("defs", null, o.createElement("path", {
                    id: "github_svg__a",
                    d: "M0 0h16v16H0z"
                }))), o.createElement("g", null, n || (n = o.createElement("mask", {
                    id: "github_svg__b",
                    fill: "#fff"
                }, o.createElement("use", {
                    xlinkHref: "#github_svg__a"
                }))), o.createElement("g", {
                    mask: "url(#github_svg__b)"
                }, o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M7.11 8.51c.81-.16 1.53-.45 2.1-.87.96-.73 1.46-1.85 1.46-2.95 0-.78-.3-1.5-.81-2.11-.28-.34.55-2.89-.19-2.55-.73.34-1.81 1.1-2.38.94C6.68.79 6.02.69 5.33.69c-.6 0-1.17.07-1.71.21-.79.2-1.53-.54-2.29-.87C.58-.29.99 2.34.77 2.62.28 3.22 0 3.93 0 4.69c0 1.1.6 2.22 1.56 2.95.65.48 1.45.78 2.35.94",
                    transform: "translate(2.667 1.645)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M.58 0C.19.43 0 .83 0 1.21v2.91",
                    transform: "translate(6 10.22)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M0 0c.37.48.55.91.55 1.29v2.89",
                    transform: "translate(9.782 10.159)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M0 0c.3.04.52.17.67.41C.88.77 1.69 2.1 2.61 2.1H4",
                    transform: "translate(2 10.405)"
                }))))
            }
        },
        18154: function(e, t, a) {
            "use strict";
            var i, n, o = a(52846);

            function r() {
                return (r = Object.assign ? Object.assign.bind() : function(e) {
                    for (var t = 1; t < arguments.length; t++) {
                        var a = arguments[t];
                        for (var i in a) Object.prototype.hasOwnProperty.call(a, i) && (e[i] = a[i])
                    }
                    return e
                }).apply(this, arguments)
            }
            t.Z = function(e) {
                return o.createElement("svg", r({
                    xmlns: "http://www.w3.org/2000/svg",
                    xmlnsXlink: "http://www.w3.org/1999/xlink",
                    width: 16,
                    height: 16,
                    fill: "none"
                }, e), i || (i = o.createElement("defs", null, o.createElement("path", {
                    id: "left_svg__a",
                    d: "M0 0h16v16H0z"
                }))), o.createElement("g", null, n || (n = o.createElement("mask", {
                    id: "left_svg__b",
                    fill: "#fff"
                }, o.createElement("use", {
                    xlinkHref: "#left_svg__a"
                }))), o.createElement("g", {
                    mask: "url(#left_svg__b)"
                }, o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M4 8 0 4l4-4",
                    transform: "translate(6.333 4)"
                }))))
            }
        },
        22774: function(e, t, a) {
            "use strict";
            var i, n, o = a(52846);

            function r() {
                return (r = Object.assign ? Object.assign.bind() : function(e) {
                    for (var t = 1; t < arguments.length; t++) {
                        var a = arguments[t];
                        for (var i in a) Object.prototype.hasOwnProperty.call(a, i) && (e[i] = a[i])
                    }
                    return e
                }).apply(this, arguments)
            }
            t.Z = function(e) {
                return o.createElement("svg", r({
                    xmlns: "http://www.w3.org/2000/svg",
                    xmlnsXlink: "http://www.w3.org/1999/xlink",
                    width: 16,
                    height: 16,
                    fill: "none"
                }, e), i || (i = o.createElement("defs", null, o.createElement("path", {
                    id: "mask_svg__a",
                    d: "M0 0h16v16H0z"
                }))), o.createElement("g", null, n || (n = o.createElement("mask", {
                    id: "mask_svg__b",
                    fill: "#fff"
                }, o.createElement("use", {
                    xlinkHref: "#mask_svg__a"
                }))), o.createElement("g", {
                    mask: "url(#mask_svg__b)"
                }, o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M6 0C2.69 0 0 2.54 0 5.67s2.69 5.66 6 5.66 6-2.53 6-5.66C12 2.54 9.31 0 6 0Z",
                    transform: "translate(2 3.333)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M1 0C.45 0 0 .6 0 1.33c0 .74.45 1.34 1 1.34s1-.6 1-1.34C2 .6 1.55 0 1 0Z",
                    transform: "rotate(15 -22.183 22.313)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M1 0C.45 0 0 .6 0 1.33c0 .74.45 1.34 1 1.34s1-.6 1-1.34C2 .6 1.55 0 1 0Z",
                    transform: "rotate(165 5.213 5.304)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M4 4.51c1.04-1.04 1.15-2.74.1-3.78C3.06-.32 1.04-.2 0 .84",
                    transform: "translate(9.667 2.493)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M.84 4.51C-.2 3.47-.32 1.77.73.73 1.77-.32 3.8-.2 4.84.84",
                    transform: "translate(1.493 2.493)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M0 0c.17.43.73 1.09 1.67.29.93.8 1.5.14 1.66-.29",
                    transform: "translate(6.5 11.67)"
                }))))
            }
        },
        14845: function(e, t, a) {
            "use strict";
            var i, n, o = a(52846);

            function r() {
                return (r = Object.assign ? Object.assign.bind() : function(e) {
                    for (var t = 1; t < arguments.length; t++) {
                        var a = arguments[t];
                        for (var i in a) Object.prototype.hasOwnProperty.call(a, i) && (e[i] = a[i])
                    }
                    return e
                }).apply(this, arguments)
            }
            t.Z = function(e) {
                return o.createElement("svg", r({
                    xmlns: "http://www.w3.org/2000/svg",
                    xmlnsXlink: "http://www.w3.org/1999/xlink",
                    width: 16,
                    height: 16,
                    fill: "none"
                }, e), i || (i = o.createElement("defs", null, o.createElement("path", {
                    id: "max_svg__a",
                    d: "M0 0h16v16H0z"
                }))), o.createElement("g", null, n || (n = o.createElement("mask", {
                    id: "max_svg__b",
                    fill: "#fff"
                }, o.createElement("use", {
                    xlinkHref: "#max_svg__a"
                }))), o.createElement("g", {
                    mask: "url(#max_svg__b)"
                }, o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "m0 0 3.33 3.3",
                    transform: "translate(2 2)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M0 3.3 3.33 0",
                    transform: "translate(2 10.667)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M3.3 3.3 0 0",
                    transform: "translate(10.7 10.667)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M3.3 0 0 3.3",
                    transform: "translate(10.667 2)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M0 0h3v3",
                    transform: "translate(11 2)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M3 0v3H0",
                    transform: "translate(11 11)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M3 3H0V0",
                    transform: "translate(2 11)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M0 3V0h3",
                    transform: "translate(2 2)"
                }))))
            }
        },
        68397: function(e, t, a) {
            "use strict";
            var i, n, o = a(52846);

            function r() {
                return (r = Object.assign ? Object.assign.bind() : function(e) {
                    for (var t = 1; t < arguments.length; t++) {
                        var a = arguments[t];
                        for (var i in a) Object.prototype.hasOwnProperty.call(a, i) && (e[i] = a[i])
                    }
                    return e
                }).apply(this, arguments)
            }
            t.Z = function(e) {
                return o.createElement("svg", r({
                    xmlns: "http://www.w3.org/2000/svg",
                    xmlnsXlink: "http://www.w3.org/1999/xlink",
                    width: 16,
                    height: 16,
                    fill: "none"
                }, e), i || (i = o.createElement("defs", null, o.createElement("path", {
                    id: "min_svg__a",
                    d: "M0 0h16v16H0z"
                }))), o.createElement("g", null, n || (n = o.createElement("mask", {
                    id: "min_svg__b",
                    fill: "#fff"
                }, o.createElement("use", {
                    xlinkHref: "#min_svg__a"
                }))), o.createElement("g", {
                    mask: "url(#min_svg__b)"
                }, o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "m0 0 3.33 3.3",
                    transform: "translate(2 2)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M0 3.3 3.33 0",
                    transform: "translate(2 10.667)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M3.3 3.3 0 0",
                    transform: "translate(10.7 10.667)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M3.3 0 0 3.3",
                    transform: "translate(10.667 2)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M0 0v3h3",
                    transform: "translate(10.667 2.333)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M3 0v3H0",
                    transform: "translate(2.333 2.333)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M3 3V0H0",
                    transform: "translate(2.333 10.667)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M0 3V0h2.97",
                    transform: "translate(10.667 10.667)"
                }))))
            }
        },
        98829: function(e, t, a) {
            "use strict";
            var i, n, o = a(52846);

            function r() {
                return (r = Object.assign ? Object.assign.bind() : function(e) {
                    for (var t = 1; t < arguments.length; t++) {
                        var a = arguments[t];
                        for (var i in a) Object.prototype.hasOwnProperty.call(a, i) && (e[i] = a[i])
                    }
                    return e
                }).apply(this, arguments)
            }
            t.Z = function(e) {
                return o.createElement("svg", r({
                    xmlns: "http://www.w3.org/2000/svg",
                    xmlnsXlink: "http://www.w3.org/1999/xlink",
                    width: 16,
                    height: 16,
                    fill: "none"
                }, e), i || (i = o.createElement("defs", null, o.createElement("path", {
                    id: "reload_svg__a",
                    d: "M0 0h16v16H0z"
                }))), o.createElement("g", null, n || (n = o.createElement("mask", {
                    id: "reload_svg__b",
                    fill: "#fff"
                }, o.createElement("use", {
                    xlinkHref: "#reload_svg__a"
                }))), o.createElement("g", {
                    mask: "url(#reload_svg__b)"
                }, o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M0 0v5.33",
                    transform: "translate(14 2.667)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.3333333333333333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M0 0v5.33",
                    transform: "translate(2 8)"
                }), o.createElement("path", {
                    style: {
                        stroke: "#333",
                        strokeWidth: 1.333,
                        strokeOpacity: 1,
                        strokeDasharray: "0 0"
                    },
                    d: "M12.003 6a6.005 6.005 0 0 0-10.32-4.17M0 6a6.005 6.005 0 0 0 10.17 4.32",
                    transform: "translate(2 2)"
                }))))
            }
        },
        24053: function(e, t, a) {
            "use strict";
            var i, n, o, r = a(52846);

            function l() {
                return (l = Object.assign ? Object.assign.bind() : function(e) {
                    for (var t = 1; t < arguments.length; t++) {
                        var a = arguments[t];
                        for (var i in a) Object.prototype.hasOwnProperty.call(a, i) && (e[i] = a[i])
                    }
                    return e
                }).apply(this, arguments)
            }
            t.Z = function(e) {
                return r.createElement("svg", l({
                    xmlns: "http://www.w3.org/2000/svg",
                    width: 30,
                    height: 14,
                    fill: "#fff",
                    viewBox: "0 0 120 30"
                }, e), i || (i = r.createElement("circle", {
                    cx: 15,
                    cy: 15,
                    r: 15,
                    fill: "var(--primary, red)"
                }, r.createElement("animate", {
                    attributeName: "r",
                    begin: "0s",
                    calcMode: "linear",
                    dur: "0.8s",
                    from: 15,
                    repeatCount: "indefinite",
                    to: 15,
                    values: "15;9;15"
                }), r.createElement("animate", {
                    attributeName: "fill-opacity",
                    begin: "0s",
                    calcMode: "linear",
                    dur: "0.8s",
                    from: 1,
                    repeatCount: "indefinite",
                    to: 1,
                    values: "1;.5;1"
                }))), n || (n = r.createElement("circle", {
                    cx: 60,
                    cy: 15,
                    r: 9,
                    fill: "var(--primary, red)",
                    fillOpacity: .3
                }, r.createElement("animate", {
                    attributeName: "r",
                    begin: "0s",
                    calcMode: "linear",
                    dur: "0.8s",
                    from: 9,
                    repeatCount: "indefinite",
                    to: 9,
                    values: "9;15;9"
                }), r.createElement("animate", {
                    attributeName: "fill-opacity",
                    begin: "0s",
                    calcMode: "linear",
                    dur: "0.8s",
                    from: .5,
                    repeatCount: "indefinite",
                    to: .5,
                    values: ".5;1;.5"
                }))), o || (o = r.createElement("circle", {
                    cx: 105,
                    cy: 15,
                    r: 15,
                    fill: "var(--primary, red)"
                }, r.createElement("animate", {
                    attributeName: "r",
                    begin: "0s",
                    calcMode: "linear",
                    dur: "0.8s",
                    from: 15,
                    repeatCount: "indefinite",
                    to: 15,
                    values: "15;9;15"
                }), r.createElement("animate", {
                    attributeName: "fill-opacity",
                    begin: "0s",
                    calcMode: "linear",
                    dur: "0.8s",
                    from: 1,
                    repeatCount: "indefinite",
                    to: 1,
                    values: "1;.5;1"
                }))))
            }
        },
        89285: function(e, t, a) {
            Promise.resolve().then(a.bind(a, 42188)), Promise.resolve().then(a.bind(a, 51120))
        },
        1610: function(e, t, a) {
            "use strict";
            a.d(t, {
                ti: function() {
                    return N
                },
                K$: function() {
                    return M
                },
                Oj: function() {
                    return _
                },
                Lw: function() {
                    return U
                },
                wU: function() {
                    return R
                }
            });
            var i = a(94880),
                n = a(75591),
                o = a(44922),
                r = a(85564),
                l = a(26757);

            function s(e) {
                let t = e.split("/");
                if ("gateway.ai.cloudflare.com" == t[2]) {
                    if ("azure-openai" == t[6]) return t.slice(0, 8).concat(t.slice(-3)).join("/");
                    if ("openai" == t[6] || "anthropic" == t[6]) return t.slice(0, 7).concat(t.slice(-2)).join("/")
                }
                return e
            }
            var c = a(13894),
                u = a(92944),
                d = a(1217);
            class p {
                path(e) {
                    let t = o._X.getState(),
                        a = "",
                        r = e.includes("deployments");
                    if (t.useCustomConfig) {
                        if (r && !t.isValidAzure()) throw Error("incomplete azure config, please check it in your settings page");
                        a = r ? t.azureUrl : t.openaiUrl
                    }
                    if (0 === a.length) {
                        var l;
                        let e = !!(null === (l = (0, i.Z)()) || void 0 === l ? void 0 : l.isApp),
                            t = r ? n.L.Azure : n.L.OpenAI;
                        a = e ? n.Bi : t
                    }
                    return a.endsWith("/") && (a = a.slice(0, a.length - 1)), a.startsWith("http") || r || a.startsWith(n.L.OpenAI) || (a = "https://" + a), console.log("[Proxy Endpoint] ", a, e), s([a, e].join("/"))
                }
                async extractMessage(e) {
                    var t, a, i, n, o, r, s, c, u, d;
                    if (e.error) return "```\n" + JSON.stringify(e, null, 4) + "\n```";
                    if (e.data) {
                        let t = null !== (c = null === (o = e.data) || void 0 === o ? void 0 : null === (n = o.at(0)) || void 0 === n ? void 0 : n.url) && void 0 !== c ? c : "",
                            a = null !== (u = null === (s = e.data) || void 0 === s ? void 0 : null === (r = s.at(0)) || void 0 === r ? void 0 : r.b64_json) && void 0 !== u ? u : "";
                        return !t && a && (t = await (0, l.Ix)((0, l.lf)(a, "image/png"))), [{
                            type: "image_url",
                            image_url: {
                                url: t
                            }
                        }]
                    }
                    return null !== (d = null === (i = e.choices) || void 0 === i ? void 0 : null === (a = i.at(0)) || void 0 === a ? void 0 : null === (t = a.message) || void 0 === t ? void 0 : t.content) && void 0 !== d ? d : e
                }
                async speech(e) {
                    var t;
                    let a = {
                        model: e.model,
                        input: e.input,
                        voice: e.voice,
                        response_format: e.response_format,
                        speed: e.speed
                    };
                    console.log("[Request] openai speech payload: ", a);
                    let i = new AbortController;
                    null === (t = e.onController) || void 0 === t || t.call(e, i);
                    try {
                        let e = this.path(n.mX.SpeechPath),
                            t = {
                                method: "POST",
                                body: JSON.stringify(a),
                                signal: i.signal,
                                headers: R()
                            },
                            o = setTimeout(() => i.abort(), n.tb),
                            r = await (0, d.h)(e, t);
                        return clearTimeout(o), await r.arrayBuffer()
                    } catch (e) {
                        throw console.log("[Request] failed to make a speech request", e), e
                    }
                }
                async chat(e) {
                    var t, a, i, s, c, p, m, h, g, T, S;
                    let v;
                    let b = {
                            ...o.MG.getState().modelConfig,
                            ...o.aK.getState().currentSession().mask.modelConfig,
                            model: e.config.model,
                            providerName: e.config.providerName
                        },
                        y = (0, u.Wu)(e.config.model),
                        f = e.config.model.startsWith("o1");
                    if (y) {
                        let t = (0, u.YK)(null === (a = e.messages.slice(-1)) || void 0 === a ? void 0 : a.pop());
                        v = {
                            model: e.config.model,
                            prompt: t,
                            response_format: "b64_json",
                            n: 1,
                            size: null !== (p = null === (i = e.config) || void 0 === i ? void 0 : i.size) && void 0 !== p ? p : "1024x1024",
                            quality: null !== (m = null === (s = e.config) || void 0 === s ? void 0 : s.quality) && void 0 !== m ? m : "standard",
                            style: null !== (h = null === (c = e.config) || void 0 === c ? void 0 : c.style) && void 0 !== h ? h : "vivid"
                        }
                    } else {
                        let t = (0, u.Xf)(e.config.model),
                            a = [];
                        for (let i of e.messages) {
                            let e = t ? await (0, l.VA)(i.content) : (0, u.YK)(i);
                            f && "system" === i.role || a.push({
                                role: i.role,
                                content: e
                            })
                        }
                        v = {
                            messages: a,
                            stream: !f && e.config.stream,
                            model: b.model,
                            temperature: f ? 1 : b.temperature,
                            presence_penalty: f ? 0 : b.presence_penalty,
                            frequency_penalty: f ? 0 : b.frequency_penalty,
                            top_p: f ? 1 : b.top_p
                        }, f && (v.max_completion_tokens = b.max_tokens), t && (v.max_tokens = Math.max(b.max_tokens, 4e3))
                    }
                    console.log("[Request] openai payload: ", v);
                    let k = !y && !!e.config.stream && !f,
                        C = new AbortController;
                    null === (t = e.onController) || void 0 === t || t.call(e, C);
                    try {
                        let t = "";
                        if (b.providerName === n.UT.Azure) {
                            let {
                                models: e,
                                customModels: a
                            } = o.MG.getState(), {
                                defaultModel: i,
                                customModels: l,
                                useCustomConfig: s
                            } = o._X.getState(), c = (0, r.lW)(e, [a, l].join(","), i).find(e => {
                                var t;
                                return e.name === b.model && (null == e ? void 0 : null === (t = e.provider) || void 0 === t ? void 0 : t.providerName) === n.UT.Azure
                            });
                            t = this.path((y ? n.kn.ImagePath : n.kn.ChatPath)(null !== (g = null == c ? void 0 : c.displayName) && void 0 !== g ? g : null == c ? void 0 : c.name, s ? o._X.getState().azureApiVersion : ""))
                        } else t = this.path(y ? n.mX.ImagePath : n.mX.ChatPath);
                        if (k) {
                            let a = -1,
                                [i, n] = o.RQ.getState().getAsTools((null === (T = o.aK.getState().currentSession().mask) || void 0 === T ? void 0 : T.plugin) || []);
                            (0, l.Vw)(t, v, R(), i, n, C, (e, t) => {
                                var i, n, o, r, l, s, c, u, d, p;
                                let m = JSON.parse(e).choices,
                                    h = null === (n = m[0]) || void 0 === n ? void 0 : null === (i = n.delta) || void 0 === i ? void 0 : i.tool_calls;
                                if ((null == h ? void 0 : h.length) > 0) {
                                    let e = null === (l = h[0]) || void 0 === l ? void 0 : l.id,
                                        i = null === (c = h[0]) || void 0 === c ? void 0 : null === (s = c.function) || void 0 === s ? void 0 : s.arguments;
                                    e ? (a += 1, t.push({
                                        id: e,
                                        type: null === (u = h[0]) || void 0 === u ? void 0 : u.type,
                                        function: {
                                            name: null === (p = h[0]) || void 0 === p ? void 0 : null === (d = p.function) || void 0 === d ? void 0 : d.name,
                                            arguments: i
                                        }
                                    })) : t[a].function.arguments += i
                                }
                                return null === (r = m[0]) || void 0 === r ? void 0 : null === (o = r.delta) || void 0 === o ? void 0 : o.content
                            }, (e, t, i) => {
                                var n, o;
                                a = -1, null == e || null === (o = e.messages) || void 0 === o || o.splice(null == e ? void 0 : null === (n = e.messages) || void 0 === n ? void 0 : n.length, 0, t, ...i)
                            }, e)
                        } else {
                            let a = {
                                    method: "POST",
                                    body: JSON.stringify(v),
                                    signal: C.signal,
                                    headers: R()
                                },
                                i = setTimeout(() => C.abort(), y || f ? 4 * n.tb : n.tb),
                                o = await (0, d.h)(t, a);
                            clearTimeout(i);
                            let r = await o.json(),
                                l = await this.extractMessage(r);
                            e.onFinish(l, o)
                        }
                    } catch (t) {
                        console.log("[Request] failed to make a chat request", t), null === (S = e.onError) || void 0 === S || S.call(e, t)
                    }
                }
                async usage() {
                    let e = e => "".concat(e.getFullYear(), "-").concat((e.getMonth() + 1).toString().padStart(2, "0"), "-").concat(e.getDate().toString().padStart(2, "0")),
                        t = new Date,
                        a = e(new Date(t.getFullYear(), t.getMonth(), 1)),
                        i = e(new Date(Date.now() + 864e5)),
                        [o, r] = await Promise.all([(0, d.h)(this.path("".concat(n.mX.UsagePath, "?start_date=").concat(a, "&end_date=").concat(i)), {
                            method: "GET",
                            headers: R()
                        }), (0, d.h)(this.path(n.mX.SubsPath), {
                            method: "GET",
                            headers: R()
                        })]);
                    if (401 === o.status) throw Error(c.ZP.Error.Unauthorized);
                    if (!o.ok || !r.ok) throw Error("Failed to query usage from openai");
                    let l = await o.json(),
                        s = await r.json();
                    if (l.error && l.error.type) throw Error(l.error.message);
                    return l.total_usage && (l.total_usage = Math.round(l.total_usage) / 100), s.hard_limit_usd && (s.hard_limit_usd = Math.round(100 * s.hard_limit_usd) / 100), {
                        used: l.total_usage,
                        total: s.hard_limit_usd
                    }
                }
                async models() {
                    var e;
                    if (this.disableListModels) return n.Fv.slice();
                    let t = await (0, d.h)(this.path(n.mX.ListModelPath), {
                            method: "GET",
                            headers: {
                                ...R()
                            }
                        }),
                        a = null === (e = (await t.json()).data) || void 0 === e ? void 0 : e.filter(e => e.id.startsWith("gpt-") || e.id.startsWith("chatgpt-"));
                    if (console.log("[Models]", a), !a) return [];
                    let i = 1e3;
                    return a.map(e => ({
                        name: e.id,
                        available: !0,
                        sorted: i++,
                        provider: {
                            id: "openai",
                            providerName: "OpenAI",
                            providerType: "openai",
                            sorted: 1
                        }
                    }))
                }
                constructor() {
                    this.disableListModels = !0
                }
            }
            var m = a(84065);
            class h {
                path(e) {
                    var t;
                    let a = o._X.getState(),
                        r = "";
                    a.useCustomConfig && (r = a.googleUrl);
                    let l = !!(null === (t = (0, i.Z)()) || void 0 === t ? void 0 : t.isApp);
                    0 === r.length && (r = l ? n.Hm : n.L.Google), r.endsWith("/") && (r = r.slice(0, r.length - 1)), r.startsWith("http") || r.startsWith(n.L.Google) || (r = "https://" + r), console.log("[Proxy Endpoint] ", r, e);
                    let s = [r, e].join("/");
                    return s + (s.includes("?") ? "&alt=sse" : "?alt=sse")
                }
                extractMessage(e) {
                    var t, a, i, n, o;
                    return console.log("[Response] gemini-pro response: ", e), (null == e ? void 0 : null === (n = e.candidates) || void 0 === n ? void 0 : null === (i = n.at(0)) || void 0 === i ? void 0 : null === (a = i.content) || void 0 === a ? void 0 : null === (t = a.parts.at(0)) || void 0 === t ? void 0 : t.text) || (null == e ? void 0 : null === (o = e.error) || void 0 === o ? void 0 : o.message) || ""
                }
                speech(e) {
                    throw Error("Method not implemented.")
                }
                async chat(e) {
                    var t, a, i, r, s;
                    let c = [];
                    for (let t of e.messages) {
                        let e = await (0, l.VA)(t.content);
                        c.push({
                            role: t.role,
                            content: e
                        })
                    }
                    let p = c.map(t => {
                        let a = [{
                            text: (0, u.YK)(t)
                        }];
                        if ((0, u.Xf)(e.config.model)) {
                            let e = (0, u.Bs)(t);
                            e.length > 0 && (a = a.concat(e.map(e => ({
                                inline_data: {
                                    mime_type: e.split(";")[0].split(":")[1],
                                    data: e.split(",")[1]
                                }
                            }))))
                        }
                        return {
                            role: t.role.replace("assistant", "model").replace("system", "user"),
                            parts: a
                        }
                    });
                    for (let e = 0; e < p.length - 1;) p[e].role === p[e + 1].role ? (p[e].parts = p[e].parts.concat(p[e + 1].parts), p.splice(e + 1, 1)) : e++;
                    let h = o._X.getState(),
                        g = {
                            ...o.MG.getState().modelConfig,
                            ...o.aK.getState().currentSession().mask.modelConfig,
                            model: e.config.model
                        },
                        T = {
                            contents: p,
                            generationConfig: {
                                temperature: g.temperature,
                                maxOutputTokens: g.max_tokens,
                                topP: g.top_p
                            },
                            safetySettings: [{
                                category: "HARM_CATEGORY_HARASSMENT",
                                threshold: h.googleSafetySettings
                            }, {
                                category: "HARM_CATEGORY_HATE_SPEECH",
                                threshold: h.googleSafetySettings
                            }, {
                                category: "HARM_CATEGORY_SEXUALLY_EXPLICIT",
                                threshold: h.googleSafetySettings
                            }, {
                                category: "HARM_CATEGORY_DANGEROUS_CONTENT",
                                threshold: h.googleSafetySettings
                            }]
                        },
                        S = !!e.config.stream,
                        v = new AbortController;
                    null === (t = e.onController) || void 0 === t || t.call(e, v);
                    try {
                        let t = this.path(n.ie.ChatPath(g.model)),
                            s = {
                                method: "POST",
                                body: JSON.stringify(T),
                                signal: v.signal,
                                headers: R()
                            },
                            c = setTimeout(() => v.abort(), n.tb);
                        if (S) {
                            let [i, n] = o.RQ.getState().getAsTools((null === (a = o.aK.getState().currentSession().mask) || void 0 === a ? void 0 : a.plugin) || []);
                            return (0, l.Vw)(t, T, R(), i.length > 0 ? [{
                                functionDeclarations: i.map(e => e.function)
                            }] : [], n, v, (e, t) => {
                                var a, i, n, o, r, l;
                                let s = JSON.parse(e),
                                    c = null == s ? void 0 : null === (n = s.candidates) || void 0 === n ? void 0 : null === (i = n.at(0)) || void 0 === i ? void 0 : null === (a = i.content.parts.at(0)) || void 0 === a ? void 0 : a.functionCall;
                                if (c) {
                                    let {
                                        name: e,
                                        args: a
                                    } = c;
                                    t.push({
                                        id: (0, m.x0)(),
                                        type: "function",
                                        function: {
                                            name: e,
                                            arguments: JSON.stringify(a)
                                        }
                                    })
                                }
                                return null == s ? void 0 : null === (l = s.candidates) || void 0 === l ? void 0 : null === (r = l.at(0)) || void 0 === r ? void 0 : null === (o = r.content.parts.at(0)) || void 0 === o ? void 0 : o.text
                            }, (e, t, a) => {
                                var i, n;
                                null == e || null === (n = e.contents) || void 0 === n || n.splice(null == e ? void 0 : null === (i = e.contents) || void 0 === i ? void 0 : i.length, 0, {
                                    role: "model",
                                    parts: t.tool_calls.map(e => {
                                        var t, a;
                                        return {
                                            functionCall: {
                                                name: null == e ? void 0 : null === (t = e.function) || void 0 === t ? void 0 : t.name,
                                                args: JSON.parse(null == e ? void 0 : null === (a = e.function) || void 0 === a ? void 0 : a.arguments)
                                            }
                                        }
                                    })
                                }, ...a.map(e => ({
                                    role: "function",
                                    parts: [{
                                        functionResponse: {
                                            name: e.name,
                                            response: {
                                                name: e.name,
                                                content: e.content
                                            }
                                        }
                                    }]
                                })))
                            }, e)
                        } {
                            let a = await (0, d.h)(t, s);
                            clearTimeout(c);
                            let n = await a.json();
                            (null == n ? void 0 : null === (i = n.promptFeedback) || void 0 === i ? void 0 : i.blockReason) && (null === (r = e.onError) || void 0 === r || r.call(e, Error("Message is being blocked for reason: " + n.promptFeedback.blockReason)));
                            let o = this.extractMessage(n);
                            e.onFinish(o, a)
                        }
                    } catch (t) {
                        console.log("[Request] failed to make a chat request", t), null === (s = e.onError) || void 0 === s || s.call(e, t)
                    }
                }
                usage() {
                    throw Error("Method not implemented.")
                }
                async models() {
                    return []
                }
            }
            let g = {
                assistant: "assistant",
                user: "user",
                system: "user"
            };
            class T {
                speech(e) {
                    throw Error("Method not implemented.")
                }
                extractMessage(e) {
                    var t, a;
                    return console.log("[Response] claude response: ", e), null == e ? void 0 : null === (a = e.content) || void 0 === a ? void 0 : null === (t = a[0]) || void 0 === t ? void 0 : t.text
                }
                async chat(e) {
                    var t, a, i, r;
                    let s = (0, u.Xf)(e.config.model),
                        c = o._X.getState(),
                        p = !!e.config.stream,
                        m = {
                            ...o.MG.getState().modelConfig,
                            ...o.aK.getState().currentSession().mask.modelConfig,
                            model: e.config.model
                        },
                        h = [];
                    for (let t of e.messages) {
                        let e = await (0, l.VA)(t.content);
                        h.push({
                            role: t.role,
                            content: e
                        })
                    }
                    let T = ["system", "user"];
                    for (let e = 0; e < h.length - 1; e++) {
                        let t = h[e],
                            a = h[e + 1];
                        T.includes(t.role) && T.includes(a.role) && (h[e] = [t, {
                            role: "assistant",
                            content: ";"
                        }])
                    }
                    let S = h.flat().filter(e => !!(e.content && ("string" != typeof e.content || e.content.trim()))).map(e => {
                        var t;
                        let {
                            role: a,
                            content: i
                        } = e, n = null !== (t = g[a]) && void 0 !== t ? t : "user";
                        return s && "string" != typeof i ? {
                            role: n,
                            content: i.filter(e => e.image_url || e.text).map(e => {
                                let {
                                    type: t,
                                    text: a,
                                    image_url: i
                                } = e;
                                if ("text" === t) return {
                                    type: t,
                                    text: a
                                };
                                let {
                                    url: n = ""
                                } = i || {}, o = n.indexOf(":"), r = n.indexOf(";"), l = n.indexOf(","), s = n.slice(o + 1, r);
                                return {
                                    type: "image",
                                    source: {
                                        type: n.slice(r + 1, l),
                                        media_type: s,
                                        data: n.slice(l + 1)
                                    }
                                }
                            })
                        } : {
                            role: n,
                            content: (0, u.YK)(e)
                        }
                    });
                    (null === (t = S[0]) || void 0 === t ? void 0 : t.role) === "assistant" && S.unshift({
                        role: "user",
                        content: ";"
                    });
                    let v = {
                            messages: S,
                            stream: p,
                            model: m.model,
                            max_tokens: m.max_tokens,
                            temperature: m.temperature,
                            top_p: m.top_p,
                            top_k: 5
                        },
                        b = this.path(n.YU.ChatPath),
                        y = new AbortController;
                    if (null === (a = e.onController) || void 0 === a || a.call(e, y), p) {
                        let t = -1,
                            [a, n] = o.RQ.getState().getAsTools((null === (i = o.aK.getState().currentSession().mask) || void 0 === i ? void 0 : i.plugin) || []);
                        return (0, l.Vw)(b, v, {
                            ...R(),
                            "anthropic-version": c.anthropicApiVersion
                        }, a.map(e => {
                            var t, a, i;
                            return {
                                name: null == e ? void 0 : null === (t = e.function) || void 0 === t ? void 0 : t.name,
                                description: null == e ? void 0 : null === (a = e.function) || void 0 === a ? void 0 : a.description,
                                input_schema: null == e ? void 0 : null === (i = e.function) || void 0 === i ? void 0 : i.parameters
                            }
                        }), n, y, (e, a) => {
                            var i, n, o, r, l;
                            let s;
                            if ((null == (s = JSON.parse(e)) ? void 0 : null === (i = s.content_block) || void 0 === i ? void 0 : i.type) == "tool_use") {
                                t += 1;
                                let e = null == s ? void 0 : s.content_block.id,
                                    i = null == s ? void 0 : s.content_block.name;
                                a.push({
                                    id: e,
                                    type: "function",
                                    function: {
                                        name: i,
                                        arguments: ""
                                    }
                                })
                            }
                            return (null == s ? void 0 : null === (n = s.delta) || void 0 === n ? void 0 : n.type) == "input_json_delta" && (null == s ? void 0 : null === (o = s.delta) || void 0 === o ? void 0 : o.partial_json) && (a[t].function.arguments += null == s ? void 0 : null === (l = s.delta) || void 0 === l ? void 0 : l.partial_json), null == s ? void 0 : null === (r = s.delta) || void 0 === r ? void 0 : r.text
                        }, (e, a, i) => {
                            var n, o;
                            t = -1, null == e || null === (o = e.messages) || void 0 === o || o.splice(null == e ? void 0 : null === (n = e.messages) || void 0 === n ? void 0 : n.length, 0, {
                                role: "assistant",
                                content: a.tool_calls.map(e => {
                                    var t, a, i;
                                    return {
                                        type: "tool_use",
                                        id: e.id,
                                        name: null == e ? void 0 : null === (t = e.function) || void 0 === t ? void 0 : t.name,
                                        input: (null == e ? void 0 : null === (a = e.function) || void 0 === a ? void 0 : a.arguments) ? JSON.parse(null == e ? void 0 : null === (i = e.function) || void 0 === i ? void 0 : i.arguments) : {}
                                    }
                                })
                            }, ...i.map(e => ({
                                role: "user",
                                content: [{
                                    type: "tool_result",
                                    tool_use_id: e.tool_call_id,
                                    content: e.content
                                }]
                            })))
                        }, e)
                    } {
                        let t = {
                            method: "POST",
                            body: JSON.stringify(v),
                            signal: y.signal,
                            headers: {
                                ...R(),
                                "anthropic-version": c.anthropicApiVersion
                            }
                        };
                        try {
                            y.signal.onabort = () => e.onFinish("", new Response(null, {
                                status: 400
                            }));
                            let a = await (0, d.h)(b, t),
                                i = await a.json(),
                                n = this.extractMessage(i);
                            e.onFinish(n, a)
                        } catch (t) {
                            console.error("failed to chat", t), null === (r = e.onError) || void 0 === r || r.call(e, t)
                        }
                    }
                }
                async usage() {
                    return {
                        used: 0,
                        total: 0
                    }
                }
                async models() {
                    return []
                }
                path(e) {
                    let t = o._X.getState(),
                        a = "";
                    if (t.useCustomConfig && (a = t.anthropicUrl), 0 === a.trim().length) {
                        var r;
                        a = (null === (r = (0, i.Z)()) || void 0 === r ? void 0 : r.isApp) ? n.y3 : n.L.Anthropic
                    }
                    return a.startsWith("http") || a.startsWith("/api") || (a = "https://" + a), a = function(e) {
                        let t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : " ";
                        if (0 === t.length) return e;
                        for (; e.endsWith(t);) e = e.slice(0, -t.length);
                        return e
                    }(a, "/"), s("".concat(a, "/").concat(e))
                }
            }
            async function S(e, t) {
                let a = await fetch("".concat(n.FR, "?grant_type=client_credentials&client_id=").concat(e, "&client_secret=").concat(t), {
                    method: "POST",
                    mode: "cors"
                });
                return await a.json()
            }
            var v = a(534),
                b = a(58669);
            class y {
                path(e) {
                    let t = o._X.getState(),
                        a = "";
                    if (t.useCustomConfig && (a = t.baiduUrl), 0 === a.length) {
                        var r;
                        a = (null === (r = (0, i.Z)()) || void 0 === r ? void 0 : r.isApp) ? n.n9 : n.L.Baidu
                    }
                    return a.endsWith("/") && (a = a.slice(0, a.length - 1)), a.startsWith("http") || a.startsWith(n.L.Baidu) || (a = "https://" + a), console.log("[Proxy Endpoint] ", a, e), [a, e].join("/")
                }
                speech(e) {
                    throw Error("Method not implemented.")
                }
                async chat(e) {
                    var t, a, r, l;
                    let s = e.messages.map(e => ({
                        role: "system" === e.role ? "user" : e.role,
                        content: (0, u.YK)(e)
                    }));
                    s.length % 2 == 0 && ((null === (a = s.at(0)) || void 0 === a ? void 0 : a.role) === "user" ? s.splice(1, 0, {
                        role: "assistant",
                        content: " "
                    }) : s.unshift({
                        role: "user",
                        content: " "
                    }));
                    let p = {
                            ...o.MG.getState().modelConfig,
                            ...o.aK.getState().currentSession().mask.modelConfig,
                            model: e.config.model
                        },
                        m = !!e.config.stream,
                        h = {
                            messages: s,
                            stream: m,
                            model: p.model,
                            temperature: p.temperature,
                            presence_penalty: p.presence_penalty,
                            frequency_penalty: p.frequency_penalty,
                            top_p: p.top_p
                        };
                    console.log("[Request] Baidu payload: ", h);
                    let g = new AbortController;
                    null === (t = e.onController) || void 0 === t || t.call(e, g);
                    try {
                        let t = this.path(n.v3.ChatPath(p.model));
                        if (null === (r = (0, i.Z)()) || void 0 === r ? void 0 : r.isApp) {
                            let e = o._X.getState();
                            if (e.useCustomConfig && e.isValidBaidu()) {
                                let {
                                    access_token: a
                                } = await S(e.baiduApiKey, e.baiduSecretKey);
                                t = "".concat(t).concat(t.includes("?") ? "&" : "?", "access_token=").concat(a)
                            }
                        }
                        let a = {
                                method: "POST",
                                body: JSON.stringify(h),
                                signal: g.signal,
                                headers: R()
                            },
                            l = setTimeout(() => g.abort(), n.tb);
                        if (m) {
                            let i, n = "",
                                o = "",
                                r = !1;
                            ! function t() {
                                var a, i;
                                if (r || g.signal.aborted) {
                                    n += o, console.log("[Response Animation] finished"), (null == n ? void 0 : n.length) === 0 && (null === (a = e.onError) || void 0 === a || a.call(e, Error("empty response from server")));
                                    return
                                }
                                if (o.length > 0) {
                                    let t = Math.max(1, Math.round(o.length / 60)),
                                        a = o.slice(0, t);
                                    n += a, o = o.slice(t), null === (i = e.onUpdate) || void 0 === i || i.call(e, n, a)
                                }
                                requestAnimationFrame(t)
                            }();
                            let s = () => {
                                r || (r = !0, e.onFinish(n + o, i))
                            };
                            g.signal.onabort = s, (0, v.L)(t, {
                                fetch: d.h,
                                ...a,
                                async onopen(e) {
                                    var t;
                                    clearTimeout(l);
                                    let a = e.headers.get("content-type");
                                    if (console.log("[Baidu] request response content type: ", a), i = e, null == a ? void 0 : a.startsWith("text/plain")) return n = await e.clone().text(), s();
                                    if (!e.ok || !(null === (t = e.headers.get("content-type")) || void 0 === t ? void 0 : t.startsWith(v.a)) || 200 !== e.status) {
                                        let t = [n],
                                            a = await e.clone().text();
                                        try {
                                            let t = await e.clone().json();
                                            a = (0, b.B)(t)
                                        } catch (e) {}
                                        return 401 === e.status && t.push(c.ZP.Error.Unauthorized), a && t.push(a), n = t.join("\n\n"), s()
                                    }
                                },
                                onmessage(e) {
                                    if ("[DONE]" === e.data || r) return s();
                                    let t = e.data;
                                    try {
                                        let e = JSON.parse(t),
                                            a = null == e ? void 0 : e.result;
                                        a && (o += a)
                                    } catch (a) {
                                        console.error("[Request] parse error", t, e)
                                    }
                                },
                                onclose() {
                                    s()
                                },
                                onerror(t) {
                                    var a;
                                    throw null === (a = e.onError) || void 0 === a || a.call(e, t), t
                                },
                                openWhenHidden: !0
                            })
                        } else {
                            let i = await (0, d.h)(t, a);
                            clearTimeout(l);
                            let n = await i.json(),
                                o = null == n ? void 0 : n.result;
                            e.onFinish(o, i)
                        }
                    } catch (t) {
                        console.log("[Request] failed to make a chat request", t), null === (l = e.onError) || void 0 === l || l.call(e, t)
                    }
                }
                async usage() {
                    return {
                        used: 0,
                        total: 0
                    }
                }
                async models() {
                    return []
                }
            }
            class f {
                path(e) {
                    let t = o._X.getState(),
                        a = "";
                    if (t.useCustomConfig && (a = t.bytedanceUrl), 0 === a.length) {
                        var r;
                        a = (null === (r = (0, i.Z)()) || void 0 === r ? void 0 : r.isApp) ? n.ik : n.L.ByteDance
                    }
                    return a.endsWith("/") && (a = a.slice(0, a.length - 1)), a.startsWith("http") || a.startsWith(n.L.ByteDance) || (a = "https://" + a), console.log("[Proxy Endpoint] ", a, e), [a, e].join("/")
                }
                extractMessage(e) {
                    var t, a, i, n;
                    return null !== (n = null === (i = e.choices) || void 0 === i ? void 0 : null === (a = i.at(0)) || void 0 === a ? void 0 : null === (t = a.message) || void 0 === t ? void 0 : t.content) && void 0 !== n ? n : ""
                }
                speech(e) {
                    throw Error("Method not implemented.")
                }
                async chat(e) {
                    var t, a;
                    let i = e.messages.map(e => ({
                            role: e.role,
                            content: (0, u.YK)(e)
                        })),
                        r = {
                            ...o.MG.getState().modelConfig,
                            ...o.aK.getState().currentSession().mask.modelConfig,
                            model: e.config.model
                        },
                        l = !!e.config.stream,
                        s = {
                            messages: i,
                            stream: l,
                            model: r.model,
                            temperature: r.temperature,
                            presence_penalty: r.presence_penalty,
                            frequency_penalty: r.frequency_penalty,
                            top_p: r.top_p
                        },
                        p = new AbortController;
                    null === (t = e.onController) || void 0 === t || t.call(e, p);
                    try {
                        let t = this.path(n.MU.ChatPath),
                            a = {
                                method: "POST",
                                body: JSON.stringify(s),
                                signal: p.signal,
                                headers: R()
                            },
                            i = setTimeout(() => p.abort(), n.tb);
                        if (l) {
                            let n, o = "",
                                r = "",
                                l = !1;
                            ! function t() {
                                var a, i;
                                if (l || p.signal.aborted) {
                                    o += r, console.log("[Response Animation] finished"), (null == o ? void 0 : o.length) === 0 && (null === (a = e.onError) || void 0 === a || a.call(e, Error("empty response from server")));
                                    return
                                }
                                if (r.length > 0) {
                                    let t = Math.max(1, Math.round(r.length / 60)),
                                        a = r.slice(0, t);
                                    o += a, r = r.slice(t), null === (i = e.onUpdate) || void 0 === i || i.call(e, o, a)
                                }
                                requestAnimationFrame(t)
                            }();
                            let s = () => {
                                l || (l = !0, e.onFinish(o + r, n))
                            };
                            p.signal.onabort = s, (0, v.L)(t, {
                                fetch: d.h,
                                ...a,
                                async onopen(e) {
                                    var t;
                                    clearTimeout(i);
                                    let a = e.headers.get("content-type");
                                    if (console.log("[ByteDance] request response content type: ", a), n = e, null == a ? void 0 : a.startsWith("text/plain")) return o = await e.clone().text(), s();
                                    if (!e.ok || !(null === (t = e.headers.get("content-type")) || void 0 === t ? void 0 : t.startsWith(v.a)) || 200 !== e.status) {
                                        let t = [o],
                                            a = await e.clone().text();
                                        try {
                                            let t = await e.clone().json();
                                            a = (0, b.B)(t)
                                        } catch (e) {}
                                        return 401 === e.status && t.push(c.ZP.Error.Unauthorized), a && t.push(a), o = t.join("\n\n"), s()
                                    }
                                },
                                onmessage(e) {
                                    if ("[DONE]" === e.data || l) return s();
                                    let t = e.data;
                                    try {
                                        var a, i;
                                        let e = JSON.parse(t).choices,
                                            n = null === (i = e[0]) || void 0 === i ? void 0 : null === (a = i.delta) || void 0 === a ? void 0 : a.content;
                                        n && (r += n)
                                    } catch (a) {
                                        console.error("[Request] parse error", t, e)
                                    }
                                },
                                onclose() {
                                    s()
                                },
                                onerror(t) {
                                    var a;
                                    throw null === (a = e.onError) || void 0 === a || a.call(e, t), t
                                },
                                openWhenHidden: !0
                            })
                        } else {
                            let n = await (0, d.h)(t, a);
                            clearTimeout(i);
                            let o = await n.json(),
                                r = this.extractMessage(o);
                            e.onFinish(r, n)
                        }
                    } catch (t) {
                        console.log("[Request] failed to make a chat request", t), null === (a = e.onError) || void 0 === a || a.call(e, t)
                    }
                }
                async usage() {
                    return {
                        used: 0,
                        total: 0
                    }
                }
                async models() {
                    return []
                }
            }
            class k {
                path(e) {
                    let t = o._X.getState(),
                        a = "";
                    if (t.useCustomConfig && (a = t.alibabaUrl), 0 === a.length) {
                        var r;
                        a = (null === (r = (0, i.Z)()) || void 0 === r ? void 0 : r.isApp) ? n.x5 : n.L.Alibaba
                    }
                    return a.endsWith("/") && (a = a.slice(0, a.length - 1)), a.startsWith("http") || a.startsWith(n.L.Alibaba) || (a = "https://" + a), console.log("[Proxy Endpoint] ", a, e), [a, e].join("/")
                }
                extractMessage(e) {
                    var t, a, i, n, o;
                    return null !== (o = null == e ? void 0 : null === (n = e.output) || void 0 === n ? void 0 : null === (i = n.choices) || void 0 === i ? void 0 : null === (a = i.at(0)) || void 0 === a ? void 0 : null === (t = a.message) || void 0 === t ? void 0 : t.content) && void 0 !== o ? o : ""
                }
                speech(e) {
                    throw Error("Method not implemented.")
                }
                async chat(e) {
                    var t, a;
                    let i = e.messages.map(e => ({
                            role: e.role,
                            content: (0, u.YK)(e)
                        })),
                        r = {
                            ...o.MG.getState().modelConfig,
                            ...o.aK.getState().currentSession().mask.modelConfig,
                            model: e.config.model
                        },
                        l = !!e.config.stream,
                        s = {
                            model: r.model,
                            input: {
                                messages: i
                            },
                            parameters: {
                                result_format: "message",
                                incremental_output: l,
                                temperature: r.temperature,
                                top_p: 1 === r.top_p ? .99 : r.top_p
                            }
                        },
                        p = new AbortController;
                    null === (t = e.onController) || void 0 === t || t.call(e, p);
                    try {
                        let t = this.path(n.rk.ChatPath),
                            a = {
                                method: "POST",
                                body: JSON.stringify(s),
                                signal: p.signal,
                                headers: {
                                    ...R(),
                                    "X-DashScope-SSE": l ? "enable" : "disable"
                                }
                            },
                            i = setTimeout(() => p.abort(), n.tb);
                        if (l) {
                            let n, o = "",
                                r = "",
                                l = !1;
                            ! function t() {
                                var a, i;
                                if (l || p.signal.aborted) {
                                    o += r, console.log("[Response Animation] finished"), (null == o ? void 0 : o.length) === 0 && (null === (a = e.onError) || void 0 === a || a.call(e, Error("empty response from server")));
                                    return
                                }
                                if (r.length > 0) {
                                    let t = Math.max(1, Math.round(r.length / 60)),
                                        a = r.slice(0, t);
                                    o += a, r = r.slice(t), null === (i = e.onUpdate) || void 0 === i || i.call(e, o, a)
                                }
                                requestAnimationFrame(t)
                            }();
                            let s = () => {
                                l || (l = !0, e.onFinish(o + r, n))
                            };
                            p.signal.onabort = s, (0, v.L)(t, {
                                fetch: d.h,
                                ...a,
                                async onopen(e) {
                                    var t;
                                    clearTimeout(i);
                                    let a = e.headers.get("content-type");
                                    if (console.log("[Alibaba] request response content type: ", a), n = e, null == a ? void 0 : a.startsWith("text/plain")) return o = await e.clone().text(), s();
                                    if (!e.ok || !(null === (t = e.headers.get("content-type")) || void 0 === t ? void 0 : t.startsWith(v.a)) || 200 !== e.status) {
                                        let t = [o],
                                            a = await e.clone().text();
                                        try {
                                            let t = await e.clone().json();
                                            a = (0, b.B)(t)
                                        } catch (e) {}
                                        return 401 === e.status && t.push(c.ZP.Error.Unauthorized), a && t.push(a), o = t.join("\n\n"), s()
                                    }
                                },
                                onmessage(e) {
                                    if ("[DONE]" === e.data || l) return s();
                                    let t = e.data;
                                    try {
                                        var a, i;
                                        let e = JSON.parse(t).output.choices,
                                            n = null === (i = e[0]) || void 0 === i ? void 0 : null === (a = i.message) || void 0 === a ? void 0 : a.content;
                                        n && (r += n)
                                    } catch (a) {
                                        console.error("[Request] parse error", t, e)
                                    }
                                },
                                onclose() {
                                    s()
                                },
                                onerror(t) {
                                    var a;
                                    throw null === (a = e.onError) || void 0 === a || a.call(e, t), t
                                },
                                openWhenHidden: !0
                            })
                        } else {
                            let n = await (0, d.h)(t, a);
                            clearTimeout(i);
                            let o = await n.json(),
                                r = this.extractMessage(o);
                            e.onFinish(r, n)
                        }
                    } catch (t) {
                        console.log("[Request] failed to make a chat request", t), null === (a = e.onError) || void 0 === a || a.call(e, t)
                    }
                }
                async usage() {
                    return {
                        used: 0,
                        total: 0
                    }
                }
                async models() {
                    return []
                }
            }
            var C = a(7686),
                A = a(91901),
                P = a(86816),
                I = a(61260);
            class E {
                path() {
                    let e = o._X.getState(),
                        t = "";
                    if (e.useCustomConfig && (t = e.tencentUrl), 0 === t.length) {
                        var a;
                        t = (null === (a = (0, i.Z)()) || void 0 === a ? void 0 : a.isApp) ? n.Mo : n.L.Tencent
                    }
                    return t.endsWith("/") && (t = t.slice(0, t.length - 1)), t.startsWith("http") || t.startsWith(n.L.Tencent) || (t = "https://" + t), console.log("[Proxy Endpoint] ", t), t
                }

""".