/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { ChangeRebaser, GraphCommit, RevisionTag } from "../core/index.js";
import { ICommitEnricher } from "../shared-tree-core/index.js";
import { disposeSymbol } from "../util/index.js";
/**
 * A checkout whose state can be controlled by a {@link CommitEnricher} to enrich changes with refreshers.
 *
 * This is similar to a {@link TreeCheckout} in that it represents the state of the tree at a specific revision.
 * But unlike a `TreeCheckout`...
 * - It is not backed by a branch because the `CommitEnricher` that owns it controls which revision it should represent.
 * - The host application has no knowledge of it, so applying changes to it has not impact on the application.
 * - It need not maintain any state or indexes that do not play a role in enriching changes.
 *
 * See implementations for examples.
 */
export interface ChangeEnricherCheckout<TChange> {
    /**
     * Updates the set of refreshers on a change.
     * @param change - the change to enrich. Not mutated.
     * @param revision - the revision associated with the change.
     * @returns the enriched change. Possibly the same as the one passed in.
     */
    updateChangeEnrichments(change: TChange, revision: RevisionTag): TChange;
    /**
     * Applies a change to the tip state.
     * @param change - the change to apply. Not mutated.
     * @param revision - the revision associated with the change.
     * Can be undefined when the applied change is a rollback.
     */
    applyTipChange(change: TChange, revision?: RevisionTag): void;
    /**
     * Disposes of the enricher.
     */
    [disposeSymbol](): void;
}
/**
 * Default implementation of {@link ICommitEnricher}.
 */
export declare class DefaultCommitEnricher<TChange> implements ICommitEnricher<TChange> {
    /**
     * A function that can invert a change.
     */
    private readonly inverter;
    /**
     * A factory that return a new {@link ChangeEnricherCheckout} that corresponds to the tip of the top-most local
     * branch.
     */
    private readonly checkoutFactory;
    /**
     * Change enricher that represent the tip of the top-level local branch (i.e., the branch on which in-flight
     * commits are applied and automatically rebased).
     */
    private tip;
    /**
     * The list of commits (from oldest to most recent) that have been submitted but not sequenced.
     */
    private inFlightQueue;
    /**
     * The list of commits (from oldest to most recent) that should be resubmitted.
     */
    private resubmitQueue;
    /**
     * Represents the index in the `inFlightQueue` array of the most recent in flight commit that has
     * undergone rebasing but whose enrichments have not been updated.
     * All in-flight commits with an index inferior or equal to this number have stale enrichments.
     *
     * Is -1 when *any* of the following is true:
     * - There are no in-flight commits (i.e., no local commits have been made or they have all been sequenced)
     * - None of the in-flight commits have been rebased
     * - In-flight commits that have been rebased have all had their enrichments updated
     */
    private latestInFlightCommitWithStaleEnrichments;
    constructor(
    /**
     * A function that can invert a change.
     */
    inverter: ChangeRebaser<TChange>["invert"], 
    /**
     * A factory that return a new {@link ChangeEnricherCheckout} that corresponds to the tip of the top-most local
     * branch.
     */
    checkoutFactory: () => ChangeEnricherCheckout<TChange>);
    enrichCommit(commit: GraphCommit<TChange>): GraphCommit<TChange>;
    prepareForResubmit(toResubmit: readonly GraphCommit<TChange>[]): void;
    get isInResubmitPhase(): boolean;
    onSequencedCommitApplied(isLocal: boolean): void;
}
//# sourceMappingURL=defaultCommitEnricher.d.ts.map