import g from "react";
var p, y;
function R() {
  if (y) return p;
  y = 1;
  var s = g;
  function c(e, t) {
    return c = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(i, r) {
      return i.__proto__ = r, i;
    }, c(e, t);
  }
  function m(e, t) {
    e.prototype = Object.create(t.prototype), e.prototype.constructor = e, c(e, t);
  }
  function v(e, t) {
    return e === void 0 && (e = []), t === void 0 && (t = []), e.length !== t.length || e.some(function(i, r) {
      return !Object.is(i, t[r]);
    });
  }
  var f = { error: null }, E = (function(e) {
    function t() {
      for (var r, o = arguments.length, a = Array(o), n = 0; n < o; n++) a[n] = arguments[n];
      return r = e.call.apply(e, [this].concat(a)) || this, r.state = f, r.resetErrorBoundary = function() {
        for (var u, d = arguments.length, h = Array(d), l = 0; l < d; l++) h[l] = arguments[l];
        r.props.onReset == null || (u = r.props).onReset.apply(u, h), r.reset();
      }, r;
    }
    m(t, e), t.getDerivedStateFromError = function(r) {
      return { error: r };
    };
    var i = t.prototype;
    return i.reset = function() {
      this.setState(f);
    }, i.componentDidCatch = function(r, o) {
      var a, n;
      (a = (n = this.props).onError) == null || a.call(n, r, o);
    }, i.componentDidUpdate = function(r, o) {
      var a = this.props.resetKeys;
      if (this.state.error !== null && o.error !== null && v(r.resetKeys, a)) {
        var n, u;
        (n = (u = this.props).onResetKeysChange) == null || n.call(u, r.resetKeys, a), this.reset();
      }
    }, i.render = function() {
      var r = this.state.error, o = this.props, a = o.fallbackRender, n = o.FallbackComponent;
      if (o = o.fallback, r !== null) {
        if (r = { error: r, resetErrorBoundary: this.resetErrorBoundary }, s.isValidElement(o)) return o;
        if (typeof a == "function") return a(r);
        if (n) return s.createElement(n, r);
        throw Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");
      }
      return this.props.children;
    }, t;
  })(s.Component);
  return p = function({ children: e, onError: t }) {
    return s.createElement(E, { fallback: s.createElement("div", { style: { border: "1px solid #f00", color: "#f00", padding: "8px" } }, "An error was thrown."), onError: t }, e);
  }, p;
}
export {
  R as __require
};
