"use strict";

function calcStartPosition(left, top, width, height, contentWidth, contentHeight, textAlign = "left", textBaseline = "middle", margin = [ 0, 0, 0, 0 ], paddingLeft = 0, paddingRight = 0, paddingTop = 0, paddingBottom = 0) {
    const right = left + width, bottom = top + height;
    let x = left + margin[3] + paddingLeft;
    "right" === textAlign || "end" === textAlign ? x = right - contentWidth - margin[1] - paddingRight : "center" === textAlign && (x = left + (width - contentWidth + paddingLeft - paddingRight) / 2);
    let y = top + margin[0] + paddingTop;
    return "bottom" === textBaseline || "alphabetic" === textBaseline || "ideographic" === textBaseline ? y = bottom - contentHeight - margin[2] - paddingBottom : "middle" === textBaseline && (y = top + (height - contentHeight + paddingTop - paddingBottom) / 2), 
    {
        x: x,
        y: y
    };
}

function calculateCellRangeDistribution(startCol, startRow, endCol, endRow, table) {
    let needRowHeader = !1, needRightRowHeader = !1, needColumnHeader = !1, needBottomColumnHeader = !1, needBody = !1, needCornerHeader = !1, needRightTopCornerHeader = !1, needRightBottomCornerHeader = !1, needLeftBottomCornerHeader = !1;
    return startCol <= table.frozenColCount - 1 && startRow <= table.frozenRowCount - 1 && (needCornerHeader = !0), 
    endCol >= table.colCount - table.rightFrozenColCount && startRow <= table.frozenRowCount - 1 && (needRightTopCornerHeader = !0), 
    startCol <= table.frozenColCount - 1 && endRow >= table.rowCount - table.bottomFrozenRowCount && (needLeftBottomCornerHeader = !0), 
    endCol >= table.colCount - table.rightFrozenColCount && endRow >= table.rowCount - table.bottomFrozenRowCount && (needRightBottomCornerHeader = !0), 
    startCol <= table.frozenColCount - 1 && endRow >= table.frozenRowCount && startRow <= table.rowCount - table.bottomFrozenRowCount - 1 && (needRowHeader = !0), 
    endCol >= table.colCount - table.rightFrozenColCount && endRow >= table.frozenRowCount && startRow <= table.rowCount - table.bottomFrozenRowCount - 1 && (needRightRowHeader = !0), 
    startRow <= table.frozenRowCount - 1 && endCol >= table.frozenColCount && startCol <= table.colCount - table.rightFrozenColCount - 1 && (needColumnHeader = !0), 
    endRow >= table.rowCount - table.bottomFrozenRowCount && endCol >= table.frozenColCount && startCol <= table.colCount - table.rightFrozenColCount - 1 && (needBottomColumnHeader = !0), 
    startCol <= table.colCount - table.rightFrozenColCount - 1 && endCol >= table.frozenColCount && startRow <= table.rowCount - table.bottomFrozenRowCount - 1 && endRow >= table.frozenRowCount && (needBody = !0), 
    {
        needRowHeader: needRowHeader,
        needRightRowHeader: needRightRowHeader,
        needColumnHeader: needColumnHeader,
        needBottomColumnHeader: needBottomColumnHeader,
        needBody: needBody,
        needCornerHeader: needCornerHeader,
        needRightTopCornerHeader: needRightTopCornerHeader,
        needLeftBottomCornerHeader: needLeftBottomCornerHeader,
        needRightBottomCornerHeader: needRightBottomCornerHeader
    };
}

Object.defineProperty(exports, "__esModule", {
    value: !0
}), exports.calculateCellRangeDistribution = exports.calcStartPosition = void 0, 
exports.calcStartPosition = calcStartPosition, exports.calculateCellRangeDistribution = calculateCellRangeDistribution;
//# sourceMappingURL=cell-pos.js.map
