"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseLayerSwitcherContainer = void 0;
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var base_layer_switcher_1 = require("../components/base-layer-switcher");
var hooks_1 = require("./hooks");
var map_1 = require("../actions/map");
var context_1 = require("../components/map-providers/context");
var BaseLayerSwitcherContainer = function () {
    var mapName = (0, hooks_1.useActiveMapName)();
    var locale = (0, hooks_1.useViewerLocale)();
    var externalBaseLayers = (0, hooks_1.useActiveMapExternalBaseLayers)();
    var dispatch = (0, context_1.useReduxDispatch)();
    var setBaseLayerAction = function (mapName, layerName) { return dispatch((0, map_1.setBaseLayer)(mapName, layerName)); };
    var onBaseLayerChanged = function (layerName) {
        if (mapName) {
            setBaseLayerAction === null || setBaseLayerAction === void 0 ? void 0 : setBaseLayerAction(mapName, layerName);
        }
    };
    if (locale && externalBaseLayers) {
        return React.createElement(base_layer_switcher_1.BaseLayerSwitcher, { onBaseLayerChanged: onBaseLayerChanged, externalBaseLayers: externalBaseLayers, locale: locale });
    }
    else {
        return React.createElement("noscript", null);
    }
};
exports.BaseLayerSwitcherContainer = BaseLayerSwitcherContainer;
//# sourceMappingURL=base-layer-switcher.js.map