/**
 * Event types for service worker internal communication
 */
export declare enum ServiceWorkerEvent {
    CACHE_HIT = "cache:hit",
    CACHE_MISS = "cache:miss",
    CACHE_ERROR = "cache:error",
    CACHE_INVALIDATE = "cache:invalidate",
    CACHE_INVALIDATE_ALL = "cache:invalidate_all",
    CACHE_REVALIDATE = "cache:revalidate",
    UPDATE_CHECK_START = "update:check_start",
    UPDATE_CHECK_COMPLETE = "update:check_complete",
    UPDATE_AVAILABLE = "update:available",
    UPDATE_APPLIED = "update:applied",
    UPDATE_ERROR = "update:error",
    NETWORK_REQUEST_START = "network:request_start",
    NETWORK_REQUEST_COMPLETE = "network:request_complete",
    NETWORK_REQUEST_ERROR = "network:request_error",
    NETWORK_ONLINE = "network:online",
    NETWORK_OFFLINE = "network:offline",
    CLIENT_CONNECTED = "connection:client_connected",
    CLIENT_DISCONNECTED = "connection:client_disconnected",
    INSTALL = "lifecycle:install",
    ACTIVATE = "lifecycle:activate",
    READY = "lifecycle:ready"
}
/**
 * Event payload interfaces
 */
export interface ICacheEventPayload {
    url: string;
    method?: string;
    bytes?: number;
    error?: string;
}
export interface IUpdateEventPayload {
    oldVersion?: string;
    newVersion?: string;
    oldHash?: string;
    newHash?: string;
    error?: string;
}
export interface INetworkEventPayload {
    url: string;
    method?: string;
    status?: number;
    duration?: number;
    bytes?: number;
    error?: string;
}
export interface IConnectionEventPayload {
    clientId?: string;
    tabId?: string;
}
export interface ILifecycleEventPayload {
    timestamp: number;
}
/**
 * Union type for all event payloads
 */
export type TEventPayload = ICacheEventPayload | IUpdateEventPayload | INetworkEventPayload | IConnectionEventPayload | ILifecycleEventPayload | Record<string, unknown>;
/**
 * Event listener callback type
 */
export type TEventListener<T extends TEventPayload = TEventPayload> = (event: ServiceWorkerEvent, payload: T) => void | Promise<void>;
/**
 * Subscription interface
 */
export interface ISubscription {
    unsubscribe: () => void;
}
/**
 * Event bus for decoupled communication between service worker components.
 * Implements a simple pub/sub pattern.
 */
export declare class EventBus {
    private static instance;
    private listeners;
    private globalListeners;
    private eventHistory;
    private readonly maxHistorySize;
    private debugMode;
    private constructor();
    /**
     * Gets the singleton instance
     */
    static getInstance(): EventBus;
    /**
     * Enables or disables debug mode (logs all events)
     */
    setDebugMode(enabled: boolean): void;
    /**
     * Emits an event to all subscribed listeners
     */
    emit<T extends TEventPayload>(event: ServiceWorkerEvent, payload: T): void;
    /**
     * Subscribes to a specific event
     */
    on<T extends TEventPayload>(event: ServiceWorkerEvent, listener: TEventListener<T>): ISubscription;
    /**
     * Subscribes to multiple events at once
     */
    onMany<T extends TEventPayload>(events: ServiceWorkerEvent[], listener: TEventListener<T>): ISubscription;
    /**
     * Subscribes to all events
     */
    onAll<T extends TEventPayload>(listener: TEventListener<T>): ISubscription;
    /**
     * Subscribes to an event for only one emission
     */
    once<T extends TEventPayload>(event: ServiceWorkerEvent, listener: TEventListener<T>): ISubscription;
    /**
     * Unsubscribes a listener from an event
     */
    off(event: ServiceWorkerEvent, listener: TEventListener): void;
    /**
     * Removes all listeners for an event
     */
    removeAllListeners(event?: ServiceWorkerEvent): void;
    /**
     * Gets the count of listeners for an event
     */
    listenerCount(event: ServiceWorkerEvent): number;
    /**
     * Gets the event history
     */
    getHistory(): Array<{
        event: ServiceWorkerEvent;
        payload: TEventPayload;
        timestamp: number;
    }>;
    /**
     * Gets events of a specific type from history
     */
    getHistoryByType(event: ServiceWorkerEvent): Array<{
        payload: TEventPayload;
        timestamp: number;
    }>;
    /**
     * Clears the event history
     */
    clearHistory(): void;
    /**
     * Waits for an event to be emitted (returns a promise)
     */
    waitFor<T extends TEventPayload>(event: ServiceWorkerEvent, timeout?: number): Promise<T>;
    /**
     * Records an event in history
     */
    private recordEvent;
    /**
     * Emits a cache hit event
     */
    emitCacheHit(url: string, bytes?: number): void;
    /**
     * Emits a cache miss event
     */
    emitCacheMiss(url: string): void;
    /**
     * Emits a cache error event
     */
    emitCacheError(url: string, error?: string): void;
    /**
     * Emits a cache invalidation event
     */
    emitCacheInvalidate(url?: string): void;
    /**
     * Emits an update available event
     */
    emitUpdateAvailable(oldVersion: string, newVersion: string, oldHash: string, newHash: string): void;
    /**
     * Emits an update applied event
     */
    emitUpdateApplied(newVersion: string, newHash: string): void;
    /**
     * Emits a network online event
     */
    emitNetworkOnline(): void;
    /**
     * Emits a network offline event
     */
    emitNetworkOffline(): void;
}
export declare const getEventBus: () => EventBus;
