import { __exports as a } from "./index-_virtual65.js";
import q from "react";
import { __require as g } from "./index-prop-types.js";
import { __require as w } from "./index-spin.js";
var l;
function R() {
  if (l) return a;
  l = 1, Object.defineProperty(a, "__esModule", {
    value: !0
  });
  var s = /* @__PURE__ */ (function() {
    function n(e, r) {
      for (var t = 0; t < r.length; t++) {
        var i = r[t];
        i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i);
      }
    }
    return function(e, r, t) {
      return r && n(e.prototype, r), t && n(e, t), e;
    };
  })(), u = q, c = p(u), d = /* @__PURE__ */ g(), o = p(d), h = w(), _ = p(h);
  function p(n) {
    return n && n.__esModule ? n : { default: n };
  }
  function m(n, e) {
    if (!(n instanceof e))
      throw new TypeError("Cannot call a class as a function");
  }
  function y(n, e) {
    if (!n)
      throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
    return e && (typeof e == "object" || typeof e == "function") ? e : n;
  }
  function v(n, e) {
    if (typeof e != "function" && e !== null)
      throw new TypeError("Super expression must either be null or a function, not " + typeof e);
    n.prototype = Object.create(e && e.prototype, { constructor: { value: n, enumerable: !1, writable: !0, configurable: !0 } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(n, e) : n.__proto__ = e);
  }
  var f = (function(n) {
    v(e, n);
    function e() {
      return m(this, e), y(this, (e.__proto__ || Object.getPrototypeOf(e)).apply(this, arguments));
    }
    return s(e, [{
      key: "componentDidMount",
      value: function() {
        this.updateSpinner();
      }
    }, {
      key: "componentDidUpdate",
      value: function() {
        this.updateSpinner();
      }
    }, {
      key: "componentWillUnmount",
      value: function() {
        this.spinner && (this.spinner.stop(), this.spinner = null);
      }
    }, {
      key: "updateSpinner",
      value: function() {
        var t = this.props.loaded;
        !t && !this.spinner ? (this.spinner = new _.default(this.props.config), this.spinner.spin(this.refs.loader)) : t && this.spinner && (this.spinner.stop(), this.spinner = null);
      }
    }, {
      key: "render",
      value: function() {
        var t = this.props, i = t.loaded, b = t.className;
        return i ? this.props.children ? u.Children.only(this.props.children) : null : c.default.createElement("div", { className: b, ref: "loader" });
      }
    }]), e;
  })(u.Component);
  return f.propTypes = {
    className: o.default.string,
    config: o.default.object.isRequired,
    loaded: o.default.bool.isRequired,
    children: o.default.node
  }, f.defaultProps = {
    config: {},
    loaded: !1,
    className: "loader"
  }, a.default = f, a;
}
export {
  R as __require
};
