import{Q as d}from"./QuestsInfo.js";import{C as g}from"./Button.js";import{r as f,o as n,h as P,w as k,a as t,n as S,c as a,f as c,t as u,b as T,T as v,p as C,g as I,_ as E}from"./index.js";import{_ as b,a as q}from"./mark.js";import"./telegram-authenticator.js";import"./close2.js";import"./donate.js";import"./money.js";const p=e=>(C("data-v-2248a7cc"),e=e(),I(),e),B={class:"quests-progress-info__content"},w=p(()=>t("div",{class:"quests-progress-info__before"},null,-1)),L={class:"quests-progress-info__wrap"},O=p(()=>t("img",{src:b},null,-1)),M=p(()=>t("div",{class:"quests-progress-info-mark-button__shadow"},null,-1)),N=[O,M],Q={class:"quests-progress-info__description"},x={key:0,class:"quests-progress-info__progress"},D={class:"quests-progress-info__title"},y={class:"quests-progress-info__title-text"},H=p(()=>t("div",{class:"quests-progress-info-mark-button__border-middle"},[t("div",{class:"quests-progress-info-mark-button__border-last"},[t("img",{src:q})])],-1)),J=["innerHTML"];function A(e,s,o,h,i,r){const m=f("ControlsButton");return n(),P(v,{name:"quests-progress-slide",appear:""},{default:k(()=>[t("div",{class:S(["quests-progress-info",{"quests-progress-info_mobile":r.isMobile}])},[t("div",B,[w,t("div",L,[r.isMobile&&i.isShowLocateButton?(n(),a("div",{key:0,class:"quests-progress-info-mark-button",onClick:s[0]||(s[0]=(..._)=>r.markOnMap&&r.markOnMap(..._))},N)):c("",!0),t("div",Q,[i.showedProgress?(n(),a("div",x,"Выполнено "+u(r.getQuestProgressBarPercent()),1)):c("",!0),t("div",D,[t("div",y,u(i.progressName),1)])]),!r.isMobile&&i.isShowLocateButton?(n(),a("div",{key:1,class:"quests-progress-info-mark-button",onClick:s[1]||(s[1]=(..._)=>r.markOnMap&&r.markOnMap(..._))},[H,T(m,{class:"quests-progress-info-mark-button__control",keyCode:i.KEY_CODE_J,text:"J","is-small":"",holdTime:i.LOCATE_HOLD_TIME,onPressed:r.markOnMap},null,8,["keyCode","holdTime","onPressed"])])):c("",!0)]),i.progressTask?(n(),a("div",{key:0,class:"quests-progress-info__text",innerHTML:i.progressTask},null,8,J)):c("",!0)])],2)]),_:1})}const l=62,V=400,K={name:"quests-progress-info",props:["openParams"],components:{ControlsButton:g},data(){return{LOCATE_HOLD_TIME:V,KEY_CODE_J:window.KEY_CODE_J,list:d,currentScores:1,maxScores:2,countTypes:3,currentQuestId:null,progressName:"Наименование",progressTask:"Небольшое описание задания можно в несколько строк",progressDescription:"Добро пожаловать! Время немного освоится, и понять, что к чему… Первым делом Вам нужно позаботится о своем здоровье, которое на пределе. Давайте перекусим бесплатной едой, которая находится на некоторых вокзалах области. Данная благотворительность доступна лишь только приезжим гражданам области.",showedProgress:1,isShowLocateButton:!1}},computed:{description(){let e=this.progressDescription;return e.length>l?e.slice(0,l)+"...":e},isMobile(){return this.$root.isMobile}},created(){this.$data.noAdaptation=!0,this.openParams&&(this.openParams[0]?(this.getQuestProgressBarInfo(this.openParams[1],this.openParams[2],this.openParams[3],this.openParams[4]),this.currentQuestId=this.openParams[3],this.isShowLocateButton=this.openParams[5]):(this.currentScores=this.openParams[1],this.maxScores=this.openParams[2],this.showedProgress=this.openParams[5],this.currentQuestId=null,this.progressName=this.openParams[3],this.progressDescription=this.openParams[4],this.progressTask=this.openParams[4],this.isShowLocateButton=this.openParams[6]))},methods:{getQuestProgressBarInfo(e,s,o,h){this.currentScores=e,this.maxScores=s,this.showedProgress=h,this.currentQuestId=o,this.getQuestProgressName(o)},getQuestProgressBarPercent(){return parseInt(this.currentScores*100/this.maxScores)+"%"},updateData(e){let s=JSON.parse(e);this.currentScores=s[1],this.maxScores=s[2],this.progressName=s[3],this.progressDescription=s[4],this.progressTask=s[4],this.showedProgress=s[5]},setLocateBtnState(e){this.isShowLocateButton=e},markOnMap(){sendClientEvent(gm.EVENT_EXECUTE_PUBLIC,"QPI_OnLocate")},getQuestProgressName(e){for(let s in this.list)for(let o in this.list[s])if(this.list[s][o].id==e){this.progressName=this.list[s][o].name,this.progressDescription=this.list[s][o].description,this.progressTask=this.list[s][o].task;break}}}},W=E(K,[["render",A],["__scopeId","data-v-2248a7cc"]]);export{W as default};
