/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { FieldKey, TreeType, UpPath, ITreeCursorSynchronous, Value, FieldUpPath, PathRootPrefix } from "../core";
/**
 * {@link ITreeCursorSynchronous} that can return the underlying node objects.
 * @alpha
 */
export interface CursorWithNode<TNode> extends ITreeCursorSynchronous {
    /**
     * Gets the underlying object for the current node.
     *
     * Only valid when `mode` is `Nodes`.
     */
    getNode(): TNode;
    /**
     * Create a copy of this cursor which navigates independently,
     * and is initially located at the same place as this one.
     *
     * Depending on the cursor implementation this may be significantly faster
     * than other ways to copy the cursor
     * (such as creating a new one and walking the path from this one).
     */
    fork(): CursorWithNode<TNode>;
}
/**
 * Create a cursor, in `nodes` mode at the root of the provided tree.
 *
 * @returns an {@link ITreeCursorSynchronous} for a single root.
 * @alpha
 */
export declare function singleStackTreeCursor<TNode>(root: TNode, adapter: CursorAdapter<TNode>): CursorWithNode<TNode>;
/**
 * Provides functionality to allow a {@link singleStackTreeCursor} to implement a cursor.
 * @alpha
 */
export interface CursorAdapter<TNode> {
    /**
     * @returns the value of the given node.
     */
    value(node: TNode): Value;
    /**
     * @returns the type of the given node.
     */
    type(node: TNode): TreeType;
    /**
     * @returns the keys for non-empty fields on the given node.
     */
    keysFromNode(node: TNode): readonly FieldKey[];
    /**
     * @returns the child nodes for the given node and key.
     */
    getFieldFromNode(node: TNode, key: FieldKey): readonly TNode[];
}
/**
 * A class that satisfies part of the ITreeCursorSynchronous implementation.
 */
export declare abstract class SynchronousCursor {
    get pending(): false;
    skipPendingFields(): boolean;
}
/**
 * Apply `prefix` to `path`.
 * @alpha
 */
export declare function prefixPath(prefix: PathRootPrefix | undefined, path: UpPath | undefined): UpPath | undefined;
/**
 * Apply `prefix` to `path`.
 * @alpha
 */
export declare function prefixFieldPath(prefix: PathRootPrefix | undefined, path: FieldUpPath): FieldUpPath;
/**
 * Compose two prefixes together.
 * `prefixFieldPath(root, prefixFieldPath(inner, path))` should be the same as `prefixFieldPath(prefixPathPrefix(root, inner), path))`
 *
 * TODO: tests for this.
 */
export declare function prefixPathPrefix(root: PathRootPrefix, inner: PathRootPrefix): PathRootPrefix;
/**
 * Wrapper around a path that adds a prefix to the root.
 *
 * Exported for testing: use `prefixPath` and `prefixFieldPath` to construct.
 */
export declare class PrefixedPath implements UpPath {
    readonly prefix: PathRootPrefix;
    readonly path: UpPath;
    readonly parentField: FieldKey;
    readonly parentIndex: number;
    constructor(prefix: PathRootPrefix, path: UpPath);
    get parent(): UpPath | undefined;
}
//# sourceMappingURL=treeCursorUtils.d.ts.map