import l from "../../../@babel/runtime/helpers/esm/classCallCheck.mjs";
import d from "../../../@babel/runtime/helpers/esm/createClass.mjs";
import h from "../../../@babel/runtime/helpers/esm/inherits.mjs";
import y from "../../../@babel/runtime/helpers/esm/createSuper.mjs";
import * as i from "react";
import S from "./Alert.mjs";
let k = /* @__PURE__ */ function(a) {
  h(e, a);
  var c = y(e);
  function e() {
    var r;
    return l(this, e), r = c.apply(this, arguments), r.state = {
      error: void 0,
      info: {
        componentStack: ""
      }
    }, r;
  }
  return d(e, [{
    key: "componentDidCatch",
    value: function(t, o) {
      this.setState({
        error: t,
        info: o
      });
    }
  }, {
    key: "render",
    value: function() {
      const {
        message: t,
        description: o,
        children: p
      } = this.props, {
        error: s,
        info: n
      } = this.state, m = n && n.componentStack ? n.componentStack : null, u = typeof t > "u" ? (s || "").toString() : t, f = typeof o > "u" ? m : o;
      return s ? /* @__PURE__ */ i.createElement(S, {
        type: "error",
        message: u,
        description: /* @__PURE__ */ i.createElement("pre", {
          style: {
            fontSize: "0.9em",
            overflowX: "auto"
          }
        }, f)
      }) : p;
    }
  }]), e;
}(i.Component);
const B = k;
export {
  B as default
};
