openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
34 lines (33 loc) • 1.07 kB
JavaScript
import { l as normalizeOptionalString } from "./string-coerce-CCIiB4H7.mjs";
import { d as normalizeMimeType, i as getFileExtension } from "./mime-D2wVBzpa.mjs";
//#region src/media/audio.ts
/** File extensions accepted by channel voice-message upload paths. */
const VOICE_MESSAGE_AUDIO_EXTENSIONS = /* @__PURE__ */ new Set([
".oga",
".ogg",
".opus",
".mp3",
".m4a"
]);
/** MIME types compatible with voice-message upload paths. */
const VOICE_MESSAGE_MIME_TYPES = /* @__PURE__ */ new Set([
"audio/ogg",
"audio/opus",
"audio/mpeg",
"audio/mp3",
"audio/mp4",
"audio/x-m4a",
"audio/m4a"
]);
/** Checks whether MIME type or filename is compatible with voice-message delivery. */
function isVoiceMessageCompatibleAudio(e) {
const t = normalizeMimeType(e.contentType);
if (t && VOICE_MESSAGE_MIME_TYPES.has(t)) return true;
const n = normalizeOptionalString(e.fileName);
if (!n) return false;
const r = getFileExtension(n);
if (!r) return false;
return VOICE_MESSAGE_AUDIO_EXTENSIONS.has(r);
}
//#endregion
export { isVoiceMessageCompatibleAudio as t };