import{v as H,d as _,c as n,j as A,s as Be,q as Pe,m as pe,n as J,r as m,U as Re,y as O,z as De,a2 as Ne,w as F,J as M,o as ce,a3 as le,B as ue,b as $,S as re,e as de,u as Y,a as fe}from"./index.3718c0a8.js";import{c as Q,n as B,t as ge,v as z,q as $e,D as qe,I as P,w as X,O as Fe,k as Oe,m as p,b as ze,Q as He,h as Ue,f as he,R as We,z as G,S as je}from"./index.2b675c4f.js";import{B as Ke,T as Ge}from"./index.e03f08ff.js";import{I as Je}from"./logo-1.1c5bc018.js";import{I as Ye}from"./icon-search.f54aed7d.js";import{u as me,T as Qe,a as ie}from"./index.1c8a9e51.js";import{T as Xe,H as Ze}from"./index.9600f46d.js";import{H as et}from"./index.395fb153.js";import{r as Z}from"./request.a45d1be5.js";import"./index.7077e759.js";import{L as be}from"./index.3536719e.js";import{T as tt}from"./index.87de90a8.js";import"./use-tab-status.a6d8936e.js";import"./index.ef83260a.js";import"./vue3-lottie.es.e34f7e89.js";import"./utils.e748d7c8.js";const[at,E]=Q("cell"),ve={icon:String,size:String,title:B,value:B,label:B,center:Boolean,isLink:Boolean,border:ge,required:Boolean,iconPrefix:String,valueClass:z,labelClass:z,titleClass:z,titleStyle:null,arrowDirection:String,clickable:{type:Boolean,default:null}},nt=H({},ve,$e);var lt=_({name:at,props:nt,setup(e,{slots:a}){const l=qe(),o=()=>{if(a.label||A(e.label))return n("div",{class:[E("label"),e.labelClass]},[a.label?a.label():e.label])},r=()=>{if(a.title||A(e.title))return n("div",{class:[E("title"),e.titleClass],style:e.titleStyle},[a.title?a.title():n("span",null,[e.title]),o()])},s=()=>{const u=a.value||a.default;if(u||A(e.value)){const y=a.title||A(e.title);return n("div",{class:[E("value",{alone:!y}),e.valueClass]},[u?u():n("span",null,[e.value])])}},h=()=>{if(a.icon)return a.icon();if(e.icon)return n(P,{name:e.icon,class:E("left-icon"),classPrefix:e.iconPrefix},null)},i=()=>{if(a["right-icon"])return a["right-icon"]();if(e.isLink){const u=e.arrowDirection?`arrow-${e.arrowDirection}`:"arrow";return n(P,{name:u,class:E("right-icon")},null)}};return()=>{var u,f;const{size:y,center:I,border:R,isLink:C,required:L}=e,w=(u=e.clickable)!=null?u:C,S={center:I,required:L,clickable:w,borderless:!R};return y&&(S[y]=!!y),n("div",{class:E(S),role:w?"button":void 0,tabindex:w?0:void 0,onClick:l},[h(),r(),s(),i(),(f=a.extra)==null?void 0:f.call(a)])}}});const rt=X(lt);function it(e){return Array.isArray(e)?!e.length:e===0?!1:!e}function ot(e,a){return!(a.required&&it(e)||a.pattern&&!a.pattern.test(String(e)))}function st(e,a){return new Promise(l=>{const o=a.validator(e,a);if(Be(o)){o.then(l);return}l(o)})}function oe(e,a){const{message:l}=a;return Pe(l)?l(e,a):l||""}function ct({target:e}){e.composing=!0}function se({target:e}){e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}function ut(e,a){const l=Fe();e.style.height="auto";let o=e.scrollHeight;if(pe(a)){const{maxHeight:r,minHeight:s}=a;r!==void 0&&(o=Math.min(o,r)),s!==void 0&&(o=Math.max(o,s))}o&&(e.style.height=`${o}px`,Oe(l))}function dt(e){return e==="number"?{type:"text",inputmode:"decimal"}:e==="digit"?{type:"tel",inputmode:"numeric"}:{type:e}}function K(e){return[...e].length}function ft(e,a){return[...e].slice(0,a).join("")}const[gt,v]=Q("field"),ee={id:String,name:String,leftIcon:String,rightIcon:String,autofocus:Boolean,clearable:Boolean,maxlength:B,formatter:Function,clearIcon:p("clear"),modelValue:ze(""),inputAlign:String,placeholder:String,autocomplete:String,errorMessage:String,enterkeyhint:String,clearTrigger:p("focus"),formatTrigger:p("onChange"),error:{type:Boolean,default:null},disabled:{type:Boolean,default:null},readonly:{type:Boolean,default:null}},ht=H({},ve,ee,{rows:B,type:p("text"),rules:Array,autosize:[Boolean,Object],labelWidth:B,labelClass:z,labelAlign:String,showWordLimit:Boolean,errorMessageAlign:String,colon:{type:Boolean,default:null}});var mt=_({name:gt,props:ht,emits:["blur","focus","clear","keypress","click-input","end-validate","start-validate","click-left-icon","click-right-icon","update:modelValue"],setup(e,{emit:a,slots:l}){const o=me(),r=J({status:"unvalidated",focused:!1,validateMessage:""}),s=m(),h=m(),{parent:i}=Re(He),u=()=>{var t;return String((t=e.modelValue)!=null?t:"")},f=t=>{if(A(e[t]))return e[t];if(i&&A(i.props[t]))return i.props[t]},y=O(()=>{const t=f("readonly");if(e.clearable&&!t){const d=u()!=="",g=e.clearTrigger==="always"||e.clearTrigger==="focus"&&r.focused;return d&&g}return!1}),I=O(()=>h.value&&l.input?h.value():e.modelValue),R=t=>t.reduce((d,g)=>d.then(()=>{if(r.status==="failed")return;let{value:b}=I;if(g.formatter&&(b=g.formatter(b,g)),!ot(b,g)){r.status="failed",r.validateMessage=oe(b,g);return}if(g.validator)return st(b,g).then(T=>{T&&typeof T=="string"?(r.status="failed",r.validateMessage=T):T===!1&&(r.status="failed",r.validateMessage=oe(b,g))})}),Promise.resolve()),C=()=>{r.status="unvalidated",r.validateMessage=""},L=()=>a("end-validate",{status:r.status}),w=(t=e.rules)=>new Promise(d=>{C(),t?(a("start-validate"),R(t).then(()=>{r.status==="failed"?(d({name:e.name,message:r.validateMessage}),L()):(r.status="passed",d(),L())})):d()}),S=t=>{if(i&&e.rules){const{validateTrigger:d}=i.props,g=le(d).includes(t),b=e.rules.filter(T=>T.trigger?le(T.trigger).includes(t):g);b.length&&w(b)}},U=t=>{const{maxlength:d}=e;if(A(d)&&K(t)>d){const g=u();return g&&K(g)===+d?g:ft(t,+d)}return t},V=(t,d="onChange")=>{if(t=U(t),e.type==="number"||e.type==="digit"){const g=e.type==="number";t=We(t,g,g)}e.formatter&&d===e.formatTrigger&&(t=e.formatter(t)),s.value&&s.value.value!==t&&(s.value.value=t),t!==e.modelValue&&a("update:modelValue",t)},W=t=>{t.target.composing||V(t.target.value)},D=()=>{var t;return(t=s.value)==null?void 0:t.blur()},c=()=>{var t;return(t=s.value)==null?void 0:t.focus()},x=()=>{const t=s.value;e.type==="textarea"&&e.autosize&&t&&ut(t,e.autosize)},j=t=>{r.focused=!0,a("focus",t),M(x),f("readonly")&&D()},ye=t=>{f("readonly")||(r.focused=!1,V(u(),"onBlur"),a("blur",t),S("onBlur"),M(x),je())},te=t=>a("click-input",t),ke=t=>a("click-left-icon",t),Ce=t=>a("click-right-icon",t),we=t=>{G(t),a("update:modelValue",""),a("clear",t)},ae=O(()=>{if(typeof e.error=="boolean")return e.error;if(i&&i.props.showError&&r.status==="failed")return!0}),Se=O(()=>{const t=f("labelWidth");if(t)return{width:Ue(t)}}),_e=t=>{t.keyCode===13&&(!(i&&i.props.submitOnEnter)&&e.type!=="textarea"&&G(t),e.type==="search"&&D()),a("keypress",t)},ne=()=>e.id||`${o}-input`,xe=()=>r.status,Te=()=>{const t=v("control",[f("inputAlign"),{error:ae.value,custom:!!l.input,"min-height":e.type==="textarea"&&!e.autosize}]);if(l.input)return n("div",{class:t,onClick:te},[l.input()]);const d={id:ne(),ref:s,name:e.name,rows:e.rows!==void 0?+e.rows:void 0,class:t,disabled:f("disabled"),readonly:f("readonly"),autofocus:e.autofocus,placeholder:e.placeholder,autocomplete:e.autocomplete,enterkeyhint:e.enterkeyhint,"aria-labelledby":e.label?`${o}-label`:void 0,onBlur:ye,onFocus:j,onInput:W,onClick:te,onChange:se,onKeypress:_e,onCompositionend:se,onCompositionstart:ct};return e.type==="textarea"?n("textarea",d,null):n("input",ue(dt(e.type),d),null)},Ae=()=>{const t=l["left-icon"];if(e.leftIcon||t)return n("div",{class:v("left-icon"),onClick:ke},[t?t():n(P,{name:e.leftIcon,classPrefix:e.iconPrefix},null)])},Ie=()=>{const t=l["right-icon"];if(e.rightIcon||t)return n("div",{class:v("right-icon"),onClick:Ce},[t?t():n(P,{name:e.rightIcon,classPrefix:e.iconPrefix},null)])},Le=()=>{if(e.showWordLimit&&e.maxlength){const t=K(u());return n("div",{class:v("word-limit")},[n("span",{class:v("word-num")},[t]),$("/"),e.maxlength])}},Ve=()=>{if(i&&i.props.showErrorMessage===!1)return;const t=e.errorMessage||r.validateMessage;if(t){const d=l["error-message"],g=f("errorMessageAlign");return n("div",{class:v("error-message",g)},[d?d({message:t}):t])}},Ee=()=>{const t=f("colon")?":":"";if(l.label)return[l.label(),t];if(e.label)return n("label",{id:`${o}-label`,for:ne()},[e.label+t])},Me=()=>[n("div",{class:v("body")},[Te(),y.value&&n(P,{name:e.clearIcon,class:v("clear"),onTouchstart:we},null),Ie(),l.button&&n("div",{class:v("button")},[l.button()])]),Le(),Ve()];return he({blur:D,focus:c,validate:w,formValue:I,resetValidation:C,getValidationStatus:xe}),De(Ne,{customValue:h,resetValidation:C,validateWithTrigger:S}),F(()=>e.modelValue,()=>{V(u()),C(),S("onChange"),M(x)}),ce(()=>{V(u(),e.formatTrigger),M(x)}),()=>{const t=f("disabled"),d=f("labelAlign"),g=Ee(),b=Ae();return n(rt,{size:e.size,icon:e.leftIcon,class:v({error:ae.value,disabled:t,[`label-${d}`]:d}),center:e.center,border:e.border,isLink:e.isLink,clickable:e.clickable,titleStyle:Se.value,valueClass:v("value"),titleClass:[v("label",[d,{required:e.required}]),e.labelClass],arrowDirection:e.arrowDirection},{icon:b?()=>b:null,title:g?()=>g:null,value:Me,extra:l.extra})}}});const bt=X(mt),[vt,N,yt]=Q("search"),kt=H({},ee,{label:String,shape:p("square"),leftIcon:p("search"),clearable:ge,actionText:String,background:String,showAction:Boolean});var Ct=_({name:vt,props:kt,emits:["blur","focus","clear","search","cancel","click-input","click-left-icon","click-right-icon","update:modelValue"],setup(e,{emit:a,slots:l,attrs:o}){const r=me(),s=m(),h=()=>{l.action||(a("update:modelValue",""),a("cancel"))},i=c=>{c.keyCode===13&&(G(c),a("search",e.modelValue))},u=()=>e.id||`${r}-input`,f=()=>{if(l.label||e.label)return n("label",{class:N("label"),for:u()},[l.label?l.label():e.label])},y=()=>{if(e.showAction){const c=e.actionText||yt("cancel");return n("div",{class:N("action"),role:"button",tabindex:0,onClick:h},[l.action?l.action():c])}},I=()=>{var c;return(c=s.value)==null?void 0:c.blur()},R=()=>{var c;return(c=s.value)==null?void 0:c.focus()},C=c=>a("blur",c),L=c=>a("focus",c),w=c=>a("clear",c),S=c=>a("click-input",c),U=c=>a("click-left-icon",c),V=c=>a("click-right-icon",c),W=Object.keys(ee),D=()=>{const c=H({},o,re(e,W),{id:u()}),x=j=>a("update:modelValue",j);return n(bt,ue({ref:s,type:"search",class:N("field"),border:!1,onBlur:C,onFocus:L,onClear:w,onKeypress:i,"onClick-input":S,"onClick-left-icon":U,"onClick-right-icon":V,"onUpdate:modelValue":x},c),re(l,["left-icon","right-icon"]))};return he({focus:R,blur:I}),()=>{var c;return n("div",{class:N({"show-action":e.showAction}),style:{background:e.background}},[(c=l.left)==null?void 0:c.call(l),n("div",{class:N("content",e.shape)},[f(),D()]),y()])}}});const wt=X(Ct),St="_search_167tt_1",_t="_fixed_167tt_1",xt="_top_167tt_6",Tt="_topBtn_167tt_22",At="_tagContent_167tt_30",It="_tagLeft_167tt_34",Lt="_tags_167tt_39",Vt="_searchContianer_167tt_50",k={search:St,fixed:_t,top:xt,topBtn:Tt,tagContent:At,tagLeft:It,tags:Lt,searchContianer:Vt};const Et="_theSearch_14hx5_1",Mt={theSearch:Et},Bt=_({name:"TheSearch",props:{keyword:{type:String,default:""}},emits:["search","blur","back"],setup(e,{emit:a}){const l=m(e.keyword);F(()=>e.keyword,r=>{l.value=r});const o={"left-icon":()=>n(P,{name:Ye,size:20},null),action:()=>n("div",{style:{color:"var(--van-primary-color)"},onClick:()=>a("back")},[$("\u8FD4\u56DE")])};return()=>n("div",{class:Mt.theSearch},[n(wt,{shape:"round","show-action":!0,modelValue:l.value,"onUpdate:modelValue":r=>l.value=r,placeholder:"\u641C\u7D22\u4F60\u60F3\u7EC3\u4E60\u7684\u66F2\u8C31\u548C\u4E13\u8F91",onSearch:r=>a("search",r),onClear:()=>a("search",""),onBlur:()=>a("blur",l.value)},o)])}}),Pt="_searchList_141ai_1",pt="_container_141ai_10",Rt="_searchAlbum_141ai_13",Dt="_searchMusic_141ai_16",q={searchList:Pt,container:pt,searchAlbum:Rt,searchMusic:Dt},Nt=_({name:"searchAlbum",setup(){const e=Y(),a=fe();F(e,()=>{i.page=1,i.idAndName=e.query.search||"",r.value=!1,s.value="\u6682\u65E0\u6570\u636E",h.value=[]});const[l,o]=de(!1),r=m(!1),s=m("\u6682\u65E0\u6570\u636E"),h=m([]),i=J({albumStatus:1,page:1,rows:33,idAndName:e.query.search||""}),u=async()=>{if(!l.value){o(!0);try{const f=await Z.post("/api-website/open/music/album/list",{data:i});f.data&&Array.isArray(f.data.rows)&&(h.value=[].concat(h.value,f.data.rows),i.page++,f.data.rows.length||(r.value=!0,s.value=f.data.pageNo==1?"\u6682\u65E0\u6570\u636E":"\u6CA1\u6709\u66F4\u591A\u4E86"))}catch{}M(()=>{o(!1)})}};return()=>n("div",{class:q.searchAlbum},[n(be,{loading:l.value,finished:r.value,finishedText:s.value,onLoad:()=>u()},{default:()=>[n(Xe,{list:h.value,onGoto:f=>a.push({path:"/musicAlum",query:{id:f.id}})},null)]})])}}),$t=_({name:"searchMusic",setup(){const e=Y();F(e,()=>{s.page=1,s.idAndName=e.query.search||"",o.value=!1,r.value="\u6682\u65E0\u6570\u636E",h.value=[],i()});const[a,l]=de(!1),o=m(!1),r=m("\u6682\u65E0\u6570\u636E"),s=J({albumStatus:"PASS",page:1,rows:20,state:1,idAndName:e.query.search||""}),h=m([]),i=async()=>{if(!a.value){l(!0);try{const{data:u}=await Z.post("/api-website/open/music/sheet/list",{data:s});u&&Array.isArray(u.rows)&&(h.value=[].concat(h.value,u.rows),s.page++,u.rows.length||(o.value=!0,r.value=u.pageNo==1?"\u6682\u65E0\u6570\u636E":"\u6CA1\u6709\u66F4\u591A\u4E86"))}catch{}M(()=>{l(!1)})}};return()=>n("div",{class:q.searchMusic},[n(be,{loading:a.value,finished:o.value,finishedText:r.value,onLoad:()=>i()},{default:()=>[n(tt,{list:h.value},null)]})])}}),qt=_({name:"searchList",setup(e,a){const l=m("album");return()=>n("div",{class:q.searchList},[n(Qe,{shrink:!0,active:l.value,"onUpdate:active":o=>l.value=o,color:"var(--van-primary-color)","line-width":"26px",swipeable:!0,animated:!0},{default:()=>[n(ie,{title:"\u4E13\u8F91",name:"album"},{default:()=>[n("div",{class:q.container},[n(Nt,null,null)])]}),n(ie,{title:"\u66F2\u76EE",name:"music"},{default:()=>[n("div",{class:q.container},[n($t,null,null)])]})]})])}}),aa=_({name:"Search",setup(){const e=Y(),a=fe(),l=m(e.query.search||"");F(e,()=>{l.value=e.query.search||""});const o=m([]),r=async()=>{try{const{data:i}=await Z.get("/api-website/open/music/sheet/hotTag/MUSIC");Array.isArray(i)&&(o.value=i)}catch{}};ce(()=>{r()});const s=i=>{if(!i){l.value=i||"";return}a.replace({path:"/search",query:{search:i}})},h=m();return()=>n("div",{class:k.search},[n("div",{class:k.fixed},[n("div",{class:k.top},[n("img",{class:k.img,src:Je},null),n("span",null,[$("\u6253\u5F00APP\u770B\u6D77\u91CF\u70ED\u95E8\u4E50\u8C31")]),n(Ke,{round:!0,class:k.topBtn,onClick:()=>{var i;return(i=h.value)==null?void 0:i.downLoadApp()}},{default:()=>[$("\u6253\u5F00")]})]),n(Bt,{keyword:l.value,onSearch:i=>s(i),onBlur:i=>s(i),onBack:()=>{a.push("/")}},null)]),n("div",{class:k.tagContent},[n("div",{class:k.tagLeft},[$("\u70ED\u95E8\u641C\u7D22\uFF1A")]),n("div",{class:k.tags},[o.value.map(i=>n("span",{onClick:()=>s(i.key)},[i.key]))])]),l.value&&n(qt,null,null),n("div",{style:{display:l.value?"none":"block"}},[n("div",{class:k.searchContianer},[n(Ze,null,null)]),n(et,null,null)]),n(Ge,{ref:h},null)])}});export{aa as default};