"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VersionUpgrade21 = void 0;
const VersionUpgrade_1 = require("./VersionUpgrade");
const LayoutHelpers_1 = require("../Api/Implementation/LayoutHelpers");
class VersionUpgrade21 extends VersionUpgrade_1.VersionUpgrade {
    migrateState(state) {
        this.migrateLayoutState(state);
        return state;
    }
    migrateLayoutState(state) {
        const layoutState = state.Layout;
        if (layoutState && layoutState.Layouts) {
            layoutState.Layouts = layoutState.Layouts.map((layout) => {
                //@ts-ignore
                if (layout.ColumnWidths && !layout.ColumnSizing) {
                    //@ts-ignore
                    layout.ColumnSizing = (0, LayoutHelpers_1.columnWidthsToColumnSizing)(layout.ColumnWidths);
                    //@ts-ignore
                    delete layout.ColumnWidths;
                }
                return layout;
            });
        }
        return state;
    }
}
exports.VersionUpgrade21 = VersionUpgrade21;
