import{y as C,ac as h,r as m,c as $,N as t,w as N,A as f,H as y,q as a,D as o,z as v,S as c,Q as p,K as U,E as s}from"./index-9b822783.js";import{a as w,V as B}from"./VCardText-bc96863a.js";import{k as P,l as b}from"./forwardRefs-af0663a3.js";import{V as S}from"./VForm-79d9662c.js";import{V as T}from"./VTextField-7d804c49.js";import{V as q}from"./VSelect-c39cc514.js";import"./VMenu-8029677e.js";import"./VInput-c159036c.js";import"./VSlideGroup-d3ac8eca.js";import"./VVirtualScroll-a3d1c1c9.js";const D={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},A=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),M=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})));N(()=>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(B,null,{default:o(()=>[e.provider&&e.provider in v(t).providers?(f(),y("div",D,[a(w,null,{default:o(()=>[c(p(e.$t("settings.add_group_player"))+" ("+p(v(t).providers[e.provider].name)+") ",1)]),_:1}),A,a(P),E,F,a(S,{ref:"form",modelValue:u.value,"onUpdate:modelValue":l[2]||(l[2]=r=>u.value=r),style:{"margin-right":"10px"}},{default:o(()=>[a(T,{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})])):U("",!0)]),_:1})]))}});export{M as default};
