import { Base } from '../internal/base.js'; import { Gallery } from './gallery.js'; /** * Supported image file formats. * * @enum {string} * @readonly */ declare enum Extension { Avif = 'avif', Webp = 'webp', Jxl = 'jxl' } /** * Available thumbnail size presets. * * @enum {string} * @readonly */ declare enum ThumbnailSize { Small = 'small', Medium = 'smallbig', Big = 'big' } /** * An abstract base class for media resources with shared dimension properties. * * @abstract * @see {@link Image} * @see {@link Video} */ declare abstract class Media extends Base { /** * The width of the media in pixels. * * @type {number} * @readonly */ readonly width: number; /** * The height of the media in pixels. * * @type {number} * @readonly */ readonly height: number; } /** * An image file belonging to a gallery. * * @see {@link Gallery} */ declare class Image extends Media { /** * The unique hash identifying the image. * * @type {string} * @readonly */ readonly hash: string; /** * The original filename of the image. * * @type {string} * @readonly */ readonly name: string; /** * Whether this image is available in AVIF format. * * @type {boolean} * @readonly */ readonly hasAvif: boolean; /** * Whether this image is available in WebP format. * * @deprecated Always `true`. * @type {boolean} * @readonly */ readonly hasWebp: boolean; /** * Whether this image is available in JPEG XL format. * * @deprecated Always `false`. * @type {boolean} * @readonly */ readonly hasJxl: boolean; /** * Whether thumbnail variants are available for this image. * * @type {boolean} * @readonly */ readonly hasThumbnail: boolean; /** * Resolves a URL for this image in the specified format, optionally using a thumbnail size. * * Only the following combinations are valid: * * | Thumbnail Size | Extension | Requirement (must be `true`) | * | :------------- | :-------- | :------------------------------- | * | *(none)* | *(all)* | `has{Extension}` | * | `Small` | *(all)* | `has{Extension}` | * | `Medium` | `Avif` | `hasThumbnail && has{Extension}` | * | `Big` | *(all)* | `hasThumbnail && has{Extension}` | * * @param {Extension} extension The desired image format. * @param {ThumbnailSize} [thumbnailSize] The thumbnail size preset. Omit for a full-size image URL. * @returns {Promise} A `Promise` that resolves to the image URL. * @throws {HitomiError} If the `extension` and `thumbnailSize` combination is invalid. * @see {@link Extension} * @see {@link ThumbnailSize} * @see {@link Image.hasAvif} * @see {@link Image.hasWebp} * @see {@link Image.hasJxl} * @see {@link Image.hasThumbnail} */ resolveUrl(extension: Extension, thumbnailSize?: ThumbnailSize): Promise; /** * Fetches the image in the specified format and optional thumbnail size. * * The same `extension` and `thumbnailSize` restrictions as {@link Image.resolveUrl} apply. * * @param {Extension} extension The desired image format. * @param {ThumbnailSize} [thumbnailSize] The thumbnail size preset. Omit for a full-size image. * @returns {Promise} A `Promise` that resolves to the image as a `Uint8Array`. * @throws {HitomiError} If the `extension` and `thumbnailSize` combination is invalid. * @see {@link Extension} * @see {@link ThumbnailSize} */ fetch(extension: Extension, thumbnailSize?: ThumbnailSize): Promise; } /** * A video file belonging to a gallery. * * @see {@link Gallery} */ declare class Video extends Media { /** * The file name of the video. * * @type {string} * @readonly */ readonly fileName: string; /** * The streaming URL of the video. * * @type {string} * @readonly */ readonly url: string; /** * The URL of the poster (video thumbnail). * * @type {string} * @readonly */ readonly posterUrl: string; /** * Fetches the video in MP4 format. * * @returns {Promise} A `Promise` that resolves to the video as a `Uint8Array`. */ fetch(): Promise; /** * Fetches the poster (video thumbnail) in WebP format. * * @returns {Promise} A `Promise` that resolves to the poster as a `Uint8Array`. */ fetchPoster(): Promise; } export { Extension, Image, ThumbnailSize, Video };