import{d as h,a1 as k,r as m,l as $,b as t,I as U,c as f,h as b,f as a,w as o,u as v,m as V,t as p,j as w,g as s}from"./index-0ae84607.js";import{a as B,V as N}from"./VCardText-b1a0de89.js";import{a as P,V as y}from"./forwardRefs-d0d7c5bd.js";import{V as T}from"./VForm-272c3dd0.js";import{V as S}from"./VTextField-4bf39c0d.js";import{V as j}from"./VSelect-2b6c5c22.js";import"./VMenu-f26d3a19.js";import"./VInput-00e20677.js";import"./VSlideGroup-18f8a11f.js";import"./VVirtualScroll-06bbaaf5.js";const q={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},D=s("br",null,null,-1),F=s("br",null,null,-1),G=s("br",null,null,-1),A=s("br",null,null,-1),E=s("br",null,null,-1),Q=h({__name:"AddGroupPlayer",props:{provider:{}},setup(_){const c=k(),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})));U(()=>d.provider,async e=>{n.value="",u.value=!1,i.value=[]},{immediate:!0});const C=async function(){t.createPlayerGroup(d.provider,n.value,i.value),c.push({name:"playersettings"})};return(e,l)=>(f(),b("section",null,[a(N,null,{default:o(()=>[e.provider&&e.provider in v(t).providers?(f(),b("div",q,[a(B,null,{default:o(()=>[V(p(e.$t("settings.add_group_player"))+" ("+p(v(t).providers[e.provider].name)+") ",1)]),_:1}),D,a(P),F,G,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(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"]),A,a(y,{block:"",color:"primary",disabled:!u.value,onClick:C},{default:o(()=>[V(p(e.$t("settings.save")),1)]),_:1},8,["disabled"])]),_:1},8,["modelValue"]),E,a(y,{block:"",onClick:l[3]||(l[3]=r=>v(c).back())},{default:o(()=>[V(p(e.$t("close")),1)]),_:1})])):w("",!0)]),_:1})]))}});export{Q as default};
