import * as plugins from './plugins.js';
import * as interfaces from '../dist_ts_interfaces/index.js';
declare global {
    interface ServiceWorkerGlobalScope extends EventTarget {
        clients: Clients;
        registration: ServiceWorkerRegistration;
    }
    interface Clients {
        matchAll(options?: ClientQueryOptions): Promise<Client[]>;
        openWindow(url: string): Promise<WindowClient>;
        claim(): Promise<void>;
        get(id: string): Promise<Client | undefined>;
    }
    interface ClientQueryOptions {
        includeUncontrolled?: boolean;
        type?: 'window' | 'worker' | 'sharedworker' | 'all';
    }
    interface Client {
        id: string;
        type: 'window' | 'worker' | 'sharedworker';
        url: string;
    }
    interface WindowClient extends Client {
        focused: boolean;
        visibilityState: 'hidden' | 'visible' | 'prerender' | 'unloaded';
        focus(): Promise<WindowClient>;
        navigate(url: string): Promise<WindowClient>;
    }
}
/**
 * This class is meant to be used only on the backend side
 */
export declare class ServiceworkerBackend {
    deesComms: plugins.deesComms.DeesComms;
    private swSelf;
    private clientUpdateInterval;
    private metricsUpdateThrottle;
    private pendingMetricsUpdate;
    private readonly METRICS_THROTTLE_MS;
    /**
     * Helper to create properly formatted TypedRequest messages for DeesComms
     */
    private createMessage;
    constructor(optionsArg: {
        self: any;
        purgeCache: (reqArg: interfaces.serviceworker.IRequest_PurgeServiceWorkerCache['request']) => Promise<interfaces.serviceworker.IRequest_PurgeServiceWorkerCache['response']>;
    });
    /**
     * Sets up subscriptions to EventBus events and broadcasts them to clients
     */
    private setupEventBusSubscriptions;
    /**
     * Broadcasts a status update to all connected clients
     */
    broadcastStatusUpdate(status: interfaces.serviceworker.IStatusUpdate): Promise<void>;
    /**
     * Broadcasts a TypedRequest log entry to all connected clients (for sw-dash)
     */
    broadcastTypedRequestLogged(entry: interfaces.serviceworker.ITypedRequestLogEntry): Promise<void>;
    /**
     * Start periodic updates of connected client count
     */
    private startClientCountUpdates;
    /**
     * Update the connected clients count using the Clients API
     */
    private updateConnectedClientsCount;
    /**
     * reloads all clients
     */
    triggerReloadAll(): Promise<void>;
    /**
     * display notification
     */
    addNotification(notificationArg: {
        title: string;
        body: string;
    }): Promise<void>;
    alert(alertText: string): Promise<void>;
    /**
     * Pushes a new event log entry to all connected clients
     * Called immediately when an event is logged
     */
    pushEvent(entry: interfaces.serviceworker.IEventLogEntry): Promise<void>;
    /**
     * Pushes a metrics update to all connected clients
     * Throttled to max 1 update per 500ms to prevent spam
     */
    pushMetricsUpdate(): void;
    /**
     * Actually sends the metrics update via DeesComms
     */
    private sendMetricsUpdate;
    /**
     * Pushes notification when a resource is cached
     */
    pushResourceCached(url: string, contentType: string, size: number, cached: boolean): Promise<void>;
}
