export function restoreAlignedRuntimeFormulaFamilyRuns(args) {
    const runtimeRuns = args.runs;
    if (!runtimeRuns || runtimeRuns.length === 0) {
        return undefined;
    }
    const restoredRuns = [];
    let fallbackCount = 0;
    for (const run of runtimeRuns) {
        const sheetId = args.sheetIdsByName.get(run.sheetName);
        if (sheetId === undefined ||
            run.cellIndices.length === 0 ||
            !Number.isInteger(run.templateId) ||
            !Number.isInteger(run.fixedIndex) ||
            !Number.isInteger(run.start) ||
            !Number.isInteger(run.step) ||
            run.step <= 0 ||
            (run.axis !== 'row' && run.axis !== 'column')) {
            fallbackCount += 1;
            continue;
        }
        restoredRuns.push({
            sheetId,
            templateId: run.templateId,
            shapeKey: run.shapeKey,
            axis: run.axis,
            fixedIndex: run.fixedIndex,
            start: run.start,
            step: run.step,
            lastIndex: run.start + run.step * (run.cellIndices.length - 1),
            ordered: true,
            cellIndices: run.cellIndices,
        });
    }
    return { runs: restoredRuns, fallbackCount };
}
//# sourceMappingURL=runtime-image-formula-family-runs.js.map