import { j as jsxRuntimeExports } from '../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js';
import { ExclamationTriangleIcon, FileIcon, FileTextIcon } from '../node_modules/.pnpm/@radix-ui_react-icons@1.3.0_react@18.2.0/node_modules/@radix-ui/react-icons/dist/react-icons.esm.js';
import { cva } from '../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js';
import { Body } from '../body/body.js';
import { Flex } from '../flex/flex.js';
import { Headline } from '../headline/headline.js';
import styles from './errorstate.module.css.js';

const getIcon = (status = "") => {
    switch (status) {
        case "400":
            return jsxRuntimeExports.jsx(FileTextIcon, { width: 80, height: 80 });
        case "NOT_FOUND":
            return jsxRuntimeExports.jsx(FileIcon, { width: 80, height: 80 });
        case "UNDER_MAINTENANCE":
            return jsxRuntimeExports.jsx(ExclamationTriangleIcon, { width: 80, height: 80 });
        case "SOMETHING_WENT_WRONG":
            return jsxRuntimeExports.jsx(ExclamationTriangleIcon, { width: 80, height: 80 });
        default:
            return jsxRuntimeExports.jsx(ExclamationTriangleIcon, { width: 80, height: 80 });
    }
};
const getMessage = (status = "System is facing some issue with your request, please try again later") => {
    switch (status) {
        case "400":
            return "Sorry, the page you are looking for doesn’t exist or has been moved.";
        case "NOT_FOUND":
            return "Sorry, the resource you are looking for doesn’t exist or has been deleted.";
        case "UNDER_MAINTENANCE":
            return "The page you are looking for is under maintenance and will be back soon.";
        case "SOMETHING_WENT_WRONG":
            return "System is facing some issue with your request, please try again later";
        default:
            return status;
    }
};
const getHeadline = (status = "Something gone wrong") => {
    switch (status) {
        case "400":
            return "404 error";
        case "NOT_FOUND":
            return "Resource not found";
        case "UNDER_MAINTENANCE":
            return "Under maintenance";
        case "SOMETHING_WENT_WRONG":
            return "Something gone wrong";
        default:
            return status;
    }
};
const errorstate = cva(styles.errorstate);
function ErrorState({ children, className, status, icon, message, ...props }) {
    return (jsxRuntimeExports.jsx(Flex, { justify: "center", style: { width: "100%", height: "100%" }, children: jsxRuntimeExports.jsxs(Flex, { direction: "column", gap: "large", align: "center", justify: "center", className: errorstate({ className }), style: { textAlign: "center", maxWidth: "400px" }, ...props, children: [icon ? icon : getIcon(status), jsxRuntimeExports.jsxs(Flex, { direction: "column", gap: "medium", children: [jsxRuntimeExports.jsx(Headline, { size: "large", children: getHeadline(status) }), jsxRuntimeExports.jsx(Body, { size: "large", children: message ? message : getMessage(status) })] })] }) }));
}

export { ErrorState };
//# sourceMappingURL=errorstate.js.map
