var p=Object.defineProperty;var r=(s,c)=>p(s,"name",{value:c,configurable:!0});import{eH as l,eI as u}from"./vendor-other-CSX7WseZ.js";import{a as m,f}from"./index-2-qFLlQP.js";let i=!1;const T=r(()=>{const s=r((e,o,n)=>{console.error(`Audio Service Error (${e}):`,o,n)},"handleError");return{convertBlobToFileAndSubmit:r(async e=>{const o=`recording-${Date.now()}.wav`,n=new File([e],o,{type:e.type||"audio/wav"}),t=new FormData;t.append("image",n),t.append("subfolder","audio"),t.append("type","temp");const a=await m.fetchApi("/upload/image",{method:"POST",body:t});if(a.status!==200){const d=`Error uploading temp file: ${a.status} - ${a.statusText}`;throw f().addAlert(d),new Error(d)}return`audio/${(await a.json()).name} [temp]`},"convertBlobToFileAndSubmit"),registerWavEncoder:r(async()=>{if(!i)try{await l(await u()),i=!0}catch(e){e instanceof Error&&e.message.includes("already an encoder stored")?i=!0:s("encoder","Failed to register WAV encoder",e)}},"registerWavEncoder"),stopAllTracks:r(e=>{e&&(e.getTracks().forEach(o=>{o.stop()}),e=null)},"stopAllTracks")}},"useAudioService");export{T as u};
//# sourceMappingURL=audioService-Bh6LQBV8.js.map
