import { ToggleField } from '@masterteam/components/toggle-field';
import { Avatar } from '@masterteam/components/avatar';
import { Button } from '@masterteam/components/button';
import * as i0 from '@angular/core';
import { inject, viewChild, input, model, computed, output, signal, effect, Component } from '@angular/core';
import * as i1 from 'primeng/tree';
import { TreeModule } from 'primeng/tree';
import { Icon } from '@masterteam/icons';
import { CommonModule } from '@angular/common';
import { Directionality } from '@angular/cdk/bidi';
import * as i3 from '@angular/forms';
import { FormsModule } from '@angular/forms';
import * as i4 from 'primeng/contextmenu';
import { ContextMenuModule } from 'primeng/contextmenu';
import { TranslocoService, TranslocoModule } from '@jsverse/transloco';
import * as i2 from 'primeng/api';

class Tree {
    transloco = inject(TranslocoService);
    dir = inject(Directionality, { optional: true });
    primeTree = viewChild('primeTree', ...(ngDevMode ? [{ debugName: "primeTree" }] : []));
    value = input.required(...(ngDevMode ? [{ debugName: "value" }] : []));
    selection = model(...(ngDevMode ? [undefined, { debugName: "selection" }] : []));
    selectionMode = input(...(ngDevMode ? [undefined, { debugName: "selectionMode" }] : []));
    nodeIcon = input(...(ngDevMode ? [undefined, { debugName: "nodeIcon" }] : []));
    propagateSelectionUp = input(false, ...(ngDevMode ? [{ debugName: "propagateSelectionUp" }] : []));
    propagateSelectionDown = input(false, ...(ngDevMode ? [{ debugName: "propagateSelectionDown" }] : []));
    checkAllChildren = input(false, ...(ngDevMode ? [{ debugName: "checkAllChildren" }] : []));
    loading = input(false, ...(ngDevMode ? [{ debugName: "loading" }] : []));
    emptyMessage = input(this.transloco.translate('components.tree.no-data-found'), ...(ngDevMode ? [{ debugName: "emptyMessage" }] : []));
    checkAllLabel = input(this.transloco.translate('components.tree.check-all'), ...(ngDevMode ? [{ debugName: "checkAllLabel" }] : []));
    filterPlaceholder = input(this.transloco.translate('components.tree.search'), ...(ngDevMode ? [{ debugName: "filterPlaceholder" }] : []));
    dataKey = input('key', ...(ngDevMode ? [{ debugName: "dataKey" }] : []));
    filter = input(false, ...(ngDevMode ? [{ debugName: "filter" }] : []));
    filterMode = input('lenient', ...(ngDevMode ? [{ debugName: "filterMode" }] : []));
    styleClass = input('', ...(ngDevMode ? [{ debugName: "styleClass" }] : []));
    style = input(...(ngDevMode ? [undefined, { debugName: "style" }] : []));
    pInputs = input(...(ngDevMode ? [undefined, { debugName: "pInputs" }] : []));
    nodeActions = input([], ...(ngDevMode ? [{ debugName: "nodeActions" }] : []));
    nodeContextmenuActions = input([], ...(ngDevMode ? [{ debugName: "nodeContextmenuActions" }] : []));
    // Context menu state
    contextMenuSelection = model(null, ...(ngDevMode ? [{ debugName: "contextMenuSelection" }] : []));
    contextMenuItems = computed(() => {
        const actions = this.nodeContextmenuActions();
        return actions.map((action) => ({
            label: action.label,
            icon: action.icon,
            command: () => {
                const node = this.contextMenuSelection();
                if (node) {
                    action.action(node);
                }
            },
        }));
    }, ...(ngDevMode ? [{ debugName: "contextMenuItems" }] : []));
    action = output();
    CheckAllValue = signal(false, ...(ngDevMode ? [{ debugName: "CheckAllValue" }] : []));
    // Computed tree value with "Check All" nodes added recursively to all parents
    treeValue = computed(() => {
        const nodes = this.value();
        const shouldAddCheckAll = this.checkAllChildren() && this.selectionMode() === 'checkbox';
        if (!shouldAddCheckAll) {
            return nodes;
        }
        // Recursively add "Check All" child to any parent node
        const addCheckAllRecursive = (node) => {
            if (node.children && node.children.length > 0) {
                const checkAllNode = {
                    key: `${node.key}-check-all`,
                    label: this.checkAllLabel(),
                    icon: 'general.check-square-broken',
                    data: node,
                };
                return {
                    ...node,
                    children: [checkAllNode, ...node.children.map(addCheckAllRecursive)],
                };
            }
            return node;
        };
        // Transform all nodes
        const transformedNodes = nodes.map(addCheckAllRecursive);
        // Add "Check All" for entire tree at the beginning
        const treeCheckAllNode = {
            key: 'tree-check-all',
            label: this.checkAllLabel(),
            icon: 'general.check-square-broken',
            data: { isTreeRoot: true, children: transformedNodes },
        };
        return [treeCheckAllNode, ...transformedNodes];
    }, ...(ngDevMode ? [{ debugName: "treeValue" }] : []));
    constructor() {
        // Apply pInputs to the PrimeNG tree instance
        effect(() => {
            const tree = this.primeTree();
            const inputs = this.pInputs();
            if (tree && inputs) {
                Object.assign(tree, inputs);
            }
        });
        // Sync checked state when selection changes (including initial value)
        effect(() => {
            const value = this.treeValue();
            // Only run if we have nodes and selection
            if (value.length > 0 && this.selectionMode() === 'checkbox') {
                this.handleCheckedNodes();
            }
        });
    }
    isProcessingBatchSelection = signal(false, ...(ngDevMode ? [{ debugName: "isProcessingBatchSelection" }] : []));
    onSelectionChange(event) {
        // Skip emitting if we're in the middle of batch processing
        if (this.isProcessingBatchSelection()) {
            return;
        }
        this.handleCheckedNodes();
        this.action.emit({ action: 'selectionChange', data: event });
    }
    onNodeSelect(event) {
        this.action.emit({ action: 'nodeSelect', data: event });
    }
    onNodeUnselect(event) {
        this.action.emit({ action: 'nodeUnselect', data: event });
    }
    onNodeExpand(event) {
        this.action.emit({ action: 'nodeExpand', data: event });
    }
    onNodeCollapse(event) {
        this.action.emit({ action: 'nodeCollapse', data: event });
    }
    onContextMenuSelect(event) {
        this.contextMenuSelection.set(event);
    }
    getCheckAllValue(event) {
        this.CheckAllValue.set(event);
    }
    toggleNodeSelection(node, event) {
        event.stopPropagation();
        if (node.selectable === false) {
            return;
        }
        const tree = this.primeTree();
        if (this.selectionMode() === 'checkbox' && tree) {
            if (node.key?.includes('check-all') && node.data) {
                const checkValue = this.CheckAllValue() ?? true;
                // Handle parent-level "Check All" - only check immediate children
                const parentNode = node.data;
                // Start batch processing to prevent multiple selection change events
                this.isProcessingBatchSelection.set(true);
                parentNode?.children?.forEach((child) => {
                    if (!child.key?.includes('check-all')) {
                        const isSelected = tree.isSelected(child);
                        // Only toggle if the current state doesn't match desired state
                        if ((checkValue && !isSelected) || (!checkValue && isSelected)) {
                            tree.onNodeClick(event, child);
                        }
                    }
                });
                // End batch processing and emit single selection change event
                this.isProcessingBatchSelection.set(false);
                this.handleCheckedNodes();
                this.action.emit({
                    action: 'selectionChange',
                    data: this.selection(),
                });
            }
            else {
                tree.onNodeClick(event, node);
            }
        }
    }
    handleCheckedNodes() {
        const updateNodeCheckedState = (nodes) => {
            const tree = this.primeTree();
            nodes.forEach((node) => {
                if (node.key?.includes('check-all')) {
                    const isAllChildrenSelected = !nodes?.filter((n) => !tree?.isSelected(n) && !n.key?.includes('check-all'))?.length;
                    node.checked = isAllChildrenSelected;
                }
                else {
                    node.checked = tree?.isSelected(node);
                }
                if (node.children) {
                    updateNodeCheckedState(node.children);
                }
            });
        };
        updateNodeCheckedState(this.treeValue());
    }
    resolveActionLoading(action, node) {
        if (typeof action.loading === 'function') {
            return action.loading(node);
        }
        return action.loading;
    }
    nodeAction(action, node) {
        action.action(node);
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: Tree, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: Tree, isStandalone: true, selector: "mt-tree", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, nodeIcon: { classPropertyName: "nodeIcon", publicName: "nodeIcon", isSignal: true, isRequired: false, transformFunction: null }, propagateSelectionUp: { classPropertyName: "propagateSelectionUp", publicName: "propagateSelectionUp", isSignal: true, isRequired: false, transformFunction: null }, propagateSelectionDown: { classPropertyName: "propagateSelectionDown", publicName: "propagateSelectionDown", isSignal: true, isRequired: false, transformFunction: null }, checkAllChildren: { classPropertyName: "checkAllChildren", publicName: "checkAllChildren", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null }, checkAllLabel: { classPropertyName: "checkAllLabel", publicName: "checkAllLabel", isSignal: true, isRequired: false, transformFunction: null }, filterPlaceholder: { classPropertyName: "filterPlaceholder", publicName: "filterPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, dataKey: { classPropertyName: "dataKey", publicName: "dataKey", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, filterMode: { classPropertyName: "filterMode", publicName: "filterMode", isSignal: true, isRequired: false, transformFunction: null }, styleClass: { classPropertyName: "styleClass", publicName: "styleClass", isSignal: true, isRequired: false, transformFunction: null }, style: { classPropertyName: "style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null }, pInputs: { classPropertyName: "pInputs", publicName: "pInputs", isSignal: true, isRequired: false, transformFunction: null }, nodeActions: { classPropertyName: "nodeActions", publicName: "nodeActions", isSignal: true, isRequired: false, transformFunction: null }, nodeContextmenuActions: { classPropertyName: "nodeContextmenuActions", publicName: "nodeContextmenuActions", isSignal: true, isRequired: false, transformFunction: null }, contextMenuSelection: { classPropertyName: "contextMenuSelection", publicName: "contextMenuSelection", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selection: "selectionChange", contextMenuSelection: "contextMenuSelectionChange", action: "action" }, viewQueries: [{ propertyName: "primeTree", first: true, predicate: ["primeTree"], descendants: true, isSignal: true }], ngImport: i0, template: "<p-tree\r\n  #primeTree\r\n  [value]=\"treeValue()\"\r\n  [(selection)]=\"selection\"\r\n  [selectionMode]=\"selectionMode()\"\r\n  [propagateSelectionUp]=\"propagateSelectionUp()\"\r\n  [propagateSelectionDown]=\"propagateSelectionDown()\"\r\n  [loading]=\"loading()\"\r\n  [emptyMessage]=\"emptyMessage()\"\r\n  [filter]=\"filter()\"\r\n  [filterMode]=\"filterMode()\"\r\n  [filterPlaceholder]=\"filterPlaceholder()\"\r\n  [styleClass]=\"'mt-tree ' + styleClass()\"\r\n  [style]=\"style()\"\r\n  [contextMenu]=\"contextMenuItems().length ? cm : null\"\r\n  [(contextMenuSelection)]=\"contextMenuSelection\"\r\n  contextMenuSelectionMode=\"separate\"\r\n  (selectionChange)=\"onSelectionChange($event)\"\r\n  (onNodeSelect)=\"onNodeSelect($event)\"\r\n  (onNodeUnselect)=\"onNodeUnselect($event)\"\r\n  (onNodeExpand)=\"onNodeExpand($event)\"\r\n  (onNodeCollapse)=\"onNodeCollapse($event)\"\r\n  (onNodeContextMenuSelect)=\"onContextMenuSelect($event.node)\"\r\n>\r\n  <ng-template let-node pTemplate=\"default\">\r\n    <div\r\n      (click)=\"selectionMode() === 'checkbox' ? $event.stopPropagation() : null\"\r\n      class=\"mt-tree-node border-1 border-gray-300 cursor-default rounded-lg flex items-center hover:bg-surface-100 justify-between\"\r\n      [class]=\"node?.key.includes('check-all') ? 'bg-surface-100 ' : ''\"\r\n    >\r\n      <div\r\n        class=\"px-3 flex items-center justify-between flex-1\"\r\n        [class.cursor-pointer]=\"\r\n          selectionMode() === 'single' || selectionMode() === 'multiple'\r\n        \"\r\n      >\r\n        <div class=\"flex items-center\">\r\n          @if (node.children && node.children.length > 0) {\r\n            <div\r\n              class=\"py-3\"\r\n              (click)=\"node.expanded = !node.expanded; $event.stopPropagation()\"\r\n            >\r\n              <mt-icon\r\n                class=\"text-2xl cursor-pointer\"\r\n                [icon]=\"\r\n                  node.expanded\r\n                    ? 'arrow.chevron-down'\r\n                    : dir?.value === 'rtl'\r\n                      ? 'arrow.chevron-left'\r\n                      : 'arrow.chevron-right'\r\n                \"\r\n              />\r\n            </div>\r\n          }\r\n          @if (node.icon || nodeIcon()) {\r\n            <mt-avatar\r\n              class=\"ms-2\"\r\n              [icon]=\"node.icon || nodeIcon()\"\r\n              shape=\"square\"\r\n              size=\"small\"\r\n              style=\"\r\n                --p-avatar-background: var(--p-primary-50);\r\n                --p-avatar-color: var(--p-primary-color);\r\n              \"\r\n              [style]=\"\r\n                node?.key.includes('check-all')\r\n                  ? ' --p-avatar-background: var(--p-primary-color); --p-avatar-color: white'\r\n                  : ''\r\n              \"\r\n            >\r\n            </mt-avatar>\r\n          }\r\n          <div class=\"text-md mx-3 py-4\">{{ node.label }}</div>\r\n        </div>\r\n        <div class=\"flex items-center gap-2\">\r\n          @if (nodeActions().length > 0) {\r\n            <div class=\"flex items-center\">\r\n              @for (action of nodeActions(); track action.icon) {\r\n                @let hidden = action.hidden?.(node);\r\n                @if (!hidden) {\r\n                  <mt-button\r\n                    [variant]=\"action.variant\"\r\n                    [icon]=\"action.icon\"\r\n                    [severity]=\"action.severity\"\r\n                    [size]=\"action.size\"\r\n                    [label]=\"action.label\"\r\n                    [tooltip]=\"action.tooltip\"\r\n                    [loading]=\"resolveActionLoading(action, node)\"\r\n                    (click)=\"nodeAction(action, node)\"\r\n                  >\r\n                  </mt-button>\r\n                }\r\n              }\r\n            </div>\r\n          }\r\n        </div>\r\n      </div>\r\n      @if (selectionMode() === \"checkbox\") {\r\n        <div\r\n          class=\"me-3\"\r\n          [class.cursor-pointer]=\"node.selectable !== false\"\r\n          (click)=\"toggleNodeSelection(node, $event)\"\r\n        >\r\n          <mt-toggle-field\r\n            (ngModelChange)=\"getCheckAllValue($event)\"\r\n            [ngModel]=\"node.checked\"\r\n            [disabled]=\"node.selectable === false\"\r\n          />\r\n        </div>\r\n      }\r\n    </div>\r\n  </ng-template>\r\n</p-tree>\r\n\r\n<p-contextMenu #cm [model]=\"contextMenuItems()\" appendTo=\"body\">\r\n  <ng-template pTemplate=\"item\" let-item>\r\n    <div class=\"p-menu-item-content\" (click)=\"item.command()\">\r\n      <a class=\"p-menu-item-link flex items-center gap-2\">\r\n        @if (item.icon) {\r\n          <mt-icon [icon]=\"item.icon\" class=\"text-lg\" />\r\n        }\r\n        <span class=\"p-menu-item-label\">{{ item.label }}</span>\r\n      </a>\r\n    </div>\r\n  </ng-template>\r\n</p-contextMenu>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: TreeModule }, { kind: "component", type: i1.Tree, selector: "p-tree", inputs: ["value", "selectionMode", "loadingMode", "selection", "styleClass", "contextMenu", "contextMenuSelectionMode", "contextMenuSelection", "draggableScope", "droppableScope", "draggableNodes", "droppableNodes", "metaKeySelection", "propagateSelectionUp", "propagateSelectionDown", "loading", "loadingIcon", "emptyMessage", "ariaLabel", "togglerAriaLabel", "ariaLabelledBy", "validateDrop", "filter", "filterInputAutoFocus", "filterBy", "filterMode", "filterOptions", "filterPlaceholder", "filteredNodes", "filterLocale", "scrollHeight", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "indentation", "_templateMap", "trackBy", "highlightOnSelect"], outputs: ["selectionChange", "contextMenuSelectionChange", "onNodeSelect", "onNodeUnselect", "onNodeExpand", "onNodeCollapse", "onNodeContextMenuSelect", "onNodeDoubleClick", "onNodeDrop", "onLazyLoad", "onScroll", "onScrollIndexChange", "onFilter"] }, { kind: "directive", type: i2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "ngmodule", type: CommonModule }, { kind: "component", type: Avatar, selector: "mt-avatar", inputs: ["label", "icon", "image", "styleClass", "size", "shape", "badge", "badgeSize", "badgeSeverity"], outputs: ["onImageError"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: ToggleField, selector: "mt-toggle-field", inputs: ["label", "labelPosition", "placeholder", "readonly", "pInputs", "required", "toggleShape", "size", "icon", "descriptionCard"], outputs: ["onChange"] }, { kind: "ngmodule", type: ContextMenuModule }, { kind: "component", type: i4.ContextMenu, selector: "p-contextMenu, p-contextmenu, p-context-menu", inputs: ["model", "triggerEvent", "target", "global", "style", "styleClass", "autoZIndex", "baseZIndex", "id", "breakpoint", "ariaLabel", "ariaLabelledBy", "pressDelay", "appendTo", "motionOptions"], outputs: ["onShow", "onHide"] }, { kind: "ngmodule", type: TranslocoModule }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: Tree, decorators: [{
            type: Component,
            args: [{ selector: 'mt-tree', standalone: true, imports: [
                        TreeModule,
                        Icon,
                        CommonModule,
                        Avatar,
                        Button,
                        FormsModule,
                        ToggleField,
                        ContextMenuModule,
                        TranslocoModule,
                    ], template: "<p-tree\r\n  #primeTree\r\n  [value]=\"treeValue()\"\r\n  [(selection)]=\"selection\"\r\n  [selectionMode]=\"selectionMode()\"\r\n  [propagateSelectionUp]=\"propagateSelectionUp()\"\r\n  [propagateSelectionDown]=\"propagateSelectionDown()\"\r\n  [loading]=\"loading()\"\r\n  [emptyMessage]=\"emptyMessage()\"\r\n  [filter]=\"filter()\"\r\n  [filterMode]=\"filterMode()\"\r\n  [filterPlaceholder]=\"filterPlaceholder()\"\r\n  [styleClass]=\"'mt-tree ' + styleClass()\"\r\n  [style]=\"style()\"\r\n  [contextMenu]=\"contextMenuItems().length ? cm : null\"\r\n  [(contextMenuSelection)]=\"contextMenuSelection\"\r\n  contextMenuSelectionMode=\"separate\"\r\n  (selectionChange)=\"onSelectionChange($event)\"\r\n  (onNodeSelect)=\"onNodeSelect($event)\"\r\n  (onNodeUnselect)=\"onNodeUnselect($event)\"\r\n  (onNodeExpand)=\"onNodeExpand($event)\"\r\n  (onNodeCollapse)=\"onNodeCollapse($event)\"\r\n  (onNodeContextMenuSelect)=\"onContextMenuSelect($event.node)\"\r\n>\r\n  <ng-template let-node pTemplate=\"default\">\r\n    <div\r\n      (click)=\"selectionMode() === 'checkbox' ? $event.stopPropagation() : null\"\r\n      class=\"mt-tree-node border-1 border-gray-300 cursor-default rounded-lg flex items-center hover:bg-surface-100 justify-between\"\r\n      [class]=\"node?.key.includes('check-all') ? 'bg-surface-100 ' : ''\"\r\n    >\r\n      <div\r\n        class=\"px-3 flex items-center justify-between flex-1\"\r\n        [class.cursor-pointer]=\"\r\n          selectionMode() === 'single' || selectionMode() === 'multiple'\r\n        \"\r\n      >\r\n        <div class=\"flex items-center\">\r\n          @if (node.children && node.children.length > 0) {\r\n            <div\r\n              class=\"py-3\"\r\n              (click)=\"node.expanded = !node.expanded; $event.stopPropagation()\"\r\n            >\r\n              <mt-icon\r\n                class=\"text-2xl cursor-pointer\"\r\n                [icon]=\"\r\n                  node.expanded\r\n                    ? 'arrow.chevron-down'\r\n                    : dir?.value === 'rtl'\r\n                      ? 'arrow.chevron-left'\r\n                      : 'arrow.chevron-right'\r\n                \"\r\n              />\r\n            </div>\r\n          }\r\n          @if (node.icon || nodeIcon()) {\r\n            <mt-avatar\r\n              class=\"ms-2\"\r\n              [icon]=\"node.icon || nodeIcon()\"\r\n              shape=\"square\"\r\n              size=\"small\"\r\n              style=\"\r\n                --p-avatar-background: var(--p-primary-50);\r\n                --p-avatar-color: var(--p-primary-color);\r\n              \"\r\n              [style]=\"\r\n                node?.key.includes('check-all')\r\n                  ? ' --p-avatar-background: var(--p-primary-color); --p-avatar-color: white'\r\n                  : ''\r\n              \"\r\n            >\r\n            </mt-avatar>\r\n          }\r\n          <div class=\"text-md mx-3 py-4\">{{ node.label }}</div>\r\n        </div>\r\n        <div class=\"flex items-center gap-2\">\r\n          @if (nodeActions().length > 0) {\r\n            <div class=\"flex items-center\">\r\n              @for (action of nodeActions(); track action.icon) {\r\n                @let hidden = action.hidden?.(node);\r\n                @if (!hidden) {\r\n                  <mt-button\r\n                    [variant]=\"action.variant\"\r\n                    [icon]=\"action.icon\"\r\n                    [severity]=\"action.severity\"\r\n                    [size]=\"action.size\"\r\n                    [label]=\"action.label\"\r\n                    [tooltip]=\"action.tooltip\"\r\n                    [loading]=\"resolveActionLoading(action, node)\"\r\n                    (click)=\"nodeAction(action, node)\"\r\n                  >\r\n                  </mt-button>\r\n                }\r\n              }\r\n            </div>\r\n          }\r\n        </div>\r\n      </div>\r\n      @if (selectionMode() === \"checkbox\") {\r\n        <div\r\n          class=\"me-3\"\r\n          [class.cursor-pointer]=\"node.selectable !== false\"\r\n          (click)=\"toggleNodeSelection(node, $event)\"\r\n        >\r\n          <mt-toggle-field\r\n            (ngModelChange)=\"getCheckAllValue($event)\"\r\n            [ngModel]=\"node.checked\"\r\n            [disabled]=\"node.selectable === false\"\r\n          />\r\n        </div>\r\n      }\r\n    </div>\r\n  </ng-template>\r\n</p-tree>\r\n\r\n<p-contextMenu #cm [model]=\"contextMenuItems()\" appendTo=\"body\">\r\n  <ng-template pTemplate=\"item\" let-item>\r\n    <div class=\"p-menu-item-content\" (click)=\"item.command()\">\r\n      <a class=\"p-menu-item-link flex items-center gap-2\">\r\n        @if (item.icon) {\r\n          <mt-icon [icon]=\"item.icon\" class=\"text-lg\" />\r\n        }\r\n        <span class=\"p-menu-item-label\">{{ item.label }}</span>\r\n      </a>\r\n    </div>\r\n  </ng-template>\r\n</p-contextMenu>\r\n" }]
        }], ctorParameters: () => [], propDecorators: { primeTree: [{ type: i0.ViewChild, args: ['primeTree', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }, { type: i0.Output, args: ["selectionChange"] }], selectionMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectionMode", required: false }] }], nodeIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "nodeIcon", required: false }] }], propagateSelectionUp: [{ type: i0.Input, args: [{ isSignal: true, alias: "propagateSelectionUp", required: false }] }], propagateSelectionDown: [{ type: i0.Input, args: [{ isSignal: true, alias: "propagateSelectionDown", required: false }] }], checkAllChildren: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkAllChildren", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }], checkAllLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkAllLabel", required: false }] }], filterPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterPlaceholder", required: false }] }], dataKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "dataKey", required: false }] }], filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: false }] }], filterMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterMode", required: false }] }], styleClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "styleClass", required: false }] }], style: [{ type: i0.Input, args: [{ isSignal: true, alias: "style", required: false }] }], pInputs: [{ type: i0.Input, args: [{ isSignal: true, alias: "pInputs", required: false }] }], nodeActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "nodeActions", required: false }] }], nodeContextmenuActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "nodeContextmenuActions", required: false }] }], contextMenuSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "contextMenuSelection", required: false }] }, { type: i0.Output, args: ["contextMenuSelectionChange"] }], action: [{ type: i0.Output, args: ["action"] }] } });

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

export { Tree };
//# sourceMappingURL=masterteam-components-tree.mjs.map
