import type { RootSchema } from '../types';
import type { Document } from './document';
export interface Serialization<K = RootSchema, T = string> {
    serialize(data: K): T;
    unserialize(data: T): K;
}
export declare enum HISTORY_EVENT {
    STATE_CHANGE = "history:state.change",
    CURSOR_CHANGE = "history:cursor.change"
}
export declare class History<T = RootSchema> {
    private redoer;
    readonly document?: Document | undefined;
    emitter: import("..").EventBus;
    /** current record */
    private session;
    /** all records */
    private records;
    /** as a cursor of records to go back and forward */
    private point;
    private asleep;
    /** current recorded data */
    get hotData(): string;
    private timeGap;
    private serialization;
    setSerialization(serialization: Serialization<T, string>): void;
    constructor(dataFn: () => T | null, redoer: (data: T) => void, document?: Document | undefined);
    /**
     * check if there is unsaved change for history
     */
    isSavePoint(): boolean;
    private sleep;
    private wakeup;
    go(originalCursor: number): void;
    back(): void;
    forward(): void;
    savePoint(): void;
    destroy(): void;
    /**
     *  |    1     |     1    |    1     |
     *  | -------- | -------- | -------- |
     *  | modified | redoable | undoable |
     * eg.
     *  7 means : modified && redoable && undoable
     *  5 means : modified && undoable
     *  ...
     */
    getState(): number;
    isModified(): boolean;
    isRedoable(): boolean;
    isUndoable(): boolean;
    onStateChange(listener: () => void): () => void;
    onCursorChange(func: () => void): () => void;
}
/**
 * Session is a record of History
 */
export declare class Session<T = string> {
    readonly cursor: number;
    private timeGap;
    private _data;
    private activeTimer;
    get data(): T;
    constructor(cursor: number, data: T, timeGap?: number);
    /**
     * log data
     *  log may be executed multiple times, and it has a timeGap period, during this period,
     *  the changes will only be recorded in this Session, until the timeGap period will be reset
     *  you can see it in the reaction function of History
     */
    log(data: T): void;
    isActive(): boolean;
    end(): void;
    private setTimer;
    private clearTimer;
}
