import { Component, Output, EventEmitter } from '@angular/core';
import { RunView, LogError } from '@memberjunction/core';
import { Subject, BehaviorSubject, combineLatest } from 'rxjs';
import { debounceTime, takeUntil, distinctUntilChanged } from 'rxjs/operators';
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@angular/forms";
import * as i3 from "@memberjunction/ng-ui-components";
import * as i4 from "@memberjunction/ng-shared-generic";
const _c0 = a0 => ({ nodes: a0 });
const _forTrack0 = ($index, $item) => $item.category.ID;
const _forTrack1 = ($index, $item) => $item.ID;
function ActionsListViewComponent_Conditional_18_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtext(0, " All Categories ");
} }
function ActionsListViewComponent_Conditional_19_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtext(0);
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵtextInterpolate1(" ", ctx_r0.getCategoryName(ctx_r0.selectedCategory$.value), " ");
} }
function ActionsListViewComponent_Conditional_22_ng_container_13_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainer(0);
} }
function ActionsListViewComponent_Conditional_22_ng_template_14_For_1_Conditional_2_Conditional_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 34);
} }
function ActionsListViewComponent_Conditional_22_ng_template_14_For_1_Conditional_2_Conditional_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 35);
} }
function ActionsListViewComponent_Conditional_22_ng_template_14_For_1_Conditional_2_Template(rf, ctx) { if (rf & 1) {
    const _r5 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 33);
    i0.ɵɵlistener("click", function ActionsListViewComponent_Conditional_22_ng_template_14_For_1_Conditional_2_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r5); const node_r4 = i0.ɵɵnextContext().$implicit; const ctx_r0 = i0.ɵɵnextContext(3); ctx_r0.toggleCategoryExpanded(node_r4.category.ID); return i0.ɵɵresetView($event.stopPropagation()); });
    i0.ɵɵconditionalCreate(1, ActionsListViewComponent_Conditional_22_ng_template_14_For_1_Conditional_2_Conditional_1_Template, 1, 0, "i", 34)(2, ActionsListViewComponent_Conditional_22_ng_template_14_For_1_Conditional_2_Conditional_2_Template, 1, 0, "i", 35);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const node_r4 = i0.ɵɵnextContext().$implicit;
    const ctx_r0 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r0.isCategoryExpanded(node_r4.category.ID) ? 1 : 2);
} }
function ActionsListViewComponent_Conditional_22_ng_template_14_For_1_Conditional_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "span", 31);
} }
function ActionsListViewComponent_Conditional_22_ng_template_14_For_1_Conditional_8_ng_container_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainer(0);
} }
function ActionsListViewComponent_Conditional_22_ng_template_14_For_1_Conditional_8_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtemplate(0, ActionsListViewComponent_Conditional_22_ng_template_14_For_1_Conditional_8_ng_container_0_Template, 1, 0, "ng-container", 26);
} if (rf & 2) {
    const node_r4 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵnextContext(2);
    const categoryTreeTemplate_r6 = i0.ɵɵreference(15);
    i0.ɵɵproperty("ngTemplateOutlet", categoryTreeTemplate_r6)("ngTemplateOutletContext", i0.ɵɵpureFunction1(2, _c0, node_r4.children));
} }
function ActionsListViewComponent_Conditional_22_ng_template_14_For_1_Template(rf, ctx) { if (rf & 1) {
    const _r3 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 28)(1, "button", 29);
    i0.ɵɵlistener("click", function ActionsListViewComponent_Conditional_22_ng_template_14_For_1_Template_button_click_1_listener() { const node_r4 = i0.ɵɵrestoreView(_r3).$implicit; const ctx_r0 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r0.selectCategory(node_r4.category.ID)); });
    i0.ɵɵconditionalCreate(2, ActionsListViewComponent_Conditional_22_ng_template_14_For_1_Conditional_2_Template, 3, 1, "button", 30)(3, ActionsListViewComponent_Conditional_22_ng_template_14_For_1_Conditional_3_Template, 1, 0, "span", 31);
    i0.ɵɵelement(4, "i", 32);
    i0.ɵɵtext(5);
    i0.ɵɵelementStart(6, "span", 15);
    i0.ɵɵtext(7);
    i0.ɵɵelementEnd()();
    i0.ɵɵconditionalCreate(8, ActionsListViewComponent_Conditional_22_ng_template_14_For_1_Conditional_8_Template, 1, 4, "ng-container");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const node_r4 = ctx.$implicit;
    const ctx_r0 = i0.ɵɵnextContext(3);
    i0.ɵɵstyleProp("padding-left", node_r4.level * 20, "px");
    i0.ɵɵadvance();
    i0.ɵɵclassProp("selected", ctx_r0.selectedCategory$.value === node_r4.category.ID);
    i0.ɵɵadvance();
    i0.ɵɵconditional(node_r4.children.length > 0 ? 2 : 3);
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate1(" ", node_r4.category.Name, " ");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r0.getCategoryActionCount(node_r4.category.ID));
    i0.ɵɵadvance();
    i0.ɵɵconditional(node_r4.children.length > 0 && ctx_r0.isCategoryExpanded(node_r4.category.ID) ? 8 : -1);
} }
function ActionsListViewComponent_Conditional_22_ng_template_14_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵrepeaterCreate(0, ActionsListViewComponent_Conditional_22_ng_template_14_For_1_Template, 9, 8, "div", 27, _forTrack0);
} if (rf & 2) {
    const nodes_r7 = ctx.nodes;
    i0.ɵɵrepeater(nodes_r7);
} }
function ActionsListViewComponent_Conditional_22_Template(rf, ctx) { if (rf & 1) {
    const _r2 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 16)(1, "div", 20)(2, "h3");
    i0.ɵɵtext(3, "Select Category");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "button", 21);
    i0.ɵɵlistener("click", function ActionsListViewComponent_Conditional_22_Template_button_click_4_listener() { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.toggleCategoryTree()); });
    i0.ɵɵelement(5, "i", 22);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(6, "div", 23)(7, "button", 21);
    i0.ɵɵlistener("click", function ActionsListViewComponent_Conditional_22_Template_button_click_7_listener() { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.selectCategory("all")); });
    i0.ɵɵelement(8, "i", 24);
    i0.ɵɵtext(9, " All Categories ");
    i0.ɵɵelementStart(10, "span", 15);
    i0.ɵɵtext(11);
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(12, "div", 25);
    i0.ɵɵtemplate(13, ActionsListViewComponent_Conditional_22_ng_container_13_Template, 1, 0, "ng-container", 26);
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(14, ActionsListViewComponent_Conditional_22_ng_template_14_Template, 2, 0, "ng-template", null, 0, i0.ɵɵtemplateRefExtractor);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const categoryTreeTemplate_r6 = i0.ɵɵreference(15);
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance(7);
    i0.ɵɵclassProp("selected", ctx_r0.selectedCategory$.value === "all");
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate(ctx_r0.actions.length);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngTemplateOutlet", categoryTreeTemplate_r6)("ngTemplateOutletContext", i0.ɵɵpureFunction1(5, _c0, ctx_r0.categoryTree));
} }
function ActionsListViewComponent_Conditional_24_For_1_Conditional_10_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 44);
    i0.ɵɵelement(1, "i", 51);
    i0.ɵɵtext(2, " AI Generated ");
    i0.ɵɵelementEnd();
} }
function ActionsListViewComponent_Conditional_24_For_1_Conditional_18_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 47);
    i0.ɵɵelement(1, "i", 52);
    i0.ɵɵelementStart(2, "span");
    i0.ɵɵtext(3);
    i0.ɵɵpipe(4, "date");
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const action_r9 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate1("Updated ", i0.ɵɵpipeBind2(4, 1, action_r9.__mj_UpdatedAt, "MMM d, yyyy"));
} }
function ActionsListViewComponent_Conditional_24_For_1_Conditional_19_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 47);
    i0.ɵɵelement(1, "i", 53);
    i0.ɵɵelementStart(2, "span");
    i0.ɵɵtext(3);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const action_r9 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(action_r9.CodeApprovalStatus);
} }
function ActionsListViewComponent_Conditional_24_For_1_Template(rf, ctx) { if (rf & 1) {
    const _r8 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 37);
    i0.ɵɵlistener("click", function ActionsListViewComponent_Conditional_24_For_1_Template_div_click_0_listener() { const action_r9 = i0.ɵɵrestoreView(_r8).$implicit; const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.openAction(action_r9)); });
    i0.ɵɵelementStart(1, "div", 38);
    i0.ɵɵelement(2, "i");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "div", 39)(4, "div", 40)(5, "h3", 41);
    i0.ɵɵtext(6);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(7, "div", 42)(8, "span", 43);
    i0.ɵɵtext(9);
    i0.ɵɵelementEnd();
    i0.ɵɵconditionalCreate(10, ActionsListViewComponent_Conditional_24_For_1_Conditional_10_Template, 3, 0, "span", 44);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(11, "div", 45);
    i0.ɵɵtext(12);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(13, "div", 46)(14, "div", 47);
    i0.ɵɵelement(15, "i", 32);
    i0.ɵɵelementStart(16, "span");
    i0.ɵɵtext(17);
    i0.ɵɵelementEnd()();
    i0.ɵɵconditionalCreate(18, ActionsListViewComponent_Conditional_24_For_1_Conditional_18_Template, 5, 4, "div", 47);
    i0.ɵɵconditionalCreate(19, ActionsListViewComponent_Conditional_24_For_1_Conditional_19_Template, 4, 1, "div", 47);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(20, "div", 48)(21, "button", 49);
    i0.ɵɵlistener("click", function ActionsListViewComponent_Conditional_24_For_1_Template_button_click_21_listener($event) { i0.ɵɵrestoreView(_r8); return i0.ɵɵresetView($event.stopPropagation()); });
    i0.ɵɵelement(22, "i", 50);
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const action_r9 = ctx.$implicit;
    const ctx_r0 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(2);
    i0.ɵɵclassMap(ctx_r0.getActionIcon(action_r9));
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate(action_r9.Name);
    i0.ɵɵadvance(2);
    i0.ɵɵattribute("data-color", ctx_r0.getStatusColor(action_r9.Status));
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", action_r9.Status, " ");
    i0.ɵɵadvance();
    i0.ɵɵconditional(action_r9.Type === "Generated" ? 10 : -1);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", action_r9.Description || "No description available", " ");
    i0.ɵɵadvance(5);
    i0.ɵɵtextInterpolate(ctx_r0.getCategoryName(action_r9.CategoryID));
    i0.ɵɵadvance();
    i0.ɵɵconditional(action_r9.__mj_UpdatedAt ? 18 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(action_r9.CodeApprovalStatus && action_r9.Type === "Generated" ? 19 : -1);
} }
function ActionsListViewComponent_Conditional_24_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵrepeaterCreate(0, ActionsListViewComponent_Conditional_24_For_1_Template, 23, 10, "div", 36, _forTrack1);
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵrepeater(ctx_r0.filteredActions);
} }
function ActionsListViewComponent_Conditional_25_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mj-empty-state", 18);
} }
function ActionsListViewComponent_Conditional_26_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 19);
    i0.ɵɵelement(1, "mj-loading", 54);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    i0.ɵɵadvance();
    i0.ɵɵproperty("showText", false);
} }
export class ActionsListViewComponent extends BaseAngularComponent {
    openEntityRecord = new EventEmitter();
    isLoading = true;
    actions = [];
    filteredActions = [];
    categories = new Map();
    categoryTree = [];
    categoryDescendants = new Map();
    searchTerm$ = new BehaviorSubject('');
    selectedStatus$ = new BehaviorSubject('all');
    selectedType$ = new BehaviorSubject('all');
    selectedCategory$ = new BehaviorSubject('all');
    expandedCategories = new Set();
    statusOptions = [
        { text: 'All Statuses', value: 'all' },
        { text: 'Active', value: 'Active' },
        { text: 'Pending', value: 'Pending' },
        { text: 'Disabled', value: 'Disabled' }
    ];
    typeOptions = [
        { text: 'All Types', value: 'all' },
        { text: 'AI Generated', value: 'Generated' },
        { text: 'Custom', value: 'Custom' }
    ];
    categoryOptions = [
        { text: 'All Categories', value: 'all' }
    ];
    destroy$ = new Subject();
    constructor() { super(); }
    ngOnInit() {
        this.setupFilters();
        this.loadData();
    }
    ngOnDestroy() {
        this.destroy$.next();
        this.destroy$.complete();
    }
    setupFilters() {
        combineLatest([
            this.searchTerm$.pipe(debounceTime(300), distinctUntilChanged()),
            this.selectedStatus$.pipe(distinctUntilChanged()),
            this.selectedType$.pipe(distinctUntilChanged()),
            this.selectedCategory$.pipe(distinctUntilChanged())
        ]).pipe(takeUntil(this.destroy$)).subscribe(() => {
            this.applyFilters();
        });
    }
    async loadData() {
        try {
            this.isLoading = true;
            const rv = RunView.FromMetadataProvider(this.ProviderToUse);
            const [actionsResult, categoriesResult] = await rv.RunViews([
                {
                    EntityName: 'MJ: Actions',
                    OrderBy: 'Name'
                },
                {
                    EntityName: 'MJ: Action Categories',
                    OrderBy: 'Name'
                }
            ]);
            if (!actionsResult.Success || !categoriesResult.Success) {
                const errors = [];
                if (!actionsResult.Success)
                    errors.push('Actions: ' + actionsResult.ErrorMessage);
                if (!categoriesResult.Success)
                    errors.push('Categories: ' + categoriesResult.ErrorMessage);
                throw new Error('Failed to load data: ' + errors.join(', '));
            }
            const actions = (actionsResult.Results || []);
            const categories = (categoriesResult.Results || []);
            this.actions = actions;
            this.populateCategoriesMap(categories);
            this.buildCategoryOptions(categories);
            this.applyFilters();
        }
        catch (error) {
            console.error('Error loading actions list data:', error);
            LogError('Failed to load actions list data', undefined, error);
        }
        finally {
            this.isLoading = false;
        }
    }
    populateCategoriesMap(categories) {
        this.categories.clear();
        categories.forEach(category => {
            this.categories.set(category.ID, category);
        });
        // Build the category tree
        this.buildCategoryTree(categories);
        // Build descendant mapping for efficient filtering
        this.buildDescendantMapping(categories);
    }
    buildCategoryOptions(categories) {
        this.categoryOptions = [
            { text: 'All Categories', value: 'all' },
            ...categories.map(category => ({
                text: category.Name,
                value: category.ID
            }))
        ];
    }
    buildCategoryTree(categories) {
        const categoryMap = new Map();
        // First pass: create all nodes
        categories.forEach(category => {
            categoryMap.set(category.ID, {
                category,
                children: [],
                level: 0
            });
        });
        // Second pass: build tree structure
        const rootNodes = [];
        categoryMap.forEach(node => {
            const parentId = node.category.ParentID;
            if (parentId && categoryMap.has(parentId)) {
                const parent = categoryMap.get(parentId);
                parent.children.push(node);
                node.level = parent.level + 1;
            }
            else {
                rootNodes.push(node);
            }
        });
        // Sort children at each level by name
        const sortChildren = (nodes) => {
            nodes.sort((a, b) => a.category.Name.localeCompare(b.category.Name));
            nodes.forEach(node => sortChildren(node.children));
        };
        sortChildren(rootNodes);
        this.categoryTree = rootNodes;
    }
    buildDescendantMapping(categories) {
        this.categoryDescendants.clear();
        // Initialize each category with itself
        categories.forEach(category => {
            this.categoryDescendants.set(category.ID, new Set([category.ID]));
        });
        // Build descendant sets
        const addDescendants = (categoryId, descendantId) => {
            const descendants = this.categoryDescendants.get(categoryId);
            if (descendants) {
                descendants.add(descendantId);
            }
        };
        categories.forEach(category => {
            if (category.ParentID) {
                // Add this category as a descendant of all its ancestors
                let currentParentId = category.ParentID;
                while (currentParentId) {
                    addDescendants(currentParentId, category.ID);
                    const parent = this.categories.get(currentParentId);
                    currentParentId = parent?.ParentID || null;
                }
            }
        });
    }
    applyFilters() {
        let filtered = [...this.actions];
        // Apply search filter
        const searchTerm = this.searchTerm$.value.toLowerCase();
        if (searchTerm) {
            filtered = filtered.filter(action => action.Name.toLowerCase().includes(searchTerm) ||
                (action.Description || '').toLowerCase().includes(searchTerm));
        }
        // Apply status filter
        const status = this.selectedStatus$.value;
        if (status !== 'all') {
            filtered = filtered.filter(action => action.Status === status);
        }
        // Apply type filter
        const type = this.selectedType$.value;
        if (type !== 'all') {
            filtered = filtered.filter(action => action.Type === type);
        }
        // Apply category filter (includes descendants)
        const categoryId = this.selectedCategory$.value;
        if (categoryId !== 'all') {
            const descendantIds = this.categoryDescendants.get(categoryId);
            if (descendantIds) {
                // Filter actions that belong to the selected category or any of its descendants
                filtered = filtered.filter(action => action.CategoryID && descendantIds.has(action.CategoryID));
            }
            else {
                console.warn(`Category ID ${categoryId} not found in category hierarchy`);
                filtered = [];
            }
        }
        this.filteredActions = filtered;
    }
    onSearchChange(searchTerm) {
        this.searchTerm$.next(searchTerm);
    }
    onStatusFilterChange(status) {
        this.selectedStatus$.next(status);
    }
    onTypeFilterChange(type) {
        this.selectedType$.next(type);
    }
    onCategoryFilterChange(categoryId) {
        this.selectedCategory$.next(categoryId);
    }
    openAction(action) {
        this.openEntityRecord.emit({
            entityName: 'MJ: Actions',
            recordId: action.ID
        });
    }
    getCategoryName(categoryId) {
        if (!categoryId)
            return 'No Category';
        return this.categories.get(categoryId)?.Name || 'Unknown Category';
    }
    getStatusColor(status) {
        switch (status) {
            case 'Active': return 'success';
            case 'Pending': return 'warning';
            case 'Disabled': return 'error';
            default: return 'info';
        }
    }
    getTypeIcon(type) {
        switch (type) {
            case 'Generated': return 'fa-solid fa-robot';
            case 'Custom': return 'fa-solid fa-code';
            default: return 'fa-solid fa-cog';
        }
    }
    /**
     * Gets the icon class for an action
     * Falls back to type-based icon if no IconClass is set
     */
    getActionIcon(action) {
        return action?.IconClass || this.getTypeIcon(action.Type);
    }
    // Tree view methods
    toggleCategoryExpanded(categoryId) {
        if (this.expandedCategories.has(categoryId)) {
            this.expandedCategories.delete(categoryId);
        }
        else {
            this.expandedCategories.add(categoryId);
        }
    }
    isCategoryExpanded(categoryId) {
        return this.expandedCategories.has(categoryId);
    }
    selectCategory(categoryId) {
        this.selectedCategory$.next(categoryId);
    }
    getCategoryActionCount(categoryId) {
        const descendantIds = this.categoryDescendants.get(categoryId);
        if (!descendantIds)
            return 0;
        return this.actions.filter(action => action.CategoryID && descendantIds.has(action.CategoryID)).length;
    }
    showCategoryTree = false;
    toggleCategoryTree() {
        this.showCategoryTree = !this.showCategoryTree;
    }
    static ɵfac = function ActionsListViewComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ActionsListViewComponent)(); };
    static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ActionsListViewComponent, selectors: [["mj-actions-list-view"]], outputs: { openEntityRecord: "openEntityRecord" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 27, vars: 14, consts: [["categoryTreeTemplate", ""], [1, "actions-list-view"], [1, "list-header"], [1, "header-title"], [1, "fa-solid", "fa-cogs"], [1, "results-count"], [1, "filters-row"], [1, "search-container"], [1, "search-input-wrapper"], [1, "fa-solid", "fa-search", "search-icon"], ["type", "text", "placeholder", "Search actions...", 1, "mj-input", 3, "input", "value"], [1, "filter-group"], ["TextField", "text", "ValueField", "value", 3, "ValueChange", "Data", "ValuePrimitive", "ngModel"], ["mjButton", "", "variant", "outline", 1, "category-filter-button", 3, "click"], [1, "fa-solid", "fa-folder-tree"], [1, "badge"], [1, "category-tree-panel"], [1, "actions-list"], ["Variant", "no-results", "Title", "No actions found", "Message", "Try adjusting your search or filter criteria"], [1, "loading-overlay"], [1, "tree-header"], ["mjButton", "", "variant", "flat", "size", "sm", 3, "click"], [1, "fa-solid", "fa-times"], [1, "tree-actions"], [1, "fa-solid", "fa-folder-open"], [1, "tree-content"], [4, "ngTemplateOutlet", "ngTemplateOutletContext"], [1, "tree-node", 3, "padding-left"], [1, "tree-node"], ["mjButton", "", "variant", "flat", "size", "sm", 1, "tree-node-button", 3, "click"], ["mjButton", "", "variant", "flat", "size", "sm", 1, "expand-button"], [1, "no-expand"], [1, "fa-solid", "fa-folder"], ["mjButton", "", "variant", "flat", "size", "sm", 1, "expand-button", 3, "click"], [1, "fa-solid", "fa-chevron-down"], [1, "fa-solid", "fa-chevron-right"], [1, "action-card"], [1, "action-card", 3, "click"], [1, "action-icon"], [1, "action-main"], [1, "action-header"], [1, "action-name"], [1, "action-badges"], [1, "status-chip"], ["data-color", "info", 1, "status-chip"], [1, "action-description"], [1, "action-details"], [1, "detail-item"], [1, "action-actions"], ["mjButton", "", "variant", "flat", 3, "click"], [1, "fa-solid", "fa-ellipsis-vertical"], [1, "fa-solid", "fa-robot"], [1, "fa-solid", "fa-clock"], [1, "fa-solid", "fa-check-circle"], ["size", "medium", 3, "showText"]], template: function ActionsListViewComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "div", 1)(1, "div", 2)(2, "div", 3)(3, "h2");
            i0.ɵɵelement(4, "i", 4);
            i0.ɵɵtext(5, " Actions");
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(6, "div", 5);
            i0.ɵɵtext(7);
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(8, "div", 6)(9, "div", 7)(10, "div", 8);
            i0.ɵɵelement(11, "i", 9);
            i0.ɵɵelementStart(12, "input", 10);
            i0.ɵɵlistener("input", function ActionsListViewComponent_Template_input_input_12_listener($event) { return ctx.onSearchChange($event.target.value); });
            i0.ɵɵelementEnd()()();
            i0.ɵɵelementStart(13, "div", 11)(14, "mj-dropdown", 12);
            i0.ɵɵlistener("ValueChange", function ActionsListViewComponent_Template_mj_dropdown_ValueChange_14_listener($event) { return ctx.onStatusFilterChange($event); });
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(15, "mj-dropdown", 12);
            i0.ɵɵlistener("ValueChange", function ActionsListViewComponent_Template_mj_dropdown_ValueChange_15_listener($event) { return ctx.onTypeFilterChange($event); });
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(16, "button", 13);
            i0.ɵɵlistener("click", function ActionsListViewComponent_Template_button_click_16_listener() { return ctx.toggleCategoryTree(); });
            i0.ɵɵelement(17, "i", 14);
            i0.ɵɵconditionalCreate(18, ActionsListViewComponent_Conditional_18_Template, 1, 0)(19, ActionsListViewComponent_Conditional_19_Template, 1, 1);
            i0.ɵɵelementStart(20, "span", 15);
            i0.ɵɵtext(21);
            i0.ɵɵelementEnd()()()()();
            i0.ɵɵconditionalCreate(22, ActionsListViewComponent_Conditional_22_Template, 16, 7, "div", 16);
            i0.ɵɵelementStart(23, "div", 17);
            i0.ɵɵconditionalCreate(24, ActionsListViewComponent_Conditional_24_Template, 2, 0)(25, ActionsListViewComponent_Conditional_25_Template, 1, 0, "mj-empty-state", 18);
            i0.ɵɵelementEnd();
            i0.ɵɵconditionalCreate(26, ActionsListViewComponent_Conditional_26_Template, 2, 1, "div", 19);
            i0.ɵɵelementEnd();
        } if (rf & 2) {
            i0.ɵɵadvance(7);
            i0.ɵɵtextInterpolate2("", ctx.filteredActions.length, " of ", ctx.actions.length, " actions");
            i0.ɵɵadvance(5);
            i0.ɵɵproperty("value", ctx.searchTerm$.value);
            i0.ɵɵadvance(2);
            i0.ɵɵproperty("Data", ctx.statusOptions)("ValuePrimitive", true)("ngModel", ctx.selectedStatus$.value);
            i0.ɵɵadvance();
            i0.ɵɵproperty("Data", ctx.typeOptions)("ValuePrimitive", true)("ngModel", ctx.selectedType$.value);
            i0.ɵɵadvance(3);
            i0.ɵɵconditional(ctx.selectedCategory$.value === "all" ? 18 : 19);
            i0.ɵɵadvance(3);
            i0.ɵɵtextInterpolate(ctx.getCategoryActionCount(ctx.selectedCategory$.value));
            i0.ɵɵadvance();
            i0.ɵɵconditional(ctx.showCategoryTree ? 22 : -1);
            i0.ɵɵadvance(2);
            i0.ɵɵconditional(ctx.filteredActions.length > 0 ? 24 : !ctx.isLoading ? 25 : -1);
            i0.ɵɵadvance(2);
            i0.ɵɵconditional(ctx.isLoading ? 26 : -1);
        } }, dependencies: [i1.NgTemplateOutlet, i2.NgControlStatus, i2.NgModel, i3.MJButtonDirective, i3.MJDropdownComponent, i3.MJEmptyStateComponent, i4.LoadingComponent, i1.DatePipe], styles: [".actions-list-view[_ngcontent-%COMP%] {\n  display: flex;\n  flex-direction: column;\n  height: 100%;\n  background: var(--mj-bg-page);\n  position: relative; \n\n}\n.actions-list-view[_ngcontent-%COMP%]   .list-header[_ngcontent-%COMP%] {\n  padding: 1.5rem;\n  border-bottom: 1px solid var(--mj-border-default);\n  background: var(--mj-bg-surface);\n}\n.actions-list-view[_ngcontent-%COMP%]   .list-header[_ngcontent-%COMP%]   .header-title[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  margin-bottom: 1rem;\n}\n.actions-list-view[_ngcontent-%COMP%]   .list-header[_ngcontent-%COMP%]   .header-title[_ngcontent-%COMP%]   h2[_ngcontent-%COMP%] {\n  margin: 0;\n  font-size: 1.5rem;\n  font-weight: 600;\n  display: flex;\n  align-items: center;\n  gap: 0.5rem;\n}\n.actions-list-view[_ngcontent-%COMP%]   .list-header[_ngcontent-%COMP%]   .header-title[_ngcontent-%COMP%]   h2[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n  color: var(--mj-brand-primary);\n}\n.actions-list-view[_ngcontent-%COMP%]   .list-header[_ngcontent-%COMP%]   .header-title[_ngcontent-%COMP%]   .results-count[_ngcontent-%COMP%] {\n  font-size: 0.875rem;\n  color: var(--mj-text-muted);\n  font-weight: 600;\n}\n.actions-list-view[_ngcontent-%COMP%]   .list-header[_ngcontent-%COMP%]   .filters-row[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: center;\n  gap: 1rem;\n  flex-wrap: wrap;\n}\n.actions-list-view[_ngcontent-%COMP%]   .list-header[_ngcontent-%COMP%]   .filters-row[_ngcontent-%COMP%]   .search-container[_ngcontent-%COMP%] {\n  flex: 1;\n  min-width: 200px;\n}\n.actions-list-view[_ngcontent-%COMP%]   .list-header[_ngcontent-%COMP%]   .filters-row[_ngcontent-%COMP%]   .filter-group[_ngcontent-%COMP%] {\n  display: flex;\n  gap: 0.75rem;\n}\n.actions-list-view[_ngcontent-%COMP%]   .list-header[_ngcontent-%COMP%]   .filters-row[_ngcontent-%COMP%]   .filter-group[_ngcontent-%COMP%]   .category-filter-button[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: center;\n  gap: 8px;\n}\n.actions-list-view[_ngcontent-%COMP%]   .list-header[_ngcontent-%COMP%]   .filters-row[_ngcontent-%COMP%]   .filter-group[_ngcontent-%COMP%]   .category-filter-button[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n  font-size: 14px;\n}\n.actions-list-view[_ngcontent-%COMP%]   .list-header[_ngcontent-%COMP%]   .filters-row[_ngcontent-%COMP%]   .filter-group[_ngcontent-%COMP%]   .category-filter-button[_ngcontent-%COMP%]   .badge[_ngcontent-%COMP%] {\n  background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n  color: var(--mj-brand-primary);\n  padding: 2px 8px;\n  border-radius: 12px;\n  font-size: 12px;\n  margin-left: 8px;\n}\n.actions-list-view[_ngcontent-%COMP%]   .category-tree-panel[_ngcontent-%COMP%] {\n  position: absolute;\n  top: 120px;\n  right: 20px;\n  width: 350px;\n  max-height: 70vh;\n  background: var(--mj-bg-surface);\n  border: 1px solid var(--mj-border-default);\n  border-radius: 8px;\n  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n  z-index: 100;\n  display: flex;\n  flex-direction: column;\n}\n.actions-list-view[_ngcontent-%COMP%]   .category-tree-panel[_ngcontent-%COMP%]   .tree-header[_ngcontent-%COMP%] {\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  padding: 12px 16px;\n  border-bottom: 1px solid var(--mj-border-default);\n}\n.actions-list-view[_ngcontent-%COMP%]   .category-tree-panel[_ngcontent-%COMP%]   .tree-header[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%] {\n  margin: 0;\n  font-size: 16px;\n  font-weight: 600;\n}\n.actions-list-view[_ngcontent-%COMP%]   .category-tree-panel[_ngcontent-%COMP%]   .tree-actions[_ngcontent-%COMP%] {\n  padding: 8px;\n  border-bottom: 1px solid var(--mj-border-default);\n}\n.actions-list-view[_ngcontent-%COMP%]   .category-tree-panel[_ngcontent-%COMP%]   .tree-actions[_ngcontent-%COMP%]   button[_ngcontent-%COMP%] {\n  width: 100%;\n  justify-content: flex-start;\n}\n.actions-list-view[_ngcontent-%COMP%]   .category-tree-panel[_ngcontent-%COMP%]   .tree-actions[_ngcontent-%COMP%]   button.selected[_ngcontent-%COMP%] {\n  background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n}\n.actions-list-view[_ngcontent-%COMP%]   .category-tree-panel[_ngcontent-%COMP%]   .tree-actions[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]   .badge[_ngcontent-%COMP%] {\n  margin-left: auto;\n  background: var(--mj-bg-surface-sunken);\n  color: var(--mj-text-primary);\n  padding: 2px 8px;\n  border-radius: 12px;\n  font-size: 11px;\n}\n.actions-list-view[_ngcontent-%COMP%]   .category-tree-panel[_ngcontent-%COMP%]   .tree-content[_ngcontent-%COMP%] {\n  flex: 1;\n  overflow-y: auto;\n  padding: 8px;\n}\n.actions-list-view[_ngcontent-%COMP%]   .category-tree-panel[_ngcontent-%COMP%]   .tree-content[_ngcontent-%COMP%]   .tree-node[_ngcontent-%COMP%]   .tree-node-button[_ngcontent-%COMP%] {\n  width: 100%;\n  justify-content: flex-start;\n  padding-left: 8px;\n  margin-bottom: 2px;\n}\n.actions-list-view[_ngcontent-%COMP%]   .category-tree-panel[_ngcontent-%COMP%]   .tree-content[_ngcontent-%COMP%]   .tree-node[_ngcontent-%COMP%]   .tree-node-button.selected[_ngcontent-%COMP%] {\n  background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n  color: var(--mj-brand-primary);\n}\n.actions-list-view[_ngcontent-%COMP%]   .category-tree-panel[_ngcontent-%COMP%]   .tree-content[_ngcontent-%COMP%]   .tree-node[_ngcontent-%COMP%]   .tree-node-button[_ngcontent-%COMP%]   .expand-button[_ngcontent-%COMP%] {\n  padding: 0;\n  min-width: 20px;\n  width: 20px;\n  height: 20px;\n  margin-right: 4px;\n}\n.actions-list-view[_ngcontent-%COMP%]   .category-tree-panel[_ngcontent-%COMP%]   .tree-content[_ngcontent-%COMP%]   .tree-node[_ngcontent-%COMP%]   .tree-node-button[_ngcontent-%COMP%]   .expand-button[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n  font-size: 10px;\n}\n.actions-list-view[_ngcontent-%COMP%]   .category-tree-panel[_ngcontent-%COMP%]   .tree-content[_ngcontent-%COMP%]   .tree-node[_ngcontent-%COMP%]   .tree-node-button[_ngcontent-%COMP%]   .no-expand[_ngcontent-%COMP%] {\n  display: inline-block;\n  width: 24px;\n}\n.actions-list-view[_ngcontent-%COMP%]   .category-tree-panel[_ngcontent-%COMP%]   .tree-content[_ngcontent-%COMP%]   .tree-node[_ngcontent-%COMP%]   .tree-node-button[_ngcontent-%COMP%]   i.fa-folder[_ngcontent-%COMP%] {\n  margin-right: 6px;\n  color: var(--mj-status-warning);\n}\n.actions-list-view[_ngcontent-%COMP%]   .category-tree-panel[_ngcontent-%COMP%]   .tree-content[_ngcontent-%COMP%]   .tree-node[_ngcontent-%COMP%]   .tree-node-button[_ngcontent-%COMP%]   .badge[_ngcontent-%COMP%] {\n  margin-left: auto;\n  background: var(--mj-bg-surface-sunken);\n  color: var(--mj-text-primary);\n  padding: 2px 6px;\n  border-radius: 12px;\n  font-size: 11px;\n}\n.actions-list-view[_ngcontent-%COMP%]   .actions-list[_ngcontent-%COMP%] {\n  flex: 1;\n  min-height: 0;\n  overflow-y: auto;\n  padding: 1.5rem;\n}\n.actions-list-view[_ngcontent-%COMP%]   .actions-list[_ngcontent-%COMP%]   .action-card[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: flex-start;\n  gap: 1rem;\n  padding: 1.5rem;\n  background: var(--mj-bg-surface);\n  border: 1px solid var(--mj-border-default);\n  border-radius: 0.75rem;\n  margin-bottom: 1rem;\n  cursor: pointer;\n  transition: all 0.2s ease;\n}\n.actions-list-view[_ngcontent-%COMP%]   .actions-list[_ngcontent-%COMP%]   .action-card[_ngcontent-%COMP%]:hover {\n  background: var(--mj-bg-surface-hover);\n  border-color: var(--mj-brand-primary);\n  transform: translateY(-1px);\n  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);\n}\n.actions-list-view[_ngcontent-%COMP%]   .actions-list[_ngcontent-%COMP%]   .action-card[_ngcontent-%COMP%]   .action-icon[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  width: 3rem;\n  height: 3rem;\n  border-radius: 0.5rem;\n  background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n  flex-shrink: 0;\n}\n.actions-list-view[_ngcontent-%COMP%]   .actions-list[_ngcontent-%COMP%]   .action-card[_ngcontent-%COMP%]   .action-icon[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n  color: var(--mj-brand-primary);\n  font-size: 1.25rem;\n}\n.actions-list-view[_ngcontent-%COMP%]   .actions-list[_ngcontent-%COMP%]   .action-card[_ngcontent-%COMP%]   .action-main[_ngcontent-%COMP%] {\n  flex: 1;\n}\n.actions-list-view[_ngcontent-%COMP%]   .actions-list[_ngcontent-%COMP%]   .action-card[_ngcontent-%COMP%]   .action-main[_ngcontent-%COMP%]   .action-header[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: flex-start;\n  justify-content: space-between;\n  margin-bottom: 0.75rem;\n}\n.actions-list-view[_ngcontent-%COMP%]   .actions-list[_ngcontent-%COMP%]   .action-card[_ngcontent-%COMP%]   .action-main[_ngcontent-%COMP%]   .action-header[_ngcontent-%COMP%]   .action-name[_ngcontent-%COMP%] {\n  margin: 0;\n  font-size: 1.125rem;\n  font-weight: 600;\n  color: var(--mj-text-primary);\n}\n.actions-list-view[_ngcontent-%COMP%]   .actions-list[_ngcontent-%COMP%]   .action-card[_ngcontent-%COMP%]   .action-main[_ngcontent-%COMP%]   .action-header[_ngcontent-%COMP%]   .action-badges[_ngcontent-%COMP%] {\n  display: flex;\n  gap: 0.5rem;\n  flex-shrink: 0;\n}\n.actions-list-view[_ngcontent-%COMP%]   .actions-list[_ngcontent-%COMP%]   .action-card[_ngcontent-%COMP%]   .action-main[_ngcontent-%COMP%]   .action-description[_ngcontent-%COMP%] {\n  color: var(--mj-text-muted);\n  line-height: 1.5;\n  margin-bottom: 1rem;\n}\n.actions-list-view[_ngcontent-%COMP%]   .actions-list[_ngcontent-%COMP%]   .action-card[_ngcontent-%COMP%]   .action-main[_ngcontent-%COMP%]   .action-details[_ngcontent-%COMP%] {\n  display: flex;\n  gap: 1.5rem;\n  flex-wrap: wrap;\n}\n.actions-list-view[_ngcontent-%COMP%]   .actions-list[_ngcontent-%COMP%]   .action-card[_ngcontent-%COMP%]   .action-main[_ngcontent-%COMP%]   .action-details[_ngcontent-%COMP%]   .detail-item[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: center;\n  gap: 0.375rem;\n  font-size: 0.75rem;\n  color: var(--mj-text-muted);\n}\n.actions-list-view[_ngcontent-%COMP%]   .actions-list[_ngcontent-%COMP%]   .action-card[_ngcontent-%COMP%]   .action-main[_ngcontent-%COMP%]   .action-details[_ngcontent-%COMP%]   .detail-item[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n  color: var(--mj-brand-primary);\n  width: 0.75rem;\n}\n.actions-list-view[_ngcontent-%COMP%]   .actions-list[_ngcontent-%COMP%]   .action-card[_ngcontent-%COMP%]   .action-actions[_ngcontent-%COMP%] {\n  flex-shrink: 0;\n}\n.actions-list-view[_ngcontent-%COMP%]   .actions-list[_ngcontent-%COMP%]   .action-card[_ngcontent-%COMP%]   .action-actions[_ngcontent-%COMP%]   button[_ngcontent-%COMP%] {\n  opacity: 0;\n  transition: opacity 0.2s ease;\n}\n.actions-list-view[_ngcontent-%COMP%]   .actions-list[_ngcontent-%COMP%]   .action-card[_ngcontent-%COMP%]:hover   .action-actions[_ngcontent-%COMP%]   button[_ngcontent-%COMP%] {\n  opacity: 1;\n}\n.actions-list-view[_ngcontent-%COMP%]   .loading-overlay[_ngcontent-%COMP%] {\n  position: absolute;\n  top: 0;\n  left: 0;\n  right: 0;\n  bottom: 0;\n  background: rgba(255, 255, 255, 0.8);\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  z-index: 1000;\n}\n\n@media (max-width: 768px) {\n  .actions-list-view[_ngcontent-%COMP%]   .list-header[_ngcontent-%COMP%] {\n    padding: 1rem;\n  }\n  .actions-list-view[_ngcontent-%COMP%]   .list-header[_ngcontent-%COMP%]   .header-title[_ngcontent-%COMP%] {\n    flex-direction: column;\n    align-items: stretch;\n    gap: 0.5rem;\n  }\n  .actions-list-view[_ngcontent-%COMP%]   .list-header[_ngcontent-%COMP%]   .filters-row[_ngcontent-%COMP%] {\n    flex-direction: column;\n    align-items: stretch;\n  }\n  .actions-list-view[_ngcontent-%COMP%]   .list-header[_ngcontent-%COMP%]   .filters-row[_ngcontent-%COMP%]   .search-container[_ngcontent-%COMP%], \n   .actions-list-view[_ngcontent-%COMP%]   .list-header[_ngcontent-%COMP%]   .filters-row[_ngcontent-%COMP%]   .filter-group[_ngcontent-%COMP%] {\n    min-width: unset;\n  }\n  .actions-list-view[_ngcontent-%COMP%]   .list-header[_ngcontent-%COMP%]   .filters-row[_ngcontent-%COMP%]   .filter-group[_ngcontent-%COMP%] {\n    display: grid;\n    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));\n    gap: 0.5rem;\n  }\n  .actions-list-view[_ngcontent-%COMP%]   .actions-list[_ngcontent-%COMP%] {\n    padding: 1rem;\n  }\n  .actions-list-view[_ngcontent-%COMP%]   .actions-list[_ngcontent-%COMP%]   .action-card[_ngcontent-%COMP%] {\n    padding: 1rem;\n  }\n  .actions-list-view[_ngcontent-%COMP%]   .actions-list[_ngcontent-%COMP%]   .action-card[_ngcontent-%COMP%]   .action-main[_ngcontent-%COMP%]   .action-header[_ngcontent-%COMP%] {\n    flex-direction: column;\n    align-items: stretch;\n    gap: 0.5rem;\n  }\n  .actions-list-view[_ngcontent-%COMP%]   .actions-list[_ngcontent-%COMP%]   .action-card[_ngcontent-%COMP%]   .action-main[_ngcontent-%COMP%]   .action-header[_ngcontent-%COMP%]   .action-badges[_ngcontent-%COMP%] {\n    align-self: flex-start;\n  }\n  .actions-list-view[_ngcontent-%COMP%]   .actions-list[_ngcontent-%COMP%]   .action-card[_ngcontent-%COMP%]   .action-main[_ngcontent-%COMP%]   .action-details[_ngcontent-%COMP%] {\n    gap: 1rem;\n  }\n}"] });
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ActionsListViewComponent, [{
        type: Component,
        args: [{ standalone: false, selector: 'mj-actions-list-view', template: "<div class=\"actions-list-view\" >\n  <!-- Header with filters -->\n  <div class=\"list-header\">\n    <div class=\"header-title\">\n      <h2><i class=\"fa-solid fa-cogs\"></i> Actions</h2>\n      <div class=\"results-count\">{{ filteredActions.length }} of {{ actions.length }} actions</div>\n    </div>\n    \n    <div class=\"filters-row\">\n      <div class=\"search-container\">\n        <div class=\"search-input-wrapper\">\n          <i class=\"fa-solid fa-search search-icon\"></i>\n          <input type=\"text\" class=\"mj-input\"\n            placeholder=\"Search actions...\"\n            [value]=\"searchTerm$.value\"\n            (input)=\"onSearchChange($any($event.target).value)\" />\n        </div>\n      </div>\n      \n      <div class=\"filter-group\">\n        <mj-dropdown\n          [Data]=\"statusOptions\"\n          TextField=\"text\"\n          ValueField=\"value\"\n          [ValuePrimitive]=\"true\"\n          [ngModel]=\"selectedStatus$.value\"\n          (ValueChange)=\"onStatusFilterChange($any($event))\">\n        </mj-dropdown>\n\n        <mj-dropdown\n          [Data]=\"typeOptions\"\n          TextField=\"text\"\n          ValueField=\"value\"\n          [ValuePrimitive]=\"true\"\n          [ngModel]=\"selectedType$.value\"\n          (ValueChange)=\"onTypeFilterChange($any($event))\">\n        </mj-dropdown>\n        \n        <button mjButton\n          variant=\"outline\"\n          (click)=\"toggleCategoryTree()\"\n          class=\"category-filter-button\">\n          <i class=\"fa-solid fa-folder-tree\"></i>\n          @if (selectedCategory$.value === 'all') {\n            All Categories\n          } @else {\n            {{ getCategoryName(selectedCategory$.value) }}\n          }\n          <span class=\"badge\">{{ getCategoryActionCount(selectedCategory$.value) }}</span>\n        </button>\n      </div>\n    </div>\n  </div>\n  \n  <!-- Category Tree View Panel -->\n  @if (showCategoryTree) {\n    <div class=\"category-tree-panel\">\n      <div class=\"tree-header\">\n        <h3>Select Category</h3>\n        <button mjButton\n          variant=\"flat\"\n          size=\"sm\"\n          (click)=\"toggleCategoryTree()\">\n          <i class=\"fa-solid fa-times\"></i>\n        </button>\n      </div>\n      \n      <div class=\"tree-actions\">\n        <button mjButton\n          variant=\"flat\"\n          size=\"sm\"\n          (click)=\"selectCategory('all')\"\n          [class.selected]=\"selectedCategory$.value === 'all'\">\n          <i class=\"fa-solid fa-folder-open\"></i>\n          All Categories\n          <span class=\"badge\">{{ actions.length }}</span>\n        </button>\n      </div>\n      \n      <div class=\"tree-content\">\n        <ng-container *ngTemplateOutlet=\"categoryTreeTemplate; context: { nodes: categoryTree }\"></ng-container>\n      </div>\n      \n      <ng-template #categoryTreeTemplate let-nodes=\"nodes\">\n        @for (node of nodes; track node.category.ID) {\n          <div class=\"tree-node\" [style.padding-left.px]=\"node.level * 20\">\n            <button mjButton\n              variant=\"flat\"\n              size=\"sm\"\n              class=\"tree-node-button\"\n              [class.selected]=\"selectedCategory$.value === node.category.ID\"\n              (click)=\"selectCategory(node.category.ID)\">\n              \n              @if (node.children.length > 0) {\n                <button mjButton\n                  variant=\"flat\"\n                  size=\"sm\"\n                  class=\"expand-button\"\n                  (click)=\"toggleCategoryExpanded(node.category.ID); $event.stopPropagation()\">\n                  @if (isCategoryExpanded(node.category.ID)) {\n                    <i class=\"fa-solid fa-chevron-down\"></i>\n                  } @else {\n                    <i class=\"fa-solid fa-chevron-right\"></i>\n                  }\n                </button>\n              } @else {\n                <span class=\"no-expand\"></span>\n              }\n              \n              <i class=\"fa-solid fa-folder\"></i>\n              {{ node.category.Name }}\n              <span class=\"badge\">{{ getCategoryActionCount(node.category.ID) }}</span>\n            </button>\n            \n            @if (node.children.length > 0 && isCategoryExpanded(node.category.ID)) {\n              <ng-container *ngTemplateOutlet=\"categoryTreeTemplate; context: { nodes: node.children }\"></ng-container>\n            }\n          </div>\n        }\n      </ng-template>\n    </div>\n  }\n\n  <!-- Actions List -->\n  <div class=\"actions-list\">\n    @if (filteredActions.length > 0) {\n      @for (action of filteredActions; track action.ID) {\n        <div class=\"action-card\" (click)=\"openAction(action)\">\n          <div class=\"action-icon\">\n            <i [class]=\"getActionIcon(action)\"></i>\n          </div>\n          \n          <div class=\"action-main\">\n            <div class=\"action-header\">\n              <h3 class=\"action-name\">{{ action.Name }}</h3>\n              <div class=\"action-badges\">\n                <span class=\"status-chip\" [attr.data-color]=\"getStatusColor(action.Status)\">\n                  {{ action.Status }}\n                </span>\n                @if (action.Type === 'Generated') {\n                  <span class=\"status-chip\" data-color=\"info\">\n                    <i class=\"fa-solid fa-robot\"></i> AI Generated\n                  </span>\n                }\n              </div>\n            </div>\n            \n            <div class=\"action-description\">\n              {{ action.Description || 'No description available' }}\n            </div>\n            \n            <div class=\"action-details\">\n              <div class=\"detail-item\">\n                <i class=\"fa-solid fa-folder\"></i>\n                <span>{{ getCategoryName(action.CategoryID) }}</span>\n              </div>\n              @if (action.__mj_UpdatedAt) {\n                <div class=\"detail-item\">\n                  <i class=\"fa-solid fa-clock\"></i>\n                  <span>Updated {{ action.__mj_UpdatedAt | date:'MMM d, yyyy' }}</span>\n                </div>\n              }\n              @if (action.CodeApprovalStatus && action.Type === 'Generated') {\n                <div class=\"detail-item\">\n                  <i class=\"fa-solid fa-check-circle\"></i>\n                  <span>{{ action.CodeApprovalStatus }}</span>\n                </div>\n              }\n            </div>\n          </div>\n          \n          <div class=\"action-actions\">\n            <button mjButton\n              variant=\"flat\"\n              (click)=\"$event.stopPropagation()\">\n              <i class=\"fa-solid fa-ellipsis-vertical\"></i>\n            </button>\n          </div>\n        </div>\n      }\n    } @else if (!isLoading) {\n      <mj-empty-state Variant=\"no-results\"\n        Title=\"No actions found\"\n        Message=\"Try adjusting your search or filter criteria\" />\n    }\n  </div>\n\n  @if (isLoading) {\n    <div class=\"loading-overlay\">\n      <mj-loading [showText]=\"false\" size=\"medium\"></mj-loading>\n    </div>\n  }\n</div>", styles: [".actions-list-view {\n  display: flex;\n  flex-direction: column;\n  height: 100%;\n  background: var(--mj-bg-page);\n  position: relative; /* Required for scoped loading overlay */\n}\n.actions-list-view .list-header {\n  padding: 1.5rem;\n  border-bottom: 1px solid var(--mj-border-default);\n  background: var(--mj-bg-surface);\n}\n.actions-list-view .list-header .header-title {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  margin-bottom: 1rem;\n}\n.actions-list-view .list-header .header-title h2 {\n  margin: 0;\n  font-size: 1.5rem;\n  font-weight: 600;\n  display: flex;\n  align-items: center;\n  gap: 0.5rem;\n}\n.actions-list-view .list-header .header-title h2 i {\n  color: var(--mj-brand-primary);\n}\n.actions-list-view .list-header .header-title .results-count {\n  font-size: 0.875rem;\n  color: var(--mj-text-muted);\n  font-weight: 600;\n}\n.actions-list-view .list-header .filters-row {\n  display: flex;\n  align-items: center;\n  gap: 1rem;\n  flex-wrap: wrap;\n}\n.actions-list-view .list-header .filters-row .search-container {\n  flex: 1;\n  min-width: 200px;\n}\n.actions-list-view .list-header .filters-row .filter-group {\n  display: flex;\n  gap: 0.75rem;\n}\n.actions-list-view .list-header .filters-row .filter-group .category-filter-button {\n  display: flex;\n  align-items: center;\n  gap: 8px;\n}\n.actions-list-view .list-header .filters-row .filter-group .category-filter-button i {\n  font-size: 14px;\n}\n.actions-list-view .list-header .filters-row .filter-group .category-filter-button .badge {\n  background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n  color: var(--mj-brand-primary);\n  padding: 2px 8px;\n  border-radius: 12px;\n  font-size: 12px;\n  margin-left: 8px;\n}\n.actions-list-view .category-tree-panel {\n  position: absolute;\n  top: 120px;\n  right: 20px;\n  width: 350px;\n  max-height: 70vh;\n  background: var(--mj-bg-surface);\n  border: 1px solid var(--mj-border-default);\n  border-radius: 8px;\n  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n  z-index: 100;\n  display: flex;\n  flex-direction: column;\n}\n.actions-list-view .category-tree-panel .tree-header {\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  padding: 12px 16px;\n  border-bottom: 1px solid var(--mj-border-default);\n}\n.actions-list-view .category-tree-panel .tree-header h3 {\n  margin: 0;\n  font-size: 16px;\n  font-weight: 600;\n}\n.actions-list-view .category-tree-panel .tree-actions {\n  padding: 8px;\n  border-bottom: 1px solid var(--mj-border-default);\n}\n.actions-list-view .category-tree-panel .tree-actions button {\n  width: 100%;\n  justify-content: flex-start;\n}\n.actions-list-view .category-tree-panel .tree-actions button.selected {\n  background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n}\n.actions-list-view .category-tree-panel .tree-actions button .badge {\n  margin-left: auto;\n  background: var(--mj-bg-surface-sunken);\n  color: var(--mj-text-primary);\n  padding: 2px 8px;\n  border-radius: 12px;\n  font-size: 11px;\n}\n.actions-list-view .category-tree-panel .tree-content {\n  flex: 1;\n  overflow-y: auto;\n  padding: 8px;\n}\n.actions-list-view .category-tree-panel .tree-content .tree-node .tree-node-button {\n  width: 100%;\n  justify-content: flex-start;\n  padding-left: 8px;\n  margin-bottom: 2px;\n}\n.actions-list-view .category-tree-panel .tree-content .tree-node .tree-node-button.selected {\n  background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n  color: var(--mj-brand-primary);\n}\n.actions-list-view .category-tree-panel .tree-content .tree-node .tree-node-button .expand-button {\n  padding: 0;\n  min-width: 20px;\n  width: 20px;\n  height: 20px;\n  margin-right: 4px;\n}\n.actions-list-view .category-tree-panel .tree-content .tree-node .tree-node-button .expand-button i {\n  font-size: 10px;\n}\n.actions-list-view .category-tree-panel .tree-content .tree-node .tree-node-button .no-expand {\n  display: inline-block;\n  width: 24px;\n}\n.actions-list-view .category-tree-panel .tree-content .tree-node .tree-node-button i.fa-folder {\n  margin-right: 6px;\n  color: var(--mj-status-warning);\n}\n.actions-list-view .category-tree-panel .tree-content .tree-node .tree-node-button .badge {\n  margin-left: auto;\n  background: var(--mj-bg-surface-sunken);\n  color: var(--mj-text-primary);\n  padding: 2px 6px;\n  border-radius: 12px;\n  font-size: 11px;\n}\n.actions-list-view .actions-list {\n  flex: 1;\n  min-height: 0;\n  overflow-y: auto;\n  padding: 1.5rem;\n}\n.actions-list-view .actions-list .action-card {\n  display: flex;\n  align-items: flex-start;\n  gap: 1rem;\n  padding: 1.5rem;\n  background: var(--mj-bg-surface);\n  border: 1px solid var(--mj-border-default);\n  border-radius: 0.75rem;\n  margin-bottom: 1rem;\n  cursor: pointer;\n  transition: all 0.2s ease;\n}\n.actions-list-view .actions-list .action-card:hover {\n  background: var(--mj-bg-surface-hover);\n  border-color: var(--mj-brand-primary);\n  transform: translateY(-1px);\n  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);\n}\n.actions-list-view .actions-list .action-card .action-icon {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  width: 3rem;\n  height: 3rem;\n  border-radius: 0.5rem;\n  background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n  flex-shrink: 0;\n}\n.actions-list-view .actions-list .action-card .action-icon i {\n  color: var(--mj-brand-primary);\n  font-size: 1.25rem;\n}\n.actions-list-view .actions-list .action-card .action-main {\n  flex: 1;\n}\n.actions-list-view .actions-list .action-card .action-main .action-header {\n  display: flex;\n  align-items: flex-start;\n  justify-content: space-between;\n  margin-bottom: 0.75rem;\n}\n.actions-list-view .actions-list .action-card .action-main .action-header .action-name {\n  margin: 0;\n  font-size: 1.125rem;\n  font-weight: 600;\n  color: var(--mj-text-primary);\n}\n.actions-list-view .actions-list .action-card .action-main .action-header .action-badges {\n  display: flex;\n  gap: 0.5rem;\n  flex-shrink: 0;\n}\n.actions-list-view .actions-list .action-card .action-main .action-description {\n  color: var(--mj-text-muted);\n  line-height: 1.5;\n  margin-bottom: 1rem;\n}\n.actions-list-view .actions-list .action-card .action-main .action-details {\n  display: flex;\n  gap: 1.5rem;\n  flex-wrap: wrap;\n}\n.actions-list-view .actions-list .action-card .action-main .action-details .detail-item {\n  display: flex;\n  align-items: center;\n  gap: 0.375rem;\n  font-size: 0.75rem;\n  color: var(--mj-text-muted);\n}\n.actions-list-view .actions-list .action-card .action-main .action-details .detail-item i {\n  color: var(--mj-brand-primary);\n  width: 0.75rem;\n}\n.actions-list-view .actions-list .action-card .action-actions {\n  flex-shrink: 0;\n}\n.actions-list-view .actions-list .action-card .action-actions button {\n  opacity: 0;\n  transition: opacity 0.2s ease;\n}\n.actions-list-view .actions-list .action-card:hover .action-actions button {\n  opacity: 1;\n}\n.actions-list-view .loading-overlay {\n  position: absolute;\n  top: 0;\n  left: 0;\n  right: 0;\n  bottom: 0;\n  background: rgba(255, 255, 255, 0.8);\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  z-index: 1000;\n}\n\n@media (max-width: 768px) {\n  .actions-list-view .list-header {\n    padding: 1rem;\n  }\n  .actions-list-view .list-header .header-title {\n    flex-direction: column;\n    align-items: stretch;\n    gap: 0.5rem;\n  }\n  .actions-list-view .list-header .filters-row {\n    flex-direction: column;\n    align-items: stretch;\n  }\n  .actions-list-view .list-header .filters-row .search-container,\n  .actions-list-view .list-header .filters-row .filter-group {\n    min-width: unset;\n  }\n  .actions-list-view .list-header .filters-row .filter-group {\n    display: grid;\n    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));\n    gap: 0.5rem;\n  }\n  .actions-list-view .actions-list {\n    padding: 1rem;\n  }\n  .actions-list-view .actions-list .action-card {\n    padding: 1rem;\n  }\n  .actions-list-view .actions-list .action-card .action-main .action-header {\n    flex-direction: column;\n    align-items: stretch;\n    gap: 0.5rem;\n  }\n  .actions-list-view .actions-list .action-card .action-main .action-header .action-badges {\n    align-self: flex-start;\n  }\n  .actions-list-view .actions-list .action-card .action-main .action-details {\n    gap: 1rem;\n  }\n}\n"] }]
    }], () => [], { openEntityRecord: [{
            type: Output
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ActionsListViewComponent, { className: "ActionsListViewComponent", filePath: "src/Actions/components/actions-list-view.component.ts", lineNumber: 20 }); })();
//# sourceMappingURL=actions-list-view.component.js.map