var e = require("../../common/vendor.js"),
  n = require("../../hooks/onMounted.js"),
  u = require("../../hooks/onShareAppMessage.js"),
  t = require("../../hooks/useState.js"),
  a = require("../../enums/index.js"),
  r = require("../../constant/index.js"),
  o = require("../../data/index.js"),
  i = require("../../utils/navigate.js"),
  l = require("../../utils/util.js"),
  v = require("../../utils/common.js");
require("../../service/index.js"),
  require("../../utils/request.js"),
  require("../../config/index.js"),
  require("../../store/app/index.js"),
  Array || e.resolveComponent("uni-data-select")();
Math ||
  (
    e.unref(p) +
    function () {
      return "../../uni_modules/uni-data-select/components/uni-data-select/uni-data-select.js";
    } +
    e.unref(c) +
    e.unref(y) +
    e.unref(d) +
    e.unref(m) +
    e.unref(h) +
    e.unref(f) +
    e.unref(s)
  )();
var s = function () {
    return "../../components/popup-copy-vin/index.js";
  },
  c = function () {
    return "../../components/agreement/index.js";
  },
  f = function () {
    return "../../components/keyboard/index.js";
  },
  d = function () {
    return "../../components/divider/index.js";
  },
  p = function () {
    return "../../components/tips/index.js";
  },
  y = function () {
    return "../../components/prompt/index.js";
  },
  m = function () {
    return "../../components/float-back-to-top/index.js";
  },
  h = function () {
    return "../../components/float-share/index.js";
  },
  E = {
    __name: "index",
    setup: function (s) {
      var c = t.useState().showAgreementPopup,
        f = e.ref(!0),
        d = e.ref(""),
        p = e.ref("02"),
        y = e.ref(a.QueryTypeEnum.VIN),
        m = e.ref(!1),
        h = e.ref(""),
        E = e.ref(!1),
        T = e.ref(["", "", "", "", "", "", "", ""]),
        g = e.ref(0),
        x = e.ref(!1),
        j = e.ref(a.KeyboardEnum.AREA),
        I = e.ref(!1),
        b = e.ref(""),
        N = e.ref(!1),
        V = function () {
          var e = c.value || I.value;
          return "height: 100%; overflow: "
            .concat(e ? "hidden" : "visible", "; position: ")
            .concat(e ? "fixed" : "relative");
        },
        q = function () {
          i.navigateTo({ url: "/pages/vin-info/index" });
        },
        _ = function (e) {
          (y.value = e.detail.value),
            e.detail.value === a.QueryTypeEnum.VIN
              ? ((E.value = !0), (x.value = !1))
              : ((E.value = !1), (x.value = !0));
        },
        k = function () {
          h.value = "";
        },
        A = function () {
          v.ocrIdentifyVin().then(function (e) {
            h.value = e;
          });
        },
        C = function () {
          E.value = !0;
        },
        Q = function () {
          E.value = !1;
        },
        w = function (e) {
          h.value = e.value;
        },
        L = function () {
          x.value = !1;
        },
        H = function (e) {
          e.keyboardType
            ? (j.value = e.keyboardType)
            : ((T.value = e.value), (g.value = e.index));
        },
        S = function () {
          j.value =
            j.value === a.KeyboardEnum.AREA
              ? a.KeyboardEnum.ABC
              : a.KeyboardEnum.AREA;
        },
        K = function () {
          m.value = !m.value;
        },
        M = function () {
          I.value = !1;
        },
        O = function () {
          (h.value = b.value), (I.value = !1), P();
        },
        P = function () {
          (E.value = !1), (x.value = !1);
          var e = T.value.join("");
          if (m.value) {
            if (y.value === a.QueryTypeEnum.VIN) {
              if (0 === h.value.length)
                return void l.showToast("请输入VIN车架号");
              if (h.value.length < 17)
                return void l.showToast("请输入完整的VIN车架号");
            }
            y.value !== a.QueryTypeEnum.VEHICLE_NO || r.vehicleNoExp.test(e)
              ? p.value
                ? i.navigateTo({
                    url: "/pages/order-confirm/index",
                    params: {
                      productType: a.ProductTypeEnum.SALI_CHECK,
                      queryType: y.value,
                      vehicleType: p.value,
                      vin: h.value,
                      vehicleNo: e,
                    },
                  })
                : l.showToast("请选择车辆类型")
              : l.showToast("请输入正确的车牌");
          } else l.showToast("请先阅读并同意协议");
        };
      return (
        n.onMounted(function (n) {
          e.index.setNavigationBarTitle({ title: n.title }),
            v.hasClickAgreement() &&
              e.index.getClipboardData().then(function (n) {
                var u = n.data;
                e.index.hideToast(),
                  17 === u.trim().length &&
                    setTimeout(function () {
                      (b.value = u.trim()), (I.value = !0);
                    }, 300);
              }),
            (d.value = n.title),
            (f.value = !1),
            l.hideLoading();
        }),
        e.onPageScroll(function (n) {
          var u = n.scrollTop;
          N.value = u >= e.index.getSystemInfoSync().windowHeight / 3;
        }),
        u.onShareAppMessage(),
        function (n, u) {
          return e.e(
            { a: V(), b: !f.value },
            f.value
              ? {}
              : e.e(
                  {
                    c: e.t(d.value),
                    d: e.o(q),
                    e: e.unref(a.QueryTypeEnum).VIN,
                    f: y.value === e.unref(a.QueryTypeEnum).VIN,
                    g: e.unref(a.QueryTypeEnum).VEHICLE_NO,
                    h: y.value === e.unref(a.QueryTypeEnum).VEHICLE_NO,
                    i: e.o(_),
                    j: y.value === e.unref(a.QueryTypeEnum).VIN,
                  },
                  y.value === e.unref(a.QueryTypeEnum).VIN
                    ? e.e(
                        { k: 0 === h.value.length },
                        (h.value.length, {}),
                        { l: e.t(h.value), m: e.o(C), n: h.value.length > 0 },
                        h.value.length > 0 ? { o: e.o(k) } : {},
                        {
                          p: e.t(h.value.length),
                          q: e.o(A),
                          r: h.value.length > 0 ? 1 : "",
                        }
                      )
                    : {},
                  { s: y.value === e.unref(a.QueryTypeEnum).VEHICLE_NO },
                  y.value === e.unref(a.QueryTypeEnum).VEHICLE_NO
                    ? {
                        t: e.f(T.value, function (n, u, t) {
                          return e.e(
                            {
                              a: e.t(n),
                              b: u === g.value ? 1 : "",
                              c: 7 === u,
                            },
                            {},
                            {
                              d: u,
                              e: 7 === u ? 1 : "",
                              f: e.o(function (e) {
                                return (function (e) {
                                  (g.value = e), (x.value = !0);
                                })(u);
                              }, u),
                            }
                          );
                        }),
                      }
                    : {},
                  {
                    v: e.o(function (e) {
                      return (p.value = e);
                    }),
                    w: e.p({
                      localdata: e.unref(r.vehicleTypeList),
                      modelValue: p.value,
                    }),
                    x: e.o(P),
                    y: e.o(K),
                    z: e.p({ checked: m.value }),
                    A: e.f(e.unref(o.mockSaliCheckList), function (n, u, t) {
                      return {
                        a: e.t(n.label),
                        b: e.t(n.value),
                        c: u,
                        d:
                          (y.value === e.unref(a.QueryTypeEnum).VEHICLE_NO &&
                            1 === u) ||
                          (y.value === e.unref(a.QueryTypeEnum).VIN && 0 === u)
                            ? "none"
                            : "",
                      };
                    }),
                    B: e.t(e.unref(r.disclaimer)),
                    C: e.p({ visible: N.value }),
                    D: e.o(L),
                    E: e.o(H),
                    F: e.o(S),
                    G: e.p({
                      visible: x.value,
                      "can-switch": !0,
                      "keyboard-type": j.value,
                      "vehicle-no-list": T.value,
                      "vehicle-no-index": g.value,
                    }),
                    H: e.o(Q),
                    I: e.o(w),
                    J: e.p({
                      visible: E.value,
                      "can-switch": !1,
                      vin: h.value,
                    }),
                    K: e.o(O),
                    L: e.o(M),
                    M: e.p({ visible: I.value, "copy-vin": b.value }),
                  }
                )
          );
        }
      );
    },
  },
  T = e._export_sfc(E, [["__scopeId", "data-v-b545ddc3"]]);
(E.__runtimeHooks = 3), wx.createPage(T);
