"use strict";
const common_vendor = require("../../../common/vendor.js");
const sheep_index = require("../../index.js");
const sheep_hooks_useModal = require("../../hooks/useModal.js");
require("../../api/index.js");
require("../../api/distri/score.js");
require("../../request/index.js");
require("../../config/index.js");
require("../../store/index.js");
require("../../store/app.js");
require("../../api/promotion/diy.js");
require("../../platform/index.js");
require("../../platform/provider/wechat/index.js");
require("../../platform/provider/wechat/miniProgram.js");
require("../../api/member/auth.js");
require("../../api/member/social.js");
require("../../api/member/user.js");
require("../../platform/provider/apple/index.js");
require("../../platform/share.js");
require("../../router/index.js");
require("../../helper/throttle.js");
require("../../url/index.js");
require("../../platform/pay.js");
require("../../helper/index.js");
require("../../helper/test.js");
require("../../helper/digit.js");
require("../../api/pay/order.js");
require("../../store/user.js");
require("../../store/cart.js");
require("../../api/trade/cart.js");
require("../../api/pay/wallet.js");
require("../../api/trade/order.js");
require("../../api/promotion/coupon.js");
require("../../store/sys.js");
require("../../store/modal.js");
require("../../api/distri/share.js");
require("../../api/distri/team.js");
require("../../api/infra/file.js");
require("../../api/member/address.js");
require("../../api/member/point.js");
require("../../api/member/signin.js");
require("../../api/migration/app.js");
require("../../api/migration/chat.js");
require("../../api/migration/index.js");
require("../../api/migration/third.js");
require("../../api/pay/channel.js");
require("../../api/product/category.js");
require("../../api/product/comment.js");
require("../../api/product/favorite.js");
require("../../api/product/history.js");
require("../../api/product/spu.js");
require("../../api/promotion/activity.js");
require("../../api/promotion/article.js");
require("../../api/promotion/bargain.js");
require("../../api/promotion/combination.js");
require("../../api/promotion/rewardActivity.js");
require("../../api/promotion/seckill.js");
require("../../api/system/area.js");
require("../../api/system/voice.js");
require("../../api/trade/afterSale.js");
require("../../api/trade/brokerage.js");
require("../../api/trade/config.js");
require("../../api/trade/delivery.js");
require("../../config/zIndex.js");
if (!Array) {
  const _easycom_su_popup2 = common_vendor.resolveComponent("su-popup");
  _easycom_su_popup2();
}
const _easycom_su_popup = () => "../../ui/su-popup/su-popup.js";
if (!Math) {
  (common_vendor.unref(officialAccountFirstLogin) + accountLogin + smsLogin + register + resetPassword + changeMobile + changePassword + mpAuthorization + _easycom_su_popup)();
}
const accountLogin = () => "./components/account-login.js";
const smsLogin = () => "./components/sms-login.js";
const register = () => "./components/register.js";
const resetPassword = () => "./components/reset-password.js";
const changeMobile = () => "./components/change-mobile.js";
const changePassword = () => "./components/change-password.js";
const mpAuthorization = () => "./components/mp-authorization.js";
const officialAccountFirstLogin = () => "./components/officialAccountFirstLogin.js";
const _sfc_main = {
  __name: "s-auth-modal",
  setup(__props) {
    common_vendor.computed(() => sheep_index.sheep.$store("app").info);
    const linkId = common_vendor.index.getStorageSync("linkId");
    const modalStore = sheep_index.sheep.$store("modal");
    const authType = common_vendor.computed(() => modalStore.auth);
    const isActive = common_vendor.computed(() => modalStore.isActive);
    const state = common_vendor.reactive({
      protocol: false
    });
    const currentProtocol = common_vendor.ref(false);
    function onChange() {
      state.protocol = !state.protocol;
    }
    function onProtocol(title) {
      sheep_hooks_useModal.closeAuthModal();
      sheep_index.sheep.$router.go("/pages/public/richtext", {
        title
      });
    }
    function onConfirm(e) {
      currentProtocol.value = e;
      setTimeout(() => {
        currentProtocol.value = false;
      }, 1e3);
    }
    const thirdLogin = async (provider) => {
      if (!state.protocol) {
        currentProtocol.value = true;
        setTimeout(() => {
          currentProtocol.value = false;
        }, 1e3);
        sheep_index.sheep.$helper.toast("请勾选同意");
        return;
      }
      const loginRes = await sheep_index.sheep.$platform.useProvider(provider).login();
      if (loginRes) {
        sheep_hooks_useModal.closeAuthModal();
        sheep_hooks_useModal.showAuthModal("mpAuthorization");
      }
    };
    const thirdRegister = async (provider) => {
      if (!state.protocol) {
        currentProtocol.value = true;
        setTimeout(() => {
          currentProtocol.value = false;
        }, 1e3);
        sheep_index.sheep.$helper.toast("请勾选同意");
        return;
      }
      const linkId2 = common_vendor.index.getStorageSync("linkId");
      if (!linkId2) {
        sheep_index.sheep.$helper.toast("您只能通过分享注册");
        return false;
      }
      const loginRes = await sheep_index.sheep.$platform.useProvider(provider).register();
      if (loginRes) {
        sheep_hooks_useModal.closeAuthModal();
        sheep_hooks_useModal.showAuthModal("mpAuthorization");
      }
    };
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: ["smsLogin", "accountLogin", "register"].includes(authType.value)
      }, ["smsLogin", "accountLogin", "register"].includes(authType.value) ? common_vendor.e({
        b: common_vendor.n(isActive.value == "accountLogin" ? `head-title ss-m-r-40 head-title-animation` : `head-title-active ss-m-r-40`),
        c: common_vendor.o(($event) => {
          isActive.value = "accountLogin";
          common_vendor.unref(sheep_hooks_useModal.showAuthModal)("accountLogin", "accountLogin");
        }),
        d: common_vendor.n(isActive.value == "smsLogin" ? `head-title head-title-line head-title-animation ss-m-r-40` : ` ss-m-r-40 head-title-active head-title-line`),
        e: common_vendor.o(($event) => {
          isActive.value = "smsLogin";
          common_vendor.unref(sheep_hooks_useModal.showAuthModal)("smsLogin", "smsLogin");
        }),
        f: common_vendor.unref(linkId)
      }, common_vendor.unref(linkId) ? {
        g: common_vendor.n(isActive.value == "register" ? `head-title head-title-line head-title-animation` : `head-title-active head-title-line`),
        h: common_vendor.o(($event) => {
          isActive.value = "register";
          common_vendor.unref(sheep_hooks_useModal.showAuthModal)("register", "register");
        })
      } : {}) : {}, {
        i: ["smsLogin", "accountLogin", "register"].includes(authType.value)
      }, ["smsLogin", "accountLogin", "register"].includes(authType.value) ? {
        j: state.protocol,
        k: common_vendor.o(onChange),
        l: common_vendor.o(($event) => onProtocol("用户协议")),
        m: common_vendor.o(($event) => onProtocol("隐私协议")),
        n: common_vendor.o(onChange),
        o: currentProtocol.value ? 1 : ""
      } : {}, {
        p: ["accountLogin", "smsLogin"].includes(authType.value)
      }, ["accountLogin", "smsLogin"].includes(authType.value) ? common_vendor.e({
        q: ["WechatOfficialAccount", "WechatMiniProgram", "App"].includes(common_vendor.unref(sheep_index.sheep).$platform.name) && common_vendor.unref(sheep_index.sheep).$platform.isWechatInstalled
      }, ["WechatOfficialAccount", "WechatMiniProgram", "App"].includes(common_vendor.unref(sheep_index.sheep).$platform.name) && common_vendor.unref(sheep_index.sheep).$platform.isWechatInstalled ? {
        r: common_vendor.unref(sheep_index.sheep).$url.static("/static/images/wechat.png"),
        s: common_vendor.o(($event) => thirdLogin("wechat"))
      } : {}) : {}, {
        t: ["register"].includes(authType.value)
      }, ["register"].includes(authType.value) ? common_vendor.e({
        v: ["WechatOfficialAccount", "WechatMiniProgram", "App"].includes(common_vendor.unref(sheep_index.sheep).$platform.name) && common_vendor.unref(sheep_index.sheep).$platform.isWechatInstalled
      }, ["WechatOfficialAccount", "WechatMiniProgram", "App"].includes(common_vendor.unref(sheep_index.sheep).$platform.name) && common_vendor.unref(sheep_index.sheep).$platform.isWechatInstalled ? {
        w: common_vendor.unref(sheep_index.sheep).$url.static("/static/images/wechat.png"),
        x: common_vendor.o(($event) => thirdRegister("wechat"))
      } : {}) : {}, {
        y: authType.value === "officialAccountFirstLogin"
      }, authType.value === "officialAccountFirstLogin" ? {
        z: common_vendor.o(onConfirm),
        A: common_vendor.p({
          agreeStatus: state.protocol
        })
      } : {}, {
        B: authType.value === "accountLogin"
      }, authType.value === "accountLogin" ? {
        C: common_vendor.o(onConfirm),
        D: common_vendor.p({
          agreeStatus: state.protocol
        })
      } : {}, {
        E: authType.value === "smsLogin"
      }, authType.value === "smsLogin" ? {
        F: common_vendor.o(onConfirm),
        G: common_vendor.p({
          agreeStatus: state.protocol
        })
      } : {}, {
        H: authType.value === "register"
      }, authType.value === "register" ? {
        I: common_vendor.o(onConfirm),
        J: common_vendor.p({
          agreeStatus: state.protocol
        })
      } : {}, {
        K: authType.value === "resetPassword"
      }, authType.value === "resetPassword" ? {} : {}, {
        L: authType.value === "changeMobile"
      }, authType.value === "changeMobile" ? {} : {}, {
        M: authType.value === "changePassword"
      }, authType.value === "changePassword" ? {} : {}, {
        N: authType.value === "mpAuthorization"
      }, authType.value === "mpAuthorization" ? {} : {}, {
        O: common_vendor.o(common_vendor.unref(sheep_hooks_useModal.closeAuthModal)),
        P: common_vendor.p({
          show: authType.value !== "",
          round: "10",
          showClose: true
        })
      });
    };
  }
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-21181321"], ["__file", "D:/zx/mall-front-app/sheep/components/s-auth-modal/s-auth-modal.vue"]]);
wx.createComponent(Component);
