import{m as h,B as c,H as p,P as m,W as g,C as u,n as v}from"./index-Bku7SJna.js";import"./vuetify-Ce4WN_Dg.js";import"./overlayscrollbars-CiKU261J.js";import"./echarts-DzoUeqWp.js";var b=Object.defineProperty,f=Object.getOwnPropertyDescriptor,n=(r,t,i,s)=>{for(var e=s>1?void 0:s?f(t,i):t,l=r.length-1,o;l>=0;l--)(o=r[l])&&(e=(s?o(t,i,e):o(e))||e);return s&&e&&b(t,i,e),e};let a=class extends h(c,p){constructor(){super(...arguments),this.aspectRatio=null,this.isVisible=!1,this.isVisibleViewport=!1,this.isVisibleDocument=!0}get url(){var t;return this.convertUrl((t=this.camSettings)==null?void 0:t.stream_url,this.printerUrl)}get webcamStyle(){var i,s,e;const t={transform:this.generateTransform((i=this.camSettings.flip_horizontal)!=null?i:!1,(s=this.camSettings.flip_vertical)!=null?s:!1,(e=this.camSettings.rotation)!=null?e:0),aspectRatio:1.7777777777777777,maxHeight:window.innerHeight-155+"px",maxWidth:"auto"};return this.aspectRatio&&(t.aspectRatio=this.aspectRatio,t.maxWidth=(window.innerHeight-155)*this.aspectRatio+"px"),t}mounted(){document.addEventListener("visibilitychange",this.documentVisibilityChanged)}beforeDestroy(){document.removeEventListener("visibilitychange",this.documentVisibilityChanged),this.stopStream()}startStream(){this.isVisible||this.$refs.webcamUv4lMjpegImage&&this.$refs.webcamUv4lMjpegImage.setAttribute("src",this.url)}stopStream(){this.$refs.webcamUv4lMjpegImage&&(this.$refs.webcamUv4lMjpegImage.removeAttribute("src"),URL.revokeObjectURL(this.url))}documentVisibilityChanged(){const t=document.visibilityState;this.isVisibleDocument=t==="visible",this.isVisibleDocument||this.stopStream(),this.visibilityChanged()}viewportVisibilityChanged(t){this.isVisibleViewport=t,this.visibilityChanged()}visibilityChanged(){if(this.isVisibleViewport&&this.isVisibleDocument){this.startStream();return}this.stopStream()}onload(){this.aspectRatio===null&&this.$refs.webcamUv4lMjpegImage&&(this.aspectRatio=this.$refs.webcamUv4lMjpegImage.naturalWidth/this.$refs.webcamUv4lMjpegImage.naturalHeight)}async urlChanged(){await this.stopStream(),await this.startStream()}};n([m({required:!0})],a.prototype,"camSettings",2);n([m({default:null})],a.prototype,"printerUrl",2);n([g("url")],a.prototype,"urlChanged",1);a=n([u],a);var d=function(){var t=this,i=t._self._c;return t._self._setupProxy,i("div",{staticClass:"d-flex justify-center"},[i("img",{directives:[{name:"observe-visibility",rawName:"v-observe-visibility",value:t.viewportVisibilityChanged,expression:"viewportVisibilityChanged"}],ref:"webcamUv4lMjpegImage",staticClass:"webcamImage",style:t.webcamStyle,attrs:{draggable:"false"},on:{load:t.onload}})])},w=[],y=v(a,d,w,!1,null,"f00ff5d2");const j=y.exports;export{j as default};
