/** * PersistentMap — an immutable, structurally-shared hash map based on a * Hash Array Mapped Trie (HAMT). Keys are always strings (Dvala objects * only use string keys). * * Performance characteristics: * get(k) O(log₃₂ N) ≈ O(1) in practice * assoc O(log₃₂ N) — path-copies the spine, shares unchanged nodes * dissoc O(log₃₂ N) * has(k) O(log₃₂ N) * size O(1) * iterate O(N) * * HAMT nodes: * BitmapNode — sparse 32-slot virtual node, compressed via popcount bitmap * LeafNode — single key-value pair at a resolved leaf position * CollisionNode — multiple pairs sharing the same 32-bit hash */ /** * TransientMap provides O(1) amortized operations during bulk construction. * Obtained via `map.asTransient()`; converted back via `.persistent()`. * * Do not use after calling `.persistent()`. */ export declare class TransientMap { private _entries; constructor(source?: PersistentMap); set(key: string, value: V): void; persistent(): PersistentMap; } export declare class PersistentMap implements Iterable { static readonly EMPTY: PersistentMap; private readonly _root; readonly size: number; private constructor(); static empty(): PersistentMap; /** Build from an iterable of [key, value] pairs. O(N). */ static from(entries: Iterable): PersistentMap; /** Build from a plain JS object. O(N). */ static fromRecord(record: Record): PersistentMap; /** Returns the value for `key`, or `undefined` if absent. */ get(key: string): V | undefined; /** Returns true if `key` is present. */ has(key: string): boolean; /** Returns a new map with `key` → `value` inserted or updated. */ assoc(key: string, value: V): PersistentMap; /** Returns a new map with `key` removed. Returns `this` if not found. */ dissoc(key: string): PersistentMap; /** Returns an array of all keys. Order is hash-determined (not insertion order). */ keys(): string[]; /** Returns an array of all values. */ values(): V[]; /** Returns an array of [key, value] pairs. */ entries(): [string, V][]; /** Iterate over [key, value] pairs. */ [Symbol.iterator](): Iterator; /** Convert to a plain JS object (shallow). O(N). */ toRecord(): Record; /** Returns a transient for bulk construction. */ asTransient(): TransientMap; }