text: "use strict";
  
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  
  exports.__esModule = true;
  exports.default = void 0;
  
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
  
  var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
  
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
  
  var _reactDom = require("react-dom");
  
  var _MapComponent2 = _interopRequireDefault(require("./MapComponent"));
  
  var _updateClassName = _interopRequireDefault(require("./utils/updateClassName"));
  
  var DivOverlay =
  /*#__PURE__*/
  function (_MapComponent) {
    (0, _inheritsLoose2.default)(DivOverlay, _MapComponent);
  
    function DivOverlay(props) {
      var _this;
  
      _this = _MapComponent.call(this, props) || this;
      (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onClose", function () {
        if (_this.props.onClose) {
          _this.props.onClose();
        }
      });
      (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onOpen", function () {
        _this.forceUpdate(); // Re-render now that leafletElement is created
  
  
        if (_this.props.onOpen) {
          _this.props.onOpen();
        }
      });
      _this.leafletElement = _this.createLeafletElement(props);
      return _this;
    }
  
    var _proto = DivOverlay.prototype;
  
    _proto.createLeafletElement = function createLeafletElement(_props) {
      throw new Error('createLeafletElement() must be implemented');
    };
  
    _proto.updateLeafletElement = function updateLeafletElement(_prevProps, _props) {};
  
    _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
      (0, _updateClassName.default)(this.leafletElement._container, prevProps.className, this.props.className);
      this.updateLeafletElement(prevProps, this.props);
  
      if (this.leafletElement.isOpen()) {
        this.leafletElement.update();
        this.onRender();
      }
    };
  
    _proto.onRender = function onRender() {};
  
    _proto.render = function render() {
      if (this.leafletElement._contentNode) {
        return (0, _reactDom.createPortal)(this.props.children, this.leafletElement._contentNode);
      }
  
      return null;
    };
  
    return DivOverlay;
  }(_MapComponent2.default);
  
  exports.default = DivOverlay;