import{B as u}from"./Button3.js";import{C}from"./Button.js";import{r as E,o as t,c as i,b as k,l as w,f as r,F as h,a as o,n as l,t as d,e as b,i as y,h as m,w as g,m as x,_ as v}from"./index.js";/* empty css                                                      */import"./ButtonContainer.js";/* empty css                                                               */import"./colors.js";import"./telegram-authenticator.js";import"./close2.js";import"./donate.js";import"./money.js";const S={key:0,class:"death-waves"},P=o("div",{class:"death-bg-gradient"},null,-1),f={key:0,class:"death-bg-gradient-danger"},M={class:"death-container"},D={key:0,class:"death-timer"},K={class:"death-title"},T=o("div",{class:"death-desc"},"После потери сознания Вы будете доставлены в ближайшую больницу.",-1),B={key:0,class:"death-desc"},A={class:"death-timer__time"},O={class:"death-buttons"};function F(n,a,c,Y,V,e){const _=E("controls-button");return t(),i("div",{class:l(["death iface-container",{death_mobile:e.isMobile}])},[k(w,{name:"fade"}),e.isMobile?r("",!0):(t(),i("div",S)),e.isMobile?(t(),i(h,{key:1},[o("div",{class:l(["death-bg-lines",{"death-bg-lines_danger":e.isDanger}])},null,2),P,e.isDanger?(t(),i("div",f)):r("",!0)],64)):r("",!0),o("div",M,[e.isMobile?r("",!0):(t(),i("div",D,d(e.getTime()),1)),o("div",K,[b("Без сознания"),T,e.isSuicide?r("",!0):(t(),i("div",B,d(e.deathDescription),1))]),e.isMobile?(t(),i("div",{key:1,class:l(["death-timer_mobile",{"death-timer_mobile_danger":e.isDanger}])},[o("div",A,d(e.getTime()),1)],2)):r("",!0),o("div",O,[(t(!0),i(h,null,y(e.buttons,(s,p)=>(t(),m(x(e.isMobile?"Button":"div"),{class:"death-button",key:p,text:s.text,type:s.type,onClick:s.onClick},{default:g(()=>[s.isShowControll?(t(),m(_,{key:0,keyCode:this[`KEY_CODE_${s.code.toUpperCase()}`],text:s.code,onPressed:s.onPress},null,8,["keyCode","text","onPressed"])):r("",!0),e.isMobile?r("",!0):(t(),i("div",{key:1,class:l(["death-button-text",s.textClass])},d(s.text),3))]),_:2},1032,["text","type","onClick"]))),128))])])],2)}const N={props:["openParams"],components:{ControlsButton:C,Button:u},data(){return{KEY_CODE_E:window.KEY_CODE_E,KEY_CODE_SPACE:window.KEY_CODE_SPACE,KEY_CODE_F2:window.KEY_CODE_F2,seconds:0,ambulancePrice:1e3,preMortemSeconds:0,killerNickname:"",killerWeapon:"",isShowReport:!1}},computed:{isMobile(){return this.$root.isMobile},isSuicide(){return this.killerNickname===""},isKilledByAdmin(){return this.killerWeapon==="hp"},deathDescription(){const{isKilledByAdmin:n,killerNickname:a,killerWeapon:c}=this;return n?`Администратор ${a} выдал вам 0 HP.`:a.length?`Вас убил ${a} с помощью ${c}.`:""},isDanger(){return this.seconds<60},buttons(){const n=[{text:this.deathText,code:"E",onClick:this.spawn,isShowControll:!this.isMobile&&!this.preMortemSeconds,type:"white",textClass:{"death-button-text-gray":this.preMortemSeconds}},{text:this.callAmbulanceText,code:"Space",onClick:this.callAmbulance,isShowControll:!this.isMobile,type:"green",textClass:{}}],a={text:"Подать жалобу",code:"F2",onClick:this.reportPlayer,onPress:this.reportPlayer,isShowControll:!this.isMobile,type:"transparent",textClass:{}};return this.isShowReport&&n.push(a),n},deathText(){return this.preMortemSeconds?`Вы сможете появиться в больнице через ${window.getTimeFormatSeconds(this.preMortemSeconds,!0)}`:"Появиться в больнице"},callAmbulanceText(){return this.isMobile?"Вызвать медиков":`Вызвать скорую (${this.ambulancePrice} р)`}},created(){this.openParams&&(this.seconds=this.openParams[0],this.ambulancePrice=this.openParams[1],this.preMortemSeconds=this.openParams[2],this.killerNickname=this.openParams[3],this.killerWeapon=this.openParams[4],this.isShowReport=this.openParams[5]),setInterval(()=>{this.seconds>0&&(this.seconds-=1),this.preMortemSeconds>0&&(this.preMortemSeconds-=1)},1e3),this.$data.noAdaptation=!0,window.interface("Fishing")&&window.closeInterface("Fishing")},methods:{getTime(){return window.getTimeFormatSeconds(this.seconds,!0)},spawn(){window.sendKeyEvent(this.KEY_CODE_E)},callAmbulance(){window.sendKeyEvent(this.KEY_CODE_SPACE)},reportPlayer(){sendClientEvent(gm.EVENT_EXECUTE_PUBLIC,"OnReport")}}},J=v(N,[["render",F]]);export{J as default};
