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