import { defineComponent as $, inject as C, ref as m, reactive as k, resolveComponent as a, openBlock as f, createElementBlock as g, createVNode as e, withCtx as n, createElementVNode as h, createTextVNode as v, toDisplayString as u, createCommentVNode as N } from "vue";
import { u as R, b as q, e as E, _ as F } from "./index-597e6e44.mjs";
const L = { class: "login-container" }, z = { class: "login-form" }, B = {
  key: 0,
  style: { color: "var(--el-color-error)" }
}, D = /* @__PURE__ */ $({
  __name: "index",
  setup(P) {
    const d = C("globalContext"), p = m(), t = k({
      username: "",
      password: ""
    }), i = m(!1), b = R();
    function w() {
      p.value.validate((o) => {
        i.value = !1, o && E(d, t).then(() => {
          var l;
          b.push(((l = d.router.currentRoute.value.query) == null ? void 0 : l.redirect) || "/");
        }).catch((l) => {
          console.log(l), i.value = !0;
        });
      });
    }
    return (o, l) => {
      const c = a("lc-icon"), _ = a("el-input"), r = a("el-form-item"), y = a("el-button"), V = a("el-form"), x = a("dvi");
      return f(), g("div", L, [
        e(x, { class: "login-area" }, {
          default: n(() => [
            h("div", z, [
              h("h2", null, [
                v(u(o.$t("_.plugin.login.title")) + " ", 1),
                e(q, { style: { "line-height": "32px", "margin-left": "8px" } })
              ]),
              e(V, {
                ref_key: "loginFormRef",
                ref: p,
                model: t,
                size: "large",
                "label-position": "top"
              }, {
                default: n(() => [
                  e(r, {
                    prop: "username",
                    label: o.$t("_.plugin.login.username"),
                    required: ""
                  }, {
                    default: n(() => [
                      e(_, {
                        clearable: "",
                        modelValue: t.username,
                        "onUpdate:modelValue": l[0] || (l[0] = (s) => t.username = s),
                        placeholder: o.$t("_.plugin.login.usernamePlaceholder")
                      }, {
                        prefix: n(() => [
                          e(c, { icon: "mdiAccount" })
                        ]),
                        _: 1
                      }, 8, ["modelValue", "placeholder"])
                    ]),
                    _: 1
                  }, 8, ["label"]),
                  e(r, {
                    prop: "password",
                    label: o.$t("_.plugin.login.password"),
                    required: ""
                  }, {
                    default: n(() => [
                      e(_, {
                        clearable: "",
                        "show-password": "",
                        modelValue: t.password,
                        "onUpdate:modelValue": l[1] || (l[1] = (s) => t.password = s),
                        placeholder: o.$t("_.plugin.login.passwordPlaceholder")
                      }, {
                        prefix: n(() => [
                          e(c, { icon: "mdiLock" })
                        ]),
                        _: 1
                      }, 8, ["modelValue", "placeholder"])
                    ]),
                    _: 1
                  }, 8, ["label"]),
                  e(r, null, {
                    default: n(() => [
                      e(y, {
                        size: "large",
                        type: "primary",
                        style: { width: "100%" },
                        onClick: w
                      }, {
                        default: n(() => [
                          v(u(o.$t("_.plugin.login.login")), 1)
                        ]),
                        _: 1
                      })
                    ]),
                    _: 1
                  }),
                  e(r, null, {
                    default: n(() => [
                      i.value ? (f(), g("span", B, u(o.$t("_.plugin.login.loginFail")), 1)) : N("", !0)
                    ]),
                    _: 1
                  })
                ]),
                _: 1
              }, 8, ["model"])
            ])
          ]),
          _: 1
        })
      ]);
    };
  }
});
const A = /* @__PURE__ */ F(D, [["__scopeId", "data-v-9aff7205"]]);
export {
  A as default
};
