import{c as y}from"./index.9eb2b8e9.js";import C from"./index.d8d229d7.js";import T from"./index.b0b6f01c.js";import{m as o,s as x}from"./header.f083b5f2.js";import{d as L,P as M,Q as k,U as a,V as q,bC as w,i as v}from"./index.7994470a.js";import{g as O}from"./music.d2ae34a8.js";import{a as P,S as V}from"./hooks.04c1f931.js";import"./index.6449f9de.js";import"./index.ec643df3.js";import"./use-tab-status.00d7316c.js";import"./index.889feca1.js";import"./index.a28173c9.js";import"./use-id.117b75b2.js";import"./use-refs.ad5f4144.js";import"./index.0f4f72db.js";import"./index.777f4790.js";import"./index.3dd26d27.js";import"./select-subject.cc64fd7c.js";import"./index.0262b810.js";import"./index.b3dca421.js";import"./index.ab866de2.js";import"./index.2fbdc579.js";import"./icon-xin.df8ab2d7.js";import"./select-tag.e373e423.js";import"./index.29eb1675.js";import"./index.c9af17c2.js";import"./index.926ca9c5.js";import"./index.2e766b01.js";import"./index.module.7b815a85.js";import"./index.f99f2504.js";import"./icon_uploader.9f387137.js";import"./icon_album.fa329df6.js";import"./icon_album_active.ce98b2a8.js";import"./icon_exquisite.69e33c80.js";import"./icon_music_active.3b316ab8.js";import"./icon-play.bc9e7aab.js";import"./index.c5bf3ab5.js";import"./index.0a2aeb2c.js";import"./use-height.ffa5a0f3.js";import"./index.570461cd.js";var Re=L({name:"MusicSearch",emits:["confirm"],setup(){localStorage.setItem("behaviorId",O());const f=M(),j=k(),d=a(f.query.keyword||""),i=a(f.query.tagids||""),c=a(),R=a(!1),r=y("music-search",[]),m=a("songe"),I=P(V.SEARCH);c.value=I.id;const b=e=>{var t,u;d.value=e;const s=r.value.indexOf(e);s>-1&&r.value.splice(s,1),e&&(r.value.unshift(e),r.value.length=Math.min(r.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(",");i.value=s,(u=(t=(m.value==="album"?n:l).value).onComfirm)==null||u.call(t,e),R.value=!1},g=e=>{var p,t;c.value=e.id,(t=(p=(m.value==="album"?n:l).value).onComfirmSubject)==null||t.call(p,e)},n=a(null),l=a(null),S=e=>{m.value=e};return q(()=>{o.on("changeTab",S),o.on("search",b),o.on("confirm",h),o.on("confirmSubject",g)}),w(()=>{o.off("changeTab",S),o.off("search",b),o.off("confirm",h),o.off("confirmSubject",g)}),()=>v("div",{class:x.search},[m.value==="album"?v(C,{hideSearch:!0,ref:n,defauleParams:{search:d.value,tagids:i.value,albumTagIds:i.value,subjectIds:c.value}},null):v(T,{hideSearch:!0,ref:l,onItemClick:e=>{j.push({path:"/music-detail",query:{id:e.id,albumId:f.params.id}})},defauleParams:{search:d.value,tagids:i.value,musicTagIds:i.value,subjectIds:c.value}},null)])}});export{Re as default};
