var _excluded = ["children", "disabled", "style"];
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
import React from "react";
import { debounce } from "lodash";
var FillWindow = /*#__PURE__*/function (_React$Component) {
  _inheritsLoose(FillWindow, _React$Component);
  function FillWindow() {
    var _this;
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
    _defineProperty(_assertThisInitialized(_this), "updateDimensions", debounce(function () {
      if (_this.props.disabled) return;
      _this.setState({
        randomRerenderTrigger: Math.random()
      });
    }, 100));
    return _this;
  }
  var _proto = FillWindow.prototype;
  _proto.componentDidMount = function componentDidMount() {
    window.addEventListener("resize", this.updateDimensions);
  };
  _proto.componentWillUnmount = function componentWillUnmount() {
    window.removeEventListener("resize", this.updateDimensions);
  };
  _proto.render = function render() {
    var w = window,
      d = document,
      e = d.documentElement,
      g = d.getElementsByTagName("body")[0],
      width = w.innerWidth || e.clientWidth || g.clientWidth,
      height = w.innerHeight || e.clientHeight || g.clientHeight;
    var windowDimensions = {
      width: width,
      height: height
    };
    var _this$props = this.props,
      children = _this$props.children,
      disabled = _this$props.disabled,
      style = _this$props.style,
      rest = _objectWithoutPropertiesLoose(_this$props, _excluded);
    if (disabled) return children(windowDimensions);
    return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
      style: _extends({
        width: width,
        height: height,
        position: "fixed",
        top: 0,
        left: 0,
        background: "white"
      }, style)
    }), children(windowDimensions));
  };
  return FillWindow;
}(React.Component);
export { FillWindow as default };