"use strict";
var __read = (this && this.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var re_reselect_1 = __importDefault(require("re-reselect"));
var light_theme_1 = require("../../utils/themes/light_theme");
var theme_1 = require("../../utils/themes/theme");
var get_chart_id_1 = require("./get_chart_id");
var get_settings_specs_1 = require("./get_settings_specs");
exports.getChartThemeSelector = re_reselect_1.default([get_settings_specs_1.getSettingsSpecSelector], function (settingsSpec) { return getTheme(settingsSpec.baseTheme, settingsSpec.theme); })(get_chart_id_1.getChartIdSelector);
function getTheme(baseTheme, theme) {
    var base = baseTheme || light_theme_1.LIGHT_THEME;
    if (Array.isArray(theme)) {
        var _a = __read(theme), firstTheme = _a[0], axillaryThemes = _a.slice(1);
        return theme_1.mergeWithDefaultTheme(firstTheme, base, axillaryThemes);
    }
    return theme ? theme_1.mergeWithDefaultTheme(theme, base) : base;
}
//# sourceMappingURL=get_chart_theme.js.map