import { s as normalizeOptionalLowercaseString } from "./string-coerce-DKw2K5wM.js";
import { r as normalizeChatChannelId } from "./ids-COH3O_8T.js";
import { s as findRegisteredChannelPluginEntry } from "./registry-Cf1bcJgW.js";
//#region src/utils/message-channel-constants.ts
const INTERNAL_MESSAGE_CHANNEL = "webchat";
const INTERNAL_NON_DELIVERY_CHANNELS = [
	"heartbeat",
	"cron",
	"webhook",
	"voice"
];
function isInternalNonDeliveryChannel(value) {
	return INTERNAL_NON_DELIVERY_CHANNELS.includes(value);
}
//#endregion
//#region src/channels/registry-normalize.ts
function normalizeAnyChannelId(raw) {
	const key = normalizeOptionalLowercaseString(raw);
	if (!key) return null;
	return findRegisteredChannelPluginEntry(key)?.plugin.id ?? null;
}
//#endregion
//#region src/utils/message-channel-core.ts
function normalizeMessageChannel(raw) {
	const normalized = normalizeOptionalLowercaseString(raw);
	if (!normalized) return;
	if (normalized === "webchat") return INTERNAL_MESSAGE_CHANNEL;
	const builtIn = normalizeChatChannelId(normalized);
	if (builtIn) return builtIn;
	return normalizeAnyChannelId(normalized) ?? normalized;
}
function isDeliverableMessageChannel(value) {
	const normalized = normalizeMessageChannel(value);
	return normalized !== void 0 && normalized !== "webchat" && normalized === value;
}
//#endregion
export { isInternalNonDeliveryChannel as a, INTERNAL_MESSAGE_CHANNEL as i, normalizeMessageChannel as n, normalizeAnyChannelId as r, isDeliverableMessageChannel as t };
