import "react";
import { jsx, jsxs } from "../node_modules/.pnpm/@emotion_react@11.10.4_q4mq7tnhdumujvomvw24zx33y4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js";
const ErrorBox = ({
  title,
  itemId,
  caught,
  desc = "\u51FA\u9519\u4E86"
}) => {
  let message;
  if (caught) {
    switch (caught.status) {
      case 401:
        message = "\u60A8\u6682\u65E0\u8BBF\u95EE\u6743\u9650";
        break;
      case 404:
        message = "\u6CA1\u6709\u53D1\u73B0\u8BE5\u9875\u9762";
        break;
      default:
        message = `\u6CA1\u6709\u8BE5\u5185\u5BB9${itemId || ""}`;
        throw new Error(`Unhandled error: ${caught.data || caught.statusText}`);
    }
    return /* @__PURE__ */ jsx("section", {
      className: "flex items-center h-full bg-white sm:p-16 dark:bg-stone-900 dark:text-stone-100 text-stone-600",
      children: /* @__PURE__ */ jsxs("div", {
        className: "container flex flex-col items-center justify-center px-5 mx-auto my-8",
        children: [/* @__PURE__ */ jsxs("h2", {
          className: "mb-8 font-extrabold text-9xl text-stone-600 dark:text-stone-100",
          children: [/* @__PURE__ */ jsx("span", {
            className: "sr-only",
            children: caught.statusText
          }), caught.status]
        }), /* @__PURE__ */ jsx("p", {
          className: "text-2xl font-semibold md:text-3xl",
          children: caught.data || title || message
        }), /* @__PURE__ */ jsx("p", {
          className: "mt-4 mb-8 dark:text-stone-400",
          children: "\u522B\u62C5\u5FC3\uFF0C\u60A8\u53EF\u4EE5\u5148\u8BBF\u95EE\u5176\u4ED6\u5185\u5BB9\u3002"
        }), /* @__PURE__ */ jsx("a", {
          href: "/",
          className: "px-8 py-3 mt-8 font-semibold text-white bg-blue-600 rounded",
          children: "\u9996\u9875"
        })]
      })
    });
  }
  return /* @__PURE__ */ jsx("section", {
    className: "flex items-center h-full bg-white text-stone-600 sm:p-16 dark:bg-stone-900 dark:text-stone-100",
    children: /* @__PURE__ */ jsxs("div", {
      className: "container flex flex-col items-center justify-center px-5 mx-auto my-8 space-y-8 text-center sm:max-w-md",
      children: [/* @__PURE__ */ jsxs("svg", {
        xmlns: "http://www.w3.org/2000/svg",
        viewBox: "0 0 512 512",
        className: "w-40 h-40 text-stone-600",
        children: [/* @__PURE__ */ jsx("path", {
          fill: "currentColor",
          d: "M256,16C123.452,16,16,123.452,16,256S123.452,496,256,496,496,388.548,496,256,388.548,16,256,16ZM403.078,403.078a207.253,207.253,0,1,1,44.589-66.125A207.332,207.332,0,0,1,403.078,403.078Z"
        }), /* @__PURE__ */ jsx("rect", {
          width: "176",
          height: "32",
          x: "168",
          y: "320",
          fill: "currentColor"
        }), /* @__PURE__ */ jsx("polygon", {
          fill: "currentColor",
          points: "210.63 228.042 186.588 206.671 207.958 182.63 184.042 161.37 162.671 185.412 138.63 164.042 117.37 187.958 141.412 209.329 120.042 233.37 143.958 254.63 165.329 230.588 189.37 251.958 210.63 228.042"
        }), /* @__PURE__ */ jsx("polygon", {
          fill: "currentColor",
          points: "383.958 182.63 360.042 161.37 338.671 185.412 314.63 164.042 293.37 187.958 317.412 209.329 296.042 233.37 319.958 254.63 341.329 230.588 365.37 251.958 386.63 228.042 362.588 206.671 383.958 182.63"
        })]
      }), /* @__PURE__ */ jsx("p", {
        className: "mt-4 text-3xl",
        children: title
      }), /* @__PURE__ */ jsx("p", {
        className: "mt-2 text-gray-300",
        children: desc
      }), /* @__PURE__ */ jsx("a", {
        href: "/",
        className: "px-8 py-3 mt-8 font-semibold text-white bg-blue-600 rounded",
        children: "\u9996\u9875"
      })]
    })
  });
};
export {
  ErrorBox
};
//# sourceMappingURL=ErrorBox.js.map
