export function applyFormulaRuntimePlanFields(formula, update) {
    formula.source = update.source;
    formula.structuralSourceTransform = undefined;
    formula.sourceRenameTransform = undefined;
    formula.sourceRenameTransforms = undefined;
    delete formula.preserveCachedValueOnFullRecalc;
    formula.planId = update.plan.id;
    formula.templateId = update.templateId;
    formula.compiled = update.plan.compiled;
    formula.plan = update.plan;
    formula.inlineScalarFastPlanKind = update.inlineScalarFastPlanKind;
    if (update.inlineScalarArithmeticDeltaCoefficients !== undefined || formula.inlineScalarArithmeticDeltaCoefficients !== undefined) {
        formula.inlineScalarArithmeticDeltaCoefficients = update.inlineScalarArithmeticDeltaCoefficients;
    }
    if (update.inlineScalarFastPlanStringIds !== undefined || formula.inlineScalarFastPlanStringIds !== undefined) {
        formula.inlineScalarFastPlanStringIds = update.inlineScalarFastPlanStringIds;
    }
    formula.inlineScalarPlanCellIndices = update.inlineScalarPlanCellIndices;
    if (update.runtimeProgram !== undefined) {
        formula.runtimeProgram = update.runtimeProgram;
    }
    formula.constants = update.plan.compiled.constants;
    formula.programLength = update.programLength;
    formula.constNumberLength = update.plan.compiled.constants.length;
}
export function applyDirectScalarReplacementRuntimePlanFields(formula, update) {
    const compiled = update.plan.compiled;
    const runtimeProgram = compiled.volatile || compiled.producesSpill ? compiled.program : compiled.program.subarray(0, 0);
    applyFormulaRuntimePlanFields(formula, { ...update, runtimeProgram, programLength: runtimeProgram.length });
}
//# sourceMappingURL=formula-binding-runtime-update.js.map