export type { DiagnosticEvent, DiagnosticExportPackage, DiagnosticLiveEvent, DiagnosticLiveSnapshot, DiagnosticsConfig, DiagnosticsLiveListener, DiagnosticSessionSnapshot } from '../../utils/diagnostics/types';
import type { DiagnosticsConfig } from '../../utils/diagnostics/types';
export type TrackType = 'video' | 'audio' | 'text';
export type PlayState = 'playing' | 'paused';
export type TimeMs = number;
export interface ThumbnailProvider {
    /**
     * 获取片段的封面图片
     * @param clip 片段对象
     * @returns 封面图片URL、Promise<URL>或封面图片URL数组、Promise<URL数组>
     */
    getThumbnails(clip: Clip): string[] | Promise<string[]>;
}
export interface ClipVisualTransform {
    x: number;
    y: number;
    scale: number;
}
export interface TextClipStyle {
    fontSize: number;
    color: string;
    rotation: number;
    strokeColor: string;
    strokeWidth: number;
    paddingX: number;
}
export declare const DEFAULT_TEXT_CLIP_STYLE: TextClipStyle;
export declare function resolveTextClipStyle(style?: Partial<TextClipStyle> | null): TextClipStyle;
export type PreviewBackendType = 'dom' | 'canvas' | 'auto';
export interface Mp4PreviewMediaSource {
    url: string;
    mimeType: string;
    kind: 'mp4';
}
export interface HlsFmp4PreviewMediaSource {
    url: string;
    mimeType: string;
    kind: 'hls-fmp4';
}
export interface AudioPreviewMediaSource {
    url: string;
    mimeType: string;
    kind: 'audio';
}
export type PreviewMediaSource = Mp4PreviewMediaSource | HlsFmp4PreviewMediaSource | AudioPreviewMediaSource;
export type PreviewSourceResolver = (clip: Clip) => PreviewMediaSource | null | Promise<PreviewMediaSource | null>;
export interface TextPreviewFontConfig {
    fontName: string;
    fontSourceUrl: string;
}
export interface VoiceOption {
    id: string;
    name: string;
    lang: string;
    emotion: string;
    tags: string[];
    avatar?: string;
    audiofile?: string;
    source?: Record<string, unknown>;
}
export interface GenerateVoiceRequest {
    requestId: string;
    sourceTextClipId: string;
    targetAudioClipId?: string;
    text: string;
    voiceId: string;
    followTextUpdates: boolean;
    mode: 'create' | 'replace';
}
export interface GenerateVoiceResult {
    requestId: string;
    audioSrc: string;
    duration: number;
    voiceId: string;
    voiceName: string;
}
export interface ClipConfigVoicePanelOptions {
    voiceCatalog?: VoiceOption[];
    generateVoiceBatch?: (requests: GenerateVoiceRequest[]) => Promise<GenerateVoiceResult[]>;
}
export interface ClipConfig {
    id?: string;
    type?: TrackType;
    externalId?: string;
    src?: string;
    name?: string;
    isMuted?: boolean;
    startTime?: TimeMs;
    duration?: TimeMs;
    startTimeAtSource?: TimeMs;
    endTimeAtSource?: TimeMs;
    sourceDuration?: TimeMs;
    thumbnails?: string[];
    style?: Record<string, any>;
    visualTransform?: ClipVisualTransform;
    separatedAudioClipId?: string;
    separatedFromVideoClipId?: string;
    trackId?: string;
    volume?: number;
    textContent?: string;
    textStyle?: Partial<TextClipStyle>;
    ttsSourceTextClipId?: string;
    ttsVoiceId?: string;
    ttsVoiceName?: string;
    ttsFollowTextUpdates?: boolean;
}
export interface ClipEntity {
    id: string;
    type: TrackType;
    externalId?: string;
    src: string;
    name: string;
    isMuted?: boolean;
    startTime: TimeMs;
    duration: TimeMs;
    endTime: TimeMs;
    startTimeAtSource: TimeMs;
    endTimeAtSource: TimeMs;
    sourceDuration: TimeMs;
    thumbnails?: string[];
    style?: Record<string, any>;
    visualTransform?: ClipVisualTransform;
    separatedAudioClipId?: string;
    separatedFromVideoClipId?: string;
    volume?: number;
    textContent?: string;
    textStyle?: TextClipStyle;
    ttsSourceTextClipId?: string;
    ttsVoiceId?: string;
    ttsVoiceName?: string;
    ttsFollowTextUpdates?: boolean;
}
export interface ClipViewState {
    isDragging: boolean;
    isResizing: boolean;
    isResizingLeft: boolean;
    isResizingRight: boolean;
    isSelected: boolean;
    zIndex: number;
    opacity: number;
}
export type Clip = ClipEntity & ClipViewState;
export declare const DEFAULT_CLIP_VIEW_STATE: ClipViewState;
export interface TrackConfig {
    id?: string;
    type?: TrackType;
    name?: string;
    isMuted?: boolean;
    role?: 'primary' | 'normal';
    clips: Clip[];
}
export type TrackInsertionPlacement = 'before_primary' | 'after_primary' | 'top_of_type_region' | 'bottom_of_type_region' | 'before_track' | 'after_track';
export interface Track extends TrackConfig {
    id: string;
    type: TrackType;
    name: string;
    order: number;
    role: 'primary' | 'normal';
}
export interface Theme {
    background: string;
    border: string;
    timeTick: string;
    timeText: string;
    trackBackground: string;
    trackSelectedBackground?: string;
    trackBorder: string;
    clipBackground: string;
    clipBorder: string;
    clipName: string;
    clipDuration: string;
    clipHandle: string;
    clipCoverBackground: string;
    audioClipText?: string;
    audioClipAccent?: string;
    clipSelectedBorder: string;
    playhead: string;
    grid: string;
    snapGuideLineColor?: string;
    snapGuideLineWidth?: number;
    scrollbarBackground?: string;
    scrollbarBorder?: string;
    scrollbarThumb?: string;
    scrollbarThumbBorder?: string;
}
export type ThemeConfig = Partial<Theme>;
export type ResolvedTimelineConfig = Omit<TimelineConfig, 'theme'> & {
    theme: Theme;
};
export type TimelineKeyboardShortcutAction = 'togglePlay' | 'deleteSelectedClips' | 'copySelectedClips' | 'cutSelectedClips' | 'pasteClipboardClips' | 'toggleSelectedClipsAudio' | 'splitCurrentClip' | 'undo' | 'redo';
export type TimelineKeyboardShortcutBindings = Partial<Record<TimelineKeyboardShortcutAction, string | string[]>>;
export interface TimelineKeyboardShortcutsConfig {
    enabled?: boolean;
    bindings?: TimelineKeyboardShortcutBindings;
}
export declare const defaultDarkTheme: Theme;
export declare function resolveTheme(theme?: ThemeConfig): Theme;
export interface TimelineResourceCacheConfig {
    enabled?: boolean;
    maxEntryBytes?: number;
    maxTotalBytes?: number;
    ttlMs?: number;
    preferStorage?: 'opfs' | 'indexeddb';
    resolveMode?: 'prefer-fast-start' | 'prefer-cache-ready';
    allowedMimeTypes?: string[];
}
export interface TimelineConfig {
    duration: TimeMs;
    zoom: number;
    currentTime: TimeMs;
    playState: PlayState;
    container?: HTMLElement;
    theme?: ThemeConfig;
    timeScaleHeight?: number;
    diagnostics?: DiagnosticsConfig;
    speed?: number;
    dragActivationThreshold?: number;
    enableClipSnap?: boolean;
    clipSnapThreshold?: number;
    thumbnailProvider?: ThumbnailProvider;
    previewBackend?: PreviewBackendType;
    previewSourceResolver?: PreviewSourceResolver;
    resourceCache?: boolean | TimelineResourceCacheConfig;
    textPreviewFont?: TextPreviewFontConfig | null;
    draftData?: TimelineExportData;
    keyboardShortcuts?: false | TimelineKeyboardShortcutsConfig;
}
export type PreviewAspectRatioMode = 'auto-first-added-video' | 'auto-first-video' | 'manual';
export interface PreviewAspectRatio {
    mode: PreviewAspectRatioMode;
    width: number;
    height: number;
}
export interface PreviewAspectRatioPreset {
    key: 'default' | '9:16' | '16:9' | '3:4' | '4:3';
    label: string;
    aspectRatio: PreviewAspectRatio;
}
export declare const ASPECT_RATIO_BASELINE_SHORT_EDGE_PX = 720;
export declare const DEFAULT_PREVIEW_ASPECT_RATIO: PreviewAspectRatio;
export declare const PREVIEW_ASPECT_RATIO_PRESETS: PreviewAspectRatioPreset[];
export declare function normalizePreviewAspectRatioMode(mode?: PreviewAspectRatioMode | null): PreviewAspectRatioMode;
export declare function isAutoPreviewAspectRatioMode(mode?: PreviewAspectRatioMode | null): boolean;
export declare function normalizePreviewAspectRatio(aspectRatio?: Partial<PreviewAspectRatio> | null): PreviewAspectRatio;
export declare function resolveAspectRatioBaselineDimensions(aspectRatio: Pick<PreviewAspectRatio, 'width' | 'height'>, shortEdge?: number): {
    width: number;
    height: number;
};
export interface PreviewMountConfig {
    container: HTMLElement;
    aspectRatio?: {
        mode?: PreviewAspectRatioMode;
        width?: number;
        height?: number;
    };
}
export interface ActiveClipPlaybackInfo {
    trackId: string;
    trackType: TrackType;
    trackOrder: number;
    clip: Clip;
    mediaTime: TimeMs;
    muted: boolean;
    kind: TrackType;
    hasVisual: boolean;
    hasAudio: boolean;
}
export interface ClipStateUpdate {
    clipId: string;
    newState: Clip;
    previousState: Clip;
}
export interface AddClipAction {
    type: 'add_clip';
    data: Clip;
    timestamp: number;
}
export interface RemoveClipAction {
    type: 'remove_clip';
    data: {
        clip: Clip;
        sourceTrackId: string | null;
        sourceTrackSnapshot: Track | null;
        sourceTrackRestoreAnchor: TrackRestoreAnchor | null;
    };
    timestamp: number;
}
export interface TrackRestoreAnchor {
    previousTrackId: string | null;
    nextTrackId: string | null;
}
export interface UpdateClipAction {
    type: 'update_clip';
    data: {
        clipId: string;
        updates: Partial<Clip>;
        previousState: Partial<Clip>;
    };
    timestamp: number;
}
export interface SplitClipAction {
    type: 'split_clip';
    data: {
        originalClip: Clip;
        clip1: Clip;
        clip2: Clip;
    };
    timestamp: number;
}
export interface MoveClipAction {
    type: 'move_clip';
    data: {
        clipId: string;
        newStartTime: number;
        previousStartTime: number;
    };
    timestamp: number;
}
export interface ResizeClipAction {
    type: 'resize_clip';
    data: {
        clipId: string;
        newDuration: number;
        newStartTime: number;
        previousDuration: number;
        previousStartTime: number;
    };
    timestamp: number;
}
export interface SetTimeAction {
    type: 'set_time';
    data: {
        newTime: number;
        previousTime: number;
    };
    timestamp: number;
}
export interface RemoveGapsAction {
    type: 'remove_gaps';
    data: {
        clipsBefore: Clip[];
    };
    timestamp: number;
}
export interface MultiClipUpdateAction {
    type: 'multi_clip_update';
    data: {
        clipUpdates: ClipStateUpdate[];
    };
    timestamp: number;
}
export interface MoveClipBetweenTracksAction {
    type: 'move_clip_between_tracks';
    data: {
        clipId: string;
        sourceTrackId: string;
        targetTrackId: string;
        clipBefore: Clip;
        clipAfter: Clip;
        sourceTrackSnapshot: Track | null;
        targetTrackSnapshot: Track | null;
    };
    timestamp: number;
}
export interface SeparateClipAudioAction {
    type: 'separate_clip_audio';
    data: {
        videoClipBefore: Clip;
        videoClipAfter: Clip;
        audioClip: Clip | null;
        audioTrackId: string | null;
    };
    timestamp: number;
}
export interface RestoreClipAudioAction {
    type: 'restore_clip_audio';
    data: {
        videoClipBefore: Clip;
        videoClipAfter: Clip;
        audioClip: Clip | null;
        audioTrackId: string | null;
    };
    timestamp: number;
}
export interface CompoundAction {
    type: 'compound';
    data: {
        actions: Action[];
        label?: string;
    };
    timestamp: number;
}
export type Action = AddClipAction | RemoveClipAction | UpdateClipAction | SplitClipAction | MoveClipAction | ResizeClipAction | SetTimeAction | RemoveGapsAction | MultiClipUpdateAction | MoveClipBetweenTracksAction | SeparateClipAudioAction | RestoreClipAudioAction | CompoundAction;
export type ActionType = Action['type'];
export interface Position {
    x: number;
    y: number;
}
export interface Range {
    start: number;
    end: number;
}
export interface HistoryState {
    past: Action[];
    future: Action[];
}
export type TimelineEvent = 'time_change' | 'play_state_change' | 'clip_added' | 'clip_removed' | 'clip_updated' | 'zoom_change' | 'history_change' | 'track_duration_change' | 'clip_selected' | 'selected_clip_change' | 'speed_change' | 'can_play_change' | 'buffering_state_change' | 'source_loading_change' | 'preview_aspect_ratio_change' | 'draft_loaded' | 'selection_change';
export interface TimeChangeData {
    time: TimeMs;
}
export interface PlayStateChangeData {
    playState: PlayState;
}
export interface ZoomChangeData {
    zoom: number;
}
export interface ClipEventData {
    clip: Clip;
}
export interface SelectedClipChangeData {
    clip: Clip | null;
    hasSelectedClip: boolean;
}
export type SelectedClipAudioAction = 'separate' | 'restore' | null;
export interface SelectionChangeData {
    clip: Clip | null;
    hasSelectedClip: boolean;
    selectedClipIds: string[];
    canDeleteSelectedClips: boolean;
    canSplitSelectedClip: boolean;
    selectedClipAudioAction: SelectedClipAudioAction;
    canToggleSelectedClipsAudio: boolean;
}
export interface ClipRemovedEventData {
    clipId: string;
}
export interface CanPlayChangeData {
    canPlay: boolean;
}
export interface BufferingStateChangeData {
    isBuffering: boolean;
}
export interface SourceLoadingChangeData {
    isLoading: boolean;
    pending: number;
}
export interface PreviewAspectRatioChangeData {
    aspectRatio: PreviewAspectRatio;
}
export interface DraftLoadedData {
    errors: Array<{
        clipId: string;
        error: unknown;
    }>;
}
export interface MultiSelectionChangeData {
    selectedClipIds: string[];
    previousSelectedClipIds: string[];
}
export interface EventListener {
    (event: TimelineEvent, data?: any): void;
}
export interface TimelineManagerConfig {
    initialDuration?: TimeMs;
    initialZoom?: number;
    diagnostics?: DiagnosticsConfig;
    thumbnailProvider?: ThumbnailProvider;
}
export interface TimelineExportData {
    version: string;
    exportTime: number;
    coverUrl: string;
    composition: TimelineCompositionExportData;
    tracks: TrackExportData[];
}
export interface TimelineCompositionExportData {
    width: number;
    height: number;
    aspectRatio: string;
    mode: PreviewAspectRatioMode;
}
export interface TrackExportData {
    id: string;
    type: TrackType;
    name: string;
    order: number;
    role?: Track['role'];
    isMuted: boolean;
    clips: ClipExportData[];
}
export interface ClipExportData {
    id: string;
    type: TrackType;
    externalId?: string;
    src: string;
    name: string;
    isMuted: boolean;
    startTime: TimeMs;
    duration: TimeMs;
    endTime: TimeMs;
    startTimeAtSource: TimeMs;
    endTimeAtSource: TimeMs;
    sourceDuration: TimeMs;
    thumbnails?: string[];
    visualTransform?: ClipVisualTransform;
    separatedAudioClipId?: string;
    separatedFromVideoClipId?: string;
    volume?: number;
    textContent?: string;
    textStyle?: TextClipStyle;
    ttsSourceTextClipId?: string;
    ttsVoiceId?: string;
    ttsVoiceName?: string;
    ttsFollowTextUpdates?: boolean;
}
