/**
 * Lazy Loader
 *
 * Implements lazy loading for heavy modules to reduce startup time.
 * Modules are loaded on-demand and cached for subsequent uses.
 *
 * Key features:
 * - On-demand loading with automatic caching
 * - Priority-based preloading after startup
 * - Parallel module loading support
 * - Load time metrics and optimization hints
 */
import { EventEmitter } from 'events';
export interface LazyModule<T = unknown> {
    name: string;
    loader: () => Promise<T>;
    instance?: T;
    loaded: boolean;
    loading: boolean;
    loadTime?: number;
    error?: Error;
    /** Priority for preloading (higher = load first) */
    priority?: number;
    /** Dependencies that must be loaded first */
    dependencies?: string[];
}
export interface LazyLoaderConfig {
    /** Preload modules after initial startup (ms delay) */
    preloadDelay: number;
    /** Modules to preload automatically */
    preloadModules: string[];
    /** Enable performance logging */
    enableMetrics: boolean;
    /** Maximum parallel loads during preload */
    maxParallelLoads: number;
    /** Enable idle-time preloading */
    idlePreload: boolean;
}
export interface LoadMetrics {
    moduleName: string;
    loadTime: number;
    timestamp: number;
    success: boolean;
}
/** Module loading priority levels */
export declare const LoadPriority: {
    readonly CRITICAL: 100;
    readonly HIGH: 75;
    readonly NORMAL: 50;
    readonly LOW: 25;
    readonly DEFERRED: 0;
};
export declare class LazyLoader extends EventEmitter {
    private modules;
    private config;
    private metrics;
    private preloadTimeout;
    private idleCallback;
    private loadingQueue;
    private activeLoads;
    constructor(config?: Partial<LazyLoaderConfig>);
    /**
     * Register a module for lazy loading
     */
    register<T>(name: string, loader: () => Promise<T>, options?: {
        priority?: number;
        dependencies?: string[];
    }): void;
    /**
     * Get a lazily loaded module
     */
    get<T>(name: string): Promise<T>;
    /**
     * Check if a module is loaded
     */
    isLoaded(name: string): boolean;
    /**
     * Preload specified modules with parallel loading support
     */
    preload(moduleNames?: string[]): Promise<void>;
    /**
     * Schedule preloading after startup
     */
    schedulePreload(): void;
    /**
     * Schedule idle-time preloading for lower priority modules
     */
    scheduleIdlePreload(moduleNames: string[]): void;
    /**
     * Unload a module to free memory
     */
    unload(name: string): boolean;
    /**
     * Get loading metrics
     */
    getMetrics(): LoadMetrics[];
    /**
     * Get summary statistics
     */
    getStats(): {
        totalModules: number;
        loadedModules: number;
        totalLoadTime: number;
        averageLoadTime: number;
    };
    /**
     * Clear all modules
     */
    clear(): void;
    /**
     * Get loading hints based on metrics
     */
    getOptimizationHints(): string[];
    private loadModule;
}
export declare function getLazyLoader(config?: Partial<LazyLoaderConfig>): LazyLoader;
export declare function resetLazyLoader(): void;
/**
 * Register common heavy modules for lazy loading
 */
export declare function registerCommonModules(loader: LazyLoader): void;
/**
 * Initialize lazy loader with common modules
 */
export declare function initializeLazyLoader(config?: Partial<LazyLoaderConfig>): LazyLoader;
/**
 * Initialize lazy loader for CLI startup
 * Optimized for minimal startup time with intelligent preloading
 */
export declare function initializeCLILazyLoader(): LazyLoader;
/**
 * Quick startup helper - defers module loading until after initial render
 * Returns a function to call after the UI is ready
 */
export declare function createDeferredLoader(): () => void;
