import { Muxer } from 'mp4-muxer';
import { StreamTarget } from 'mp4-muxer';

declare type Abs<T extends Object> = {
    [K in keyof T]: T[K] extends number | Percent ? number : T[K];
};

export declare function abs(value: number | Percent, max: number): number;

/**
 * Move an element inside the provided array
 */
export declare function arraymove(arr: any[], fromIndex: number, toIndex: number): void;

/**
 * clip assert replacement for the browser
 * @example assert(true == false)
 */
export declare function assert(condition: any): void;

/**
 * Converts the specified AudioBuffer to a Blob.
 *
 * Note that changing the MIME type does not change the actual file format.
 * The output is a WAVE in any case
 */
export declare function audioBufferToWav(buffer: AudioBuffer, type?: string): Blob;

export declare class AudioClip extends MediaClip {
    readonly type = "audio";
    track?: Track<AudioClip>;
    source: AudioSource;
    /**
     * Access to the HTML5 audio element
     */
    element: HTMLAudioElement;
    constructor(source?: File | AudioSource, props?: AudioClipProps);
    init(): Promise<void>;
    update(_renderer: Renderer, _time: Timestamp, mode?: RenderMode): void | Promise<void>;
    copy(): AudioClip;
}

export declare interface AudioClipProps extends MediaClipProps {
}

export declare type AudioMimeType = keyof (typeof SUPPORTED_MIME_TYPES)['AUDIO'];

declare type AudioSettings = {
    sampleRate: number;
    numberOfChannels: number;
    bitrate: number;
};

export declare type AudioSlice = {
    start: Timestamp;
    stop: Timestamp;
};

export declare class AudioSource extends AudioSource_base {
    private decoding;
    private _silences?;
    readonly duration: Timestamp;
    readonly type: ClipType;
    element: HTMLAudioElement;
    transcript?: Transcript;
    audioBuffer?: AudioBuffer;
    protected loadElement(): Promise<void>;
    decode(numberOfChannels?: number, sampleRate?: number, cache?: boolean): Promise<AudioBuffer>;
    /**
     * Sampler that uses a window size to calculate the max value of the samples in the window.
     * @param options - Sampling options.
     * @returns An array of the max values of the samples in the window.
     */
    sample({ length, start, stop, logarithmic, }?: SamplerOptions): Promise<Float32Array>;
    thumbnail(options?: SamplerOptions): Promise<HTMLElement>;
    /**
     * Find silences in the audio clip. Results are cached.
     *
     * uses default sample rate of 3000
     * @param options - Silences options.
     * @returns An array of the silences (in ms) in the clip.
     */
    silences(options?: SilenceDetectionOptions): Promise<AudioSlice[]>;
}

declare const AudioSource_base: {
    new (...args: any[]): {
        readonly height: int;
        readonly width: int;
        readonly aspectRatio: number;
        id: `${string}-${string}-${string}-${string}-${string}`;
        toJSON(): any;
    };
} & typeof Source;

export declare class AudioTrack extends MediaTrack<AudioClip> {
    readonly type = "audio";
}

export declare type Background = {
    /**
     * @default #000000
     */
    fill?: hex;
    /**
     * @default 100
     */
    opacity?: number;
    /**
     * @default 20
     */
    borderRadius?: number;
    /**
     * @default { x: 30, y: 20 }
     */
    padding?: {
        x: int;
        y: int;
    };
};

export declare class BaseError extends Error {
    readonly message: string;
    readonly code: string;
    constructor({ message, code }: {
        message?: string | undefined;
        code?: string | undefined;
    }, ...args: any[]);
}

declare type BaseEvents<E = {}> = {
    '*': any;
    error: Error;
} & E;

/**
 * Defines the blend mode to use
 */
export declare type BlendMode = 'source-over' | 'source-in' | 'source-out' | 'source-atop' | 'destination-over' | 'destination-in' | 'destination-out' | 'destination-atop' | 'lighter' | 'copy' | 'xor' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity';

/**
 * Merges the channels of the audio blob into a mono AudioBuffer
 */
export declare function blobToMonoBuffer(blob: Blob, sampleRate?: number, scalingFactor?: number): Promise<AudioBuffer>;

/**
 * Convert an audio buffer into a planar float 32 array
 */
export declare function bufferToF32Planar(input: AudioBuffer): Float32Array;

/**
 * Conver an audio buffer inter a interleaved int 16 array
 */
export declare function bufferToI16Interleaved(audioBuffer: AudioBuffer): Int16Array;

export declare function capitalize(str: string): string;

export declare class CaptionPresetDeserializer {
    static fromJSON<K extends {
        type?: CaptionPresetType;
    }>(data: K extends string ? never : K): CaptionPresetStrategy;
}

export declare interface CaptionPresetStrategy {
    /**
     * Defines the type of strategy
     */
    type: CaptionPresetType;
    /**
     * This function returns the position of the captions
     */
    position: RelativePoint;
    /**
     * This function applies the settings to the track
     */
    applyTo(track: CaptionTrack): Promise<void>;
}

export declare type CaptionPresetType = 'CLASSIC' | 'SPOTLIGHT' | 'CASCADE' | 'GUINEA' | 'SOLAR' | 'WHISPER' | 'VERDANT' | string;

/**
 * Defines the captions transport format
 */
export declare type Captions = {
    /**
     * Defines the word or token
     * currently spoken
     */
    token: string;
    /**
     * Defines the time when the token
     * will be spoken in **milliseconds**
     */
    start: number;
    /**
     * Defines the time when the token
     * has been spoken in **milliseconds**
     */
    stop: number;
}[][];

export declare class CaptionTrack extends Track<TextClip> {
    /**
     * Defines the media clip that will be
     * used for creating the captions
     */
    clip?: MediaClip;
    readonly type = "caption";
    /**
     * The currently active captioning strategy
     */
    preset: CaptionPresetStrategy;
    /**
     * Defines the media resource from which the
     * captions will be created. It must contain
     * a `Transcript`
     */
    from(value: MediaClip | undefined): this;
    /**
     * If a transcript has been added to the resource
     * you can generate captions with this function
     * @param strategy The caption strategy to use
     * @default ClassicCaptionPreset
     */
    createCaptions(strategy?: CaptionPresetStrategy | (new () => CaptionPresetStrategy)): Promise<this>;
}

export declare class CascadeCaptionPreset extends Serializer implements CaptionPresetStrategy {
    generatorOptions: GeneratorOptions;
    readonly type = "CASCADE";
    position: RelativePoint;
    constructor(config?: Partial<DefaultCaptionPresetConfig>);
    applyTo(track: CaptionTrack): Promise<void>;
}

/**
 * Defines the properties of a circle
 */
export declare interface Circle {
    /**
     * The x coordinate of the circle
     */
    cx: number | Percent;
    /**
     * The y coordinate of the circle
     */
    cy: number | Percent;
    /**
     * The radius of the circle
     */
    radius: number;
}

export declare class CircleClip extends ShapeClip {
    track?: Track<CircleClip>;
    radius: number;
    animations: CircleClipAnimationOptions;
    constructor(props?: CircleClipProps);
    /**
     * Access to the html document that
     * will be rendered to the canvas
     */
    render(renderer: Renderer): void;
    copy(): CircleClip;
}

export declare type CircleClipAnimationOptions = (KeyframeOptions<'x' | 'y' | 'translateX' | 'translateY', number | Percent> | KeyframeOptions<'opacity' | 'rotation' | 'scale' | 'scaleX' | 'scaleY' | 'radius', number> | KeyframeOptions<'fill', string>)[];

export declare interface CircleClipProps extends ShapeClipProps {
    radius: number;
    animations?: CircleClipAnimationOptions;
}

export declare class CircleMask extends Mask {
    constructor(options: Abs<Circle>);
}

export declare class ClassicCaptionPreset extends Serializer implements CaptionPresetStrategy {
    generatorOptions: GeneratorOptions;
    readonly type: CaptionPresetType;
    position: RelativePoint;
    constructor(config?: Partial<DefaultCaptionPresetConfig>);
    applyTo(track: CaptionTrack): Promise<void>;
}

export declare class Clip extends Clip_base {
    _name: undefined | string;
    _delay: Timestamp;
    _duration: Timestamp;
    /**
     * Data associated with the clip
     */
    data: Record<string, unknown>;
    /**
     * Flag to check if the clip has been initialized
     */
    initialized: boolean;
    /**
     * Defines the type of the clip
     */
    readonly type: ClipType;
    /**
     * Defines the source of the clip with a
     * one-to-many (1:n) relationship
     */
    source?: Source;
    /**
     * Flag to check if the clip has been rendered
     */
    rendered?: boolean;
    /**
     * Timestamp when the clip has been created
     */
    readonly createdAt: Date;
    /**
     * Controls the visability of the clip
     */
    disabled: boolean;
    /**
     * Animation properties for the clip
     */
    animations: ClipAnimationOptions;
    /**
     * Access the parent track
     */
    track?: Track<Clip>;
    /**
     * Human readable identifier ot the clip
     */
    get name(): string | undefined;
    set name(name: string);
    /**
     * Get the first visible frame
     */
    get start(): Timestamp;
    /**
     * Get the last visible frame
     */
    get stop(): Timestamp;
    /**
     * Get the delay of the clip
     */
    get delay(): Timestamp;
    /**
     * Get the duration of the clip
     */
    get duration(): Timestamp;
    constructor(props?: ClipProps);
    /**
     * Set the animation time of the clip
     * and interpolate the values
     * @param time the current absolute time to render
     */
    animate(time: Timestamp): this;
    /**
     * Method for connecting the track with the clip
     */
    connect(track: Track<Clip>): Promise<void>;
    /**
     * Change clip's offset to zero in seconds. Can be negative
     */
    set delay(time: frame | Timestamp);
    /**
     * Set the duration of the clip, needs to be positive
     */
    set duration(time: frame | Timestamp);
    /**
     * Offsets the clip by a given frame number
     */
    offset(time: frame | Timestamp): this;
    /**
     * Triggered when the clip is
     * added to the composition
     */
    init(): Promise<void>;
    /**
     * Triggered when the clip enters the scene
     */
    enter(): void;
    /**
     * Triggered for each redraw of the scene.
     * Can return a promise which will be awaited
     * during export.
     * @param time the current time to render
     */
    update(renderer: Renderer, time: Timestamp, mode?: RenderMode, fps?: number): void | Promise<void>;
    render(renderer: Renderer, time: Timestamp): void;
    /**
     * Triggered when the clip exits the scene
     */
    exit(): void;
    /**
     * Remove the clip from the track
     */
    detach(): this;
    /**
     * Trim the clip to the specified start and stop
     */
    trim(start?: Timestamp | frame, stop?: Timestamp | frame): this;
    /**
     * Split the clip into two clips at the specified time
     * @param time split, will use the current frame of the composition
     * a fallback
     * @returns The clip that was created by performing this action
     */
    split(time?: frame | Timestamp): Promise<this>;
    /**
     * Create a copy of the clip
     */
    copy(): Clip;
}

declare const Clip_base: {
    new (...args: any[]): {
        _handlers: {
            '*'?: {
                [x: string]: (event: EmittedEvent<any, any>) => void;
            } | undefined;
            error?: {
                [x: string]: (event: EmittedEvent<Error, any>) => void;
            } | undefined;
            offset?: {
                [x: string]: (event: EmittedEvent<Timestamp, any>) => void;
            } | undefined;
            update?: {
                [x: string]: (event: EmittedEvent<any, any>) => void;
            } | undefined;
            frame?: {
                [x: string]: (event: EmittedEvent<number | undefined, any>) => void;
            } | undefined;
            attach?: {
                [x: string]: (event: EmittedEvent<undefined, any>) => void;
            } | undefined;
            detach?: {
                [x: string]: (event: EmittedEvent<undefined, any>) => void;
            } | undefined;
        };
        on<T extends "*" | "error" | keyof ClipEvents>(eventType: T, callback: (event: EmittedEvent<BaseEvents<ClipEvents>[T], any>) => void): string;
        off(id?: string | "*", ...ids: string[]): void;
        emit<T extends "*" | "error" | keyof ClipEvents>(eventType: T, detail: BaseEvents<ClipEvents>[T]): void;
        bubble(target: any): string;
        resolve(eventType: "*" | "error" | keyof ClipEvents): (resolve: (value: unknown) => void, reject: (reason?: any) => void) => void;
    };
} & typeof Serializer;

export declare type ClipAnimationOptions = KeyframeOptions<any, number | string | hex | Percent>[];

export declare class ClipDeserializer {
    static fromType(data: {
        type: ClipType;
    }): Clip;
    static fromSource(data: Source): VideoClip | AudioClip | HtmlClip | ImageClip | undefined;
}

export declare type ClipEvents = {
    offset: Timestamp;
    update: any;
    frame: number | undefined;
    attach: undefined;
    detach: undefined;
};

export declare interface ClipProps {
    disabled?: boolean;
    name?: string;
    duration?: frame | Timestamp;
    delay?: frame | Timestamp;
    animations?: ClipAnimationOptions;
}

export declare type ClipType = 'image' | 'audio' | 'text' | 'video' | 'base' | 'html' | 'shape';

export declare class Composition extends Composition_base {
    /**
     * Access to the gpu renderer
     */
    renderer: Renderer;
    /**
     * Tracks attached to the composition
     */
    tracks: Track<Clip>[];
    /**
     * The ticker used for rendering the composition
     */
    ticker: Ticker;
    constructor({ height, width, background, }?: Partial<CompositionSettings>);
    /**
     * Settings of the composition
     */
    get settings(): CompositionSettings;
    /**
     * Get the current width of the canvas
     */
    get width(): number;
    /**
     * Get the current height of the canvas
     */
    get height(): number;
    /**
     * This is where the playback stops playing
     */
    get duration(): Timestamp;
    /**
     * Limit the total duration of the composition
     */
    set duration(time: frame | Timestamp | undefined);
    /**
     * Resize the renderer
     */
    resize(width: number, height: number): void;
    /**
     * Add the renderer to the dom.
     * This will start the ticker
     */
    mount(element: HTMLElement): void;
    /**
     * Remove the renderer from the dom.
     * This will stop the ticker
     */
    unmount(): void;
    /**
     * Insert a new track at the specified index (defaults to 0)
     * @param Track The track to insert
     * @param index The index to insert at (0 = top layer, default: 0)
     */
    insertTrack<L extends Track<Clip>>(Track: (new () => L) | L, index?: number): L;
    /**
     * Create a track with the given type
     * @param type the desired type of the track
     * @returns A new track
     */
    createTrack<T extends TrackType>(type: T): TrackMap[T];
    /**
     * Convenience function for appending a track
     * aswell as the clip to the composition
     */
    add<L extends Clip>(clip: L): Promise<L>;
    /**
     * Remove a given clip from the composition
     * @returns `Clip` when it has been successfully removed `undefined` otherwise
     */
    remove<L extends Clip>(clip: L): L | undefined;
    /**
     * Remove all tracks that are of the specified type
     * @param track type to be removed
     */
    removeTracks(Track: new (composition: Composition) => Track<Clip>): Track<Clip>[];
    /**
     * Find tracks that match the profided parameters
     */
    findTracks<T extends Track<Clip>>(predicate: ((value: Track<Clip>) => boolean) | (new () => T)): T[];
    /**
     * Find clips that match the profided parameters
     */
    findClips<T extends Clip>(predicate: ((value: Clip) => boolean) | (new () => T)): T[];
    /**
     * Compute the currently active frame
     */
    render(frame: frame): void;
    /**
     * Update the composition at a specific frame
     */
    update(frame: frame): void;
    /**
     * Take a screenshot of the still frame
     */
    screenshot(format?: ScreenshotImageFormat, quality?: number): string;
    /**
     * Set the playback position to a specific time
     * @param value new playback time
     */
    seek(value: frame | Timestamp): Promise<void>;
    /**
     * Play the composition
     */
    play(): Promise<void>;
    /**
     * Pause the composition
     */
    pause(): Promise<void>;
    audio(numberOfChannels?: number, sampleRate?: number): Promise<AudioBuffer>;
    /**
     * Remove all tracks and clips from the composition
     */
    clear(): void;
    /**
     * Get the current playback time and composition
     * duration formatted as `00:00 / 00:00` by default.
     * if **hours** is set the format is `HH:mm:ss` whereas
     * **milliseconds** will return `mm:ss.SSS`
     */
    time(precision?: {
        hours?: boolean;
        milliseconds?: boolean;
    }): string;
    /**
     * Remove a given track from the composition
     * @returns `Track` when it has been successfully removed `undefined` otherwise
     */
    removeTrack<T extends Track<Clip>>(track: T): T | undefined;
}

declare const Composition_base: {
    new (...args: any[]): {
        _handlers: {
            '*'?: {
                [x: string]: (event: EmittedEvent<any, any>) => void;
            } | undefined;
            error?: {
                [x: string]: (event: EmittedEvent<Error, any>) => void;
            } | undefined;
            play?: {
                [x: string]: (event: EmittedEvent<frame, any>) => void;
            } | undefined;
            pause?: {
                [x: string]: (event: EmittedEvent<frame, any>) => void;
            } | undefined;
            init?: {
                [x: string]: (event: EmittedEvent<undefined, any>) => void;
            } | undefined;
            currentframe?: {
                [x: string]: (event: EmittedEvent<frame, any>) => void;
            } | undefined;
            update?: {
                [x: string]: (event: EmittedEvent<any, any>) => void;
            } | undefined;
            frame?: {
                [x: string]: (event: EmittedEvent<number | undefined, any>) => void;
            } | undefined;
            attach?: {
                [x: string]: (event: EmittedEvent<undefined, any>) => void;
            } | undefined;
            detach?: {
                [x: string]: (event: EmittedEvent<undefined, any>) => void;
            } | undefined;
            load?: {
                [x: string]: (event: EmittedEvent<undefined, any>) => void;
            } | undefined;
            resize?: {
                [x: string]: (event: EmittedEvent<undefined, any>) => void;
            } | undefined;
        };
        on<T extends "*" | "error" | keyof CompositionEvents>(eventType: T, callback: (event: EmittedEvent<BaseEvents<CompositionEvents>[T], any>) => void): string;
        off(id?: string | "*", ...ids: string[]): void;
        emit<T extends "*" | "error" | keyof CompositionEvents>(eventType: T, detail: BaseEvents<CompositionEvents>[T]): void;
        bubble(target: any): string;
        resolve(eventType: "*" | "error" | keyof CompositionEvents): (resolve: (value: unknown) => void, reject: (reason?: any) => void) => void;
    };
} & typeof Serializer;

/**
 * Defines the type of events emitted by the
 * composition
 */
export declare type CompositionEvents = {
    play: frame;
    pause: frame;
    init: undefined;
    currentframe: frame;
    update: any;
    frame: number | undefined;
    attach: undefined;
    detach: undefined;
    load: undefined;
    resize: undefined;
};

export declare type CompositionSettings = {
    /**
     * Height of the composition
     *
     * @default 1080
     */
    height: int;
    /**
     * Width of the composition
     *
     * @default 1920
     */
    width: int;
    /**
     * Background color of the composition
     *
     * @default #000000
     */
    background: hex | 'transparent';
};

/**
 * Defines the constructor required by mixins
 */
export declare type Constructor<T = {}> = new (...args: any[]) => T;

/**
 * Limit the number of times a function can be called
 * per interval, timeout is in milliseconds
 */
export declare function debounce(func: Function, timeout?: number): (...args: any[]) => void;

export declare type DefaultCaptionPresetConfig = {
    generatorOptions: GeneratorOptions;
    position: RelativePoint;
};

export declare type Deserializer<T> = (data: any) => Promise<T> | T;

/**
 * This utility creates an anchor tag and clicks on it
 * @param source Blob url or base64 encoded svg
 * @param name File name suggestion
 */
export declare function downloadObject(source: string | Blob, name?: string): Promise<void>;

/**
 * An optional easing function to apply to the interpolation.
 * Easing functions can modify the interpolation to be non-linear.
 * @default "linear"
 */
declare type Easing = 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'ease-out-in';

declare type EmittedEvent<K, T extends {}> = OverrideValues<CustomEvent<K>, {
    target: T;
}>;

export declare type EncodedOpusChunk = {
    data: Uint8Array;
    timestamp: number;
    type: 'key' | 'delta';
    duration: number;
};

export declare type EncodedOpusChunkOutputCallback = (output: EncodedOpusChunk, metadata: EncodedAudioChunkMetadata) => void;

export declare class Encoder extends WebcodecsVideoEncoder {
    private audioEncoder?;
    /**
     * Create a new audio and video encoder and multiplex the result
     * using a mp4 container
     * @param composition The composition to render
     * @param options Configure the output
     * @example
     * ```
     * new Encoder(composition, { resolution: 2 }).render() // will render at 4K
     * ```
     */
    constructor(composition: Composition, init?: VideoEncoderInit_2);
    /**
     * Export the specified composition
     * @throws DOMException if the export has been aborted
     */
    render(target?: StreamCallback | FileSystemFileHandle | string, signal?: AbortSignal): Promise<undefined | Blob>;
    /**
     * Check which configurations are supported and select the best
     * @returns A supported audio and video configuration
     */
    private getConfigs;
}

export declare class EncoderError extends BaseError {
}

declare type EncoderEvents = {
    render: {
        /**
         * Defines how many frames were rendered yet
         */
        progress: number;
        /**
         * Defines the total number of frames
         * to be rendered
         */
        total: number;
        /**
         * Defines the estimated remaining
         * render time
         */
        remaining: Date;
    };
};

declare interface EncoderInit {
    /**
     * A floating point number indicating the audio context's sample rate, in samples per second.
     *
     * @default 48000
     */
    sampleRate?: number;
    /**
     * Defines the number of channels
     * of the composed audio
     *
     * @default 2
     */
    numberOfChannels?: number;
    /**
     * Defines the bitrate at which the video
     * should be rendered at
     * @default 10e6
     */
    videoBitrate?: number;
    /**
     * Defines the maximum size of the video
     * encoding queue, increasing this number
     * will put a higher pressure on the gpu.
     * It's restricted to a value between 1 and 100
     * @default 5
     */
    gpuBatchSize?: number;
    /**
     * Defines the fps at which the composition
     * will be rendered
     * @default 30
     */
    fps?: number;
    /**
     * Defines if the audio should be encoded
     */
    audio?: boolean;
}

/**
 * Error message structure
 */
export declare type ErrorEventDetail = {
    msg: string;
    code: string;
    params?: any;
};

export declare function EventEmitter<Events = {}>(): {
    new (...args: any[]): {
        _handlers: { [T in keyof BaseEvents<Events>]?: {
                [x: string]: (event: EmittedEvent<BaseEvents<Events>[T], any>) => void;
            } | undefined; };
        on<T_1 extends "*" | "error" | keyof Events>(eventType: T_1, callback: (event: EmittedEvent<BaseEvents<Events>[T_1], any>) => void): string;
        off(id?: string | "*", ...ids: string[]): void;
        emit<T_1 extends "*" | "error" | keyof Events>(eventType: T_1, detail: BaseEvents<Events>[T_1]): void;
        bubble(target: {
            _handlers: { [T in keyof BaseEvents<Events>]?: {
                    [x: string]: (event: EmittedEvent<BaseEvents<Events>[T], any>) => void;
                } | undefined; };
            on<T_1 extends "*" | "error" | keyof Events>(eventType: T_1, callback: (event: EmittedEvent<BaseEvents<Events>[T_1], any>) => void): string;
            off(id?: string | "*", ...ids: string[]): void;
            emit<T_1 extends "*" | "error" | keyof Events>(eventType: T_1, detail: BaseEvents<Events>[T_1]): void;
            bubble(target: any): string;
            resolve(eventType: "*" | "error" | keyof Events): (resolve: (value: unknown) => void, reject: (reason?: any) => void) => void;
        }): string;
        resolve(eventType: "*" | "error" | keyof Events): (resolve: (value: unknown) => void, reject: (reason?: any) => void) => void;
    };
};

export declare function EventEmitterMixin<Events = {}, T extends Constructor = Constructor>(Base: T): {
    new (...args: any[]): {
        _handlers: { [T_1 in keyof BaseEvents<Events>]?: {
                [x: string]: (event: EmittedEvent<BaseEvents<Events>[T_1], any>) => void;
            }; };
        on<T_1 extends keyof BaseEvents<Events>>(eventType: T_1, callback: (event: EmittedEvent<BaseEvents<Events>[T_1], any>) => void): string;
        off(id?: string | "*", ...ids: string[]): void;
        emit<T_1 extends keyof BaseEvents<Events>>(eventType: T_1, detail: BaseEvents<Events>[T_1]): void;
        bubble(target: any): string;
        resolve(eventType: keyof BaseEvents<Events>): (resolve: (value: unknown) => void, reject: (reason?: any) => void) => void;
    };
} & T;

declare type EventListener_2 = (event: MessageEvent<any>['data']) => void;

declare type Events = {
    load: undefined;
    update: undefined;
};

declare type Events_2 = {
    update: any;
    frame: number | undefined;
    attach: undefined;
    detach: undefined;
};

declare type Events_3 = {
    update: any;
};

/**
 * Defines the extrapolation behavior outside the input range.
 * - "clamp": Clamps the value to the nearest endpoint within the range.
 * - "extend": Allows values to extend beyond the range.
 * @default "clamp"
 */
declare type Extrapolate = 'clamp' | 'extend';

/**
 * Defines the fill properties that
 * can be applied to a shape
 */
export declare interface FillOptions {
    /**
     * The color of the fill
     */
    color: hex | Gradient | Pattern;
    /**
     * The opacity of the fill
     */
    opacity?: number;
}

/**
 * Defines the fill rule of the mask
 */
export declare type FillRule = 'nonzero' | 'evenodd';

/**
 * Defines a floating point number
 */
export declare type float = (number & {
    _float: void;
}) | number;

/**
 * Converts a Float32Array to 16-bit PCM.
 */
export declare function floatTo16BitPCM(dataview: DataView, buffer: Float32Array, offset: number): DataView;

/**
 * Defines the properties of a font
 */
export declare interface Font {
    /**
     * The size of the font
     */
    size: number;
    /**
     * The family of the font
     */
    family: string;
    /**
     * The weight of the font
     */
    weight?: FontWeight;
    /**
     * The style of the font
     */
    style?: FontStyle;
}

export declare const FONT_WEIGHTS: {
    readonly '100': "Thin";
    readonly '200': "Extra Light";
    readonly '300': "Light";
    readonly '400': "Normal";
    readonly '500': "Medium";
    readonly '600': "Semi Bold";
    readonly '700': "Bold";
    readonly '800': "Extra Bold";
    readonly '900': "Black";
};

/**
 * Defines all available font families
 */
export declare type FontFamily = keyof typeof WebFonts | string;

export declare class FontManager extends Serializer {
    /**
     * The fonts that have been loaded
     */
    loadedFonts: types_2.FontSource[];
    /**
     * Load the font that has been initiated via the constructor
     */
    load<T extends keyof typeof WebFonts>(options: types_2.FontSource | types_2.WebfontProperties<T>): Promise<Font>;
    /**
     * Reload all fonts
     */
    reload(): Promise<void>;
    /**
     * Get all available local fonts, requires the
     * **Local Font Access API**
     */
    static localFonts(): Promise<types_2.FontSources[]>;
    /**
     * Get common web fonts
     */
    static webFonts(): types_2.FontSources[];
    static load<T extends keyof typeof WebFonts>(options: types_2.FontSource | types_2.WebfontProperties<T>): Promise<Font>;
    copy(): FontManager;
}

/**
 * Defines the properties that are required
 * to load a new font
 */
export declare type FontSource = {
    /**
     * Name of the Family
     * @example 'Arial'
     */
    family: string;
    /**
     * Source of the Variant
     * @example url(arial.ttf)
     */
    source: string;
    /**
     * Defines the font style
     * @example 'italic'
     */
    style?: FontStyle;
    /**
     * The weight of the font
     * @example '400'
     */
    weight?: FontWeight;
    /**
     * The size of the font
     * @example 16
     */
    size?: number;
};

/**
 * Defines a single font that has one or
 * more variants
 */
export declare type FontSources = {
    family: string;
    variants: FontSource[];
};

/**
 * Defines the style of the font
 */
export declare type FontStyle = 'normal' | 'italic' | 'oblique';

/**
 * Defines all available font subsets which
 * limit the number of characters
 */
export declare type FontSubset = 'latin' | 'latin-ext' | 'vietnamese' | 'cyrillic' | 'cyrillic-ext';

/**
 * Defines the source where the font is coming from
 */
export declare type FontType = 'local' | 'web';

/**
 * Defines the thickness/weight of the font
 */
export declare type FontWeight = 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';

export declare const FPS_DEFAULT = 30;

/**
 * Defines an interger that correspondes
 * to a point in time
 */
export declare type frame = (number & {
    _frame: void;
}) | number;

/**
 * Convert frames to milliseconds
 */
export declare function framesToMillis(frames: frame, fps?: number): number;

/**
 * Convert frames into seconds
 */
export declare function framesToSeconds(frames: frame, fps?: number): number;

export declare type GeneratorOptions = {
    /**
     * Iterates by word count
     */
    count?: [number, number?];
    /**
     * Iterates by group duration
     */
    duration?: [number, number?];
    /**
     * Iterates by number of characters within the group
     */
    length?: [number, number?];
};

/**
 * Function for retrieving supported audio encoder configurations
 */
export declare function getAudioEncoderConfigs(settings: AudioSettings): Promise<AudioEncoderConfig[]>;

/**
 * Function for retrieving the best supported audio
 * and video profiles
 */
export declare function getSupportedEncoderConfigs(settings: {
    audio: AudioSettings;
    video: VideoSettings;
}): Promise<[VideoEncoderConfig, AudioEncoderConfig | undefined]>;

/**
 * Function for retrieving supported video encoder
 * configurations
 */
export declare function getVideoEncoderConfigs(settings: VideoSettings): Promise<VideoEncoderConfig[]>;

/**
 * Defines the properties of a glow
 */
export declare interface Glow {
    /**
     * The color of the glow
     */
    color: hex;
    /**
     * The radius of the glow
     */
    radius?: number;
    /**
     * The intensity of the glow
     */
    intensity?: number;
    /**
     * The opacity of the glow
     */
    opacity?: number;
}

/**
 * Defines the properties of a gradient
 */
export declare interface Gradient {
    /**
     * The type of gradient to use
     */
    type: GradientType;
    /**
     * The stops of the gradient
     */
    stops: GradientStop[];
}

/**
 * Defines the properties of a gradient stop
 */
export declare interface GradientStop {
    /**
     * The offset of the gradient stop
     */
    offset: number;
    /**
     * The color of the gradient stop
     */
    color: string;
}

/**
 * Defines the type of gradient to use
 */
export declare type GradientType = 'linear' | 'radial';

/**
 * Group an array of objects by the specified key
 */
export declare function groupBy<T extends {}, K extends keyof T>(arr: T[], key: K): Record<T[K], T[]>;

export declare class GuineaCaptionPreset extends Serializer implements CaptionPresetStrategy {
    readonly type: CaptionPresetType;
    colors: hex[];
    position: RelativePoint;
    constructor(config?: Partial<MultiColorCaptionPresetConfig>);
    applyTo(track: CaptionTrack): Promise<void>;
    protected splitSequence(sequence: WordGroup): {
        segments: string[];
        words: Word[][];
    };
}

/**
 * Defines a color hex value
 */
export declare type hex = `#${string}`;

export declare function hexWithOpacity(color?: hex, opacity?: number): hex;

export declare class HtmlClip extends HtmlClip_base {
    readonly type = "html";
    track?: Track<HtmlClip>;
    source: HtmlSource;
    animations: HtmlClipAnimationOptions;
    /**
     * Access to the html document that
     * will be rendered to the canvas
     */
    readonly element: HTMLImageElement;
    constructor(source?: File | HtmlSource, props?: HtmlClipProps);
    init(): Promise<void>;
    render(renderer: Renderer): void;
    copy(): HtmlClip;
    refresh(): this;
}

declare const HtmlClip_base: {
    new (...args: any[]): {
        source: VisualSource;
        _height?: number | Percent;
        _width?: number | Percent;
        mask?: Mask;
        anchorX: number;
        anchorY: number;
        scaleX: number;
        scaleY: number;
        translateX: number;
        translateY: number;
        freeTransform: boolean;
        x: number | Percent;
        y: number | Percent;
        rotation: number;
        opacity: number;
        filter?: string;
        blendMode?: BlendMode;
        get translate(): Point;
        set translate(value: Point | number);
        get anchor(): Point;
        set anchor(value: Point | number);
        get scale(): Point;
        set scale(value: Point | number);
        get height(): number | Percent;
        set height(value: Percent | number | undefined);
        get width(): number | Percent;
        set width(value: Percent | number | undefined);
        get position(): RelativePoint;
        set position(value: RelativePoint | "center");
        readonly size: Size;
        track?: {
            composition?: {
                height?: number;
                width?: number;
            };
        };
        id: `${string}-${string}-${string}-${string}-${string}`;
        toJSON(): any;
    };
} & typeof Clip;

export declare type HtmlClipAnimationOptions = VisualMixinAnimationOptions;

export declare interface HtmlClipProps extends ClipProps, VisualMixinProps {
    animations?: HtmlClipAnimationOptions;
}

export declare class HtmlSource extends HtmlSource_base {
    readonly type: ClipType;
    /**
     * Access to the iframe that is required
     * for extracting the html's dimensions
     */
    element: HTMLIFrameElement;
    constructor();
    get height(): number;
    get width(): number;
    /**
     * Access to the html document as loaded
     * within the iframe. Can be manipulated with
     * javascript
     */
    get document(): Document | undefined;
    get imageUrl(): string;
    thumbnail(): Promise<HTMLImageElement>;
}

declare const HtmlSource_base: {
    new (...args: any[]): {
        readonly height: int;
        readonly width: int;
        readonly aspectRatio: number;
        id: `${string}-${string}-${string}-${string}-${string}`;
        toJSON(): any;
    };
} & typeof Source;

export declare class HtmlTrack extends Track<HtmlClip> {
    readonly type = "html";
}

export declare class ImageClip extends ImageClip_base {
    readonly type = "image";
    track?: Track<ImageClip>;
    element: HTMLImageElement;
    source: ImageSource;
    animations: ImageClipAnimationOptions;
    constructor(source?: File | ImageSource, props?: ImageClipProps);
    init(): Promise<void>;
    render(renderer: Renderer): void;
    copy(): ImageClip;
}

declare const ImageClip_base: {
    new (...args: any[]): {
        source: VisualSource;
        _height?: number | Percent;
        _width?: number | Percent;
        mask?: Mask;
        anchorX: number;
        anchorY: number;
        scaleX: number;
        scaleY: number;
        translateX: number;
        translateY: number;
        freeTransform: boolean;
        x: number | Percent;
        y: number | Percent;
        rotation: number;
        opacity: number;
        filter?: string;
        blendMode?: BlendMode;
        get translate(): Point;
        set translate(value: Point | number);
        get anchor(): Point;
        set anchor(value: Point | number);
        get scale(): Point;
        set scale(value: Point | number);
        get height(): number | Percent;
        set height(value: Percent | number | undefined);
        get width(): number | Percent;
        set width(value: Percent | number | undefined);
        get position(): RelativePoint;
        set position(value: RelativePoint | "center");
        readonly size: Size;
        track?: {
            composition?: {
                height?: number;
                width?: number;
            };
        };
        id: `${string}-${string}-${string}-${string}-${string}`;
        toJSON(): any;
    };
} & typeof Clip;

export declare type ImageClipAnimationOptions = VisualMixinAnimationOptions;

export declare interface ImageClipProps extends ClipProps, VisualMixinProps {
    animations?: ImageClipAnimationOptions;
}

export declare type ImageMimeType = keyof (typeof SUPPORTED_MIME_TYPES)['IMAGE'];

/**
 * Defines the properties of an image
 */
export declare interface ImageOptions {
    /**
     * The x coordinate of the image
     */
    x?: number | Percent;
    /**
     * The y coordinate of the image
     */
    y?: number | Percent;
    /**
     * The width of the image
     */
    width?: number | Percent;
    /**
     * The height of the image
     */
    height?: number | Percent;
}

export declare class ImageSource extends ImageSource_base {
    readonly type: ClipType;
    element: HTMLImageElement;
    get height(): number;
    get width(): number;
    thumbnail(): Promise<HTMLImageElement>;
}

declare const ImageSource_base: {
    new (...args: any[]): {
        readonly height: int;
        readonly width: int;
        readonly aspectRatio: number;
        id: `${string}-${string}-${string}-${string}-${string}`;
        toJSON(): any;
    };
} & typeof Source;

declare class ImageTrack_2 extends Track<ImageClip> {
    readonly type = "image";
}
export { ImageTrack_2 as ImageTrack }

export declare type InsertMode = (typeof insertModes)[number];

declare const insertModes: readonly ["DEFAULT", "STACK"];

declare interface InsertStrategy<T extends InsertMode> {
    readonly mode: T;
    add(clip: Clip, track: Track<Clip>, index?: number): void;
    update(clip: Clip, track: Track<Clip>): void;
    offset(time: Timestamp, track: Track<Clip>): void;
}

/**
 * Defines a number without decimal places
 */
export declare type int = (number & {
    _int: void;
}) | number;

/**
 * Converts an AudioBuffer to a Float32Array.
 * For 2 channels it will result in something like:
 * [L[0], R[0], L[1], R[1], ... , L[n], R[n]]
 */
export declare function interleave(input: AudioBuffer): Float32Array;

export declare class IOError extends BaseError {
}

/**
 * Check whether a given value is a class
 */
export declare function isClass(value: any): boolean;

declare interface KeyFrame<T> {
    value: T;
    frame: number;
    easing?: Easing;
}

declare interface KeyframeOptions<K, T> {
    key: K;
    extrapolate?: Extrapolate;
    frames: KeyFrame<T>[];
    easing?: Easing;
}

export declare enum Language {
    en = "en",
    de = "de"
}

export declare class Library extends Library_base {
    sources: Source[];
    add(...sources: (Source | Promise<Source>)[]): Promise<this>;
    remove(source: Source | string): this;
    get<T extends Source>(key: string): T;
    at<T extends Source>(index: number): T;
}

declare const Library_base: {
    new (...args: any[]): {
        _handlers: {
            '*'?: {
                [x: string]: (event: EmittedEvent<any, any>) => void;
            } | undefined;
            error?: {
                [x: string]: (event: EmittedEvent<Error, any>) => void;
            } | undefined;
            add?: {
                [x: string]: (event: EmittedEvent<string, any>) => void;
            } | undefined;
            remove?: {
                [x: string]: (event: EmittedEvent<string, any>) => void;
            } | undefined;
        };
        on<T extends "*" | "error" | keyof LibraryEvents>(eventType: T, callback: (event: EmittedEvent<BaseEvents<LibraryEvents>[T], any>) => void): string;
        off(id?: string | "*", ...ids: string[]): void;
        emit<T extends "*" | "error" | keyof LibraryEvents>(eventType: T, detail: BaseEvents<LibraryEvents>[T]): void;
        bubble(target: any): string;
        resolve(eventType: "*" | "error" | keyof LibraryEvents): (resolve: (value: unknown) => void, reject: (reason?: any) => void) => void;
    };
} & Constructor;

declare type LibraryEvents = {
    add: string;
    remove: string;
};

/**
 * Defines the cap style of the stroke
 */
export declare type LineCap = 'butt' | 'round' | 'square';

/**
 * Defines the join style of the stroke
 */
export declare type LineJoin = 'bevel' | 'round' | 'miter';

export declare class Mask {
    path: Path2D;
    fillRule?: FillRule;
}

export declare class MediaClip extends Clip {
    source: AudioSource;
    element?: HTMLAudioElement | HTMLVideoElement;
    /**
     * Is the media currently playing
     */
    playing: boolean;
    /**
     * Trimmed start and stop values
     */
    range: [Timestamp, Timestamp];
    constructor(props?: MediaClipProps);
    /**
     * Defines the transcript of the video/audio.
     * Will be trimmed to the clip range.
     * If the duration is not set, the transcript will be returned.
     */
    get transcript(): Transcript | undefined;
    set transcript(transcript: Transcript | undefined);
    get start(): Timestamp;
    get stop(): Timestamp;
    get duration(): Timestamp;
    set duration(time: frame | Timestamp);
    /**
     * Defines if the clip is currently muted
     * @default false
     */
    get muted(): boolean;
    set muted(state: boolean);
    trim(start?: frame | Timestamp, stop?: frame | Timestamp): this;
    /**
     * Set the media playback to a given time
     */
    seek(time: Timestamp): Promise<void>;
    exit(): void;
    /**
     * Returns a slice of a media clip with trimmed start and stop
     */
    subclip(start?: frame | Timestamp, stop?: frame | Timestamp): this;
    /**
     * Number between 0 and 1 defining the volume of the media
     * @default 1;
     */
    get volume(): float;
    set volume(volume: float);
    copy(): MediaClip;
    split(time?: frame | Timestamp): Promise<this>;
    /**
     * Generates a new caption track for the current clip using the specified captioning strategy.
     * @param strategy An optional CaptionPresetStrategy to define how captions should be generated.
     */
    createCaptions(strategy?: CaptionPresetStrategy | (new () => CaptionPresetStrategy)): Promise<CaptionTrack>;
    /**
     * Remove silences from the clip
     *
     * @param options - Options for silence detection
     */
    removeSilences(options?: SilenceRemoveOptions): Promise<MediaClip[]>;
}

export declare interface MediaClipProps extends ClipProps {
    playing?: boolean;
    transcript?: Transcript;
    volume?: number;
    muted?: boolean;
}

export declare class MediaTrack<Clip extends MediaClip> extends Track<MediaClip> {
    clips: Clip[];
    seek(time: Timestamp): Promise<void>;
    /**
     * Remove silences from all clips in the track
     *
     * @param options - Options for silence detection
     */
    removeSilences(options?: SilenceRemoveOptions): Promise<void>;
}

declare type MimeType_2 = ImageMimeType | VideoMimeType | AudioMimeType;
export { MimeType_2 as MimeType }

export declare type MixinType<T extends (...args: any[]) => {
    new (...args: any[]): any;
}> = InstanceType<ReturnType<T>>;

export declare type MultiColorCaptionPresetConfig = {
    colors: hex[] | undefined;
} & DefaultCaptionPresetConfig;

export declare class OpusEncoder {
    output: EncodedOpusChunkOutputCallback;
    error: WebCodecsErrorCallback;
    config?: OpusEncoderConfig;
    private encoder?;
    private opus?;
    private meta?;
    /**
     * Create a new OpusEncoder for encoding pcm to opus
     * @param init encoder callbacks
     */
    constructor(init: OpusEncoderInit);
    /**
     * Configure the encoder. **Note** these values must match the samples to encode
     * @param config The sample rate and channel count to use
     */
    configure(config: OpusEncoderConfig): Promise<void>;
    /**
     * Encode the samples synchronously (this is a blocking event)
     * @param samples The data to encode
     */
    encode({ data, numberOfFrames, timestamp }: OpusEncoderSamples): void;
}

export declare type OpusEncoderConfig = Omit<AudioEncoderConfig, 'codec' | 'bitrate'>;

export declare type OpusEncoderInit = {
    output: EncodedOpusChunkOutputCallback;
    error: WebCodecsErrorCallback;
};

export declare type OpusEncoderSamples = {
    /**
     * 16-bit signed integer array of interleaved audio samples
     */
    data: Int16Array;
    /**
     * The number of frames (usually total samples / number of channels)
     */
    numberOfFrames: number;
    /**
     * Defines the timestamp of the first frame
     */
    timestamp?: number;
};

declare type OverrideValues<T, U> = Omit<T, keyof U> & Pick<U, Extract<keyof U, keyof T>>;

/**
 * Make sure a mimetype is valid
 * @param mimeType The mimetype to check
 * @returns A valid mimetype
 */
export declare function parseMimeType(mimeType?: string | null): MimeType_2;

/**
 * Defines the properties of a pattern
 */
export declare interface Pattern {
    /**
     * The image to use for the pattern
     */
    image: HTMLImageElement | HTMLCanvasElement;
    /**
     * The repetition of the pattern
     */
    repetition: PatternRepetition;
}

/**
 * Defines the repetition of the pattern
 */
export declare type PatternRepetition = 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat';

/**
 * Defines a string that starts with a number
 * and ends with a `%` character
 * @example '50%'
 */
export declare type Percent = `${number}%`;

/**
 * Defines the properties of a point
 */
export declare interface Point {
    /**
     * The x coordinate of the point
     */
    x: number;
    /**
     * The y coordinate of the point
     */
    y: number;
}

/**
 * Generate a random value between two numbers
 */
export declare function randInt(min: number, max: number | undefined): number;

/**
 * Defines the properties of a rectangle
 */
export declare interface Rect extends Partial<Point> {
    /**
     * The width of the rectangle
     */
    width: number | Percent;
    /**
     * The height of the rectangle
     */
    height: number | Percent;
}

export declare class RectangleClip extends ShapeClip {
    track?: Track<RectangleClip>;
    animations: RectangleClipAnimationOptions;
    radius?: number;
    constructor(props?: RectangleClipProps);
    /**
     * Access to the html document that
     * will be rendered to the canvas
     */
    render(renderer: Renderer): void;
    copy(): RectangleClip;
}

export declare type RectangleClipAnimationOptions = (KeyframeOptions<'x' | 'y' | 'height' | 'width' | 'translateX' | 'translateY', number | Percent> | KeyframeOptions<'opacity' | 'rotation' | 'scale' | 'scaleX' | 'scaleY' | 'radius', number> | KeyframeOptions<'fill', string>)[];

export declare interface RectangleClipProps extends ShapeClipProps {
    radius?: number;
    animations?: RectangleClipAnimationOptions;
}

export declare class RectangleMask extends Mask {
    constructor(options: Abs<RoundRect>);
}

declare class ReferenceError_2 extends BaseError {
}
export { ReferenceError_2 as ReferenceError }

export declare interface RelativePoint {
    /**
     * The x coordinate of the point
     */
    x: number | Percent;
    /**
     * The y coordinate of the point
     */
    y: number | Percent;
}

export declare class Renderer {
    /**
     * The canvas element
     */
    readonly canvas: HTMLCanvasElement;
    /**
     * The context of the canvas
     */
    readonly ctx: CanvasRenderingContext2D;
    /**
     * The resolution of the canvas
     */
    resolution: number;
    /**
     * The width of the canvas
     */
    width: number;
    /**
     * The height of the canvas
     */
    height: number;
    /**
     * The background color of the canvas
     */
    background: hex | 'transparent';
    /**
     * The scale of the text
     */
    textScale: number;
    constructor(width?: number, height?: number, background?: hex | 'transparent', resolution?: number);
    /**
     * Resize the canvas
     */
    resize(width: number, height: number): this;
    /**
     * Copy the renderer
     */
    copy(resolution?: number): Renderer;
    clear(region?: Rect): this;
    rect(rect: RoundRect): this;
    circle(circle: Circle): this;
    image(image: CanvasImageSourceWebCodecs, options: ImageOptions): this;
    clip(path?: Path2D, fillRule?: FillRule): this;
    opacity(opacity: number): this;
    text(options: TextOptions): this;
    strokeText(text: string, options: RelativePoint): this;
    fillText(text: string, options: RelativePoint): this;
    measureText(text: string, options: Font): TextMetrics;
    transform(transform?: Transform): this;
    blendMode(mode?: BlendMode): this;
    save(): this;
    restore(): this;
    filter(filter?: string): this;
    fill(options?: FillOptions, draw?: boolean): this;
    shadow(options?: Shadow): this;
    stroke(options?: Stroke, draw?: boolean): this;
    /**
     * Add the renderer to the dom
     */
    mount(element: HTMLElement): void;
    /**
     * Remove the renderer from the dom
     */
    unmount(): void;
    private createGradient;
    private createFontString;
    /**
     * Draw a watermark on the canvas
     */
    watermark(text?: string): void;
}

/**
 * Defines the render mode of the composition
 */
export declare type RenderMode = 'pause' | 'play' | 'render';

/**
 * Change the sample rate of an audio buffer
 * @param buffer The buffer to resample
 * @param sampleRate The desired sample rate
 * @param numberOfChannels The desired number of channels
 * @returns The resampled audio buffer
 */
export declare function resampleBuffer(buffer: AudioBuffer, sampleRate?: number, numberOfChannels?: number): AudioBuffer;

export declare class RichTextClip extends TextClip {
    track?: Track<RichTextClip>;
    private model?;
    /**
     * The width at which text will wrap
     */
    maxWidth: number | Percent | undefined;
    background?: types.Background;
    styles?: types.StyleOverride[];
    constructor(props?: RichTextClipProps);
    update(renderer: Renderer): void;
    render(renderer: Renderer): Promise<void>;
    copy(): RichTextClip;
}

export declare interface RichTextClipProps extends Omit<TextClipProps, 'glow'> {
    background?: Background;
    styles?: StyleOverride[];
    maxWidth?: number | Percent;
}

/**
 * Defines the properties of a rounded rectangle
 */
export declare interface RoundRect extends Rect {
    /**
     * The radius of the rounded corners
     */
    radius?: number;
}

export declare const SAFE_BROSER_FONTS: readonly ["Helvetica", "Arial", "Arial Black", "Verdana", "Tahoma", "Trebuchet MS", "Impact", "Gill Sans", "Times New Roman", "Georgia", "Palatino", "Baskerville", "Andalé Mono", "Courier", "Lucida", "Monaco", "Bradley Hand", "Brush Script MT", "Luminari", "Comic Sans MS"];

/**
 * Fast sampler options.
 */
export declare type SamplerOptions = {
    /**
     * The number of samples to return.
     */
    length?: number;
    /**
     * The start time in **milliseconds** relative to the beginning of the clip.
     */
    start?: Timestamp | number;
    /**
     * The stop time in **milliseconds** relative to the beginning of the clip.
     */
    stop?: Timestamp | number;
    /**
     * Whether to use a logarithmic scale.
     */
    logarithmic?: boolean;
};

/**
 * Defines the available image formats
 */
export declare type ScreenshotImageFormat = 'webp' | 'png' | 'jpeg';

/**
 * Convert seconds into frames
 */
export declare function secondsToFrames(seconds: number, fps?: number): frame;

export declare function serializable(serializer?: Omit<Constructor<Serializer>, 'toJSON'>): (target: any, propertyKey: string) => void;

export declare class Serializer {
    /**
     * Unique identifier of the object
     */
    id: `${string}-${string}-${string}-${string}-${string}`;
    toJSON(): any;
    static fromJSON<T extends Serializer, K = {}>(this: new () => T, obj: K extends string ? never : K): T;
}

/**
 * Defines the shadow properties that
 * can be applied to a shape
 */
export declare interface Shadow {
    /**
     * The color of the shadow
     */
    color?: hex;
    /**
     * The horizontal offset of the shadow
     */
    offsetX?: number;
    /**
     * The vertical offset of the shadow
     */
    offsetY?: number;
    /**
     * The blur of the shadow
     */
    blur?: number;
    /**
     * The opacity of the shadow
     */
    opacity?: number;
}

export declare class ShapeClip extends ShapeClip_base {
    readonly type = "shape";
    fill?: hex;
    stroke?: Stroke;
    constructor(props?: ShapeClipProps);
}

declare const ShapeClip_base: {
    new (...args: any[]): {
        source: VisualSource;
        _height?: number | Percent;
        _width?: number | Percent;
        mask?: Mask;
        anchorX: number;
        anchorY: number;
        scaleX: number;
        scaleY: number;
        translateX: number;
        translateY: number;
        freeTransform: boolean;
        x: number | Percent;
        y: number | Percent;
        rotation: number;
        opacity: number;
        filter?: string;
        blendMode?: BlendMode;
        get translate(): Point;
        set translate(value: Point | number);
        get anchor(): Point;
        set anchor(value: Point | number);
        get scale(): Point;
        set scale(value: Point | number);
        get height(): number | Percent;
        set height(value: Percent | number | undefined);
        get width(): number | Percent;
        set width(value: Percent | number | undefined);
        get position(): RelativePoint;
        set position(value: RelativePoint | "center");
        readonly size: Size;
        track?: {
            composition?: {
                height?: number;
                width?: number;
            };
        };
        id: `${string}-${string}-${string}-${string}-${string}`;
        toJSON(): any;
    };
} & typeof Clip;

export declare interface ShapeClipProps extends ClipProps, VisualMixinProps {
    fill?: hex;
    stroke?: Stroke;
}

export declare class ShapeTrack extends Track<ShapeClip> {
    readonly type = "shape";
}

/**
 * This utility creates a file input element and clicks on it
 * @param accept comma separated mime types
 * @example audio/mp3, video/mp4
 * @param multiple enable multiselection
 * @default true
 */
export declare function showFileDialog(accept: string, multiple?: boolean): Promise<File[]>;

export declare type SilenceDetectionOptions = {
    /**
     * If the RMS is below the threshold, the frame is considered silent.
     * @default 0.02
     */
    threshold?: number;
    /**
     * This parameter affects how accurately the algorithm captures short silences.
     * @default 1024
     */
    hopSize?: number;
    /**
     * Setting a minimum duration in **milliseconds** for a silence period helps avoid detecting brief gaps between sounds as silences.
     * @default 500
     */
    minDuration?: number;
};

export declare type SilenceRemoveOptions = {
    /**
     * Adds padding in milliseconds after each detected non-silent segment.
     * This helps prevent cutting off audio too abruptly.
     * @default 500
     */
    padding?: number;
} & SilenceDetectionOptions;

export declare type SingleColorCaptionPresetConfig = {
    color: hex;
} & DefaultCaptionPresetConfig;

/**
 * Defines the absolute height and width
 */
export declare type Size = {
    width: number;
    height: number;
};

/**
 * setTimeout async/await replacement
 */
export declare function sleep(ms: number): Promise<void>;

export declare class SolarCaptionPreset extends Serializer implements CaptionPresetStrategy {
    generatorOptions: GeneratorOptions;
    readonly type: CaptionPresetType;
    position: RelativePoint;
    constructor(config?: Partial<DefaultCaptionPresetConfig>);
    applyTo(track: CaptionTrack): Promise<void>;
}

/**
 * Config sort function that prioritizes hardware acceleration
 */
export declare function sortHardwareAcceleration(a: VideoEncoderConfig, b: VideoEncoderConfig): number;

export declare class Source extends Source_base {
    /**
     * Duration of the source
     */
    readonly duration: Timestamp;
    /**
     * Indicates if the track is loading
     */
    state: 'READY' | 'LOADING' | 'ERROR' | 'IDLE';
    /**
     * Data associated with the source
     */
    data: Record<string, unknown>;
    /**
     * Indicates whether the source is used inside the composition
     */
    added: boolean;
    /**
     * Type of the source which is compatible
     * with clips and tracks
     */
    readonly type: ClipType;
    /**
     * Original name of the file e.g. clip.mp4
     */
    name: string;
    /**
     * Type of the file that has been loaded
     */
    mimeType: MimeType_2 | undefined;
    /**
     * External url if the file has been fetched remotely
     */
    externalURL: string | URL | Request | undefined;
    /**
     * True if the file has been retrieved from an
     * external source
     */
    external: boolean;
    /**
     * Access to the data of the source
     */
    file?: File;
    /**
     * Access to the element that is used to parse
     * the source
     */
    element: SourceElement;
    /**
     * The object url of the source
     */
    get objectURL(): string | undefined;
    /**
     * Method for retrieving the file when
     * it has been loaded
     * @returns Loaded File
     */
    getFile(): Promise<File>;
    protected loadElement(): Promise<void>;
    protected loadFile(file: File): Promise<void>;
    protected loadUrl(url: string | URL | Request, init?: RequestInit): Promise<void>;
    from(input: File | string | URL | Request, init?: RequestInit): Promise<this>;
    loaded(): Promise<void>;
    /**
     * Get the source as an array buffer
     */
    arrayBuffer(): Promise<ArrayBuffer>;
    /**
     * Clean up the data associated with this object
     */
    remove(): Promise<void>;
    /**
     * Downloads the file
     */
    download(): Promise<void>;
    /**
     * Get a visulization of the source
     * as an html element
     */
    thumbnail(): Promise<HTMLElement>;
    /**
     * Create a new source for the specified input
     */
    static from<T extends Source>(this: new () => T, input: File | string | URL | Request, init?: RequestInit | undefined, source?: T): Promise<T>;
}

declare const Source_base: {
    new (...args: any[]): {
        _handlers: {
            '*'?: {
                [x: string]: (event: EmittedEvent<any, any>) => void;
            } | undefined;
            error?: {
                [x: string]: (event: EmittedEvent<Error, any>) => void;
            } | undefined;
            load?: {
                [x: string]: (event: EmittedEvent<undefined, any>) => void;
            } | undefined;
            update?: {
                [x: string]: (event: EmittedEvent<undefined, any>) => void;
            } | undefined;
        };
        on<T extends "*" | "error" | keyof Events>(eventType: T, callback: (event: EmittedEvent<BaseEvents<Events>[T], any>) => void): string;
        off(id?: string | "*", ...ids: string[]): void;
        emit<T extends "*" | "error" | keyof Events>(eventType: T, detail: BaseEvents<Events>[T]): void;
        bubble(target: any): string;
        resolve(eventType: "*" | "error" | keyof Events): (resolve: (value: unknown) => void, reject: (reason?: any) => void) => void;
    };
} & typeof Serializer;

export declare type SourceElement = HTMLVideoElement | HTMLImageElement | HTMLIFrameElement | HTMLAudioElement;

/**
 * Split an array at the specified position
 */
export declare function splitAt<T>(list: any[] | string, index: number): T;

export declare class SpotlightCaptionPreset extends Serializer implements CaptionPresetStrategy {
    generatorOptions: GeneratorOptions;
    readonly type = "SPOTLIGHT";
    color: hex;
    position: RelativePoint;
    constructor(config?: Partial<SingleColorCaptionPresetConfig>);
    applyTo(track: CaptionTrack): Promise<void>;
}

export declare class StorageItem<T> extends StorageItem_base {
    private _key;
    private _value;
    private _store;
    loaded: boolean;
    constructor(store: Store, key: string, value: T | Promise<T>);
    get key(): string;
    get value(): T;
    set value(newValue: T);
    private initValue;
}

declare const StorageItem_base: {
    new (...args: any[]): {
        _handlers: {
            '*'?: {
                [x: string]: (event: EmittedEvent<any, any>) => void;
            } | undefined;
            error?: {
                [x: string]: (event: EmittedEvent<Error, any>) => void;
            } | undefined;
            update?: {
                [x: string]: (event: EmittedEvent<any, any>) => void;
            } | undefined;
        };
        on<T_1 extends "*" | "error" | "update">(eventType: T_1, callback: (event: EmittedEvent<BaseEvents<Events_3>[T_1], any>) => void): string;
        off(id?: string | "*", ...ids: string[]): void;
        emit<T_1 extends "*" | "error" | "update">(eventType: T_1, detail: BaseEvents<Events_3>[T_1]): void;
        bubble(target: any): string;
        resolve(eventType: "*" | "error" | "update"): (resolve: (value: unknown) => void, reject: (reason?: any) => void) => void;
    };
} & typeof Serializer;

export declare class Store {
    readonly storageEngine: Storage;
    readonly namespace?: string;
    constructor(namespace?: string, storageEngine?: Storage);
    define<T>(key: string, defaultValue: T, deserializer?: Deserializer<T>): StorageItem<T>;
    set<T>(key: string, value: T): void;
    get<T>(key: string): T | null;
    remove(key: string): void;
    private getStorageId;
}

declare type StreamCallback = (data: Uint8Array, position: number) => void;

/**
 * Defines the stroke properties that
 * can be applied to a shape
 */
export declare interface Stroke {
    /**
     * The color of the stroke
     */
    color?: hex;
    /**
     * The width of the stroke
     */
    width?: number;
    /**
     * The line cap style to use
     */
    lineCap?: LineCap;
    /**
     * The line join style to use
     */
    lineJoin?: LineJoin;
    /**
     * The miter limit to use
     */
    miterLimit?: number;
    /**
     * The opacity of the stroke
     */
    opacity?: number;
}

export declare type StyleOverride = {
    /**
     * Defines the start of the style segment
     */
    start: number;
    /**
     * Defines the stop of the style segment, leave
     * undefined when it's the end of the text
     */
    stop?: number;
    /**
     * Defines the style of the text
     */
    style: {
        /**
         * Defines the fill style of the text
         */
        color?: hex;
        /**
         * Defines the font size of the text
         */
        fontSize?: number;
        /**
         * Defines the stroke of the text
         */
        stroke?: Partial<Stroke>;
        /**
         * Defines the font of the text
         */
        font?: Font;
    };
};

export declare const SUPPORTED_MIME_TYPES: {
    IMAGE: {
        'image/jpeg': string;
        'image/png': string;
        'image/webp': string;
        'image/svg+xml': string;
    };
    VIDEO: {
        'video/mp4': string;
        'video/webm': string;
        'video/quicktime': string;
    };
    AUDIO: {
        'audio/mp3': string;
        'audio/mpeg': string;
        'audio/aac': string;
        'audio/wav': string;
        'audio/x-wav': string;
    };
    DOCUMENT: {
        'text/html': string;
    };
    readonly MIXED: {
        'text/html': string;
        'audio/mp3': string;
        'audio/mpeg': string;
        'audio/aac': string;
        'audio/wav': string;
        'audio/x-wav': string;
        'video/mp4': string;
        'video/webm': string;
        'video/quicktime': string;
        'image/jpeg': string;
        'image/png': string;
        'image/webp': string;
        'image/svg+xml': string;
    };
};

/**
 * Defines the vertical alignment of the text.
 * This key also sets the anchor point.
 */
export declare type TextAlign = 'left' | 'center' | 'right';

/**
 * Defines the horizonal alignment of the text.
 * This key also sets the anchor point.
 */
export declare type TextBaseline = 'top' | 'hanging' | 'middle' | 'alphabetic' | 'ideographic' | 'bottom';

/**
 * Defines the case of the text
 */
export declare type TextCase = 'upper' | 'lower';

export declare class TextClip extends TextClip_base {
    readonly type = "text";
    track?: Track<TextClip>;
    animations: TextClipAnimationOptions;
    /**
     * Set the copy for the text object. To split a line you can use '\n'.
     */
    text: string;
    /**
     * A fillstyle that will be used on the text '#00FF00'.
     */
    color: hex;
    /**
     * The font to use for the text.
     */
    font: Font;
    /**
     * The casing of the text, e.g. uppercase
     */
    casing: TextCase | undefined;
    /**
     * Alignment for multiline text, does not affect single line text.
     */
    align: TextAlign;
    /**
     * The baseline of the text that is rendered.
     */
    baseline: TextBaseline;
    /**
     * An object describing the stroke to apply
     */
    stroke: Stroke | undefined;
    /**
     * Set a drop shadow for the text.
     */
    shadow: Shadow | Shadow[] | undefined;
    /**
     * The space between lines
     */
    leading: number;
    /**
     * An object describing the glow to apply
     */
    glow: Glow | undefined;
    constructor(props?: TextClipProps);
    render(renderer: Renderer): void;
    /**
     * Proxy for font.size
     */
    get fontSize(): number;
    set fontSize(value: number);
    get name(): string;
    copy(): TextClip;
    get shadows(): Shadow[];
}

declare const TextClip_base: {
    new (...args: any[]): {
        source: VisualSource;
        _height?: number | Percent;
        _width?: number | Percent;
        mask?: Mask;
        anchorX: number;
        anchorY: number;
        scaleX: number;
        scaleY: number;
        translateX: number;
        translateY: number;
        freeTransform: boolean;
        x: number | Percent;
        y: number | Percent;
        rotation: number;
        opacity: number;
        filter?: string;
        blendMode?: BlendMode;
        get translate(): Point;
        set translate(value: Point | number);
        get anchor(): Point;
        set anchor(value: Point | number);
        get scale(): Point;
        set scale(value: Point | number);
        get height(): number | Percent;
        set height(value: Percent | number | undefined);
        get width(): number | Percent;
        set width(value: Percent | number | undefined);
        get position(): RelativePoint;
        set position(value: RelativePoint | "center");
        readonly size: Size;
        track?: {
            composition?: {
                height?: number;
                width?: number;
            };
        };
        id: `${string}-${string}-${string}-${string}-${string}`;
        toJSON(): any;
    };
} & typeof Clip;

export declare type TextClipAnimationOptions = (KeyframeOptions<'x' | 'y' | 'translateX' | 'translateY', number | Percent> | KeyframeOptions<'opacity' | 'rotation' | 'scale' | 'scaleX' | 'scaleY' | 'fontSize' | 'leading', number> | KeyframeOptions<'text', string> | KeyframeOptions<'color', hex>)[];

export declare interface TextClipProps extends ClipProps, Omit<VisualMixinProps, 'anchor' | 'width' | 'height'> {
    text?: string;
    font?: Font;
    align?: TextAlign;
    baseline?: TextBaseline;
    color?: hex;
    stroke?: Stroke;
    casing?: TextCase;
    shadow?: Shadow | Shadow[];
    fontSize?: number;
    leading?: number;
    glow?: Glow;
    animations?: TextClipAnimationOptions;
}

/**
 * Defines the properties of text
 */
export declare interface TextOptions {
    /**
     * The font to use
     */
    font?: Font;
    /**
     * The color of the text
     */
    color?: string;
    /**
     * The alignment of the text
     */
    alignment?: TextAlign;
    /**
     * The baseline of the text
     */
    baseline?: TextBaseline;
}

declare class TextTrack_2 extends Track<TextClip> {
    readonly type = "text";
}
export { TextTrack_2 as TextTrack }

export declare class Thread<Result> {
    worker: Worker;
    constructor(Worker: Constructor<Worker>);
    run<Arg>(payload?: Arg, listner?: EventListener_2): Promise<TreadResponse<Result>>;
}

/**
 * A ticker is used to update the state of the composition
 * at a fixed interval.
 */
declare class Ticker {
    /**
     * The time when the playback started in milliseconds
     */
    startTime: number;
    /**
     * The frame when the playback started
     */
    startFrame: frame;
    /**
     * The current frame that the playback is set to
     */
    frame: frame;
    /**
     * Defines the fps used for rendering.
     */
    fps: float;
    /**
     * Defines the current state of the ticker
     */
    playing: boolean;
    /**
     * Defines if the ticker is active
     */
    stopped: boolean;
    /**
     * User defined fixed duration
     */
    duration?: Timestamp;
    /**
     * The interval at which the ticker is updated in **milliseconds**
     */
    updateInterval: number;
    /**
     * The last time the ticker was updated
     */
    private lastUpdate;
    /**
     * The function to call when the ticker is updated
     */
    private updateFn;
    /**
     * The function to call when the ticker is rendered
     */
    private renderFn;
    /**
     * Creates a new ticker
     * @param update - The function to call when the ticker is updated
     * @param render - The function to call when the ticker is rendered
     */
    constructor(update: TickerCallback, render: TickerCallback);
    /**
     * Starts the animation loop
     */
    start(): void;
    /**
     * Stops the animation loop
     */
    stop(): void;
    /**
     * Starts the frame incrementation
     */
    play(): void;
    /**
     * Pauses the frame incrementation
     */
    pause(): void;
    /**
     * The animation loop
     */
    private timer;
}

/**
 * Defines the type of the callback function that is used to update the state of the composition
 */
declare type TickerCallback = (time: number) => void;

/**
 * Defines a time indication object that uses
 * milliseconds rounded to the nearest integer
 * and 30fps internally. By default the time is 0
 */
export declare class Timestamp implements Omit<Serializer, 'id'> {
    /**
     * Time state in **milliseconds**
     */
    private time;
    /**
     * Create a new timestamp from various time units
     * @param millis - Time in milliseconds
     * @param seconds - Time in seconds
     * @param minutes - Time in minutes
     * @param hours - Time in hours
     */
    constructor(millis?: number, seconds?: number, minutes?: number, hours?: number);
    /**
     * Base unit of the timestamp
     */
    get millis(): number;
    set millis(value: number);
    /**
     * Defines the time in frames at the
     * current frame rate
     */
    get frames(): frame;
    set frames(value: frame);
    /**
     * Convert the timestamp to seconds
     */
    get seconds(): number;
    set seconds(value: number);
    /**
     * Equivalent to millis += x
     */
    addMillis(value: number): this;
    /**
     * Equivalent to frames += x
     */
    addFrames(value: frame): this;
    /**
     * add two timestamps the timestamp being added will adapt
     * its fps to the current fps
     * @returns A new Timestamp instance with the added frames
     */
    add(time: Timestamp): Timestamp;
    /**
     * subtract two timestamps timestamp being subtracted
     * will adapt its fps to the current fps
     * @returns A new Timestamp instance with the added frames
     */
    subtract(time: Timestamp): Timestamp;
    /**
     * Create a new timestamp from frames
     */
    static fromFrames(value: frame, fps?: number): Timestamp;
    /**
     * get a copy of the object
     */
    copy(): Timestamp;
    toJSON(): number;
    static fromJSON(value: number): Timestamp;
}

/**
 * Convert an alpha value to hex
 * @param alpha A value between 0 and 1
 * @returns Alpha as 2 digit hex
 * @example FF
 */
export declare function toHex(alpha: number): string;

export declare class Track<Clp extends Clip = Clip> extends Track_base {
    /**
     * Data associated with the track
     */
    data: Record<string, unknown>;
    /**
     * Flag to check if the track is the primary track
     */
    primary: boolean;
    /**
     * The clip that is currently being rendered
     */
    private rendering?;
    /**
     * Controls the visability of the track
     */
    disabled: boolean;
    /**
     * The clips to be displayed
     */
    clips: Clp[];
    /**
     * Pointer to the expected track
     */
    pointer: number;
    /**
     * Reference to the composition
     */
    composition?: Composition;
    /**
     * Id that can be used to search by kind
     */
    readonly type: TrackType;
    /**
     * Controls how the clips should be inserted and updated
     */
    strategy: InsertStrategy<InsertMode>;
    /**
     * Connect the track with the composition
     */
    connect(composition: Composition): this;
    /**
     * Applies the stack property
     */
    stacked(value?: boolean): this;
    /**
     * Change the layer of the track
     */
    layer(layer: TrackLayer): this;
    /**
     * Seek the provided time if the track contains
     * audio or video clips
     */
    seek(time: Timestamp): void;
    /**
     * Move all clips of the track at once along the timeline
     */
    offset(time: frame | Timestamp): this;
    /**
     * Triggered when the track is redrawn
     */
    update(renderer: Renderer, time: Timestamp, mode?: RenderMode, fps?: number): void | Promise<void>;
    render(renderer: Renderer, time: Timestamp): void;
    /**
     * Adds a new clip to the track
     * @param clip The clip to add
     * @param index The index to insert the clip at, will be ignored if track is not stacked
     * @throws Error if the clip can't be added
     */
    add(clip: Clp, index?: number): Promise<Clp>;
    /**
     * Remove a given clip from the track
     * @returns `Track` when it has been successfully removed `undefined` otherwise
     */
    remove<L extends Clp>(clip: L): L | undefined;
    /**
     * Get the first visible frame of the clip
     */
    get stop(): Timestamp;
    /**
     * Get the last visible frame of the clip
     */
    get start(): Timestamp;
    /**
     * Remove the track from the composition
     */
    detach(): this;
    /**
     * Remove all clips from the track
     */
    clear(): void;
    /**
     * Get the clip that the pointer is
     * currently referencing
     */
    private get clipRef();
}

declare const Track_base: {
    new (...args: any[]): {
        _handlers: {
            '*'?: {
                [x: string]: (event: EmittedEvent<any, any>) => void;
            } | undefined;
            error?: {
                [x: string]: (event: EmittedEvent<Error, any>) => void;
            } | undefined;
            update?: {
                [x: string]: (event: EmittedEvent<any, any>) => void;
            } | undefined;
            frame?: {
                [x: string]: (event: EmittedEvent<number | undefined, any>) => void;
            } | undefined;
            attach?: {
                [x: string]: (event: EmittedEvent<undefined, any>) => void;
            } | undefined;
            detach?: {
                [x: string]: (event: EmittedEvent<undefined, any>) => void;
            } | undefined;
        };
        on<T extends "*" | "error" | keyof Events_2>(eventType: T, callback: (event: EmittedEvent<BaseEvents<Events_2>[T], any>) => void): string;
        off(id?: string | "*", ...ids: string[]): void;
        emit<T extends "*" | "error" | keyof Events_2>(eventType: T, detail: BaseEvents<Events_2>[T]): void;
        bubble(target: any): string;
        resolve(eventType: "*" | "error" | keyof Events_2): (resolve: (value: unknown) => void, reject: (reason?: any) => void) => void;
    };
} & typeof Serializer;

export declare class TrackDeserializer {
    static fromType<T extends keyof TrackMap>(data: {
        type: T;
    }): TrackMap[T];
}

/**
 * Defines where the track should be inserted
 */
export declare type TrackLayer = 'top' | 'bottom' | number;

export declare type TrackMap = {
    video: VideoTrack;
    audio: AudioTrack;
    html: HtmlTrack;
    image: ImageTrack_2;
    text: TextTrack_2;
    caption: CaptionTrack;
    shape: ShapeTrack;
    base: Track<Clip>;
};

export declare type TrackType = keyof TrackMap;

export declare class Transcript implements Serializer {
    id: `${string}-${string}-${string}-${string}-${string}`;
    language: Language;
    groups: WordGroup[];
    get text(): string;
    get words(): Word[];
    constructor(groups?: WordGroup[], language?: Language);
    /**
     * Iterate over all words in groups
     */
    iter({ count, duration, length }: GeneratorOptions): Generator<WordGroup, void, unknown>;
    /**
     * This method will optimize the transcipt for display
     */
    optimize(): this;
    /**
     * Convert the transcript into a SRT compatible
     * string and downloadable blob
     */
    toSRT(options?: GeneratorOptions): {
        text: string;
        blob: Blob;
    };
    toJSON(): Captions;
    /**
     * Create a new Transcript containing the
     * first `{count}` words
     * @param count Defines the number of words required
     * @param startAtZero Defines if the first word should start at 0 milliseconds
     * @returns A new Transcript instance
     */
    slice(count: number, startAtZero?: boolean): Transcript;
    /**
     * Create a deep copy of the transcript
     * @returns A new Transcript instance
     */
    copy(): Transcript;
    static fromJSON(data: Captions): Transcript;
    /**
     * Fetch captions from an external resource and parse them. JSON needs
     * to be of the form `{ token: string; start: number; stop: number; }[][]`
     * @param input Location of the captions
     * @param init Additional fetch parameters such as method or headers
     * @returns A Transcript with processed captions
     */
    static from(input: string | URL | Request | File, init?: RequestInit | undefined): Promise<Transcript>;
}

/**
 * Defines the properties of a transform
 */
export declare interface Transform {
    /**
     * The translation of the transform
     */
    translate?: RelativePoint;
    /**
     * The scale of the transform
     */
    scale?: Point;
    /**
     * The rotation of the transform
     */
    rotate?: number;
}

export declare function transformText(text: string, textCase?: TextCase): string;

declare type TreadResponse<R> = {
    result: R;
    error: undefined;
} | {
    result: undefined;
    error: string;
};

declare namespace types {
    export {
        StyleOverride,
        Background
    }
}

declare namespace types_2 {
    export {
        FontFamily,
        FontSubset,
        FontType,
        FontSource,
        FontSources,
        WebfontProperties
    }
}

/**
 * Short unique id (not as secure as uuid 4 though)
 */
export declare function uid(): string | undefined;

/**
 * Defines a uuid 4
 */
export declare type uuid = `${string}-${string}-${string}-${string}-${string}`;

export declare class ValidationError extends BaseError {
}

export declare class VerdantCaptionPreset extends Serializer implements CaptionPresetStrategy {
    readonly type: CaptionPresetType;
    generatorOptions: GeneratorOptions;
    color: hex;
    position: RelativePoint;
    constructor(config?: Partial<SingleColorCaptionPresetConfig>);
    applyTo(track: CaptionTrack): Promise<void>;
}

export declare class VideoClip extends VideoClip_base {
    source: VideoSource;
    readonly type = "video";
    track?: Track<VideoClip>;
    animations: VideoClipAnimationOptions;
    private worker?;
    private buffer?;
    /**
     * Html5 video element access
     */
    element: HTMLVideoElement;
    frame?: VideoFrame;
    constructor(source?: File | VideoSource, props?: VideoClipProps);
    init(): Promise<void>;
    update(_renderer: Renderer, _time: Timestamp, mode?: RenderMode, fps?: number): void | Promise<void>;
    render(renderer: Renderer): void;
    exit(): void;
    copy(): VideoClip;
    private decodeVideo;
    private nextFrame;
    private get demuxRange();
}

declare const VideoClip_base: {
    new (...args: any[]): {
        source: VisualSource;
        _height?: number | Percent;
        _width?: number | Percent;
        mask?: Mask;
        anchorX: number;
        anchorY: number;
        scaleX: number;
        scaleY: number;
        translateX: number;
        translateY: number;
        freeTransform: boolean;
        x: number | Percent;
        y: number | Percent;
        rotation: number;
        opacity: number;
        filter?: string;
        blendMode?: BlendMode;
        get translate(): Point;
        set translate(value: Point | number);
        get anchor(): Point;
        set anchor(value: Point | number);
        get scale(): Point;
        set scale(value: Point | number);
        get height(): number | Percent;
        set height(value: Percent | number | undefined);
        get width(): number | Percent;
        set width(value: Percent | number | undefined);
        get position(): RelativePoint;
        set position(value: RelativePoint | "center");
        readonly size: Size;
        track?: {
            composition?: {
                height?: number;
                width?: number;
            };
        };
        id: `${string}-${string}-${string}-${string}-${string}`;
        toJSON(): any;
    };
} & typeof MediaClip;

export declare type VideoClipAnimationOptions = VisualMixinAnimationOptions;

export declare interface VideoClipProps extends MediaClipProps, VisualMixinProps {
    animations?: VideoClipAnimationOptions;
}

declare interface VideoEncoderInit_2 extends EncoderInit {
    /**
     * Multiplier of the composition size
     * @example 2 // 1080p -> 4K
     * @default 1 // 1080p -> 1080p
     */
    resolution?: number;
    /**
     * Defines if the performance should be logged
     * @default false;
     */
    debug?: boolean;
    /**
     * Defines the watermark to add to the video.
     * Needs to be more than 5 characters long
     */
    watermark?: string;
}

export declare type VideoMimeType = keyof (typeof SUPPORTED_MIME_TYPES)['VIDEO'];

declare type VideoSettings = {
    height: number;
    width: number;
    fps: number;
    bitrate: number;
};

export declare class VideoSource extends VideoSource_base {
    private downloadInProgress;
    readonly type: ClipType;
    readonly element: HTMLVideoElement;
    get height(): number;
    get width(): number;
    protected loadElement(): Promise<void>;
    protected loadUrl(url: string | URL | Request, init?: RequestInit | undefined): Promise<void>;
    getFile(): Promise<File>;
    thumbnail(): Promise<HTMLVideoElement>;
}

declare const VideoSource_base: {
    new (...args: any[]): {
        readonly height: int;
        readonly width: int;
        readonly aspectRatio: number;
        id: `${string}-${string}-${string}-${string}-${string}`;
        toJSON(): any;
    };
} & typeof AudioSource;

export declare class VideoTrack extends MediaTrack<VideoClip> {
    readonly type = "video";
}

declare interface VisualBase extends Serializer {
    track?: {
        composition?: {
            height?: number;
            width?: number;
        };
    };
}

export declare function VisualMixin<T extends Constructor<VisualBase>>(Base: T): {
    new (...args: any[]): {
        source: VisualSource;
        _height?: number | Percent;
        _width?: number | Percent;
        mask?: Mask;
        /**
         * The anchor x position, proxy for the anchor.x property
         * @default 0
         */
        anchorX: number;
        /**
         * The anchor y position, proxy for the anchor.y property
         * @default 0
         */
        anchorY: number;
        /**
         * The scale x factor
         * @default 1
         */
        scaleX: number;
        /**
         * The scale y factor
         * @default 1
         */
        scaleY: number;
        /**
         * The translate x factor
         * @default 0
         */
        translateX: number;
        /**
         * The translate y factor
         * @default 0
         */
        translateY: number;
        /**
         * If true, the clip will be free transformed
         * @default true
         */
        freeTransform: boolean;
        /**
         * The position of the clip on the x axis.
         * @default 0
         */
        x: number | Percent;
        /**
         * The position of the clip on the y axis.
         * @default 0
         */
        y: number | Percent;
        /**
         * Defines the rotation of the clip in degrees
         * @default 0
         * @example 90
         */
        rotation: number;
        /**
         * Defines the opacity of the clip as a number
         * between 0 and 1
         * @default 100
         */
        opacity: number;
        /**
         * Defines the filter property of the Canvas 2D API. It provides
         * filter effects such as blurring and grayscaling.
         * It is similar to the CSS filter property and accepts the same values.
         * https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/filter
         */
        filter?: string;
        /**
         * Sets the type of compositing operation to apply when drawing new shapes.
         * https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
         * @default 'source-over'
         */
        blendMode?: BlendMode;
        /**
         * 2D position offset of the clip.
         * @default { x: 0, y: 0 }
         */
        get translate(): Point;
        set translate(value: Point | number);
        /**
         * The anchor sets the origin point of the clip. Setting the anchor to (0.5,0.5)
         * means the clips' origin is centered. Setting the anchor to (1,1) would mean
         * the clips' origin point will be the bottom right corner. If you pass only
         * single parameter, it will set both x and y to the same value.
         */
        get anchor(): Point;
        set anchor(value: Point | number);
        /**
         * The scale factors of this object along the local coordinate axes.
         * Will be added to the scale applied by setting height and/or width
         * @default { x: 1, y: 1 }
         */
        get scale(): Point;
        set scale(value: Point | number);
        /**
         * Gets the current height of the clip
         */
        get height(): number | Percent;
        set height(value: Percent | number | undefined);
        /**
         * Gets the current width of the clip
         */
        get width(): number | Percent;
        set width(value: Percent | number | undefined);
        /**
         * The coordinate of the object relative to the local coordinates of the parent.
         * @default { x: 0, y: 0 }
         */
        get position(): RelativePoint;
        set position(value: RelativePoint | "center");
        readonly size: Size;
        track?: {
            composition?: {
                height?: number;
                width?: number;
            };
        };
        id: `${string}-${string}-${string}-${string}-${string}`;
        toJSON(): any;
    };
} & T;

export declare type VisualMixinAnimationOptions = (KeyframeOptions<'x' | 'y' | 'height' | 'width' | 'translateX' | 'translateY', number | Percent> | KeyframeOptions<'opacity' | 'rotation' | 'scale' | 'scaleX' | 'scaleY', number>)[];

export declare interface VisualMixinProps {
    rotation?: number;
    opacity?: number;
    translate?: Point | number;
    translateX?: number | Percent;
    translateY?: number | Percent;
    position?: RelativePoint | 'center';
    x?: number | Percent;
    y?: number | Percent;
    scale?: Point | number;
    scaleX?: number;
    scaleY?: number;
    height?: Percent | number;
    width?: Percent | number;
    anchor?: Point | number;
    anchorX?: number;
    anchorY?: number;
    freeTransform?: boolean;
    filter?: string;
    blendMode?: BlendMode;
    mask?: Mask;
}

export declare class VisualSource extends VisualSource_base {
}

declare const VisualSource_base: {
    new (...args: any[]): {
        /**
         * The height of the source
         */
        readonly height: int;
        /**
         * The width of the source
         */
        readonly width: int;
        /**
         * The aspect ratio of the source
         */
        readonly aspectRatio: number;
        id: `${string}-${string}-${string}-${string}-${string}`;
        toJSON(): any;
    };
} & typeof Source;

export declare function VisualSourceMixin<T extends Constructor<Serializer>>(Base: T): {
    new (...args: any[]): {
        /**
         * The height of the source
         */
        readonly height: int;
        /**
         * The width of the source
         */
        readonly width: int;
        /**
         * The aspect ratio of the source
         */
        readonly aspectRatio: number;
        id: `${string}-${string}-${string}-${string}-${string}`;
        toJSON(): any;
    };
} & T;

export declare interface WaveformBar {
    width: number;
    gap: number;
    radius?: number;
}

export declare class WaveformClip extends WaveformClip_base {
    source: AudioSource;
    readonly type = "shape";
    track?: Track<WaveformClip>;
    animations: WaveformClipAnimationOptions;
    readonly sampleRate = 8000;
    fill: FillOptions;
    bar: WaveformBar;
    smoothing: number;
    magnitude: number;
    private barHeights;
    private channelData?;
    constructor(source?: File | AudioSource, props?: WaveformClipProps);
    init(): Promise<void>;
    update(renderer: Renderer): void;
    render(renderer: Renderer, time: Timestamp, _mode?: RenderMode): Promise<void>;
    copy(): WaveformClip;
}

declare const WaveformClip_base: {
    new (...args: any[]): {
        source: VisualSource;
        _height?: number | Percent;
        _width?: number | Percent;
        mask?: Mask;
        anchorX: number;
        anchorY: number;
        scaleX: number;
        scaleY: number;
        translateX: number;
        translateY: number;
        freeTransform: boolean;
        x: number | Percent;
        y: number | Percent;
        rotation: number;
        opacity: number;
        filter?: string;
        blendMode?: BlendMode;
        get translate(): Point;
        set translate(value: Point | number);
        get anchor(): Point;
        set anchor(value: Point | number);
        get scale(): Point;
        set scale(value: Point | number);
        get height(): number | Percent;
        set height(value: Percent | number | undefined);
        get width(): number | Percent;
        set width(value: Percent | number | undefined);
        get position(): RelativePoint;
        set position(value: RelativePoint | "center");
        readonly size: Size;
        track?: {
            composition?: {
                height?: number;
                width?: number;
            };
        };
        id: `${string}-${string}-${string}-${string}-${string}`;
        toJSON(): any;
    };
} & typeof MediaClip;

export declare type WaveformClipAnimationOptions = VisualMixinAnimationOptions;

export declare interface WaveformClipProps extends Omit<MediaClipProps, 'volume'>, VisualMixinProps {
    animations?: WaveformClipAnimationOptions;
    bar?: WaveformBar;
    fill?: FillOptions;
    sampleRate?: number;
    smoothing?: number;
    magnitude?: number;
}

declare class WebcodecsVideoEncoder extends WebcodecsVideoEncoder_base {
    composition: Composition;
    resolution: number;
    sampleRate: number;
    numberOfChannels: number;
    videoBitrate: number;
    gpuBatchSize: number;
    watermark?: string;
    fps: number;
    debug: boolean;
    audio: boolean;
    constructor(composition: Composition, init?: VideoEncoderInit_2);
    /**
     * render and encode visual frames
     */
    encodeVideo(muxer: Muxer<StreamTarget>, config: VideoEncoderConfig, signal?: AbortSignal): Promise<void>;
}

declare const WebcodecsVideoEncoder_base: {
    new (...args: any[]): {
        _handlers: {
            '*'?: {
                [x: string]: (event: EmittedEvent<any, any>) => void;
            } | undefined;
            error?: {
                [x: string]: (event: EmittedEvent<Error, any>) => void;
            } | undefined;
            render?: {
                [x: string]: (event: EmittedEvent<    {
                progress: number;
                total: number;
                remaining: Date;
                }, any>) => void;
            } | undefined;
        };
        on<T extends "*" | "error" | "render">(eventType: T, callback: (event: EmittedEvent<BaseEvents<EncoderEvents>[T], any>) => void): string;
        off(id?: string | "*", ...ids: string[]): void;
        emit<T extends "*" | "error" | "render">(eventType: T, detail: BaseEvents<EncoderEvents>[T]): void;
        bubble(target: {
            _handlers: {
                '*'?: {
                    [x: string]: (event: EmittedEvent<any, any>) => void;
                } | undefined;
                error?: {
                    [x: string]: (event: EmittedEvent<Error, any>) => void;
                } | undefined;
                render?: {
                    [x: string]: (event: EmittedEvent<    {
                    progress: number;
                    total: number;
                    remaining: Date;
                    }, any>) => void;
                } | undefined;
            };
            on<T extends "*" | "error" | "render">(eventType: T, callback: (event: EmittedEvent<BaseEvents<EncoderEvents>[T], any>) => void): string;
            off(id?: string | "*", ...ids: string[]): void;
            emit<T extends "*" | "error" | "render">(eventType: T, detail: BaseEvents<EncoderEvents>[T]): void;
            bubble(target: any): string;
            resolve(eventType: "*" | "error" | "render"): (resolve: (value: unknown) => void, reject: (reason?: any) => void) => void;
        }): string;
        resolve(eventType: "*" | "error" | "render"): (resolve: (value: unknown) => void, reject: (reason?: any) => void) => void;
    };
};

/**
 * Defines the arguments to identify
 * a default webfont
 */
export declare type WebfontProperties<T extends keyof typeof WebFonts> = {
    family: T;
    weight: typeof WebFonts[T]['weights'][number];
    size?: number;
};

export declare const WebFonts: {
    readonly 'The Bold Font': {
        readonly weights: readonly ["500"];
        readonly url: "https://diffusion-studio-public.s3.eu-central-1.amazonaws.com/fonts/the-bold-font.ttf";
    };
    readonly 'Komika Axis': {
        readonly weights: readonly ["400"];
        readonly url: "https://diffusion-studio-public.s3.eu-central-1.amazonaws.com/fonts/komika-axis.ttf";
    };
    readonly Geologica: {
        readonly weights: readonly ["100", "200", "300", "400", "500", "600", "700", "800", "900"];
        readonly url: "https://fonts.gstatic.com/s/geologica/v1/oY1l8evIr7j9P3TN9YwNAdyjzUyDKkKdAGOJh1UlCDUIhAIdhCZOn1fLsig7jfvCCPHZckUWE1lELWNN-w.woff2";
    };
    readonly Nunito: {
        readonly weights: readonly ["200", "300", "400", "500", "600", "700", "800", "900"];
        readonly url: "https://fonts.gstatic.com/s/nunito/v26/XRXV3I6Li01BKofINeaBTMnFcQ.woff2";
    };
    readonly Figtree: {
        readonly weights: readonly ["300", "400", "500", "600", "700", "800", "900"];
        readonly url: "https://fonts.gstatic.com/s/figtree/v5/_Xms-HUzqDCFdgfMm4S9DaRvzig.woff2";
    };
    readonly Urbanist: {
        readonly weights: readonly ["100", "200", "300", "400", "500", "600", "700", "800", "900"];
        readonly url: "https://fonts.gstatic.com/s/urbanist/v15/L0x-DF02iFML4hGCyMqlbS1miXK2.woff2";
    };
    readonly Montserrat: {
        readonly weights: readonly ["100", "200", "300", "400", "500", "600", "700", "800", "900"];
        readonly url: "https://fonts.gstatic.com/s/montserrat/v26/JTUSjIg1_i6t8kCHKm459WlhyyTh89Y.woff2";
    };
    readonly Bangers: {
        readonly weights: readonly ["400"];
        readonly url: "https://fonts.gstatic.com/s/bangers/v20/FeVQS0BTqb0h60ACH55Q2J5hm24.woff2";
    };
    readonly Chewy: {
        readonly weights: readonly ["400"];
        readonly url: "https://fonts.gstatic.com/s/chewy/v18/uK_94ruUb-k-wn52KjI9OPec.woff2";
    };
    readonly 'Source Code Pro': {
        readonly weights: readonly ["200", "300", "400", "500", "600", "700", "800", "900"];
        readonly url: "https://fonts.gstatic.com/s/sourcecodepro/v22/HI_SiYsKILxRpg3hIP6sJ7fM7PqlPevWnsUnxg.woff2";
    };
};

export declare class WhisperCaptionPreset extends Serializer implements CaptionPresetStrategy {
    generatorOptions: GeneratorOptions;
    readonly type = "WHISPER";
    color: hex;
    position: RelativePoint;
    constructor(config?: Partial<SingleColorCaptionPresetConfig>);
    applyTo(track: CaptionTrack): Promise<void>;
}

export declare function withThreadErrorHandler(main: (event: MessageEvent<any>) => Promise<void>): (event: MessageEvent<any>) => Promise<void>;

export declare class Word {
    /**
     * A unique identifier for the word
     */
    id: `${string}-${string}-${string}-${string}-${string}`;
    /**
     * Defines the text to be displayed
     */
    text: string;
    /**
     * Defines the time stamp at
     * which the text is spoken
     */
    start: Timestamp;
    /**
     * Defines the time stamp at
     * which the text was spoken
     */
    stop: Timestamp;
    /**
     * Defines the confidence of
     * the predicition
     */
    confidence?: number;
    /**
     * Create a new Word object
     * @param text The string contents of the word
     * @param start Start in **milliseconds**
     * @param stop Stop in **milliseconds**
     * @param confidence Predicition confidence
     */
    constructor(text: string, start: number, stop: number, confidence?: number);
    /**
     * Defines the time between start
     * and stop returned as a timestamp
     */
    get duration(): Timestamp;
}

export declare class WordGroup {
    words: Word[];
    constructor(words?: Word[]);
    get duration(): Timestamp;
    get text(): string;
    get start(): Timestamp;
    get stop(): Timestamp;
}

export { }
