import * as i0 from '@angular/core';
import { EventEmitter, booleanAttribute, Output, Input, HostBinding, ViewEncapsulation, Component, inject, ElementRef, forwardRef, ContentChildren, ContentChild, ViewChild, Directive, NgModule } from '@angular/core';
import * as i1 from '@angular/forms';
import { FormsModule } from '@angular/forms';
import * as i3 from '@eui/components/eui-button';
import { EUI_BUTTON } from '@eui/components/eui-button';
import * as i4 from '@eui/components/eui-icon';
import { EUI_ICON } from '@eui/components/eui-icon';
import * as i5 from '@eui/components/eui-icon-input';
import { EUI_ICON_INPUT } from '@eui/components/eui-icon-input';
import * as i2 from '@eui/components/eui-input-text';
import { EUI_INPUT_TEXT } from '@eui/components/eui-input-text';
import * as i1$1 from '@ngx-translate/core';
import { TranslateModule } from '@ngx-translate/core';
import { uniqueId, consumeEvent } from '@eui/core';
import * as i1$2 from '@eui/components/shared';
import { BaseStatesDirective } from '@eui/components/shared';
import * as i2$1 from '@eui/components/eui-label';
import { EUI_LABEL } from '@eui/components/eui-label';
import * as i3$1 from '@eui/components/eui-icon-button-expander';
import { EUI_ICON_BUTTON_EXPANDER } from '@eui/components/eui-icon-button-expander';
import { NgTemplateOutlet } from '@angular/common';

class EuiTreeListToolbarComponent {
    constructor() {
        this.classes = 'eui-tree-list-toolbar';
        this.e2eAttr = 'eui-tree-list-toolbar';
        /**
         * Shows or hides the toolbar
         * @default false
         */
        this.isVisible = false;
        /**
         * @deprecated This property is not used anymore and will be removed in the next major version.
         */
        this.isFilterVisible = true;
        /**
         * @deprecated This property is not used anymore and will be removed in the next major version.
         */
        this.isToggleVisible = true;
        /**
         * Option that toggles the expanded/collapsed state of the corresponding button
         * @default false
         */
        this.isToggleExpanded = false;
        /**
         * The value of the filter input
         * @default ''
         */
        this.filterValue = '';
        /**
         * @deprecated This property is not used anymore and will be removed in the next major version.
         */
        this.hasLabels = true;
        /**
         * Event emitted if there is or if a filter value changes.
         */
        this.filter = new EventEmitter();
        /**
         * Event emitted when the expand all button is clicked.
         */
        this.expandAll = new EventEmitter();
        /**
         * Event emitted when the collapse all button is clicked.
         */
        this.collapseAll = new EventEmitter();
    }
    ngOnInit() {
        if (this.filterValue !== '' && this.filterValue !== undefined) {
            this.filter.emit(this.filterValue);
        }
    }
    ngOnChanges(c) {
        if (c && c.filterValue && this.filterValue !== undefined) {
            this.filter.emit(this.filterValue);
        }
    }
    /**
     * This method is called when the filter input value changes.
     * It emits the filter value to the parent component.
     * @protected
     */
    onFilter() {
        if (this.filterValue === '') {
            if (!this.isToggleExpanded) {
                this.collapseAll.emit(null);
            }
        }
        this.filter.emit(this.filterValue);
    }
    /**
     * This method is called when the expand all button is clicked.
     * It emits the expand all event to the parent component.
     * @param event The mouse event
     * @protected
     */
    onExpandAll(event) {
        this.isToggleExpanded = !this.isToggleExpanded;
        this.expandAll.emit(event);
    }
    /**
     * This method is called when the collapse all button is clicked.
     * It emits the collapse all event to the parent component.
     * @param event The mouse event
     * @protected
     */
    onCollapseAll(event) {
        this.isToggleExpanded = !this.isToggleExpanded;
        this.collapseAll.emit(event);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiTreeListToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: EuiTreeListToolbarComponent, isStandalone: true, selector: "eui-tree-list-toolbar", inputs: { e2eAttr: "e2eAttr", isVisible: ["isVisible", "isVisible", booleanAttribute], filterLabel: "filterLabel", expandAllLabel: "expandAllLabel", collapseAllLabel: "collapseAllLabel", isFilterVisible: ["isFilterVisible", "isFilterVisible", booleanAttribute], isToggleVisible: ["isToggleVisible", "isToggleVisible", booleanAttribute], isToggleExpanded: ["isToggleExpanded", "isToggleExpanded", booleanAttribute], filterValue: "filterValue", hasLabels: ["hasLabels", "hasLabels", booleanAttribute] }, outputs: { filter: "filter", expandAll: "expandAll", collapseAll: "collapseAll" }, host: { properties: { "class": "this.classes" } }, usesOnChanges: true, ngImport: i0, template: "@if (isVisible) {\n    <eui-icon-input>\n        <eui-icon-svg icon=\"search:outline\" fillColor=\"neutral-lighter\" aria-label=\"Search Icon\" />\n        <input\n            euiInputText\n            euiClearable\n            [(ngModel)]=\"filterValue\"\n            [placeholder]=\"filterLabel\"\n            (ngModelChange)=\"onFilter()\" />\n    </eui-icon-input>\n\n    @if (!isToggleExpanded) {\n        <button euiButton euiSecondary euiOutline (click)=\"onExpandAll($event)\" [euiIconButton]=\"expandAllLabel === ''\" aria-label=\"Expand all\">\n            @if (expandAllLabel !== '') {\n                {{ expandAllLabel }}\n            }\n            <eui-icon-svg icon=\"eui-level-down\" aria-label=\"Expand all tree items icon\" />\n        </button>\n    } @else {\n        <button euiButton euiSecondary euiOutline (click)=\"onCollapseAll($event)\" [euiIconButton]=\"collapseAllLabel === ''\" aria-label=\"Collapse all\">\n            @if (collapseAllLabel !== '') {\n                {{ collapseAllLabel }}\n            }\n            <eui-icon-svg icon=\"eui-level-up\" aria-label=\"Collapse all tree items icon\" />\n        </button>\n    }\n}\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i2.EuiInputTextComponent, selector: "input[euiInputText]", inputs: ["isInvalid"] }, { kind: "component", type: i3.EuiButtonComponent, selector: "button[euiButton], a[euiButton]", inputs: ["e2eAttr", "id", "euiBasicButton", "euiButtonCall", "euiCTAButton", "euiBlockButton", "euiIconButton", "euiAvatarButton", "euiLineWrap", "isCompact", "hasNoFocusRing", "isChecked", "euiDisabled"], outputs: ["buttonClick"] }, { kind: "component", type: i4.EuiIconSvgComponent, selector: "eui-icon-svg, span[euiIconSvg], i[euiIconSvg]", inputs: ["icon", "fillColor", "set", "size", "style", "iconUrl", "transform", "euiVariant", "aria-label", "ariaHidden", "focusable", "isLoading", "isInputIcon", "euiStart", "euiEnd"] }, { kind: "component", type: i5.EuiIconInputComponent, selector: "eui-icon-input", inputs: ["euiIconPositionStart", "euiIconPositionEnd"] }], encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiTreeListToolbarComponent, decorators: [{
            type: Component,
            args: [{ selector: 'eui-tree-list-toolbar', encapsulation: ViewEncapsulation.None, imports: [
                        FormsModule,
                        ...EUI_INPUT_TEXT,
                        ...EUI_BUTTON,
                        ...EUI_ICON,
                        ...EUI_ICON_INPUT,
                    ], template: "@if (isVisible) {\n    <eui-icon-input>\n        <eui-icon-svg icon=\"search:outline\" fillColor=\"neutral-lighter\" aria-label=\"Search Icon\" />\n        <input\n            euiInputText\n            euiClearable\n            [(ngModel)]=\"filterValue\"\n            [placeholder]=\"filterLabel\"\n            (ngModelChange)=\"onFilter()\" />\n    </eui-icon-input>\n\n    @if (!isToggleExpanded) {\n        <button euiButton euiSecondary euiOutline (click)=\"onExpandAll($event)\" [euiIconButton]=\"expandAllLabel === ''\" aria-label=\"Expand all\">\n            @if (expandAllLabel !== '') {\n                {{ expandAllLabel }}\n            }\n            <eui-icon-svg icon=\"eui-level-down\" aria-label=\"Expand all tree items icon\" />\n        </button>\n    } @else {\n        <button euiButton euiSecondary euiOutline (click)=\"onCollapseAll($event)\" [euiIconButton]=\"collapseAllLabel === ''\" aria-label=\"Collapse all\">\n            @if (collapseAllLabel !== '') {\n                {{ collapseAllLabel }}\n            }\n            <eui-icon-svg icon=\"eui-level-up\" aria-label=\"Collapse all tree items icon\" />\n        </button>\n    }\n}\n" }]
        }], propDecorators: { classes: [{
                type: HostBinding,
                args: ['class']
            }], e2eAttr: [{
                type: Input
            }], isVisible: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], filterLabel: [{
                type: Input
            }], expandAllLabel: [{
                type: Input
            }], collapseAllLabel: [{
                type: Input
            }], isFilterVisible: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], isToggleVisible: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], isToggleExpanded: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], filterValue: [{
                type: Input
            }], hasLabels: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], filter: [{
                type: Output
            }], expandAll: [{
                type: Output
            }], collapseAll: [{
                type: Output
            }] } });

class EuiTreeListComponent {
    constructor() {
        /**
         * Option to show the toolbar
         * @default false
         */
        this.isShowToolbar = false;
        /**
         * @deprecated This property is not used anymore and will be removed in the next major version.
         */
        this.isShowToolbarToggle = true;
        /**
         * Sets the expanded state of the tree list
         */
        this.isExpanded = false;
        /**
         * @deprecated This property is not used anymore and will be removed in the next major version.
         */
        this.hasItemsUrl = false;
        /**
         * Sets the tabindex attribute to handle the focus state
         * @default '0'
         */
        this.tabindex = '0';
        /**
         * Sets the aria-label attribute for the tree list
         * @default ''
         */
        this.ariaLabel = '';
        /**
         * Sets the filter value of the toolbar
         * @default ''
         */
        this.toolbarFilterValue = '';
        /**
         * Sets the end-to-end attribute for the tree list
         * @default 'eui-tree-list'
         */
        this.e2eAttr = 'eui-tree-list';
        /**
         * @deprecated This property is not used anymore and will be removed in the next major version.
         */
        this.itemSelected = new EventEmitter();
        /**
         * Event that emits the filter value upon filtering.
         */
        this.filter = new EventEmitter();
        /**
         * Event emitted upon expanding all items.
         */
        this.expandAll = new EventEmitter();
        /**
         * Event emitted upon collapsing all items.
         */
        this.collapseAll = new EventEmitter();
        this.ariaOwns = '';
        this.originalTabindex = '0';
        this.classes = '';
        this.ariaRoleTree = 'tree';
        this.elementRef = inject(ElementRef);
    }
    ngAfterViewInit() {
        const treeItemIds = [];
        if (this.items) {
            this.items.forEach((treeItem) => {
                treeItemIds.push(treeItem.id);
            });
        }
        setTimeout(() => {
            this.ariaOwns = treeItemIds.join(' ');
            this.originalTabindex = this.tabindex;
            if (this.isExpanded) {
                this.setExpandedState(true);
            }
        }, 0);
    }
    ngOnChanges(changes) {
        if (changes && changes['tabindex']) {
            this.originalTabindex = this.tabindex;
        }
    }
    /**
     * Getter function that returns true if the expandAllLabel exists.
     * @returns {boolean}
     */
    get hasExpandAllLabel() {
        return this.expandAllLabel !== undefined && this.expandAllLabel !== null;
    }
    /**
     * Getter function that returns true if the collapseAllLabel exists.
     * @returns {boolean}
     */
    get hasCollapseAllLabel() {
        return this.collapseAllLabel !== undefined && this.collapseAllLabel !== null;
    }
    /**
     * Method that sets the expanded state and emits the expand-all event.
     */
    onExpandAll(event) {
        this.setExpandedState(true);
        this.expandAll.next(void 0);
    }
    /**
     * Method that sets the collapsed state and emits the collapse-all event.
     */
    onCollapseAll(event) {
        this.setExpandedState(false);
        this.collapseAll.next(void 0);
    }
    /**
     * Method that handles the visibility of the items based on the filter value and emits the filter event.
     * @param {string} filterValue - The filter value to set.
     */
    onFilter(filterValue) {
        // TODO find a recursive way of doing the filtering throughout the tree structure
        if (filterValue && filterValue !== '') {
            this.setVisibleState(false);
            this.items.toArray().forEach((item1) => {
                item1.isVisible = this.filterMatched(0, item1, filterValue);
                if (item1.subTreeList.length !== 0) {
                    item1.subTreeList.toArray().forEach((item1SubTreeList) => {
                        item1SubTreeList.items.toArray().forEach((item2) => {
                            if (this.filterMatched(1, item2, filterValue)) {
                                item2.isVisible = true;
                                item1.isVisible = true;
                                item1.isExpanded = true;
                                if (item2.subTreeList.length !== 0) {
                                    item2.subTreeList.toArray().forEach((item2SubTreeList) => {
                                        item2SubTreeList.items.toArray().forEach((item3) => {
                                            item3.isVisible = true;
                                        });
                                    });
                                }
                            }
                            if (item2.subTreeList.length !== 0) {
                                item2.subTreeList.toArray().forEach((item2SubTreeList) => {
                                    item2SubTreeList.items.toArray().forEach((item4) => {
                                        if (this.filterMatched(2, item4, filterValue)) {
                                            item4.isVisible = true;
                                            item2.isVisible = true;
                                            item2.isExpanded = true;
                                            item1.isVisible = true;
                                            item1.isExpanded = true;
                                        }
                                    });
                                });
                            }
                        });
                    });
                }
            });
        }
        else {
            this.setVisibleState(true);
        }
        this.filter.next(filterValue);
    }
    /**
     * @deprecated This method is not used anymore and will be removed in the next major version. You can use the `focus()` method instead.
     */
    onFocus() {
        this.focus();
    }
    /**
     * Method that sets the visibility state of the tree list items.
     * @param {boolean} state
     */
    setVisibleState(state) {
        this.items.toArray().forEach((item) => item.setVisibleState(state));
    }
    /**
     * Method that sets the expanded state of the tree list items.
     * @param {boolean} state
     */
    setExpandedState(state) {
        this.items.toArray().forEach((item) => item.setExpandedState(state));
    }
    /**
     * Method that puts the focus on the first child tree item.
     */
    focus() {
        // Focus on the first child tree item:
        if (this.items && this.items.length > 0) {
            this.items.first.focus();
        }
    }
    /**
     * Method that makes the tree list not focusable.
     */
    disableFocus() {
        this.tabindex = '-1';
    }
    /**
     * Method used to focus on the previous tree item in the list.
     * @param {EuiTreeListItemComponent} currentTreeListItem - The current tree list item.
     * @return {boolean} - Returns true if the focus was set on the previous tree item, false otherwise.
     */
    focusOnPreviousTreeItem(currentTreeListItem) {
        if (this.items && this.items.length > 0) {
            let previousTreeListItem = null;
            for (const treeListItem of this.items.toArray()) {
                if (treeListItem !== currentTreeListItem) {
                    previousTreeListItem = treeListItem;
                }
                else if (previousTreeListItem) {
                    previousTreeListItem.focusOnLastExpandedTreeItem();
                    return true;
                }
            }
            // Focus on the last item of the previous parent:
            // First find the parent list item:
            if (this.elementRef) {
                let parent = this.elementRef.nativeElement.parentElement;
                while (parent && !parent.classList.contains('eui-tree-list-item')) {
                    parent = parent.parentElement;
                }
                if (parent) {
                    // parent tree-item is found
                    const content = parent.querySelector('.eui-tree-list-item-header__content');
                    if (content) {
                        content.setAttribute('tabindex', '0');
                        content.focus();
                        return true;
                    }
                }
            }
        }
        return false;
    }
    /**
     * Method used to focus on the next tree item in the list.
     * @param {EuiTreeListItemComponent} currentTreeListItem - The current tree list item.
     * @return {boolean} - Returns true if the focus was set on the next tree item, false otherwise.
     */
    focusOnNextTreeItem(currentTreeListItem) {
        if (this.items && this.items.length > 0) {
            if (currentTreeListItem !== this.items.last) {
                let previousTreeListItem = null;
                for (const treeListItem of this.items.toArray()) {
                    if (previousTreeListItem !== currentTreeListItem) {
                        previousTreeListItem = treeListItem;
                    }
                    else {
                        treeListItem.focus();
                        return true;
                    }
                }
            }
            else {
                // The current focused tree item is the last one; find the first next tree item:
                if (this.elementRef) {
                    // First find the parent tree list item:
                    let parent = this.elementRef.nativeElement.parentElement;
                    // Find the parent that is not a last child itself:
                    while (parent && (parent.tagName.toLowerCase() !== 'eui-tree-list-item' || parent.nextElementSibling === null)) {
                        parent = parent.parentElement;
                    }
                    if (parent) {
                        // parent tree list item is found; focus on the first child of the next list item
                        const nextTreeListItem = parent.nextElementSibling;
                        if (nextTreeListItem) {
                            const next = nextTreeListItem.querySelector('.eui-tree-list-item-header__content');
                            next.setAttribute('tabindex', '0');
                            next.focus();
                            return true;
                        }
                    }
                }
            }
        }
        return false;
    }
    /**
     * Method that sets the default filter function to filter the tree list items.
     * @param {EuiTreeListFilterParams} params - The filter parameters.
     * @returns {boolean} - Returns true if the item matches the filter, false otherwise.
     * @private
     */
    defaultFilterFunction(params) {
        if (!params.item.label) {
            return false;
        }
        else if (params.item.label.toUpperCase().indexOf(params.keyword.toUpperCase()) !== -1) {
            return true;
        }
        else {
            return false;
        }
    }
    /**
     * Method that filters the tree list items based on the provided params.
     * @param {number} level - The level of the item in the tree list.
     * @param {EuiTreeListItemComponent} item - The tree list item to filter.
     * @param {string} keyword - The keyword to filter by.
     * @returns {boolean} - Returns true if the item matches the filter, false otherwise.
     * @private
     */
    filterMatched(level, item, keyword) {
        if (this.filterFunction) {
            return this.filterFunction({ level, item, keyword });
        }
        else {
            return this.defaultFilterFunction({ level, item, keyword });
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiTreeListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: EuiTreeListComponent, isStandalone: true, selector: "eui-tree-list", inputs: { isShowToolbar: ["isShowToolbar", "isShowToolbar", booleanAttribute], isShowToolbarToggle: ["isShowToolbarToggle", "isShowToolbarToggle", booleanAttribute], isExpanded: ["isExpanded", "isExpanded", booleanAttribute], hasItemsUrl: ["hasItemsUrl", "hasItemsUrl", booleanAttribute], filterLabel: "filterLabel", filterFunction: "filterFunction", expandAllLabel: "expandAllLabel", collapseAllLabel: "collapseAllLabel", tabindex: "tabindex", ariaLabel: "ariaLabel", toolbarFilterValue: "toolbarFilterValue", e2eAttr: "e2eAttr" }, outputs: { itemSelected: "itemSelected", filter: "filter", expandAll: "expandAll", collapseAll: "collapseAll" }, queries: [{ propertyName: "items", predicate: i0.forwardRef(() => EuiTreeListItemComponent) }], usesOnChanges: true, ngImport: i0, template: "@if (isShowToolbar) {\n    <eui-tree-list-toolbar\n        [isVisible]=\"isShowToolbar\"\n        [isToggleVisible]=\"isShowToolbarToggle\"\n        (filter)=\"onFilter($event)\"\n        [filterValue]=\"toolbarFilterValue\"\n        (expandAll)=\"onExpandAll($event)\"\n        (collapseAll)=\"onCollapseAll($event)\"\n        [filterLabel]=\"filterLabel ? filterLabel : 'eui.FILTER' | translate\"\n        [expandAllLabel]=\"hasExpandAllLabel ? expandAllLabel : 'eui.EXPANDALL' | translate\"\n        [collapseAllLabel]=\"hasCollapseAllLabel ? collapseAllLabel : 'eui.COLLAPSEALL' | translate\"\n        [isToggleExpanded]=\"isExpanded\"\n        attr.data-e2e=\"{{ e2eAttr }}-a-toolbar-filter\" />\n}\n\n<div\n    class=\"eui-tree-list\"\n    [attr.role]=\"ariaRoleTree\"\n    [attr.data-tabindex]=\"originalTabindex\"\n    [attr.aria-label]=\"ariaLabel\"\n    [attr.aria-owns]=\"ariaOwns\"\n    attr.data-e2e=\"{{ e2eAttr }}\">\n    <ng-content></ng-content>\n</div>\n", styles: [".eui-19 .eui-tree-list{display:block;width:100%;background-color:var(--eui-c-surface-container)}.eui-19 .eui-tree-list-item{display:block;width:100%;border-top:1px solid var(--eui-c-divider)}.eui-19 .eui-tree-list-item-header{display:flex;align-items:center;width:100%;border-left:var(--eui-s-xs) solid transparent;text-decoration:none;min-height:calc(3 * var(--eui-s-m))}.eui-19 .eui-tree-list-item-header:hover,.eui-19 .eui-tree-list-item-header:focus{text-decoration:none}.eui-19 .eui-tree-list-item-header__content{align-items:center;display:flex;padding:var(--eui-s-xs);width:100%;font:var(--eui-f-m)}.eui-19 .eui-tree-list-item-header__content:focus:not([readonly]){outline:2px solid var(--eui-c-focus)!important;outline-offset:-2px!important;transition:none}.eui-19 .eui-tree-list-item-header__content:focus-visible:not([readonly]){outline:2px solid var(--eui-c-focus-visible)!important;outline-offset:-2px!important;transition:none}.eui-19 .eui-tree-list-item-header__content [tabindex=\"0\"]:focus:not([readonly]){outline:2px solid var(--eui-c-focus-visible)!important;outline-offset:-2px!important;transition:none}.eui-19 .eui-tree-list-item-header__content-right-content{align-items:center;display:flex;flex:0 0 auto;margin-left:auto;margin-right:var(--eui-s-xs)}.eui-19 .eui-tree-list-item-header__content-expand-toggle-wrapper{align-items:center;display:flex;margin-left:var(--eui-s-s);text-align:center}.eui-19 .eui-tree-list-item-header__content-expand-toggle{color:var(--eui-c-text-light);cursor:pointer;padding:var(--eui-s-xs)}.eui-19 .eui-tree-list-item-header__content-expand-toggle:hover{box-shadow:var(--eui-sh-1)}.eui-19 .eui-tree-list-item-header__details-content{border-top:1px solid var(--eui-c-divider-light);padding:var(--eui-s-xs)}.eui-19 .eui-tree-list .eui-tree-list{border-top:1px solid var(--eui-c-divider-light)}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list-item{border-top:0}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content,.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content-right-content-sub{color:var(--eui-c-text)}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list{padding-left:0}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content{border-bottom:0}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content-right-content-sub{color:var(--eui-c-text-light)}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content,.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list-item-header__details-content{margin-left:var(--eui-s-m)}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content,.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__details-content{margin-left:calc(2 * var(--eui-s-m))}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content,.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__details-content{margin-left:calc(3 * var(--eui-s-m))}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content,.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__details-content{margin-left:calc(4 * var(--eui-s-m))}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content,.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__details-content{margin-left:calc(5 * var(--eui-s-m))}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content,.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__details-content{margin-left:calc(6 * var(--eui-s-m))}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content,.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__details-content{margin-left:calc(7 * var(--eui-s-m))}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content,.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__details-content{margin-left:calc(8 * var(--eui-s-m))}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content,.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__details-content{margin-left:calc(9 * var(--eui-s-m))}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content,.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__details-content{margin-left:calc(10 * var(--eui-s-m))}.eui-19 .eui-tree-list--no-bullets .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content:before{content:\"\"}.eui-19 .eui-tree-list-item__hover-content{background-color:var(--eui-c-active-bg);height:100%;left:var(--eui-layout-sidebar-width);position:fixed;top:calc(var(--eui-layout-header-height) + var(--eui-layout-nav-height) - 1);width:var(--eui-layout-sidebar-width)}.eui-19 .eui-tree-list-item-content{display:flex;align-items:center;width:100%}.eui-19 .eui-tree-list-toolbar{align-items:center;display:flex;flex-direction:row;gap:var(--eui-s-s);padding:var(--eui-s-m)}.eui-19 .eui-tree-list-item--primary .eui-tree-list-item-header{border-color:var(--eui-c-s-primary-base)}.eui-19 .eui-tree-list-item--secondary .eui-tree-list-item-header{border-color:var(--eui-c-s-secondary-border)}.eui-19 .eui-tree-list-item--info .eui-tree-list-item-header{border-color:var(--eui-c-s-info-base)}.eui-19 .eui-tree-list-item--success .eui-tree-list-item-header{border-color:var(--eui-c-s-success-base)}.eui-19 .eui-tree-list-item--warning .eui-tree-list-item-header{border-color:var(--eui-c-s-warning-base)}.eui-19 .eui-tree-list-item--danger .eui-tree-list-item-header{border-color:var(--eui-c-s-danger-base)}.eui-19 .eui-tree-list-item--accent .eui-tree-list-item-header{border-color:var(--eui-c-s-accent-border)}.eui-19 .eui-tree-list-item--hidden{display:none}\n"], dependencies: [{ kind: "component", type: EuiTreeListToolbarComponent, selector: "eui-tree-list-toolbar", inputs: ["e2eAttr", "isVisible", "filterLabel", "expandAllLabel", "collapseAllLabel", "isFilterVisible", "isToggleVisible", "isToggleExpanded", "filterValue", "hasLabels"], outputs: ["filter", "expandAll", "collapseAll"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiTreeListComponent, decorators: [{
            type: Component,
            args: [{ selector: 'eui-tree-list', encapsulation: ViewEncapsulation.None, imports: [
                        EuiTreeListToolbarComponent,
                        TranslateModule,
                    ], template: "@if (isShowToolbar) {\n    <eui-tree-list-toolbar\n        [isVisible]=\"isShowToolbar\"\n        [isToggleVisible]=\"isShowToolbarToggle\"\n        (filter)=\"onFilter($event)\"\n        [filterValue]=\"toolbarFilterValue\"\n        (expandAll)=\"onExpandAll($event)\"\n        (collapseAll)=\"onCollapseAll($event)\"\n        [filterLabel]=\"filterLabel ? filterLabel : 'eui.FILTER' | translate\"\n        [expandAllLabel]=\"hasExpandAllLabel ? expandAllLabel : 'eui.EXPANDALL' | translate\"\n        [collapseAllLabel]=\"hasCollapseAllLabel ? collapseAllLabel : 'eui.COLLAPSEALL' | translate\"\n        [isToggleExpanded]=\"isExpanded\"\n        attr.data-e2e=\"{{ e2eAttr }}-a-toolbar-filter\" />\n}\n\n<div\n    class=\"eui-tree-list\"\n    [attr.role]=\"ariaRoleTree\"\n    [attr.data-tabindex]=\"originalTabindex\"\n    [attr.aria-label]=\"ariaLabel\"\n    [attr.aria-owns]=\"ariaOwns\"\n    attr.data-e2e=\"{{ e2eAttr }}\">\n    <ng-content></ng-content>\n</div>\n", styles: [".eui-19 .eui-tree-list{display:block;width:100%;background-color:var(--eui-c-surface-container)}.eui-19 .eui-tree-list-item{display:block;width:100%;border-top:1px solid var(--eui-c-divider)}.eui-19 .eui-tree-list-item-header{display:flex;align-items:center;width:100%;border-left:var(--eui-s-xs) solid transparent;text-decoration:none;min-height:calc(3 * var(--eui-s-m))}.eui-19 .eui-tree-list-item-header:hover,.eui-19 .eui-tree-list-item-header:focus{text-decoration:none}.eui-19 .eui-tree-list-item-header__content{align-items:center;display:flex;padding:var(--eui-s-xs);width:100%;font:var(--eui-f-m)}.eui-19 .eui-tree-list-item-header__content:focus:not([readonly]){outline:2px solid var(--eui-c-focus)!important;outline-offset:-2px!important;transition:none}.eui-19 .eui-tree-list-item-header__content:focus-visible:not([readonly]){outline:2px solid var(--eui-c-focus-visible)!important;outline-offset:-2px!important;transition:none}.eui-19 .eui-tree-list-item-header__content [tabindex=\"0\"]:focus:not([readonly]){outline:2px solid var(--eui-c-focus-visible)!important;outline-offset:-2px!important;transition:none}.eui-19 .eui-tree-list-item-header__content-right-content{align-items:center;display:flex;flex:0 0 auto;margin-left:auto;margin-right:var(--eui-s-xs)}.eui-19 .eui-tree-list-item-header__content-expand-toggle-wrapper{align-items:center;display:flex;margin-left:var(--eui-s-s);text-align:center}.eui-19 .eui-tree-list-item-header__content-expand-toggle{color:var(--eui-c-text-light);cursor:pointer;padding:var(--eui-s-xs)}.eui-19 .eui-tree-list-item-header__content-expand-toggle:hover{box-shadow:var(--eui-sh-1)}.eui-19 .eui-tree-list-item-header__details-content{border-top:1px solid var(--eui-c-divider-light);padding:var(--eui-s-xs)}.eui-19 .eui-tree-list .eui-tree-list{border-top:1px solid var(--eui-c-divider-light)}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list-item{border-top:0}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content,.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content-right-content-sub{color:var(--eui-c-text)}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list{padding-left:0}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content{border-bottom:0}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content-right-content-sub{color:var(--eui-c-text-light)}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content,.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list-item-header__details-content{margin-left:var(--eui-s-m)}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content,.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__details-content{margin-left:calc(2 * var(--eui-s-m))}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content,.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__details-content{margin-left:calc(3 * var(--eui-s-m))}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content,.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__details-content{margin-left:calc(4 * var(--eui-s-m))}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content,.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__details-content{margin-left:calc(5 * var(--eui-s-m))}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content,.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__details-content{margin-left:calc(6 * var(--eui-s-m))}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content,.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__details-content{margin-left:calc(7 * var(--eui-s-m))}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content,.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__details-content{margin-left:calc(8 * var(--eui-s-m))}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content,.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__details-content{margin-left:calc(9 * var(--eui-s-m))}.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content,.eui-19 .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list .eui-tree-list-item-header__details-content{margin-left:calc(10 * var(--eui-s-m))}.eui-19 .eui-tree-list--no-bullets .eui-tree-list .eui-tree-list .eui-tree-list-item-header__content:before{content:\"\"}.eui-19 .eui-tree-list-item__hover-content{background-color:var(--eui-c-active-bg);height:100%;left:var(--eui-layout-sidebar-width);position:fixed;top:calc(var(--eui-layout-header-height) + var(--eui-layout-nav-height) - 1);width:var(--eui-layout-sidebar-width)}.eui-19 .eui-tree-list-item-content{display:flex;align-items:center;width:100%}.eui-19 .eui-tree-list-toolbar{align-items:center;display:flex;flex-direction:row;gap:var(--eui-s-s);padding:var(--eui-s-m)}.eui-19 .eui-tree-list-item--primary .eui-tree-list-item-header{border-color:var(--eui-c-s-primary-base)}.eui-19 .eui-tree-list-item--secondary .eui-tree-list-item-header{border-color:var(--eui-c-s-secondary-border)}.eui-19 .eui-tree-list-item--info .eui-tree-list-item-header{border-color:var(--eui-c-s-info-base)}.eui-19 .eui-tree-list-item--success .eui-tree-list-item-header{border-color:var(--eui-c-s-success-base)}.eui-19 .eui-tree-list-item--warning .eui-tree-list-item-header{border-color:var(--eui-c-s-warning-base)}.eui-19 .eui-tree-list-item--danger .eui-tree-list-item-header{border-color:var(--eui-c-s-danger-base)}.eui-19 .eui-tree-list-item--accent .eui-tree-list-item-header{border-color:var(--eui-c-s-accent-border)}.eui-19 .eui-tree-list-item--hidden{display:none}\n"] }]
        }], propDecorators: { isShowToolbar: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], isShowToolbarToggle: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], isExpanded: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], hasItemsUrl: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], filterLabel: [{
                type: Input
            }], filterFunction: [{
                type: Input
            }], expandAllLabel: [{
                type: Input
            }], collapseAllLabel: [{
                type: Input
            }], tabindex: [{
                type: Input
            }], ariaLabel: [{
                type: Input
            }], toolbarFilterValue: [{
                type: Input
            }], e2eAttr: [{
                type: Input
            }], itemSelected: [{
                type: Output
            }], filter: [{
                type: Output
            }], expandAll: [{
                type: Output
            }], collapseAll: [{
                type: Output
            }], items: [{
                type: ContentChildren,
                args: [forwardRef(() => EuiTreeListItemComponent)]
            }] } });

class EuiTreeListItemContentComponent {
    constructor() {
        this.string = 'eui-tree-list-item-content';
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiTreeListItemContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: EuiTreeListItemContentComponent, isStandalone: true, selector: "eui-tree-list-item-content", host: { properties: { "class": "this.string" } }, ngImport: i0, template: '<ng-content />', isInline: true }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiTreeListItemContentComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'eui-tree-list-item-content',
                    template: '<ng-content />',
                }]
        }], propDecorators: { string: [{
                type: HostBinding,
                args: ['class']
            }] } });

class EuiTreeListItemComponent {
    constructor() {
        this.tabIndex = '0';
        this.ariaRole = 'treeitem';
        this.e2eAttr = 'eui-tree-list-item';
        /**
         * @deprecated This property is not used anymore and will be removed in the next major version.
         */
        this.subLinks = [];
        /**
         * Option that enables a corresponding class if it is set to true.
         * @default false
         */
        this.isActive = false;
        /**
         * Option to set the expanded state of the list item.
         * @default false
         */
        this.isExpanded = false;
        /**
         * Option to set the expanded state of the list item when it is always expanded.
         * @default false
         */
        this.isAlwaysExpanded = false;
        /**
         * Option to set the visible state of the list item and apply the corresponding hidden class if it is set to false.
         * @default true
         */
        this.isVisible = true;
        /**
         * @deprecated This property is not used anymore and will be removed in the next major version.
         */
        this.isDisplaySubLinksOnHover = false;
        /**
         * @deprecated This property is not used anymore and will be removed in the next major version.
         */
        this.isNavigateOnlyOnLabelClick = false;
        /**
         * Event emitted upon toggling the expanded state.
         */
        this.toggled = new EventEmitter();
        this.isHovered = false;
        this.treeListComponent = inject(EuiTreeListComponent, { host: true, optional: true });
        // tree states
        this.hasSub = false;
        // custom content
        this.hasCustomContent = false;
        this.elementRef = inject(ElementRef);
        this.baseStatesDirective = inject(BaseStatesDirective);
    }
    get cssClasses() {
        return this.getCssClasses();
    }
    ngAfterContentInit() {
        if (!this.ariaLabel) {
            this.ariaLabel = this.label ? this.label : 'Custom content';
        }
        // make sure that the tree item can be aria-owned by a parent tree for WAI-ARIA attributes:
        if (!this.id) {
            this.id = uniqueId();
        }
        // setting tree states
        if (this.subTreeList.length !== 0) {
            this.hasSub = true;
        }
        // checking if customContent set
        if (this.customContent.length !== 0) {
            this.hasCustomContent = true;
        }
        // make sure that any child tree-list is non-focusable and that it has the role of a WAI-ARIA group:
        if (this.subTreeList) {
            this.subTreeList.forEach((subtree) => {
                subtree.disableFocus();
                subtree.ariaRoleTree = 'group';
            });
        }
    }
    /**
     * Method fired when the expander button is clicked.
     * @param {Event} event - The click event.
     */
    toggle(event) {
        event.preventDefault();
        event.stopPropagation();
        this.isExpanded = !this.isExpanded;
        this.toggled.next(this);
    }
    /**
     * Method fired when a key is pressed down.
     * @param {KeyboardEvent} event - The keyboard event.
     */
    onKeyDown(event) {
        switch (event.keyCode) {
            case 13: // ENTER
            case 32: // SPACE
                this.isExpanded = !this.isExpanded;
                consumeEvent(event);
                break;
            case 37: // ARROW LEFT
                this.isExpanded = false;
                consumeEvent(event);
                break;
            case 38: // ARROW UP
                if (this.treeListComponent) {
                    if (this.treeListComponent.focusOnPreviousTreeItem(this)) {
                        this.disableFocus();
                    }
                }
                consumeEvent(event);
                break;
            case 39: // ARROW RIGHT
                this.isExpanded = true;
                consumeEvent(event);
                break;
            case 40: // ARROW DOWN
                if (this.focusOnNextTreeItem()) {
                    this.disableFocus();
                }
                consumeEvent(event);
                break;
        }
    }
    /**
     * Method that sets the visible state.
     * @param {boolean} state - The visible state.
     */
    setVisibleState(state) {
        this.isVisible = state;
        if (this.subTreeList && this.subTreeList.length !== 0) {
            this.subTreeList.toArray().forEach((item) => {
                item.setVisibleState(state);
            });
        }
    }
    /**
     * Method that sets the expanded state.
     * @param {boolean} state - The expanded state.
     */
    setExpandedState(state) {
        this.isExpanded = state;
        if (this.subTreeList.length !== 0) {
            this.subTreeList.toArray().forEach((item) => {
                item.setExpandedState(state);
            });
        }
    }
    /**
     * Method used to enable/disable the focus state.
     */
    focus() {
        if (this.focusable) {
            this.enableFocus();
            this.focusable.nativeElement.focus();
        }
        if (this.treeListComponent) {
            this.treeListComponent.disableFocus();
        }
    }
    /**
     * Method used to focus on the last expanded tree item.
     */
    focusOnLastExpandedTreeItem() {
        const lastExpanded = this.elementRef.nativeElement.querySelectorAll('.eui-tree-list-item-header__content');
        if (lastExpanded && lastExpanded.length > 0) {
            const element = lastExpanded[lastExpanded.length - 1];
            element.setAttribute('tabindex', '0');
            element.focus();
        }
        else {
            this.focus();
        }
    }
    /**
     * Method used to focus on the next tree item.
     * @returns {boolean} - Returns true if the focus was set, false otherwise.
     * @protected
     */
    focusOnNextTreeItem() {
        if (this.isExpanded && this.subTreeList && this.subTreeList.length > 0) {
            this.subTreeList.first.focus();
            return true;
        }
        else if (this.treeListComponent) {
            return this.treeListComponent.focusOnNextTreeItem(this);
        }
        return false;
    }
    /**
     * Method used to disable the focus state.
     * @protected
     */
    disableFocus() {
        if (this.focusable) {
            this.focusable.nativeElement.setAttribute('tabindex', '-1');
        }
    }
    /**
     * Method used to enable the focus state.
     * @protected
     */
    enableFocus() {
        if (this.focusable) {
            this.focusable.nativeElement.setAttribute('tabindex', '0');
        }
    }
    /**
     * Method used to get the CSS classes for the tree list item.
     * @returns {string} - The CSS classes.
     * @private
     */
    getCssClasses() {
        return [
            this.baseStatesDirective.getCssClasses('eui-tree-list-item'),
            this.isActive ? 'eui-tree-list-item--active' : '',
            !this.isVisible ? 'eui-tree-list-item--hidden' : '',
        ]
            .join(' ')
            .trim();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiTreeListItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: EuiTreeListItemComponent, isStandalone: true, selector: "eui-tree-list-item", inputs: { id: "id", ariaLabel: "ariaLabel", e2eAttr: "e2eAttr", label: "label", linkUrl: "linkUrl", subLabel: "subLabel", url: "url", subLinks: "subLinks", isActive: ["isActive", "isActive", booleanAttribute], isExpanded: ["isExpanded", "isExpanded", booleanAttribute], isAlwaysExpanded: ["isAlwaysExpanded", "isAlwaysExpanded", booleanAttribute], isVisible: ["isVisible", "isVisible", booleanAttribute], isDisplaySubLinksOnHover: ["isDisplaySubLinksOnHover", "isDisplaySubLinksOnHover", booleanAttribute], isNavigateOnlyOnLabelClick: ["isNavigateOnlyOnLabelClick", "isNavigateOnlyOnLabelClick", booleanAttribute] }, outputs: { toggled: "toggled" }, host: { properties: { "class": "this.cssClasses", "attr.tabindex": "this.tabIndex", "attr.role": "this.ariaRole", "attr.id": "this.id", "attr.aria-label": "this.ariaLabel", "attr.data-e2e": "this.e2eAttr" } }, queries: [{ propertyName: "customLabel", first: true, predicate: i0.forwardRef(() => EuiTreeListItemLabelTagDirective), descendants: true }, { propertyName: "customDetailContent", first: true, predicate: i0.forwardRef(() => EuiTreeListItemDetailsContentTagDirective), descendants: true }, { propertyName: "customSubContainerContent", first: true, predicate: i0.forwardRef(() => EuiTreeListItemSubContainerContentTagDirective), descendants: true }, { propertyName: "subTreeList", predicate: i0.forwardRef(() => EuiTreeListComponent), descendants: true }, { propertyName: "customContent", predicate: i0.forwardRef(() => EuiTreeListItemContentComponent) }], viewQueries: [{ propertyName: "focusable", first: true, predicate: ["focusable"], descendants: true }], hostDirectives: [{ directive: i1$2.BaseStatesDirective, inputs: ["euiPrimary", "euiPrimary", "euiSecondary", "euiSecondary", "euiInfo", "euiInfo", "euiSuccess", "euiSuccess", "euiWarning", "euiWarning", "euiDanger", "euiDanger", "euiAccent", "euiAccent", "euiVariant", "euiVariant"] }], ngImport: i0, template: "<div class=\"eui-tree-list-item-header\">\n    <div\n        #focusable\n        class=\"eui-tree-list-item-header__content\"\n        (keydown)=\"onKeyDown($event)\"\n        attr.aria-label=\"{{ label }} {{ subLabel }}\">\n\n        @if (hasCustomContent) {\n            <ng-content select=\"eui-tree-list-item-content\"></ng-content>\n            <ng-container *ngTemplateOutlet=\"rightContent\"></ng-container>\n        } @else {\n            <div class=\"eui-u-flex\">\n                <eui-label>\n                    @if (!customLabel) {\n                        {{label}}\n                        @if (subLabel) {\n                        <eui-label euiSublabel>{{subLabel}}</eui-label>\n                        }\n                    } @else {\n                        <div class=\"eui-u-flex\">\n                            <ng-content select=\"eui-tree-list-item-label\"></ng-content>\n                        </div>\n                    }\n                </eui-label>\n            </div>\n            <ng-container *ngTemplateOutlet=\"rightContent\"></ng-container>\n        }\n    </div>\n\n    @if (customDetailContent) {\n        <div class=\"eui-tree-list-item-header__details-content\">\n            <ng-content select=\"eui-tree-list-item-details\"></ng-content>\n        </div>\n    }\n\n    @if (customSubContainerContent) {\n        <ng-content select=\"eui-tree-list-item-sub-container\"></ng-content>\n    }\n</div>\n\n@if (isExpanded || isAlwaysExpanded) {\n    <ng-content />\n}\n\n<ng-template #rightContent>\n    <div class=\"eui-tree-list-item-header__content-right-content\">\n        <div class=\"eui-tree-list-item-header__content-expand-toggle-wrapper\">\n            @if (hasSub && !isAlwaysExpanded) {\n                <eui-icon-button-expander\n                    (buttonClick)=\"toggle($event)\"\n                    [isExpanded]=\"isExpanded\"\n                    isDirectionForward>\n                </eui-icon-button-expander>\n            }\n        </div>\n    </div>\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i2$1.EuiLabelComponent, selector: "label[euiLabel], span[euiLabel], div[euiLabel], a[euiLabel], eui-label,               label[euiSublabel], span[euiSublabel], div[euiSublabel], a[euiSublabel], eui-sublabel", inputs: ["euiRequired", "euiReadonly", "euiSublabel"] }, { kind: "component", type: i3$1.EuiIconButtonExpanderComponent, selector: "eui-icon-button-expander", inputs: ["fillColor", "size", "ariaLabel", "isExpanded", "isDirectionForward", "euiDisabled"], outputs: ["buttonClick"] }], encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiTreeListItemComponent, decorators: [{
            type: Component,
            args: [{ selector: 'eui-tree-list-item', encapsulation: ViewEncapsulation.None, imports: [
                        TranslateModule,
                        FormsModule,
                        NgTemplateOutlet,
                        ...EUI_LABEL,
                        ...EUI_ICON_INPUT,
                        ...EUI_ICON_BUTTON_EXPANDER,
                    ], hostDirectives: [
                        {
                            directive: BaseStatesDirective,
                            inputs: ['euiPrimary', 'euiSecondary', 'euiInfo', 'euiSuccess', 'euiWarning', 'euiDanger', 'euiAccent', 'euiVariant'],
                        },
                    ], template: "<div class=\"eui-tree-list-item-header\">\n    <div\n        #focusable\n        class=\"eui-tree-list-item-header__content\"\n        (keydown)=\"onKeyDown($event)\"\n        attr.aria-label=\"{{ label }} {{ subLabel }}\">\n\n        @if (hasCustomContent) {\n            <ng-content select=\"eui-tree-list-item-content\"></ng-content>\n            <ng-container *ngTemplateOutlet=\"rightContent\"></ng-container>\n        } @else {\n            <div class=\"eui-u-flex\">\n                <eui-label>\n                    @if (!customLabel) {\n                        {{label}}\n                        @if (subLabel) {\n                        <eui-label euiSublabel>{{subLabel}}</eui-label>\n                        }\n                    } @else {\n                        <div class=\"eui-u-flex\">\n                            <ng-content select=\"eui-tree-list-item-label\"></ng-content>\n                        </div>\n                    }\n                </eui-label>\n            </div>\n            <ng-container *ngTemplateOutlet=\"rightContent\"></ng-container>\n        }\n    </div>\n\n    @if (customDetailContent) {\n        <div class=\"eui-tree-list-item-header__details-content\">\n            <ng-content select=\"eui-tree-list-item-details\"></ng-content>\n        </div>\n    }\n\n    @if (customSubContainerContent) {\n        <ng-content select=\"eui-tree-list-item-sub-container\"></ng-content>\n    }\n</div>\n\n@if (isExpanded || isAlwaysExpanded) {\n    <ng-content />\n}\n\n<ng-template #rightContent>\n    <div class=\"eui-tree-list-item-header__content-right-content\">\n        <div class=\"eui-tree-list-item-header__content-expand-toggle-wrapper\">\n            @if (hasSub && !isAlwaysExpanded) {\n                <eui-icon-button-expander\n                    (buttonClick)=\"toggle($event)\"\n                    [isExpanded]=\"isExpanded\"\n                    isDirectionForward>\n                </eui-icon-button-expander>\n            }\n        </div>\n    </div>\n</ng-template>\n" }]
        }], propDecorators: { cssClasses: [{
                type: HostBinding,
                args: ['class']
            }], tabIndex: [{
                type: HostBinding,
                args: ['attr.tabindex']
            }], ariaRole: [{
                type: HostBinding,
                args: ['attr.role']
            }], id: [{
                type: HostBinding,
                args: ['attr.id']
            }, {
                type: Input
            }], ariaLabel: [{
                type: HostBinding,
                args: ['attr.aria-label']
            }, {
                type: Input
            }], e2eAttr: [{
                type: HostBinding,
                args: ['attr.data-e2e']
            }, {
                type: Input
            }], label: [{
                type: Input
            }], linkUrl: [{
                type: Input
            }], subLabel: [{
                type: Input
            }], url: [{
                type: Input
            }], subLinks: [{
                type: Input
            }], isActive: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], isExpanded: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], isAlwaysExpanded: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], isVisible: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], isDisplaySubLinksOnHover: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], isNavigateOnlyOnLabelClick: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], toggled: [{
                type: Output
            }], focusable: [{
                type: ViewChild,
                args: ['focusable']
            }], customLabel: [{
                type: ContentChild,
                args: [forwardRef(() => EuiTreeListItemLabelTagDirective)]
            }], customDetailContent: [{
                type: ContentChild,
                args: [forwardRef(() => EuiTreeListItemDetailsContentTagDirective)]
            }], customSubContainerContent: [{
                type: ContentChild,
                args: [forwardRef(() => EuiTreeListItemSubContainerContentTagDirective)]
            }], subTreeList: [{
                type: ContentChildren,
                args: [forwardRef(() => EuiTreeListComponent), { descendants: true }]
            }], customContent: [{
                type: ContentChildren,
                args: [forwardRef(() => EuiTreeListItemContentComponent), { descendants: false }]
            }] } });
/* eslint-disable */
class EuiTreeListItemLabelTagDirective {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiTreeListItemLabelTagDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: EuiTreeListItemLabelTagDirective, isStandalone: true, selector: "eui-tree-list-item-label", ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiTreeListItemLabelTagDirective, decorators: [{
            type: Directive,
            args: [{ selector: 'eui-tree-list-item-label', }]
        }] });
class EuiTreeListItemDetailsContentTagDirective {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiTreeListItemDetailsContentTagDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: EuiTreeListItemDetailsContentTagDirective, isStandalone: true, selector: "eui-tree-list-item-details", ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiTreeListItemDetailsContentTagDirective, decorators: [{
            type: Directive,
            args: [{ selector: 'eui-tree-list-item-details', }]
        }] });
class EuiTreeListItemSubContainerContentTagDirective {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiTreeListItemSubContainerContentTagDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: EuiTreeListItemSubContainerContentTagDirective, isStandalone: true, selector: "eui-tree-list-item-sub-container", ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiTreeListItemSubContainerContentTagDirective, decorators: [{
            type: Directive,
            args: [{ selector: 'eui-tree-list-item-sub-container', }]
        }] });

/**
 * @description
 * This module provides the EuiTreeListComponent which is used to create
 * tree lists with various styles and functionalities.
 *
 * @deprecated Use {@link EUI_TREE_LIST} instead
 */
class EuiTreeListModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiTreeListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.17", ngImport: i0, type: EuiTreeListModule, imports: [EuiTreeListComponent,
            EuiTreeListItemComponent,
            EuiTreeListItemLabelTagDirective,
            EuiTreeListItemDetailsContentTagDirective,
            EuiTreeListItemSubContainerContentTagDirective,
            EuiTreeListItemContentComponent,
            EuiTreeListToolbarComponent], exports: [EuiTreeListComponent,
            EuiTreeListItemComponent,
            EuiTreeListItemLabelTagDirective,
            EuiTreeListItemDetailsContentTagDirective,
            EuiTreeListItemSubContainerContentTagDirective,
            EuiTreeListItemContentComponent,
            EuiTreeListToolbarComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiTreeListModule, imports: [EuiTreeListComponent,
            EuiTreeListItemComponent,
            EuiTreeListToolbarComponent] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiTreeListModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [
                        EuiTreeListComponent,
                        EuiTreeListItemComponent,
                        EuiTreeListItemLabelTagDirective,
                        EuiTreeListItemDetailsContentTagDirective,
                        EuiTreeListItemSubContainerContentTagDirective,
                        EuiTreeListItemContentComponent,
                        EuiTreeListToolbarComponent,
                    ],
                    exports: [
                        EuiTreeListComponent,
                        EuiTreeListItemComponent,
                        EuiTreeListItemLabelTagDirective,
                        EuiTreeListItemDetailsContentTagDirective,
                        EuiTreeListItemSubContainerContentTagDirective,
                        EuiTreeListItemContentComponent,
                        EuiTreeListToolbarComponent,
                    ],
                }]
        }] });

const EUI_TREE_LIST = [
    EuiTreeListComponent,
    EuiTreeListItemComponent,
    EuiTreeListItemLabelTagDirective,
    EuiTreeListItemDetailsContentTagDirective,
    EuiTreeListItemSubContainerContentTagDirective,
    EuiTreeListItemContentComponent,
    EuiTreeListToolbarComponent,
];

/**
 * Generated bundle index. Do not edit.
 */

export { EUI_TREE_LIST, EuiTreeListComponent, EuiTreeListItemComponent, EuiTreeListItemContentComponent, EuiTreeListItemDetailsContentTagDirective, EuiTreeListItemLabelTagDirective, EuiTreeListItemSubContainerContentTagDirective, EuiTreeListModule, EuiTreeListToolbarComponent };
//# sourceMappingURL=eui-components-eui-tree-list.mjs.map
