"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

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

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

var _deck = _interopRequireDefault(require("deck.gl"));

var _MultiPathMap = _interopRequireDefault(require("./MultiPathMap"));

var _MultiScatterPlotMap = _interopRequireDefault(require("./MultiScatterPlotMap"));

var _MultiScreenGridMap = _interopRequireDefault(require("./MultiScreenGridMap"));

var _MultiIconMap = _interopRequireDefault(require("./MultiIconMap"));

var _MultiSmallPolygonMap = _interopRequireDefault(require("./MultiSmallPolygonMap"));

var _MultiChoroplethMap = _interopRequireDefault(require("./MultiChoroplethMap"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _extends() { _extends = Object.assign || 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 _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var MultiLayerMap = function MultiLayerMap(props) {
  var viewport = props.viewport,
      mapLayers = props.mapLayers,
      children = props.children,
      onHoverSlide = props.onHoverSlide;
  var renderMaps = mapLayers.map(function (layerData, index) {
    var mapType = layerData.mapType;
    return mapType === "PathMap" ? (0, _MultiPathMap["default"])(_objectSpread({}, layerData, {
      index: index,
      onHoverSlide: onHoverSlide
    })) : mapType === "ScatterPlotMap" ? (0, _MultiScatterPlotMap["default"])(_objectSpread({}, layerData, {
      index: index,
      onHoverSlide: onHoverSlide
    })) : mapType === "ScreenGridMap" ? (0, _MultiScreenGridMap["default"])(_objectSpread({}, layerData, {
      index: index
    })) : mapType === "IconMap" ? (0, _MultiIconMap["default"])(_objectSpread({}, layerData, {
      index: index,
      onHoverSlide: onHoverSlide,
      viewport: viewport
    })) : mapType === "SmallPolygonMap" ? (0, _MultiSmallPolygonMap["default"])(_objectSpread({}, layerData, {
      index: index,
      onHoverSlide: onHoverSlide,
      viewport: viewport
    })) : mapType === "ChoroplethMap" ? (0, _MultiChoroplethMap["default"])(_objectSpread({}, layerData, {
      index: index,
      onHoverSlide: onHoverSlide
    })) : null;
  });
  return _react["default"].createElement(_deck["default"], _extends({
    className: "DeckGL-Map-Layer",
    getCursor: function getCursor() {
      return "crosshair";
    }
  }, viewport), renderMaps, children);
};

MultiLayerMap.propTypes = {
  viewport: (0, _propTypes.shape)({}),
  mapLayers: (0, _propTypes.arrayOf)((0, _propTypes.shape)({})).isRequired,
  onHoverSlide: _propTypes.func,
  onClick: _propTypes.func,
  children: _propTypes.node
};
MultiLayerMap.defaultProps = {};
var _default = MultiLayerMap;
exports["default"] = _default;