;(function(){function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}var __vite_style__=document.createElement('style');__vite_style__.innerHTML="._search_x5fbt_1{--van-cell-background-color: transparent;--van-cell-font-size: .42667rem;--van-cell-text-color: #333;--van-cell-value-color: #999;--van-cell-icon-size: .26667rem;--base-bg: #f6f8f9}._search_x5fbt_1 ._sticky_x5fbt_9 .van-sticky--fixed{box-shadow:.26667rem .26667rem .26667rem var(--box-shadow-color)}._search_x5fbt_1 ._sticky_x5fbt_9>div{background-color:var(--base-bg)}._search_x5fbt_1 ._title_x5fbt_15{padding-top:.42667rem}._search_x5fbt_1 ._title_x5fbt_15 .van-cell__value{font-size:.32rem}._search_x5fbt_1 ._keywords_x5fbt_21{margin-top:.26667rem;padding:0 .37333rem .26667rem;display:flex;align-items:center}._search_x5fbt_1 ._keywords_x5fbt_21 ._content_x5fbt_28::-webkit-scrollbar{display:none}._search_x5fbt_1 ._keywords_x5fbt_21 ._content_x5fbt_28{flex:1;overflow:hidden;overflow-x:auto;display:flex}._search_x5fbt_1 ._keywords_x5fbt_21 ._content_x5fbt_28 ._searchKeyword_x5fbt_38{--van-tag-default-color: white;--van-tag-text-color: #333;font-size:.37333rem;padding:.10667rem .26667rem;margin-right:.13333rem;word-break:keep-all}._search_x5fbt_1 ._keywords_x5fbt_21 ._remove_x5fbt_46{font-size:.42667rem}\n";document.head.appendChild(__vite_style__);System.register(['./vendor-legacy.031e1374.js','./index-legacy.f25f109a5.js','./index-legacy.f25f109a10.js','./index-legacy.637f35562.js','./index-legacy.637f35563.js','./index-legacy.edec5e29.js','./index-legacy.104980d7.js','./index-legacy.6e10cd37.js','./select-tag-legacy.8087e2bf.js','./music-legacy.9bfa98dd.js'],function(exports){'use strict';var defineComponent,ref,useRouter,useRoute,onBeforeRouteUpdate,watch,onMounted,createVNode,Sticky,Tabs,Tab,Tag,isVNode,Icon,RouterView,Popup,ColSearch,useLocalStorage,classNames,SelectTag,getRandomKey;return{setters:[function(module){defineComponent=module.d;ref=module.V;useRouter=module.a2;useRoute=module._;onBeforeRouteUpdate=module.a3;watch=module.U;onMounted=module.a4;createVNode=module.a;Sticky=module.S;Tabs=module.G;Tab=module.H;Tag=module.z;isVNode=module.x;Icon=module.u;RouterView=module.R;Popup=module.P;},function(){},function(){},function(){},function(){},function(module){ColSearch=module.C;},function(module){useLocalStorage=module.c;},function(module){classNames=module.c;},function(module){SelectTag=module.S;},function(module){getRandomKey=module.g;}],execute:function execute(){var _Object$freeze;function mitt(n){return{all:n=n||new Map(),on:function on(t,e){var i=n.get(t);i?i.push(e):n.set(t,[e]);},off:function off(t,e){var i=n.get(t);i&&(e?i.splice(i.indexOf(e)>>>0,1):n.set(t,[]));},emit:function emit(t,e){var i=n.get(t);i&&i.slice().map(function(n){n(e);}),(i=n.get("*"))&&i.slice().map(function(n){n(t,e);});}};}var search="_search_x5fbt_1";var sticky="_sticky_x5fbt_9";var title="_title_x5fbt_15";var keywords="_keywords_x5fbt_21";var content="_content_x5fbt_28";var searchKeyword="_searchKeyword_x5fbt_38";var remove="_remove_x5fbt_46";var styles=exports('s',{search:search,sticky:sticky,title:title,keywords:keywords,content:content,searchKeyword:searchKeyword,remove:remove});function _isSlot(s){return typeof s==='function'||Object.prototype.toString.call(s)==='[object Object]'&&!isVNode(s);}var mitter=exports('m',mitt());var selectTagRef=ref();var header=defineComponent({name:'MusicSearchHeader',setup:function setup(){var searchInputRef=ref();localStorage.setItem('behaviorId',getRandomKey());var router=useRouter();var route=useRoute();ref(false);var keyword=ref('');var tagids=ref('');ref([]);ref([]);var tagVisibility=ref(false);var words=useLocalStorage('music-search',[]);var activeTab=ref('songe');onBeforeRouteUpdate(function(){// console.log('onBeforeRouteUpdate', route.fullPath)
if(route.path==='/music-songbook/search'){keyword.value='';tagids.value='';activeTab.value='songe';// console.log('onBeforeRouteUpdate')
try{var _selectTagRef$value,_selectTagRef$value$r;(_selectTagRef$value=selectTagRef.value)===null||_selectTagRef$value===void 0?void 0:(_selectTagRef$value$r=_selectTagRef$value.resetTags)===null||_selectTagRef$value$r===void 0?void 0:_selectTagRef$value$r.call(_selectTagRef$value);}catch(error){console.log(error);}}return true;});watch(activeTab,function(val){mitter.emit('changeTab',val);});var onSearch=function onSearch(val){keyword.value=val;var indexOf=words.value.indexOf(val);if(indexOf>-1){words.value.splice(indexOf,1);}if(val){words.value.unshift(val);words.value.length=Math.min(words.value.length,5);}mitter.emit('search',val);// const activeRef = activeTab.value === 'album' ? albumList : musicList
// ;(activeRef.value as any).onSearch?.(val)
// FetchList()
};var onComfirm=function onComfirm(tags){var name=arguments.length>1&&arguments[1]!==undefined?arguments[1]:'';var data=Object.values(tags).flat().filter(Boolean).join(',');tagids.value=data;mitter.emit('confirm',tags);// FetchList()
// const activeRef = activeTab.value === 'album' ? albumList : musicList
// ;(activeRef.value as any).onComfirm?.(tags)
tagVisibility.value=false;};// const albumList = ref(null)
// const musicList = ref(null)
onMounted(function(){// const activeRef = activeTab.value === 'album' ? albumList : musicList
// ;(activeRef.value as any).onSearch?.('')
// console.log(searchInputRef.value)
});return function(){return createVNode("div",{"class":styles.search},[createVNode(Sticky,{"class":styles.sticky},{default:function _default(){return[createVNode(ColSearch,{"modelValue":keyword.value,"showAction":true,"ref":searchInputRef,"onSearch":onSearch,"onFilter":function onFilter(){return tagVisibility.value=true;},"filterDot":!!tagids.value,"onClick":function onClick(){if(route.path==='/music-songbook'){router.push({path:'/music-songbook/search'});}}},null),route.path==='/music-songbook/search'&&createVNode(Tabs,{"color":"var(--van-primary)","background":"transparent","lineWidth":20,"shrink":true,"active":activeTab.value,"onUpdate:active":function onUpdateActive($event){return activeTab.value=$event;},"onChange":function onChange(val){return activeTab.value=val;}},{default:function _default(){return[createVNode(Tab,{"title":"单曲","name":"songe"},null),createVNode(Tab,{"title":"专辑","name":"album"},null)];}})];}}),words.value.length>0&&route.path==='/music-songbook/search'&&createVNode("div",{"class":classNames(styles.keywords,'van-hairline--bottom')},[createVNode("div",{"class":styles.content},[words.value.map(function(item){return createVNode(Tag,{"round":true,"class":styles.searchKeyword,"key":item,"onClick":function onClick(){return onSearch(item);}},_isSlot(item)?item:{default:function _default(){return[item];}});})]),createVNode(Icon,{"class":styles.remove,"name":"delete-o","onClick":function onClick(){return words.value=[];}},null)]),createVNode(RouterView,null,null),createVNode(Popup,{"show":tagVisibility.value,"round":true,"closeable":true,"position":"bottom","style":{height:'60%'},"teleport":"body","onUpdate:show":function onUpdateShow(val){return tagVisibility.value=val;}},{default:function _default(){return[createVNode(SelectTag,{"ref":selectTagRef,"onConfirm":onComfirm,"onCancel":function onCancel(){}},null)];}})]);};}});var header$1=/*#__PURE__*/Object.freeze((_Object$freeze={__proto__:null},_defineProperty(_Object$freeze,Symbol.toStringTag,'Module'),_defineProperty(_Object$freeze,"mitter",mitter),_defineProperty(_Object$freeze,'default',header),_Object$freeze));exports('h',header$1);}};});})();
