import '../../../../globals.js';
// Copyright 2023-2024, University of Colorado Boulder
/**
 * A leaf node element in the RichText, which will display a Node (e.g. with the `nodes` or `tags` feature)
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 */
import Pool from '../../../../phet-core/js/Pool.js';
import { Node, RichTextCleanable, scenery } from '../../imports.js';
class RichTextNode extends RichTextCleanable(Node) {
    constructor(content) {
        super();
        this.leftSpacing = 0;
        this.rightSpacing = 0;
        this.initialize(content);
    }
    initialize(content) {
        this.addChild(content);
        return this;
    }
    /**
     * Cleans references that could cause memory leaks (as those things may contain other references).
     */
    clean() {
        super.clean();
        this.removeAllChildren();
    }
    /**
     * Whether this leaf will fit in the specified amount of space
     */
    fitsIn(widthAvailable) {
        return this.width <= widthAvailable;
    }
    freeToPool() {
        RichTextNode.pool.freeToPool(this);
    }
}
RichTextNode.pool = new Pool(RichTextNode);
export default RichTextNode;
scenery.register('RichTextNode', RichTextNode);
//# sourceMappingURL=RichTextNode.js.map