import{C as k}from"./Close.js";import{o as r,c as a,a as t,p as h,g as p,_ as u,r as c,b as l,n as _,t as E}from"./index.js";import{a as C,_ as f}from"./pointer.js";import"./telegram-authenticator.js";import"./close2.js";import"./Button.js";import"./donate.js";import"./money.js";const m=e=>(h("data-v-2e1162bd"),e=e(),p(),e),w={key:0,class:"qte-bar",width:"298",height:"298",viewBox:"0 0 298 298",fill:"none",xmlns:"http://www.w3.org/2000/svg"},b=["stroke-dasharray","stroke-dashoffset"],I=m(()=>t("path",{opacity:"0.25",d:"m294 149c0 80.081-64.919 145-145 145-80.0813 0-145-64.919-145-145 0-80.0813 64.9187-145 145-145 80.081 0 145 64.9187 145 145",stroke:"white","stroke-width":"8"},null,-1)),q={key:1,class:"qte-bar",width:"112",height:"120",viewBox:"0 0 112 120",fill:"none",xmlns:"http://www.w3.org/2000/svg"},D=["stroke-dasharray","stroke-dashoffset"],P=m(()=>t("path",{opacity:"0.25",d:"m110 59v-41c0-8.8366-7.163-16-16-16l-76 0c-8.8366 0-16 7.1634-16 16v41 41c0 8.837 7.1634 16 16 16h76c8.837 0 16-7.163 16-16v-41",stroke:"white","stroke-width":"4"},null,-1));function R(e,o,d,v,n,s){return d.isRound?(r(),a("svg",w,[t("path",{class:"qte-bar__animated",d:"m294 149c0 80.081-64.919 145-145 145-80.0813 0-145-64.919-145-145 0-80.0813 64.9187-145 145-145 80.081 0 145 64.9187 145 145",stroke:"orange","stroke-width":"8","stroke-dasharray":s.dasharray,"stroke-dashoffset":s.dashoffset},null,8,b),I])):(r(),a("svg",q,[t("path",{class:"qte-bar__animated",d:"m110 59v-41c0-8.8366-7.163-16-16-16l-76 0c-8.8366 0-16 7.1634-16 16v41 41c0 8.837 7.1634 16 16 16h76c8.837 0 16-7.163 16-16v-41",stroke:"orange","stroke-width":"4","stroke-dasharray":s.dasharray,"stroke-dashoffset":s.dashoffset},null,8,D),P]))}const A=420,x=911,T={props:{progress:{type:Number,default:0},isRound:{type:Boolean,default:!1}},computed:{dasharray(){return this.isRound?x:A},dashoffset(){const e=this.dasharray+this.dasharray*(Math.min(this.progress,100)/100);return this.isRound?-e:e}}},U=u(T,[["render",R],["__scopeId","data-v-2e1162bd"]]),i=e=>(h("data-v-994525e6"),e=e(),p(),e),S={class:"qte__content"},V=i(()=>t("img",{class:"qte-background",src:f},null,-1)),B=i(()=>t("div",{class:"qte-button__shadow"},null,-1)),K={class:"qte-button__content"},L={key:0,class:"qte-button__content-icon",src:C},M={key:1,class:"qte-button__content-text"},N=i(()=>t("div",{class:"qte-button__content-background"},null,-1)),F={class:"qte-text"},O={class:"qte-text__content"};function Q(e,o,d,v,n,s){const g=c("ControlsClose"),y=c("Bar");return r(),a("div",{class:_(["qte",{qte_completed:n.isCompleted,qte_mobile:s.isMobile}])},[l(g,{class:"qte__close",isMobile:s.isMobile,type:4,onClose:s.close,onClick:s.close},null,8,["isMobile","onClose","onClick"]),t("div",S,[V,t("div",{class:_(["qte-button",{"qte-button_active":n.buttonIsDown}])},[l(y,{class:"qte-button__progress",progress:n.progress,isRound:s.isMobile},null,8,["progress","isRound"]),t("div",{class:"qte-button__container",onClick:o[0]||(o[0]=X=>s.isMobile&&s.onRequiredKeyClick())},[B,t("div",K,[s.isMobile?(r(),a("img",L)):(r(),a("div",M,"F")),N])])],2),t("div",F,[t("div",O,E(n.text),1)])])],2)}const Y=150,G=5,$=15,H={props:["openParams"],components:{ControlsClose:k,Bar:U},data(){return{KEY_CODE_ESC:window.KEY_CODE_ESC,progress:0,progressInterval:null,text:"быстро нажимайте",keysPressed:[],buttonIsDown:!1,isCompleted:!1,decreasingInterval:Y,decreasingValue:G,increasingValue:$}},computed:{isMobile(){return this.$root.isMobile}},created(){this.$data.noAdaptation=!0,this.openParams&&(this.increasingValue=this.openParams[0],this.decreasingValue=this.openParams[1],this.decreasingInterval=this.openParams[2]),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keyup",this.onKeyUp)},mounted(){this.startInterval()},unmounted(){document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keyup",this.onKeyUp),this.stopInterval()},methods:{startInterval(){this.stopInterval(),this.progressInterval=setInterval(()=>{this.setProgress(this.progress-this.decreasingValue)},this.decreasingInterval)},stopInterval(){clearInterval(this.progressInterval)},onKeyDown(e){this.keysPressed.includes(e.keyCode)||(this.keysPressed.push(e.keyCode),e.keyCode===window.KEY_CODE_F&&this.onRequiredKeyClick())},onKeyUp(e){this.keysPressed=this.keysPressed.filter(o=>o!==e.keyCode)},onRequiredKeyClick(){this.setProgress(this.progress+this.increasingValue),this.buttonIsDown=!0,setTimeout(()=>{this.buttonIsDown=!1},100)},setProgress(e){this.progress=Math.max(0,Math.min(100,e)),this.progress===100&&this.onProgressComplete()},onProgressComplete(){this.stopInterval(),this.isCompleted=!0,sendClientEvent(gm.EVENT_EXECUTE_PUBLIC,"QTE_OnPlayerFinish")},close(){window.closeInterface("QTE"),sendClientEvent(gm.EVENT_EXECUTE_PUBLIC,"QTE_OnPlayerClose")}}},oe=u(H,[["render",Q],["__scopeId","data-v-994525e6"]]);export{oe as default};
