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, ViewChild } from '@angular/core';
import { BaseDashboard } from '@memberjunction/ng-shared';
import { RegisterClass, UUIDsEqual } from '@memberjunction/global';
import { CompositeKey } from '@memberjunction/core';
import { Subject } from 'rxjs';
import { debounceTime } from 'rxjs/operators';
import { UserInfoEngine } from '@memberjunction/core-entities';
import { buildEntityAdminAgentContext, buildEntityNotFoundError, entityDisplayName, resolveEntityByIdOrName, } from './entity-admin-agent-context';
import { validateStringParam } from '../shared/agent-tool-validation';
import * as i0 from "@angular/core";
import * as i1 from "@memberjunction/ng-ui-components";
import * as i2 from "@memberjunction/ng-shared-generic";
import * as i3 from "@memberjunction/ng-entity-relationship-diagram";
const _c0 = ["erdComposite"];
function EntityAdminDashboardComponent_Conditional_10_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 9);
    i0.ɵɵelement(1, "mj-loading", 12);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance();
    i0.ɵɵproperty("text", ctx_r0.loadingMessage);
} }
function EntityAdminDashboardComponent_Conditional_11_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 10)(1, "p", 13);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r0.error);
} }
function EntityAdminDashboardComponent_Conditional_12_Template(rf, ctx) { if (rf & 1) {
    const _r2 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 11)(1, "mj-erd-composite", 14, 0);
    i0.ɵɵlistener("stateChange", function EntityAdminDashboardComponent_Conditional_12_Template_mj_erd_composite_stateChange_1_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.onStateChange($event)); })("userStateChange", function EntityAdminDashboardComponent_Conditional_12_Template_mj_erd_composite_userStateChange_1_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.onUserStateChange($event)); })("entityOpened", function EntityAdminDashboardComponent_Conditional_12_Template_mj_erd_composite_entityOpened_1_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.onEntityOpened($event)); })("openRecord", function EntityAdminDashboardComponent_Conditional_12_Template_mj_erd_composite_openRecord_1_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.onOpenRecord($event)); });
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance();
    i0.ɵɵproperty("isRefreshingERD", ctx_r0.isRefreshingERD);
} }
/** Settings key for ERD state persistence */
const ERD_SETTINGS_KEY = 'MJ.Admin.Entity.ERD';
let EntityAdminDashboardComponent = class EntityAdminDashboardComponent extends BaseDashboard {
    erdComposite;
    isLoading = false;
    isRefreshingERD = false;
    loadingMessage = '';
    error = null;
    // Filter panel visibility for header controls
    filterPanelVisible = true;
    selectedEntity = null;
    filteredEntities = [];
    /** Total unfiltered entity count — feeds the chrome's X-of-Y badge. */
    get TotalEntityCount() {
        return this.erdComposite?.entities?.length ?? 0;
    }
    // State management
    userStateChangeSubject = new Subject();
    hasLoadedUserState = false;
    metadata = this.ProviderToUse;
    userSettingEntity = null;
    ngAfterViewInit() {
        // Setup debounced state persistence to MJ: User Settings
        this.userStateChangeSubject.pipe(debounceTime(1000)).subscribe(state => {
            this.saveStateToUserSettings(state);
        });
        // Publish the initial agent context and register the (read-only) client tools
        // the AI agent can invoke against this surface. Ongoing re-emit happens in
        // onStateChange (every ERD state change).
        this.publishAgentContext();
        this.registerAgentClientTools();
    }
    async GetResourceDisplayName(data) {
        return "Entity Administration";
    }
    ngOnDestroy() {
        this.userStateChangeSubject.complete();
        super.ngOnDestroy();
    }
    initDashboard() {
        // Initialize dashboard - called by BaseDashboard
    }
    loadData() {
        // Data loading is handled by ERDCompositeComponent
    }
    toggleFilterPanel() {
        this.filterPanelVisible = !this.filterPanelVisible;
        if (this.erdComposite) {
            this.erdComposite.onToggleFilterPanel();
        }
    }
    onStateChange(state) {
        // Update local state to keep header controls in sync
        this.filterPanelVisible = state.filterPanelVisible;
        this.filteredEntities = this.erdComposite?.filteredEntities || [];
        if (state.selectedEntityId && this.erdComposite) {
            this.selectedEntity = this.erdComposite.entities.find(e => UUIDsEqual(e.ID, state.selectedEntityId)) || null;
        }
        else {
            this.selectedEntity = null;
        }
        // Load user state when data becomes available for the first time
        if (this.erdComposite?.isDataLoaded && !this.hasLoadedUserState) {
            this.hasLoadedUserState = true;
            this.loadStateFromUserSettings();
        }
        // Keep the AI agent's view of this surface in sync with every ERD state change
        // (entity selection, filter panel visibility, filtered count, etc.).
        this.publishAgentContext();
    }
    onUserStateChange(state) {
        // Queue state for debounced persistence
        this.userStateChangeSubject.next(state);
    }
    onEntityOpened(entity) {
        this.openEntity(entity);
    }
    onOpenRecord(event) {
        this.OpenEntityRecord.emit({
            EntityName: event.EntityName,
            RecordPKey: new CompositeKey([{ FieldName: 'ID', Value: event.RecordID }])
        });
    }
    openEntity(entity) {
        this.Interaction.emit({
            type: 'openEntity',
            entity: entity,
            data: { entityId: entity.ID, entityName: entity.Name }
        });
    }
    /**
     * Load ERD state from MJ: User Settings entity using UserInfoEngine for cached access
     */
    async loadStateFromUserSettings() {
        try {
            const userId = this.metadata.CurrentUser?.ID;
            if (!userId) {
                this.NotifyLoadComplete();
                return;
            }
            const engine = UserInfoEngine.Instance;
            // Find setting from cached user settings
            const setting = engine.UserSettings.find(s => s.Setting === ERD_SETTINGS_KEY);
            if (setting) {
                this.userSettingEntity = setting;
                if (this.userSettingEntity.Value) {
                    const savedState = JSON.parse(this.userSettingEntity.Value);
                    if (this.erdComposite) {
                        this.erdComposite.loadUserState(savedState);
                    }
                }
            }
            this.NotifyLoadComplete();
        }
        catch (error) {
            console.warn('Failed to load ERD state from User Settings:', error);
            this.NotifyLoadComplete();
        }
    }
    /**
     * Save ERD state to MJ: User Settings entity using UserInfoEngine for cached lookup
     */
    async saveStateToUserSettings(state) {
        try {
            const userId = this.metadata.CurrentUser?.ID;
            if (!userId)
                return;
            // Find existing setting from cached user settings if not already loaded
            if (!this.userSettingEntity) {
                const engine = UserInfoEngine.Instance;
                const setting = engine.UserSettings.find(s => s.Setting === ERD_SETTINGS_KEY);
                if (setting) {
                    this.userSettingEntity = setting;
                }
                else {
                    this.userSettingEntity = await this.metadata.GetEntityObject('MJ: User Settings');
                    this.userSettingEntity.UserID = userId;
                    this.userSettingEntity.Setting = ERD_SETTINGS_KEY;
                }
            }
            // Save the state as JSON
            this.userSettingEntity.Value = JSON.stringify(state);
            await this.userSettingEntity.Save();
        }
        catch (error) {
            console.warn('Failed to save ERD state to User Settings:', error);
        }
    }
    // ========================================
    // AI AGENT CONTEXT & CLIENT TOOLS
    //
    // 🔒 SAFETY BOUNDARY: The Entity Admin surface is a metadata BROWSER (the ERD
    // entity explorer). The context published and the tools registered below are
    // STRICTLY READ-ONLY / NAVIGATIONAL — select/clear an entity, toggle the filter
    // panel, refresh the diagram. NO tool here (and none added in future) may edit,
    // create, or delete entity metadata, alter schema, or perform any other mutation.
    // The agent browses; the user makes changes from the dedicated entity forms.
    // ========================================
    /**
     * Publish the current Entity Admin ERD-browser state to the AI agent via
     * NavigationService. Reports — at Data-Explorer depth — the entity counts (total +
     * filtered), the active filter values (schema / search / status), the current
     * selection (id + registered name + DISPLAY name + schema + description + field count
     * + a bounded relationship summary), filter-panel visibility, a bounded list of
     * available entity DISPLAY names, and the schema-grouping landscape. The shaping lives
     * in the pure {@link buildEntityAdminAgentContext} helper so it stays unit-testable.
     * Called on init (ngAfterViewInit) and on every ERD state change (onStateChange).
     */
    publishAgentContext() {
        const filters = this.erdComposite?.filters;
        const context = buildEntityAdminAgentContext({
            TotalEntityCount: this.TotalEntityCount,
            FilteredEntityCount: this.filteredEntities.length,
            SelectedEntityId: this.selectedEntity?.ID ?? null,
            SelectedEntityName: this.selectedEntity?.Name ?? null,
            SelectedEntityDisplayName: this.selectedEntity
                ? entityDisplayName(this.selectedEntity.Name, this.selectedEntity.DisplayName)
                : null,
            SelectedEntitySchema: this.selectedEntity?.SchemaName ?? null,
            SelectedEntityDescription: this.selectedEntity?.Description ?? null,
            SelectedEntityFieldCount: this.selectedEntity?.Fields?.length ?? null,
            RelatedEntities: this.buildRelatedEntitySummaries(),
            FilterPanelVisible: this.filterPanelVisible,
            SchemaFilter: filters?.schemaName ?? null,
            SearchText: filters?.entityName ?? '',
            StatusFilter: filters?.entityStatus ?? null,
            AvailableEntityNames: this.filteredEntities.map(e => entityDisplayName(e.Name, e.DisplayName)),
            SchemaGroups: this.buildSchemaGroupSummaries(),
        });
        this.navigationService.SetAgentContext(this, context);
    }
    /** Related-entity summaries for the selected entity (display name + relationship type). */
    buildRelatedEntitySummaries() {
        if (!this.selectedEntity) {
            return [];
        }
        return this.selectedEntity.RelatedEntities.map(re => ({
            Name: re.RelatedEntity ?? re.RelatedEntityID ?? '(unknown)',
            RelationshipType: re.Type ?? 'Related',
        }));
    }
    /** Schema-grouping summaries across the currently-visible (filtered) entities. */
    buildSchemaGroupSummaries() {
        const counts = new Map();
        for (const e of this.filteredEntities) {
            const schema = e.SchemaName || '(no schema)';
            counts.set(schema, (counts.get(schema) ?? 0) + 1);
        }
        return Array.from(counts.entries())
            .map(([SchemaName, EntityCount]) => ({ SchemaName, EntityCount }))
            .sort((a, b) => b.EntityCount - a.EntityCount);
    }
    /** The ERD's loaded entities, narrowed to the resolver's structural shape. */
    get entityCandidates() {
        return this.erdComposite?.entities ?? [];
    }
    /**
     * Register the (read-only / navigational) client tools the AI agent can invoke
     * against the Entity Admin ERD. Each handler delegates to the same component or
     * ERD method a user interaction would call, and returns `{ Success: true }` on
     * success or `{ Success: false, ErrorMessage }` on failure. Handlers never throw.
     *
     * Tools (browse only — see SAFETY BOUNDARY above):
     * - SelectEntity: select/focus an entity by its ID, registered Name, or DISPLAY name.
     * - ToggleFilterPanel: show/hide the ERD filter panel.
     * - ClearEntitySelection: deselect the currently selected entity.
     * - RefreshERD: re-render the ERD diagram.
     * - FilterEntities: narrow the ERD by schema and/or a name search.
     * - NavigateToEntityRecord: open an entity's record list/view (read-only navigation).
     */
    registerAgentClientTools() {
        this.navigationService.SetAgentClientTools(this, [
            {
                Name: 'SelectEntity',
                Description: 'Select and focus an entity in the ERD by its ID, registered name, or the display name shown on screen (e.g. "AI Models" rather than "MJ: AI Models"). Read-only — opens nothing for edit.',
                ParameterSchema: { type: 'object', properties: { entity: { type: 'string', description: 'Entity ID, registered name, or display name.' } }, required: ['entity'] },
                Handler: async (params) => this.toolSelectEntity(params),
            },
            {
                Name: 'ToggleFilterPanel',
                Description: 'Show or hide the ERD entity filter panel.',
                ParameterSchema: { type: 'object', properties: {} },
                Handler: async () => {
                    this.toggleFilterPanel();
                    this.publishAgentContext();
                    return { Success: true };
                },
            },
            {
                Name: 'ClearEntitySelection',
                Description: 'Clear the currently selected entity in the ERD.',
                ParameterSchema: { type: 'object', properties: {} },
                Handler: async () => this.toolClearEntitySelection(),
            },
            {
                Name: 'RefreshERD',
                Description: 'Re-render the ERD diagram (no data is modified).',
                ParameterSchema: { type: 'object', properties: {} },
                Handler: async () => this.toolRefreshERD(),
            },
            {
                Name: 'FilterEntities',
                Description: 'Narrow the entities shown in the ERD by schema name and/or an entity-name search. Pass an empty string for a field to clear it; pass neither to reset all filters. No data is modified.',
                ParameterSchema: {
                    type: 'object',
                    properties: {
                        schema: { type: 'string', description: 'Schema name to filter by (empty string clears it).' },
                        search: { type: 'string', description: 'Entity-name search text (empty string clears it).' },
                    },
                },
                Handler: async (params) => this.toolFilterEntities(params),
            },
            {
                Name: 'NavigateToEntityRecord',
                Description: 'Open the record list / data view for an entity (by ID, registered name, or display name) for viewing. Read-only navigation — opens nothing for edit and creates no records.',
                ParameterSchema: { type: 'object', properties: { entity: { type: 'string', description: 'Entity ID, registered name, or display name.' } }, required: ['entity'] },
                Handler: async (params) => this.toolNavigateToEntityRecord(params),
            },
        ]);
    }
    /** Resolve an entity by ID / registered name / display name and select/focus it. */
    toolSelectEntity(params) {
        const validated = validateStringParam(params['entity'], 'entity');
        if (!validated.ok) {
            return validated.result;
        }
        if (!this.erdComposite) {
            return { Success: false, ErrorMessage: 'The ERD is not ready yet.' };
        }
        const candidates = this.entityCandidates;
        const match = resolveEntityByIdOrName(validated.value, candidates);
        if (!match) {
            return { Success: false, ErrorMessage: buildEntityNotFoundError(validated.value, candidates) };
        }
        const entity = this.erdComposite.entities.find(e => UUIDsEqual(e.ID, match.ID));
        if (!entity) {
            return { Success: false, ErrorMessage: buildEntityNotFoundError(validated.value, candidates) };
        }
        this.erdComposite.onEntitySelected(entity);
        return { Success: true, ErrorMessage: undefined };
    }
    /** Deselect the currently selected entity in the ERD. */
    toolClearEntitySelection() {
        if (!this.erdComposite) {
            return { Success: false, ErrorMessage: 'The ERD is not ready yet.' };
        }
        this.erdComposite.onEntityDeselected();
        return { Success: true };
    }
    /** Re-render the ERD diagram. */
    toolRefreshERD() {
        if (!this.erdComposite) {
            return { Success: false, ErrorMessage: 'The ERD is not ready yet.' };
        }
        this.erdComposite.refreshERD();
        return { Success: true };
    }
    /** Narrow the ERD by schema and/or a name search (read-only — only changes what's shown). */
    toolFilterEntities(params) {
        if (!this.erdComposite) {
            return { Success: false, ErrorMessage: 'The ERD is not ready yet.' };
        }
        const schemaRaw = params['schema'];
        const searchRaw = params['search'];
        // Neither provided → reset all filters.
        if (schemaRaw === undefined && searchRaw === undefined) {
            this.erdComposite.onResetFilters();
            this.publishAgentContext();
            return { Success: true };
        }
        const next = { ...this.erdComposite.filters };
        if (schemaRaw !== undefined) {
            const validated = validateStringParam(schemaRaw, 'schema');
            if (!validated.ok) {
                return validated.result;
            }
            const schema = validated.value.trim();
            // Tolerant case-insensitive match against the known schemas; empty clears it.
            if (!schema) {
                next.schemaName = null;
            }
            else {
                const known = Array.from(new Set(this.entityCandidates.map(e => e.SchemaName).filter((s) => !!s)));
                const resolved = known.find(s => s.toLowerCase() === schema.toLowerCase());
                if (!resolved) {
                    return { Success: false, ErrorMessage: `No schema matches "${schema}". Available schemas: ${known.join(', ') || '(none)'}.` };
                }
                next.schemaName = resolved;
            }
        }
        if (searchRaw !== undefined) {
            const validated = validateStringParam(searchRaw, 'search');
            if (!validated.ok) {
                return validated.result;
            }
            next.entityName = validated.value;
        }
        this.erdComposite.onFiltersChange(next);
        this.publishAgentContext();
        return { Success: true };
    }
    /** Open an entity's record list / data view for viewing (read-only navigation). */
    toolNavigateToEntityRecord(params) {
        const validated = validateStringParam(params['entity'], 'entity');
        if (!validated.ok) {
            return validated.result;
        }
        const candidates = this.entityCandidates;
        const match = resolveEntityByIdOrName(validated.value, candidates);
        if (!match) {
            return { Success: false, ErrorMessage: buildEntityNotFoundError(validated.value, candidates) };
        }
        // Open the entity's dynamic record view (read-only navigation — no edit, no create).
        this.navigationService.OpenDynamicView(match.Name);
        return { Success: true };
    }
    static ɵfac = /*@__PURE__*/ (() => { let ɵEntityAdminDashboardComponent_BaseFactory; return function EntityAdminDashboardComponent_Factory(__ngFactoryType__) { return (ɵEntityAdminDashboardComponent_BaseFactory || (ɵEntityAdminDashboardComponent_BaseFactory = i0.ɵɵgetInheritedFactory(EntityAdminDashboardComponent)))(__ngFactoryType__ || EntityAdminDashboardComponent); }; })();
    static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: EntityAdminDashboardComponent, selectors: [["mj-entity-admin-dashboard"]], viewQuery: function EntityAdminDashboardComponent_Query(rf, ctx) { if (rf & 1) {
            i0.ɵɵviewQuery(_c0, 5);
        } if (rf & 2) {
            let _t;
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.erdComposite = _t.first);
        } }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 13, vars: 8, consts: [["erdComposite", ""], ["Title", "Entity Admin", "Icon", "fa-solid fa-database", "Subtitle", "Browse and configure entity definitions"], ["meta", ""], ["Label", "entities", 3, "Count", "Total"], ["actions", ""], ["mjButton", "", "size", "sm", "title", "Toggle Filters", 3, "click", "variant"], [1, "fa-solid", "fa-filter"], [1, "action-btn-label"], [3, "Flex", "Padding"], [1, "loading-container"], [1, "error-container"], [1, "dashboard-content"], ["size", "large", 3, "text"], [1, "error-message"], [3, "stateChange", "userStateChange", "entityOpened", "openRecord", "isRefreshingERD"]], template: function EntityAdminDashboardComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "mj-page-layout")(1, "mj-page-header", 1)(2, "div", 2);
            i0.ɵɵelement(3, "mj-stat-badge", 3);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(4, "div", 4)(5, "button", 5);
            i0.ɵɵlistener("click", function EntityAdminDashboardComponent_Template_button_click_5_listener() { return ctx.toggleFilterPanel(); });
            i0.ɵɵelement(6, "i", 6);
            i0.ɵɵelementStart(7, "span", 7);
            i0.ɵɵtext(8, "Filters");
            i0.ɵɵelementEnd()()()();
            i0.ɵɵelementStart(9, "mj-page-body", 8);
            i0.ɵɵconditionalCreate(10, EntityAdminDashboardComponent_Conditional_10_Template, 2, 1, "div", 9);
            i0.ɵɵconditionalCreate(11, EntityAdminDashboardComponent_Conditional_11_Template, 3, 1, "div", 10);
            i0.ɵɵconditionalCreate(12, EntityAdminDashboardComponent_Conditional_12_Template, 3, 1, "div", 11);
            i0.ɵɵelementEnd()();
        } if (rf & 2) {
            i0.ɵɵadvance(3);
            i0.ɵɵproperty("Count", ctx.filteredEntities.length)("Total", ctx.TotalEntityCount);
            i0.ɵɵadvance(2);
            i0.ɵɵproperty("variant", ctx.filterPanelVisible ? "primary" : "secondary");
            i0.ɵɵadvance(4);
            i0.ɵɵproperty("Flex", true)("Padding", false);
            i0.ɵɵadvance();
            i0.ɵɵconditional(ctx.isLoading ? 10 : -1);
            i0.ɵɵadvance();
            i0.ɵɵconditional(ctx.error ? 11 : -1);
            i0.ɵɵadvance();
            i0.ɵɵconditional(!ctx.isLoading && !ctx.error ? 12 : -1);
        } }, dependencies: [i1.MJButtonDirective, i1.MJPageHeaderComponent, i1.MJPageLayoutComponent, i1.MJPageBodyComponent, i1.MJStatBadgeComponent, i2.LoadingComponent, i3.ERDCompositeComponent], styles: ["\n\n\n\n\n\n\n\n.loading-container[_ngcontent-%COMP%], \n.error-container[_ngcontent-%COMP%] {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: center;\n  background: var(--mj-bg-surface-sunken);\n  flex: 1;\n  border-radius: var(--mj-radius-lg);\n}\n\n.loading-container[_ngcontent-%COMP%]   p[_ngcontent-%COMP%], \n.error-container[_ngcontent-%COMP%]   p[_ngcontent-%COMP%] {\n  font-size: var(--mj-text-sm);\n  font-weight: var(--mj-font-normal);\n  color: var(--mj-text-secondary);\n}\n\n\n\n.error-message[_ngcontent-%COMP%] {\n  color: var(--mj-status-error-text);\n  font-weight: var(--mj-font-medium);\n}\n\n\n\n.dashboard-content[_ngcontent-%COMP%] {\n  overflow: hidden;\n  flex: 1;\n  display: flex;\n  flex-direction: column;\n  min-height: 0;\n}\n\n\n\n.loading-content[_ngcontent-%COMP%] {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  gap: var(--mj-space-4);\n}\n\n.loading-spinner[_ngcontent-%COMP%] {\n  position: relative;\n  width: 60px;\n  height: 60px;\n}\n\n.spinner-ring[_ngcontent-%COMP%] {\n  position: absolute;\n  width: 100%;\n  height: 100%;\n  border: 3px solid transparent;\n  border-radius: 50%;\n  animation: _ngcontent-%COMP%_spin 1.5s linear infinite;\n}\n\n.spinner-ring[_ngcontent-%COMP%]:nth-child(1) {\n  border-top-color: var(--mj-brand-primary);\n  animation-delay: 0s;\n}\n\n.spinner-ring[_ngcontent-%COMP%]:nth-child(2) {\n  border-top-color: var(--mj-brand-tertiary);\n  animation-delay: 0.3s;\n  transform: scale(0.8);\n}\n\n.spinner-ring[_ngcontent-%COMP%]:nth-child(3) {\n  border-top-color: var(--mj-brand-accent);\n  animation-delay: 0.6s;\n  transform: scale(0.6);\n}\n\n.loading-text[_ngcontent-%COMP%] {\n  font-size: var(--mj-text-sm);\n  font-weight: var(--mj-font-medium);\n  color: var(--mj-text-secondary);\n  text-align: center;\n}\n\n@keyframes _ngcontent-%COMP%_spin {\n  0% {\n    transform: rotate(0deg);\n  }\n  100% {\n    transform: rotate(360deg);\n  }\n}"] });
};
EntityAdminDashboardComponent = __decorate([
    RegisterClass(BaseDashboard, 'EntityAdmin')
], EntityAdminDashboardComponent);
export { EntityAdminDashboardComponent };
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(EntityAdminDashboardComponent, [{
        type: Component,
        args: [{ standalone: false, selector: 'mj-entity-admin-dashboard', template: "<mj-page-layout>\n  <mj-page-header\n    Title=\"Entity Admin\"\n    Icon=\"fa-solid fa-database\"\n    Subtitle=\"Browse and configure entity definitions\">\n    <!-- X-of-Y filtered count earns its meta spot per chrome conventions \u00A72. -->\n    <div meta>\n      <mj-stat-badge\n        [Count]=\"filteredEntities.length\"\n        [Total]=\"TotalEntityCount\"\n        Label=\"entities\">\n      </mj-stat-badge>\n    </div>\n    <div actions>\n      <button\n        mjButton\n        [variant]=\"filterPanelVisible ? 'primary' : 'secondary'\"\n        size=\"sm\"\n        (click)=\"toggleFilterPanel()\"\n        title=\"Toggle Filters\">\n        <i class=\"fa-solid fa-filter\"></i> <span class=\"action-btn-label\">Filters</span>\n      </button>\n    </div>\n  </mj-page-header>\n\n  <mj-page-body [Flex]=\"true\" [Padding]=\"false\">\n    @if (isLoading) {\n      <div class=\"loading-container\">\n        <mj-loading [text]=\"loadingMessage\" size=\"large\"></mj-loading>\n      </div>\n    }\n\n    @if (error) {\n      <div class=\"error-container\">\n        <p class=\"error-message\">{{ error }}</p>\n      </div>\n    }\n\n    @if (!isLoading && !error) {\n      <div class=\"dashboard-content\">\n        <mj-erd-composite\n          #erdComposite\n          [isRefreshingERD]=\"isRefreshingERD\"\n          (stateChange)=\"onStateChange($event)\"\n          (userStateChange)=\"onUserStateChange($event)\"\n          (entityOpened)=\"onEntityOpened($event)\"\n          (openRecord)=\"onOpenRecord($event)\"\n          >\n        </mj-erd-composite>\n      </div>\n    }\n  </mj-page-body>\n</mj-page-layout>", styles: ["/**\n * Entity Admin Dashboard Component - MJ Design Token Styled\n * Reference implementation for MJ design token usage\n */\n\n/* Loading and Error Containers */\n.loading-container,\n.error-container {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: center;\n  background: var(--mj-bg-surface-sunken);\n  flex: 1;\n  border-radius: var(--mj-radius-lg);\n}\n\n.loading-container p,\n.error-container p {\n  font-size: var(--mj-text-sm);\n  font-weight: var(--mj-font-normal);\n  color: var(--mj-text-secondary);\n}\n\n/* Error Message */\n.error-message {\n  color: var(--mj-status-error-text);\n  font-weight: var(--mj-font-medium);\n}\n\n/* Dashboard Content */\n.dashboard-content {\n  overflow: hidden;\n  flex: 1;\n  display: flex;\n  flex-direction: column;\n  min-height: 0;\n}\n\n/* Loading Spinner */\n.loading-content {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  gap: var(--mj-space-4);\n}\n\n.loading-spinner {\n  position: relative;\n  width: 60px;\n  height: 60px;\n}\n\n.spinner-ring {\n  position: absolute;\n  width: 100%;\n  height: 100%;\n  border: 3px solid transparent;\n  border-radius: 50%;\n  animation: spin 1.5s linear infinite;\n}\n\n.spinner-ring:nth-child(1) {\n  border-top-color: var(--mj-brand-primary);\n  animation-delay: 0s;\n}\n\n.spinner-ring:nth-child(2) {\n  border-top-color: var(--mj-brand-tertiary);\n  animation-delay: 0.3s;\n  transform: scale(0.8);\n}\n\n.spinner-ring:nth-child(3) {\n  border-top-color: var(--mj-brand-accent);\n  animation-delay: 0.6s;\n  transform: scale(0.6);\n}\n\n.loading-text {\n  font-size: var(--mj-text-sm);\n  font-weight: var(--mj-font-medium);\n  color: var(--mj-text-secondary);\n  text-align: center;\n}\n\n@keyframes spin {\n  0% {\n    transform: rotate(0deg);\n  }\n  100% {\n    transform: rotate(360deg);\n  }\n}\n"] }]
    }], null, { erdComposite: [{
            type: ViewChild,
            args: ['erdComposite', { static: false }]
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(EntityAdminDashboardComponent, { className: "EntityAdminDashboardComponent", filePath: "src/EntityAdmin/entity-admin-dashboard.component.ts", lineNumber: 32 }); })();
//# sourceMappingURL=entity-admin-dashboard.component.js.map