import{d as y,O as C,P as T,S as a,U as x,bD as L,j as v}from"./index.3bfa6a0e.js";import{d as M}from"./index.b1671445.js";import O from"./index.8e1bb35b.js";import k from"./index.aba226e7.js";import{m as o,s as q}from"./header.89ef3cfa.js";import{g as w}from"./music.20bd83e9.js";import{a as P,S as A}from"./hooks.435f47d5.js";import"./index.4a8093e5.js";import"./index.0a290e73.js";import"./use-tab-status.c0d730a9.js";import"./index.6bd4dfa5.js";import"./index.e9acc943.js";import"./index.cd00eeaf.js";import"./use-id.7c44c16f.js";import"./use-refs.7efc98f2.js";import"./index.8a87fb9c.js";import"./index.79997a38.js";import"./index.983bfd1a.js";import"./select-subject.0b31a0d6.js";import"./index.c171ade0.js";import"./index.d7aedf5c.js";import"./index.8711ee78.js";import"./index.0fd5538f.js";import"./icon-xin.62588855.js";import"./index.645e7ddc.js";import"./index.52c97b40.js";import"./index.31f02135.js";import"./select-tag.18b080ca.js";import"./index.68aa5658.js";import"./index.fb1da5d0.js";import"./index.926ca9c5.js";import"./index.dab60457.js";import"./index.0090270e.js";import"./icon_uploader.ff962490.js";import"./icon_album.ed729d4a.js";import"./icon_album_active.469423f9.js";import"./icon_exquisite.4b18ad76.js";import"./icon_music_active.1e7b47ef.js";import"./icon-play.bc9e7aab.js";var je=y({name:"MusicSearch",emits:["confirm"],setup(){localStorage.setItem("behaviorId",w());const p=C(),j=T(),d=a(p.query.keyword||""),r=a(p.query.tagids||""),c=a(),R=a(!1),i=M("music-search",[]),m=a("songe"),I=P(A.SEARCH);c.value=I.id;const b=e=>{var t,u;d.value=e;const s=i.value.indexOf(e);s>-1&&i.value.splice(s,1),e&&(i.value.unshift(e),i.value.length=Math.min(i.value.length,5)),(u=(t=(m.value==="album"?n:l).value).onSearch)==null||u.call(t,e)},h=e=>{var t,u;const s=Object.values(e).flat().filter(Boolean).join(",");r.value=s,(u=(t=(m.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=(m.value==="album"?n:l).value).onComfirmSubject)==null||t.call(f,e)},n=a(null),l=a(null),S=e=>{m.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:q.search},[m.value==="album"?v(O,{hideSearch:!0,ref:n,defauleParams:{search:d.value,tagids:r.value,albumTagIds:r.value,subjectIds:c.value}},null):v(k,{hideSearch:!0,ref:l,onItemClick:e=>{j.push({path:"/music-detail",query:{id:e.id,albumId:p.params.id}})},defauleParams:{search:d.value,tagids:r.value,musicTagIds:r.value,subjectIds:c.value}},null)])}});export{je as default};
