import { defineComponent as L, computed as d, reactive as u, markRaw as c, openBlock as p, createElementBlock as _, createElementVNode as m, toDisplayString as x, unref as s, Fragment as C, renderList as H, createBlock as D, resolveDynamicComponent as R, createVNode as B } from "vue";
import { U as z, n as U, a as y, E as V, e as $, p as N, b as A, c as F } from "./index-89cd84f1.mjs";
import "pinia";
import "dayjs";
const I = { class: "cds-auth__body" }, S = ["textContent"], T = { class: "cds-auth__form" }, j = { class: "cds-auth__action" }, O = /* @__PURE__ */ L({
  __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(h, { emit: v }) {
    const b = h, l = d(() => b.lang), o = d(() => b.disabled), g = u({
      disabled: o.value,
      card: !1,
      inline: !1,
      iconEnd: !0,
      size: "large"
    }), r = u([
      {
        icon: z,
        validate: U,
        iconEnd: !1,
        label: l.value.nameLabel,
        hint: l.value.nameHint,
        params: { autocomplete: "name" },
        required: !0,
        key: "display_name",
        value: "",
        component: c(y)
      },
      {
        icon: V,
        validate: $,
        iconEnd: !1,
        label: l.value.emailLabel,
        hint: l.value.emailHint,
        params: { autocomplete: "email", type: "email" },
        required: !0,
        key: "email",
        value: "",
        component: c(y)
      },
      {
        icon: null,
        validate: N,
        iconEnd: !1,
        label: l.value.passwordLabel,
        hint: l.value.passwordHint,
        type: null,
        params: { autocomplete: "current-password" },
        required: !0,
        key: "password",
        value: "",
        component: c(A)
      }
    ]), i = u({
      email: { value: "", valid: !1 },
      password: { value: "", valid: !1 }
    }), k = d(() => {
      let t = [];
      for (let a in i)
        t = [...t, i[a].valid];
      return t.every((a) => a);
    }), f = (t) => {
      const { key: a, valid: e, value: n } = t;
      if (!a)
        return;
      const w = r.findIndex((q) => q.key === a);
      r[w].value = n, i[a] = { value: n, valid: e }, e && v("update", { key: a, valid: e, value: n });
    }, E = () => v("register", i);
    return (t, a) => (p(), _("div", I, [
      m("div", {
        class: "cds-auth__title",
        textContent: x(s(l).title)
      }, null, 8, S),
      m("div", T, [
        (p(!0), _(C, null, H(r, (e) => (p(), D(R(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: s(o),
          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) => f(n)),
          onUpdateData: a[1] || (a[1] = (n) => f(n))
        }, null, 40, ["base", "decorations", "disabled", "hint", "icon", "label", "name", "params", "required", "validate", "value"]))), 256))
      ]),
      m("div", j, [
        B(F, {
          disabled: !s(k) || s(o),
          fill: !0,
          label: s(l).submit,
          color: "success",
          size: "large",
          type: "submit",
          onClick: E
        }, null, 8, ["disabled", "label"])
      ])
    ]));
  }
});
export {
  O as default
};
//# sourceMappingURL=AuthRegister-56af8076.mjs.map
