import { action, makeObservable, observable } from 'mobx';
export class ToolbarResponsivePriorityState {
    constructor(params) {
        this._shouldShrink = false;
        this._groupElement = null;
        this.expandedWidth = params.expandedWidth ?? 0;
        this.collapsedWidth = params.collapsedWidth ?? 0;
        this.responsive = params.responsive;
        makeObservable(this, {
            _shouldShrink: observable.ref,
            _syncWidth: action,
        });
    }
    _syncWidth() {
        const { _groupElement, _shouldShrink, responsive } = this;
        if (responsive.responsiveDisabled) {
            return;
        }
        if (!_groupElement) {
            return;
        }
        const measured = _groupElement.scrollWidth;
        if (_shouldShrink) {
            this.collapsedWidth = measured;
        }
        else {
            this.expandedWidth = measured;
        }
        responsive._scheduleRecompute();
    }
}
//# sourceMappingURL=ToolbarResponsivePriorityState.js.map