import { Point } from './Point';
import type { ITimestampStruct } from '../../../json-crdt-patch/clock';
import type { Printable } from 'tree-dump/lib/types';
import type { AbstractRga } from '../../../json-crdt/nodes/rga';
import type { Stateful } from '../types';
/**
 * A range is a pair of points that represent a selection in the text. A range
 * can be collapsed to a single point, then it is called a *marker*
 * (if it is stored in the text), or *caret* (if it is a cursor position).
 */
export declare class Range<T = string> implements Pick<Stateful, 'refresh'>, Printable {
    protected readonly rga: AbstractRga<T>;
    start: Point<T>;
    end: Point<T>;
    /**
     * Creates a range from two points. The points are ordered so that the
     * start point is before or equal to the end point.
     *
     * @param rga Peritext context.
     * @param p1 Some point.
     * @param p2 Another point.
     * @returns Range with points in correct order.
     */
    static from<T = string>(rga: AbstractRga<T>, p1: Point<T>, p2: Point<T>): Range<T>;
    /**
     * A convenience method for creating a range from a view position and a length.
     * The `start` argument specifies the position between characters, where
     * the range should start. The `size` argument specifies the number of
     * characters in the range. If `size` is zero or not specified, the range
     * will be collapsed to a single point.
     *
     * When the range is collapsed, the anchor position is set to "after" the
     * character. When the range is expanded, the anchor positions are set to
     * "before" for the start point and "after" for the end point.
     *
     * The `size` argument can be negative, in which case the range is selected
     * backwards.
     *
     * @param rga Peritext context.
     * @param start Position in the text between characters.
     * @param size Length of the range. Can be negative, in which case the range
     *             is selected backwards.
     * @returns A range from the given position with the given length.
     */
    static at<T = string>(rga: AbstractRga<T>, start: number, size?: number): Range<T>;
    /**
     * @param rga Peritext context.
     * @param start Start point of the range, must be before or equal to end.
     * @param end End point of the range, must be after or equal to start.
     */
    constructor(rga: AbstractRga<T>, start: Point<T>, end: Point<T>);
    /**
     * Clones the range.
     *
     * @returns A new range with the same start and end points.
     */
    range(): Range<T>;
    cmp(range: Range<T>): -1 | 0 | 1;
    cmpSpatial(range: Range<T>): number;
    /**
     * Determines if the range is collapsed to a single point. Handles special
     * cases where the range is collapsed, but the points are not equal, for
     * example, when the characters between the points are invisible.
     *
     * @returns True if the range is collapsed to a single point.
     */
    isCollapsed(): boolean;
    contains(range: Range<T>): boolean;
    containsPoint(point: Point<T>): boolean;
    set(start: Point<T>, end?: Point<T>): void;
    setRange(range: Range<T>): void;
    setAt(start: number, length?: number): void;
    setAfter(id: ITimestampStruct): void;
    /**
     * Collapse the range to the start point and sets the anchor position to be
     * "after" the character.
     */
    collapseToStart(): void;
    /**
     * Collapse the range to the end point and sets the anchor position to be
     * "before" the character.
     */
    collapseToEnd(): void;
    /**
     * Expand range left and right to contain all invisible space: (1) tombstones,
     * (2) anchors of non-deleted adjacent chunks.
     */
    expand(): void;
    /**
     * The reverse of {@link expand}. Shrink the range's start and end points to
     * still contain the same visible text, but narrow the range in the CRDT-space
     * as much as possible.
     */
    shrink(): void;
    /**
     * Returns the range in the view coordinates as a position and length.
     *
     * @returns The range as a view position and length.
     */
    view(): [start: number, size: number];
    /**
     * @returns The length of the range in view coordinates.
     */
    length(): number;
    /**
     * Returns plain text view of the range. Concatenates all text chunks in the
     * range ignoring tombstones and returns the result.
     *
     * @returns The text content of the range.
     */
    text(): string;
    refresh(): number;
    toStringName(): string;
    toString(tab?: string, lite?: boolean): string;
}
