import{d as k,af as h,r as m,z as $,b as t,I as U,c,g as b,f as a,w as o,u as v,G as f,t as p,j as w,i as s}from"./index-1fa25223.js";import{V as B,a as N}from"./VCardText-bbb7eb1a.js";import{V as P}from"./VList-f519ecda.js";import{V as T}from"./VForm-e19226bb.js";import{V as G}from"./VTextField-46c02b72.js";import{V as S}from"./VSelect-58338ce7.js";import{t as y}from"./VListItem-53d44b85.js";import"./VLabel-148b546a.js";import"./VMenu-85495654.js";import"./VVirtualScroll-f6a01209.js";import"./VCheckboxBtn-4c4cfeff.js";const j={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},q=s("br",null,null,-1),D=s("br",null,null,-1),F=s("br",null,null,-1),z=s("br",null,null,-1),A=s("br",null,null,-1),X=k({__name:"AddGroupPlayer",props:{provider:{}},setup(_){const V=h(),i=m(""),n=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=>{i.value="",u.value=!1,n.value=[]},{immediate:!0});const C=async function(){t.createPlayerGroup(d.provider,i.value,n.value),V.push({name:"playersettings"})};return(e,l)=>(c(),b("section",null,[a(N,null,{default:o(()=>[e.provider&&e.provider in v(t).providers?(c(),b("div",j,[a(B,null,{default:o(()=>[f(p(e.$t("settings.add_group_player"))+" ("+p(v(t).providers[e.provider].name)+") ",1)]),_:1}),q,a(P),D,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(G,{modelValue:i.value,"onUpdate:modelValue":l[0]||(l[0]=r=>i.value=r),label:e.$t("settings.player_name"),variant:"outlined",clearable:"",required:""},null,8,["modelValue","label"]),a(S,{modelValue:n.value,"onUpdate:modelValue":l[1]||(l[1]=r=>n.value=r),clearable:"",multiple:"",items:g.value,label:e.$t("settings.group_members"),required:""},null,8,["modelValue","items","label"]),z,a(y,{block:"",color:"primary",disabled:!u.value,onClick:C},{default:o(()=>[f(p(e.$t("settings.save")),1)]),_:1},8,["disabled"])]),_:1},8,["modelValue"]),A,a(y,{block:"",onClick:l[3]||(l[3]=r=>v(V).back())},{default:o(()=>[f(p(e.$t("close")),1)]),_:1})])):w("",!0)]),_:1})]))}});export{X as default};
