import{I as v}from"./icons.js";/* empty css       */import{_ as P}from"./FootballMixin.js";import{o as r,c as l,a as e,F as p,i as _,n as c,t as o,_ as h}from"./index.js";const u={class:"football-positions-container"},y={class:"football-positions"},f={class:"area"},b=["onClick"],C={class:"backup-area-wrapper",style:{width:"100%"}},I={class:"backup-area"},g={style:{height:"127px"},"data-simplebar":"","data-force-visible":"true","data-auto-hide":"false"},k={class:"gamers"},E=["onClick"],x={class:"gamer__number"},B={class:"gamer__pos"},N=["innerHTML"],F={class:"confirm-area-wrapper"},T=["disabled"];function L(s,t,d,w,m,i){return r(),l("div",u,[e("div",y,[e("div",f,[(r(),l(p,null,_(5,n=>e("div",{class:c(["area-pos",[`pos${n}`,{active:i.playerInPosition(n)}]]),onClick:a=>i.setPosition(n)},[e("span",null,o(i.playerInPosition(n)?i.playerInPosition(n).num:""),1)],10,b)),64))]),e("div",C,[e("div",I,[e("div",{class:c(["area-pos pos6",[{active:i.playerInPosition(6)}]]),onClick:t[0]||(t[0]=n=>i.setPosition(6))},[e("span",null,o(i.playerInPosition(6)?i.playerInPosition(6).num:""),1)],2),e("div",{class:c(["area-pos pos7",[{active:i.playerInPosition(7)}]]),onClick:t[1]||(t[1]=n=>i.setPosition(7))},[e("span",null,o(i.playerInPosition(7)?i.playerInPosition(7).num:""),1)],2)])]),e("div",g,[e("div",k,[(r(!0),l(p,null,_(m.command,(n,a)=>(r(),l("div",{class:c(["gamer",{gamer_active:m.activePlayer==a}]),key:a,onClick:M=>m.activePlayer=a},[e("div",x,o(n.num),1),e("div",B,o(s.getPositionName(n.pos)),1),e("div",{class:"gamer__nickname",innerHTML:n.name.replace("_","<br>")},null,8,N)],10,E))),128))])]),e("div",F,[e("span",{class:"confirm-button",disabled:i.buttonActive,onClick:t[2]||(t[2]=n=>i.close())},"Подтвердить",8,T)])])])}const U={name:"football-positions",mixins:[P],props:["openParams"],data(){return{command:[],activePlayer:0,positionSelector:1}},computed:{activePosition(){return this.command[this.activePlayer].pos},buttonActive(){return!!this.command.find(s=>Number(s.pos)===0)}},created(){this.openParams&&(this.command=this.openParams.command)},methods:{close(){sendClientEvent(gm.EVENT_EXECUTE_PUBLIC,"FB_CloseChangePlayerMenu")},playerInPosition(s){return this.command.find(t=>Number(t.pos)===s)?this.command.find(t=>Number(t.pos)===s):null},prevPosition(){let s=this.command[this.activePlayer].pos;s-=1,s<1&&(s=5),this.setPosition(s)},nextPosition(){let s=this.command[this.activePlayer].pos;s+=1,s>5&&(s=1),this.setPosition(s)},setPosition(s){const t=this.command.findIndex(d=>d.pos==s);t!=-1&&(this.command[t].pos=this.command[this.activePlayer].pos,this.command[this.activePlayer].pos=s),this.command[this.activePlayer].pos=s,sendClientEvent(gm.EVENT_EXECUTE_PUBLIC,"FB_OnChangePosPlayer",parseInt(this.command[this.activePlayer].playerid),s)},getIconForPos(s){let t="star";return s==4&&(t="circle"),`${v}#${t}`}}},X=h(U,[["render",L]]);export{X as default};
