import { E as compilerRuntimeExports, a0 as useParams, r as reactExports, j as jsxRuntimeExports } from "./vendor-react-DYNCg6N5.js";
import { c as createStyles, G as Group, T as Text, B as Button, S as Stack } from "./vendor-mantine-h0WlM2Mj.js";
import { ap as useLazyConfirmEmailActivationQuery } from "./index-DfebxkL9.js";
import { L as LoginWraper } from "./index-q4s1wmSu.js";
import { i as iconSuccess } from "./icon-mail-success-C8dZWFGQ.js";
import { i as iconError } from "./icon-mail-error-BTXt9n8h.js";
import { u as useTranslation } from "./vendor-i18n-wisIXUFi.js";
import "./vendor-icons-xWhXK_Ui.js";
const useStyles = createStyles((theme, _, utils) => ({
  wrapper: {
    minHeight: "100vh",
    backgroundSize: "cover",
    display: "flex",
    justifyContent: "center",
    alignItems: "center",
    "@supports(-webkit-touch-callout: none)": {
      minHeight: "-webkit-fill-available"
    }
  },
  responseContent: {
    display: "flex",
    flexDirection: "column",
    alignItems: "center"
  },
  desc: {
    lineHeight: "22px",
    color: theme.colors.gray[6]
  },
  responsiveInput: {
    [utils.smallerThan("xs")]: {
      width: "100%"
    }
  },
  icon: {
    marginTop: "15px",
    width: "100px",
    height: "100px"
  },
  title: {
    [utils.dark]: {
      color: theme.white
    },
    [utils.light]: {
      color: theme.black
    },
    fontFamily: `Greycliff CF, ${theme.fontFamily}`
  }
}));
const ConfirmEmail = () => {
  const $ = compilerRuntimeExports.c(17);
  const {
    classes
  } = useStyles();
  const {
    t
  } = useTranslation();
  const {
    code: t0
  } = useParams();
  const code = t0 === void 0 ? "" : t0;
  const [confirmEmailActivation, t1] = useLazyConfirmEmailActivationQuery();
  const {
    isSuccess
  } = t1;
  let t2;
  if ($[0] !== code || $[1] !== confirmEmailActivation) {
    t2 = () => {
      const fetchData = async () => {
        try {
          await confirmEmailActivation({
            Code: code
          });
        } catch (t32) {
          const error = t32;
          console.error("Error while making API request:", error);
        }
      };
      fetchData();
    };
    $[0] = code;
    $[1] = confirmEmailActivation;
    $[2] = t2;
  } else {
    t2 = $[2];
  }
  let t3;
  if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
    t3 = [];
    $[3] = t3;
  } else {
    t3 = $[3];
  }
  reactExports.useEffect(t2, t3);
  let t4;
  if ($[4] !== classes.desc || $[5] !== classes.icon || $[6] !== isSuccess || $[7] !== t) {
    t4 = isSuccess ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(Group, { justify: "center", gap: "xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: iconSuccess, alt: "icon", className: classes.icon }) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: classes.desc, ta: "center", children: t("profile.emailConfirmed") })
    ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(Group, { justify: "center", gap: "xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: iconError, alt: "icon", className: classes.icon }) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: classes.desc, ta: "center", children: t("profile.emailError") })
    ] });
    $[4] = classes.desc;
    $[5] = classes.icon;
    $[6] = isSuccess;
    $[7] = t;
    $[8] = t4;
  } else {
    t4 = $[8];
  }
  const t5 = classes.responsiveInput;
  let t6;
  if ($[9] !== t) {
    t6 = t("goHome");
    $[9] = t;
    $[10] = t6;
  } else {
    t6 = $[10];
  }
  let t7;
  if ($[11] !== classes.responsiveInput || $[12] !== t6) {
    t7 = /* @__PURE__ */ jsxRuntimeExports.jsx(Group, { justify: "center", w: "100%", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { w: "100%", className: t5, component: "a", size: "lg", href: "/", children: t6 }) });
    $[11] = classes.responsiveInput;
    $[12] = t6;
    $[13] = t7;
  } else {
    t7 = $[13];
  }
  let t8;
  if ($[14] !== t4 || $[15] !== t7) {
    t8 = /* @__PURE__ */ jsxRuntimeExports.jsx(LoginWraper, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Stack, { children: [
      t4,
      t7
    ] }) });
    $[14] = t4;
    $[15] = t7;
    $[16] = t8;
  } else {
    t8 = $[16];
  }
  return t8;
};
export {
  ConfirmEmail
};
//# sourceMappingURL=index-CtFaoOYp.js.map
