1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[18367],{18367:(e,t,a)=>{a.r(t),a.d(t,{VocalRemoverPanel:()=>u,default:()=>m});var s=a(88999),l=a(33576),r=a(431),i=a(76009),o=a(54326),n=a(88865),d=a(2885),c=a(64727);function u(){let e=(0,l.c)("AIAudioStudio"),[t,a]=(0,r.useState)(null),[u,m]=(0,r.useState)(!1),[x,v]=(0,r.useState)(null),h=(0,i.m)("audio-vocal-panel"),{data:p,status:f,error:b}=(0,o.d)({taskId:t,type:"vocal-removal",enabled:!!t}),g=(0,r.useMemo)(()=>p?.stems??(0,n.o)(p?.raw,x?.audioUrl),[p?.raw,p?.stems,x?.audioUrl]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c._,{onOpenPicker:()=>m(!0),onStart:async e=>{let t=await fetch("/api/audio/separate-vocals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,audioUrl:x?.audioUrl??void 0,idempotencyKey:h.key})}),s=await t.json();s.taskId&&(a(s.taskId),h.reset())},status:f,errorMessage:b,hasActiveTask:!!t,stems:g,selectedItem:x}),(0,s.jsx)(d._,{open:u,onOpenChange:m,title:e("vocalRemoverPanel.pickerTitle"),onSelect:e=>{v(e)}})]})}let m=u},30447:(e,t,a)=>{a.d(t,{A:()=>s});let s=(0,a(92074).A)("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]])},35532:(e,t,a)=>{a.d(t,{A:()=>s});let s=(0,a(92074).A)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])},36641:(e,t,a)=>{a.d(t,{A:()=>s});let s=(0,a(92074).A)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},45699:(e,t,a)=>{a.d(t,{B8:()=>_,UC:()=>I,bL:()=>C,l9:()=>U});var s=a(431),l=a(5195),r=a(42739),i=a(99417),o=a(20625),n=a(11195),d=a(11140),c=a(11626),u=a(15622),m=a(88999),x="Tabs",[v,h]=(0,r.A)(x,[i.RG]),p=(0,i.RG)(),[f,b]=v(x),g=s.forwardRef((e,t)=>{let{__scopeTabs:a,value:s,onValueChange:l,defaultValue:r,orientation:i="horizontal",dir:o,activationMode:x="automatic",...v}=e,h=(0,d.jH)(o),[p,b]=(0,c.i)({prop:s,onChange:l,defaultProp:r});return(0,m.jsx)(f,{scope:a,baseId:(0,u.B)(),value:p,onValueChange:b,orientation:i,dir:h,activationMode:x,children:(0,m.jsx)(n.sG.div,{dir:h,"data-orientation":i,...v,ref:t})})});g.displayName=x;var w="TabsList",j=s.forwardRef((e,t)=>{let{__scopeTabs:a,loop:s=!0,...l}=e,r=b(w,a),o=p(a);return(0,m.jsx)(i.bL,{asChild:!0,...o,orientation:r.orientation,dir:r.dir,loop:s,children:(0,m.jsx)(n.sG.div,{role:"tablist","aria-orientation":r.orientation,...l,ref:t})})});j.displayName=w;var y="TabsTrigger",N=s.forwardRef((e,t)=>{let{__scopeTabs:a,value:s,disabled:r=!1,...o}=e,d=b(y,a),c=p(a),u=A(d.baseId,s),x=S(d.baseId,s),v=s===d.value;return(0,m.jsx)(i.q7,{asChild:!0,...c,focusable:!r,active:v,children:(0,m.jsx)(n.sG.button,{type:"button",role:"tab","aria-selected":v,"aria-controls":x,"data-state":v?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:u,...o,ref:t,onMouseDown:(0,l.m)(e.onMouseDown,e=>{r||0!==e.button||!1!==e.ctrlKey?e.preventDefault():d.onValueChange(s)}),onKeyDown:(0,l.m)(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&d.onValueChange(s)}),onFocus:(0,l.m)(e.onFocus,()=>{let e="manual"!==d.activationMode;v||r||!e||d.onValueChange(s)})})})});N.displayName=y;var R="TabsContent",k=s.forwardRef((e,t)=>{let{__scopeTabs:a,value:l,forceMount:r,children:i,...d}=e,c=b(R,a),u=A(c.baseId,l),x=S(c.baseId,l),v=l===c.value,h=s.useRef(v);return s.useEffect(()=>{let e=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,m.jsx)(o.C,{present:r||v,children:({present:a})=>(0,m.jsx)(n.sG.div,{"data-state":v?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!a,id:x,tabIndex:0,...d,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:a&&i})})});function A(e,t){return`${e}-trigger-${t}`}function S(e,t){return`${e}-content-${t}`}k.displayName=R;var C=g,_=j,U=N,I=k},63335:(e,t,a)=>{a.d(t,{Xi:()=>n,av:()=>d,j7:()=>o,tU:()=>i});var s=a(88999);a(431);var l=a(45699),r=a(96244);function i({className:e,...t}){return(0,s.jsx)(l.bL,{"data-slot":"tabs",className:(0,r.cn)("flex flex-col gap-2",e),...t})}function o({className:e,...t}){return(0,s.jsx)(l.B8,{"data-slot":"tabs-list",className:(0,r.cn)("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function n({className:e,...t}){return(0,s.jsx)(l.l9,{"data-slot":"tabs-trigger",className:(0,r.cn)("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focu
1s-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function d({className:e,...t}){return(0,s.jsx)(l.UC,{"data-slot":"tabs-content",className:(0,r.cn)("flex-1 outline-none",e),...t})}},64727:(e,t,a)=>{a.d(t,{_:()=>N});var s=a(88999),l=a(12630),r=a(33303),i=a(63335),o=a(35532),n=a(22690),d=a(78042),c=a(30447),u=a(85741),m=a(70739),x=a(36641),v=a(33576),h=a(35162),p=a(431),f=a(63275),b=a(62925),g=a(76009),w=a(54326),j=a(39203),y=a(88865);function N({onStart:e,onOpenPicker:t,status:a,errorMessage:N,hasActiveTask:R=!1,stems:k,selectedItem:A}){let S=(0,v.c)("AIAudioStudio"),C=(0,h.Ym)(),_=R&&("failed"===a||"timeout"===a),U=(0,p.useRef)(null),[I,E]=(0,p.useState)(!1),[M,F]=(0,p.useState)(!1),[T,L]=(0,p.useState)(""),[D,$]=(0,p.useState)(""),[O,P]=(0,p.useState)("idle"),[H,z]=(0,p.useState)(""),[G,V]=(0,p.useState)(null),[q,K]=(0,p.useState)(""),W=(0,p.useRef)(null),[B,J]=(0,p.useState)(0),[Q,X]=(0,p.useState)(null),Y=(0,g.m)("audio-vocal-upload"),[Z,ee]=(0,p.useState)({vocal:"processing",instrumental:"processing",origin:"processing"}),[et,ea]=(0,p.useState)(0),[es,el]=(0,p.useState)("idle"),[er,ei]=(0,p.useState)(null),[eo,en]=(0,p.useState)(null),[ed,ec]=(0,p.useState)({vocal:"idle",instrumental:"idle",origin:"idle"}),eu=R&&("running"===a||"queued"===a||"success"===a&&!k),em=R&&"success"===a&&!!k,ex=A&&("idle"!==es||eu||em||k),{status:ev,data:eh}=(0,w.d)({taskId:Q,type:"vocal-removal",enabled:!!Q}),ep=(0,p.useMemo)(()=>eh?.stems??(0,y.o)(eh?.raw,T),[eh?.raw,eh?.stems,T]),ef=(0,p.useMemo)(()=>[{label:S("vocalRemover.labels.origin"),url:k?.origin},{label:S("vocalRemover.labels.vocal"),url:k?.vocal},{label:S("vocalRemover.labels.instrumental"),url:k?.instrumental}].filter(e=>"string"==typeof e.url&&e.url.length>0),[k?.instrumental,k?.origin,k?.vocal,S]);(0,p.useEffect)(()=>{el("idle"),ei(null),ec({vocal:"idle",instrumental:"idle",origin:"idle"}),ea(0)},[A?.audioId]),(0,p.useEffect)(()=>{if(q)return()=>{URL.revokeObjectURL(q)}},[q]),(0,p.useEffect)(()=>{if("processing"!==O)return;let e=!0;J(2);let t=Date.now(),a=setInterval(()=>{e&&(J(e=>e>=98?e:Math.min(98,e+Math.max(1,Math.round(6*Math.random())))),Date.now()-t>6500&&J(100))},900);return()=>{e=!1,clearInterval(a)}},[O]),(0,p.useEffect)(()=>{"uploading"===O&&ee({vocal:"processing",instrumental:"processing",origin:"processing"})},[O]),(0,p.useEffect)(()=>{ep&&(P("results"),ee({vocal:"success",instrumental:"success",origin:"success"}))},[ep]),(0,p.useEffect)(()=>{Q&&("failed"===ev||"timeout"===ev)&&($(S("vocalRemover.errors.processFailed")),P("idle"))},[ev,Q]),(0,p.useEffect)(()=>{if(!eu)return;let e=!0;ea(2);let t=Date.now(),a=setInterval(()=>{e&&(ea(e=>e>=98?e:Math.min(98,e+Math.max(1,Math.round(6*Math.random())))),Date.now()-t>6500&&ea(99))},900);return()=>{e=!1,clearInterval(a)}},[eu]),(0,p.useEffect)(()=>{em&&ea(100)},[em]),(0,p.useEffect)(()=>{k&&(el("results"),ec({vocal:"success",instrumental:"success",origin:"success"}))},[k]),(0,p.useEffect)(()=>{if(!A?.audioUrl)return void en(null);let e=!0,t=new Audio(A.audioUrl),a=()=>{e&&Number.isFinite(t.duration)&&en(t.duration)};return t.addEventListener("loadedmetadata",a),t.load(),()=>{e=!1,t.removeEventListener("loadedmetadata",a)}},[A?.audioUrl]);let eb=async()=>{if(A?.apiTaskId&&A.audioId)try{el("processing"),ei(null),ec({vocal:"idle",instrumental:"idle",origin:"idle"}),await e({taskId:A.apiTaskId,audioId:A.audioId}),window.setTimeout(()=>{el("choose")},900)}catch(t){el("idle"),ea(0),ei(null),ec({vocal:"idle",instrumental:"idle",origin:"idle"});let e=t instanceof Error?t.message:S("vocalRemover.errors.startFailed");f.o.error(e)}},eg=()=>{P("idle"),L(""),$(""),z(""),V(null),K(""),J(0),X(null),Y.reset()},ew=e=>{if(!e||!Number.isFinite(e))return"";let t=Math.round(e),a=Math.floor(t/60),s=String(t%60).padStart(2,"0");return`${a}:${s}`},ej=async()=>{if(!A?.audioUrl)return;let e=U.current;if(e){if(e.src!==A.audioUrl&&(e.src=A.audioUrl),e.paused){try{await e.play(),E(!0)}catch{}return}e.pause(),E(!1)}},ey={height:32,barWidth:2,barGap:2,barRadius:2,normalize:!0,cursorWidth:0,waveColor:"rgba(255, 255, 255, 0.2)",progressColor:"#f3c653",dragToSeek:!0,interact:!0},eN=({label:e,url:t,isProcessing:a,progressWidth:l})=>{let r=(0,p.useRef)(null),i=(0,p.useRef)(null),[c,u]=(0,p.useState)(!1),[m,x]=(0,p.useState)(!1);return(0,p.useEffect)(()=>
1{if(!r.current||!t)return;u(!1),x(!1);let e=b.A.create({...ey,container:r.current});i.current=e;let a=()=>u(!0),s=()=>x(!0),l=()=>x(!1),o=()=>x(!1);return e.on("ready",a),e.on("play",s),e.on("pause",l),e.on("finish",o),e.load(t),()=>{e.un("ready",a),e.un("play",s),e.un("pause",l),e.un("finish",o);try{e.destroy()}catch{}i.current=null}},[t]),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between text-xs text-white/60",children:[(0,s.jsx)("span",{className:"text-[#f3c653]",children:e}),t?(0,s.jsx)("a",{href:t,className:"inline-flex items-center gap-2 text-white/60 hover:text-white",download:!0,children:(0,s.jsx)(o.A,{className:"h-4 w-4"})}):(0,s.jsx)("span",{className:"text-white/40",children:S("vocalRemover.status.processing")})]}),(0,s.jsxs)("div",{className:"flex items-center gap-4 rounded-2xl bg-white/5 px-4 py-3",children:[(0,s.jsx)("button",{type:"button",onClick:()=>i.current?.playPause(),disabled:!t||!c,className:"flex h-10 w-10 items-center justify-center rounded-full bg-white/10 text-white/80 disabled:opacity-40","aria-label":m?S("media.pause"):S("media.play"),children:m?(0,s.jsx)(n.A,{className:"h-4 w-4"}):(0,s.jsx)(d.A,{className:"h-4 w-4"})}),(0,s.jsx)("div",{className:"flex-1",children:t?(0,s.jsx)("div",{ref:r,className:"h-8 w-full"}):(0,s.jsx)("div",{className:"h-2 w-full overflow-hidden rounded-full bg-white/10",children:(0,s.jsx)("div",{className:"h-full rounded-full bg-gradient-to-r from-[#f7d774] via-[#f2b24d] to-[#f7d774] bg-[length:220%_100%] animate-[gradient_2.2s_linear_infinite] shadow-[0_0_12px_rgba(247,215,116,0.35)]",style:{width:a?l:"100%"}})})})]})]})},eR=async e=>{if(0===e.length)return;let t=`${A?.title||"stems"}.zip`,a=await fetch("/api/music/download-zip",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:e,filename:t})});if(!a.ok)throw Error(S("vocalRemover.errors.downloadFailed"));let s=a.headers.get("content-disposition")||"",l=t,r=s.match(/filename\*=UTF-8''([^;]+)/i),i=s.match(/filename=\"([^\"]+)\"/i);if(r?.[1])try{l=decodeURIComponent(r[1])}catch{l=t}else i?.[1]&&(l=i[1]);let o=await a.blob(),n=URL.createObjectURL(o),d=document.createElement("a");d.href=n,d.download=l,d.style.display="none",document.body.appendChild(d),d.click(),d.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3)};return(0,s.jsx)("div",{className:"space-y-8",children:(0,s.jsx)("div",{className:"rounded-[2rem] border border-white/10 bg-black/40 backdrop-blur-md p-6 shadow-xl min-h-[534px] flex flex-col",children:(0,s.jsxs)(i.tU,{defaultValue:"my-music",className:"gap-4 flex flex-col",children:[(0,s.jsxs)(i.j7,{className:"bg-transparent p-0 gap-6 h-auto rounded-none",children:[(0,s.jsxs)(i.Xi,{value:"my-music",className:"relative rounded-none border-0 border-b-2 border-transparent bg-transparent px-0 pb-2 text-sm font-semibold text-white/70 data-[state=active]:border-[#f3c653] data-[state=active]:bg-transparent data-[state=active]:text-[#f3c653] data-[state=active]:shadow-none data-[state=active]:[&>svg]:text-[#f3c653]",children:[(0,s.jsx)(c.A,{className:"h-4 w-4"}),S("vocalRemover.tabs.myMusic")]}),(0,s.jsxs)(i.Xi,{value:"local-file",className:"relative rounded-none border-0 border-b-2 border-transparent bg-transparent px-0 pb-2 text-sm font-semibold text-white/70 data-[state=active]:border-[#f3c653] data-[state=active]:bg-transparent data-[state=active]:text-[#f3c653] data-[state=active]:shadow-none data-[state=active]:[&>svg]:text-[#f3c653]",children:[(0,s.jsx)(u.A,{className:"h-4 w-4"}),S("vocalRemover.tabs.upload")]})]}),(0,s.jsxs)("div",{className:"border-t border-white/10 pt-6",children:[(0,s.jsx)(i.av,{value:"my-music",className:"mt-0",children:A?(0,s.jsxs)("div",{className:"flex h-full flex-col",children:[ex?null:(0,s.jsxs)("div",{className:"w-full space-y-4",children:[(0,s.jsx)("div",{className:"rounded-2xl border border-white/10 bg-white/5 px-5 py-4",children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-4 min-w-0",children:[(0,s.jsxs)("div",{className:"group relative h-12 w-12 overflow-hidden rounded-xl border border-white/10 bg-white/10 flex items-center justify-center",children:[A.imageUrl?(0,s.jsx)("img",{src:A.imageUrl,alt:A.title||S("vocalRemover.selected.coverAlt"),className:"h-full w-full object-cover"}):(0,s.jsx)(m.A,{className:"h-5 w-5 text-gradient-purple"}),A.audioUrl?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{type:"button",onClick:ej,className:"absolute inset-0 flex items-center justify-center bg-black/40 text-white","aria-label":I?S("media.pause"):S("media.play"),children:I?(0,s.jsx)(n.A,{className:"h-4 w-4"}):(0,s.jsx)(d.A,{className:"h-4 w-4"})}),(0,s.jsx)("audio",{ref:U,preload:"none",onEnded:()=>E(!1),className:"hidden"})]}):null]}),(0,s.jsxs)("div",{className:"min-w-0 text-left",children:[(0,s.jsx)("p",{className:"truncate text-sm font-semibold text-[#f3c653]",children:A.title||S("vocalRemover.selected.untitled")}),(0,s.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-xs text-white/50",children:[(0,s.jsx)("span",{className:"rounded-full border border-white/10 bg-white/5 px-2 py-0.5",children:S("vocalRemover.tags.party")}),(0,s.jsx)("span",{className:"rounded-full border border-white/10 bg-white/5 px-2 py-0.5",children:S("vocalRemover.tags.driving")}),(0,s.jsx)("span",{children:A.createdAt?new Date(A.createdAt).toLocaleStr
1ing(C):""})]})]})]}),(0,s.jsx)(l.Q,{onClick:eb,children:(0,s.jsxs)(r.$,{className:"h-8 rounded-full bg-gradient-to-r from-cyan-400 to-sky-400 px-4 text-xs font-semibold text-white shadow-[0_12px_24px_rgba(56,189,248,0.25)]",disabled:eu||!A.apiTaskId||!A.audioId,children:[(0,s.jsx)(m.A,{className:"mr-1.5 h-3.5 w-3.5"}),eu?S("vocalRemover.actions.removing"):em?S("vocalRemover.actions.removed"):S("vocalRemover.actions.remove")]})})]})}),(A.audioUrl,null)]}),ex?(0,s.jsxs)("div",{className:"mt-4 rounded-2xl border border-white/10 bg-white/5 p-6 shadow-[0_20px_60px_rgba(0,0,0,0.25)]",children:[_||N?(0,s.jsx)("div",{className:"mb-4 rounded-xl border border-red-500/30 bg-red-500/10 px-4 py-3 text-xs text-red-200",children:N||S("vocalRemover.errors.processFailedDetailed")}):null,(0,s.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 text-sm text-white/70",children:[(0,s.jsx)("button",{type:"button",onClick:t,className:"flex h-9 w-9 items-center justify-center rounded-full bg-white/5 text-white/70 hover:text-white","aria-label":S("vocalRemover.actions.back"),children:(0,s.jsx)(x.A,{className:"h-4 w-4"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm font-semibold text-[#f3c653]",children:A.title||S("vocalRemover.selected.untitled")}),(0,s.jsx)("div",{className:"mt-1 text-xs text-white/40",children:eo?`${Math.floor(eo/60)}:${String(Math.floor(eo%60)).padStart(2,"0")}`:""})]})]}),(0,s.jsxs)(r.$,{type:"button",disabled:0===ef.length,onClick:async()=>{if(0!==ef.length)try{await eR(ef)}catch(t){let e=t instanceof Error?t.message:S("vocalRemover.errors.downloadFailed");f.o.error(e)}},className:"h-9 rounded-full bg-sky-400 px-4 text-xs font-semibold text-slate-900 shadow-[0_10px_24px_rgba(56,189,248,0.25)] disabled:opacity-50",children:[(0,s.jsx)(o.A,{className:"mr-2 h-4 w-4"}),S("vocalRemover.actions.downloadAll")]})]}),(0,s.jsxs)("div",{className:"mt-6 space-y-5",children:[(0,s.jsx)(eN,{label:S("vocalRemover.labels.origin"),url:k?.origin,isProcessing:!k?.origin,progressWidth:"38%"}),(0,s.jsx)(eN,{label:S("vocalRemover.labels.vocal"),url:k?.vocal,isProcessing:!k?.vocal,progressWidth:"70%"}),(0,s.jsx)(eN,{label:S("vocalRemover.labels.instrumental"),url:k?.instrumental,isProcessing:!k?.instrumental,progressWidth:"55%"})]}),(0,s.jsx)("div",{className:"mt-6 text-center text-xs text-white/40",children:S("vocalRemover.reminder")}),(0,s.jsx)("div",{className:"mt-2 text-center text-xs text-[#f3c653]",children:S("vocalRemover.costHint")})]}):null]}):(0,s.jsxs)("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[(0,s.jsx)("div",{className:"flex size-12 items-center justify-center rounded-full bg-white/5",children:(0,s.jsx)(m.A,{className:"h-5 w-5 text-gradient-purple"})}),(0,s.jsx)("h3",{className:"mt-4 text-sm font-semibold text-white",children:S("vocalRemover.empty.title")}),(0,s.jsx)("p",{className:"mt-2 max-w-md text-sm text-white/60",children:S("vocalRemover.empty.description")}),(0,s.jsx)("p",{className:"mt-3 text-xs text-white/60",children:S("vocalRemover.empty.creditCost",{credits:(0,j.r)("vocal-separation")})}),(0,s.jsx)(l.Q,{onClick:t,children:(0,s.jsx)(r.$,{className:"mt-4 h-9 rounded-full bg-gradient-gold px-6 text-sm font-semibold text-black/90",children:S("vocalRemover.actions.remove")})})]})}),(0,s.jsx)(i.av,{value:"local-file",className:"mt-0",children:(0,s.jsx)("div",{className:"flex h-full flex-col items-center justify-center text-center",children:"idle"===O||"uploading"===O?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"w-full rounded-[2rem] border border-dashed border-white/15 bg-white/5 px-6 py-12",children:[(0,s.jsx)("p",{className:"mb-3 text-center text-xs text-white/60",children:S("vocalRemover.upload.creditCost",{credits:(0,j.r)("vocal-separation")})}),(0,s.jsx)(l.Q,{onClick:()=>{M||W.current?.click()},children:(0,s.jsx)(r.$,{type:"button",className:"h-9 rounded-full bg-gradient-gold px-6 text-sm font-semibold text-black/90",disabled:M,children:M?S("vocalRemover.upload.uploading"):S("vocalRemover.upload.selectFile")})}),(0,s.jsx)("input",{id:"vocal-upload",type:"file",accept:"audio/*",className:"hidden",ref:W,onChange:async e=>{let t=e.target.files?.[0];if(t&&!M)try{F(!0),P("uploading"),$(""),z(t.name),V(null);let e=URL.createObjectURL(t);K(e);let a=new Audio(e);a.addEventListener("loadedmetadata",()=>{Number.isFinite(a.duration)&&V(a.duration)});let s=new FormData;s.append("file",t),s.append("folder","audio/uploads");let l=await fetch("/api/music/upload",{method:"POST",body:s}),r=await l.json();if(!l.ok||!r.url)throw Error(r.error||S("vocalRemover.errors.uploadFailed"));L(r.url),P("processing"),ee({vocal:"processing",instrumental:"processing",origin:"processing"});let i=await fetch("/api/audio/separate-vocals-upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({uploadUrl:r.url,idempotencyKey:Y.key})}),o=await i.json();if(!i.ok||!o.taskId)throw Error(o.error||S("vocalRemover.errors.startFailed"));X(o.taskId),Y.reset(),(0,f.o)(S("vocalRemover.upload.successToast"))}catch(t){let e=t instanceof Error?t.message:S("vocalRemover.errors.uploadFailed");$(e),P("idle"),f.o.error(e)}finally{F(!1),e.target.value=""}}}),(0,s.jsx)("p",{className:"mt-3 text-sm text-white/50",children:S("vocalRemover.upload.dragHint")})]}),D?(0,s.jsx)("p",{className:"mt-3 text-xs text-red-300",children:D}):null,(0,s.jsxs)("div",{className:"mt-6 text-xs text-white/50",children:[(0,s.jsx)("p",{children:S("vocalRemover.upload.limits")}),(0,s.jsx)("p",{className:"mt-1 text-[#f3c653]",children:S("vocalRemover.upload.costHint")})]})]}):"processing"===O?(0,s.jsxs)("div",{className:"w-full max-w-5xl space-y-6 text-left",children:[(0,s.jsxs)("div",{className:"flex items-center gap-4 text-sm text-[#f3c653]",children:[(0,s.jsx)("button",{type:"button",onClick:eg,className:"flex items-center gap-2 text-white/70 hover:text-white",children:S("vocalRemover.upload.back")}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-[#f3c653] font-semibold",children:H||S("vocalRemover.upload.uploadedAudio")}),(0,s.jsx)("div",{className:"text-xs text-white/50",children:ew(G)})]}),(0,s.jsx)("div",{className:"ml-auto text-xs text-[#f3c653]",children:S("vocalRemover.upload.costHintDetailed")})]}),(0,s.jsxs)("div",{className:"rounded-2xl border border-white/10 bg-white/5 px-6 py-8 text-center",children:[(0,s.jsx)("div",{className:"mx-auto mb-4 h-10 w-10 animate-spin rounded-full border-2 border-white/30 border-t-white"}),(0,s.jsx)("h3",{className:"text-base font-semibold text-white",children:S("vocalRemover.processing.t
1itle")}),(0,s.jsx)("p",{className:"mt-2 text-sm text-white/50",children:S("vocalRemover.processing.subtitle")}),(0,s.jsx)("div",{className:"mt-6 h-2 w-full overflow-hidden rounded-full bg-white/10",children:(0,s.jsx)("div",{className:"h-full rounded-full bg-gradient-to-r from-[#f7d774] via-[#f2b24d] to-[#f7d774] bg-[length:220%_100%] animate-[gradient_2.2s_linear_infinite] transition-all duration-500",style:{width:`${B}%`}})}),(0,s.jsxs)("div",{className:"mt-2 text-xs text-white/50",children:[S("vocalRemover.processing.progress")," ",(0,s.jsxs)("span",{className:"ml-2",children:[B,"%"]})]}),(0,s.jsx)("div",{className:"mt-6 text-xs text-white/40",children:S("vocalRemover.reminder")})]})]}):(0,s.jsxs)("div",{className:"w-full max-w-5xl space-y-6 text-left",children:[(0,s.jsxs)("div",{className:"flex items-center gap-4 text-sm text-white/70",children:[(0,s.jsx)("button",{type:"button",onClick:eg,className:"flex items-center gap-2 text-white/70 hover:text-white",children:S("vocalRemover.upload.back")}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-white font-semibold",children:H||S("vocalRemover.upload.uploadedAudio")}),(0,s.jsx)("div",{className:"text-xs text-white/50",children:ew(G)})]}),(0,s.jsx)("div",{className:"ml-auto text-xs text-[#f3c653]",children:S("vocalRemover.upload.costHintDetailed")})]}),(0,s.jsxs)("div",{className:"rounded-2xl border border-white/10 bg-white/5 p-4 space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("h4",{className:"text-sm font-semibold text-white",children:S("vocalRemover.results.title")}),(0,s.jsx)(r.$,{type:"button",disabled:!ep?.origin&&!T,onClick:async()=>{let e=[{label:S("vocalRemover.labels.origin"),url:ep?.origin||T},{label:S("vocalRemover.labels.vocal"),url:ep?.vocal},{label:S("vocalRemover.labels.instrumental"),url:ep?.instrumental}].filter(e=>"string"==typeof e.url&&e.url.length>0);try{await eR(e)}catch(t){let e=t instanceof Error?t.message:S("vocalRemover.errors.downloadFailed");f.o.error(e)}},className:"h-8 rounded-full bg-gradient-to-r from-sky-400 to-cyan-400 px-4 text-xs font-semibold text-white disabled:opacity-50",children:S("vocalRemover.actions.downloadAll")})]}),[{key:"origin",label:S("vocalRemover.labels.origin")},{key:"vocal",label:S("vocalRemover.labels.vocal")},{key:"instrumental",label:S("vocalRemover.labels.instrumental")}].map(e=>{let t=ep?.[e.key]||("origin"===e.key?T:void 0);return(0,s.jsxs)("div",{className:"rounded-xl border border-white/10 bg-black/20 px-4 py-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between text-xs text-white/60",children:[(0,s.jsx)("span",{className:"text-[#f3c653]",children:e.label}),"success"===Z[e.key]&&t?(0,s.jsx)("a",{href:t,className:"text-gradient-purple underline",download:!0,children:S("vocalRemover.actions.download")}):(0,s.jsx)("span",{className:"text-white/40",children:S("vocalRemover.status.processing")})]}),(0,s.jsx)("div",{className:"mt-2",children:"success"===Z[e.key]&&t?(0,s.jsx)("audio",{controls:!0,preload:"none",className:"w-full h-9",src:t}):(0,s.jsx)("div",{className:"h-2 w-full rounded-full bg-white/10",children:(0,s.jsx)("div",{className:"h-full w-1/2 roun
1ded-full bg-gradient-to-r from-cyan-400 via-sky-400 to-cyan-300"})})})]},e.key)})]}),(0,s.jsx)("div",{className:"text-center text-xs text-white/40",children:S("vocalRemover.reminder")})]})})})]})]})})})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.