"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports.default = void 0;

var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _react = _interopRequireDefault(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var L = _interopRequireWildcard(require("leaflet"));

var _reactLeaflet = require("react-leaflet");

require("./leaflet.google");

var GoogleLayer =
/*#__PURE__*/
function (_GridLayer) {
  (0, _inheritsLoose2.default)(GoogleLayer, _GridLayer);

  function GoogleLayer() {
    return _GridLayer.apply(this, arguments) || this;
  }

  var _proto = GoogleLayer.prototype;

  _proto.createLeafletElement = function createLeafletElement(props) {
    this.leafletElement = new L.gridLayer.googleMutant(props);
    return this.leafletElement;
  };

  _proto.updateLeafletElement = function updateLeafletElement(prevProps, nextProps) {
    var opacity = nextProps.opacity,
        zIndex = nextProps.zIndex;

    if (opacity !== prevProps.opacity) {
      this.leafletElement.setOpacity(opacity);
    }

    if (zIndex !== prevProps.zIndex) {
      this.leafletElement.setZIndex(zIndex);
    }
  };

  return GoogleLayer;
}(_reactLeaflet.GridLayer);

(0, _defineProperty2.default)(GoogleLayer, "propTypes", {
  googlekey: _propTypes.default.string.isRequired,
  maptype: _propTypes.default.string,
  asclientid: _propTypes.default.bool,
  channel: _propTypes.default.string
});
(0, _defineProperty2.default)(GoogleLayer, "contextTypes", _reactLeaflet.GridLayer.contextTypes);
(0, _defineProperty2.default)(GoogleLayer, "childContextTypes", _reactLeaflet.GridLayer.childContextTypes);

var _default = (0, _reactLeaflet.withLeaflet)(GoogleLayer);

exports.default = _default;