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