#[cfg(feature = "cloud")]
use crate::boundaries::{EstimateFirer, EstimatePlan};
#[cfg(feature = "cloud")]
use crate::engine::{estimate_word_boundaries, preprocess_speech_markdown, TtsEngine};
#[cfg(feature = "cloud")]
use crate::types::{
normalize_gender, Gender, LanguageCode, TtsError, TtsResult, Voice, WordBoundary,
};
use std::collections::HashMap;
#[cfg(feature = "cloud")]
use std::sync::Arc;
#[cfg(feature = "cloud")]
use {
tungstenite::client::IntoClientRequest,
tungstenite::{connect, Message},
url::Url,
uuid::Uuid,
};
#[must_use]
pub(crate) fn azure_ws_extract_path(text_msg: &str) -> &str {
text_msg
.lines()
.find(|l| l.starts_with("Path:"))
.and_then(|l| l.strip_prefix("Path:"))
.map_or("", str::trim)
}
#[must_use]
pub(crate) fn azure_ws_extract_body(text_msg: &str) -> &str {
if let Some(idx) = text_msg.find("\r\n\r\n") {
&text_msg[idx + 4..]
} else if let Some(idx) = text_msg.find("\n\n") {
&text_msg[idx + 2..]
} else {
""
}
}
#[must_use]
pub(crate) fn azure_ws_extract_error(body: &str) -> Option<String> {
let json: serde_json::Value = serde_json::from_str(body).ok()?;
let err = json.get("Error")?;
let reason = err
.get("Message")
.and_then(|v| v.as_str())
.or_else(|| json.get("reason").and_then(|v| v.as_str()))
.unwrap_or("Azure synthesis failed");
Some(reason.to_string())
}
#[cfg(feature = "cloud-core")]
mod config;
#[cfg(feature = "cloud")]
mod decode;
#[cfg(feature = "cloud-core")]
mod edge;
#[cfg(feature = "cloud-core")]
mod elevenlabs;
#[cfg(feature = "cloud")]
mod engine;
#[cfg(feature = "cloud-core")]
mod gemini;
#[cfg(feature = "cloud-core")]
mod google;
#[cfg(feature = "cloud")]
mod qwen;
#[cfg(feature = "cloud-core")]
mod sigv4;
#[cfg(feature = "cloud-core")]
mod ssml;
#[cfg(all(test, feature = "cloud"))]
mod tests;
#[cfg(feature = "cloud")]
mod voices;
#[cfg(feature = "cloud-core")]
pub use config::*;
#[cfg(feature = "cloud")]
pub(crate) use decode::*;
#[cfg(feature = "cloud-core")]
pub use edge::*;
#[cfg(feature = "cloud-core")]
pub use elevenlabs::*;
#[cfg(feature = "cloud-core")]
pub use gemini::*;
#[cfg(feature = "cloud-core")]
pub use google::*;
#[cfg(feature = "cloud")]
pub(crate) use qwen::*;
#[cfg(feature = "cloud-core")]
pub use sigv4::*;
#[cfg(feature = "cloud-core")]
pub use ssml::*;
#[cfg(feature = "cloud")]
pub(crate) use voices::*;
#[cfg(feature = "cloud")]
pub use engine::create_cloud_engine;
#[cfg(feature = "cloud")]
pub use engine::set_viseme_callback;
#[allow(unused_imports)] #[cfg(feature = "cloud")]
pub use engine::CloudEngine;