"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "RenderedRowsCalculationType", {
    enumerable: true,
    get: function() {
        return RenderedRowsCalculationType;
    }
});
const _partiallyVisibleRows = require("./partiallyVisibleRows");
class RenderedRowsCalculationType extends _partiallyVisibleRows.PartiallyVisibleRowsCalculationType {
    /**
   * Finalizes the calculation.
   *
   * @param {ViewportRowsCalculator} viewportCalculator The viewport calculator object.
   */ finalize(viewportCalculator) {
        super.finalize(viewportCalculator);
        const { overrideFn, totalRows, positionCache } = viewportCalculator;
        if (this.startRow !== null && typeof overrideFn === 'function') {
            const startRow = this.startRow;
            const endRow = this.endRow;
            overrideFn(this);
            this.rowStartOffset = startRow - this.startRow;
            this.rowEndOffset = this.endRow - endRow;
        }
        if (this.startRow < 0) {
            this.startRow = 0;
        }
        this.startPosition = this.startRow !== null ? positionCache.getOffset(this.startRow) : null;
        if (totalRows < this.endRow) {
            this.endRow = totalRows - 1;
        }
        if (this.startRow !== null) {
            this.count = this.endRow - this.startRow + 1;
        }
    }
    constructor(...args){
        super(...args), /**
   * The property holds the offset applied in the `overrideFn` function to the `startColumn` value.
   *
   * @type {number}
   */ this.rowStartOffset = 0, /**
   * The property holds the offset applied in the `overrideFn` function to the `endColumn` value.
   *
   * @type {number}
   */ this.rowEndOffset = 0;
    }
}
