import{d as y,P as C,Q as T,U as a,V as x,bi as L,j as v}from"./ResizeObserver.es.45df6c0f.js";import{d as M}from"./index.f6378dda.js";import k from"./index.6311abe3.js";import q from"./index.302d0597.js";import{m as o,s as w}from"./header.9407b720.js";import{g as O}from"./music.9d852d08.js";import{a as P,S as V}from"./hooks.d8170117.js";import"./index.3c3f214d.js";import"./use-tab-status.b9a2b892.js";import"./index.41214d91.js";import"./index.ba862406.js";import"./index.cbe24982.js";import"./use-id.41c465c4.js";import"./use-refs.4c6f1efb.js";import"./index.ec19e463.js";import"./index.5034ef43.js";import"./index.0acff0f0.js";import"./select-subject.3b743568.js";import"./index.b5f25372.js";import"./index.8d3bde74.js";import"./index.73914520.js";import"./index.e11fdb7d.js";import"./icon-xin.a59bfaf1.js";import"./index.1a59558b.js";import"./index.d1be830c.js";import"./index.fa590efe.js";import"./select-tag.c7bfe3e6.js";import"./index.483575b2.js";import"./index.d6257742.js";import"./index.926ca9c5.js";import"./index.41072e13.js";import"./index.264de4ca.js";import"./icon_uploader.93248775.js";import"./icon_album.9592f49b.js";import"./icon_album_active.25be6148.js";import"./icon_exquisite.858d352b.js";import"./icon_music_active.a468d335.js";import"./icon-play.bc9e7aab.js";var Se=y({name:"MusicSearch",emits:["confirm"],setup(){localStorage.setItem("behaviorId",O());const p=C(),j=T(),d=a(p.query.keyword||""),i=a(p.query.tagids||""),c=a(),R=a(!1),r=M("music-search",[]),s=a("songe"),I=P(V.SEARCH);c.value=I.id;const b=e=>{var t,u;d.value=e;const m=r.value.indexOf(e);m>-1&&r.value.splice(m,1),e&&(r.value.unshift(e),r.value.length=Math.min(r.value.length,5)),(u=(t=(s.value==="album"?n:l).value).onSearch)==null||u.call(t,e)},h=e=>{var t,u;const m=Object.values(e).flat().filter(Boolean).join(",");i.value=m,(u=(t=(s.value==="album"?n:l).value).onComfirm)==null||u.call(t,e),R.value=!1},g=e=>{var f,t;c.value=e.id,(t=(f=(s.value==="album"?n:l).value).onComfirmSubject)==null||t.call(f,e)},n=a(null),l=a(null),S=e=>{s.value=e};return x(()=>{o.on("changeTab",S),o.on("search",b),o.on("confirm",h),o.on("confirmSubject",g)}),L(()=>{o.off("changeTab",S),o.off("search",b),o.off("confirm",h),o.off("confirmSubject",g)}),()=>v("div",{class:w.search},[s.value==="album"?v(k,{hideSearch:!0,ref:n,defauleParams:{search:d.value,tagids:i.value,albumTagIds:i.value,subjectIds:c.value}},null):v(q,{hideSearch:!0,ref:l,onItemClick:e=>{j.push({path:"/music-detail",query:{id:e.id,albumId:p.params.id}})},defauleParams:{search:d.value,tagids:i.value,musicTagIds:i.value,subjectIds:c.value}},null)])}});export{Se as default};
