var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { Component, ChangeDetectionStrategy, ViewChild } from '@angular/core';
import { BaseDashboard } from '@memberjunction/ng-shared';
import { RegisterClass } from '@memberjunction/global';
import { CompositeKey } from '@memberjunction/core';
import { Subject } from 'rxjs';
import { debounceTime } from 'rxjs/operators';
import { SharedService } from '@memberjunction/ng-shared';
import { buildCommunicationAgentContext, isValidCommunicationTab, communicationTabLabel, resolveCommunicationItem, capCommunicationList, COMMUNICATION_TABS, COMMUNICATION_LOG_STATUSES, } from './communication-agent-context';
import { validateEnumParam, validateStringParam } from '../shared/agent-tool-validation';
import { CommunicationLogsResourceComponent } from './communication-logs-resource.component';
import { CommunicationProvidersResourceComponent } from './communication-providers-resource.component';
import { CommunicationTemplatesResourceComponent } from './communication-templates-resource.component';
import { CommunicationRunsResourceComponent } from './communication-runs-resource.component';
import { CommunicationMonitorResourceComponent } from './communication-monitor-resource.component';
import * as i0 from "@angular/core";
import * as i1 from "./communication-monitor-resource.component";
import * as i2 from "./communication-logs-resource.component";
import * as i3 from "./communication-providers-resource.component";
import * as i4 from "./communication-runs-resource.component";
import * as i5 from "./communication-templates-resource.component";
function CommunicationDashboardComponent_Case_47_Conditional_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mj-communication-monitor-resource");
} }
function CommunicationDashboardComponent_Case_47_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 23);
    i0.ɵɵconditionalCreate(1, CommunicationDashboardComponent_Case_47_Conditional_1_Template, 1, 0, "mj-communication-monitor-resource");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r0.hasVisited("monitor") ? 1 : -1);
} }
function CommunicationDashboardComponent_Case_48_Conditional_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mj-communication-logs-resource");
} }
function CommunicationDashboardComponent_Case_48_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 23);
    i0.ɵɵconditionalCreate(1, CommunicationDashboardComponent_Case_48_Conditional_1_Template, 1, 0, "mj-communication-logs-resource");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r0.hasVisited("logs") ? 1 : -1);
} }
function CommunicationDashboardComponent_Case_49_Conditional_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mj-communication-providers-resource");
} }
function CommunicationDashboardComponent_Case_49_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 23);
    i0.ɵɵconditionalCreate(1, CommunicationDashboardComponent_Case_49_Conditional_1_Template, 1, 0, "mj-communication-providers-resource");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r0.hasVisited("providers") ? 1 : -1);
} }
function CommunicationDashboardComponent_Case_50_Conditional_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mj-communication-templates-resource");
} }
function CommunicationDashboardComponent_Case_50_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 23);
    i0.ɵɵconditionalCreate(1, CommunicationDashboardComponent_Case_50_Conditional_1_Template, 1, 0, "mj-communication-templates-resource");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r0.hasVisited("templates") ? 1 : -1);
} }
function CommunicationDashboardComponent_Case_51_Conditional_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mj-communication-runs-resource");
} }
function CommunicationDashboardComponent_Case_51_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 23);
    i0.ɵɵconditionalCreate(1, CommunicationDashboardComponent_Case_51_Conditional_1_Template, 1, 0, "mj-communication-runs-resource");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r0.hasVisited("runs") ? 1 : -1);
} }
let CommunicationDashboardComponent = class CommunicationDashboardComponent extends BaseDashboard {
    cdr;
    isLoading = false;
    isRefreshing = false;
    activeTab = 'monitor';
    selectedIndex = 0;
    visitedTabs = new Set();
    navigationItems = [...COMMUNICATION_TABS];
    stateChangeSubject = new Subject();
    // Per-surface agent selection. The agent's SelectLog / SelectProvider / SelectTemplate /
    // SelectRun tools record what was last picked so the context can report it by id+name
    // (and the Open* tools can act on it). Read-only — selecting never mutates anything.
    selectedLog = null;
    selectedProvider = null;
    selectedTemplate = null;
    selectedRun = null;
    // Child resource components are mounted lazily (only after their tab is first
    // visited) and live inside @if blocks, so these queries resolve to a ref only
    // while their tab is the active, mounted one. They are read defensively — a null
    // ref simply means that surface's state isn't available yet.
    logsChild;
    providersChild;
    templatesChild;
    runsChild;
    monitorChild;
    constructor(cdr) {
        super();
        this.cdr = cdr;
        this.setupStateManagement();
    }
    async GetResourceDisplayName(data) {
        return "Communications";
    }
    ngAfterViewInit() {
        this.visitedTabs.add(this.activeTab);
        this.emitStateChange();
        // Wire the agent context + client tools (see SAFETY BOUNDARY below).
        this.registerAgentClientTools();
        this.publishAgentContext();
        this.cdr.detectChanges();
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        this.stateChangeSubject.complete();
    }
    onTabChange(tabId) {
        this.activeTab = tabId;
        const index = this.navigationItems.indexOf(tabId);
        this.selectedIndex = index >= 0 ? index : 0;
        setTimeout(() => {
            SharedService.Instance.InvokeManualResize();
            // The newly-mounted child has had a tick to load; re-publish so its
            // deep state reaches the agent and re-scope the tool set to the new tab.
            this.publishAgentContext();
        }, 100);
        this.visitedTabs.add(tabId);
        this.emitStateChange();
        // Immediate re-emit reflects the tab switch even before the child loads.
        this.publishAgentContext();
        this.cdr.markForCheck();
    }
    hasVisited(tabId) {
        return this.visitedTabs.has(tabId);
    }
    onRefresh() {
        this.isRefreshing = true;
        this.cdr.markForCheck();
        this.publishAgentContext();
        setTimeout(() => {
            this.isRefreshing = false;
            this.cdr.markForCheck();
            this.publishAgentContext();
        }, 1000);
    }
    setupStateManagement() {
        this.stateChangeSubject.pipe(debounceTime(50)).subscribe(state => {
            this.UserStateChanged.emit(state);
        });
    }
    emitStateChange() {
        const state = {
            activeTab: this.activeTab
        };
        this.stateChangeSubject.next(state);
    }
    loadUserState(state) {
        if (state.activeTab) {
            this.activeTab = state.activeTab;
            const index = this.navigationItems.indexOf(state.activeTab);
            this.selectedIndex = index >= 0 ? index : 0;
            this.visitedTabs.add(state.activeTab);
        }
        this.cdr.markForCheck();
    }
    initDashboard() {
        try {
            this.isLoading = true;
        }
        catch (error) {
            console.error('Error initializing Communication dashboard:', error);
            this.Error.emit(new Error('Failed to initialize Communication dashboard. Please try again.'));
        }
        finally {
            this.isLoading = false;
        }
    }
    loadData() {
        if (this.Config?.userState) {
            setTimeout(() => {
                if (this.Config?.userState) {
                    this.loadUserState(this.Config.userState);
                }
            }, 0);
        }
        this.NotifyLoadComplete();
    }
    getCurrentTabLabel() {
        return communicationTabLabel(this.activeTab);
    }
    // ================================================================
    // AI Agent Context & Client Tools
    //
    // 🚨 SAFETY BOUNDARY — NAVIGATIONAL + READ-ONLY-DISPLAY ONLY 🚨
    // The Communication dashboard sends real messages and manages providers and
    // templates. The agent context and client tools registered here are strictly
    // READ / FILTER / SEARCH / SELECT / NAVIGATE: tab switches, a refresh of
    // already-visible data, status/category filters + free-text search on the
    // (read-only) lists, selecting a visible row by id/name, and opening a
    // template / provider / log / run record in a tab.
    //
    // The following side-effecting operations that exist on this surface (in the
    // child resource components) are DELIBERATELY NOT exposed to the agent:
    //   - Sending / composing messages (onSend / new-message resource) — irreversible
    //     outbound side effect.
    //   - Creating / editing / deleting templates or providers — config mutation.
    //   - Any test-send / "send sample" action.
    // Context exposes only aggregate counts, the active filters/search, and the
    // salient DISPLAY names of visible rows — never message bodies, recipient lists,
    // provider credentials, or template content.
    // ================================================================
    /**
     * Publish the current Communication dashboard state to the AI agent via
     * NavigationService, then re-scope the tool set to the active tab. Re-invoked on
     * every meaningful state change (tab switch, refresh start/end, agent filter/select
     * action, and a tick after a tab mounts) so the agent always sees a fresh, read-only
     * snapshot. Only the ACTIVE surface's deep state is harvested — context is mode-scoped
     * to whatever tab is open, mirroring the Data Explorer pattern.
     */
    publishAgentContext() {
        const context = buildCommunicationAgentContext({
            ActiveTab: isValidCommunicationTab(this.activeTab) ? this.activeTab : 'monitor',
            ActiveTabLabel: this.getCurrentTabLabel(),
            VisitedTabs: Array.from(this.visitedTabs),
            IsRefreshing: this.isRefreshing,
            Surface: this.harvestActiveSurface(),
        });
        this.navigationService.SetAgentContext(this, context);
        this.syncAgentToolsForMode();
    }
    /**
     * Harvest the deep, per-surface state slice for the ACTIVE tab from whichever child
     * resource component is mounted. Returns `{ Surface: 'none' }` when the active tab's
     * child isn't available (settings tab, or a tab restored from saved state whose
     * content hasn't loaded yet) — so context truthfully reports "not loaded" rather than
     * fabricating zeros.
     */
    harvestActiveSurface() {
        switch (this.activeTab) {
            case 'monitor':
                return this.harvestMonitorSurface();
            case 'logs':
                return this.harvestLogsSurface();
            case 'providers':
                return this.harvestProvidersSurface();
            case 'templates':
                return this.harvestTemplatesSurface();
            case 'runs':
                return this.harvestRunsSurface();
            default:
                return { Surface: 'none' };
        }
    }
    harvestMonitorSurface() {
        const c = this.monitorChild;
        if (!c) {
            return { Surface: 'none' };
        }
        return {
            Surface: 'monitor',
            TotalSent: c.stats.totalSent,
            DeliveryRate: c.stats.deliveryRate,
            Pending: c.stats.pending,
            Failed: c.stats.failed,
            ProviderHealthNames: capCommunicationList(c.providerHealth.map(p => p.Name)),
            ProviderHealthCount: c.providerHealth.length,
            ChannelNames: c.channelBreakdown.map(ch => ch.Name),
            RecentActivityNames: capCommunicationList(c.recentLogs.map(l => `${l.CommunicationProviderMessageType || 'Message'} · ${l.CommunicationProvider || 'Unknown'} · ${l.Status}`)),
        };
    }
    harvestLogsSurface() {
        const c = this.logsChild;
        if (!c) {
            return { Surface: 'none' };
        }
        return {
            Surface: 'logs',
            LogCount: c.logs.length,
            FilteredLogCount: c.filteredLogs.length,
            StatusFilter: c.statusFilter,
            SearchText: c.SearchText,
            VisibleLogSummaries: capCommunicationList(c.filteredLogs.map(l => this.logDisplayName(l))),
            SelectedItemId: this.selectedLog?.id ?? null,
            SelectedItemName: this.selectedLog?.name ?? null,
        };
    }
    harvestProvidersSurface() {
        const c = this.providersChild;
        if (!c) {
            return { Surface: 'none' };
        }
        return {
            Surface: 'providers',
            ProviderCount: c.providerCards.length,
            ActiveProviderCount: c.providerCards.filter(p => p.Entity.Status === 'Active').length,
            ProviderNames: capCommunicationList(c.providerCards.map(p => p.Entity.Name)),
            SelectedItemId: this.selectedProvider?.id ?? null,
            SelectedItemName: this.selectedProvider?.name ?? null,
        };
    }
    harvestTemplatesSurface() {
        const c = this.templatesChild;
        if (!c) {
            return { Surface: 'none' };
        }
        return {
            Surface: 'templates',
            TemplateCount: c.allTemplates.length,
            FilteredTemplateCount: c.filteredTemplates.length,
            CategoryFilter: c.categoryFilter,
            SearchText: c.SearchText,
            AvailableCategories: capCommunicationList(c.categories),
            VisibleTemplateNames: capCommunicationList(c.filteredTemplates.map(t => t.Entity.Name)),
            SelectedItemId: this.selectedTemplate?.id ?? null,
            SelectedItemName: this.selectedTemplate?.name ?? null,
        };
    }
    harvestRunsSurface() {
        const c = this.runsChild;
        if (!c) {
            return { Surface: 'none' };
        }
        return {
            Surface: 'runs',
            RunCount: c.runs.length,
            ActiveRunCount: c.summary.active,
            CompletedRunCount: c.summary.completed,
            SuccessRate: c.summary.successRate,
            VisibleRunSummaries: capCommunicationList(c.runs.map(r => `${this.runDisplayName(r.ID)} · ${r.Status}`)),
            SelectedItemId: this.selectedRun?.id ?? null,
            SelectedItemName: this.selectedRun?.name ?? null,
        };
    }
    /** The display label the runs timeline shows for a run ("Run #<short-id>"). */
    runDisplayName(id) {
        return `Run #${(id || '').substring(0, 8)}`;
    }
    /**
     * The on-screen display summary for a log row ("<provider> · <type> · <status>"),
     * used both for context publishing and for name-based resolution by the agent's
     * Select/Open log tools — so the agent can refer to a row exactly as it's described
     * in context.
     */
    logDisplayName(log) {
        return `${log.CommunicationProvider || 'Unknown'} · ${log.CommunicationProviderMessageType || 'Message'} · ${log.Status}`;
    }
    /** id+name candidates for the visible (filtered) log rows. Empty when the Logs tab isn't mounted. */
    logCandidates() {
        return (this.logsChild?.filteredLogs ?? []).map(l => ({ ID: l.ID, Name: this.logDisplayName(l) }));
    }
    // -- Mode-scoped client tools -------------------------------------------------
    /**
     * Tracks which tool set was last registered, so the mode-scoped re-registration
     * ({@link syncAgentToolsForMode}) only fires on a tab transition rather than on
     * every state change.
     */
    lastRegisteredToolMode = null;
    /**
     * Re-scope the agent's client tools to the ACTIVE tab. Each surface exposes a
     * different set of affordances (logs filter by status + search + select/open a log;
     * templates filter by category + search + select/open a template; providers select/
     * open a provider; runs select/open a run; monitor is read-only), so a logs-only tool
     * is never exposed while the Providers tab is open and vice-versa. The COMMON tools
     * (switch tab, refresh) are always present. Because {@link publishAgentContext} fires
     * on every state change but the tool set only changes on the tab flip, this guards on
     * {@link lastRegisteredToolMode} and only calls into NavigationService when the active
     * tab actually changes.
     */
    syncAgentToolsForMode() {
        const mode = isValidCommunicationTab(this.activeTab) ? this.activeTab : 'monitor';
        if (mode === this.lastRegisteredToolMode) {
            return;
        }
        this.lastRegisteredToolMode = mode;
        this.navigationService.SetAgentClientTools(this, [
            ...this.buildCommonTools(),
            ...this.buildSurfaceTools(mode),
        ]);
    }
    /**
     * Register the navigational / read-only client tools the agent may invoke. Called
     * once on mount; {@link syncAgentToolsForMode} re-registers the surface-scoped slice
     * on every tab change. See the SAFETY BOUNDARY comment above for the operations
     * intentionally NOT exposed.
     */
    registerAgentClientTools() {
        this.lastRegisteredToolMode = null;
        this.syncAgentToolsForMode();
    }
    buildAgentTool(name, description, parameterSchema, handler) {
        return { Name: name, Description: description, ParameterSchema: parameterSchema, Handler: handler };
    }
    /** COMMON tools — available on EVERY tab (switch tab + refresh). */
    buildCommonTools() {
        return [
            this.buildAgentTool('SwitchCommunicationTab', 'Switch the active Communication dashboard tab. Valid tabs: monitor, logs, providers, templates, runs, settings.', {
                type: 'object',
                properties: { tab: { type: 'string', enum: [...COMMUNICATION_TABS] } },
                required: ['tab'],
            }, async (params) => this.handleSwitchTabTool(params)),
            this.buildAgentTool('RefreshCommunicationData', 'Refresh the currently-displayed Communication data. Read-only — re-loads existing data, sends nothing.', { type: 'object', properties: {} }, async () => {
                this.onRefresh();
                return { Success: true };
            }),
        ];
    }
    /** The surface-scoped tool slice for the active tab. */
    buildSurfaceTools(mode) {
        switch (mode) {
            case 'logs':
                return this.buildLogsTools();
            case 'providers':
                return this.buildProvidersTools();
            case 'templates':
                return this.buildTemplatesTools();
            case 'runs':
                return this.buildRunsTools();
            case 'monitor':
            case 'settings':
            default:
                return [];
        }
    }
    buildLogsTools() {
        return [
            this.buildAgentTool('FilterLogsBy', "Filter the message-log list by delivery status. Valid statuses: Complete, Failed, Pending, or '' to clear.", {
                type: 'object',
                properties: { status: { type: 'string', enum: [...COMMUNICATION_LOG_STATUSES] } },
                required: ['status'],
            }, async (params) => this.handleFilterLogsTool(params)),
            this.buildAgentTool('SearchLogs', 'Type into the log-list search box to filter logs by provider, message type, status, or error text.', { type: 'object', properties: { query: { type: 'string' } }, required: ['query'] }, async (params) => this.handleSearchLogsTool(params)),
            this.buildAgentTool('SelectLog', 'Select a visible message-log row by its id or a display value (provider / message type / status). Read-only — records the selection so it can be opened or referenced.', { type: 'object', properties: { log: { type: 'string' } }, required: ['log'] }, async (params) => this.handleSelectLogTool(params)),
            this.buildAgentTool('OpenLog', 'Open a message-log record in a tab by id or display value. Defaults to the currently-selected log when no argument is given. Read-only navigation.', { type: 'object', properties: { log: { type: 'string' } } }, async (params) => this.handleOpenLogTool(params)),
        ];
    }
    buildProvidersTools() {
        return [
            this.buildAgentTool('SelectProvider', 'Select a configured provider card by its name or id. Read-only — records the selection so it can be opened or referenced.', { type: 'object', properties: { provider: { type: 'string' } }, required: ['provider'] }, async (params) => this.handleSelectProviderTool(params)),
            this.buildAgentTool('OpenProvider', 'Open a provider record in a tab by name or id. Defaults to the currently-selected provider when no argument is given. Read-only navigation — does NOT edit the provider.', { type: 'object', properties: { provider: { type: 'string' } } }, async (params) => this.handleOpenProviderTool(params)),
        ];
    }
    buildTemplatesTools() {
        return [
            this.buildAgentTool('FilterTemplatesByCategory', "Filter the template list by category, or pass '' to clear the filter.", { type: 'object', properties: { category: { type: 'string' } }, required: ['category'] }, async (params) => this.handleFilterTemplatesTool(params)),
            this.buildAgentTool('SearchTemplates', 'Type into the template-list search box to filter templates by name, description, or category.', { type: 'object', properties: { query: { type: 'string' } }, required: ['query'] }, async (params) => this.handleSearchTemplatesTool(params)),
            this.buildAgentTool('SelectTemplate', 'Select a visible template by its name or id. Read-only — records the selection so it can be opened or referenced.', { type: 'object', properties: { template: { type: 'string' } }, required: ['template'] }, async (params) => this.handleSelectTemplateTool(params)),
            this.buildAgentTool('OpenTemplate', 'Open a template record in a tab by name or id. Defaults to the currently-selected template when no argument is given. Read-only navigation — does NOT edit the template.', { type: 'object', properties: { template: { type: 'string' } } }, async (params) => this.handleOpenTemplateTool(params)),
        ];
    }
    buildRunsTools() {
        return [
            this.buildAgentTool('SelectRun', 'Select a visible bulk-run by its id or display label ("Run #<short-id>"). Read-only — records the selection so it can be opened or referenced.', { type: 'object', properties: { run: { type: 'string' } }, required: ['run'] }, async (params) => this.handleSelectRunTool(params)),
            this.buildAgentTool('OpenRun', 'Open a bulk communication-run record in a tab by id or display label. Defaults to the currently-selected run when no argument is given. Read-only navigation.', { type: 'object', properties: { run: { type: 'string' } } }, async (params) => this.handleOpenRunTool(params)),
        ];
    }
    // -- Tolerant tool handlers ---------------------------------------------------
    handleSwitchTabTool(params) {
        const v = validateEnumParam(params?.['tab'], this.navigationItems, 'tab');
        if (!v.ok) {
            return v.result;
        }
        this.onTabChange(v.value);
        return { Success: true };
    }
    handleFilterLogsTool(params) {
        const v = validateEnumParam(params?.['status'], COMMUNICATION_LOG_STATUSES, 'status');
        if (!v.ok) {
            return v.result;
        }
        if (!this.logsChild) {
            return { Success: false, ErrorMessage: 'The Logs tab is not open. Switch to the Logs tab before filtering logs.' };
        }
        this.logsChild.onStatusFilter(v.value);
        this.publishAgentContext();
        return { Success: true };
    }
    handleSearchLogsTool(params) {
        const v = validateStringParam(params?.['query'], 'query');
        if (!v.ok) {
            return v.result;
        }
        if (!this.logsChild) {
            return { Success: false, ErrorMessage: 'The Logs tab is not open. Switch to the Logs tab before searching logs.' };
        }
        this.logsChild.onSearchValue(v.value);
        this.publishAgentContext();
        return { Success: true };
    }
    handleSelectLogTool(params) {
        const v = validateStringParam(params?.['log'], 'log');
        if (!v.ok) {
            return v.result;
        }
        if (!this.logsChild) {
            return { Success: false, ErrorMessage: 'The Logs tab is not open. Switch to the Logs tab first.' };
        }
        const match = resolveCommunicationItem(v.value, this.logCandidates());
        if (!match) {
            return { Success: false, ErrorMessage: `No visible log matches "${v.value}".` };
        }
        this.selectedLog = { id: match.ID, name: match.Name };
        this.publishAgentContext();
        return { Success: true };
    }
    handleOpenLogTool(params) {
        const ref = typeof params?.['log'] === 'string' ? params['log'] : '';
        if (ref && this.logsChild) {
            const match = resolveCommunicationItem(ref, this.logCandidates());
            if (match) {
                this.selectedLog = { id: match.ID, name: match.Name };
            }
        }
        if (!this.selectedLog) {
            return { Success: false, ErrorMessage: 'No log to open. Select a log first or pass an id / display value.' };
        }
        this.navigationService.OpenEntityRecord('MJ: Communication Logs', CompositeKey.FromID(this.selectedLog.id));
        return { Success: true };
    }
    handleSelectProviderTool(params) {
        const v = validateStringParam(params?.['provider'], 'provider');
        if (!v.ok) {
            return v.result;
        }
        if (!this.providersChild) {
            return { Success: false, ErrorMessage: 'The Providers tab is not open. Switch to the Providers tab first.' };
        }
        const candidates = this.providersChild.providerCards.map(p => ({ ID: p.Entity.ID, Name: p.Entity.Name }));
        const match = resolveCommunicationItem(v.value, candidates);
        if (!match) {
            return { Success: false, ErrorMessage: `No provider matches "${v.value}".` };
        }
        this.selectedProvider = { id: match.ID, name: match.Name };
        this.publishAgentContext();
        return { Success: true };
    }
    handleOpenProviderTool(params) {
        const ref = typeof params?.['provider'] === 'string' ? params['provider'] : '';
        if (ref && this.providersChild) {
            const candidates = this.providersChild.providerCards.map(p => ({ ID: p.Entity.ID, Name: p.Entity.Name }));
            const match = resolveCommunicationItem(ref, candidates);
            if (match) {
                this.selectedProvider = { id: match.ID, name: match.Name };
            }
        }
        if (!this.selectedProvider) {
            return { Success: false, ErrorMessage: 'No provider to open. Select a provider first or pass a name / id.' };
        }
        this.navigationService.OpenEntityRecord('MJ: Communication Providers', CompositeKey.FromID(this.selectedProvider.id));
        return { Success: true };
    }
    handleFilterTemplatesTool(params) {
        const v = validateStringParam(params?.['category'], 'category');
        if (!v.ok) {
            return v.result;
        }
        if (!this.templatesChild) {
            return { Success: false, ErrorMessage: 'The Templates tab is not open. Switch to the Templates tab first.' };
        }
        this.templatesChild.onCategoryFilter(v.value);
        this.publishAgentContext();
        return { Success: true };
    }
    handleSearchTemplatesTool(params) {
        const v = validateStringParam(params?.['query'], 'query');
        if (!v.ok) {
            return v.result;
        }
        if (!this.templatesChild) {
            return { Success: false, ErrorMessage: 'The Templates tab is not open. Switch to the Templates tab first.' };
        }
        this.templatesChild.onSearchValue(v.value);
        this.publishAgentContext();
        return { Success: true };
    }
    handleSelectTemplateTool(params) {
        const v = validateStringParam(params?.['template'], 'template');
        if (!v.ok) {
            return v.result;
        }
        if (!this.templatesChild) {
            return { Success: false, ErrorMessage: 'The Templates tab is not open. Switch to the Templates tab first.' };
        }
        const candidates = this.templatesChild.filteredTemplates.map(t => ({ ID: t.Entity.ID, Name: t.Entity.Name }));
        const match = resolveCommunicationItem(v.value, candidates);
        if (!match) {
            return { Success: false, ErrorMessage: `No visible template matches "${v.value}".` };
        }
        this.selectedTemplate = { id: match.ID, name: match.Name };
        this.publishAgentContext();
        return { Success: true };
    }
    handleOpenTemplateTool(params) {
        const ref = typeof params?.['template'] === 'string' ? params['template'] : '';
        if (ref && this.templatesChild) {
            const candidates = this.templatesChild.filteredTemplates.map(t => ({ ID: t.Entity.ID, Name: t.Entity.Name }));
            const match = resolveCommunicationItem(ref, candidates);
            if (match) {
                this.selectedTemplate = { id: match.ID, name: match.Name };
            }
        }
        if (!this.selectedTemplate) {
            return { Success: false, ErrorMessage: 'No template to open. Select a template first or pass a name / id.' };
        }
        this.navigationService.OpenEntityRecord('MJ: Templates', CompositeKey.FromID(this.selectedTemplate.id));
        return { Success: true };
    }
    handleSelectRunTool(params) {
        const v = validateStringParam(params?.['run'], 'run');
        if (!v.ok) {
            return v.result;
        }
        if (!this.runsChild) {
            return { Success: false, ErrorMessage: 'The Runs tab is not open. Switch to the Runs tab first.' };
        }
        const candidates = this.runsChild.runs.map(r => ({ ID: r.ID, Name: this.runDisplayName(r.ID) }));
        const match = resolveCommunicationItem(v.value, candidates);
        if (!match) {
            return { Success: false, ErrorMessage: `No visible run matches "${v.value}".` };
        }
        this.selectedRun = { id: match.ID, name: match.Name };
        this.publishAgentContext();
        return { Success: true };
    }
    handleOpenRunTool(params) {
        const ref = typeof params?.['run'] === 'string' ? params['run'] : '';
        if (ref && this.runsChild) {
            const candidates = this.runsChild.runs.map(r => ({ ID: r.ID, Name: this.runDisplayName(r.ID) }));
            const match = resolveCommunicationItem(ref, candidates);
            if (match) {
                this.selectedRun = { id: match.ID, name: match.Name };
            }
        }
        if (!this.selectedRun) {
            return { Success: false, ErrorMessage: 'No run to open. Select a run first or pass an id / display label.' };
        }
        this.navigationService.OpenEntityRecord('MJ: Communication Runs', CompositeKey.FromID(this.selectedRun.id));
        return { Success: true };
    }
    static ɵfac = function CommunicationDashboardComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CommunicationDashboardComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
    static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CommunicationDashboardComponent, selectors: [["mj-communication-dashboard"]], viewQuery: function CommunicationDashboardComponent_Query(rf, ctx) { if (rf & 1) {
            i0.ɵɵviewQuery(CommunicationLogsResourceComponent, 5)(CommunicationProvidersResourceComponent, 5)(CommunicationTemplatesResourceComponent, 5)(CommunicationRunsResourceComponent, 5)(CommunicationMonitorResourceComponent, 5);
        } if (rf & 2) {
            let _t;
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.logsChild = _t.first);
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.providersChild = _t.first);
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.templatesChild = _t.first);
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.runsChild = _t.first);
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.monitorChild = _t.first);
        } }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 52, vars: 15, consts: [[1, "communication-dashboard-container"], [1, "studio-toolbar"], [1, "toolbar-brand"], [1, "brand-icon"], [1, "fa-solid", "fa-satellite-dish"], [1, "brand-label"], [1, "toolbar-divider"], [1, "toolbar-spacer"], [1, "tb-btn", 3, "click"], [1, "fa-solid", "fa-rotate"], [1, "dashboard-body"], [1, "sidebar"], [1, "sidebar-section-label"], [1, "nav-item", 3, "click"], [1, "fa-solid", "fa-chart-line"], [1, "fa-solid", "fa-list-ul"], [1, "fa-solid", "fa-server"], [1, "fa-solid", "fa-file-lines"], [1, "fa-solid", "fa-play-circle"], [1, "sidebar-footer"], [1, "fa-solid", "fa-gear"], [1, "main-content"], [1, "tab-container"], [1, "tab-content"]], template: function CommunicationDashboardComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "div", 0)(1, "div", 1)(2, "div", 2)(3, "div", 3);
            i0.ɵɵelement(4, "i", 4);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(5, "span", 5);
            i0.ɵɵtext(6, "Communications");
            i0.ɵɵelementEnd()();
            i0.ɵɵelement(7, "div", 6)(8, "div", 7);
            i0.ɵɵelementStart(9, "button", 8);
            i0.ɵɵlistener("click", function CommunicationDashboardComponent_Template_button_click_9_listener() { return ctx.onRefresh(); });
            i0.ɵɵelement(10, "i", 9);
            i0.ɵɵtext(11, " Refresh ");
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(12, "div", 10)(13, "div", 11)(14, "div", 12);
            i0.ɵɵtext(15, "Dashboard");
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(16, "div", 13);
            i0.ɵɵlistener("click", function CommunicationDashboardComponent_Template_div_click_16_listener() { return ctx.onTabChange("monitor"); });
            i0.ɵɵelement(17, "i", 14);
            i0.ɵɵelementStart(18, "span");
            i0.ɵɵtext(19, "Monitor");
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(20, "div", 13);
            i0.ɵɵlistener("click", function CommunicationDashboardComponent_Template_div_click_20_listener() { return ctx.onTabChange("logs"); });
            i0.ɵɵelement(21, "i", 15);
            i0.ɵɵelementStart(22, "span");
            i0.ɵɵtext(23, "Message Logs");
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(24, "div", 12);
            i0.ɵɵtext(25, "Configuration");
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(26, "div", 13);
            i0.ɵɵlistener("click", function CommunicationDashboardComponent_Template_div_click_26_listener() { return ctx.onTabChange("providers"); });
            i0.ɵɵelement(27, "i", 16);
            i0.ɵɵelementStart(28, "span");
            i0.ɵɵtext(29, "Providers");
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(30, "div", 13);
            i0.ɵɵlistener("click", function CommunicationDashboardComponent_Template_div_click_30_listener() { return ctx.onTabChange("templates"); });
            i0.ɵɵelement(31, "i", 17);
            i0.ɵɵelementStart(32, "span");
            i0.ɵɵtext(33, "Templates");
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(34, "div", 12);
            i0.ɵɵtext(35, "Operations");
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(36, "div", 13);
            i0.ɵɵlistener("click", function CommunicationDashboardComponent_Template_div_click_36_listener() { return ctx.onTabChange("runs"); });
            i0.ɵɵelement(37, "i", 18);
            i0.ɵɵelementStart(38, "span");
            i0.ɵɵtext(39, "Bulk Runs");
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(40, "div", 19)(41, "div", 13);
            i0.ɵɵlistener("click", function CommunicationDashboardComponent_Template_div_click_41_listener() { return ctx.onTabChange("settings"); });
            i0.ɵɵelement(42, "i", 20);
            i0.ɵɵelementStart(43, "span");
            i0.ɵɵtext(44, "Settings");
            i0.ɵɵelementEnd()()()();
            i0.ɵɵelementStart(45, "div", 21)(46, "div", 22);
            i0.ɵɵconditionalCreate(47, CommunicationDashboardComponent_Case_47_Template, 2, 1, "div", 23)(48, CommunicationDashboardComponent_Case_48_Template, 2, 1, "div", 23)(49, CommunicationDashboardComponent_Case_49_Template, 2, 1, "div", 23)(50, CommunicationDashboardComponent_Case_50_Template, 2, 1, "div", 23)(51, CommunicationDashboardComponent_Case_51_Template, 2, 1, "div", 23);
            i0.ɵɵelementEnd()()()();
        } if (rf & 2) {
            let tmp_7_0;
            i0.ɵɵadvance(10);
            i0.ɵɵclassProp("spinning", ctx.isRefreshing);
            i0.ɵɵadvance(6);
            i0.ɵɵclassProp("selected", ctx.activeTab === "monitor");
            i0.ɵɵadvance(4);
            i0.ɵɵclassProp("selected", ctx.activeTab === "logs");
            i0.ɵɵadvance(6);
            i0.ɵɵclassProp("selected", ctx.activeTab === "providers");
            i0.ɵɵadvance(4);
            i0.ɵɵclassProp("selected", ctx.activeTab === "templates");
            i0.ɵɵadvance(6);
            i0.ɵɵclassProp("selected", ctx.activeTab === "runs");
            i0.ɵɵadvance(5);
            i0.ɵɵclassProp("selected", ctx.activeTab === "settings");
            i0.ɵɵadvance(6);
            i0.ɵɵconditional((tmp_7_0 = ctx.activeTab) === "monitor" ? 47 : tmp_7_0 === "logs" ? 48 : tmp_7_0 === "providers" ? 49 : tmp_7_0 === "templates" ? 50 : tmp_7_0 === "runs" ? 51 : -1);
        } }, dependencies: [i1.CommunicationMonitorResourceComponent, i2.CommunicationLogsResourceComponent, i3.CommunicationProvidersResourceComponent, i4.CommunicationRunsResourceComponent, i5.CommunicationTemplatesResourceComponent], styles: [".communication-dashboard-container[_ngcontent-%COMP%] {\n    display: flex;\n    flex-direction: column;\n    height: 100%;\n    width: 100%;\n    background: var(--mj-bg-surface);\n    color: var(--mj-text-primary);\n    font-family: 'Inter', -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n    overflow: hidden;\n}\n\n\n\n.studio-toolbar[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    padding: 0 12px;\n    background: var(--mj-bg-surface-card);\n    border-bottom: 1px solid var(--mj-border-default);\n    min-height: 48px;\n    gap: 8px;\n    flex-shrink: 0;\n}\n\n.toolbar-brand[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 10px;\n    padding: 0 8px;\n}\n\n.brand-icon[_ngcontent-%COMP%] {\n    width: 32px;\n    height: 32px;\n    border-radius: 8px;\n    background: color-mix(in srgb, var(--mj-brand-primary) 15%, var(--mj-bg-surface));\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--mj-brand-primary);\n    font-size: 14px;\n}\n\n.brand-label[_ngcontent-%COMP%] {\n    font-weight: 700;\n    font-size: 14px;\n    color: var(--mj-text-primary);\n    letter-spacing: -0.01em;\n}\n\n.toolbar-divider[_ngcontent-%COMP%] {\n    width: 1px;\n    height: 24px;\n    background: var(--mj-border-default);\n    margin: 0 4px;\n}\n\n.toolbar-spacer[_ngcontent-%COMP%] {\n    flex: 1;\n}\n\n.tb-btn[_ngcontent-%COMP%] {\n    display: inline-flex;\n    align-items: center;\n    gap: 6px;\n    padding: 6px 12px;\n    border: 1px solid var(--mj-border-default);\n    border-radius: 4px;\n    background: var(--mj-bg-surface-card);\n    color: var(--mj-text-secondary);\n    font-size: 12px;\n    font-weight: 500;\n    cursor: pointer;\n    transition: all 0.15s ease;\n    font-family: inherit;\n}\n\n.tb-btn[_ngcontent-%COMP%]:hover {\n    background: var(--mj-bg-surface-sunken);\n    border-color: var(--mj-border-strong);\n    color: var(--mj-text-primary);\n}\n\n.tb-btn[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    font-size: 12px;\n}\n\n@keyframes _ngcontent-%COMP%_spin {\n    from { transform: rotate(0deg); }\n    to { transform: rotate(360deg); }\n}\n\n.spinning[_ngcontent-%COMP%] {\n    animation: _ngcontent-%COMP%_spin 1s linear infinite;\n}\n\n\n\n.dashboard-body[_ngcontent-%COMP%] {\n    display: flex;\n    flex: 1;\n    overflow: hidden;\n}\n\n\n\n.sidebar[_ngcontent-%COMP%] {\n    width: 220px;\n    background: var(--mj-bg-surface-card);\n    border-right: 1px solid var(--mj-border-default);\n    padding: 12px 8px;\n    display: flex;\n    flex-direction: column;\n    gap: 2px;\n    flex-shrink: 0;\n}\n\n.sidebar-section-label[_ngcontent-%COMP%] {\n    font-size: 10px;\n    font-weight: 700;\n    text-transform: uppercase;\n    letter-spacing: 0.8px;\n    color: var(--mj-text-muted);\n    padding: 12px 12px 6px;\n}\n\n.nav-item[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 10px;\n    padding: 10px 12px;\n    border-radius: 8px;\n    cursor: pointer;\n    transition: all 0.15s ease;\n    color: var(--mj-text-secondary);\n    font-size: 13px;\n    font-weight: 500;\n}\n\n.nav-item[_ngcontent-%COMP%]:hover {\n    background: var(--mj-bg-surface-sunken);\n    color: var(--mj-text-primary);\n}\n\n.nav-item.selected[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-brand-primary) 15%, var(--mj-bg-surface));\n    color: var(--mj-brand-primary);\n    font-weight: 600;\n}\n\n.nav-item[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    width: 18px;\n    text-align: center;\n    font-size: 13px;\n}\n\n.sidebar-footer[_ngcontent-%COMP%] {\n    margin-top: auto;\n    padding-top: 8px;\n    border-top: 1px solid var(--mj-border-default);\n}\n\n\n\n.main-content[_ngcontent-%COMP%] {\n    flex: 1;\n    overflow-y: auto;\n    overflow-x: hidden;\n    background: var(--mj-bg-surface);\n}\n\n.tab-container[_ngcontent-%COMP%] {\n    height: 100%;\n}\n\n.tab-content[_ngcontent-%COMP%] {\n    height: 100%;\n}"], changeDetection: 0 });
};
CommunicationDashboardComponent = __decorate([
    RegisterClass(BaseDashboard, 'CommunicationDashboard')
], CommunicationDashboardComponent);
export { CommunicationDashboardComponent };
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CommunicationDashboardComponent, [{
        type: Component,
        args: [{ standalone: false, selector: 'mj-communication-dashboard', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"communication-dashboard-container\">\n  <!-- TOOLBAR -->\n  <div class=\"studio-toolbar\">\n    <div class=\"toolbar-brand\">\n      <div class=\"brand-icon\"><i class=\"fa-solid fa-satellite-dish\"></i></div>\n      <span class=\"brand-label\">Communications</span>\n    </div>\n    <div class=\"toolbar-divider\"></div>\n    <div class=\"toolbar-spacer\"></div>\n    <button class=\"tb-btn\" (click)=\"onRefresh()\">\n      <i class=\"fa-solid fa-rotate\" [class.spinning]=\"isRefreshing\"></i> Refresh\n    </button>\n  </div>\n\n  <!-- BODY -->\n  <div class=\"dashboard-body\">\n    <!-- SIDEBAR -->\n    <div class=\"sidebar\">\n      <div class=\"sidebar-section-label\">Dashboard</div>\n      <div class=\"nav-item\" [class.selected]=\"activeTab === 'monitor'\"\n        (click)=\"onTabChange('monitor')\">\n        <i class=\"fa-solid fa-chart-line\"></i>\n        <span>Monitor</span>\n      </div>\n      <div class=\"nav-item\" [class.selected]=\"activeTab === 'logs'\"\n        (click)=\"onTabChange('logs')\">\n        <i class=\"fa-solid fa-list-ul\"></i>\n        <span>Message Logs</span>\n      </div>\n\n      <div class=\"sidebar-section-label\">Configuration</div>\n      <div class=\"nav-item\" [class.selected]=\"activeTab === 'providers'\"\n        (click)=\"onTabChange('providers')\">\n        <i class=\"fa-solid fa-server\"></i>\n        <span>Providers</span>\n      </div>\n      <div class=\"nav-item\" [class.selected]=\"activeTab === 'templates'\"\n        (click)=\"onTabChange('templates')\">\n        <i class=\"fa-solid fa-file-lines\"></i>\n        <span>Templates</span>\n      </div>\n\n      <div class=\"sidebar-section-label\">Operations</div>\n      <div class=\"nav-item\" [class.selected]=\"activeTab === 'runs'\"\n        (click)=\"onTabChange('runs')\">\n        <i class=\"fa-solid fa-play-circle\"></i>\n        <span>Bulk Runs</span>\n      </div>\n\n      <div class=\"sidebar-footer\">\n        <div class=\"nav-item\" [class.selected]=\"activeTab === 'settings'\"\n          (click)=\"onTabChange('settings')\">\n          <i class=\"fa-solid fa-gear\"></i>\n          <span>Settings</span>\n        </div>\n      </div>\n    </div>\n\n    <!-- MAIN CONTENT -->\n    <div class=\"main-content\">\n      <div class=\"tab-container\">\n        @switch (activeTab) {\n          @case ('monitor') {\n            <div class=\"tab-content\">\n              @if (hasVisited('monitor')) {\n                <mj-communication-monitor-resource></mj-communication-monitor-resource>\n              }\n            </div>\n          }\n          @case ('logs') {\n            <div class=\"tab-content\">\n              @if (hasVisited('logs')) {\n                <mj-communication-logs-resource></mj-communication-logs-resource>\n              }\n            </div>\n          }\n          @case ('providers') {\n            <div class=\"tab-content\">\n              @if (hasVisited('providers')) {\n                <mj-communication-providers-resource></mj-communication-providers-resource>\n              }\n            </div>\n          }\n          @case ('templates') {\n            <div class=\"tab-content\">\n              @if (hasVisited('templates')) {\n                <mj-communication-templates-resource></mj-communication-templates-resource>\n              }\n            </div>\n          }\n          @case ('runs') {\n            <div class=\"tab-content\">\n              @if (hasVisited('runs')) {\n                <mj-communication-runs-resource></mj-communication-runs-resource>\n              }\n            </div>\n          }\n        }\n      </div>\n    </div>\n  </div>\n</div>\n", styles: [".communication-dashboard-container {\n    display: flex;\n    flex-direction: column;\n    height: 100%;\n    width: 100%;\n    background: var(--mj-bg-surface);\n    color: var(--mj-text-primary);\n    font-family: 'Inter', -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n    overflow: hidden;\n}\n\n/* TOOLBAR */\n.studio-toolbar {\n    display: flex;\n    align-items: center;\n    padding: 0 12px;\n    background: var(--mj-bg-surface-card);\n    border-bottom: 1px solid var(--mj-border-default);\n    min-height: 48px;\n    gap: 8px;\n    flex-shrink: 0;\n}\n\n.toolbar-brand {\n    display: flex;\n    align-items: center;\n    gap: 10px;\n    padding: 0 8px;\n}\n\n.brand-icon {\n    width: 32px;\n    height: 32px;\n    border-radius: 8px;\n    background: color-mix(in srgb, var(--mj-brand-primary) 15%, var(--mj-bg-surface));\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    color: var(--mj-brand-primary);\n    font-size: 14px;\n}\n\n.brand-label {\n    font-weight: 700;\n    font-size: 14px;\n    color: var(--mj-text-primary);\n    letter-spacing: -0.01em;\n}\n\n.toolbar-divider {\n    width: 1px;\n    height: 24px;\n    background: var(--mj-border-default);\n    margin: 0 4px;\n}\n\n.toolbar-spacer {\n    flex: 1;\n}\n\n.tb-btn {\n    display: inline-flex;\n    align-items: center;\n    gap: 6px;\n    padding: 6px 12px;\n    border: 1px solid var(--mj-border-default);\n    border-radius: 4px;\n    background: var(--mj-bg-surface-card);\n    color: var(--mj-text-secondary);\n    font-size: 12px;\n    font-weight: 500;\n    cursor: pointer;\n    transition: all 0.15s ease;\n    font-family: inherit;\n}\n\n.tb-btn:hover {\n    background: var(--mj-bg-surface-sunken);\n    border-color: var(--mj-border-strong);\n    color: var(--mj-text-primary);\n}\n\n.tb-btn i {\n    font-size: 12px;\n}\n\n@keyframes spin {\n    from { transform: rotate(0deg); }\n    to { transform: rotate(360deg); }\n}\n\n.spinning {\n    animation: spin 1s linear infinite;\n}\n\n/* BODY LAYOUT */\n.dashboard-body {\n    display: flex;\n    flex: 1;\n    overflow: hidden;\n}\n\n/* SIDEBAR */\n.sidebar {\n    width: 220px;\n    background: var(--mj-bg-surface-card);\n    border-right: 1px solid var(--mj-border-default);\n    padding: 12px 8px;\n    display: flex;\n    flex-direction: column;\n    gap: 2px;\n    flex-shrink: 0;\n}\n\n.sidebar-section-label {\n    font-size: 10px;\n    font-weight: 700;\n    text-transform: uppercase;\n    letter-spacing: 0.8px;\n    color: var(--mj-text-muted);\n    padding: 12px 12px 6px;\n}\n\n.nav-item {\n    display: flex;\n    align-items: center;\n    gap: 10px;\n    padding: 10px 12px;\n    border-radius: 8px;\n    cursor: pointer;\n    transition: all 0.15s ease;\n    color: var(--mj-text-secondary);\n    font-size: 13px;\n    font-weight: 500;\n}\n\n.nav-item:hover {\n    background: var(--mj-bg-surface-sunken);\n    color: var(--mj-text-primary);\n}\n\n.nav-item.selected {\n    background: color-mix(in srgb, var(--mj-brand-primary) 15%, var(--mj-bg-surface));\n    color: var(--mj-brand-primary);\n    font-weight: 600;\n}\n\n.nav-item i {\n    width: 18px;\n    text-align: center;\n    font-size: 13px;\n}\n\n.sidebar-footer {\n    margin-top: auto;\n    padding-top: 8px;\n    border-top: 1px solid var(--mj-border-default);\n}\n\n/* MAIN CONTENT */\n.main-content {\n    flex: 1;\n    overflow-y: auto;\n    overflow-x: hidden;\n    background: var(--mj-bg-surface);\n}\n\n.tab-container {\n    height: 100%;\n}\n\n.tab-content {\n    height: 100%;\n}\n"] }]
    }], () => [{ type: i0.ChangeDetectorRef }], { logsChild: [{
            type: ViewChild,
            args: [CommunicationLogsResourceComponent]
        }], providersChild: [{
            type: ViewChild,
            args: [CommunicationProvidersResourceComponent]
        }], templatesChild: [{
            type: ViewChild,
            args: [CommunicationTemplatesResourceComponent]
        }], runsChild: [{
            type: ViewChild,
            args: [CommunicationRunsResourceComponent]
        }], monitorChild: [{
            type: ViewChild,
            args: [CommunicationMonitorResourceComponent]
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CommunicationDashboardComponent, { className: "CommunicationDashboardComponent", filePath: "src/Communication/communication-dashboard.component.ts", lineNumber: 61 }); })();
//# sourceMappingURL=communication-dashboard.component.js.map