import{C as b}from"./Button.js";import{S as y}from"./Subtitle.js";import{_ as T,C as v,a as P}from"./logo4.js";import{C as f}from"./Close.js";import{r as c,o as l,c as a,b as s,w as u,a as r,n as E,e as m,f as p,T as k,p as D,g as w,_ as K}from"./index.js";import"./telegram-authenticator.js";import"./close2.js";import"./donate.js";import"./money.js";const B=o=>(D("data-v-adca00c0"),o=o(),w(),o),A={class:"tuning-player-pneuma iface-container"},N={key:0,class:"tuning-player-pneuma-main"},Y={class:"tuning-player-pneuma-main-controller"},R={class:"controller__wrapper"},V=B(()=>r("img",{class:"controller__logo",src:T},null,-1)),g={class:"controller__button-box"},M={class:"controller__button-box"},S={key:0,class:"tuning-player-pneuma-main-controls"},x={class:"controls__button"},W={class:"controls__button"};function L(o,e,I,X,t,n){const C=c("controls-close"),i=c("controls-button"),O=c("car-front-icon"),h=c("car-back-icon"),d=c("sub-title");return l(),a("div",A,[s(C,{onClose:e[0]||(e[0]=_=>n.close()),isMobile:n.isMobile},null,8,["isMobile"]),s(k,{name:"slide"},{default:u(()=>[t.state?(l(),a("div",N,[r("div",Y,[r("div",R,[V,r("div",g,[s(i,{class:"controller__button",keyCode:t.KEY_CODE_ARROW_TOP,onPressed:e[1]||(e[1]=_=>n.action(t.EVENT.UP))},null,8,["keyCode"]),s(i,{class:"controller__button",keyCode:t.KEY_CODE_ARROW_BOTTOM,onPressed:e[2]||(e[2]=_=>n.action(t.EVENT.DOWN))},null,8,["keyCode"]),r("div",{class:E(["controller__button",{pressed:t.pressed}]),onClick:e[3]||(e[3]=_=>n.action(t.EVENT.MAX_UP))},[s(O,{class:"controller__button-icon"})],2)]),r("div",M,[s(i,{class:"controller__button",keyCode:t.KEY_CODE_ARROW_TOP,onPressed:e[4]||(e[4]=_=>n.action(t.EVENT.UP))},null,8,["keyCode"]),s(i,{class:"controller__button",keyCode:t.KEY_CODE_ARROW_BOTTOM,onPressed:e[5]||(e[5]=_=>n.action(t.EVENT.DOWN))},null,8,["keyCode"]),r("div",{class:E(["controller__button",{pressed:t.pressed}]),onClick:e[6]||(e[6]=_=>n.action(t.EVENT.MAX_DOWN))},[s(h,{class:"controller__button-icon"})],2)])])]),n.isMobile?p("",!0):(l(),a("div",S,[r("div",x,[s(i,{class:"button",keyCode:t.KEY_CODE_SPACE,text:"Space"},null,8,["keyCode"]),s(d,{class:"text"},{default:u(()=>[m("Регулировка")]),_:1})]),r("div",W,[s(i,{class:"button",keyCode:t.KEY_CODE_TAB,onPressed:n.switchButton},null,8,["keyCode","onPressed"]),s(d,{class:"text"},{default:u(()=>[m("Управление")]),_:1})])]))])):p("",!0)]),_:1})])}const U={name:"TuningPneumaVue",props:["openParams"],components:{ControlsButton:b,ControlsClose:f,SubTitle:y,CarBackIcon:v,CarFrontIcon:P},data(){return{EVENT:{UP:0,DOWN:1,MAX_UP:2,MAX_DOWN:3,CLOSE:4},state:!1,currentButton:-1,currentFace:0,faces:["front","back"],KEY_CODE_SPACE:window.KEY_CODE_SPACE,KEY_CODE_TAB:window.KEY_CODE_TAB,KEY_CODE_E:window.KEY_CODE_E,KEY_CODE_ARROW_TOP:window.KEY_CODE_ARROW_TOP,KEY_CODE_ARROW_BOTTOM:window.KEY_CODE_ARROW_BOTTOM,buttons:[],pressed:!1}},computed:{isMobile(){return this.$root.isMobile}},created(){this.$data.noAdaptation=!0,this.openParams&&(this.isItemBought=this.openParams[0],this.price=this.openParams[1]),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keyup",this.onKeyUp),this.$nextTick(()=>this.state=!0)},mounted(){this.buttons=document.querySelectorAll(".controller__button"),this.buttons[this.currentButton].classList.add("pressed")},unmounted(){document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keyup",this.onKeyUp)},methods:{action(o){sendClientEvent(gm.EVENT_EXECUTE_PUBLIC,"Tuning_OnPlayerPneumaEvent",o)},onClick(o){o==this.KEY_CODE_E&&this.action(this.EVENT.RESET)},switchButton(){this.buttons[this.currentButton].classList.remove("pressed"),this.currentButton<this.buttons.length-1?++this.currentButton:this.currentButton=0,this.buttons[this.currentButton].classList.add("pressed")},onKeyDown(o){o.which===this.KEY_CODE_E&&(this.pressed=!0)},onKeyUp(o){o.which===this.KEY_CODE_E&&(this.pressed=!1,this.action(this.EVENT.RESET))},close(){this.state=!1,setTimeout(()=>{this.action(this.EVENT.CLOSE),window.closeInterface("TuningPlayerPneuma")},500)}}},$=K(U,[["render",L],["__scopeId","data-v-adca00c0"]]);export{$ as default};
