import{C as f}from"./Button.js";import{C as b}from"./Close.js";/* empty css                                          */import{o as r,c,a as s,_ as h,r as o,b as E,t as d,h as n,F as g,i as w,w as k,e as y,n as T,q as j}from"./index.js";import{B}from"./BaseButton.js";import{b as M}from"./telegram-authenticator.js";import{c as C}from"./timeZone.js";import{h as D,f as A}from"./time4.js";import"./close2.js";import"./donate.js";import"./money.js";const O={class:"jail-camera-arrow-mobile"},P=s("img",{class:"jail-camera-arrow-mobile__icon",src:M},null,-1),N=[P];function U(e,a){return r(),c("div",O,N)}const x={},J=h(x,[["render",U]]),L=s("div",{class:"jail-camera__curtain"},null,-1),K=j('<div class="jail-camera__lens"><div class="jail-camera__lens__angle"></div><div class="jail-camera__lens__angle"></div><div class="jail-camera__lens__angle"></div><div class="jail-camera__lens__center"></div></div>',1),S={class:"jail-camera__content"},V={class:"jail-camera__time"},Y=["innerHTML"],I=s("div",{class:"jail-camera__shadow"},null,-1),$={class:"jail-camera__curtain"},F={class:"jail-camera__tabs"},H={class:"jail-camera__tabs__content",ref:"tabs"};function X(e,a,i,z,R,t){const u=o("ControlsClose"),_=o("ArrowMobile"),m=o("ControlsButton"),p=o("BaseButton");return r(),c("div",{class:T(["jail-camera iface-container",{"jail-camera_mobile":t.isMobile}])},[L,E(u,{class:"jail-camera__close",isMobile:t.isMobile,type:1,onClose:t.close},null,8,["isMobile","onClose"]),K,s("div",S,[s("div",V,d(t.timeString),1),s("div",{class:"jail-camera__label",innerHTML:e.currentCamera.label},null,8,Y)]),I,s("div",$,[s("div",F,[t.isMobile?(r(),n(_,{key:0,class:"jail-camera__arrow",onClick:t.prev},null,8,["onClick"])):(r(),n(m,{key:1,keyCode:e.KEY_CODE_A,text:"A",onPressed:t.prev},null,8,["keyCode","onPressed"])),s("div",H,[(r(!0),c(g,null,w(e.cameras,(v,l)=>(r(),n(p,{key:l,isActive:l===e.currentCamera.id,onClick:G=>t.onChangeCamera(l,!0)},{default:k(()=>[y(d(v),1)]),_:2},1032,["isActive","onClick"]))),128))],512),t.isMobile?(r(),n(_,{key:2,class:"jail-camera__arrow",onClick:t.next},null,8,["onClick"])):(r(),n(m,{key:3,keyCode:e.KEY_CODE_D,text:"D",onPressed:t.next},null,8,["keyCode","onPressed"]))])])],2)}const q={props:["openParams"],components:{ControlsButton:f,ControlsClose:b,BaseButton:B,ArrowMobile:J},data:()=>({KEY_CODE_A:window.KEY_CODE_A,KEY_CODE_D:window.KEY_CODE_D,currentCamera:{id:0,label:"Медицинский корпус <span>/ Камера 2</span>"},cameras:["Камера 1","Камера 1","Камера 1","Камера 1","Камера 1","Камера 1","Камера 1","Камера 1","Камера 1","Камера 1","Камера 1","Камера 1","Камера 1","Камера 1","Камера 1"],time:C(new Date),timeTimer:null}),computed:{timeString(){const e=D(this.time),a=A(this.time);return`${e} ${a}`},isMobile(){return this.$root.isMobile}},created(){if(this.$data.noAdaptation=!0,this.openParams){const[e,a]=this.openParams;this.setCurrentCamera(e),this.setCameras(a)}this.startUpdateTime()},unmounted(){this.stopUpdateTime()},methods:{onChangeCamera(e,a=!1){if(!a){const i=this.$refs.tabs;i.scrollLeft=i.children[e].offsetLeft}sendClientEvent(gm.EVENT_EXECUTE_PUBLIC,"JailCamera_OnCameraChange",e)},prev(){const e=this.currentCamera.id;return e-1<0?this.onChangeCamera(this.cameras.length-1):this.onChangeCamera(e-1)},next(){const e=this.currentCamera.id;return e+1>=this.cameras.length?this.onChangeCamera(0):this.onChangeCamera(e+1)},setCurrentCamera(e){const[a,i]=typeof e=="string"?JSON.parse(e):e;this.currentCamera={id:a,label:i}},setCameras(e){const a=typeof e=="string"?JSON.parse(e):e;this.cameras=a},startUpdateTime(){this.timeTimer=setInterval(()=>{this.time=C(new Date)},30*1e3)},stopUpdateTime(){clearInterval(this.timeTimer)},close(){sendClientEvent(gm.EVENT_EXECUTE_PUBLIC,"JailCamera_OnPlayerClose"),window.closeInterface("JailCamera")}}},le=h(q,[["render",X]]);export{le as default};
