import{d as C,j as e,z as c,g as T,x as B,S,a2 as b,a7 as j,T as x,B as v}from"./index.3bfa6a0e.js";import{c as E}from"./index.b1671445.js";import{T as h}from"./index.c171ade0.js";import{C as y}from"./index.68aa5658.js";import"./index.fb1da5d0.js";import{c as f}from"./index.926ca9c5.js";import{C as A}from"./index.dab60457.js";const N="_select_ku3kj_1",V="_title_ku3kj_17",F="_tit_ku3kj_17",q="_childContent_ku3kj_31",w="_item_ku3kj_36",z="_radio_ku3kj_46",D="_btn_ku3kj_73";var t={select:N,title:V,tit:F,childContent:q,item:w,"radio-group":"_radio-group_ku3kj_46",radio:z,btn:D},U=C({name:"SelectTagChild",props:{child:{type:Array,default:()=>[]},onSelect:{type:Function,default:()=>{}},rowSingle:{type:Boolean,default:!1},needAllButton:{type:Boolean,default:!0}},setup({child:m,onSelect:n,needAllButton:d,rowSingle:i},{attrs:p}){return()=>{const u=p.selected;return e(A,{class:f(t.childContent,t["radio-group"]),modelValue:u,"onUpdate:modelValue":a=>{n(a)}},{default:()=>[d&&e(y,{name:0,class:t.radio,onClick:()=>n([])},{default:()=>[e(h,{class:f(t.item,"van-ellipsis"),type:"primary",plain:u.length!==0,round:!0,size:"large"},{default:()=>[c("\u5168\u90E8")]})]}),m.map(a=>e(y,{key:a.id,name:a.id,class:t.radio,onClick:()=>{i&&n([a.id])}},{default:()=>[e(h,{class:f(t.item,"van-ellipsis"),plain:!u.includes(a.id),type:"primary",round:!0,size:"large"},{default:()=>[a.name]})]}))]})}}}),J=C({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({exquisiteFlag:m,defaultValue:n,...d},{emit:i,expose:p}){const u=T.platformType==="STUDENT"?"/api-student":"/api-teacher",{isLoading:a,state:l}=E(B(u+"/MusicTag/tree"),null),g=()=>{s.value=[],i("cancel")};(n||"").split(",").map(o=>Number(o));const s=S([]),_={};return b(l,()=>{if(l.value){const o=l.value&&l.value.data||[];for(const r of o)_[r.id]=r.name}}),p({resetTags:g}),()=>{const o=l.value&&l.value.data||[];return e("div",{class:t.select},[e("h4",{class:t.title},[c("\u5168\u90E8\u6807\u7B7E")]),e("div",{class:t.content},[o.length>0&&e("div",{class:t.list},[e(U,j({selected:s.value||[],child:o||[],onSelect:r=>{if(s.value.length>=3){x("\u6700\u591A\u53EA\u80FD\u90093\u4E2A\u6807\u7B7E");return}setTimeout(()=>{r.forEach(k=>{s.value.includes(k)||s.value.push(k)})},100)}},d),null)])]),e("footer",{class:"van-safe-area-bottom van-hairline--top"},[e(v,{class:t.btn,round:!0,onClick:g},{default:()=>[c("\u91CD\u7F6E")]}),e(v,{class:t.btn,type:"primary",round:!0,onClick:()=>i("confirm",s.value,_)},{default:()=>[c("\u786E\u8BA4")]})])])}}});export{J as S};
