import{c as g}from"./index.28b40a59.js";import y from"./index.7579549f.js";import S from"./index.442697d0.js";import{m as o,s as R}from"./header.e751f3ca.js";import{d as C,V as a,_ as L,a2 as M,a4 as T,a5 as I,a as l}from"./vendor.a0144ce9.js";import{g as k,m as q}from"./music.21b5a533.js";/* empty css               *//* empty css               */import"./index.ccfa57ee.js";/* empty css               *//* empty css               */import"./index.3d95a92c.js";import"./item.86e13af7.js";/* empty css               */import"./footer.b1c4a2d9.js";import"./favorite.9bdf4305.js";import"./select-tag.a1caf9cf.js";/* empty css                *//* empty css                *//* empty css                */import"./index.926ca9c5.js";import"./item.e115375c.js";import"./init-user-icon.d5c3c464.js";import"./index.module.64874bae.js";import"./orderStatus.243cb96a.js";import"./index.339fc024.js";/* empty css               *//* empty css               */var ie=C({name:"MusicSearch",emits:["confirm"],setup(){a(),localStorage.setItem("behaviorId",k());const f=L(),x=M();a(!1);const c=a(f.query.keyword||""),m=a(f.query.tagids||"");a([]),a([]);const b=a(!1),t=g("music-search",[]),n=a("songe"),p=e=>{var i,r;c.value=e;const s=t.value.indexOf(e);s>-1&&t.value.splice(s,1),e&&(t.value.unshift(e),t.value.length=Math.min(t.value.length,5));const v=n.value==="album"?u:d;console.log(e),(r=(i=v.value).onSearch)==null||r.call(i,e)},j=e=>{var i,r;const s=Object.values(e).flat().filter(Boolean).join(",");m.value=s,(r=(i=(n.value==="album"?u:d).value).onComfirm)==null||r.call(i,e),b.value=!1},u=a(null),d=a(null),h=e=>{n.value=e};return T(()=>{o.on("changeTab",h),o.on("search",p),o.on("confirm",j)}),I(()=>{o.off("changeTab",h),o.off("search",p),o.off("confirm",j)}),()=>l("div",{class:R.search},[n.value==="album"?l(y,{hideSearch:!0,ref:u,defauleParams:{search:c.value,tagids:m.value}},null):l(S,{hideSearch:!0,ref:d,onItemClick:e=>{q(e,s=>{x.push({path:s,query:{orderType:"MUSIC"}})})},defauleParams:{search:c.value,tagids:m.value}},null)])}});export{ie as default};
