import type { ExecutionContext } from '../types/core';
import type { RuntimeEnvironment } from './environment';
export type { RuntimeEnvironment } from './environment';
export type EventTarget<TEnv extends RuntimeEnvironment> = TEnv extends 'browser' ? Element : TEnv extends 'node' ? object : Element | object;
export type NativeEvent<TEnv extends RuntimeEnvironment> = TEnv extends 'browser' ? Event : TEnv extends 'node' ? never : Event | undefined;
export interface EventSourcePayload<TEnv extends RuntimeEnvironment = 'universal'> {
    type: string;
    data: unknown;
    target?: EventTarget<TEnv> | null;
    nativeEvent?: NativeEvent<TEnv>;
    meta?: Record<string, unknown>;
}
export type EventSourceHandler<TEnv extends RuntimeEnvironment = 'universal'> = (payload: EventSourcePayload<TEnv>, context: ExecutionContext) => void;
export interface EventSourceSubscription {
    id: string;
    source: string;
    event: string;
    unsubscribe: () => void;
}
export interface EventSourceSubscribeOptions {
    event: string;
    handler: EventSourceHandler;
    target?: string | RegExp;
    selector?: string;
    options?: Record<string, unknown>;
}
export interface EventSource {
    readonly name: string;
    readonly description?: string;
    readonly supportedEvents?: string[];
    subscribe(options: EventSourceSubscribeOptions, context: ExecutionContext): EventSourceSubscription;
    supports?(event: string): boolean;
    initialize?(): Promise<void> | void;
    destroy?(): void;
}
export declare class EventSourceRegistry {
    private sources;
    private subscriptions;
    private nextId;
    register(name: string, source: EventSource): void;
    unregister(name: string): boolean;
    get(name: string): EventSource | undefined;
    has(name: string): boolean;
    subscribe(sourceName: string, options: EventSourceSubscribeOptions, context: ExecutionContext): EventSourceSubscription | undefined;
    unsubscribe(subscriptionId: string): boolean;
    getSourceNames(): string[];
    getSubscriptions(): EventSourceSubscription[];
    findSourceForEvent(event: string): string | undefined;
    generateId(): string;
    destroy(): void;
}
export declare function createEventSourceRegistry(): EventSourceRegistry;
export declare function getDefaultEventSourceRegistry(): EventSourceRegistry;
//# sourceMappingURL=event-source-registry.d.ts.map