import { jsxs, jsx } from 'react/jsx-runtime';

function ErrorFallback({ error }) {
  const errorMessage = error == null ? void 0 : error instanceof Error ? error.message : String(error);
  const errorStack = error instanceof Error ? error.stack : void 0;
  return /* @__PURE__ */ jsxs("div", { className: "p-4 border border-red-500 bg-red-100 text-red-700 rounded flex-grow w-full", children: [
    /* @__PURE__ */ jsx("h3", { className: "font-bold mb-2", children: "Component Error" }),
    /* @__PURE__ */ jsxs("p", { children: [
      "Error: ",
      errorMessage || "Unknown error"
    ] }),
    /* @__PURE__ */ jsxs("details", { className: "mt-2", children: [
      /* @__PURE__ */ jsx("summary", { className: "cursor-pointer", children: "Stack trace" }),
      /* @__PURE__ */ jsx("pre", { className: "mt-2 text-xs whitespace-pre-wrap", children: errorStack })
    ] })
  ] });
}

export { ErrorFallback };
