import { Emitter, Unsubscribe } from 'nanoevents';
import { ILayout, InputLayoutType, OptionsType } from '../Layout';
import { IMedia } from '../Media';
import { OverlayLayoutManager } from "../../Modules/Layout/OverlayLayoutManager";
export type PrepareLayoutsType = {
    moveNext?: boolean;
};
export declare enum ELayoutType {
    CURRENT = 0,
    NEXT = 1
}
export type IXlrEvents = {
    layoutChange: (layoutId: number) => void;
    layoutStart: (layout: ILayout) => void;
    layoutEnd: (layout: ILayout) => void;
    layoutError: (layout: ILayout) => void;
    widgetStart: (widgetId: number) => void;
    widgetEnd: (widgetId: number) => void;
    widgetError: (widgetId: number) => void;
    adRequest: (sspLayoutIndex: number) => void;
    sspWidgetRequest: (media: IMedia) => void;
    sspWidgetEnd: (impressionUrls: string[], errorUrls: string[], duration: number) => void;
    updateLoop: (inputLayouts: InputLayoutType[]) => void;
    updateOverlays: (overlays: InputLayoutType[]) => void;
    overlayStart: (overlay: ILayout) => void;
    overlayEnd: (overlay: ILayout) => void;
    commandCodeReceived: (commandCode: string) => void;
    commandStringReceived: (commandString: string) => void;
    navLayout: (layoutCode: string, url: string) => void;
};
export interface IXlrPlayback {
    currentLayout: ILayout | undefined;
    nextLayout: ILayout | undefined;
    currentLayoutIndex: number;
    nextLayoutIndex: number;
    isCurrentLayoutValid: boolean;
    hasDefaultOnly: boolean;
}
export interface IXlr {
    bootstrap(): void;
    config: OptionsType;
    currentLayout: ILayout | undefined;
    currentLayoutId: number;
    currentLayoutIndex: number;
    emitSync<E extends keyof IXlrEvents>(eventName: E, ...args: Parameters<IXlrEvents[E]>): Promise<void>;
    emitter: Emitter<IXlrEvents>;
    getLayout(inputLayout: InputLayoutType): ILayout | undefined;
    getLayoutById(layoutId: number, layoutIndex?: number): ILayout | undefined;
    gotoNextLayout(): void;
    gotoPrevLayout(): void;
    /**
     * Navigate directly to a layout identified by its CMS code string.
     * Searches parsed layouts first, then fetches unparsed XLF files via appHost.
     * No-ops silently if the code is not found in the current loop.
     */
    gotoLayoutByCode(layoutCode: string): Promise<void>;
    /**
     * Play the given layout once as an interrupt, then resume the current loop.
     * Used by non-CMS platforms for Navigate to Layout interactive actions.
     * The interrupt is not part of inputLayouts and is spliced in temporarily.
     */
    playInterruptLayout(inputLayout: InputLayoutType): Promise<void>;
    /**
     * Dispatch an incoming webhook trigger code to the current layout's
     * action controller. Pass an optional widgetId to narrow the match.
     */
    triggerAction(triggerCode: string, widgetId?: string): void;
    init(): Promise<IXlr>;
    inputLayouts: InputLayoutType[];
    isInterrupted: boolean;
    isLayoutInDOM(containerName: string, layoutId: number): boolean;
    cleanupOrphanedLayouts(keepCurrent?: ILayout | null, keepNext?: ILayout | null): void;
    isSspEnabled: boolean;
    isUpdatingLoop: boolean;
    isUpdatingOverlays: boolean;
    layouts: Record<string, ILayout>;
    nextLayout: ILayout | undefined;
    on<E extends keyof IXlrEvents>(event: E, callback: IXlrEvents[E]): Unsubscribe;
    overlayLayoutManager: OverlayLayoutManager;
    overlays: InputLayoutType[];
    parseLayouts(loopUpdate?: boolean): IXlrPlayback;
    playLayouts(xlr: IXlr): void;
    playSchedules(xlr: IXlr): Promise<void>;
    prepareForSsp(nextLayout: ILayout): Promise<ILayout>;
    prepareLayoutXlf(inputLayout: ILayout | undefined): Promise<ILayout>;
    prepareLayouts(): Promise<IXlr>;
    renderOverlayLayouts(): Promise<void>;
    uniqueLayouts: Map<string, InputLayoutType>;
    updateInputLayout(layoutIndex: number, layout: InputLayoutType): void;
    updateLayouts(inputLayouts: InputLayoutType[]): void;
    updateLoop(inputLayouts: InputLayoutType[]): Promise<void>;
    updateOverlays(overlays: InputLayoutType[]): Promise<void>;
    updateScheduleLayouts(scheduleLayouts: InputLayoutType[]): Promise<void>;
}
export declare const initialXlr: IXlr;
