!function() {
    function t(t, e, a) {
        return e in t ? Object.defineProperty(t, e, {
            value: a,
            enumerable: !0,
            configurable: !0,
            writable: !0
        }) : t[e] = a, t;
    }
    function e(t) {
        t.setData({
            showModalStatus: !1
        }), setTimeout(function() {
            t.setData({
                mengshow: !1,
                bottom: "-100%"
            });
        }, 100);
    }
    function a(t) {
        for (var e = "", a = t.split("~"), r = [], o = [], i = [], c = 0; c < a.length; c++) {
            var s = a[c].match(/(\d*)\-(\d+)\-(\d+)/i);
            console.log("v", s), i.push(s[3]), n(s[2], o) ? r.push(parseInt(s[3]) + "日") : (o.push(s[2]), 
            e = s[1] + "年", r.push(parseInt(s[2]) + "月" + parseInt(s[3]) + "日"));
        }
        return console.log("day", i), o.length > 1 ? e : i.length > 1 && parseInt(i[1]) - parseInt(i[0]) >= 27 ? parseInt(o[0]) + "月" : r.join("-");
    }
    function n(t, e) {
        for (var a in e) if (e[a] == t) return !0;
        return !1;
    }
    function r(t) {
        return String.fromCharCode(t);
    }
    function o(t, e) {
        var a = 3;
        e && "gb" === e.substr(0, 2).toLowerCase() && (a = 2);
        for (var n = 0, r = t.split(""), o = 0; o < r.length; o++) {
            var i = encodeURI(r[o]);
            n += 1 == i.length ? 1 : i.length / 9 * a;
        }
        return n;
    }
    function i(t) {
        var e = t;
        if (3 == e.length) var a = e.map(function(t) {
            return "%" + t.toString(16);
        }).join("");
        return decodeURI(a);
    }
    function c(t) {
        "undefined" == String(t) && (t = "");
        for (var e = new Array(), a = 0, n = 0; n < t.length; n++) {
            var r = encodeURI(t[n]);
            if (1 == r.length) e[a++] = r.charCodeAt(0); else for (var o = r.split("%"), i = 1; i < o.length; i++) e[a++] = parseInt("0x" + o[i]);
        }
        return e;
    }
    function s(t, e, a, n) {
        if (0 == a) return "";
        0 == n && (n = 1);
        var r = (t.substr(e, a) - n) / (n % 7 == 0 ? 1 : n % 7);
        return r < 1 ? 1 : r;
    }
    var l = function(t) {
        return [ (t = t || new Date()).getFullYear(), t.getMonth() + 1, t.getDate() ].map(u).join("");
    }, u = function(t) {
        return (t = t.toString())[1] ? t : "0" + t;
    }, d = "https://api.xzw.com/com/json/";
    module.exports = {
        formatTime: function(t) {
            var e = t.getFullYear(), a = t.getMonth() + 1, n = t.getDate(), r = t.getHours(), o = t.getMinutes(), i = t.getSeconds();
            return [ e, a, n ].map(u).join("/") + " " + [ r, o, i ].map(u).join(":");
        },
        formatDate: l,
        showModal: function(t) {
            t.setData({
                modalHidden: !0,
                showModalStatus: !0,
                mengshow: !0,
                bottom: "0px"
            });
        },
        hideModal: e,
        setIcon: function(t, a) {
            t.setData({
                female: t.data.femalecheck,
                male: t.data.malecheck,
                femaleclickid: t.data.femalecheck,
                maleclickid: t.data.malecheck
            });
            var n = {};
            n.m = t.data.malecheck, n.f = t.data.femalecheck, wx.setStorage({
                key: a,
                data: n
            }), e(t);
        },
        cancel: function(t) {
            t.setData({
                femalecheck: t.data.female,
                malecheck: t.data.male,
                femaleclickid: t.data.female,
                maleclickid: t.data.male
            }), e(t);
        },
        scrollFun: function(e, a) {
            var n = a.currentTarget.dataset.name, r = a.detail.scrollTop, o = a.detail.scrollHeight, i = Math.round(r / (o / 14));
            i > 11 && (i = 11), i < 0 && (i = 0), e.setData(t({}, n, i));
        },
        clickIcon: function(e, a) {
            var n, r = a.currentTarget.dataset.index, o = a.currentTarget.dataset.name, i = o + "check", c = o + "clickid";
            e.setData((t(n = {}, i, r), t(n, c, r), n));
        },
        getData: function(t, e, n, r) {
            var o, i = e.data.list[t - 1].name, c = (e.data.id, []);
            if ("xz" === n) {
                var s = l();
                o = d + "fortune.js?id=" + t + "&ld=-1&vc=xcx&token=Mh8tGmSoW3fyH642Y+Eb3E&rq=" + s;
            }
            "sx" === n && (o = d + "shengxiao.js?id=" + t + "&vc=xcx&token=Mh8tGmbZpzSxqPGmJaKeKo"), 
            "sxys" === n && (o = d + "shengxiao_fortune.js?id=" + t + "&vc=wxcode&token=Mdozp+aZobSx2jK0JeglmiYkHqpuWeT3JzStGWapYqe"), 
            wx.request({
                url: o,
                success: function(n) {
                    for (var o = n.data.data, s = 0; s < o.length; s++) c.push(a(o[s].vdate));
                    e.setData({
                        infodata: n.data.data,
                        id: t,
                        name: i,
                        date: c
                    }), "function" == typeof r && r();
                }
            });
        },
        getPairData: function(t, e, a) {
            var n = parseInt(t.data.male), r = parseInt(t.data.female);
            t.setData({
                male: n,
                female: r
            }), wx.request({
                url: d + ("sx" === e ? "shengxiao_pairs" : "pair") + ".js?aid=" + (n + 1) + "&bid=" + (r + 1) + "&vc=" + ("sx" === e ? "smart" : "xcx") + "&token=" + ("sx" === e ? "MZnl52boobgxX242Y9mmqSQkG2ZxHx/1pzSr3E" : "Mh8tGmbe3rWx52foQ"),
                success: function(e) {
                    var n = e.data.data.data;
                    t.setData({
                        infodata: n
                    }), "function" == typeof a && a();
                }
            });
        },
        initdata: function(t, e) {
            var a = wx.getStorageSync(e);
            a && t.setData({
                male: a.m,
                malecheck: a.m,
                maleclickid: a.m,
                female: a.f,
                femalecheck: a.f,
                femaleclickid: a.f
            });
        },
        simple_date: a,
        getPairTopData: function(t, e, a, n) {
            wx.request({
                url: d + ("sx" === e ? "shengxiao_" : "") + "pairtop.js?id=" + a + "&vc=smart&token=" + ("sx" === e ? "MZnl52boobgxX242Y9mmqSQkG2ZxHx/1pzStKqbeXKe" : "MZnl52boobdvY3O3Zl6a6s"),
                success: function(e) {
                    var a = e.data.data.data;
                    t.setData({
                        infodata: a
                    }), "function" == typeof n && n();
                }
            });
        },
        authcode: function() {
            var t, e, a, n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null, s = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "encode", l = o(n += "");
            if ("decode" == s) {
                if (l % 3 != 0) return "";
                l /= 3;
            }
            e = [], a = "";
            for (var u = 0, d = 0; d < 255; d++) u = (u + d) % 26, t = d, e[d] = u, e[u] = t;
            var f = "", m = [];
            "encode" == s && (f = c(n));
            for (var g = u = d = 0; d < l; d++) if (u = (u + e[g = (g + 1) % 255]) % 255, t = g, 
            e[g] = u, e[u] = t, "encode" == s) {
                var h = f[d] + e[(e[g] + e[u]) % 200];
                h < 100 && (h = "0" + h), a += h;
            } else {
                var v = Math.ceil(n.substr(3 * d, 3) - e[(e[g] + e[u]) % 200]);
                v > 127 ? (m.push(v), 3 == m.length && (a += i(m), m = [])) : a += r(v);
            }
            return a;
        },
        formatCxLink: function(t, e) {
            var a;
            0 == (a = isNaN(t) ? t.length : t) && (a = 1);
            var n = a % 7;
            0 == n && (n = 1);
            for (var r = [], o = [ 0, 0, 0, 0 ], i = 0; i < e.length; i++) e[i] && (r[i] = e[i] * n + a, 
            o[i] = r[i].toString().length);
            return o.join("") + r.join("");
        },
        GetCxId: function(t, e) {
            var a, n, r, o, i, c, l, u = String(t).substr(0, 4);
            return a = String(t).substr(4), n = isNaN(e) ? trlen2(e) : e, a && (r = s(a, 0, u[0], n), 
            o = s(a, u[0], u[1], n), i = s(a, u[1] + u[0], u[2], n), c = s(a, u[1] + u[0] + u[2], u[3], n)), 
            l = [ r, o, i, c ].join("|"), function t(e, a) {
                var n;
                if ("" == (a = a || "")) return "";
                var r = (e = e || " ").length, o = a.length, i = n = !1;
                0 === a.indexOf(e) && (i = !0), a.lastIndexOf(e) === o - r && (n = !0);
                var c = a;
                return n ? c.length > 0 ? t(e, c = c.substring(0, o - r)) : "" : i ? c.length > 0 ? t(e, c = c.substring(r, c.length)) : "" : c;
            }("|", l).split("|");
        }
    };
}();