import{v as k,aa as h,r as m,c as $,w as B,y as f,E as y,l as a,A as t,x as v,R as V,N as p,I as N,B as s,L as o}from"./index-20675090.js";import{a as U,V as w}from"./VCardText-5e149cd1.js";import{V as P,j as b}from"./forwardRefs-67412654.js";import{V as T}from"./VForm-61bfc237.js";import{V as S}from"./VTextField-8bb22937.js";import{V as j}from"./VSelect-114025f3.js";import"./VMenu-ae4158ef.js";import"./VCheckboxBtn-bbfa74a1.js";import"./VSlideGroup-14bb6bf6.js";import"./VVirtualScroll-b47ffb64.js";const q={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},A=s("br",null,null,-1),D=s("br",null,null,-1),E=s("br",null,null,-1),F=s("br",null,null,-1),G=s("br",null,null,-1),M=k({__name:"AddGroupPlayer",props:{provider:{}},setup(_){const c=h(),n=m(""),i=m([]),u=m(!1),d=_,g=$(()=>Object.values(o.players).filter(e=>{var l;return d.provider.startsWith("ugp")||((l=o.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 C=async function(){o.createPlayerGroup(d.provider,n.value,i.value),c.push({name:"playersettings"})};return(e,l)=>(f(),y("section",null,[a(w,null,{default:t(()=>[e.provider&&e.provider in v(o).providers?(f(),y("div",q,[a(U,null,{default:t(()=>[V(p(e.$t("settings.add_group_player"))+" ("+p(v(o).providers[e.provider].name)+") ",1)]),_:1}),A,a(P),D,E,a(T,{ref:"form",modelValue:u.value,"onUpdate:modelValue":l[2]||(l[2]=r=>u.value=r),style:{"margin-right":"10px"}},{default:t(()=>[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(j,{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"]),F,a(b,{block:"",color:"primary",disabled:!u.value,onClick:C},{default:t(()=>[V(p(e.$t("settings.save")),1)]),_:1},8,["disabled"])]),_:1},8,["modelValue"]),G,a(b,{block:"",onClick:l[3]||(l[3]=r=>v(c).back())},{default:t(()=>[V(p(e.$t("close")),1)]),_:1})])):N("",!0)]),_:1})]))}});export{M as default};
