function getImageFormatFromMime(mimeType = "") {
  if (!mimeType) return null;
  const parts = mimeType.toLowerCase().split("/");
  if (parts?.[0] !== "image") return null;
  let format = parts?.[1];
  if (!format) return null;

  // Remap jpg to jpeg
  switch (format) {
    case "jpg":
      format = "jpeg";
      break;
    default:
      break;
  }

  if (!SUPPORTED_BEDROCK_IMAGE_FORMATS.includes(format)) return null;
  return format;
}
Parses a MIME type string (e.g., "image/jpeg") to extract and validate the image format
supported by Bedrock Converse. Handles 'image/jpg' as 'jpeg'.
@param {string | null | undefined} mimeType - The MIME type string.
@returns {string | null} The validated image format (e.g., "jpeg") or null if invalid/unsupported.