import TrieCursorError from "../../errors/TrieCursorError.ts";
import TrieStoreError from "../../errors/TrieStoreError.ts";
import type { Dot } from "../../crdt/Dot.ts";
import type RouteKey from "../route/RouteKey.ts";
import type { NibbleBits } from "../route/RouteKey.ts";
import TrieLeaf, { type TrieLeafEntry } from "./TrieLeaf.ts";
export declare function nibbleBitsOf(n: number): NibbleBits;
export declare function validateElement(element: string): void;
export declare function validateDot(dot: Dot): void;
export declare function suffixOfRouteKey(routeKey: RouteKey, depth: number, nibbleBits: NibbleBits): Uint8Array;
export interface UpsertArgs {
    readonly leaf: TrieLeaf;
    readonly routeKey: RouteKey;
    readonly leafDepth: number;
    readonly nibbleBits: NibbleBits;
    readonly element: string;
    readonly encodedDot: string;
}
export declare function upsertIntoLeaf(args: UpsertArgs): TrieLeaf;
export declare function findInsertIndex(entries: readonly TrieLeafEntry[], suffix: Uint8Array): number;
export declare function compareBytes(left: Uint8Array, right: Uint8Array): number;
export declare function makeEntry(routeKeySuffix: Uint8Array, element: string, dots: Set<string>): TrieLeafEntry;
export interface FindEntryArgs {
    readonly leaf: TrieLeaf;
    readonly routeKey: RouteKey;
    readonly depth: number;
    readonly nibbleBits: NibbleBits;
    readonly element: string;
}
export declare function findEntryInLeaf(args: FindEntryArgs): TrieLeafEntry | null;
export declare function partitionEntriesByNextNibble(leaf: TrieLeaf, nibbleBits: NibbleBits): ReadonlyMap<number, readonly TrieLeafEntry[]>;
export declare function shortenEntries(entries: readonly TrieLeafEntry[], nibbleBits: NibbleBits, suffixNibbles: number): TrieLeafEntry[];
/**
 * Shifts a suffix byte array left by `nibbleBits` bits, producing
 * the suffix at the next depth. The last (now-empty) nibble is
 * discarded; if that empties a whole byte, the resulting array is
 * one byte shorter.
 */
export declare function shiftSuffixLeftByOneNibble(suffix: Uint8Array, nibbleBits: NibbleBits, suffixNibbles: number): Uint8Array;
export declare function tombstoneEntry(entry: TrieLeafEntry, observedDots: ReadonlySet<string>): {
    readonly entry: TrieLeafEntry;
    readonly changed: boolean;
};
export declare function pendingChildOid(parentPath: readonly number[], childNibble: number): string;
export declare function isMissingStoreError(raw: Error): raw is TrieStoreError;
export interface WrapErrorArgs {
    readonly raw: Error;
    readonly op: string;
    readonly path: readonly number[];
    readonly oid: string;
}
export declare function wrapStoreError(args: WrapErrorArgs): TrieCursorError;
export declare function wrapDecodeError(args: WrapErrorArgs): TrieCursorError;
