import{o as e,t}from"./vue.runtime.esm-BGP6PPFT.js";import{a as n,c as r,l as i,n as a,r as o,s}from"./_plugin-vue2_normalizer-Vm4EDAeQ.js";import{t as c}from"./browser-1D2tZwAR.js";e();var l=class extends t{camera;crossorigin;streamingElement;cameraTransformStyle=``;animating=!1;status=`disconnected`;cameraName=``;cameraNameMenuItems=[];framesPerSecond=-1;rawCameraUrl=``;onCamera(){this.stopPlayback(),this.checkPlayback()}get apiUrl(){return this.$typedState.config.apiUrl}get cameraStyle(){return{transform:this.cameraTransformStyle||void 0}}get autoRaiseFrameEvent(){return!0}createTransform(){let e=this.streamingElement,{rotation:t,flip_horizontal:n,flip_vertical:r}=this.camera,i=[],{clientWidth:a,clientHeight:o}=e,s=t===0||t===180||o===0||a===0?1:o<a?o/a:a/o;return(s!==1||n)&&i.push(`scaleX(${n?-s:s})`),(s!==1||r)&&i.push(`scaleY(${r?-s:s})`),t!==0&&i.push(`rotate(${t}deg`),i.join(` `)}updateCameraTransformStyle(){requestAnimationFrame(()=>{this.animating&&(this.streamingElement&&(this.cameraTransformStyle=this.createTransform(),this.autoRaiseFrameEvent&&this.$emit(`frame`,this.streamingElement)),this.updateCameraTransformStyle())})}created(){this.animating=!0,this.updateCameraTransformStyle()}mounted(){document.addEventListener(`visibilitychange`,this.checkPlayback,!1),this.checkPlayback()}beforeDestroy(){this.animating=!1,document.removeEventListener(`visibilitychange`,this.checkPlayback),this.stopPlayback()}checkPlayback(){document.hidden?this.stopPlayback():this.startPlayback()}buildAbsoluteUrl(e){let{origin:t}=new URL(document.URL);return new URL(e,t)}updateStatus(e){this.status=e}updateCameraName(e){this.cameraName=e}updateCameraNameMenuItems(e){this.cameraNameMenuItems=e}updateFramesPerSecond(e){this.framesPerSecond=e}updateRawCameraUrl(e){this.rawCameraUrl=e}startPlayback(){}stopPlayback(){}menuItemClick(e){c.debug(`Menu item click`,e)}};a([s({type:Object,required:!0})],l.prototype,`camera`,void 0),a([s({type:String})],l.prototype,`crossorigin`,void 0),a([n(`streamingElement`)],l.prototype,`streamingElement`,void 0),a([o(`camera`)],l.prototype,`onCamera`,null),a([r(`update:status`)],l.prototype,`updateStatus`,null),a([r(`update:camera-name`)],l.prototype,`updateCameraName`,null),a([r(`update:camera-name-menu-items`)],l.prototype,`updateCameraNameMenuItems`,null),a([r(`update:frames-per-second`)],l.prototype,`updateFramesPerSecond`,null),a([r(`update:raw-camera-url`)],l.prototype,`updateRawCameraUrl`,null),l=a([i],l);var u=l;export{u as t};