import type { Changeset } from "./types";
import type { Datum } from "../charts/shared/datumTypes";
export type ChangesetCallback<T> = (changeset: Changeset<T>) => void;
export declare class DataSourceAdapter<T = Datum> {
    private callback;
    private lastBoundedData;
    private chunkTimer;
    private chunkThreshold;
    private chunkSize;
    /** Buffer for batching high-frequency push() calls */
    private pushBuffer;
    /** Whether a microtask flush is already scheduled */
    private flushScheduled;
    constructor(callback: ChangesetCallback<T>, options?: {
        chunkThreshold?: number;
        chunkSize?: number;
    });
    /** Update chunking options without recreating the adapter. */
    updateChunkOptions(options: {
        chunkThreshold?: number;
        chunkSize?: number;
    }): void;
    /** Clear the dedup cache so the next setBoundedData call re-ingests even the same reference.
     *  Also cancels any in-flight progressive chunking and discards buffered pushes. */
    clearLastData(): void;
    /**
     * Ingest a bounded data array (from props).
     *
     * Small datasets emit a single changeset synchronously.
     * Large datasets (> CHUNK_THRESHOLD) are split into chunks that render
     * progressively: the first chunk fires immediately (bounded: true to
     * reset + seed the buffer), subsequent chunks arrive on successive
     * animation frames (bounded: false so they append without clearing).
     */
    setBoundedData(data: T[]): void;
    /**
     * Replace the buffer contents without clearing category insertion-order
     * memory. Intended for aggregator HOCs (e.g. LikertChart) that re-derive
     * a full dataset from streaming input on every push — the transport is
     * wholesale replacement, but the user perceives it as a live stream
     * where categories should stay put across updates.
     *
     * Small datasets (≤ chunkThreshold) emit a single synchronous
     * changeset — the common aggregator case. Larger datasets fall
     * through to progressive chunking so an unexpectedly-huge replacement
     * doesn't block the main thread. Only the first chunk carries
     * `preserveCategoryOrder: true` (it's the one that resets the
     * buffer and seeds the category Set); subsequent chunks are plain
     * append-only streaming changesets, which preserve order anyway via
     * the streaming-mode branch.
     */
    setReplacementData(data: T[]): void;
    /**
     * Flush all buffered push data as a single changeset.
     * Called automatically via microtask after push()/pushMany().
     */
    private flushPushBuffer;
    /** Schedule a microtask flush if one isn't already pending. */
    private scheduleFlush;
    /**
     * Push a single datum (streaming mode).
     * Data is buffered and flushed as a single changeset via microtask,
     * so rapid sequential push() calls within the same task are batched
     * into one callback invocation.
     *
     * Drops `null`/non-object data so a `ref.push(null)` (typically from a
     * loader returning a falsy row) doesn't reach extent/accessor reads
     * inside the pipeline store. Mirrors the bounded-ingest hardening.
     */
    push(datum: T): void;
    /**
     * Push multiple data (streaming batch).
     * Like push(), data is buffered and flushed via microtask. Multiple
     * pushMany() calls within the same task are coalesced.
     *
     * Sparse entries are dropped during the buffer copy. Mirrors the
     * bounded-ingest hardening — `ref.pushMany([null, valid])` lands the
     * valid row and silently skips the null instead of crashing the
     * pipeline. The early `length === 0` short-circuit still applies.
     */
    pushMany(data: T[]): void;
    /**
     * Immediately flush any buffered push data without waiting for the microtask.
     * Useful when you need the data to be processed synchronously (e.g., in tests).
     */
    flush(): void;
    /**
     * Reset the adapter state.
     */
    clear(): void;
}
