var e = require("../../common/vendor.js"),
  n = require("../../hooks/onMounted.js"),
  u = require("../../hooks/onShareAppMessage.js"),
  t = require("../../hooks/useState.js"),
  i = require("../../enums/index.js"),
  o = require("../../constant/index.js"),
  r = require("../../data/index.js"),
  a = require("../../utils/navigate.js"),
  l = require("../../utils/util.js"),
  s = require("../../utils/common.js"),
  v = require("../../utils/vin.js");
require("../../service/index.js"),
  require("../../utils/request.js"),
  require("../../config/index.js"),
  require("../../store/app/index.js"),
  Math ||
    (
      e.unref(h) +
      e.unref(f) +
      e.unref(m) +
      e.unref(p) +
      e.unref(g) +
      e.unref(x) +
      e.unref(d) +
      e.unref(c)
    )();
var c = function () {
    return "../../components/popup-copy-vin/index.js";
  },
  f = function () {
    return "../../components/agreement/index.js";
  },
  d = function () {
    return "../../components/keyboard/index.js";
  },
  p = function () {
    return "../../components/divider/index.js";
  },
  h = function () {
    return "../../components/tips/index.js";
  },
  m = function () {
    return "../../components/prompt/index.js";
  },
  g = function () {
    return "../../components/float-back-to-top/index.js";
  },
  x = function () {
    return "../../components/float-share/index.js";
  },
  j = {
    __name: "index",
    setup: function (c) {
      var f = t.useState().showAgreementPopup,
        d = e.ref(!0),
        p = e.ref(""),
        h = e.ref(i.QueryTypeEnum.VIN),
        m = e.ref(!1),
        g = e.ref(""),
        x = e.ref(!1),
        j = e.ref(0),
        q = e.ref(!1),
        y = e.ref(""),
        T = e.ref(!1),
        b = function () {
          var e = f.value || q.value;
          return "height: 100%; overflow: "
            .concat(e ? "hidden" : "visible", "; position: ")
            .concat(e ? "fixed" : "relative");
        },
        w = function () {
          a.navigateTo({ url: "/pages/vin-info/index" });
        },
        k = function () {
          g.value = "";
        },
        I = function () {
          s.ocrIdentifyVin().then(function (e) {
            g.value = e;
          });
        },
        S = function () {
          x.value = !0;
        },
        _ = function () {
          x.value = !1;
        },
        A = function (e) {
          g.value = e.value;
        },
        N = function () {
          m.value = !m.value;
        },
        V = function () {
          q.value = !1;
        },
        M = function () {
          (g.value = y.value), (q.value = !1), P();
        },
        P = function () {
          if (((x.value = !1), m.value)) {
            if (h.value === i.QueryTypeEnum.VIN) {
              if (0 === g.value.length)
                return void l.showToast("请输入VIN车架号");
              if (g.value.length < 17)
                return void l.showToast("请输入完整的VIN车架号");
              if (!v.validateVIN(g.value))
                return void l.showToast("车架号有误，请检查后重新输入");
            }
            a.navigateTo({
              url: "/pages/order-confirm/index",
              params: {
                productType: i.ProductTypeEnum.SALI,
                queryType: h.value,
                vin: g.value,
              },
            });
          } else l.showToast("请先阅读并同意协议");
        };
      return (
        n.onMounted(function (n) {
          e.index.setNavigationBarTitle({ title: n.title }),
            s.hasClickAgreement() &&
              e.index.getClipboardData().then(function (n) {
                var u = n.data;
                e.index.hideToast(),
                  17 === u.trim().length &&
                    setTimeout(function () {
                      (y.value = u.trim()), (q.value = !0);
                    }, 300);
              }),
            (p.value = n.title),
            (d.value = !1),
            l.hideLoading();
        }),
        e.onPageScroll(function (n) {
          var u = n.scrollTop;
          T.value = u >= e.index.getSystemInfoSync().windowHeight / 3;
        }),
        u.onShareAppMessage(),
        function (n, u) {
          return e.e(
            { a: b(), b: !d.value },
            d.value
              ? {}
              : e.e(
                  { c: e.t(p.value), d: e.o(w), e: 0 === g.value.length },
                  (g.value.length, {}),
                  { f: e.t(g.value), g: e.o(S), h: g.value.length > 0 },
                  g.value.length > 0 ? { i: e.o(k) } : {},
                  {
                    j: e.t(g.value.length),
                    k: e.o(I),
                    l: g.value.length > 0 ? 1 : "",
                    m: e.o(P),
                    n: e.o(N),
                    o: e.p({ checked: m.value }),
                    p: e.f(["车辆在保", "车辆脱保"], function (n, u, t) {
                      return {
                        a: e.t(n),
                        b: e.n(j.value === u ? "active" : ""),
                        c: u,
                        d: e.o(function (e) {
                          return (function (e) {
                            j.value = e;
                          })(u);
                        }, u),
                      };
                    }),
                    q: 0 === j.value,
                  },
                  0 === j.value
                    ? {
                        r: e.f(e.unref(r.mockSaliList), function (n, u, t) {
                          return { a: e.t(n.label), b: e.t(n.value), c: u };
                        }),
                      }
                    : {},
                  { s: 1 === j.value },
                  (j.value, {}),
                  {
                    t: e.t(e.unref(o.disclaimer)),
                    v: e.p({ visible: T.value }),
                    w: e.o(_),
                    x: e.o(A),
                    y: e.p({
                      visible: x.value,
                      "can-switch": !1,
                      vin: g.value,
                    }),
                    z: e.o(M),
                    A: e.o(V),
                    B: e.p({ visible: q.value, "copy-vin": y.value }),
                  }
                )
          );
        }
      );
    },
  },
  q = e._export_sfc(j, [["__scopeId", "data-v-8a3351c6"]]);
(j.__runtimeHooks = 3), wx.createPage(q);
