(() => {
    "use strict";
    var e = {
        3184: (e, t, n) => {
            n.d(t, {Z: () => i});
            var r = n(8081), o = n.n(r), a = n(3645), s = n.n(a)()(o());
            s.push([e.id, "\n.title[data-v-7170152e] {\r\n  text-align: center;\r\n  margin: 5px 10px;\r\n  font-weight: bold;\r\n  font-size: 15px;\n}\n.login[data-v-7170152e] {\r\n  text-align: center;\r\n  margin: 16px;\n}\n.items[data-v-7170152e] {\r\n  display: flex;\r\n  align-items: center;\r\n  margin-bottom: 10px;\r\n  border-bottom: 1px solid #d4d4d46b;\r\n  padding: 0 0 5px;\n}\n.footer[data-v-7170152e] {\r\n  width: 100%;\r\n  /* text-align: right; */\r\n  font-size: 12px;\r\n  display: flex;\r\n  justify-content: space-between;\n}\r\n", ""]);
            const i = s
        }, 684: (e, t, n) => {
            n.d(t, {Z: () => i});
            var r = n(8081), o = n.n(r), a = n(3645), s = n.n(a)()(o());
            s.push([e.id, "\nhtml,\r\nbody {\r\n  height: fit-content;\n}\nbody {\r\n  padding: 5px;\n}\r\n", ""]);
            const i = s
        }, 3645: e => {
            e.exports = function (e) {
                var t = [];
                return t.toString = function () {
                    return this.map((function (t) {
                        var n = "", r = void 0 !== t[5];
                        return t[4] && (n += "@supports (".concat(t[4], ") {")), t[2] && (n += "@media ".concat(t[2], " {")), r && (n += "@layer".concat(t[5].length > 0 ? " ".concat(t[5]) : "", " {")), n += e(t), r && (n += "}"), t[2] && (n += "}"), t[4] && (n += "}"), n
                    })).join("")
                }, t.i = function (e, n, r, o, a) {
                    "string" == typeof e && (e = [[null, e, void 0]]);
                    var s = {};
                    if (r) for (var i = 0; i < this.length; i++) {
                        var c = this[i][0];
                        null != c && (s[c] = !0)
                    }
                    for (var l = 0; l < e.length; l++) {
                        var d = [].concat(e[l]);
                        r && s[d[0]] || (void 0 !== a && (void 0 === d[5] || (d[1] = "@layer".concat(d[5].length > 0 ? " ".concat(d[5]) : "", " {").concat(d[1], "}")), d[5] = a), n && (d[2] ? (d[1] = "@media ".concat(d[2], " {").concat(d[1], "}"), d[2] = n) : d[2] = n), o && (d[4] ? (d[1] = "@supports (".concat(d[4], ") {").concat(d[1], "}"), d[4] = o) : d[4] = "".concat(o)), t.push(d))
                    }
                }, t
            }
        }, 8081: e => {
            e.exports = function (e) {
                return e[1]
            }
        }, 3379: e => {
            var t = [];

            function n(e) {
                for (var n = -1, r = 0; r < t.length; r++) if (t[r].identifier === e) {
                    n = r;
                    break
                }
                return n
            }

            function r(e, r) {
                for (var a = {}, s = [], i = 0; i < e.length; i++) {
                    var c = e[i], l = r.base ? c[0] + r.base : c[0], d = a[l] || 0, u = "".concat(l, " ").concat(d);
                    a[l] = d + 1;
                    var p = n(u), v = {css: c[1], media: c[2], sourceMap: c[3], supports: c[4], layer: c[5]};
                    if (-1 !== p) t[p].references++, t[p].updater(v); else {
                        var m = o(v, r);
                        r.byIndex = i, t.splice(i, 0, {identifier: u, updater: m, references: 1})
                    }
                    s.push(u)
                }
                return s
            }

            function o(e, t) {
                var n = t.domAPI(t);
                n.update(e);
                return function (t) {
                    if (t) {
                        if (t.css === e.css && t.media === e.media && t.sourceMap === e.sourceMap && t.supports === e.supports && t.layer === e.layer) return;
                        n.update(e = t)
                    } else n.remove()
                }
            }

            e.exports = function (e, o) {
                var a = r(e = e || [], o = o || {});
                return function (e) {
                    e = e || [];
                    for (var s = 0; s < a.length; s++) {
                        var i = n(a[s]);
                        t[i].references--
                    }
                    for (var c = r(e, o), l = 0; l < a.length; l++) {
                        var d = n(a[l]);
                        0 === t[d].references && (t[d].updater(), t.splice(d, 1))
                    }
                    a = c
                }
            }
        }, 569: e => {
            var t = {};
            e.exports = function (e, n) {
                var r = function (e) {
                    if (void 0 === t[e]) {
                        var n = document.querySelector(e);
                        if (window.HTMLIFrameElement && n instanceof window.HTMLIFrameElement) try {
                            n = n.contentDocument.head
                        } catch (e) {
                            n = null
                        }
                        t[e] = n
                    }
                    return t[e]
                }(e);
                if (!r) throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
                r.appendChild(n)
            }
        }, 9216: e => {
            e.exports = function (e) {
                var t = document.createElement("style");
                return e.setAttributes(t, e.attributes), e.insert(t, e.options), t
            }
        }, 3565: (e, t, n) => {
            e.exports = function (e) {
                var t = n.nc;
                t && e.setAttribute("nonce", t)
            }
        }, 7795: e => {
            e.exports = function (e) {
                if ("undefined" == typeof document) return {
                    update: function () {
                    }, remove: function () {
                    }
                };
                var t = e.insertStyleElement(e);
                return {
                    update: function (n) {
                        !function (e, t, n) {
                            var r = "";
                            n.supports && (r += "@supports (".concat(n.supports, ") {")), n.media && (r += "@media ".concat(n.media, " {"));
                            var o = void 0 !== n.layer;
                            o && (r += "@layer".concat(n.layer.length > 0 ? " ".concat(n.layer) : "", " {")), r += n.css, o && (r += "}"), n.media && (r += "}"), n.supports && (r += "}");
                            var a = n.sourceMap;
                            a && "undefined" != typeof btoa && (r += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a)))), " */")), t.styleTagTransform(r, e, t.options)
                        }(t, e, n)
                    }, remove: function () {
                        !function (e) {
                            if (null === e.parentNode) return !1;
                            e.parentNode.removeChild(e)
                        }(t)
                    }
                }
            }
        }, 4589: e => {
            e.exports = function (e, t) {
                if (t.styleSheet) t.styleSheet.cssText = e; else {
                    for (; t.firstChild;) t.removeChild(t.firstChild);
                    t.appendChild(document.createTextNode(e))
                }
            }
        }
    }, t = {};

    function n(r) {
        var o = t[r];
        if (void 0 !== o) return o.exports;
        var a = t[r] = {id: r, exports: {}};
        return e[r](a, a.exports, n), a.exports
    }

    n.n = e => {
        var t = e && e.__esModule ? () => e.default : () => e;
        return n.d(t, {a: t}), t
    }, n.d = (e, t) => {
        for (var r in t) n.o(t, r) && !n.o(e, r) && Object.defineProperty(e, r, {enumerable: !0, get: t[r]})
    }, n.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t), n.nc = void 0, (() => {
        var e = function () {
            var e = this, t = e.$createElement, n = e._self._c || t;
            return n("div", {staticStyle: {width: "350px"}}, [n("h3", {staticClass: "title"}, [e._v("跟卖精灵")]), e._v(" "), e.nickname ? n("div", [n("div", {staticClass: "items"}, [n("a-avatar", {attrs: {src: e.avatar}}), e._v(" "), n("div", {staticStyle: {"margin-left": "10px"}}, [e._v(e._s(e.nickname))])], 1), e._v(" "), n("div", {staticClass: "items"}, [n("div", [e._v("会员状态:" + e._s(e.memberStatus))])])]) :
                n("div", {staticClass: "login"}, [n("a-button", {
                        attrs: {type: "primary"},
                        on: {click: e.authLogin}
                    },
                    [e._v("授权登录")])], 1), e._v(" "), n("div", {staticClass: "footer"}, [
                e.nickname ? n("span", {
                    staticStyle: {"margin-right": "20px"},
                    on: {click: e.logout}
                }, [e._v("退出登录")]) : e._e(),
                e._v(" "),
                e.versionFit ? e._e() : n("a", {
                    staticStyle: {color: "red"},
                    attrs: {href: "https://www.genmaijl.com/#/plugin", target: "_blank"}
                }, [e._v("点击下载新版本")]),
                e._v(" "),
                // 新增版本提示部分
                n("span", [
                    e._v("版本:" + e._s(e.version) + " "),
                    e.versionTip
                        ? (e.version !== e.latestVersion
                                ? n("a", {
                                    attrs: {href: "https://www.genmaijl.com/#/plugin", target: "_blank"},
                                    staticStyle: {color: "red", "margin-left": "5px"}
                                }, [e._v(e.versionTip)])
                                : n("span", {staticStyle: {color: "green", "margin-left": "5px"}}, [e._v(e.versionTip)])
                        )
                        : e._e()
                ])
            ])])
        };
        e._withStripped = !0;
        const t = {
            components: {},
            // 在data中添加版本比较相关变量
            data: () => ({
                version: "",
                nickname: "",
                login: !1,
                memberStatus: "",
                avatar: "",
                show: "",
                versionFit: !0,
                mode: "",
                latestVersion: "", // 新增：存储最新版本
                versionTip: "" // 新增：版本提示文本
            }),

            mounted() {
                this.version = chrome.runtime.getManifest().version;
                chrome.storage.local.get(["versionInfo", "showAsin", "mode"], (e => {
                    this.versionFit = !0;
                    this.show = e?.showAsin || "show";
                    this.mode = e?.mode || "normal";
                }));
                this.getUserInfo();
                // 新增：调用版本检查
                this.checkVersion();
            },

            methods: {
                // 新增：版本检查主方法
                async checkVersion() {
                    const latestVersion = await this.getCjVersion();
                    if (!latestVersion) return;

                    this.latestVersion = latestVersion;
                    // 比较版本号（简单字符串比较，如需更严谨可实现版本号解析）
                    if (this.version !== latestVersion) {
                        this.versionTip = `已有新版本请更新`;
                    } else {
                        this.versionTip = `已是最新版本`;
                    }
                },

                // 原有getCjVersion方法保持不变...
                async getCjVersion() {
                    try {
                        const url = 'https://gmdx.genmaijl.com/api/api/getCjVersion';
                        const response = await fetch(url, {
                            method: 'GET',
                            headers: {
                                'Content-Type': 'application/json',
                            },
                        });
                        if (!response.ok) {
                            throw new Error(`请求失败，状态码: ${response.status}`);
                        }
                        const result = await response.json();
                        if (result.code === 200) {
                            const cjVersion = result.data?.cjVersion;
                            if (cjVersion) {
                                console.log('获取到的cjVersion:', cjVersion);
                                return cjVersion;
                            } else {
                                throw new Error('响应数据中未找到cjVersion');
                            }
                        } else {
                            throw new Error(`后端返回错误: ${result.msg || '未知错误'}`);
                        }
                    } catch (error) {
                        console.error('请求过程出错:', error.message);
                        return null;
                    }
                },

                // 其他原有方法保持不变...
                getUserInfo() {
                    let e = {};
                    chrome.storage.local.get(["userInfo", "level"], (t => {
                        if (!t.userInfo) return this.nickname = "", !1;
                        try {
                            let e = window.atob(t.userInfo).split("_").pop(), n = (new Date).getTime() / 1e3;
                            if (parseInt(e) < parseInt(n)) return chrome.storage.local.remove("userInfo"), chrome.storage.local.remove("level"), !1
                        } catch {
                            return !1
                        }
                        try {
                            e = JSON.parse(window.atob(window.atob(t.userInfo).split("_")[0]))
                        } catch {
                        }
                        let n = t?.level || 0;
                        this.nickname = e?.nickname || "", this.memberStatus = 12 == n ? "年费会员" : 3 == n ? "季度会员" : 1 == n ? "月度会员" : "暂无", this.avatar = e?.avatars || e.nickname.split("")[0]

                    }))
                }, authLogin() {
                    chrome.storage.local.set({login: "auth"}, (() => {
                        window.open("https://www.genmaijl.com/#/asin")
                    }))
                }, logout() {
                    chrome.storage.local.remove(["userInfo", "level"], (() => {
                        antd.message.success("操作成功"), this.getUserInfo()
                    }))
                }, onChange(e) {
                    console.log("e", e), chrome.storage.local.set({showAsin: e.target.value})
                }, modeChange(e) {
                    console.log("e", e), chrome.storage.local.set({mode: e.target.value}, (() => {
                        antd.message.success("修改模式后请刷新页面")
                    }))
                }
            }
        };
        var r = n(3379), o = n.n(r), a = n(7795), s = n.n(a), i = n(569), c = n.n(i), l = n(3565), d = n.n(l),
            u = n(9216), p = n.n(u), v = n(4589), m = n.n(v), f = n(3184), h = {};
        h.styleTagTransform = m(), h.setAttributes = d(), h.insert = c().bind(null, "head"), h.domAPI = s(), h.insertStyleElement = p();
        o()(f.Z, h);
        f.Z && f.Z.locals && f.Z.locals;
        var g = n(684), _ = {};
        _.styleTagTransform = m(), _.setAttributes = d(), _.insert = c().bind(null, "head"), _.domAPI = s(), _.insertStyleElement = p();
        o()(g.Z, _);
        g.Z && g.Z.locals && g.Z.locals;
        var y = function (e, t, n, r, o, a, s, i) {
            var c, l = "function" == typeof e ? e.options : e;
            if (t && (l.render = t, l.staticRenderFns = n, l._compiled = !0), r && (l.functional = !0), a && (l._scopeId = "data-v-" + a), s ? (c = function (e) {
                (e = e || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) || "undefined" == typeof __VUE_SSR_CONTEXT__ || (e = __VUE_SSR_CONTEXT__), o && o.call(this, e), e && e._registeredComponents && e._registeredComponents.add(s)
            }, l._ssrRegister = c) : o && (c = i ? function () {
                o.call(this, (l.functional ? this.parent : this).$root.$options.shadowRoot)
            } : o), c) if (l.functional) {
                l._injectStyles = c;
                var d = l.render;
                l.render = function (e, t) {
                    return c.call(t), d(e, t)
                }
            } else {
                var u = l.beforeCreate;
                l.beforeCreate = u ? [].concat(u, c) : [c]
            }
            return {exports: e, options: l}
        }(t, e, [], !1, null, "7170152e", null);
        const b = y.exports;
        let x = document.querySelector("#app");
        const w = document.createElement("link");
        let C = setInterval((() => {
            document.head && (clearInterval(C), document.head.appendChild(w), new Vue({el: x, render: e => e(b, {})}))
        }), 50);
        chrome.runtime.sendMessage({type: "getLevel"})
    })()
})();