"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1417],{81417:(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var n=r(23892),l=r(85848),s=r(66668);function u(e){let{samples:t,duration:r,currentTime:s,onSeek:u,height:i=80}=e,o=(0,l.useRef)(null),a=(0,l.useRef)(null),c=(0,l.useRef)(null),[d,f]=(0,l.useState)(800);return(0,l.useEffect)(()=>{if(!c.current)return;let e=()=>{c.current&&f(c.current.clientWidth)};e();let t=new ResizeObserver(e);return t.observe(c.current),()=>{t.disconnect()}},[]),(0,l.useEffect)(()=>{if(!o.current)return;let e=o.current,r=e.getContext("2d"),n=e.width,l=e.height;r.clearRect(0,0,n,l);let s=Math.floor(t.length/n);r.strokeStyle=getComputedStyle(e).getPropertyValue("--chart-default-fill").trim()||"#3b82f6",r.lineWidth=1.5,r.beginPath();for(let e=0;e<n;e++){let n=l/2*(1-(t[e*s]||0));0===e?r.moveTo(e,n):r.lineTo(e,n)}r.stroke(),r.strokeStyle="hsl(var(--border))",r.lineWidth=1,r.beginPath(),r.moveTo(0,l/2),r.lineTo(n,l/2),r.stroke()},[t,d]),(0,l.useEffect)(()=>{if(!a.current)return;let e=a.current,t=e.getContext("2d"),n=e.width,l=e.height;t.clearRect(0,0,n,l);let u=s/r*n;t.strokeStyle="red",t.lineWidth=2,t.beginPath(),t.moveTo(u,0),t.lineTo(u,l),t.stroke()},[r,s]),(0,n.jsx)("div",{className:"w-full",children:(0,n.jsxs)("div",{ref:c,className:"relative w-full cursor-pointer rounded overflow-hidden bg-muted/20 border border-border",style:{height:i},onClick:function(e){if(!o.current)return;let t=o.current.getBoundingClientRect(),n=(e.clientX-t.left)/t.width*r;u(Math.max(0,Math.min(r,n)))},children:[(0,n.jsx)("canvas",{ref:o,width:d,height:i,className:"absolute inset-0 w-full h-full"}),(0,n.jsx)("canvas",{ref:a,width:d,height:i,className:"absolute inset-0 w-full h-full pointer-events-none"})]})})}r(89116);var i=r(65102),o=r(70621);function a(e){let{audioUrl:t,autoPlay:r=!1}=e,a=(0,l.useRef)(null),[c,d]=(0,l.useState)(0),{audioData:f}=(0,o.s)(t),h=e=>{var t,r;(null==(r=a.current)||null==(t=r.audio)?void 0:t.current)&&(a.current.audio.current.currentTime=e)};return f?(0,n.jsxs)("div",{className:"p-2 w-full space-y-2",children:[(0,n.jsx)(s.A,{ref:a,src:t,autoPlay:r,autoPlayAfterSrcChange:!1,showJumpControls:!1,customAdditionalControls:[],layout:"horizontal-reverse",listenInterval:100,onListen:()=>{var e,t;(null==(t=a.current)||null==(e=t.audio)?void 0:e.current)&&d(a.current.audio.current.currentTime)}}),(0,n.jsx)(u,{samples:f.samples,duration:f.duration,currentTime:c,onSeek:h,height:50}),(0,n.jsx)(i.A,{samples:f.samples,duration:f.duration,currentTime:c,onSeek:h,height:120})]}):(0,n.jsx)("div",{className:"p-4 w-full flex items-center justify-center h-[500px]",children:(0,n.jsxs)("div",{className:"flex flex-col items-center space-y-3",children:[(0,n.jsx)("div",{className:"w-12 h-12 border-4 border-muted-foreground border-t-transparent rounded-full animate-spin"}),(0,n.jsx)("span",{className:"text-sm text-muted-foreground",children:"Loading audio..."})]})})}}}]);