import { Dot } from './Dot.ts';
/**
 * VersionVector — causality tracking for distributed CRDT systems.
 *
 * Maps each writer ID to the highest operation counter observed from
 * that writer. Forms a join-semilattice under pointwise maximum (merge).
 *
 * Instances are mutable during reduce (patch application) for performance.
 * Clone before handing to consumers that expect isolation.
 */
export default class VersionVector {
    #private;
    /**
     * Internal constructor — takes a pre-validated Map.
     *
     * External callers should use {@link VersionVector.empty} or
     * {@link VersionVector.from}.
     */
    constructor(entries: Map<string, number>);
    /** Creates an empty VersionVector. */
    static empty(): VersionVector;
    /**
     * Creates a VersionVector from a source.
     *
     * Accepts:
     * - Another VersionVector (clones it)
     * - A Map<string, number> (validates and copies)
     * - A plain object {writerId: counter} (boundary parse — skips zero counters)
     */
    static from(source: VersionVector | Map<string, number> | Record<string, number>): VersionVector;
    /** Validates and wraps a Map as a VersionVector. */
    static _fromMap(source: Map<string, number>): VersionVector;
    /**
     * Boundary deserialization from a plain object.
     * Zero counters are elided: a counter of 0 carries no causal
     * information and wastes space.
     */
    static _fromPlainObject(source: Record<string, number>): VersionVector;
    /**
     * Converts a VersionVector to a plain object with sorted keys for
     * deterministic encoding. This is a codec-layer concern — the domain
     * type provides iteration, the codec decides the wire format.
     */
    static serialize(vv: VersionVector): Record<string, number>;
    /** Returns the counter for a writer, or undefined if not present. */
    get(writerId: string): number | undefined;
    /**
     * Sets the counter for a writer. Validates the entry.
     */
    set(writerId: string, counter: number): this;
    /** Returns true if the writer has an entry. */
    has(writerId: string): boolean;
    /** The number of writer entries. */
    get size(): number;
    /** Iterates over [writerId, counter] entries. */
    [Symbol.iterator](): IterableIterator<[string, number]>;
    /** Returns an iterator over writer IDs. */
    keys(): IterableIterator<string>;
    /** Returns an iterator over counter values. */
    values(): IterableIterator<number>;
    /** Returns an iterator over [writerId, counter] entries. */
    entries(): IterableIterator<[string, number]>;
    /**
     * Increments the counter for a writer and returns the new Dot.
     * This mutates the VersionVector.
     */
    increment(writerId: string): Dot;
    /**
     * Merges with another VersionVector by taking the pointwise maximum.
     * Returns a new VersionVector; does not mutate either input.
     *
     * Properties:
     * - Commutative: a.merge(b).equals(b.merge(a))
     * - Associative: a.merge(b).merge(c).equals(a.merge(b.merge(c)))
     * - Idempotent: a.merge(a).equals(a)
     */
    merge(other: VersionVector): VersionVector;
    /**
     * Checks if this VersionVector descends from (is >= than) another.
     * this >= other means for every entry in other, this has an equal
     * or greater counter.
     */
    descends(other: VersionVector): boolean;
    /**
     * Checks if a dot is contained within (observed by) this VersionVector.
     * A dot is contained if dot.counter <= this[dot.writerId].
     */
    contains(dot: Dot): boolean;
    /** Creates a deep clone. */
    clone(): VersionVector;
    /** Checks equality with another VersionVector. */
    equals(other: VersionVector): boolean;
}
