import { defineComponent as _, computed as d, reactive as r, markRaw as z, openBlock as c, createElementBlock as b, createElementVNode as u, toDisplayString as O, Fragment as Z, renderList as C, createBlock as N, resolveDynamicComponent as T, createVNode as J } from "vue";
import { E as Q, e as D, a as V, c as Y } from "./index-48897deb.mjs";
import "pinia";
import "dayjs";
const E = { class: "cds-auth__body" }, W = ["textContent"], X = { class: "cds-auth__form" }, j = { class: "cds-auth__action" }, S = /* @__PURE__ */ _({
  __name: "AuthRecover",
  props: {
    disabled: { type: Boolean, default: !1 },
    lang: { default: {
      title: "Напомнить пароль",
      submit: "Отправить инструкцию",
      emailLabel: "Email",
      emailHint: "name@company.org",
      passwordLabel: "Пароль",
      passwordHint: "оЧеньсЛожНыйПароЛь"
    } }
  },
  emits: ["update", "recover"],
  setup(h, { emit: p }) {
    const v = h, i = d(() => v.lang), n = d(() => v.disabled), y = r({
      disabled: n.value,
      card: !1,
      inline: !1,
      iconEnd: !0,
      size: "large"
    }), o = r([
      {
        icon: Q,
        validate: D,
        iconEnd: !1,
        label: i.value.emailLabel,
        hint: i.value.emailHint,
        params: { autocomplete: "email", type: "email" },
        required: !0,
        key: "email",
        value: "",
        component: z(V)
      }
    ]), s = r({
      email: { value: "", valid: !1 },
      password: { value: "", valid: !1 }
    }), f = d(() => {
      let t = [];
      for (let a in s)
        t = [...t, s[a].valid];
      return t.every((a) => a);
    }), m = (t) => {
      const { key: a, valid: e, value: l } = t;
      if (!a)
        return;
      const g = o.findIndex((k) => k.key === a);
      o[g].value = l, s[a] = { value: l, valid: e }, e && p("update", { key: a, valid: e, value: l });
    }, L = () => p("recover", s), I = async (t) => (await fetch("https://b.docsme.ru/storage/o/public/test/text.png", {
      method: "POST",
      headers: {
        "Content-Type": "multipart/form-data",
        Authorization: "Bearer eyJhbGciOiJIUzI1NiJ9.eyJodHRwczovL2hhc3VyYS5pby9qd3QvY2xhaW1zIjp7IngtaGFzdXJhLXVzZXItaWQiOiI4NzE3ZTBlMi1mMTk2LTRmZmUtOTU5ZC03NTdkOGY5ZDllOWYiLCJ4LWhhc3VyYS1hbGxvd2VkLXJvbGVzIjpbInVzZXIiLCJtZSIsImVkaXRvciJdLCJ4LWhhc3VyYS1kZWZhdWx0LXJvbGUiOiJlZGl0b3IiLCJ4LWhhc3VyYS1kaXNwbGF5LW5hbWUiOiLQktCw0LvQtdGA0LjQuSDQldC90LjQutC10LXQsiIsIngtaGFzdXJhLWNvbXBhbnktaWQiOiI3MjgxMTM5Mi0yYzEzLTRmNzYtYjdiMy1iYjY1Zjg1MDdlODkifSwic3ViIjoiODcxN2UwZTItZjE5Ni00ZmZlLTk1OWQtNzU3ZDhmOWQ5ZTlmIiwiaXNzIjoibmhvc3QiLCJpYXQiOjE2NzEyODU2ODQsImV4cCI6MTY3MTI5Mjg4NH0.QLyyVdMuzMN0T_4Dc-ZDRcNCdPoIPKsgbsXlrPO9EYQ"
      },
      body: JSON.stringify({
        file: t,
        bucketId: "pub"
      })
    }), {
      success: 1,
      file: {
        url: "https://b.docsme.ru/storage/o/public/app/logo.svg",
        id: "2345234523",
        width: 1e3,
        height: 1e3
      }
    });
    return (t, a) => (c(), b("div", E, [
      u("div", {
        class: "cds-auth__title",
        textContent: O(i.value.title)
      }, null, 8, W),
      u("div", X, [
        (c(!0), b(Z, null, C(o, (e) => (c(), N(T(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,
            uploader: I
          },
          decorations: y,
          disabled: n.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] = (l) => m(l)),
          onUpdateData: a[1] || (a[1] = (l) => m(l))
        }, null, 40, ["base", "decorations", "disabled", "hint", "icon", "label", "name", "params", "required", "validate", "value"]))), 256))
      ]),
      u("div", j, [
        J(Y, {
          disabled: !f.value || n.value,
          fill: !0,
          label: i.value.submit,
          color: "success",
          size: "large",
          type: "submit",
          onTap: a[2] || (a[2] = (e) => L())
        }, null, 8, ["disabled", "label"])
      ])
    ]));
  }
});
export {
  S as default
};
//# sourceMappingURL=AuthRecover-f16ac4a6.mjs.map
