import{G as D,j as r,al as F,am as B,aI as G,av as P,b9 as X}from"./181bbd54-920a-4775-9fb2-3bcff9d1a946.BeKeB6Db.js";import{r as u}from"./f6de5699-4e50-48ad-ba58-1a57861e9cfe._xgslB6l.js";import{u as O,L as _}from"./index.DUxJGhFZ.js";import"./e888408f-56dc-47c7-b924-60d24f60aa87.Q259AOJ2.js";function U(n){return D({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M388.8 896.4v-27.198c.6-2.2 1.6-4.2 2-6.4 8.8-57.2 56.4-102.4 112.199-106.2 62.4-4.4 115.2 31.199 132.4 89.199 2.2 7.6 3.8 15.6 5.8 23.4v27.2c-.6 1.8-1.6 3.399-1.8 5.399-8.6 52.8-46.6 93-98.6 104.4-4 .8-8 2-12 3h-27.2c-1.8-.6-3.6-1.6-5.4-1.8-52-8.4-91.599-45.4-103.6-96.8-1.2-5-2.6-9.6-3.8-14.2zm252.4-768.797l-.001 27.202c-.6 2.2-1.6 4.2-1.8 6.4-9 57.6-56.8 102.6-113.2 106.2-62.2 4-114.8-32-131.8-90.2-2.2-7.401-3.8-15-5.6-22.401v-27.2c.6-1.8 1.6-3.4 2-5.2 9.6-52 39.8-86 90.2-102.2 6.6-2.2 13.6-3.4 20.4-5.2h27.2c1.8.6 3.6 1.6 5.4 1.8 52.2 8.6 91.6 45.4 103.6 96.8 1.201 4.8 2.401 9.4 3.601 13.999zm-.001 370.801v27.2c-.6 2.2-1.6 4.2-2 6.4-9 57.4-58.6 103.6-114.6 106-63 2.8-116.4-35.2-131.4-93.8-1.6-6.2-3-12.4-4.4-18.6v-27.2c.6-2.2 1.6-4.2 2-6.4 8.8-57.4 58.6-103.601 114.6-106.2 63-3 116.4 35.2 131.4 93.8 1.6 6.4 3 12.6 4.4 18.8z"},child:[]}]})(n)}var x=function(n,v){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var c=t.call(n),s,l=[],d;try{for(;(v===void 0||v-- >0)&&!(s=c.next()).done;)l.push(s.value)}catch(m){d={error:m}}finally{try{s&&!s.done&&(t=c.return)&&t.call(c)}finally{if(d)throw d.error}}return l};function K(n){var v=n.id,t=O(),c=t.getContainer,s=t.donwloadAudio,l=t.idioma,d=c(v)(),m=d.audio64,z=d.removeAudio,h=x(u.useState(!1),2),T=h[0],f=h[1],g=x(u.useState(0),2),k=g[0],p=g[1],b=x(u.useState(0),2),C=b[0],N=b[1],j=x(u.useState(0),2),A=j[0],E=j[1],a=u.useRef(null);u.useEffect(function(){var e=a.current,o=function(){return N(e.duration)},i=function(){E(e.currentTime),p(e.currentTime/e.duration*100)};return e.addEventListener("loadedmetadata",o),e.addEventListener("timeupdate",i),function(){e.removeEventListener("loadedmetadata",o),e.removeEventListener("timeupdate",i)}},[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;p(e)},w=function(e){var o=Math.floor(e/60),i=Math.floor(e%60);return"".concat(o,":").concat(i<10?"0":"").concat(i)},R=function(e){e.stopPropagation();var o=e.target.getBoundingClientRect(),i=e.clientX-o.left,y=Math.min(Math.max(0,i/o.width*100),100),M=y/100*a.current.duration;p(y),a.current.currentTime=M},I=function(){a.current.currentTime=0,p(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:m,onTimeUpdate:L,onEnded:I}),r.jsx("button",{onClick:S,className:"pulse",children:r.jsx("div",{className:"text-[var(--audio-control-incoming)]",children:T?r.jsx(F,{size:22}):r.jsx(B,{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(k,"%"),borderRadius:"12px"}})}),r.jsxs("div",{className:"flex text-[var(--audio-progress-metadata)]",children:[r.jsx("span",{children:w(A)})," / ",r.jsx("span",{children:w(C)})]}),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(U,{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(),z()},children:r.jsxs("div",{className:"flex gap-2 text-[var(--icon)]",children:[r.jsx(G,{size:16}),r.jsx(P,{size:"14px",children:_.excluir[l]})]})}),r.jsx("li",{onClick:function(e){e.stopPropagation(),s(m)},children:r.jsxs("div",{className:"flex gap-2 text-[var(--icon)]",children:[r.jsx(X,{size:18}),r.jsx(P,{size:"14px",children:_.baixar[l]})]})})]})]})]})}export{K as default};
