import{v as C,aa as h,r as m,c as $,L as t,w as B,y as f,E as y,l as a,A as o,x as v,Q as c,N as p,I as N,B as s}from"./index-5804982a.js";import{a as U,V as w}from"./VCardText-963b2439.js";import{k as P,l as b}from"./forwardRefs-03519353.js";import{V as T}from"./VForm-85034c32.js";import{V as S}from"./VTextField-b58cde95.js";import{V as q}from"./VSelect-e6597dd4.js";import"./VMenu-18f2572a.js";import"./VInput-fe7a35fc.js";import"./VSlideGroup-711de993.js";import"./VVirtualScroll-72995e2a.js";const A={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},D=s("br",null,null,-1),E=s("br",null,null,-1),F=s("br",null,null,-1),G=s("br",null,null,-1),j=s("br",null,null,-1),K=C({__name:"AddGroupPlayer",props:{provider:{}},setup(_){const V=h(),n=m(""),i=m([]),u=m(!1),d=_,g=$(()=>Object.values(t.players).filter(e=>{var l;return d.provider.startsWith("ugp")||((l=t.getProvider(e.provider))==null?void 0:l.instance_id)==d.provider&&e.can_sync_with.length}).sort((e,l)=>e.display_name.toUpperCase()>l.display_name.toUpperCase()?1:-1).map(e=>({title:e.display_name,value:e.player_id})));B(()=>d.provider,async e=>{n.value="",u.value=!1,i.value=[]},{immediate:!0});const k=async function(){t.createPlayerGroup(d.provider,n.value,i.value),V.push({name:"playersettings"})};return(e,l)=>(f(),y("section",null,[a(w,null,{default:o(()=>[e.provider&&e.provider in v(t).providers?(f(),y("div",A,[a(U,null,{default:o(()=>[c(p(e.$t("settings.add_group_player"))+" ("+p(v(t).providers[e.provider].name)+") ",1)]),_:1}),D,a(P),E,F,a(T,{ref:"form",modelValue:u.value,"onUpdate:modelValue":l[2]||(l[2]=r=>u.value=r),style:{"margin-right":"10px"}},{default:o(()=>[a(S,{modelValue:n.value,"onUpdate:modelValue":l[0]||(l[0]=r=>n.value=r),label:e.$t("settings.player_name"),variant:"outlined",clearable:"",required:""},null,8,["modelValue","label"]),a(q,{modelValue:i.value,"onUpdate:modelValue":l[1]||(l[1]=r=>i.value=r),clearable:"",multiple:"",items:g.value,label:e.$t("settings.group_members"),required:""},null,8,["modelValue","items","label"]),G,a(b,{block:"",color:"primary",disabled:!u.value,onClick:k},{default:o(()=>[c(p(e.$t("settings.save")),1)]),_:1},8,["disabled"])]),_:1},8,["modelValue"]),j,a(b,{block:"",onClick:l[3]||(l[3]=r=>v(V).back())},{default:o(()=>[c(p(e.$t("close")),1)]),_:1})])):N("",!0)]),_:1})]))}});export{K as default};
