/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { ICodecFamily, ICodecOptions } from "../../codec";
import { ChangeFamily, EditBuilder, ChangeRebaser, FieldKindIdentifier, UpPath, TaggedChange, RevisionTag, ChangeFamilyEditor, FieldUpPath, ChangesetLocalId, RevisionMetadataSource, RevisionInfo, ChangeAtomIdMap, JsonableTree, ITreeCursor, DeltaRoot } from "../../core";
import { FieldChangeHandler, RebaseRevisionMetadata } from "./fieldChangeHandler";
import { FieldKind, FieldKindWithEditor } from "./fieldKind";
import { FieldChangeset, ModularChangeset } from "./modularChangeTypes";
/**
 * Implementation of ChangeFamily which delegates work in a given field to the appropriate FieldKind
 * as determined by the schema.
 */
export declare class ModularChangeFamily implements ChangeFamily<ModularEditBuilder, ModularChangeset>, ChangeRebaser<ModularChangeset> {
    readonly fieldKinds: ReadonlyMap<FieldKindIdentifier, FieldKindWithEditor>;
    static readonly emptyChange: ModularChangeset;
    readonly codecs: ICodecFamily<ModularChangeset>;
    constructor(fieldKinds: ReadonlyMap<FieldKindIdentifier, FieldKindWithEditor>, codecOptions: ICodecOptions);
    get rebaser(): ChangeRebaser<ModularChangeset>;
    /**
     * Produces an equivalent list of `FieldChangeset`s that all target the same {@link FieldKind}.
     * @param changes - The list of `FieldChange`s whose `FieldChangeset`s needs to be normalized.
     * @returns An object that contains both the equivalent list of `FieldChangeset`s that all
     * target the same {@link FieldKind}, and the `FieldKind` that they target.
     * The returned `FieldChangeset`s may be a shallow copy of the input `FieldChange`s.
     */
    private normalizeFieldChanges;
    compose(changes: TaggedChange<ModularChangeset>[]): ModularChangeset;
    private composeFieldMaps;
    private composeNodeChanges;
    /**
     * @param change - The change to invert.
     * @param isRollback - Whether the inverted change is meant to rollback a change on a branch as is the case when
     * performing a sandwich rebase.
     * @param repairStore - The store to query for repair data.
     */
    invert(change: TaggedChange<ModularChangeset>, isRollback: boolean): ModularChangeset;
    private invertFieldMap;
    private invertNodeChange;
    rebase(change: ModularChangeset, over: TaggedChange<ModularChangeset>, revisionMetadata: RevisionMetadataSource): ModularChangeset;
    private rebaseFieldMap;
    private rebaseNodeChange;
    private pruneFieldMap;
    private pruneNodeChange;
    buildEditor(changeReceiver: (change: ModularChangeset) => void): ModularEditBuilder;
}
/**
 * @param change - The change to convert into a delta.
 * @param fieldKinds - The field kinds to delegate to.
 */
export declare function intoDelta(taggedChange: TaggedChange<ModularChangeset>, fieldKinds: ReadonlyMap<FieldKindIdentifier, FieldKindWithEditor>): DeltaRoot;
/**
 * @alpha
 * @param revInfos - This should describe all revisions in the rebase path, even if not part of the current base changeset.
 * @param baseRevisions - The set of revisions in the changeset being rebased over
 * @returns - RebaseRevisionMetadata to be passed to `FieldChangeRebaser.rebase`*
 */
export declare function rebaseRevisionMetadataFromInfo(revInfos: readonly RevisionInfo[], baseRevisions: (RevisionTag | undefined)[]): RebaseRevisionMetadata;
export declare function getFieldKind(fieldKinds: ReadonlyMap<FieldKindIdentifier, FieldKind>, kind: FieldKindIdentifier): FieldKindWithEditor;
export declare function getChangeHandler(fieldKinds: ReadonlyMap<FieldKindIdentifier, FieldKind>, kind: FieldKindIdentifier): FieldChangeHandler<unknown>;
export declare class ModularEditBuilder extends EditBuilder<ModularChangeset> {
    private transactionDepth;
    private idAllocator;
    constructor(family: ChangeFamily<ChangeFamilyEditor, ModularChangeset>, changeReceiver: (change: ModularChangeset) => void);
    enterTransaction(): void;
    exitTransaction(): void;
    apply(change: ModularChangeset): void;
    buildTrees(firstId: ChangesetLocalId, newContent: ITreeCursor | readonly ITreeCursor[]): GlobalEditDescription;
    /**
     * Adds a change to the edit builder
     * @param field - the field which is being edited
     * @param fieldKind - the kind of the field
     * @param change - the change to the field
     * @param maxId - the highest `ChangesetLocalId` used in this change
     */
    submitChange(field: FieldUpPath, fieldKind: FieldKindIdentifier, change: FieldChangeset, maxId?: ChangesetLocalId): void;
    submitChanges(changes: EditDescription[], maxId?: ChangesetLocalId): void;
    generateId(count?: number): ChangesetLocalId;
    private buildChangeMap;
    addNodeExistsConstraint(path: UpPath): void;
}
/**
 * @alpha
 */
export interface FieldEditDescription {
    type: "field";
    field: FieldUpPath;
    fieldKind: FieldKindIdentifier;
    change: FieldChangeset;
}
/**
 * @alpha
 */
export interface GlobalEditDescription {
    type: "global";
    builds?: ChangeAtomIdMap<JsonableTree>;
}
/**
 * @alpha
 */
export type EditDescription = FieldEditDescription | GlobalEditDescription;
//# sourceMappingURL=modularChangeFamily.d.ts.map