import { Component } from "react";
import Portal$1 from "./Portal.js";
import { jsx } from "../../../../../../@emotion_react@11.10.4_3toe27fv7etiytxb5kxc7fxaw4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js";
var __extends = globalThis && globalThis.__extends || function() {
  var extendStatics = function(d, b) {
    extendStatics = Object.setPrototypeOf || {
      __proto__: []
    } instanceof Array && function(d2, b2) {
      d2.__proto__ = b2;
    } || function(d2, b2) {
      for (var p in b2)
        if (Object.prototype.hasOwnProperty.call(b2, p))
          d2[p] = b2[p];
    };
    return extendStatics(d, b);
  };
  return function(d, b) {
    if (typeof b !== "function" && b !== null)
      throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
    extendStatics(d, b);
    function __() {
      this.constructor = d;
    }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  };
}();
var __assign = globalThis && globalThis.__assign || function() {
  __assign = Object.assign || function(t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
      s = arguments[i];
      for (var p in s)
        if (Object.prototype.hasOwnProperty.call(s, p))
          t[p] = s[p];
    }
    return t;
  };
  return __assign.apply(this, arguments);
};
var PortalWrapper = function(_super) {
  __extends(PortalWrapper2, _super);
  function PortalWrapper2() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  PortalWrapper2.prototype.componentWillUnmount = function() {
    this.instance = null;
  };
  PortalWrapper2.prototype.render = function() {
    var _this = this;
    var _a = this.props, forceRender = _a.forceRender, visible = _a.visible;
    return forceRender || visible || this.instance ? /* @__PURE__ */ jsx(Portal$1, {
      ...__assign({
        ref: function(ref) {
          return _this.instance = ref;
        }
      }, this.props)
    }) : null;
  };
  PortalWrapper2.displayName = "Portal";
  PortalWrapper2.defaultProps = {
    getContainer: function() {
      return document.body;
    }
  };
  return PortalWrapper2;
}(Component);
const Portal = PortalWrapper;
export {
  Portal as default
};
//# sourceMappingURL=index.js.map
