import{r as d,j as r}from"./v_7_4_3_15_0399e866-74c7-4569-9f5c-4e0b92137cdb.js";import{u as D,L as P}from"./v_7_4_3_15_0399e866-74c7-4569-9f5c-4e0b92137cdb18.js";import{dd as F,de as X,d2 as B,H as _,du as H}from"./v_7_4_3_15_0399e866-74c7-4569-9f5c-4e0b92137cdb11.js";import{d as O}from"./v_7_4_3_15_0399e866-74c7-4569-9f5c-4e0b92137cdb36.js";import"./v_7_4_3_15_0399e866-74c7-4569-9f5c-4e0b92137cdb20.js";import"./v_7_4_3_15_0399e866-74c7-4569-9f5c-4e0b92137cdb8.js";import"./v_7_4_3_15_0399e866-74c7-4569-9f5c-4e0b92137cdb19.js";import"./v_7_4_3_15_0399e866-74c7-4569-9f5c-4e0b92137cdb7.js";import"./v_7_4_3_15_0399e866-74c7-4569-9f5c-4e0b92137cdb9.js";import"./v_7_4_3_15_0399e866-74c7-4569-9f5c-4e0b92137cdb6.js";var x=function(u,m){var t=typeof Symbol=="function"&&u[Symbol.iterator];if(!t)return u;var c=t.call(u),i,l=[],s;try{for(;(m===void 0||m-- >0)&&!(i=c.next()).done;)l.push(i.value)}catch(p){s={error:p}}finally{try{i&&!i.done&&(t=c.return)&&t.call(c)}finally{if(s)throw s.error}}return l};function $(u){var m=u.id,t=D(),c=t.getContainer,i=t.donwloadAudio,l=t.idioma,s=c(m)(),p=s.audio64,T=s.removeAudio,g=x(d.useState(!1),2),k=g[0],f=g[1],h=x(d.useState(0),2),C=h[0],v=h[1],j=x(d.useState(0),2),N=j[0],z=j[1],b=x(d.useState(0),2),A=b[0],E=b[1],a=d.useRef(null);d.useEffect(function(){var e=a.current,o=function(){return z(e.duration)},n=function(){E(e.currentTime),v(e.currentTime/e.duration*100)};return e.addEventListener("loadedmetadata",o),e.addEventListener("timeupdate",n),function(){e.removeEventListener("loadedmetadata",o),e.removeEventListener("timeupdate",n)}},[a]);var S=function(){a.current.paused?(a.current.play(),f(!0)):(a.current.pause(),f(!1))},L=function(){var e=a.current.currentTime/a.current.duration*100;v(e)},w=function(e){var o=Math.floor(e/60),n=Math.floor(e%60);return"".concat(o,":").concat(n<10?"0":"").concat(n)},R=function(e){e.stopPropagation();var o=e.target.getBoundingClientRect(),n=e.clientX-o.left,y=Math.min(Math.max(0,n/o.width*100),100),I=y/100*a.current.duration;v(y),a.current.currentTime=I},M=function(){a.current.currentTime=0,v(0),f(!1)};return r.jsxs("div",{className:"group flex gap-2 items-center w-full max-w-[300px] p-2 border border-solid border-[var(--conversation-header-border)] m-auto mb-2 rounded-lg bg-[var(--background-default)]",children:[r.jsx("audio",{ref:a,src:p,onTimeUpdate:L,onEnded:M}),r.jsx("button",{onClick:S,className:"pulse",children:r.jsx("div",{className:"text-[var(--audio-control-incoming)]",children:k?r.jsx(F,{size:22}):r.jsx(X,{size:22})})}),r.jsx("div",{className:"progress-bar",style:{position:"relative",background:"#ddd",height:"9px",width:"100%",cursor:"pointer",borderRadius:"12px"},onClick:R,children:r.jsx("div",{style:{background:"var(--primaria)",height:"100%",width:"".concat(C,"%"),borderRadius:"12px"}})}),r.jsxs("div",{className:"flex text-[var(--audio-progress-metadata)]",children:[r.jsx("span",{children:w(A)})," / ",r.jsx("span",{children:w(N)})]}),r.jsxs("div",{className:"dropdown dropdown-top dropdown-end",children:[r.jsx("div",{className:"text-[var(--audio-control-incoming)] hidden group-hover:block animate__animated animate__zoomIn cursor-pointer pulse",tabIndex:0,role:"button",onClick:function(e){return e.stopPropagation()},children:r.jsx(O,{size:19})}),r.jsxs("ul",{tabIndex:0,className:"dropdown-content menu bg-base-100 rounded-box w-[120px] p-2 shadow z-[99999]",children:[r.jsx("li",{onClick:function(e){e.stopPropagation(),T()},children:r.jsxs("div",{className:"flex gap-2 text-[var(--icon)]",children:[r.jsx(B,{size:16}),r.jsx(_,{size:"14px",children:P.excluir[l]})]})}),r.jsx("li",{onClick:function(e){e.stopPropagation(),i(p)},children:r.jsxs("div",{className:"flex gap-2 text-[var(--icon)]",children:[r.jsx(H,{size:18}),r.jsx(_,{size:"14px",children:P.baixar[l]})]})})]})]})]})}export{$ as default};
