import { Event } from '@amplitude/analytics-core';
import { StoreType, type SessionReplayOptions as StandaloneSessionReplayOptions } from '@amplitude/session-replay-browser';
/**
 * Configuration for cross-origin iframe support.
 * Extracted from the standalone SDK's SessionReplayOptions.
 */
export type CrossOriginIframesConfig = NonNullable<StandaloneSessionReplayOptions['crossOriginIframes']>;
/**
 * Configuration for rrweb event-split flush cadence.
 * Extracted from the standalone SDK's SessionReplayOptions.
 */
export type FlushIntervalConfig = NonNullable<StandaloneSessionReplayOptions['flushIntervalConfig']>;
export type MaskLevel = 'light' | 'medium' | 'conservative';
export interface SessionReplayPrivacyConfig {
    blockSelector?: string | string[];
    defaultMaskLevel?: MaskLevel;
    maskSelector?: string[];
    unmaskSelector?: string[];
}
/**
 * Performance configuration for interaction tracking, specifically for CSS selector generation.
 */
export interface InteractionPerformanceConfig {
    /**
     * Maximum time in milliseconds allowed for CSS selector generation.
     * If selector generation takes longer than this, it will throw a timeout error.
     * Default: undefined (no timeout limit)
     */
    timeoutMs?: number;
    /**
     * Maximum number of attempts to optimize/simplify the CSS selector path.
     * Higher values may produce shorter selectors but take longer to compute.
     * Default: 10000
     */
    maxNumberOfTries?: number;
    /**
     * Maximum number of CSS selector combinations to test for uniqueness.
     * If more combinations would be generated, falls back to a simpler strategy.
     * Default: 1000
     */
    threshold?: number;
}
export interface SessionReplayPerformanceConfig {
    enabled: boolean;
    timeout?: number;
    /**
     * If enabled, consecutive mutation events are merged into a single event before
     * compression. This reduces the stored event count and coalesces bursts of
     * inline `style` mutations on the same node (last-write-wins), without changing
     * replay semantics. Defaults to false.
     */
    mergeMutations?: boolean;
    /**
     * Performance configuration for interaction tracking (clicks, scrolls).
     */
    interaction?: InteractionPerformanceConfig;
}
/**
 * UGC filter rule.
 */
export type UGCFilterRule = {
    /**
     * The selector of the UGC element.
     */
    selector: string;
    /**
     * The replacement text for the UGC element.
     */
    replacement: string;
};
export interface SessionReplayInteractionConfig {
    trackEveryNms?: number;
    enabled: boolean;
    batch: boolean;
    /**
     * UGC filter rules.
     */
    ugcFilterRules?: UGCFilterRule[];
}
export interface SessionReplayOptions {
    /**
     * @see {@link StandaloneSessionReplayOptions.sampleRate}
     */
    sampleRate?: number;
    /**
     * @see {@link StandaloneSessionReplayOptions.privacyConfig}
     */
    privacyConfig?: SessionReplayPrivacyConfig;
    /**
     * @see {@link StandaloneSessionReplayOptions.debugMode}
     */
    debugMode?: boolean;
    /**
     * If this is enabled we will force the browser SDK to also send start and end session events.
     */
    forceSessionTracking?: boolean;
    /**
     * @see {@link StandaloneSessionReplayOptions.configServerUrl}
     */
    configServerUrl?: string;
    /**
     * @see {@link StandaloneSessionReplayOptions.trackServerUrl}
     */
    trackServerUrl?: string;
    /**
     * @see {@link StandaloneSessionReplayOptions.shouldInlineStylesheet}
     */
    shouldInlineStylesheet?: boolean;
    /**
     * @see {@link StandaloneSessionReplayOptions.performanceConfig}
     */
    performanceConfig?: SessionReplayPerformanceConfig;
    /**
     * @see {@link StandaloneSessionReplayOptions.storeType}
     */
    storeType?: StoreType;
    /**
     * If true, the SDK will compress replay events using a web worker.
     * This offloads compression to a separate thread, improving performance on the main thread.
     *
     * @defaultValue false
     */
    useWebWorker?: boolean;
    /**
     * Override the device ID for session replay.
     */
    deviceId?: string;
    /**
     * Dynamically overrides the session ID for replay. Ensure stability to avoid frequent restarts.
     * @param event Browser SDK event
     * @returns The session ID for the session replay.
     */
    customSessionId?: (event: Event) => string | undefined;
    /**
     * @deprecated Use `useWebWorker` instead. This will be removed in a future version.
     * @see {@link StandaloneSessionReplayOptions.useWebWorker}
     */
    experimental?: {
        useWebWorker: boolean;
    };
    /**
     * If true, applies a background color to blocked elements for visual masking. Defaults to false.
     */
    applyBackgroundColorToBlockedElements?: boolean;
    interactionConfig?: SessionReplayInteractionConfig;
    /**
     * Enables URL change polling as a fallback for SPA route tracking.
     * When enabled, the SDK will periodically check for URL changes every second
     * in addition to patching the History API. This is useful for edge cases where
     * route changes might bypass the standard History API methods.
     *
     * @defaultValue false
     */
    enableUrlChangePolling?: boolean;
    /**
     * Specifies the interval in milliseconds for URL change polling when enableUrlChangePolling is true.
     * The SDK will check for URL changes at this interval as a fallback for SPA route tracking.
     *
     * @defaultValue 1000
     */
    urlChangePollingInterval?: number;
    /**
     * Whether to capture document title in URL change events.
     * When disabled, the title field will be empty in URL change events.
     *
     * @defaultValue false
     */
    captureDocumentTitle?: boolean;
    /**
     * @see {@link StandaloneSessionReplayOptions.captureAdoptedStyleSheets}
     */
    captureAdoptedStyleSheets?: boolean;
    /**
     * @see {@link StandaloneSessionReplayOptions.crossOriginIframes}
     */
    crossOriginIframes?: CrossOriginIframesConfig;
    /**
     * @see {@link StandaloneSessionReplayOptions.flushIntervalConfig}
     */
    flushIntervalConfig?: FlushIntervalConfig;
    /**
     * @see {@link StandaloneSessionReplayOptions.eagerFullSnapshotSend}
     */
    eagerFullSnapshotSend?: boolean;
    /**
     * @see {@link StandaloneSessionReplayOptions.captureFullSnapshotOnFocus}
     */
    captureFullSnapshotOnFocus?: boolean;
    /**
     * @see {@link StandaloneSessionReplayOptions.maxPersistedEventsSizeBytes}
     */
    maxPersistedEventsSizeBytes?: number;
    /**
     * @see {@link StandaloneSessionReplayOptions.maxSingleEventSizeBytes}
     */
    maxSingleEventSizeBytes?: number;
    /**
     * @see {@link StandaloneSessionReplayOptions.sendTimeoutMs}
     */
    sendTimeoutMs?: number;
}
//# sourceMappingURL=session-replay.d.ts.map