import { ConvertTxtWithPuppeteerBrowserInputModel, ConvertTxtWithPuppeteerBrowserOutputModel, ConvertMarkdownWithPuppeteerBrowserInputModel, ConvertMarkdownWithPuppeteerBrowserOutputModel, } 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 convertTxtWithPuppeteerBrowser(source) {
    const input = ConvertTxtWithPuppeteerBrowserInputModel.parse(source);
    switch (input.handle) {
        case 'remote':
            return await convertTxtWithPuppeteerBrowserRemote(input);
        default:
            return await convertTxtWithPuppeteerBrowserLocal(input);
    }
}
export async function convertTxtWithPuppeteerBrowserRemote(input) {
    const request = buildFormDataRequestToConvert(input);
    const content = await resolveWorkFileAsBlob(request);
    return ConvertTxtWithPuppeteerBrowserOutputModel.parse({
        file: {
            content,
        },
    });
}
export async function convertTxtWithPuppeteerBrowserLocal(input) {
    throw kink('task_not_implemented', {
        task: 'convertTxtWithPuppeteerBrowserLocal',
    });
}
export async function convertMarkdownWithPuppeteerBrowser(source) {
    const input = ConvertMarkdownWithPuppeteerBrowserInputModel.parse(source);
    switch (input.handle) {
        case 'remote':
            return await convertMarkdownWithPuppeteerBrowserRemote(input);
        default:
            return await convertMarkdownWithPuppeteerBrowserLocal(input);
    }
}
export async function convertMarkdownWithPuppeteerBrowserRemote(input) {
    const request = buildFormDataRequestToConvert(input);
    const content = await resolveWorkFileAsBlob(request);
    return ConvertMarkdownWithPuppeteerBrowserOutputModel.parse({
        file: {
            content,
        },
    });
}
export async function convertMarkdownWithPuppeteerBrowserLocal(input) {
    throw kink('task_not_implemented', {
        task: 'convertTxtWithPuppeteerBrowserLocal',
    });
}
//# sourceMappingURL=browser.js.map