import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import "react";
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
import * as __WEBPACK_EXTERNAL_MODULE_react_error_boundary__ from "react-error-boundary";
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
const { Paragraph, Text, Link } = __WEBPACK_EXTERNAL_MODULE_antd__.Typography;
const ErrorFallback = (param)=>{
    let { error } = param;
    const { resetBoundary } = (0, __WEBPACK_EXTERNAL_MODULE_react_error_boundary__.useErrorBoundary)();
    const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
    const subTitle = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_i18next__.Trans, {
        children: [
            'This is likely a Tachybase internals bug. Please open an issue at ',
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(Link, {
                href: "https://github.com/tachybase/tachybase/issues",
                target: "_blank",
                children: "here"
            })
        ]
    });
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
        style: {
            backgroundColor: 'white'
        },
        children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Result, {
            style: {
                maxWidth: '60vw',
                margin: 'auto'
            },
            status: "error",
            title: t('Render Failed'),
            subTitle: subTitle,
            extra: [
                /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Button, {
                    type: "primary",
                    href: "https://github.com/tachybase/tachybase/issues",
                    target: "_blank",
                    children: t('Feedback')
                }, "feedback"),
                /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Button, {
                    onClick: resetBoundary,
                    children: t('Try again')
                }, "try")
            ],
            children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(Paragraph, {
                copyable: true,
                children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(Text, {
                    type: "danger",
                    style: {
                        whiteSpace: 'pre-line',
                        textAlign: 'center'
                    },
                    children: error.stack
                })
            })
        })
    });
};
export { ErrorFallback };
