var v=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var y=(l,i)=>{var o={};for(var e in l)S.call(l,e)&&i.indexOf(e)<0&&(o[e]=l[e]);if(l!=null&&v)for(var e of v(l))i.indexOf(e)<0&&E.call(l,e)&&(o[e]=l[e]);return o};import{s as N,r as A}from"./index.9e4b607f.js";import{b as V}from"./index.8eb24852.js";import{d as j,a as t,a4 as w,a5 as C,U as b,j as f,l as F,_ as U,a6 as q,B as x}from"./vendor.3506a68e.js";/* empty css                *//* empty css                *//* empty css                */import{c as _}from"./index.926ca9c5.js";const z="_select_ku3kj_1",D="_title_ku3kj_17",G="_tit_ku3kj_17",L="_childContent_ku3kj_31",M="_item_ku3kj_36",P="_radio_ku3kj_46",$="_btn_ku3kj_73";var a={select:z,title:D,tit:G,childContent:L,item:M,"radio-group":"_radio-group_ku3kj_46",radio:P,btn:$},H=j({name:"SelectTagChild",props:{child:{type:Array,default:()=>[]},onSelect:{type:Function,default:()=>{}},rowSingle:{type:Boolean,default:!1},needAllButton:{type:Boolean,default:!0}},setup({child:l,onSelect:i,needAllButton:o,rowSingle:e},{attrs:m}){return()=>{const p=m.selected;return t(w,{class:_(a.childContent,a["radio-group"]),modelValue:p,"onUpdate:modelValue":n=>{i(n)}},{default:()=>[o&&t(C,{name:0,class:a.radio,onClick:()=>i([])},{default:()=>[t(b,{class:_(a.item,"van-ellipsis"),type:"primary",plain:p.length!==0,round:!0,size:"large"},{default:()=>[f("\u5168\u90E8")]})]}),l.map(n=>t(C,{key:n.id,name:n.id,class:a.radio,onClick:()=>{e&&i([n.id])}},{default:()=>[t(b,{class:_(a.item,"van-ellipsis"),plain:!p.includes(n.id),type:"primary",round:!0,size:"large"},{default:()=>[n.name]})]}))]})}}}),Z=j({name:"SelectTag",props:{defaultValue:{type:String,default:""},rowSingle:{type:Boolean,default:!1},exquisiteFlag:{type:Boolean,default:!1},needAllButton:{type:Boolean,default:!0}},emits:["cancel","confirm"],setup(p,{emit:e,expose:m}){var n=p,{exquisiteFlag:l,defaultValue:i}=n,o=y(n,["exquisiteFlag","defaultValue"]);const T=N.platformType==="STUDENT"?"/api-student":"/api-teacher",{isLoading:I,state:u}=V(A(T+"/MusicTag/tree"),null),g=()=>{d.value={},e("cancel")},B=(i||"").split(",").map(r=>Number(r)),d=F({}),h={};return U(u,()=>{if(u.value){const r=u.value&&u.value.data||[];l&&r.unshift({name:"\u4E50\u8C31\u7C7B\u578B",id:-1,children:[{id:1,name:"\u7CBE\u54C1"}]});for(const s of r){const k=s.children.map(c=>(h[c.id]=c.name,c.id));d.value[s.id]=B.filter(c=>k.includes(Number(c)))}}}),m({resetTags:g}),()=>{const r=u.value&&u.value.data||[];return console.log(r,"list"),t("div",{class:a.select},[t("h4",{class:a.title},[f("\u5168\u90E8\u6807\u7B7E")]),t("div",{class:a.content},[r.map(s=>!s.children||s.children.length<=0?null:t("div",{class:a.list,key:s.id},[t("div",{class:a.tit},[s.name]),t(H,q({key:s.id,selected:d.value[s.id]||[],child:s.children||[],onSelect:k=>{d.value[s.id]=k}},o),null)]))]),t("footer",{class:"van-safe-area-bottom van-hairline--top"},[t(x,{class:a.btn,round:!0,onClick:g},{default:()=>[f("\u91CD\u7F6E")]}),t(x,{class:a.btn,type:"primary",round:!0,onClick:()=>e("confirm",d.value,h)},{default:()=>[f("\u786E\u8BA4")]})])])}}});export{Z as S};
