import { jsx as o, jsxs as a } from "react/jsx-runtime";
import { Alert as c, AlertTitle as s, Typography as u, Box as m } from "@mui/material";
import { useRouteError as d } from "react-router-dom";
import t from "../Button/index.js";
function l({
  title: r = "Something went wrong...",
  desc: e,
  extraContent: i = null,
  severity: n = "error"
}) {
  return /* @__PURE__ */ a(
    c,
    {
      severity: n,
      variant: "outlined",
      icon: !1,
      sx: {
        justifyContent: "center"
      },
      children: [
        r ? /* @__PURE__ */ o(s, { children: r }) : null,
        e ? /* @__PURE__ */ o(
          u,
          {
            variant: "body2",
            sx: {
              mb: 1
            },
            children: e
          }
        ) : null,
        i ?? /* @__PURE__ */ a(m, { sx: { display: "flex", gap: 1, justifyContent: "center", alignItems: "center" }, children: [
          /* @__PURE__ */ o(t, { variant: "outlined", color: n, size: "small", onClick: () => window.location.replace("/"), children: "Home" }),
          /* @__PURE__ */ o(t, { variant: "contained", color: n, size: "small", onClick: () => window.location.reload(), children: "Refresh" })
        ] })
      ]
    }
  );
}
function k({ error: r }) {
  return /* @__PURE__ */ o(l, { desc: r.message });
}
function b({ error: r, resetErrorBoundary: e }) {
  return /* @__PURE__ */ o(
    l,
    {
      desc: r.message,
      extraContent: /* @__PURE__ */ o(t, { variant: "contained", color: "error", size: "small", onClick: e, children: "Try again" })
    }
  );
}
function w() {
  const r = d();
  return /* @__PURE__ */ o(l, { title: "Current route occurred an error", desc: r.message });
}
export {
  k as ErrorFallback,
  b as ErrorFallbackRetry,
  w as ReactRouterErrorFallback
};
