"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ColorBrewerSwatch = exports.getMaxRamp = exports.getColorBrewerRamps = void 0;
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var colorbrewer_1 = tslib_1.__importDefault(require("colorbrewer"));
function getColorBrewerRamps() {
    var ramps = [];
    for (var cat in colorbrewer_1.default.schemeGroups) {
        for (var _i = 0, _a = colorbrewer_1.default.schemeGroups[cat]; _i < _a.length; _i++) {
            var scheme = _a[_i];
            ramps.push({ displayName: "".concat(cat, " - ").concat(scheme), category: cat, scheme: scheme, ramp: getMaxRamp(scheme) });
        }
    }
    return ramps;
}
exports.getColorBrewerRamps = getColorBrewerRamps;
function getMaxRamp(scheme) {
    var theScheme;
    var len = 0;
    for (var s in scheme) {
        var arr = scheme[s];
        if (arr.length > len) {
            theScheme = arr;
            len = arr.length;
        }
    }
    return theScheme;
}
exports.getMaxRamp = getMaxRamp;
var ColorBrewerSwatch = function (props) {
    var ramp = getMaxRamp(colorbrewer_1.default[props.theme]);
    if (ramp) {
        return React.createElement("table", null,
            React.createElement("colgroup", null, ramp.map(function (r, i) { return React.createElement("col", { key: "ramp-col-".concat(i), span: 1, style: { width: 12 } }); })),
            React.createElement("tbody", null,
                React.createElement("tr", null, ramp.map(function (r, i) { return React.createElement("td", { key: "ramp-".concat(i), style: { border: "1px solid black", backgroundColor: r } }, "\u00A0"); }))));
    }
    ;
    return React.createElement(React.Fragment, null);
};
exports.ColorBrewerSwatch = ColorBrewerSwatch;
//# sourceMappingURL=color-brewer.js.map