import{g as v}from"./trash-2-Dx96Ty-c.js";import{a as w}from"./webui-C025Pd1b.js";const a=new v,A=new v({area:"local"}),f="browser",I=async()=>{const e=await a.get("ttsProvider");return!e||e.length===0?f:e},B=async e=>{await a.set("ttsProvider",e)},U=async()=>(await speechSynthesis.getVoices()).map(e=>({voiceName:e.name,lang:e.lang})),m=async()=>await a.get("voice"),$=async e=>{await a.set("voice",e)},j=async()=>{const e=await a.get("isTTSEnabled");return!e||e.length===0?!0:e==="true"},C=async e=>{await a.set("isTTSEnabled",e.toString())},h=async()=>await a.get("isSSMLEnabled")==="true",N=async e=>{await a.set("isSSMLEnabled",e.toString())},u=async()=>await a.get("elevenLabsApiKey"),_=async e=>{await a.set("elevenLabsApiKey",e)},L=async()=>await a.get("elevenLabsVoiceId"),q=async e=>{await a.set("elevenLabsVoiceId",e)},P=async()=>await a.get("elevenLabsModel"),z=async e=>{await a.set("elevenLabsModel",e)},E=async()=>{const e=await a.get("openAITTSBaseUrl");return!e||e.length===0?"https://api.openai.com/v1":e},D=async e=>{await a.set("openAITTSBaseUrl",e)},M=async()=>await a.get("openAITTSApiKey")||"",V=async()=>{const e=await a.get("openAITTSModel");return!e||e.length===0?"tts-1":e},F=async e=>{await a.set("openAITTSModel",e)},G=async e=>{await a.set("openAITTSApiKey",e)},k=async()=>{const e=await a.get("openAITTSVoice");return!e||e.length===0?"alloy":e},H=async e=>{await a.set("openAITTSVoice",e)},J=async()=>{const e=await a.get("ttsResponseSplitting");return!e||e.length===0||e===""?"punctuation":e},K=async()=>{const e=await A.get("removeReasoningTagTTS");return!e||e.length===0||e===""?!0:e==="true"},O=async e=>{await a.set("ttsResponseSplitting",e)},Q=async e=>{await A.set("removeReasoningTagTTS",e.toString())},W=async()=>await a.get("isTTSAutoPlayEnabled")||!1,X=async e=>{await a.set("isTTSAutoPlayEnabled",e)},x=async()=>await a.get("speechPlaybackSpeed")||1,Y=async e=>{await a.set("speechPlaybackSpeed",e)},Z=async()=>{const[e,t,s,n,i,o,c,l,p,y,r,T,g,S,d,R]=await Promise.all([j(),I(),U(),m(),h(),u(),L(),P(),J(),K(),E(),M(),V(),k(),W(),x()]);return{ttsEnabled:e,ttsProvider:t,browserTTSVoices:s,voice:n,ssmlEnabled:i,elevenLabsApiKey:o,elevenLabsVoiceId:c,elevenLabsModel:l,responseSplitting:p,removeReasoningTagTTS:y,openAITTSBaseUrl:r,openAITTSApiKey:T,openAITTSModel:g,openAITTSVoice:S,ttsAutoPlay:d,playbackSpeed:R}},ee=async({ttsEnabled:e,ttsProvider:t,voice:s,ssmlEnabled:n,elevenLabsApiKey:i,elevenLabsVoiceId:o,elevenLabsModel:c,responseSplitting:l,removeReasoningTagTTS:p,openAITTSBaseUrl:y,openAITTSApiKey:r,openAITTSModel:T,openAITTSVoice:g,ttsAutoPlay:S,playbackSpeed:d})=>{await Promise.all([C(e),B(t),$(s),N(n),_(i),q(o),z(c),O(l),Q(p),D(y),G(r),F(T),H(g),X(S),Y(d)])},b="https://api.elevenlabs.io/v1",ae=async e=>(await w.get(`${b}/voices`,{headers:{"xi-api-key":e}})).data.voices,te=async e=>(await w.get(`${b}/models`,{headers:{"xi-api-key":e}})).data,se=async(e,t,s,n)=>(await w.post(`${b}/text-to-speech/${s}`,{text:t,model_id:n},{headers:{"xi-api-key":e,"Content-Type":"application/json"},responseType:"arraybuffer"})).data;export{M as a,V as b,k as c,m as d,I as e,K as f,E as g,x as h,h as i,u as j,P as k,L as l,se as m,ae as n,te as o,Z as p,ee as s};
