import { OnInit, OnDestroy, ChangeDetectorRef } from '@angular/core';
import { BaseResourceComponent } from '@memberjunction/ng-shared';
import { ResourceData, MJDashboardEntity, MJDashboardCategoryEntity, MJDashboardPartTypeEntity, DashboardUserPermissions } from '@memberjunction/core-entities';
import { ShareDialogResult } from './dashboard-share-dialog.component';
import { DashboardViewerComponent, DashboardNavRequestEvent, PanelInteractionEvent, AddPanelResult, DashboardPanel, EditPartDialogResult, DashboardOpenEvent, DashboardEditEvent, DashboardDeleteEvent, DashboardMoveEvent, DashboardCreateEvent, CategoryCreateEvent, CategoryDeleteEvent, CategoryChangeEvent, ViewPreferenceChangeEvent, DashboardBrowserViewMode, BreadcrumbNavigateEvent } from '@memberjunction/ng-dashboard-viewer';
import * as i0 from "@angular/core";
/**
 * Mode for the dashboard browser
 */
type BrowserMode = 'list' | 'view' | 'edit';
/**
 * Resource component for browsing, creating, and editing dashboards.
 * Uses the generic DashboardBrowserComponent for list mode and handles
 * view/edit mode internally with routing integration.
 */
export declare class DashboardBrowserResourceComponent extends BaseResourceComponent implements OnInit, OnDestroy {
    private cdr;
    mode: BrowserMode;
    isLoading: boolean;
    dashboards: MJDashboardEntity[];
    categories: MJDashboardCategoryEntity[];
    selectedDashboard: MJDashboardEntity | null;
    selectedCategoryId: string | null;
    viewMode: DashboardBrowserViewMode;
    showAddPanelDialog: boolean;
    /**
     * Free-text search the agent has applied to the dashboard list (via the
     * SearchDashboards tool). Reported in the agent context so the agent knows
     * how the visible list is currently narrowed; cleared by ClearDashboardFilters.
     */
    private agentSearchText;
    /**
     * Which tool-set ('list' vs 'open') is currently registered with the agent.
     * The Dashboard Browser exposes different tools depending on whether the user
     * is browsing the list or has a dashboard open (mirrors the Data Explorer's
     * mode-scoped tools). We only re-register on the flip — see
     * {@link syncAgentToolsForMode}.
     */
    private lastRegisteredToolMode;
    showConfigDialog: boolean;
    configDialogPanel: DashboardPanel | null;
    configDialogPartType: MJDashboardPartTypeEntity | null;
    configDialogClass: string;
    showConfirmDialog: boolean;
    confirmPanelId: string;
    confirmPanelTitle: string;
    showShareDialog: boolean;
    editingName: string;
    editingDescription: string;
    private originalName;
    private originalDescription;
    private originalConfig;
    selectedDashboardPermissions: DashboardUserPermissions;
    dashboardPermissionsMap: Map<string, DashboardUserPermissions>;
    effectiveCategoryMap: Map<string, string | null>;
    private _pendingQueryParams;
    dashboardViewer: DashboardViewerComponent;
    constructor(cdr: ChangeDetectorRef);
    ngOnInit(): void;
    ngOnDestroy(): void;
    /**
     * React to query-param changes from browser back/forward, deep links, and Home
     * pin navigation. Driven by BaseResourceComponent's reactive tab-param stream,
     * which reaches this component even when it's cached/detached — the path the old
     * ActivatedRoute subscription could not reliably cover.
     */
    protected OnQueryParamsChanged(params: Record<string, string>, _source: 'popstate' | 'deeplink'): void;
    /**
     * Open/close the dashboard to match the `dashboard` query param. Requires the
     * dashboard list to be loaded. URL pushes from openDashboard()/backToList() are
     * auto-suppressed while delivering, so this reflects URL → state without looping.
     */
    private applyDashboardSelectionFromParams;
    GetResourceDisplayName(data: ResourceData): Promise<string>;
    GetResourceIconClass(data: ResourceData): Promise<string>;
    /**
     * Report the current browser state to the AI agent (async chat agent and
     * realtime co-agent). Re-emit whenever mode, selection, category filter,
     * view mode, or loading state changes.
     */
    private emitAgentContext;
    /**
     * Read the panels/widgets on the currently-open dashboard from the viewer.
     *
     * The viewer holds the live `DashboardConfig` whose `layout` embeds each
     * panel in Golden Layout's componentState; {@link extractPanelsFromLayout}
     * pulls them out. We resolve each panel's part-type name via the viewer's
     * `getPartTypeForPanel`. Tolerant by design — if the viewer isn't mounted
     * yet (e.g. context emitted before @ViewChild resolves) we return an empty
     * list rather than throwing.
     *
     * @returns a descriptive panel summary list (never null)
     */
    private readOpenedDashboardPanels;
    /**
     * The total number of dashboards accessible to the current user, independent
     * of any in-memory search narrowing the agent has applied. `this.dashboards`
     * shrinks when SearchDashboards filters it, so we read the unfiltered count
     * straight from the engine to keep TotalDashboardCount honest.
     */
    private get TotalAccessibleDashboardCount();
    /**
     * Re-register the agent client tools when the effective tool-mode flips.
     *
     * The Dashboard Browser surfaces different tools depending on whether the
     * user is browsing the list ('list') or has a dashboard open ('open' — the
     * view/edit modes collapse to one tool-mode here). We compute the effective
     * mode, and only when it differs from {@link lastRegisteredToolMode} do we
     * call `SetAgentClientTools` with `[...common, ...(list ? list : open)]`.
     * Guarding on the flip avoids re-registering on every context emission.
     *
     * Mirrors the Data Explorer's mode-scoped tool approach.
     */
    private syncAgentToolsForMode;
    /**
     * Tools available in BOTH modes — find, switch to, and reload dashboards.
     * OpenDashboard stays available while viewing so the agent can switch to
     * another dashboard without first going back to the list.
     */
    private commonTools;
    /**
     * Tools available only while browsing the LIST — category filtering, clear
     * filters, and view-mode toggling. These have no meaning while a single
     * dashboard is open, so they're scoped out of the OPEN tool-set.
     */
    private listModeTools;
    /**
     * Tools available only while a dashboard is OPEN (view/edit) — go back to
     * the list, inspect the open dashboard's panels, and read its detail
     * (owner, dates, access level). Scoped out of the LIST tool-set because
     * there's no open dashboard there.
     */
    private openModeTools;
    /**
     * Filter the dashboard list by a text query against name + description.
     * The generic browser owns the category/view chrome; this surfaces a
     * name/description filter via the same selected-category mechanism is not
     * applicable, so we narrow the in-memory list the browser renders.
     */
    private AgentSearchDashboards;
    /**
     * Apply a category filter by NAME or ID (empty string clears it) and return
     * to the list. Resolves a supplied name (case-insensitive) to its id against
     * the loaded, accessible category list — mirroring the Data Explorer's
     * SelectView name→id resolution.
     */
    private AgentSelectCategory;
    /** Clear both the text search and the category filter, returning to the full root list. */
    private AgentClearDashboardFilters;
    /**
     * Open a dashboard for inline viewing by NAME or ID. Resolves a supplied name
     * (case-insensitive) to its dashboard against the loaded, accessible list —
     * mirroring the Data Explorer's SelectView name→id resolution.
     */
    private AgentOpenDashboard;
    /** Switch and persist the list view mode (cards | list). */
    private AgentSwitchViewMode;
    /**
     * Resolve an optional `dashboardId` tool param (ID **or** name, or omitted)
     * to a concrete accessible dashboard. When omitted/empty, defaults to the
     * currently-open dashboard. Returns null with a tolerant error result when
     * nothing matches.
     */
    private resolveDashboardForTool;
    /**
     * Return the panel list for the open (or named) dashboard. For the open
     * dashboard we read live panels from the viewer; for another dashboard we
     * parse its persisted UIConfigDetails. Read-only.
     */
    private AgentGetDashboardPanels;
    /**
     * Parse a dashboard's persisted UIConfigDetails into a descriptive panel
     * summary list, resolving each panel's part-type name from the engine's
     * cached part types. Tolerant — returns [] on missing/invalid config.
     */
    private readPanelsFromPersistedConfig;
    /**
     * Return owner / dates / category / access-level detail for the open (or
     * named) dashboard. Access level comes from the DashboardEngine permissions
     * already computed by the browser. Read-only.
     */
    private AgentGetDashboardDetail;
    /**
     * Return the accessible category tree (name, ID, parent ID, and per-category
     * count of accessible dashboards filed directly under it). Read-only.
     */
    private AgentGetCategoryHierarchy;
    /**
     * Return who a dashboard is shared with and their access level. Uses
     * DashboardEngine.GetDashboardShares (the real method) over the cached
     * permission records. Returns no secrets. Read-only.
     */
    private AgentGetDashboardShares;
    /** Format a date to ISO, tolerant of null/invalid values. */
    private toIsoOrNull;
    /**
     * Handle dashboard open request from generic browser
     */
    onDashboardOpen(event: DashboardOpenEvent): void;
    /**
     * Open the current dashboard in its own dedicated Explorer tab
     */
    openInNewTab(): void;
    /**
     * Handle dashboard edit request from generic browser
     */
    onDashboardEdit(event: DashboardEditEvent): void;
    /**
     * Handle dashboard delete request from generic browser
     */
    onDashboardDelete(event: DashboardDeleteEvent): Promise<void>;
    /**
     * Handle dashboard move request from generic browser.
     * For owned dashboards: updates the dashboard's CategoryID directly.
     * For shared dashboards: creates/updates a DashboardCategoryLink to organize without modifying the original.
     */
    onDashboardMove(event: DashboardMoveEvent): Promise<void>;
    /**
     * Handle create dashboard request from generic browser
     */
    onDashboardCreate(event: DashboardCreateEvent): Promise<void>;
    /**
     * Handle category change from generic browser - update URL
     */
    onCategoryChange(event: CategoryChangeEvent): void;
    /**
     * Handle view preference change from generic browser - persist
     */
    onViewPreferenceChange(event: ViewPreferenceChangeEvent): void;
    /**
     * Handle category create request from generic browser
     * Includes extensive logging for debugging category creation issues
     */
    onCategoryCreate(event: CategoryCreateEvent): Promise<void>;
    /**
     * Handle category delete request from generic browser
     * Performs recursive deletion of category and all children
     */
    onCategoryDelete(event: CategoryDeleteEvent): Promise<void>;
    /**
     * Handle breadcrumb navigation event
     * Navigates back to list view with optional category selection
     */
    onBreadcrumbNavigate(event: BreadcrumbNavigateEvent): void;
    /**
     * Open a dashboard for viewing
     */
    openDashboard(dashboard: MJDashboardEntity): void;
    /**
     * Open a dashboard for editing
     */
    editDashboard(dashboard: MJDashboardEntity): void;
    /**
     * Go back to list view
     */
    backToList(): void;
    /**
     * Toggle edit mode for current dashboard
     */
    toggleEditMode(): void;
    /**
     * Open the share dialog for the current dashboard
     */
    openShareDialog(): void;
    /**
     * Close the share dialog
     */
    closeShareDialog(): void;
    /**
     * Handle share dialog result
     */
    onShareDialogResult(result: ShareDialogResult): void;
    /**
     * Create a new dashboard
     */
    createDashboard(categoryId?: string | null): Promise<void>;
    /**
     * Save the current dashboard
     */
    saveDashboard(): Promise<void>;
    /**
     * Cancel editing and revert changes
     */
    cancelEdit(): void;
    /**
     * Handle name input blur - validate name is not empty
     */
    onNameBlur(): void;
    /**
     * Open the Add Part dialog
     */
    openAddPartDialog(): void;
    /**
     * Handle panel interaction events from the viewer
     */
    onPanelInteraction(event: PanelInteractionEvent): void;
    /**
     * Handle navigation events from panels
     */
    onNavigationRequested(event: DashboardNavRequestEvent): void;
    /**
     * Resolve an application name to its ID
     */
    private resolveAppId;
    /**
     * Handle add panel dialog result
     */
    onPanelAdded(result: AddPanelResult): Promise<void>;
    /**
     * Handle add panel dialog cancel
     */
    onAddPanelCancelled(): void;
    /**
     * Open the config dialog for a panel
     */
    openConfigDialog(panelId: string): void;
    /**
     * Handle config dialog save
     */
    onConfigDialogSaved(result: EditPartDialogResult): void;
    /**
     * Handle config dialog cancel
     */
    onConfigDialogCancelled(): void;
    /**
     * Close the config dialog
     */
    private closeConfigDialog;
    /**
     * Open the remove confirmation dialog
     */
    openRemoveConfirmDialog(panelId: string, panelTitle: string): void;
    /**
     * Handle remove confirmation
     */
    onRemoveConfirmed(): void;
    /**
     * Handle remove cancel
     */
    onRemoveCancelled(): void;
    /**
     * Close the remove confirm dialog
     */
    private closeRemoveConfirmDialog;
    private loadDashboards;
    /**
     * Update the URL query params for the current tab.
     * Routes through BaseResourceComponent.UpdateQueryParams, which updates the tab
     * configuration (triggering the shell's URL sync while respecting app-scoped
     * routes) and is auto-suppressed while delivering OnQueryParamsChanged so
     * reflecting URL → state never loops back into a redundant URL push.
     */
    private updateUrlQueryParams;
    /**
     * Get all child categories of a parent category recursively
     */
    private getChildCategoriesRecursive;
    private loadViewPreference;
    private saveViewPreference;
    static ɵfac: i0.ɵɵFactoryDeclaration<DashboardBrowserResourceComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<DashboardBrowserResourceComponent, "mj-dashboard-browser-resource", never, {}, {}, never, never, false, never>;
}
export {};
//# sourceMappingURL=dashboard-browser-resource.component.d.ts.map