import{d as e,r as a,c as s,w as l,i as t,b as u,e as c,Y as f,m as n,h as o,S as r,j as d,F as i,k as _,n as m,f as v,t as h,g as p,p as b}from"./index-Co9nPWLO.js";import{u as k}from"./audio.DwsFIuQc.js";import{_ as y}from"./_plugin-vue_export-helper.BCo6x5W8.js";const g=y(e({__name:"index",setup(e){k();const y=a(""),g=a([]),x=a(!1),C={cherry:["#667eea","#764ba2"],ethan:["#f093fb","#f5576c"],serena:["#4facfe","#00f2fe"],chelsie:["#43e97b","#38f9d7"],momo:["#fa709a","#fee140"],vivian:["#a8edea","#fed6e3"],moon:["#5ee7df","#b490ca"],maia:["#d299c2","#fef9d7"],kai:["#89f7fe","#66a6ff"],nofish:["#cd9cf2","#f6f3ff"]};function j(e){const a=C[e]||["#667eea","#764ba2"];return`linear-gradient(135deg, ${a[0]} 0%, ${a[1]} 100%)`}async function w(){if(y.value.trim()){x.value=!0;try{const e=await p("/search",{q:y.value});g.value=e||[]}catch(e){console.error("搜索失败:",e),g.value=[]}}}return(e,a)=>{const p=f,k=n,C=t,V=v,$=r;return u(),s(C,{class:"page"},{default:l(()=>[c(C,{class:"search-bar"},{default:l(()=>[c(p,{modelValue:y.value,"onUpdate:modelValue":a[0]||(a[0]=e=>y.value=e),class:"search-input",placeholder:"搜索音频...",onConfirm:w},null,8,["modelValue"]),c(k,{class:"search-btn",onClick:w},{default:l(()=>[o("搜索")]),_:1})]),_:1}),g.value.length>0?(u(),s($,{key:0,"scroll-y":"",class:"results"},{default:l(()=>[c(C,{class:"result-list"},{default:l(()=>[(u(!0),d(i,null,_(g.value,e=>(u(),s(C,{key:e.id,class:"result-item",onClick:a=>function(e){b({url:`/pages/album/index?id=${e.id}`})}(e)},{default:l(()=>[c(C,{class:"result-cover",style:m({background:j(e.voiceId)})},{default:l(()=>[c(V,{class:"cover-icon"},{default:l(()=>[o("🎵")]),_:1})]),_:2},1032,["style"]),c(C,{class:"result-info"},{default:l(()=>[c(V,{class:"result-title"},{default:l(()=>[o(h(e.title),1)]),_:2},1024),c(V,{class:"result-meta"},{default:l(()=>[o(h(e.wordCount||0)+"字",1)]),_:2},1024)]),_:2},1024)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1})):x.value&&0===g.value.length?(u(),s(C,{key:1,class:"no-result"},{default:l(()=>[c(V,{class:"no-result-icon"},{default:l(()=>[o("🔍")]),_:1}),c(V,{class:"no-result-text"},{default:l(()=>[o("未找到相关音频")]),_:1})]),_:1})):(u(),s(C,{key:2,class:"initial-state"},{default:l(()=>[c(V,{class:"hint-text"},{default:l(()=>[o("输入关键词搜索音频")]),_:1})]),_:1}))]),_:1})}}}),[["__scopeId","data-v-dba24a7e"]]);export{g as default};
