import { w as createSvgIcon, j as jsxRuntimeExports, u as useAtomValue, a as appConfig, B as Button, e as Grow, G as Grid, x as Grid2, t as React, b as axios, T as Tooltip, I as IconButton, R as RefreshIcon, y as styled, z as currentTheme, q as useNavigate, r as reactExports, E as useAtom, J as isAuthorized, K as hideSnow, M as hasURLparam, N as getURLparam, P as createCokies, Q as removeParam, U as enterSmeta, V as isEmptyObject, W as updateStatesAfterEnter, X as updateOptionsForUser, Y as clearUrl, Z as getUrlSearh, C as Container, c as CssBaseline, d as Box, A as Autocomplete, h as FormHelperText, D as Dialog, F as FormControl, f as InputLabel, O as OutlinedInput, g as InputAdornment, L as Link, _ as TextField, $ as getOptionsForUser, a0 as smetaStore, v as renderMessageBox, l as DialogContent, a1 as DialogTitle, a2 as DialogActions, S as Slide } from "./index-D15x63tD.js";
const Visibility = createSvgIcon(/* @__PURE__ */ jsxRuntimeExports.jsx("path", {
  d: "M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"
}), "Visibility");
const VisibilityOff = createSvgIcon(/* @__PURE__ */ jsxRuntimeExports.jsx("path", {
  d: "M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7M2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2m4.31-.78 3.15 3.15.02-.16c0-1.66-1.34-3-3-3z"
}), "VisibilityOff");
function EsiaButton() {
  var _a, _b;
  const config = useAtomValue(appConfig);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Button,
    {
      style: {
        borderColor: "#3c5b77",
        textTransform: "none",
        color: "#3c5b77",
        height: "56px"
      },
      type: "submit",
      fullWidth: true,
      variant: "outlined",
      sx: { mt: 3, mb: 2 },
      startIcon: (
        // <img
        //   src={GosUslugiLogo}
        //   style={{ marginLeft: "", height: "24px" }}
        // />
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          "img",
          {
            style: { marginLeft: "", height: "39px" },
            alt: "",
            src: "data:image/svg+xml;base64, "
          }
        )
      ),
      href: (_b = (_a = config.lk) == null ? void 0 : _a.doEsia) == null ? void 0 : _b.auth,
      children: "Войти через Госуслуги"
    }
  );
}
const LinkSupport = ({ org }) => {
  var _a;
  const config = useAtomValue(appConfig);
  if (!org && ((_a = config.lk.linkOnSignInPage) == null ? void 0 : _a.linkText)) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(Grow, { in: true, timeout: 380, style: { transformOrigin: "0 0 0" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { container: true, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "a",
      {
        className: "LinkLK",
        style: { cursor: "pointer" },
        onClick: () => {
          var _a2;
          if ((_a2 = config.lk.linkOnSignInPage) == null ? void 0 : _a2.link) window.open(config.lk.linkOnSignInPage.link);
        },
        children: config.lk.linkOnSignInPage.linkText
      }
    ) }) }) });
  } else {
    return null;
  }
};
const MobileQR = () => {
  const config = useAtomValue(appConfig);
  if (config.lk.showMobileQR) {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid2, { container: true, direction: "column", sx: { alignItems: "center", mt: 1 }, children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        "img",
        {
          src: "rustoreLoad.png",
          style: {
            borderRadius: "5% 5% 0 0",
            width: "53%"
          }
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Grid2,
        {
          style: {
            color: "#1e6bb8",
            width: "80%",
            textAlign: "center"
          },
          children: "Наведите камеру, чтобы установить приложение с помощью Rustore."
        }
      )
    ] });
  } else {
    return null;
  }
};
function Captha(props) {
  const config = useAtomValue(appConfig);
  const [captcha, setCaptcha] = React.useState("");
  const [DataCaptcha, setDataCapctha] = React.useState({
    passed: config.lk.baseCaptcha === "0" ? true : false,
    color: ""
  });
  React.useEffect(() => {
    getCaptha();
  }, []);
  const getCaptha = (color) => {
    axios.get(config.lk.url.captcha).then((res) => {
      setCaptcha("");
      setDataCapctha({
        img: "data:image/gif;base64," + res.data.RCDATA,
        ident: res.data.ident,
        passed: false,
        color: color ? color : ""
      });
    });
  };
  const sendCaptha = () => {
    axios.get(`${config.lk.url.captcha}?ident=${DataCaptcha.ident}&check=${captcha}`).then((res) => {
      if (res.data.result === "1") {
        setDataCapctha({ ...DataCaptcha, passed: true, color: "Успешно." });
        props.setCaptcha(true);
      } else {
        getCaptha("Повторите ещё раз.");
        if (props.setCount) props.setCount(props.count + 1);
      }
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, xs: 10, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Grid,
    {
      container: true,
      direction: "column",
      justifyContent: "center",
      alignItems: "center",
      spacing: 1,
      style: {
        borderStyle: "solid",
        borderWidth: "1px",
        borderRadius: "4px",
        borderColor: "rgb(60, 91, 119)"
      },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, style: { width: "100%", backgroundColor: "rgb(60, 91, 119)" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          "img",
          {
            src: DataCaptcha.img,
            style: {
              borderStyle: "solid",
              borderWidth: "1px",
              borderColor: "rgb(236, 236, 236)",
              width: "97%"
            }
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { container: true, direction: "row", justifyContent: "center", alignItems: "center", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { title: "Обновить текст на картинке", placement: "left", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            IconButton,
            {
              onClick: () => {
                getCaptha();
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefreshIcon, { fontSize: "small" })
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, sx: { pb: 1, pt: 1 }, style: { width: "179px" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            CssTextField,
            {
              size: "small",
              id: "captha",
              name: "captha",
              value: captcha,
              sx: { ".MuiInputLabel-outlined": { fontSize: "12px" } },
              label: "Введите текст с картинки",
              helperText: DataCaptcha.color,
              onChange: (e) => {
                setCaptcha(e.target.value);
              }
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Grid,
            {
              item: true,
              sx: { p: 1 },
              style: {
                display: "flex",
                justifyContent: "center"
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  style: {
                    backgroundColor: "#3c5b77",
                    textTransform: "none"
                  },
                  size: "small",
                  variant: "contained",
                  onClick: sendCaptha,
                  children: "Отправить"
                }
              )
            }
          )
        ] })
      ]
    }
  ) });
}
reactExports.forwardRef(function Transition2(props, ref) {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Slide, { direction: "up", ref, ...props });
});
const CssTextField = styled(TextField)({
  "& label.Mui-focused": {
    color: "#3c5b77"
  },
  "& .MuiOutlinedInput-root": {
    "&.Mui-focused fieldset": {
      borderColor: "#3c5b77"
    }
  }
});
function WhereNavigate() {
  var _a, _b;
  if (((_a = getOptionsForUser()) == null ? void 0 : _a.from) && ((_b = getOptionsForUser()) == null ? void 0 : _b.from) === "lk" && smetaStore.get(appConfig).smeta.hideEnter === void 0) {
    return "/lk";
  } else {
    return "/";
  }
}
function SignInLK() {
  var _a, _b;
  const config = useAtomValue(appConfig);
  useAtomValue(currentTheme);
  const navigate = useNavigate();
  document.title = config.lk.titleText ? config.lk.titleText : "Вход";
  const pattern = new RegExp(
    /^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i
  );
  const [error, setError] = reactExports.useState("");
  const url = (_a = config.lk.url) == null ? void 0 : _a.signIn;
  const urlRestore = (_b = config.lk.url) == null ? void 0 : _b.restorePassword;
  const [showpassword, setShowPassword] = reactExports.useState(false);
  const [infoTextForModal, setInfoTextForModal] = reactExports.useState("");
  const [modalContent, setModalContent] = reactExports.useState("0");
  const [open, setOpen] = reactExports.useState(false);
  const [emailRestore, setEmailRestore] = reactExports.useState("");
  const [action, setAction] = reactExports.useState("");
  const [org, setOrg] = reactExports.useState();
  const [selectOrg, setSelectOrg] = reactExports.useState();
  const [message, setMessage] = reactExports.useState({
    message: "",
    color: "green"
  });
  const [count, setCount] = reactExports.useState(0);
  const [isSessionActive, setIsSessionActive] = useAtom(isAuthorized);
  const [isRequestLoading, setIsRequestLoading] = reactExports.useState(false);
  const checkSessionAndEnter = async () => {
    if (isSessionActive === true) {
      navigate(`main` + getUrlSearh());
    }
  };
  reactExports.useEffect(() => {
    hideSnow(true);
    if (hasURLparam("Guid")) {
      sessionStorage.setItem("LicG", getURLparam("Guid"));
      createCokies("LicG", getURLparam("Guid"));
      signInInSmeta({ stimwebsrv: getURLparam("stimWebSrv"), authed_by: getURLparam("authed_by") });
    }
    checkSessionAndEnter();
    if (hasURLparam("OidEsia")) {
      console.log("UMI ENTER");
    }
  }, []);
  reactExports.useEffect(() => {
    if (hasURLparam("reason")) {
      const reason = getURLparam("reason");
      if (hasURLparam(reason)) {
        const errorFromUrl = getURLparam(reason);
        setError(errorFromUrl);
        removeParam("reason", window.location.href);
        let url2 = removeParam("reason", window.location.href);
        url2 = removeParam(reason, url2);
        window.history.pushState({ additionalInformation: "Updated the URL with JS" }, "Вход", url2);
      }
    }
    if (hasURLparam("orgs")) {
      const orgsFromUrl = getURLparam("orgs").replaceAll("-", "+").replaceAll("_", "/");
      setOrg(JSON.parse(decodeURIComponent(escape(window.atob(orgsFromUrl)))));
    }
  }, []);
  const handleClickShowPassword = () => {
    setShowPassword(!showpassword);
  };
  const EmailRestore = () => {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle, { children: "Введите адрес электронной почты, указанный при регистрации вашей учетной записи" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        CssTextField,
        {
          margin: "normal",
          value: emailRestore,
          onChange: (e) => {
            setEmailRestore(e.target.value);
          },
          required: true,
          fullWidth: true,
          id: "email",
          label: "E-mail",
          name: "email",
          autoComplete: "email",
          autoFocus: true,
          sx: { mt: 1 },
          error: checkEmail()
        }
      ) }) }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogActions, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            style: {
              color: message.color,
              marginLeft: "8px",
              marginRight: "2%"
            },
            children: message.message
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            style: {
              backgroundColor: "#3c5b77",
              textTransform: "none"
            },
            onClick: sendRestorePasswordClick,
            variant: "contained",
            sx: { mt: 1, mb: 1, minWidth: "108px" },
            children: "Отправить"
          }
        )
      ] })
    ] });
  };
  const BlockingCaptha = () => {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle, { children: "Для подтверждения того, что Вы человек, а не программа, введите, пожалуйста, контрольные символы:" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, children: modalContent === "1" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
        Captha,
        {
          setCaptcha: (bool) => {
            if (bool) {
              setOpen(false);
              setCount(0);
            }
          }
        }
      ) : null }) })
    ] });
  };
  const DefaultContent = () => {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, children: infoTextForModal }) }) });
  };
  const contentForModalObj = {
    "1": /* @__PURE__ */ jsxRuntimeExports.jsx(BlockingCaptha, {}),
    "2": /* @__PURE__ */ jsxRuntimeExports.jsx(EmailRestore, {}),
    "3": /* @__PURE__ */ jsxRuntimeExports.jsx(DefaultContent, {})
  };
  const handleMouseDownPassword = (event) => {
    event.preventDefault();
  };
  const handleClose = () => {
    if (modalContent !== "1") {
      setOpen(false);
    }
    switch (action) {
      case "NeedChangePassword":
        navigate("/signup");
        break;
    }
  };
  const handlOpenDialog = () => {
    setModalContent("2");
    setMessage({ ...message, message: "" });
    setOpen(true);
  };
  const checkEmail = () => {
    if (emailRestore === "") return false;
    else return !pattern.test(emailRestore);
  };
  const sendRestorePasswordClick = () => {
    if (pattern.test(emailRestore) && emailRestore !== "") {
      const restoreData = {
        Login: emailRestore
      };
      axios.post(urlRestore, JSON.stringify(restoreData)).then((response) => {
        if (response.data.status === "ok") {
          setMessage({ message: "Письмо отправлено.", color: "green" });
          setTimeout(() => {
            setOpen(false);
          }, 1e3 * 10);
        } else {
          setMessage({ message: response.data.status, color: "red" });
        }
      });
    }
  };
  const RestorePassword = /* @__PURE__ */ jsxRuntimeExports.jsx(Grow, { in: true, timeout: 320, style: { transformOrigin: "0 0 0" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    Grid,
    {
      container: true,
      direction: "row",
      justifyContent: "flex-end",
      alignItems: "center",
      style: { width: "100%" },
      spacing: 1,
      sx: { pt: 1 },
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { className: "LinkLK", to: "", onClick: handlOpenDialog, children: "Восстановить пароль" }) })
    }
  ) });
  const handleSubmit = (event) => {
    var _a2;
    event.preventDefault();
    const data = new FormData(event.currentTarget);
    const loginData = {
      UserName: data.get("login"),
      Password: data.get("password")
    };
    if (hasURLparam("OidEsia")) {
      loginData.OidEsia = getURLparam("OidEsia");
    }
    if (hasURLparam("orgs")) {
      if (selectOrg === void 0) {
        setError("Выберите организацию.");
        return;
      }
      let urlEsia = (_a2 = config.lk.doEsia) == null ? void 0 : _a2.org;
      urlEsia += `&ksp=${selectOrg.ksp}&snils=${org.snils}&lastName=${org.lastName}&middleName=${org.middleName}&firstName=${org.firstName}`;
      window.location.href = urlEsia;
    } else {
      setIsRequestLoading(true);
      axios.post(url, JSON.stringify(loginData)).then((response) => {
        setIsRequestLoading(false);
        checkAnswerSubmit(response);
      });
    }
  };
  const checkAnswerSubmit = (response) => {
    if (response.data["status"] !== void 0 && response.data["status"] !== "ok") {
      setError(response.data["status"]);
      if (response.data.action) {
        switch (response.data.action) {
          case "NeedChangePassword":
            setInfoTextForModal(response.data["status"] + " Для этого пройдите повторную регистрацию.");
            setOpen(true);
            setModalContent("3");
            break;
        }
        setAction(response.data.action);
      } else {
        setCount(count + 1);
      }
    } else {
      if (!response.data.licguid) {
        renderMessageBox({ dlgType: 1, buttons: 1, message: "Сервер не прислал идентификатор сессии." });
        return;
      }
      const authedBy = response.data["authed_by"];
      sessionStorage.setItem("LicG", response.data["licguid"]);
      createCokies("LicG", response.data["licguid"]);
      signInInSmeta(response.data);
      let href = response.data["browser"] + `?Guid=${response.data["licguid"]}&stimWebSrv=${response.data["stimwebsrv"]}&from=${window.location.href.replace("#/", "").replaceAll("/", "@")}`;
      if (authedBy) {
        href += `&authed_by=${authedBy}`;
        href.replace(`&from=${window.location.href.replace("#/", "").replaceAll("/", "@")}`, "");
      }
    }
  };
  function signInInSmeta(response) {
    const { stimwebsrv, authed_by: authBy } = response;
    enterSmeta({}, { ip: stimwebsrv }).then((res) => {
      if (res.error) {
        setError(res.error.content);
      } else if (!isEmptyObject(res)) {
        updateStatesAfterEnter(res, {
          drx: res.ConfigName || "",
          userName: res.UserName || "",
          workPlace: res.WorkPlace || ""
        });
        if (authBy) {
          updateOptionsForUser({ authed_by: authBy });
        } else {
          updateOptionsForUser({ from: "lk" });
        }
        const licG = sessionStorage.getItem("LicG");
        localStorage.setItem("login", licG);
        clearUrl();
        setIsSessionActive(true);
        navigate("/main" + getUrlSearh());
        if (stimwebsrv) {
          updateOptionsForUser({ IP: stimwebsrv });
        }
      }
    });
  }
  function displayForEsia() {
    var _a2, _b2, _c, _d;
    return !hasURLparam("OidEsia") && config.lk.hideEsiaButton === "0" && ((_a2 = config.lk.doEsia) == null ? void 0 : _a2.auth) !== "" && ((_b2 = config.lk.doEsia) == null ? void 0 : _b2.auth) !== void 0 && ((_c = config.lk.doEsia) == null ? void 0 : _c.auth) !== null && typeof ((_d = config.lk.doEsia) == null ? void 0 : _d.auth) === "string";
  }
  if (config.lk.hideLoginAndPassword === true) {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(Container, { component: "main", maxWidth: "xl", sx: { display: "flex", justifyContent: "center" }, children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(CssBaseline, {}),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Box,
        {
          sx: {
            marginTop: 8,
            display: "flex",
            width: "396px",
            flexDirection: "column",
            alignItems: "center"
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              "img",
              {
                src: "logo.png",
                style: {
                  borderRadius: "5% 5% 0 0",
                  width: config.lk.baseWidthLogo ? config.lk.baseWidthLogo : "45%"
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsxs(
              Box,
              {
                component: "form",
                onSubmit: handleSubmit,
                noValidate: true,
                style: { width: "400px" },
                sx: { mt: 1, width: "400px" },
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
                  !org ? /* @__PURE__ */ jsxRuntimeExports.jsx(EsiaButton, {}) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Autocomplete,
                      {
                        disablePortal: true,
                        fullWidth: true,
                        value: selectOrg,
                        onChange: (e, newVal) => {
                          setError("");
                          setSelectOrg(newVal);
                        },
                        id: "orgs",
                        getOptionLabel: (option) => option.orgname,
                        options: org.orgs,
                        renderInput: (params) => /* @__PURE__ */ jsxRuntimeExports.jsx(CssTextField, { ...params, label: "Организация" })
                      }
                    ),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Button,
                      {
                        style: {
                          backgroundColor: "#3c5b77",
                          textTransform: "none"
                        },
                        type: "submit",
                        fullWidth: true,
                        variant: "contained",
                        sx: { mt: 3, mb: 2 },
                        disabled: isRequestLoading,
                        children: "Войти"
                      }
                    )
                  ] }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(Grow, { in: true, timeout: 380, style: { transformOrigin: "0 0 0" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntimeExports.jsx(FormHelperText, { error: true, children: error !== "" ? `${error}` : "" }) }) }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(MobileQR, {})
                ]
              }
            )
          ]
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Dialog,
        {
          open,
          keepMounted: true,
          onClose: handleClose,
          "aria-describedby": "alert-dialog-slide-description",
          children: contentForModalObj[modalContent]
        }
      )
    ] });
  } else {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(Container, { component: "main", maxWidth: "xs", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(CssBaseline, {}),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Box,
        {
          sx: {
            marginTop: 8,
            display: "flex",
            flexDirection: "column",
            alignItems: "center"
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              "img",
              {
                src: "logo.png",
                style: {
                  borderRadius: "5% 5% 0 0",
                  width: config.lk.baseWidthLogo ? config.lk.baseWidthLogo : "45%"
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { component: "form", onSubmit: handleSubmit, noValidate: true, sx: { mt: 1, width: "396px" }, children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
              !org ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { display: displayForEsia() ? "" : "none" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(EsiaButton, {}) }),
                hasURLparam("OidEsia") ? "Укажите данные ранее созданной учётной записи" : null,
                /* @__PURE__ */ jsxRuntimeExports.jsx(Grow, { in: true, timeout: 250, style: { transformOrigin: "0 0 0" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  CssTextField,
                  {
                    margin: "normal",
                    fullWidth: true,
                    id: "login",
                    label: "Логин",
                    name: "login",
                    autoComplete: "login",
                    autoFocus: true,
                    sx: { mt: 0 }
                  }
                ) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(Grow, { in: true, timeout: 330, style: { transformOrigin: "0 0 0" }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
                  FormControl,
                  {
                    fullWidth: true,
                    variant: "outlined",
                    sx: {
                      "& .MuiOutlinedInput-root": {
                        "&.Mui-focused fieldset": {
                          borderColor: "#3c5b77"
                        }
                      },
                      mt: 1
                    },
                    children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(InputLabel, { htmlFor: "password", sx: { "&.Mui-focused": { color: "#3c5b77" } }, children: "Пароль" }),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        OutlinedInput,
                        {
                          autoComplete: "current-password",
                          type: showpassword ? "text" : "password",
                          fullWidth: true,
                          id: "password",
                          label: "password",
                          name: "password",
                          endAdornment: /* @__PURE__ */ jsxRuntimeExports.jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                            IconButton,
                            {
                              "aria-label": "toggle password visibility",
                              onClick: handleClickShowPassword,
                              onMouseDown: handleMouseDownPassword,
                              edge: "end",
                              children: showpassword ? /* @__PURE__ */ jsxRuntimeExports.jsx(VisibilityOff, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(Visibility, {})
                            }
                          ) })
                        }
                      )
                    ]
                  }
                ) })
              ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
                Autocomplete,
                {
                  disablePortal: true,
                  fullWidth: true,
                  value: selectOrg,
                  onChange: (e, newVal) => {
                    setError("");
                    setSelectOrg(newVal);
                  },
                  id: "orgs",
                  getOptionLabel: (option) => option.orgname,
                  options: org.orgs,
                  renderInput: (params) => /* @__PURE__ */ jsxRuntimeExports.jsx(CssTextField, { ...params, label: "Организация" })
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(Grow, { in: true, timeout: 380, style: { transformOrigin: "0 0 0" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntimeExports.jsx(FormHelperText, { error: true, children: error !== "" ? `${error}` : "" }) }) }),
              config.lk.basePassRecovery === "1" ? RestorePassword : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}),
              /* @__PURE__ */ jsxRuntimeExports.jsx(Grow, { in: true, timeout: 380, style: { transformOrigin: "0 0 0" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  style: { backgroundColor: "#3c5b77", textTransform: "none" },
                  type: "submit",
                  fullWidth: true,
                  variant: "contained",
                  sx: { mt: 3, mb: 2 },
                  disabled: isRequestLoading,
                  children: hasURLparam("OidEsia") ? "Привязать к учетное записи ЕСИА" : "Войти"
                }
              ) }),
              !org ? /* @__PURE__ */ jsxRuntimeExports.jsx(Grow, { in: true, timeout: 380, style: { transformOrigin: "0 0 0" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { container: true, justifyContent: "center", alignItems: "center", style: { width: "400px" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { className: "LinkLK", to: "/signup", children: config.lk.baseLinkText }) }) }) }) : null,
              /* @__PURE__ */ jsxRuntimeExports.jsx(LinkSupport, {}),
              /* @__PURE__ */ jsxRuntimeExports.jsx(MobileQR, {})
            ] })
          ]
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Dialog,
        {
          open,
          keepMounted: true,
          onClose: handleClose,
          "aria-describedby": "alert-dialog-slide-description",
          children: contentForModalObj[modalContent]
        }
      )
    ] });
  }
}
const SignIn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  CssTextField,
  WhereNavigate,
  default: SignInLK
}, Symbol.toStringTag, { value: "Module" }));
export {
  CssTextField as C,
  SignIn as S,
  VisibilityOff as V,
  WhereNavigate as W,
  Visibility as a
};
//# sourceMappingURL=SignIn-BbTs8zBq.js.map
