/** * Interactive image acquisition for the built-in toolbar (SD-3567). * * The toolbar image button routes through the shared controller command * `image` → `create.image`, which requires a base64 PNG/JPEG data-URI `src`. * This module owns the browser file picker and the File → data-URI * conversion; the toolbar dispatches the resulting payload through the * normal controller command path. */ /** Accept filter for the picker: PNG and JPEG only (V1 parity; OOXML-native formats). */ export declare const IMAGE_PICKER_ACCEPT = ".png,.jpg,.jpeg,image/png,image/jpeg"; type NamedBlob = Blob & { name?: string; }; interface ImageFilePickerOptions { ownerDocument?: Document; onPick?: (file: File) => void | Promise; onError?: (error: unknown) => void; } interface ImageFilePicker { input: HTMLInputElement; open: () => void; destroy: () => void; } /** * Whether a picked/dropped file is an insertable image (PNG/JPEG). Falls back * to the file extension when the browser reports no MIME type. */ export declare function isSupportedImageFile(file: File | null | undefined): boolean; /** * Read a File/Blob into a base64 data URI. * * Some browsers/OSes deliver picked files with an empty `type`; the picker * accepts those by extension, but `readAsDataURL` would then produce an * `application/octet-stream` data URI that `create.image` rejects. Rewrite * the media type from the filename so extension-accepted files still insert. */ export declare function fileToDataUri(file: NamedBlob): Promise; /** * Resolve the `create.image` src for a picked file. Uses the consumer's * `handleImageUpload` callback when configured (V1 contract: * `(file: File) => Promise`). A returned non-data URL is fetched and * embedded, because `create.image` requires an embedded base64 data URI. */ export declare function resolveImageSrc(file: File, handleImageUpload: ((file: File) => Promise) | null | undefined): Promise; /** * Hidden `` picker bound to one toolbar instance. The input * stays attached (hidden) so automation and tests can drive it; `destroy()` * removes it. Picking a file calls `onPick(file)`; an unsupported type or a * failed pick routes through `onError(error)`. */ export declare function createImageFilePicker({ ownerDocument, onPick, onError, }?: ImageFilePickerOptions): ImageFilePicker; export {};