import type { CollaborativeUser, ChartAnnotation } from './CollaborativeChart.svelte';
/**
 * Generate a random user color from a predefined palette
 */
export declare function generateUserColor(): string;
/**
 * Generate a unique room ID for collaboration
 */
export declare function generateRoomId(prefix?: string): string;
/**
 * Validate and sanitize user input for collaboration
 */
export declare function sanitizeUserInput(input: string): string;
/**
 * Calculate relative position from absolute coordinates
 */
export declare function getRelativePosition(clientX: number, clientY: number, container: HTMLElement): {
    x: number;
    y: number;
};
/**
 * Throttle function calls for performance
 */
export declare function throttle<T extends (...args: any[]) => any>(func: T, delay: number): (...args: Parameters<T>) => void;
/**
 * Debounce function calls
 */
export declare function debounce<T extends (...args: any[]) => any>(func: T, delay: number): (...args: Parameters<T>) => void;
/**
 * Create a conflict-free replicated data type (CRDT) for chart data
 */
export declare class ChartDataCRDT {
    private data;
    private timestamps;
    set(key: string, value: any, timestamp?: number): boolean;
    get(key: string): any;
    delete(key: string, timestamp?: number): boolean;
    getAll(): Record<string, any>;
    merge(other: ChartDataCRDT): void;
    serialize(): string;
    static deserialize(serialized: string): ChartDataCRDT;
}
/**
 * Conflict resolution strategies for collaborative editing
 */
export declare const ConflictResolution: {
    /**
     * Last-writer-wins strategy
     */
    lastWriterWins: (local: any, remote: any, localTime: number, remoteTime: number) => any;
    /**
     * Merge arrays by concatenating and removing duplicates
     */
    mergeArrays: (local: any[], remote: any[]) => any[];
    /**
     * Merge objects by combining properties
     */
    mergeObjects: (local: Record<string, any>, remote: Record<string, any>) => {
        [x: string]: any;
    };
};
/**
 * Presence awareness utilities
 */
export declare class PresenceManager {
    private users;
    private callbacks;
    addUser(user: CollaborativeUser): void;
    updateUser(userId: string, updates: Partial<CollaborativeUser>): void;
    removeUser(userId: string): void;
    getUsers(): CollaborativeUser[];
    getActiveUsers(timeoutMs?: number): CollaborativeUser[];
    subscribe(callback: (users: CollaborativeUser[]) => void): () => void;
    private notifyCallbacks;
    cleanupInactiveUsers(timeoutMs?: number): void;
}
/**
 * Annotation synchronization utilities
 */
export declare class AnnotationSync {
    private annotations;
    addAnnotation(annotation: ChartAnnotation): void;
    updateAnnotation(id: string, updates: Partial<ChartAnnotation>): boolean;
    removeAnnotation(id: string): boolean;
    getAnnotations(): ChartAnnotation[];
    getAnnotationsByUser(userId: string): ChartAnnotation[];
    getAnnotationsByType(type: ChartAnnotation['type']): ChartAnnotation[];
    clearUserAnnotations(userId: string): void;
    serialize(): string;
    deserialize(serialized: string): void;
}
/**
 * Connection quality monitoring
 */
export declare class ConnectionMonitor {
    private latencyHistory;
    private maxHistorySize;
    private callbacks;
    recordLatency(latency: number): void;
    getAverageLatency(): number;
    getConnectionQuality(): 'good' | 'fair' | 'poor';
    subscribe(callback: (quality: 'good' | 'fair' | 'poor') => void): () => void;
    private notifyCallbacks;
}
/**
 * Operational Transform (OT) utilities for text-based annotations
 */
export declare class TextOperationTransform {
    static transform(op1: TextOperation, op2: TextOperation): [TextOperation, TextOperation];
}
export interface TextOperation {
    type: 'insert' | 'delete' | 'retain';
    position: number;
    text?: string;
    length?: number;
}
/**
 * Export utilities for collaborative sessions
 */
export declare function exportCollaborativeSession(data: any[], annotations: ChartAnnotation[], users: CollaborativeUser[], metadata: Record<string, any>): string;
//# sourceMappingURL=collaboration-utils.d.ts.map