import type { StreamChat } from './client';
import { StateStore } from './store';
import type { AttachmentManager } from '.';
/**
 * Whether an upload ended because it was aborted rather than because it failed.
 *
 * {@link UploadManager.deleteUploadRecord} and {@link UploadManager.cancelAllUploads} abort the
 * request through its `AbortController`, which is what happens when an attachment is removed
 * from the composer mid-upload or the client disconnects. Axios reports that as a
 * `CanceledError` (`axios.isCancel`); a custom `doUploadRequest` on another transport
 * conventionally throws a `DOMException` named `AbortError`.
 *
 * Callers use this to keep a deliberate cancellation from being reported as an error.
 */
export declare const isUploadCancellation: (error: unknown) => boolean;
export type UploadRecord = {
    id: string;
    /**
     * `true` once every byte has been handed to the transport but the server has not responded
     * yet.
     *
     * Upload progress measures bytes *written to the connection*, not bytes the server
     * acknowledged, so it reaches 100% the moment the request body is flushed — then the
     * connection sits idle while the CDN ingests the file and the response travels back. On a
     * large file over a slow link that window is long, and a UI that renders 100% as "done"
     * claims the upload is confirmed while it is not.
     *
     * Nothing measurable happens during that window, so it is the point at which a determinate
     * progress bar should hand over to an indeterminate one. Confirmation is the record being
     * removed, not progress reaching 100.
     *
     * Requires `AttachmentManagerConfig.trackUploadProgress`; without progress reporting there is
     * no way to tell when the flush happened, and this stays `false`.
     */
    uploadConfirmationPending?: boolean;
    uploadProgress?: number;
};
export type UploadManagerState = {
    uploads: Record<string, UploadRecord>;
};
/**
 * @internal
 */
export declare class UploadManager {
    private readonly client;
    readonly state: StateStore<UploadManagerState>;
    private inFlightUploads;
    constructor(client: StreamChat);
    private resolveAttachmentManager;
    get uploads(): Record<string, UploadRecord>;
    getUpload: (id: string) => UploadRecord;
    /**
     * Clears all upload records.
     * Invoked when the user disconnects so a later session does not inherit stale upload state.
     * Aborts every in-flight upload request via its `UploadRequestOptions.abortSignal`.
     */
    reset: () => void;
    /**
     * Removes the upload record for `id` if present.
     * If an upload is still in progress, aborts its `UploadRequestOptions.abortSignal`.
     */
    deleteUploadRecord: (id: string) => void;
    /**
     * Starts an upload for `id`, or returns the existing in-flight promise if one is already running.
     * Uses {@link StreamChat.channel}(`channelCid`) → `messageComposer.attachmentManager.doUploadRequest`.
     * Resolves with that result; rejects if the upload rejects (the record is removed from state either way).
     */
    upload: ({ id, channelCid, file, }: {
        id: string;
        channelCid: string;
        file: Parameters<typeof AttachmentManager.prototype.doUploadRequest>[0];
    }) => ReturnType<typeof AttachmentManager.prototype.doUploadRequest>;
    private upsertUpload;
    private updateUpload;
}
