//#region extensions/telegram/src/send-options.ts
/**
* Build Telegram API send options
* Eliminates duplicate code across multiple send paths
*/
function buildSendOptions(params) {
	const options = { parse_mode: params.parseMode ?? "HTML" };
	if (params.threadId) options.message_thread_id = parseInt(params.threadId, 10);
	if (params.replyToMessageId) options.reply_to_message_id = parseInt(params.replyToMessageId, 10);
	if (params.silent) options.disable_notification = true;
	if (params.caption) options.caption = params.caption;
	return options;
}
/**
* Parse data URL into mimeType and buffer
* Supports: data:mime/type;base64,DATA
*/
function parseDataUrl(dataUrl) {
	const match = dataUrl.match(/^data:([^;]+);base64,(.+)$/);
	if (!match) return null;
	const mimeType = match[1];
	const base64Data = match[2];
	return {
		mimeType,
		buffer: Buffer.from(base64Data, "base64")
	};
}
/**
* Resolve media method based on mime type or category
*/
function resolveMediaMethod(mimeTypeOrCategory) {
	if (mimeTypeOrCategory === "image" || mimeTypeOrCategory.startsWith("image/")) return "sendPhoto";
	if (mimeTypeOrCategory === "video" || mimeTypeOrCategory.startsWith("video/")) return "sendVideo";
	if (mimeTypeOrCategory === "voice") return "sendVoice";
	if (mimeTypeOrCategory.includes("opus")) return "sendVoice";
	if (mimeTypeOrCategory === "audio" || mimeTypeOrCategory.startsWith("audio/")) return "sendAudio";
	return "sendDocument";
}
//#endregion
export { buildSendOptions, parseDataUrl, resolveMediaMethod };

//# sourceMappingURL=send-options.js.map