var e = require("../../common/vendor.js"),
  n = require("../../constant/index.js"),
  r = require("../../service/index.js"),
  o = require("../../hooks/useState.js"),
  t = require("../../config/index.js"),
  i = require("../../utils/navigate.js"),
  s = require("../../utils/util.js");
require("../../utils/request.js"),
  require("../../enums/index.js"),
  require("../../store/app/index.js"),
  require("../../data/index.js"),
  Array || e.resolveComponent("uni-popup")(),
  Math;
var u = {
    __name: "index",
    props: { visible: { type: Boolean, default: !1 } },
    emits: ["close"],
    setup: function (u, a) {
      var l = a.emit,
        c = u,
        p = o.useState().setUserData,
        v = e.ref(!0),
        f = e.ref(null);
      e.watch(
        function () {
          return c.visible;
        },
        function () {
          c.visible ? f.value.open() : f.value.close();
        }
      );
      var d = function (e) {
          e.show || l("close");
        },
        m = function () {
          l("close");
        },
        g = function (e) {
          var n = e.detail;
          if (v.value) {
            var o = n.errMsg,
              t = n.code;
            "getPhoneNumber:ok" === o
              ? r.getUserMobileForMpWeixin({ code: t }).then(function () {
                  r.getUserInfo().then(function (e) {
                    var n = e.token,
                      r = e.openId,
                      o = e.userId,
                      t = e.userInfo;
                    s.showToast("登录成功"),
                      p({ token: n, openId: r, userId: o, userInfo: t }),
                      l("close");
                  });
                })
              : "getPhoneNumber:fail user deny" === o &&
                s.showToast("授权登录之后才能继续操作");
          } else s.showToast("请先阅读并同意协议");
        },
        h = function () {
          v.value = !v.value;
        },
        j = function () {
          i.navigateTo({
            url: "/pages/web-view/index",
            params: { url: n.userAgreementUrl, title: "用户协议" },
          });
        },
        q = function () {
          i.navigateTo({
            url: "/pages/web-view/index",
            params: { url: n.concealAgreementUrl, title: "隐私协议" },
          });
        };
      return function (n, r) {
        return {
          a: e.o(m),
          b: e.t(e.unref(t.appName)),
          c: e.o(function () {}),
          d: e.o(g),
          e: v.value,
          f: e.o(h),
          g: !v.value,
          h: e.o(h),
          i: e.o(j),
          j: e.o(q),
          k: e.sr(f, "1095514c-0", { k: "popup" }),
          l: e.o(d),
          m: e.p({ type: "center", "is-mask-click": !1, animation: !0 }),
        };
      };
    },
  },
  a = e._export_sfc(u, [["__scopeId", "data-v-1095514c"]]);
wx.createComponent(a);
