/**
 * ConflictCandidateCollector — mutable accumulator for conflict candidates.
 *
 * Owns the per-frame analysis pipeline: raw op → canonical op → target identity →
 * effect digest → OpRecord → immediate/eventual candidate classification.
 *
 * @module domain/services/strand/ConflictCandidateCollector
 */
import { analyzeFrameOps, addEventualOverrideCandidates } from "./conflictCandidateAnalysis.js";
export { inferCausalRelation } from "./conflictCandidateAnalysis.js";
/**
 * Mutable accumulator for conflict candidates during frame analysis.
 *
 * Use the static `collect` factory to build a fully populated instance.
 */
export class ConflictCandidateCollector {
    propertyWinnerByTarget;
    propertyAppliedHistory;
    equivalentWinnerByTargetEffect;
    candidates;
    /**
     * Creates an empty collector. Use `ConflictCandidateCollector.collect()` to populate.
     */
    constructor() {
        this.propertyWinnerByTarget = new Map();
        this.propertyAppliedHistory = new Map();
        this.equivalentWinnerByTargetEffect = new Map();
        this.candidates = [];
    }
    /**
     * Walks all patch frames, builds op records, and classifies conflict candidates.
     */
    static async collect(context, { patchFrames, scannedPatchShas, diagnostics, }) {
        const collector = new ConflictCandidateCollector();
        for (const frame of patchFrames) {
            await analyzeFrameOps(context, { frame, scannedPatchShas, diagnostics, collector });
        }
        addEventualOverrideCandidates(collector, scannedPatchShas);
        return collector;
    }
}
