"use strict";

Object.defineProperty(exports, "__esModule", {
    value: !0
}), exports.clearActiveCellRangeState = exports.setActiveCellRangeState = exports.isZeroStyle = exports.isValidStyle = exports.getVerticalScrollBarSize = exports.getHorizontalScrollBarSize = void 0;

const vutils_1 = require("@visactor/vutils");

function getHorizontalScrollBarSize(scrollStyle) {
    var _a;
    return (null == scrollStyle ? void 0 : scrollStyle.hoverOn) || (null == scrollStyle ? void 0 : scrollStyle.horizontalVisible) && "none" === (null == scrollStyle ? void 0 : scrollStyle.horizontalVisible) || !(null == scrollStyle ? void 0 : scrollStyle.horizontalVisible) && "none" === (null == scrollStyle ? void 0 : scrollStyle.visible) ? 0 : null !== (_a = null == scrollStyle ? void 0 : scrollStyle.width) && void 0 !== _a ? _a : 7;
}

function getVerticalScrollBarSize(scrollStyle) {
    var _a;
    return (null == scrollStyle ? void 0 : scrollStyle.hoverOn) || (null == scrollStyle ? void 0 : scrollStyle.verticalVisible) && "none" === (null == scrollStyle ? void 0 : scrollStyle.verticalVisible) || !(null == scrollStyle ? void 0 : scrollStyle.verticalVisible) && "none" === (null == scrollStyle ? void 0 : scrollStyle.visible) ? 0 : null !== (_a = null == scrollStyle ? void 0 : scrollStyle.width) && void 0 !== _a ? _a : 7;
}

function isValidStyle(style) {
    return !!(0, vutils_1.isValid)(style) && (!(0, vutils_1.isArray)(style) || style.some((s => (0, 
    vutils_1.isValid)(s))));
}

function isZeroStyle(style) {
    return 0 === style || (0, vutils_1.isArray)(style) && style.every((s => 0 === s));
}

function setActiveCellRangeState(table) {
    const selectRanges = table.stateManager.select.ranges, setRanges = [];
    for (let i = 0; i < selectRanges.length; i++) {
        const range = selectRanges[i];
        setRanges.push({
            range: range,
            style: {
                cellBorderColor: "blue",
                cellBorderLineWidth: 2,
                cellBorderLineDash: [ 5, 5 ]
            }
        });
    }
    table.stateManager.setCustomSelectRanges(setRanges);
}

function clearActiveCellRangeState(table) {
    table.stateManager.setCustomSelectRanges([]);
}

exports.getHorizontalScrollBarSize = getHorizontalScrollBarSize, exports.getVerticalScrollBarSize = getVerticalScrollBarSize, 
exports.isValidStyle = isValidStyle, exports.isZeroStyle = isZeroStyle, exports.setActiveCellRangeState = setActiveCellRangeState, 
exports.clearActiveCellRangeState = clearActiveCellRangeState;
//# sourceMappingURL=style.js.map
