import { a as shouldLogVerbose } from "./globals-CHNs9cIE.js";
import { a as chunkText } from "./chunk-Zq6EJkPq.js";
import "./runtime-env-DFa5Z-5g.js";
import "./reply-chunking-RWwsoQE_.js";
import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-BcLe2TGk.js";
import { n as normalizeWhatsAppPayloadText } from "./outbound-media-contract-BcOXEK-x.js";
import { t as createWhatsAppOutboundBase } from "./outbound-base-BLAIfl01.js";
//#region extensions/whatsapp/src/outbound-adapter.ts
let whatsAppSendModulePromise;
function loadWhatsAppSendModule() {
	whatsAppSendModulePromise ??= import("./send-C_lQcLNJ.js");
	return whatsAppSendModulePromise;
}
function normalizeOutboundText(text) {
	return normalizeWhatsAppPayloadText(text);
}
const whatsappOutbound = createWhatsAppOutboundBase({
	chunker: chunkText,
	sendMessageWhatsApp: async (to, text, options) => await (await loadWhatsAppSendModule()).sendMessageWhatsApp(to, normalizeOutboundText(text), { ...options }),
	sendPollWhatsApp: async (to, poll, options) => await (await loadWhatsAppSendModule()).sendPollWhatsApp(to, poll, options),
	shouldLogVerbose: () => shouldLogVerbose(),
	resolveTarget: ({ to, allowFrom, mode }) => resolveWhatsAppOutboundTarget({
		to,
		allowFrom,
		mode
	}),
	normalizeText: normalizeOutboundText,
	skipEmptyText: true
});
//#endregion
export { whatsappOutbound as t };
