import { default as CxBadge } from '../../../atoms/src/components/badge/badge.ts';
import { default as CxButton } from '../../../atoms/src/components/button/button.ts';
import { default as CxCheckbox } from '../../../atoms/src/components/checkbox/checkbox.ts';
import { default as CxDialog } from '../../../atoms/src/components/dialog/dialog.ts';
import { default as CxDivider } from '../../../atoms/src/components/divider/divider.ts';
import { default as CxDropdown } from '../../../atoms/src/components/dropdown/dropdown.ts';
import { default as CxIcon } from '../../../atoms/src/components/icon/icon.ts';
import { default as CxIconButton } from '../../../atoms/src/components/icon-button/icon-button.ts';
import { default as CxInput } from '../../../atoms/src/components/input/input.ts';
import { default as CxLineClamp } from '../../../atoms/src/components/line-clamp/line-clamp.ts';
import { default as CxMenu } from '../../../atoms/src/components/menu/menu.ts';
import { default as CxMenuItem } from '../../../atoms/src/components/menu-item/menu-item.ts';
import { default as CxPagination } from '../../../atoms/src/components/pagination/pagination.ts';
import { default as CxProgressBar } from '../../../atoms/src/components/progress-bar/progress-bar.ts';
import { default as CxRange } from '../../../atoms/src/components/range/range.ts';
import { default as CxSpace } from '../../../atoms/src/components/space/space.ts';
import { default as CxSpinner } from '../../../atoms/src/components/spinner/spinner.ts';
import { default as CxSwitch } from '../../../atoms/src/components/switch/switch.ts';
import { default as CxTooltip } from '../../../atoms/src/components/tooltip/tooltip.ts';
import { default as CxTypography } from '../../../atoms/src/components/typography/typography.ts';
import { default as CortexElement } from '../../../base/src/cortex-element.ts';
import { default as CxConfirmPopover } from '../../../molecules/src/confirm-popover/confirm-popover.ts';
import { DownloadItem, STATUS } from '../../../types/src/downloader';
import { CSSResultGroup, TemplateResult } from 'lit';
import { ExecutionContext } from './data/orangelogic-types';

declare global {
    interface Window {
        Param: any;
        Utils: any;
        tabId: string;
    }
}
/**
 * @summary A floating widget for managing downloads.
 *
 * @cssproperty [--max-width=920px] - The maximum width of the downloader.
 * @cssproperty [--search-input-width=300px] - The width of the search input.
 * @cssproperty [--settings-menu-width=400px] - The width of the settings menu.
 * @cssproperty [--name-cell-width=400px] - The width of the name cell inside download item table.
 * @cssproperty [--progress-cell-width=200px] - The width of the progress cell inside download item table.
 * @cssproperty [--status-cell-width=140px] - The width of the status cell inside download item table.
 * @cssproperty [--actions-cell-width=100px] - The width of the actions cell inside download item table.
 * @cssproperty [--table-head-height=40px] - The height of the table header inside download item table.
 */
export default class CxDownloader extends CortexElement {
    static readonly styles: CSSResultGroup;
    static readonly dependencies: {
        'cx-badge': typeof CxBadge;
        'cx-button': typeof CxButton;
        'cx-checkbox': typeof CxCheckbox;
        'cx-confirm-popover': typeof CxConfirmPopover;
        'cx-dialog': typeof CxDialog;
        'cx-divider': typeof CxDivider;
        'cx-dropdown': typeof CxDropdown;
        'cx-icon': typeof CxIcon;
        'cx-icon-button': typeof CxIconButton;
        'cx-input': typeof CxInput;
        'cx-line-clamp': typeof CxLineClamp;
        'cx-menu': typeof CxMenu;
        'cx-menu-item': typeof CxMenuItem;
        'cx-pagination': typeof CxPagination;
        'cx-progress-bar': typeof CxProgressBar;
        'cx-range': typeof CxRange;
        'cx-space': typeof CxSpace;
        'cx-spinner': typeof CxSpinner;
        'cx-switch': typeof CxSwitch;
        'cx-tooltip': typeof CxTooltip;
        'cx-typography': typeof CxTypography;
    };
    private manager;
    private fileEventsQueue;
    private cleanupHandlers;
    private readonly localize;
    downloader: HTMLDivElement;
    searchInput: CxInput;
    ctx: ExecutionContext | null;
    userId: string;
    workerURL: string;
    private _coordinates;
    get coordinates(): {
        x: number;
        y: number;
    };
    private _connected;
    get connected(): boolean;
    private isFullscreen;
    private isRocketMode;
    private isVisible;
    private chunkSize;
    private _downloadingFiles;
    get downloadingFiles(): DownloadItem[];
    get baseUrl(): string;
    get localStoragePrefix(): string;
    get allFilesCompleted(): boolean;
    get allFilesCancelled(): boolean;
    get skipDeleteConfirm(): boolean;
    /**
     * [41ST0L] Downloader V2 use local storage and IndexedDB to store necessary data.
     * If the user does not allow those data to be stored, the downloader can not function properly and we will not render this component at all.
     *
     * But if the downloader was already opened before the user disallowed cookies, we rely on this flag to stop any further data creation and updates.
     */
    get cookiesForDownloaderV2Rejected(): boolean;
    set downloadingFiles(newDownloadingFiles: DownloadItem[]);
    private allFiles;
    private sortedFiles;
    private pageIndex;
    private pageSize;
    private filteredFiles;
    private _loading;
    get loading(): boolean;
    private errorMessage;
    private bandWidth;
    private defaultDownloadFolderName;
    private filterOptions;
    private isPausing;
    private isResuming;
    private isClearing;
    private isCancelling;
    private isRetrying;
    private isSearchOpen;
    private totalSize;
    updateTotalSize(): Promise<void>;
    private countByStatus;
    updateCountByStatus(): Promise<void>;
    private isAllDownloadingFilesCompleted;
    updateIsAllDownloadingFilesCompleted(): Promise<void>;
    cleanup(): void;
    constructor();
    connectedCallback(): void;
    disconnectedCallback(): void;
    protected runFirstUpdated(): void;
    requestLocation(transactionID: string | null): void;
    requestDownload({ containerName, transactionID }: any): void;
    private buildDownloadManager;
    fireNotification(message: string, title: string | undefined, options: {
        notificationType: string;
    }): void;
    initDownloadManager(): Promise<void>;
    updateAllFiles(newAllFiles: Record<string, DownloadItem>): void;
    fetchAllFiles(): Promise<void>;
    updateFilesInterval: NodeJS.Timer | null;
    setUpdateFilesInterval(): void;
    checkDefaultRootNameInterval: NodeJS.Timer | null;
    setCheckDefaultRootNameInterval(): void;
    checkCookiesRejectedInterval: NodeJS.Timer | undefined;
    setCheckCookiesRejectedInterval(): void;
    cancelSingle: (id: string) => void;
    onCancelAll: () => Promise<void>;
    onClear: (id: string) => void;
    onClearAll: () => Promise<void>;
    onPause: (id: string) => void;
    onPauseAll: () => Promise<void>;
    onResume: (id: string) => void;
    onResumeAll: () => Promise<void>;
    onRetry: (id: string) => void;
    onRetryAll: () => Promise<void>;
    selectDefaultRoot: () => void;
    removeDefaultRoot: () => void;
    updateSortedFiles(): Promise<void>;
    animateDownloader({ duration }?: {
        duration: number;
    }): void;
    handleFullscreenChange(): void;
    handleWindowResize(): void;
    private handleRangePointerStart;
    handleDrag(event: PointerEvent): void;
    hide(): void;
    show(): void;
    updateTabIndex(): void;
    getDownloadingFilesFromLocalStorage(): void;
    onFilter(key: keyof DownloadItem, value: any): void;
    updateFilteredFiles(): void;
    private handleSearchInput;
    private pauseAll;
    private resumeAll;
    private retryAll;
    private clearCancelAll;
    private toggleFullscreen;
    private handleRocketModeChange;
    private handleChunkSizeChange;
    renderSearch(): TemplateResult<1>;
    renderMassActions(): TemplateResult<1>;
    renderChunkSizeMarks(): TemplateResult<1>;
    renderSettingsButton(): TemplateResult;
    renderExpandButton(): TemplateResult;
    renderCloseButton(): TemplateResult;
    renderProgressBar({ progress, showProgress, size, status, unit, }: {
        progress: number;
        showProgress?: boolean;
        size: number;
        status: STATUS | null;
        unit: string;
    }): TemplateResult;
    renderTableHead(): TemplateResult;
    renderItemActions({ id, status, }: {
        id: string;
        status: STATUS;
    }): TemplateResult;
    renderTableRow(rowProps: DownloadItem): TemplateResult;
    renderTableView(): TemplateResult;
    renderBandWidth(showLabel?: boolean): TemplateResult;
    renderFullView(): TemplateResult;
    renderSmallView(): TemplateResult;
    render(): TemplateResult;
}
declare global {
    interface HTMLElementTagNameMap {
        'cx-downloader': CxDownloader;
    }
}
