import type { IAudioStream, IConfig, IExternalTextTrack, IOptionalTuningConfig, IPlayer, ISources, ITextTrack, IVideoStream, PlaybackRate } from '@vkontakte/videoplayer-core';
import { ChromecastState, PlaybackState, VideoFormat } from '@vkontakte/videoplayer-core';
import { type IError, type ILogger, InterfaceLanguage, type IRectangle, type IValueObservable, type QualityLimits, VideoQuality, type InternalsExposure, AppTracer } from '@vkontakte/videoplayer-shared';
import type { ISDKConfig, IUIConfig } from '../config';
import { SeekAction, ThinOneStat } from '@vkontakte/videoplayer-statistics';
import type { InteractiveRange } from '@vkontakte/videoplayer-interactive';
import type { Readable, Writable } from 'svelte/store';
import { AdmanWrapper } from '../components/Ads/admanWrapper';
import type { Key, LanguageConfig } from '../translation/types';
import { type AdditionalButtonDeprecated, type ControlBlocksRefs, type ControlsKeys, type HotKeyMapData, type IAnnotationsApi, type IControlInfo, type IDisabledControls, type IInteractiveData, type IPictureInPictureApi, type IPlayerControlsRef, type IPlayerPhase, type ITimelinePreviewThumbsData, type IVideoEpisode, type IVKVideoPlayerCallbacks, type IVKVideoPlayerUICallbacks, type PlaybackStateRealistic, type Position, type Size, type VideoPlaybackRate, type VideoPlayerView, type VideoQualityForRender, type VideoQualityUI, type VideoSubtitle, type VideoSubtitleParsed } from '../types';
import { AdsPlaybackState } from '../types';
import { type QualitySettingsAppliesTo } from '../utils/userSettings';
import type { DebugData } from './utils';
import { GridTypes, type PlayPrevChapterDisabledTooltipKey } from '../constans';
import { UIOneStat } from '../services/statistics';
import type { AdditionalContextMenuItem, AdditionalSettingsMenuItem, ContextMenuItem, SettingsMenuItem } from '../components/Menus/subMenuTabs/types';
import type { AdditionalButton, AdditionalDesktopControlPanelButton } from '../components/Controls/types';
import type { SlotsApi } from '../utils/webAPI/slotsApi';
import type { FocusManager } from '../utils/webAPI/focusManager';
type SetQualityInfo = {
    appliesTo?: QualitySettingsAppliesTo;
    changeReason?: 'default' | 'limit-changed';
    byUser?: boolean;
};
export interface IAdsState {
    position: Writable<number>;
    duration: Writable<number>;
    playbackState: Writable<AdsPlaybackState>;
    canSkip: Writable<boolean>;
    secondsToWatchBeforeSkip: Writable<number>;
    postrollPassed: Writable<boolean>;
}
export interface IUIState {
    t: (key: Key, params?: Record<string, string>) => string;
    controlsVisible: Writable<boolean>;
    /**
     * Точечно скрываем контролы.
     */
    hiddenControls: Partial<Record<keyof IPlayerControlsRef, Writable<boolean>>>;
    /**
     * Определяет, могут ли вообще контролы быть показаны.
     */
    isControlsAvailable: Writable<boolean>;
    controlBlocks: {
        [key in keyof Required<ControlBlocksRefs>]: Writable<IControlInfo | undefined>;
    };
    touched: Writable<boolean>;
    controls: {
        prevButton: Writable<IControlInfo | undefined>;
        playButton: Writable<IControlInfo | undefined>;
        replayButton: Writable<IControlInfo | undefined>;
        nextButton: Writable<IControlInfo | undefined>;
        playPrevChapterButton: Writable<IControlInfo | undefined>;
        seekToInteractiveButton: Writable<IControlInfo | undefined>;
        interactiveGraphButton: Writable<IControlInfo | undefined>;
        liveButton: Writable<IControlInfo | undefined>;
        time: Writable<IControlInfo | undefined>;
        episodes: Writable<IControlInfo | undefined>;
        volume: Writable<IControlInfo | undefined>;
        subtitles: Writable<IControlInfo | undefined>;
        settings: Writable<IControlInfo | undefined>;
        context: Writable<IControlInfo | undefined>;
        fullscreen: Writable<IControlInfo | undefined>;
        chromecast: Writable<IControlInfo | undefined>;
        pip: Writable<IControlInfo | undefined>;
        'theater-mode-button': Writable<IControlInfo | undefined>;
        vkLogo: Writable<IControlInfo | undefined>;
        interactiveTimeIndicator: Writable<IControlInfo | undefined>;
        timeline: Writable<IControlInfo | undefined>;
        autoplayNextToggle: Writable<IControlInfo | undefined>;
        disabledControls$: IDisabledControls;
        additionalButtons: Writable<IControlInfo | undefined>[];
    };
    modals: {
        hotKeyMap: {
            show: Writable<boolean>;
            data: Writable<HotKeyMapData>;
        };
    };
    isFullscreen: Writable<boolean>;
    isFullscreenOpenedByKeyboard: Writable<boolean>;
    rotateAlpha: Writable<number>;
    isAutoplay: Writable<boolean>;
    debugPanelVisible: Writable<boolean>;
    episodes: {
        panelOpened$: Writable<boolean>;
        openedByKeyboard$: Writable<boolean>;
    };
    contextMenu: {
        visible$: Writable<boolean>;
        btnRef$: Writable<HTMLButtonElement | undefined>;
        openedByBtnKeyboard$: Writable<boolean>;
        openedByHotKey$: Writable<boolean>;
        lastActiveElem$: Writable<HTMLButtonElement | undefined>;
        showContextMenuBtn$: Writable<boolean>;
        position$: Writable<Position>;
    };
    playerSize: Writable<Size>;
    isMobile: Writable<boolean>;
    mobileNotReportControlHidden$: Readable<boolean>;
    icon3DVideoVisible: Writable<boolean>;
    scrubbingInProgress: Writable<boolean>;
    volumeChangingInProgress: Writable<boolean>;
    is3DVideo: Writable<boolean>;
    currentGridType$: Readable<GridTypes>;
    interactiveHideMobileControls: Writable<boolean>;
    additionalButtonsDeprecated$: Readable<AdditionalButtonDeprecated[]>;
    additionalDesktopControlPanelRightButtons$: Readable<AdditionalDesktopControlPanelButton[]>;
    additionalSettingsMenuItems$: Readable<SettingsMenuItem[]>;
    additionalContextMenuItems$: Readable<ContextMenuItem[]>;
    overlayContainer$: Writable<HTMLDivElement | undefined>;
    startedByKeyboard$: Writable<boolean>;
    autoplayNextEnabled$: Writable<boolean>;
    timerNextVideoRunning$: Writable<boolean>;
    settingsMenu: {
        visible$: Writable<boolean>;
        ref$: Writable<HTMLElement | undefined>;
        openedByBtnKeyboard$: Writable<boolean>;
    };
    settingsSubMenu: {
        visible$: Writable<boolean>;
        ref$: Writable<HTMLElement | undefined>;
        name$: Writable<string | undefined>;
    };
    /**
     * Отключаем любое действие пользователя.
     */
    userActionsDisabled: Writable<boolean>;
    /**
     * Положение заголовка названия видео.
     */
    videoTitleInfo: Writable<IControlInfo | undefined>;
    /**
     * Ускорение видео х2.
     */
    doubleForwardOn$: Writable<boolean>;
    /**
     * Определяет, что двойное ускорение видео доступно.
     */
    doubleForwardAvailable$: Readable<false>;
    previewTrackActive: Writable<boolean>;
    previewTrackDragInProgress: Writable<boolean>;
    previewTrackAvailable: Readable<boolean>;
    isPreviewTrackHorizontallyAligned: Readable<boolean>;
}
export interface IWebApi {
    pictureInPictureApi?: IPictureInPictureApi;
    annotationsApi?: IAnnotationsApi;
    slotsApi?: SlotsApi;
    focusManager?: FocusManager;
}
export interface IStore {
    initVideo: (config: IConfig & {
        subtitles?: Omit<IExternalTextTrack, 'type'>[];
        subtitlesForcedLanguage?: string;
    }) => void;
    videoId?: number;
    isClip: boolean;
    playerPhase: IPlayerPhase;
    interfaceLanguage$: Readable<InterfaceLanguage | string>;
    isCyrillicRelatedInterface$: Readable<boolean>;
    interactiveData?: IInteractiveData;
    vsid: Readable<string | undefined>;
    state: {
        positionExact$: Readable<number>;
        positionWithScrubbing$: Readable<number>;
        duration$: Readable<number>;
        playbackState$: Readable<PlaybackState | undefined>;
        playbackStateRealistic$: Readable<PlaybackStateRealistic | undefined>;
        isPlaying$: Readable<boolean>;
        isLoaderVisible: Readable<boolean>;
        bufferedProgress$: Readable<number>;
        isLive$: Readable<boolean | undefined>;
        canChangePlaybackSpeed$: Readable<boolean | undefined>;
        isActiveLive$: Readable<boolean | undefined>;
        isOldestAvailableLive$: Readable<boolean | undefined>;
        isRewindableLive$: Readable<boolean>;
        isEnded$: Readable<boolean>;
        volume$: Readable<number>;
        muted$: Readable<boolean>;
        trafficSavingEnabled$: Readable<boolean>;
        highQualityEnabled$: Readable<boolean>;
        availableVideoStreams$: Readable<IVideoStream[]>;
        availableAudioStreams$: Readable<IAudioStream[]>;
        videoStream$: Readable<IVideoStream | undefined>;
        audioStream$: Readable<IAudioStream | undefined>;
        currentQuality$: Readable<VideoQuality | undefined>;
        autoQualityLimitingAvailable$: Readable<boolean>;
        isAutoQualityEnabled$: Readable<boolean | undefined>;
        availableQualities$: Readable<VideoQualityForRender[]>;
        currentPlaybackRate$: Readable<number>;
        availablePlaybackRates$: Readable<VideoPlaybackRate[]>;
        currentSubtitle$: Readable<Omit<VideoSubtitle, 'selected'>>;
        availableTextTracks$: Readable<ITextTrack[]>;
        availableSubtitlesList$: Readable<VideoSubtitle[]>;
        currentSubtitleCaptions$: Readable<VideoSubtitleParsed['texts']>;
        isAutoSubtitleCaptionVisible$: Writable<boolean>;
        chromecastState$: Readable<ChromecastState>;
        chromecastDeviceName$: Readable<string | undefined>;
        chromecastConnected$: Readable<boolean>;
        currentFormat$: Readable<VideoFormat | undefined>;
        throughputEstimation$: Readable<number | undefined>;
        videoBitrate$: Readable<number | undefined>;
        videoSize$: Readable<IRectangle | undefined>;
        errorLog$: Readable<IError[]>;
        crashed$: Readable<boolean>;
        isAudioAvailable$: Readable<boolean>;
        isAudioDisabled: boolean;
        canDownload: boolean;
        availableSources$: Readable<ISources | undefined>;
        hasMpegSources$: Readable<boolean>;
        isInteractive: boolean;
        showInteractiveGraph: boolean;
        showSeekToInteractive: boolean;
        showPlayPrevChapter: boolean;
        showInteractiveTimeIndicator: boolean;
        isInteractiveTime$: Readable<boolean>;
        interactiveEpisodes$: Readable<IVideoEpisode[]>;
        isInteractiveExpectation$: Writable<boolean>;
        hasInteractiveBranches?: boolean;
        playPrevChapterDisabledTooltip: PlayPrevChapterDisabledTooltipKey;
        looped$: Writable<boolean>;
        loadedMetadata$: Writable<boolean>;
        /**
         * Определяет, можно ли в целом увидеть/выбрать Авто режим выбора качества.
         */
        isAutoQualityAvailable$: Readable<boolean>;
    };
    ui: IUIState;
    ads: IAdsState;
    webApi: IWebApi;
    actions: {
        internal: {
            preload: () => void;
            firstStart: (showAds: boolean) => void;
            play: () => void;
            pause: () => void;
            togglePlay: () => void;
            toggleMuted: () => void;
            openSettingsMenu: (wasOpenedByKey?: boolean, tick?: () => Promise<void>) => void;
            closeSettingsMenu: (fromSubMenu?: boolean) => void;
            openSettingsSubMenu: (name: string, ref: HTMLElement) => void;
            closeSettingsSubMenu: (ref: HTMLElement, isClosing?: boolean) => void;
            setTrafficSavingEnabled: (trafficSavingEnabled: boolean, appliesTo?: QualitySettingsAppliesTo) => void;
            setHighQualityEnabled: (highQualityEnabled: boolean, appliesTo?: QualitySettingsAppliesTo) => void;
            setVolume: (volume: number) => void;
            setMuted: (muted: boolean) => void;
            startVolumeChanging: () => void;
            stopVolumeChanging: () => void;
            setAudioStream: (stream: IAudioStream) => void;
            setVideoStream: (stream: IVideoStream) => void;
            setQuality: (quality: VideoQualityUI, info?: SetQualityInfo) => void;
            setPlaybackRate: (playbackRate: PlaybackRate) => void;
            incrementPlaybackRate: () => VideoPlaybackRate;
            decrementPlaybackRate: () => VideoPlaybackRate;
            setSubtitle: (subtitle?: VideoSubtitle) => void;
            toggleSubtitle: () => void;
            togglePictureInPicture: () => void;
            startScrubbing: (progress: number) => void;
            progressScrubbing: (progress: number) => void;
            completeScrubbing: (progress: number, forcePrecise?: boolean, action?: ThinOneStat.ActionSeekType | SeekAction) => void;
            toggleChromecast: () => void;
            seekTime: (time: number, action: SeekAction, forcePrecise?: boolean) => void;
            seekEpisodeStartTime: (time: number) => void;
            getNextEpisode: () => IVideoEpisode | undefined;
            seekToNextEpisode: (episode?: IVideoEpisode) => void;
            getPrevEpisode: () => IVideoEpisode | undefined;
            seekToPrevEpisode: (episode?: IVideoEpisode) => void;
            seekToPercent: (percent: number, action: SeekAction) => void;
            switchToActiveLive: () => void;
            switchFromAdsToVideo: (callPlay?: boolean) => void;
            switchFromVideoToAds: () => void;
            skipAd: () => void;
            setLiveWaitingStart: (state: boolean) => void;
            setLiveWaitingRecover: (state: boolean) => void;
            setLiveWaitingRecord: (state: boolean) => void;
            clearDelayedBufferingCheckTimeout: () => void;
            getDebugTextData: () => string;
            getTraceTextData: () => string;
            getDebugPanelData: () => DebugData;
            getVideoElement: () => HTMLVideoElement | null;
            startLogging: () => void;
            stopLogging: () => void;
            videoRotate: (alphaDiff?: number) => void;
            startCameraManualRotation(mx: number, my: number): void;
            stopCameraManualRotation(immediate?: boolean): void;
            moveCameraFocusPX(xpx: number, ypx: number, dt: number): void;
            holdCamera(): void;
            releaseCamera(): void;
            getVideoEpisodes: () => IVideoEpisode[] | undefined;
            getPreviewThumbsData: () => ITimelinePreviewThumbsData | undefined;
            downloadVideo: () => void;
            addLanguage: (config: LanguageConfig) => void;
            setLanguage: (language: InterfaceLanguage | string) => void;
            nextMovie: (movieId: number) => void;
            correctSeekTimeToInteractive: (time: number) => number;
            replayInteractive?: () => void;
            stopPlayer?: () => void;
            setLooped: (isLooped: boolean) => void;
            reportProblem: () => void;
            setAutoplayNextEnabled: (autoplayNext: boolean, byUser?: boolean) => void;
            setTimerNextVideoRunning: (timerNextVideoRunning: boolean) => void;
            prevVideoClick: (byUserAction?: boolean) => void;
            nextVideoClick: (byUserAction?: boolean) => void;
            nextVideoAnnouncementShow: () => void;
            nextVideoAnnouncementClick: () => void;
            nextVideoAnnouncementAuto: () => void;
            nextVideoAnnouncementCancel: () => void;
            checkFullscreenSupport: () => boolean;
            changeDoubleForwardOn: (enabled: boolean) => void;
            closePreviewTrack: () => void;
            previewTrackOpened: () => void;
            previewTrackDragStarted: () => void;
            previewTrackDragFinished: () => void;
        };
        external: {
            firstStart: (showAds: boolean) => void;
            play: () => void;
            pause: () => void;
            stop: () => void;
            seekTime: (time: number) => void;
            seekEpisodeStartTime: (time: number) => void;
            setPlaybackRate: (playbackRate: PlaybackRate) => void;
            setAutoQualityLimits: (limits: QualityLimits) => void;
            setMuted: (muted: boolean) => void;
            toggleSubtitle: () => void;
            changeSubtitle: (enabled: boolean, id?: string) => void;
            setVolume: (volume: number) => void;
            returnFocusToEpisodes: () => void;
            updateAdditionalSettingsItem: (itemId: string, fields: Partial<Omit<AdditionalSettingsMenuItem, 'id' | 'type'>>) => void;
            addAdditionalSettingsItem: (newItem: AdditionalSettingsMenuItem) => void;
            removeAdditionalSettingsItem: (itemId: string) => void;
            updateAdditionalContextItem: (itemId: string, fields: Partial<Omit<AdditionalContextMenuItem, 'id'>>) => void;
            addAdditionalContextItem: (newItem: AdditionalContextMenuItem) => void;
            removeAdditionalContextItem: (itemId: string) => void;
            updateAdditionalButton: (itemId: string, fields: Partial<Omit<AdditionalButton, 'id' | 'type'>>) => void;
            addAdditionalButton: (newButton: AdditionalButton) => void;
            removeAdditionalButton: (itemId: string) => void;
            setLiveLowLatency: (isLowLatency: boolean) => void;
            hideControls: () => void;
            showControls: () => void;
            setQuality: (quality: VideoQualityUI) => void;
            setTrafficSavingEnabled: (trafficSavingEnabled: boolean) => void;
            setHighQualityEnabled: (highQualityEnabled: boolean) => void;
            changeAudioStream: (id: string) => void;
        };
    };
    callbacks?: IVKVideoPlayerCallbacks;
    setUiCallbacks: (uiCallbacks: IVKVideoPlayerUICallbacks) => void;
    getAdmanWrapper: () => AdmanWrapper;
    getLogger: () => ILogger;
    getPlayer: () => IPlayer;
    destroy(): void;
}
interface IStoreParams {
    interfaceLanguage: InterfaceLanguage | string;
    isCyrillicRelatedInterface: boolean;
    videoId?: number;
    isClip: boolean;
    isLiveCatchUpMode?: boolean;
    isAudioDisabled?: boolean;
    canDownload?: boolean;
    statAuthToken?: string;
    callbacks?: IVKVideoPlayerCallbacks;
    webApi?: IWebApi;
    videoEpisodes?: IVideoEpisode[];
    previewThumbsData?: ITimelinePreviewThumbsData;
    uiConfig: IUIConfig;
    coreConfig: IOptionalTuningConfig;
    metaConfig: ISDKConfig['meta'];
    player?: IPlayer;
    isInteractive: boolean;
    interactiveRanges$?: IValueObservable<InteractiveRange[]>;
    isInteractiveTime$?: IValueObservable<boolean>;
    replayInteractive?: () => void;
    stopPlayer?: () => void;
    hasInteractiveBranches?: boolean;
    disabledControls: ControlsKeys;
    playPrevChapterDisabledTooltip: PlayPrevChapterDisabledTooltipKey;
    additionalButtons: Array<AdditionalButtonDeprecated | AdditionalDesktopControlPanelButton>;
    additionalSettingsMenuItems: AdditionalSettingsMenuItem[];
    additionalContextMenuItems: AdditionalContextMenuItem[];
    playPrevVideo: () => void;
    playNextVideo: () => void;
    /**
     * playPrevVideo или playNextVideo могут не вызваться, если обработка следующего видео находится на стороне интегарции,
     * поэтому используем данный колбэк.
     */
    onVideoChanged: (prev: boolean) => void;
    looped?: boolean;
    statistics?: UIOneStat;
    saveRate: boolean;
    internalsExposure: InternalsExposure | null;
    playerView?: VideoPlayerView;
    playerId: string;
    appTracer?: AppTracer;
}
/**
 * Store приложения.
 * Если будет слишком большим - можно разделить его на модули
 */
export declare const createStore: ({ interfaceLanguage, isCyrillicRelatedInterface, videoId, isClip, isLiveCatchUpMode, statAuthToken, isAudioDisabled, canDownload, callbacks, webApi, videoEpisodes, previewThumbsData, uiConfig, coreConfig, player: playerInstance, disabledControls, isInteractive, interactiveRanges$, isInteractiveTime$, replayInteractive, stopPlayer, hasInteractiveBranches, playPrevChapterDisabledTooltip, additionalButtons, additionalSettingsMenuItems, additionalContextMenuItems, playPrevVideo, playNextVideo, onVideoChanged, looped, statistics: uiStatistics, saveRate, internalsExposure, playerView, playerId, metaConfig, appTracer, }: IStoreParams) => IStore;
export {};
