import type { ChangesBatch } from './Change.js';
export interface BaseEntry {
    sha: string;
    mode: string;
}
export interface FlatTreeEntry extends BaseEntry {
    type: string;
    path: string;
}
export interface FlatTree {
    sha: string;
    tree: Array<FlatTreeEntry>;
}
export interface Tree {
    sha: string;
    entries: Array<Entry>;
}
export interface Entry extends BaseEntry {
    name: string;
    entries?: Array<Entry>;
}
export declare class Leaf {
    readonly type: "blob";
    readonly sha: string;
    readonly mode: string;
    constructor({ sha, mode }: BaseEntry);
    clone(): Leaf;
    toJSON(): BaseEntry;
}
declare class TreeBase<Node extends TreeBase<Node>> {
    readonly type: "tree";
    readonly mode: string;
    sha: string | undefined;
    protected nodes: Map<string, Leaf | Node>;
    constructor(sha?: string);
    get(path: string): Node | Leaf | undefined;
    getNode(path: string): Node;
    getLeaf(path: string): Leaf;
    has(path: string): boolean;
    [Symbol.iterator](): IterableIterator<[string, Node | Leaf]>;
    paths(): Iterable<string>;
    index(): Map<string, string>;
    fileIndex(prefix: string): [string, string][];
    equals(other: ReadonlyTree | WriteableTree): boolean;
}
export declare class ReadonlyTree extends TreeBase<ReadonlyTree> {
    #private;
    readonly sha: string;
    static readonly EMPTY: ReadonlyTree;
    constructor({ sha, entries }: Tree);
    get isEmpty(): boolean;
    get entries(): Array<Entry>;
    get shas(): ReadonlySet<string>;
    hasSha(sha: string): boolean;
    clone(): WriteableTree;
    toJSON(): {
        sha: string;
        mode: string;
        entries: Entry[];
    };
    flat(): {
        sha: string;
        tree: FlatTreeEntry[];
    };
    withChanges(batch: ChangesBatch): Promise<ReadonlyTree>;
    static fromFlat(tree: FlatTree): ReadonlyTree;
    diff(that: TreeBase<any>): ChangesBatch;
}
export declare class WriteableTree extends TreeBase<WriteableTree> {
    #private;
    constructor({ sha, entries }?: Tree);
    add(path: string, input: {
        clone(): WriteableTree | Leaf;
    } | string): void;
    remove(path: string): boolean;
    rename(from: string, to: string): void;
    applyChanges(batch: ChangesBatch): void;
    getSha(): Promise<string>;
    compile(previous?: ReadonlyTree): Promise<ReadonlyTree>;
    clone(): WriteableTree;
}
export {};
