"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.migrateInvalidTimelineStages = migrateInvalidTimelineStages;
const util_1 = require("../../util");
function migrateInvalidTimelineStages(project) {
    if (project.schemaVersion >= 1.2) {
        return project;
    }
    const clone = (0, util_1.cloneObject)(project);
    if (clone.view &&
        clone.view.timeline &&
        clone.view.timeline.stages &&
        Array.isArray(clone.view.timeline.stages)) {
        clone.view.timeline.stages = clone.view.timeline.stages.filter((stage) => !!stage.title);
    }
    clone.schemaVersion = 1.2; // Update schema version to reflect migration
    return clone;
}
//# sourceMappingURL=migrateInvalidTimelineStages.js.map