{"version":3,"file":"ErrorBoundary.mjs","names":["React","Component","useTranslation","Adornment","Sticky","Typography","ErrorBoundaryBase","constructor","props","state","hasError","import","meta","env","DEV","hot","on","setState","getDerivedStateFromError","error","componentDidCatch","info","console","log","render","children","t","height","display","marginLeft","marginTop","margin","defaultValue","flexDirection","alignItems","ErrorBoundary","$","_c","t0"],"sources":["../../src/errorBoundary/ErrorBoundary.jsx"],"sourcesContent":["import React, { Component } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Adornment } from '../UI';\nimport { Sticky } from '../UI';\nimport { Typography } from '../UI/dataDisplay/typography';\nclass ErrorBoundaryBase extends Component {\n  constructor(props) {\n    super(props);\n    this.state = {\n      hasError: false,\n    };\n\n    if (import.meta.env && import.meta.env.DEV && import.meta.hot) {\n      // reset the error boundary when there are HMR changes detected\n      import.meta.hot.on('vite:beforeUpdate', () => {\n        // If this boundary caught an error, reset it on HMR\n        if (this.state.hasError) {\n          this.setState({ hasError: false });\n        }\n      });\n    }\n  }\n\n  static getDerivedStateFromError(error) {\n    return {\n      hasError: true,\n    };\n  }\n\n  componentDidCatch(error, info) {\n    console.log(error);\n    console.log(info);\n  }\n\n  render() {\n    const { hasError } = this.state;\n    const { children, t } = this.props;\n    if (hasError) {\n      return (\n        <div style={{ height: \"100%\", display: \"flex\" }}>\n          <div>\n            <Adornment color=\"error\" />\n          </div>\n          <div style={{ marginLeft: 32 }}>\n            <div style={{ marginTop: 64 }}>\n              <Typography style={{ margin: 8 }} variant=\"h3\">\n                {t('errorBoundary.title', {\n                  defaultValue: 'A fatal error has occurred.'\n                })}\n              </Typography>\n              <Typography style={{ margin: 8 }} variant=\"body2\">\n                {t('errorBoundary.description', {\n                  defaultValue:\n                    'We are sorry this happened. A log of this error has been recorded and sent to support.'\n                })}\n              </Typography>\n            </div>\n            <div style={{ marginTop: 118, display: \"flex\", flexDirection: \"column\", alignItems: \"flex-start\" }}>\n              <Sticky\n                text={t('errorBoundary.createTicket', {\n                  defaultValue: 'Create a support ticket'\n                })}\n                size=\"small\"\n                color=\"success\"\n              />\n              <Sticky\n                text={t('errorBoundary.reportBug', {\n                  defaultValue: 'Report this bug'\n                })}\n                size=\"small\"\n                color=\"warning\"\n              />\n              <Sticky\n                text={t('errorBoundary.viewDocuments', {\n                  defaultValue: 'View Documents'\n                })}\n                size=\"small\"\n                color=\"info\"\n              />\n            </div>\n          </div>\n        </div>\n      )\n    }\n    return children;\n  }\n}\n\n/**\n * The boundary itself must stay a class (getDerivedStateFromError /\n * componentDidCatch), so `t` is injected by this thin function wrapper rather\n * than the withTranslation HOC: under pnpm's nested layout the HOC's inferred\n * return type can't be named portably, which fails declaration emit (TS2742).\n * Errors from children still land on the inner class - it is the boundary.\n */\nconst ErrorBoundary = (props) => {\n  const { t } = useTranslation();\n  return <ErrorBoundaryBase {...props} t={t} />;\n};\n\nexport default ErrorBoundary;\n"],"mappings":";;;;;;;AAKA,IAAMM,oBAAN,cAAgCL,UAAU;CACxCM,YAAYC,OAAO;AACjB,QAAMA,MAAM;AACZ,OAAKC,QAAQ,EACXC,UAAU,OACX;AAED,MAAIC,OAAOC,KAAKC,OAAOF,OAAOC,KAAKC,IAAIC,OAAOH,OAAOC,KAAKG,IAExDJ,QAAOC,KAAKG,IAAIC,GAAG,2BAA2B;AAE5C,OAAI,KAAKP,MAAMC,SACb,MAAKO,SAAS,EAAEP,UAAU,OAAO,CAAC;IAEpC;;CAIN,OAAOQ,yBAAyBC,OAAO;AACrC,SAAO,EACLT,UAAU,MACX;;CAGHU,kBAAkBD,OAAOE,MAAM;AAC7BC,UAAQC,IAAIJ,MAAM;AAClBG,UAAQC,IAAIF,KAAK;;CAGnBG,SAAS;EACP,MAAM,EAAEd,aAAa,KAAKD;EAC1B,MAAM,EAAEgB,UAAUC,MAAM,KAAKlB;AAC7B,MAAIE,SACF,QACE,sBAAA,cAAC,OAAD,EAAK,OAAO;GAAEiB,QAAQ;GAAQC,SAAS;GAAQ,EA0CzC,EAzCJ,sBAAA,cAAC,OAA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