"use strict";

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

var _defaultStopMarker = _interopRequireDefault(require("@opentripplanner/stops-overlay/lib/default-stop-marker"));

var _reactRedux = require("react-redux");

var _map = require("../../actions/map");

var _ui = require("../../actions/ui");

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

// connect to the redux store
const mapStateToProps = (state, ownProps) => {
  var _state$otp$transitInd;

  const {
    highlightedStop,
    viewedRoute
  } = state.otp.ui;
  const routeData = viewedRoute && ((_state$otp$transitInd = state.otp.transitIndex.routes) === null || _state$otp$transitInd === void 0 ? void 0 : _state$otp$transitInd[viewedRoute.routeId]);
  const hoverColor = (routeData === null || routeData === void 0 ? void 0 : routeData.routeColor) || '#333';
  return {
    languageConfig: state.otp.config.language,
    leafletPath: {
      color: '#000',
      fillColor: highlightedStop === ownProps.entity.id ? hoverColor : '#FFF',
      fillOpacity: 1,
      weight: 1
    },
    stop: ownProps.entity
  };
};

const mapDispatchToProps = {
  setLocation: _map.setLocation,
  setViewedStop: _ui.setViewedStop
};

var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_defaultStopMarker.default);

exports.default = _default;
module.exports = exports.default;

//# sourceMappingURL=connected-stop-marker.js