import { computed, makeObservable } from 'mobx';
export class ResponsiveColumnsState {
    constructor({ gridState, minItemWidth, rectState, containerPadding = 0, }) {
        this.gridState = gridState;
        this._minItemWidth = minItemWidth;
        this._rectState = rectState;
        this._containerPadding = containerPadding;
        makeObservable(this, {
            itemsContentWidth: computed,
            widthWithLastColumnGap: computed,
            columnCount: computed,
            containerPadding: computed,
        });
    }
    get gap() {
        return this.gridState.gap;
    }
    get minItemWidth() {
        return this._minItemWidth;
    }
    get itemsContentWidth() {
        return this._rectState.rect.width ?? 0;
    }
    get widthWithLastColumnGap() {
        return this.itemsContentWidth + this.gap - this.containerPadding;
    }
    get containerPadding() {
        return this._containerPadding;
    }
    get columnCount() {
        const { gap, minItemWidth, widthWithLastColumnGap } = this;
        const maxItemWidthWithGap = minItemWidth + gap;
        return Math.max(Math.floor(widthWithLastColumnGap / maxItemWidthWithGap), 1);
    }
}
//# sourceMappingURL=ResponsiveColumnsState.js.map