export function emitCellMutationFastPathBatchResult(args) {
    const previousMetrics = args.state.getLastMetrics();
    const lastMetrics = {
        ...previousMetrics,
        dirtyFormulaCount: 0,
        wasmFormulaCount: 0,
        jsFormulaCount: 0,
        rangeNodeVisits: 0,
        recalcMs: 0,
        batchId: previousMetrics.batchId + 1,
        changedInputCount: args.changedInputCount,
        compileMs: 0,
    };
    args.state.setLastMetrics(lastMetrics);
    if (args.hasGeneralEventListeners || args.hasWatchedCellListeners) {
        const event = {
            kind: 'batch',
            invalidation: 'cells',
            changedCellIndices: args.changed,
            changedCells: args.hasGeneralEventListeners ? args.captureChangedCells(args.changed) : [],
            invalidatedRanges: [],
            invalidatedRows: [],
            invalidatedColumns: [],
            metrics: lastMetrics,
            explicitChangedCount: args.explicitChangedCount,
        };
        args.state.events.emit(event, args.changed, (cellIndex) => args.state.workbook.getQualifiedAddress(cellIndex));
    }
    if (args.hasTrackedEventListeners) {
        args.state.events.emitTracked({
            kind: 'batch',
            invalidation: 'cells',
            changedCellIndices: args.changed,
            invalidatedRanges: [],
            invalidatedRows: [],
            invalidatedColumns: [],
            metrics: lastMetrics,
            explicitChangedCount: args.explicitChangedCount,
        });
    }
    if (args.batch) {
        void args.state.getSyncClientConnection()?.send(args.batch);
        args.emitBatch(args.batch);
    }
}
//# sourceMappingURL=operation-fast-path-batch-result.js.map