import { defineComponent as q, computed as r, reactive as d, markRaw as u, openBlock as c, createElementBlock as f, createElementVNode as p, toDisplayString as L, Fragment as x, renderList as H, createBlock as C, resolveDynamicComponent as D, createVNode as R } from "vue";
import { U as B, n as $, a as _, E as z, e as U, p as V, b as N, c as T } from "./index-70037f84.mjs";
import "pinia";
import "dayjs";
const A = { class: "cds-auth__body" }, F = ["textContent"], I = { class: "cds-auth__form" }, S = { class: "cds-auth__action" }, M = /* @__PURE__ */ q({
  __name: "AuthRegister",
  props: {
    disabled: { type: Boolean, default: !1 },
    lang: { default: {
      title: "Регистрация",
      submit: "Зарегистрироваться",
      nameLabel: "Как Вас будут называть люди?",
      nameHint: "Семен Семеныч",
      emailLabel: "Email",
      emailHint: "name@company.org",
      passwordLabel: "Пароль",
      passwordHint: "оЧеньсЛожНыйПароЛь"
    } }
  },
  emits: ["update", "register"],
  setup(y, { emit: v }) {
    const m = y, l = r(() => m.lang), i = r(() => m.disabled), g = d({
      disabled: i.value,
      card: !1,
      inline: !1,
      iconEnd: !0,
      size: "large"
    }), o = d([
      {
        icon: B,
        validate: $,
        iconEnd: !1,
        label: l.value.nameLabel,
        hint: l.value.nameHint,
        params: { autocomplete: "name" },
        required: !0,
        key: "display_name",
        value: "",
        component: u(_)
      },
      {
        icon: z,
        validate: U,
        iconEnd: !1,
        label: l.value.emailLabel,
        hint: l.value.emailHint,
        params: { autocomplete: "email", type: "email" },
        required: !0,
        key: "email",
        value: "",
        component: u(_)
      },
      {
        icon: null,
        validate: V,
        iconEnd: !1,
        label: l.value.passwordLabel,
        hint: l.value.passwordHint,
        type: null,
        params: { autocomplete: "current-password" },
        required: !0,
        key: "password",
        value: "",
        component: u(N)
      }
    ]), s = d({
      email: { value: "", valid: !1 },
      password: { value: "", valid: !1 }
    }), h = r(() => {
      let t = [];
      for (let a in s)
        t = [...t, s[a].valid];
      return t.every((a) => a);
    }), b = (t) => {
      const { key: a, valid: e, value: n } = t;
      if (!a)
        return;
      const E = o.findIndex((w) => w.key === a);
      o[E].value = n, s[a] = { value: n, valid: e }, e && v("update", { key: a, valid: e, value: n });
    }, k = () => v("register", s);
    return (t, a) => (c(), f("div", A, [
      p("div", {
        class: "cds-auth__title",
        textContent: L(l.value.title)
      }, null, 8, F),
      p("div", I, [
        (c(!0), f(x, null, H(o, (e) => (c(), C(D(e.component), {
          base: {
            key: e.key,
            autocapitalizationType: !1,
            hint: e.hint,
            icon: e.icon,
            label: e.label,
            required: e.required,
            validate: e.validate,
            value: e.value
          },
          decorations: g,
          disabled: i.value,
          hint: e.hint,
          icon: e.icon,
          iconEnd: !0,
          inline: !1,
          label: e.label,
          name: e.key,
          params: e.params,
          required: e.required,
          validate: e.validate,
          value: e.value,
          onChangeData: a[0] || (a[0] = (n) => b(n)),
          onUpdateData: a[1] || (a[1] = (n) => b(n))
        }, null, 40, ["base", "decorations", "disabled", "hint", "icon", "label", "name", "params", "required", "validate", "value"]))), 256))
      ]),
      p("div", S, [
        R(T, {
          disabled: !h.value || i.value,
          fill: !0,
          label: l.value.submit,
          color: "success",
          size: "large",
          type: "submit",
          onTap: a[2] || (a[2] = (e) => k())
        }, null, 8, ["disabled", "label"])
      ])
    ]));
  }
});
export {
  M as default
};
//# sourceMappingURL=AuthRegister-cc5ab097.mjs.map
