import type { Boundary, PartialScope } from "./writer";
export declare const K_SCOPE_ID: unique symbol;
export interface Registered {
    id: string;
    access: string;
    scope: unknown;
    locals: Locals | undefined;
}
export type Locals = (scope: (scopeId: number) => PartialScope) => PartialScope[];
export type ScopeFlush = [scopeId: number, scope: object, props: object];
export interface SerializeChannel {
    readyId?: string;
    parent?: SerializeChannel;
}
interface DeferredMembers {
    collection: Map<unknown, unknown> | Set<unknown>;
    first: unknown;
    rest: Iterable<unknown>;
}
interface QueuedCall {
    method: string;
    value: unknown;
    object: unknown;
    channel: SerializeChannel | undefined;
    valueId: string | null;
}
export declare const REGISTRY: WeakMap<WeakKey, Registered>;
declare class State {
    ids: number;
    flushId: number;
    wroteUndefined: boolean;
    buf: string[];
    strs: Map<string, Reference>;
    refs: WeakMap<WeakKey, Reference>;
    deferredRefs: Set<Reference>;
    boundary: Boundary;
    channel: SerializeChannel | undefined;
    channelDeps: Set<string> | null;
    queuedCalls: QueuedCall[];
    queuedReadyCalls: QueuedCall[];
    scopeRef(scope: WeakKey, scopeId: number): Reference;
    writeScopeProps(props: object, ref: Reference): string;
    scopesCursor(scopeId: number): string;
    writeTrailing(scopesIndex: number): string;
    wrapPayload(result: string, extras: string): string;
    writeScopedRegistration(val: WeakKey, parent: Reference | null, accessor: string, registered: Registered): void;
}
export declare class Reference {
    debug?: Debug;
    assignments: null | string[];
    deferredMembers: null | DeferredMembers;
    scopeId: number | undefined;
    channel: SerializeChannel | undefined;
    parent: Reference | null;
    accessor: string | null;
    flushId: number;
    pos: number | null;
    id: string | null;
    path: string | null;
    constructor(parent: Reference | null, accessor: string | null, flushId: number, pos?: number | null, id?: string | null);
}
interface Debug {
    file: string;
    loc: string | 0;
    vars: Record<string, string | [name: string, loc?: string]> | undefined;
    slots?: Record<string, string>;
}
export declare function setDebugInfo(obj: WeakKey, file: string, loc: string | 0, vars?: Debug["vars"]): void;
export declare function setDebugSlotName(obj: WeakKey, accessor: string, name: string): void;
export { State as SerializerState };
export declare function stringifyScopes(state: State, flushes: ScopeFlush[], boundary: Boundary, channel?: SerializeChannel): string;
export declare function pendingReadyChannel(state: State): SerializeChannel | undefined;
export declare function takeChannelDeps(state: State): Set<string> | null;
export declare function queueCall(state: State, value: unknown, object: unknown, method: string, channel?: SerializeChannel): void;
export declare function dropQueuedCall(state: State, value: unknown, object: unknown, method: string, channel: SerializeChannel | undefined): boolean;
export declare function register<T extends WeakKey>(id: string, val: T, scope?: unknown, locals?: Locals, access?: string): T;
export declare function writeDeferred(state: State): void;
export declare function hasMatchingCalls(state: State, readyId: string | undefined): boolean;
export declare function quoteRegisterId(id: string): string;
export declare function toObjectKey(name: string): string;
export declare function toAccess(accessor: string): string;
export declare function quote(str: string, startPos: number): string;
