import '../../../assert/js/assert.js';
import '../../../globals.js';
/**
 * Represents a trail (path in the graph) from a 'root' node down to a descendant node.
 * In a DAG, or with different views, there can be more than one trail up from a node,
 * even to the same root node!
 *
 * It has an array of nodes, in order from the 'root' down to the last node,
 * a length, and an array of indices such that node_i.children[index_i] === node_{i+1}.
 *
 * The indices can sometimes become stale when nodes are added and removed, so Trails
 * can have their indices updated with reindex(). It's designed to be as fast as possible
 * on Trails that are already indexed accurately.
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 */
import Bounds2 from '../../../dot/js/Bounds2.js';
import Matrix3 from '../../../dot/js/Matrix3.js';
import Transform3 from '../../../dot/js/Transform3.js';
import Vector2 from '../../../dot/js/Vector2.js';
import { Node } from '../imports.js';
export type TrailCallback = ((trail: Trail) => boolean) | ((trail: Trail) => void);
export default class Trail {
    nodes: Node[];
    length: number;
    uniqueId: string;
    indices: number[];
    private immutable?;
    /**
     * @param [nodes]
     */
    constructor(nodes?: Trail | Node[] | Node);
    /**
     * Returns a copy of this Trail that can be modified independently
     */
    copy(): Trail;
    /**
     * Whether the leaf-most Node in our trail will render something (scenery-internal)
     */
    isPainted(): boolean;
    /**
     * Whether all nodes in the trail are still connected from the trail's root to its leaf.
     */
    isValid(): boolean;
    /**
     * This trail is visible only if all nodes on it are marked as visible
     */
    isVisible(): boolean;
    /**
     * This trail is pdomVisible only if all nodes on it are marked as pdomVisible
     */
    isPDOMVisible(): boolean;
    getOpacity(): number;
    /**
     * Essentially whether this node is visited in the hit-testing operation
     */
    isPickable(): boolean;
    get(index: number): Node;
    slice(startIndex: number, endIndex?: number): Trail;
    /**
     * TODO: consider renaming to subtrailToExcluding and subtrailToIncluding? https://github.com/phetsims/scenery/issues/1581
     */
    subtrailTo(node: Node, excludeNode?: boolean): Trail;
    isEmpty(): boolean;
    /**
     * Returns the matrix multiplication of our selected nodes transformation matrices.
     *
     * @param startingIndex - Include nodes matrices starting from this index (inclusive)
     * @param endingIndex - Include nodes matrices up to this index (exclusive)
     */
    getMatrixConcatenation(startingIndex: number, endingIndex: number): Matrix3;
    /**
     * From local to global
     *
     * e.g. local coordinate frame of the leaf node to the parent coordinate frame of the root node
     */
    getMatrix(): Matrix3;
    /**
     * From local to next-to-global (ignores root node matrix)
     *
     * e.g. local coordinate frame of the leaf node to the local coordinate frame of the root node
     */
    getAncestorMatrix(): Matrix3;
    /**
     * From parent to global
     *
     * e.g. parent coordinate frame of the leaf node to the parent coordinate frame of the root node
     */
    getParentMatrix(): Matrix3;
    /**
     * From parent to next-to-global (ignores root node matrix)
     *
     * e.g. parent coordinate frame of the leaf node to the local coordinate frame of the root node
     */
    getAncestorParentMatrix(): Matrix3;
    /**
     * From local to global
     *
     * e.g. local coordinate frame of the leaf node to the parent coordinate frame of the root node
     */
    getTransform(): Transform3;
    /**
     * From parent to global
     *
     * e.g. parent coordinate frame of the leaf node to the parent coordinate frame of the root node
     */
    getParentTransform(): Transform3;
    addAncestor(node: Node, index?: number): this;
    removeAncestor(): this;
    addDescendant(node: Node, index?: number): this;
    removeDescendant(): this;
    addDescendantTrail(trail: Trail): void;
    removeDescendantTrail(trail: Trail): void;
    /**
     * Refreshes the internal index references (important if any children arrays were modified!)
     */
    reindex(): void;
    setImmutable(): this;
    setMutable(): this;
    areIndicesValid(): boolean;
    equals(other: Trail): boolean;
    /**
     * Returns a new Trail from the root up to the parameter node.
     */
    upToNode(node: Node): Trail;
    /**
     * Whether this trail contains the complete 'other' trail, but with added descendants afterwards.
     *
     * @param other - is other a subset of this trail?
     * @param allowSameTrail
     */
    isExtensionOf(other: Trail, allowSameTrail?: boolean): boolean;
    /**
     * Returns whether a given node is contained in the trail.
     */
    containsNode(node: Node): boolean;
    /**
     * A transform from our local coordinate frame to the other trail's local coordinate frame
     */
    getTransformTo(otherTrail: Trail): Transform3;
    /**
     * Returns a matrix that transforms a point in our last node's local coordinate frame to the other trail's last node's
     * local coordinate frame
     */
    getMatrixTo(otherTrail: Trail): Matrix3;
    /**
     * Returns the first index that is different between this trail and the other trail.
     *
     * If the trails are identical, the index should be equal to the trail's length.
     */
    getBranchIndexTo(otherTrail: Trail): number;
    /**
     * Returns the last (largest) index into the trail's nodes that has inputEnabled=true.
     */
    getLastInputEnabledIndex(): number;
    /**
     * Returns the leaf-most index, unless there is a Node with inputEnabled=false (in which case, the lowest index
     * for those matching Nodes are returned).
     */
    getCursorCheckIndex(): number;
    /**
     * TODO: phase out in favor of get() https://github.com/phetsims/scenery/issues/1581
     */
    nodeFromTop(offset: number): Node;
    lastNode(): Node;
    rootNode(): Node;
    /**
     * Returns the previous graph trail in the order of self-rendering
     */
    previous(): Trail | null;
    /**
     * Like previous(), but keeps moving back until the trail goes to a node with isPainted() === true
     */
    previousPainted(): Trail | null;
    /**
     * In the order of self-rendering
     */
    next(): Trail | null;
    /**
     * Like next(), but keeps moving back until the trail goes to a node with isPainted() === true
     */
    nextPainted(): Trail | null;
    /**
     * Calls callback( trail ) for this trail, and each descendant trail. If callback returns true, subtree will be skipped
     */
    eachTrailUnder(callback: TrailCallback): void;
    /**
     * Standard Java-style compare. -1 means this trail is before (under) the other trail, 0 means equal, and 1 means this trail is
     * after (on top of) the other trail.
     * A shorter subtrail will compare as -1.
     *
     * Assumes that the Trails are properly indexed. If not, please reindex them!
     *
     * Comparison is for the rendering order, so an ancestor is 'before' a descendant
     */
    compare(other: Trail): number;
    isBefore(other: Trail): boolean;
    isAfter(other: Trail): boolean;
    localToGlobalPoint(point: Vector2): Vector2;
    localToGlobalBounds(bounds: Bounds2): Bounds2;
    globalToLocalPoint(point: Vector2): Vector2;
    globalToLocalBounds(bounds: Bounds2): Bounds2;
    parentToGlobalPoint(point: Vector2): Vector2;
    parentToGlobalBounds(bounds: Bounds2): Bounds2;
    globalToParentPoint(point: Vector2): Vector2;
    globalToParentBounds(bounds: Bounds2): Bounds2;
    private updateUniqueId;
    /**
     * Concatenates the unique IDs of nodes in the trail, so that we can do id-based lookups
     */
    getUniqueId(): string;
    /**
     * Returns a string form of this object
     */
    toString(): string;
    /**
     * Cleaner string form which will show class names. Not optimized by any means, meant for debugging.
     */
    toPathString(): string;
    /**
     * Returns a debugging string ideal for logged output.
     */
    toDebugString(): string;
    /**
     * Like eachTrailBetween, but only fires for painted trails. If callback returns true, subtree will be skipped
     */
    static eachPaintedTrailBetween(a: Trail, b: Trail, callback: (trail: Trail) => void, excludeEndTrails: boolean, rootNode: Node): void;
    /**
     * Global way of iterating across trails. when callback returns true, subtree will be skipped
     */
    static eachTrailBetween(a: Trail, b: Trail, callback: (trail: Trail) => void, excludeEndTrails: boolean, rootNode: Node): void;
    /**
     * The index at which the two trails diverge. If a.length === b.length === branchIndex, the trails are identical
     */
    static branchIndex(a: Trail, b: Trail): number;
    /**
     * The subtrail from the root that both trails share
     */
    static sharedTrail(a: Trail, b: Trail): Trail;
    /**
     * @param trailResults - Will be muted by appending matching trails
     * @param trail
     * @param predicate
     */
    static appendAncestorTrailsWithPredicate(trailResults: Trail[], trail: Trail, predicate: (node: Node) => boolean): void;
    /**
     * @param trailResults - Will be muted by appending matching trails
     * @param trail
     * @param predicate
     */
    static appendDescendantTrailsWithPredicate(trailResults: Trail[], trail: Trail, predicate: (node: Node) => boolean): void;
    static spannedSubtrees(a: Trail, b: Trail): void;
    /**
     * Re-create a trail to a root node from an existing Trail id. The rootNode must have the same Id as the first
     * Node id of uniqueId.
     *
     * @param rootNode - the root of the trail being created
     * @param uniqueId - integers separated by ID_SEPARATOR, see getUniqueId
     */
    static fromUniqueId(rootNode: Node, uniqueId: string): Trail;
}
//# sourceMappingURL=Trail.d.ts.map