import{u as G}from"./vue-router-DseMGm2G.js";import{V as _,a as s,q as k,i as H}from"./index-CPxkwG0x.js";import{q as M,p as S,G as m,e as B,a8 as L,l as O,a6 as R,a4 as E,m as T}from"./vuetify-C-X2RQxn.js";import{d as N,c as j,J as r,H as n,e as o,G as v,a2 as y,a4 as g,g as U,u as b,r as f,K as q,b as i}from"./lucide-6UWTdd2w.js";import"./qrcode-DG5BmHWw.js";import"./marked-BPdRUrA1.js";import"./vue-i18n-QBroYIqB.js";import"./color-CqFg8eif.js";import"./vueuse-BmOENVLt.js";/* empty css            */import"./swiper-7FOSZ2nt.js";const D={style:{"margin-left":"-5px","margin-right":"-5px"}},h=N({__name:"AddPlayerGroup",props:{provider:{}},setup($){const C=G(),c=f(""),t=f([]),p=f(!0),V=f(!1),d=$,u=U(()=>s.getProvider(d.provider)),w=U(()=>d.provider==="universal_group"?Object.values(s.players).filter(e=>e.available&&e.type!=k.GROUP).sort((e,l)=>(e.name??"").toUpperCase().localeCompare((l.name??"").toUpperCase())):d.provider==="sync_group"?Object.values(s.players).filter(e=>{if(!e.available||e.type===k.GROUP||!e.supported_features.includes(H.SET_MEMBERS))return!1;let l=e.can_group_with;return l.length===0&&e.synced_to&&s.players[e.synced_to]&&(l=s.players[e.synced_to].can_group_with),l.length===0?!1:t.value.length===0||t.value.includes(e.player_id)?!0:t.value.some(a=>l.includes(a))}).sort((e,l)=>(e.name??"").toUpperCase().localeCompare((l.name??"").toUpperCase())):Object.values(s.players).filter(e=>e.available&&e.type!=k.GROUP&&e.provider==u.value?.instance_id).sort((e,l)=>(e.name??"").toUpperCase().localeCompare((l.name??"").toUpperCase()))),P=async function(){s.createPlayerGroup(d.provider,c.value,t.value,p.value),C.push({name:"playersettings"})};return(e,l)=>(i(),j("section",null,[r(M,null,{default:n(()=>[o("div",D,[r(S,null,{default:n(()=>[y(g(e.$t("settings.add_group_player")),1)]),_:1}),u.value?.domain==="universal_group"?(i(),v(m,{key:0,style:{"white-space":"break-spaces"},innerHTML:b(_)(e.$t("settings.add_group_player_desc_universal"))},null,8,["innerHTML"])):u.value?.domain==="sync_group"?(i(),v(m,{key:1,style:{"white-space":"break-spaces"},innerHTML:b(_)(e.$t("settings.add_group_player_desc_sync"))},null,8,["innerHTML"])):(i(),v(m,{key:2,style:{"white-space":"break-spaces"},innerHTML:b(_)(e.$t("settings.add_group_player_desc",[u.value?.name]))},null,8,["innerHTML"])),l[6]||(l[6]=o("br",null,null,-1)),r(B),l[7]||(l[7]=o("br",null,null,-1)),l[8]||(l[8]=o("br",null,null,-1)),r(L,{ref:"form",modelValue:V.value,"onUpdate:modelValue":l[3]||(l[3]=a=>V.value=a),style:{"margin-right":"10px"}},{default:n(()=>[r(O,{modelValue:c.value,"onUpdate:modelValue":l[0]||(l[0]=a=>c.value=a),label:e.$t("settings.player_name"),variant:"outlined",clearable:"",required:"",rules:[a=>a.length>0||e.$t("settings.invalid_input")]},null,8,["modelValue","label","rules"]),r(R,{modelValue:t.value,"onUpdate:modelValue":l[1]||(l[1]=a=>t.value=a),clearable:"",multiple:"",items:w.value,"item-title":"name","item-value":"player_id",label:e.$t("settings.group_members")},null,8,["modelValue","items","label"]),r(E,{modelValue:p.value,"onUpdate:modelValue":l[2]||(l[2]=a=>p.value=a),color:"primary",label:e.$t("settings.dynamic_members.label")},null,8,["modelValue","label"]),u.value?.domain!=="universal_group"?(i(),v(m,{key:0,style:{"white-space":"break-spaces","padding-left":"0","margin-top":"-25px","margin-bottom":"35px"}},{default:n(()=>[y(g(e.$t("settings.dynamic_members.description")),1)]),_:1})):q("",!0),l[5]||(l[5]=o("br",null,null,-1)),r(T,{block:"",color:"primary",disabled:!V.value||t.value.length==0&&!p.value,onClick:P},{default:n(()=>[y(g(e.$t("settings.save")),1)]),_:1},8,["disabled"])]),_:1},8,["modelValue"]),l[9]||(l[9]=o("br",null,null,-1)),r(T,{block:"",onClick:l[4]||(l[4]=a=>b(C).back())},{default:n(()=>[y(g(e.$t("close")),1)]),_:1})])]),_:1})]))}});export{h as default};
