"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDivTextSize = void 0;
const getTextLines_1 = require("./getTextLines");
const getDivTextSize = (text, fontSize, maxLineLength) => {
    const lines = (0, getTextLines_1.getTextLines)(text, maxLineLength);
    const lineCount = lines.length;
    if (!lineCount) {
        return { width: 0, height: fontSize };
    }
    let maxLineCharCount = Number.MIN_SAFE_INTEGER;
    for (let i = 0; i < lines.length; i++) {
        const line = lines[i];
        const line_length = line.trim().length;
        maxLineCharCount = Math.max(maxLineCharCount, line_length);
    }
    const emptySpaceAround = text.length - text.trim().length;
    const width = ((maxLineCharCount + emptySpaceAround) * fontSize) / 2;
    const height = lineCount * fontSize;
    return { width, height };
};
exports.getDivTextSize = getDivTextSize;
//# sourceMappingURL=getDivTextSize.js.map