import '../../../../globals.js';
// Copyright 2018-2024, University of Colorado Boulder
/**
 * Represents a path up to a PDOMInstance.
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 */
import { scenery } from '../../imports.js';
export default class PartialPDOMTrail {
    constructor(pdomInstance, trail, isRoot // TODO: remove this, since it can be computed from the pdomInstance https://github.com/phetsims/scenery/issues/1581
    ) {
        this.pdomInstance = pdomInstance;
        this.trail = trail;
        this.isRoot = isRoot;
        this.isRoot = isRoot;
        this.fullTrail = this.pdomInstance.trail.copy();
        // NOTE: Only if the parent instance is the root instance do we want to include our partial trail's root.
        // For other instances, this node in the trail will already be included
        // TODO: add Trail.concat() https://github.com/phetsims/scenery/issues/1581
        for (let j = (this.isRoot ? 0 : 1); j < this.trail.length; j++) {
            this.fullTrail.addDescendant(this.trail.nodes[j]);
        }
    }
}
scenery.register('PartialPDOMTrail', PartialPDOMTrail);
//# sourceMappingURL=PartialPDOMTrail.js.map