import { ContextualMenu } from '../../elements/contextual-menu/internals/ContextualMenu.js';
export default class ApiNavigationContextMenu extends ContextualMenu {
    /**
     * Finds the click target which can be one of the model objects
     * or SVG elements.
     */
    findTarget(e) {
        let target;
        const path = e.composedPath();
        while (path.length > 0) {
            const candidate = path.shift();
            if (candidate === this.workspace ||
                (candidate.nodeType === Node.ELEMENT_NODE &&
                    (candidate.classList.contains('list-item') || candidate.classList.contains('section-title')))) {
                target = candidate;
                break;
            }
        }
        return target;
    }
    /**
     * Maps an element to an internal target name.
     *
     * @param element The context click target
     * @returns The internal target name.
     */
    elementToTarget(element) {
        if (element === this.workspace) {
            return 'root';
        }
        if (element.dataset.graphShape) {
            return element.dataset.graphShape;
        }
        if (element.dataset.section) {
            return element.dataset.section;
        }
        return super.elementToTarget(element);
    }
}
//# sourceMappingURL=ApiNavigationContextMenu.js.map