import { ConvertDocumentWithCalibreBrowserInputModel, ConvertDocumentWithCalibreBrowserOutputModel, } from '../../../../../code/type/index.js';
import { buildFormDataRequestToConvert } from '../../shared.js';
import { resolveWorkFileAsBlob } from '../../../../../code/tool/shared/work.js';
import kink from '../../../../../code/tool/shared/kink.js';
export async function convertDocumentWithCalibreBrowser(source) {
    const input = ConvertDocumentWithCalibreBrowserInputModel.parse(source);
    switch (input.handle) {
        case 'remote':
            return await convertDocumentWithCalibreBrowserRemote(input);
        default:
            return await convertDocumentWithCalibreBrowserLocal(input);
    }
}
export async function convertDocumentWithCalibreBrowserRemote(input) {
    const request = buildFormDataRequestToConvert(input);
    const content = await resolveWorkFileAsBlob(request);
    return ConvertDocumentWithCalibreBrowserOutputModel.parse({
        file: {
            content,
        },
    });
}
export async function convertDocumentWithCalibreBrowserLocal(input) {
    throw kink('task_not_implemented', {
        task: 'convertDocumentWithCalibreBrowserLocal',
    });
}
//# sourceMappingURL=browser.js.map