import React from "react"; import type { Database, DocWithId } from "@vibes.diy/vibe-runtime"; export interface FileMeta { readonly uploadId: string; readonly type: string; readonly size: number; readonly lastModified?: number; readonly url?: string; } export type ImgGenInputImage = Blob | { readonly type?: string; readonly size?: number; readonly lastModified?: number; readonly file: () => Promise; }; export interface VersionInfo { readonly id: string; readonly created: number; readonly promptKey?: string; readonly model?: string; readonly sourceKey?: string; } export interface PromptEntry { readonly text: string; readonly created: number; } export interface ImageDocumentPlain { readonly _rev?: string; readonly type: "image"; readonly prompt?: string; readonly prompts?: Record; readonly created: number; readonly currentVersion: number; readonly versions: VersionInfo[]; readonly currentPromptKey: string; readonly _files?: Record; } export type ImageDocument = ImageDocumentPlain; export type PartialImageDocument = DocWithId>; export interface ImgGenOptions { readonly size?: string; readonly quality?: string; readonly model?: string; readonly style?: string; readonly debug?: boolean; } export interface UseImgGenOptions { readonly prompt?: string; readonly _id?: string; readonly _rev?: string; readonly database?: string | Database; readonly options?: Partial; readonly generationId?: string; readonly skip?: boolean; readonly inputImage?: ImgGenInputImage; readonly model?: string; readonly editedPrompt?: string; } export interface UseImgGenResult { readonly loading: boolean; readonly progress: number; readonly error?: Error | null; readonly document?: PartialImageDocument | null; } export interface ImgGenClasses { readonly root: string; readonly container: string; readonly image: string; readonly placeholder: string; readonly error: string; readonly controls: string; readonly button: string; readonly prompt: string; } export interface ImgGenProps extends Omit, "onError" | "className"> { readonly prompt?: string; readonly _id?: string; readonly className?: string; readonly alt?: string; readonly images?: File[]; readonly options?: ImgGenOptions; readonly database?: string | Database; readonly model?: string; readonly showControls?: boolean; readonly style?: React.CSSProperties; readonly onComplete?: () => void; readonly onError?: (error: Error) => void; readonly onDelete?: (id: string) => void; readonly onPromptEdit?: (id: string, newPrompt: string) => void; readonly classes?: Partial; readonly debug?: boolean; } export type ImgGenTargetDoc = Omit & { type?: string; }; export type ImgGenWriteBody = Omit & { _id?: string; _files: Record; versions: VersionInfo[]; }; export declare function generateVersionId(versionNumber: number): string; export declare function nextFreeVersionId(document: ImgGenTargetDoc | null | undefined): string; export declare function generatePromptKey(promptNumber: number): string; export declare function getVersionsFromDocument(document: ImgGenTargetDoc | null | undefined): { versions: VersionInfo[]; currentVersion: number; }; export declare function getPromptsFromDocument(document: ImgGenTargetDoc | null | undefined): { prompts: Record; currentPromptKey: string; }; export declare function sanitizeFiles(files: Record | undefined): Record; export interface AddNewVersionOptions { readonly prompt?: string; readonly model?: string; readonly sourceKey?: string; } export declare function addNewVersion(document: ImgGenTargetDoc, fileMeta: FileMeta, opts?: AddNewVersionOptions): ImgGenTargetDoc & { _files: Record; versions: VersionInfo[]; }; export interface ImgGenTarget { readonly dbName: string; readonly docId: string; readonly regen?: boolean; readonly sourceKey?: string; } export interface ImgGenRequestOptions { readonly inputImage?: ImgGenInputImage; readonly model?: string; readonly target?: ImgGenTarget; } export interface ImgGenFileRef { readonly uploadId: string; readonly cid: string; readonly mimeType: string; readonly size: number; } export interface ImgGenResult { readonly files: ImgGenFileRef[]; readonly docWritten?: boolean; } export declare function shouldAppendVersion(existingDoc: ImgGenTargetDoc | null | undefined, regen: boolean, model: string | undefined): boolean; export interface BuildImgGenDocUpdateOptions { readonly promptText: string; readonly model?: string; readonly regen: boolean; readonly sourceKey?: string; } export declare function buildImgGenDocUpdate(existingDoc: ImgGenTargetDoc | null, fileMeta: FileMeta, opts: BuildImgGenDocUpdateOptions): ImgGenWriteBody;