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