@mapgis/webclient-video-plugin
Version:
1 lines • 23.3 kB
JavaScript
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@mapgis/webclient-common"),require("leaflet"),require("@mapgis/webclient-leaflet-plugin"));else if("function"==typeof define&&define.amd)define(["@mapgis/webclient-common","leaflet","@mapgis/webclient-leaflet-plugin"],t);else{var i="object"==typeof exports?t(require("@mapgis/webclient-common"),require("leaflet"),require("@mapgis/webclient-leaflet-plugin")):t(e["@mapgis/webclient-common"],e.leaflet,e["@mapgis/webclient-leaflet-plugin"]);for(var o in i)("object"==typeof exports?exports:e)[o]=i[o]}}(window,function(e,t,i){return function(e){var t={};function i(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,o){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(o,r,function(t){return e[t]}.bind(null,r));return o},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=3)}([function(t,i){t.exports=e},function(e,i){e.exports=t},function(e,t){e.exports=i},function(e,t,i){"use strict";i.r(t);var o=i(0),r=i(1),n=i(2);class a{constructor(e){e=Object(o.defaultValue)(e,{}),this._videoRegisrationType=Object(o.defaultValue)(e.videoRegistrationType,null),this._calibrationParam=Object(o.defaultValue)(e.calibrationParam,void 0),this._cameraParam=Object(o.defaultValue)(e.cameraParam,void 0)}get videoRegistrationType(){return this._videoRegisrationType}get calibrationParam(){return this._calibrationParam}get cameraParam(){return this._cameraParam}}o.Zondy.VideoRegistrationParam=a;var s=a;class d{constructor(e){if(e=Object(o.defaultValue)(e,{}),this._videoID=Object(o.defaultValue)(e.videoID,null),this._videoName=Object(o.defaultValue)(e.videoName,null),this._videoSource=Object(o.defaultValue)(e.videoSource,null),this._videoSource){if(this._videoSource.videoUrl){switch(this._videoUrl=Object(o.defaultValue)(this._videoSource.videoUrl,null),this._videoProtocol=Object(o.defaultValue)(this._videoSource.protocol,null),this._videoProtocol){case o.VideoSourceType.MP4:this._videoProtocol=o.VideoSourceType.MP4;break;case o.VideoSourceType.HLS:this._videoProtocol=o.VideoSourceType.HLS;break;case o.VideoSourceType.RTMP:this._videoProtocol=o.VideoSourceType.RTMP;break;default:this._videoProtocol=null}this._videoProtocol||(this._videoProtocol=Object(o.getVideoType)(this._videoSource.videoUrl))}}else this._videoProtocol=null,this._videoUrl=null;const t=e.videoRegistrationParam?e.videoRegistrationParam:e;this._videoRegistrationParam=new s(t),this._videoMetaDataVersion=Object(o.defaultValue)(e.version,null)}get videoID(){return this._videoID}get videoName(){return this._videoName}get videoSource(){return this._videoSource}get videoRegistrationParam(){return this._videoRegistrationParam}}o.Zondy.VideoMetaData=d;var l=d;function h(e,t,i){i[1]=t[1]*e[1]+t[2]*e[4],i[2]=t[1]*e[2]+t[2]*e[5],i[0]=t[1]*e[0]+t[2]*e[3]+1*t[0],i[4]=t[4]*e[1]+t[5]*e[4],i[5]=t[4]*e[2]+t[5]*e[5],i[3]=t[4]*e[0]+t[5]*e[3]+1*t[3]}function c(e,t){if(0===e[2]&&0===e[4]&&0!==e[1]&&0!==e[5])return t[0]=-e[0]/e[1],t[1]=1/e[1],t[2]=0,t[3]=-e[3]/e[5],t[4]=0,t[5]=1/e[5],1;const i=e[1]*e[5]-e[2]*e[4],o=Math.max(Math.max(Math.abs(e[1]),Math.abs(e[2])),Math.max(Math.abs(e[4]),Math.abs(e[5])));if(Math.abs(i)<=1e-10*o*o)return 0;const r=1/i;return t[1]=e[5]*r,t[4]=-e[4]*r,t[2]=-e[2]*r,t[5]=e[1]*r,t[0]=(e[2]*e[3]-e[0]*e[5])*r,t[3]=(-e[1]*e[3]+e[0]*e[4])*r,1}function f(e,t,i){return{pdfGeoX:e[0]+t*e[1]+i*e[2],pdfGeoY:e[3]+t*e[4]+i*e[5]}}var u=class{constructor(){this._videoRegistrationParam=null,this._gdalGCPsData=[],this._toGeoTransforms=new Float64Array(6),this._invToGeoTransforms=new Float64Array(6),this._spatialReference=new o.SpatialReference("EPSG:4326")}init(e){this._videoRegistrationParam=new s(e),this._videoRegistrationParam.calibrationParam&&this._videoRegistrationParam.calibrationParam.groundControlPointList?(this._videoRegistrationParam.calibrationParam.groundControlPointList.forEach((e,t)=>{0===t&&e.spatialReference&&(this._spatialReference=e.spatialReference);let{x:i,y:r}=e;if(!this._spatialReference.isGeographic){const t=o.Projection.project(new o.Point({coordinates:[e.x,e.y],spatialReference:this._spatialReference}),new o.SpatialReference({wkid:4326}));i=t.coordinates[0],r=t.coordinates[1]}const n={pszId:e.id,pszInfo:e.description,dfGCPPixel:e.pixelX,dfGCPLine:e.pixelY,dfGCPX:i,dfGCPY:r,dfGCPZ:e.z};this._gdalGCPsData.push(n)}),function(e,t,i){let r=.25;i||(i=!0,r=.25);const n=e.length;if(n<2)return!1;if(2===n)return e[1].dfGCPPixel!==e[0].dfGCPPixel&&e[1].dfGCPLine!==e[0].dfGCPLine&&(t[1]=(e[1].dfGCPX-e[0].dfGCPX)/(e[1].dfGCPPixel-e[0].dfGCPPixel),t[2]=0,t[4]=0,t[5]=(e[1].dfGCPY-e[0].dfGCPY)/(e[1].dfGCPLine-e[0].dfGCPLine),t[0]=e[0].dfGCPX-e[0].dfGCPPixel*t[1]-e[0].dfGCPLine*t[2],t[3]=e[0].dfGCPY-e[0].dfGCPPixel*t[4]-e[0].dfGCPLine*t[5],!0);if(4===n&&e[0].dfGCPLine===e[1].dfGCPLine&&e[2].dfGCPLine===e[3].dfGCPLine&&e[0].dfGCPPixel===e[3].dfGCPPixel&&e[1].dfGCPPixel===e[2].dfGCPPixel&&e[0].dfGCPLine!==e[2].dfGCPLine&&e[0].dfGCPPixel!==e[1].dfGCPPixel&&e[0].dfGCPY===e[1].dfGCPY&&e[2].dfGCPY===e[3].dfGCPY&&e[0].dfGCPX===e[3].dfGCPX&&e[1].dfGCPX===e[2].dfGCPX&&e[0].dfGCPY!==e[2].dfGCPY&&e[0].dfGCPX!==e[1].dfGCPX)return t[1]=(e[1].dfGCPX-e[0].dfGCPX)/(e[1].dfGCPPixel-e[0].dfGCPPixel),t[2]=0,t[4]=0,t[5]=(e[2].dfGCPY-e[1].dfGCPY)/(e[2].dfGCPLine-e[1].dfGCPLine),t[0]=e[0].dfGCPX-e[0].dfGCPPixel*t[1],t[3]=e[0].dfGCPY-e[0].dfGCPLine*t[5],!0;let a=e[0].dfGCPPixel,s=e[0].dfGCPPixel,d=e[0].dfGCPLine,l=e[0].dfGCPLine,u=e[0].dfGCPX,p=e[0].dfGCPX,_=e[0].dfGCPY,m=e[0].dfGCPY;for(let t=1;t<n;++t)a=Math.min(a,e[t].dfGCPPixel),s=Math.max(s,e[t].dfGCPPixel),d=Math.min(d,e[t].dfGCPLine),l=Math.max(l,e[t].dfGCPLine),u=Math.min(u,e[t].dfGCPX),p=Math.max(p,e[t].dfGCPX),_=Math.min(_,e[t].dfGCPY),m=Math.max(m,e[t].dfGCPY);if(Math.abs(s-a)<1e-12||Math.abs(l-d)<1e-12||Math.abs(p-u)<1e-12||Math.abs(m-_)<1e-12)return!1;const v=new Float64Array(6),y=new Float64Array(6);v[0]=-a/(s-a),v[1]=1/(s-a),v[2]=0,v[3]=-d/(l-d),v[4]=0,v[5]=1/(l-d),y[0]=-u/(p-u),y[1]=1/(p-u),y[2]=0,y[3]=-_/(m-_),y[4]=0,y[5]=1/(m-_);let P=0,g=0,w=0,C=0,V=0,x=0,b=0,G=0,S=0,E=0,L=0;for(let t=0;t<n;++t){const{pdfGeoX:i,pdfGeoY:o}=f(v,e[t].dfGCPPixel,e[t].dfGCPLine),{pdfGeoX:r,pdfGeoY:n}=f(y,e[t].dfGCPX,e[t].dfGCPY);P+=i,g+=o,w+=i*o,C+=i*i,V+=o*o,x+=r,b+=r*i,G+=r*o,S+=n,E+=n*i,L+=n*o}const T=n*(C*V-w*w)+2*P*g*w-g*g*C-P*P*V;if(0===T)return!1;const M=new Float64Array(6);M[0]=(x*(C*V-w*w)+b*(g*w-P*V)+G*(P*w-g*C))/T,M[3]=(S*(C*V-w*w)+E*(g*w-P*V)+L*(P*w-g*C))/T,M[1]=(x*(g*w-P*V)+b*(n*V-g*g)+G*(P*g-w*n))/T,M[2]=(x*(P*w-g*C)+b*(P*g-n*w)+G*(n*C-P*P))/T,M[4]=(S*(g*w-P*V)+E*(n*V-g*g)+L*(P*g-w*n))/T,M[5]=(S*(P*w-g*C)+E*(P*g-n*w)+L*(n*C-P*P))/T;const I=new Float64Array(6),k=new Float64Array(6);if(!c(y,k))return!1;if(h(v,M,I),h(I,k,t),i){const i=.5*(Math.abs(t[1])+Math.abs(t[2])+Math.abs(t[4])+Math.abs(t[5]));if(0===i)return o.Log.info("dfPixelSize = 0"),!1;for(let a=0;a<n;a++){const n=e[a].dfGCPPixel*t[1]+e[a].dfGCPLine*t[2]+t[0]-e[a].dfGCPX,s=e[a].dfGCPPixel*t[4]+e[a].dfGCPLine*t[5]+t[3]-e[a].dfGCPY;if(Math.abs(n)>r*i||Math.abs(s)>r*i)return o.Log.info(`dfErrorX/dfPixelSize = ${Math.abs(n)/i}, dfErrorY/dfPixelSize = ${Math.abs(s)/i}`),!1}}}(this._gdalGCPsData,this._toGeoTransforms,!0),c(this._toGeoTransforms,this._invToGeoTransforms)):o.Log.error("缺少标定配准转换数据")}pixelCoordToGeoCoord(e){const{pdfGeoX:t,pdfGeoY:i}=f(this._toGeoTransforms,e.x,e.y);return new o.Point({coordinates:[t,i]})}geoCoordToPixelCoord(e){const{pdfGeoX:t,pdfGeoY:i}=f(this._invToGeoTransforms,e.coordinates[0],e.coordinates[1]);return{x:t,y:i}}};class p{}p.getMouseEvent=function(e,t,i){const r=t._spatialReference;let n=void 0;const a=t.toMap({x:e.containerPoint.x,y:e.containerPoint.y});return{mapPoint:n=r&&!r.isGeographic?o.Projection.project(a,r):a,x:e.containerPoint.x,y:e.containerPoint.y,button:e.originalEvent.button,buttons:e.originalEvent.buttons,stopPropagation:e.originalEvent.stopPropagation,timeStamp:e.originalEvent.timeStamp,native:e.originalEvent,type:i}},p.getKeyEvent=function(e,t,i){const o={key:e.originalEvent.key,stopPropagation:e.originalEvent.stopPropagation,timeStamp:e.originalEvent.timeStamp,native:e.originalEvent,type:i};return"key-down"===i&&(o.repeat=e.originalEvent.repeat),o},p.getViewChangeEvent=function(e,t,i){const o={event:e,target:t,type:i};return o.mapView=t,o.scale=t._scale,o.zoom=t._zoom,o.center=t.center,o.extent=t._extent,o},p.getDragEvent=function(e,t,i,o,r){return{x:e.originalEvent.layerX,y:e.originalEvent.layerY,button:void 0!==r?r:e.originalEvent.button,buttons:e.originalEvent.buttons,cancelable:e.originalEvent.cancelable,origin:i,stopPropagation:e.originalEvent.stopPropagation,timeStamp:e.originalEvent.timeStamp,native:e.originalEvent,action:o,type:"drag"}};var _=p;var m=class extends o.LayerView{onAdd(){const e=this.layer,t=this.innerView;return this.view._initVideoMetaData(e.source),this._videoMapViewContainer=document.getElementById(this.view._viewId),this.innerLayer=this._addVideoMapInnerLayer(e,t,{view:this.view}),this.innerLayer.commonLayerId=e.id,new Promise(t=>{this.innerLayer.then(()=>{this._addInnerLayerDOM(e),t(this)})})}onRemove(){return this._hlsPlayer&&(this._hlsPlayer.dispose(),this._hlsPlayer=void 0),this._rtmpPlayer&&(this._rtmpPlayer.dispose(),this._rtmpPlayer=void 0),this._videoHtml&&(this._videoHtml.remove(),this._videoHtml=void 0),this.layer=void 0,Promise.resolve(this)}_addVideoMapInnerLayer(e,t,i){this.url=e.url;const r=this.layer.source.videoSource.videoUrl,n=Object(o.getVideoType)(r);return new Promise((e,t)=>{if(n!==o.VideoSourceType.videoPlayer){if(n===o.VideoSourceType.videoHTML)return this._width=r.videoWidth,this._height=r.videoHeight,void e(this);this._videoHtml=document.createElement("video"),this._videoHtml.id="video",this._videoHtml.style.position="absolute",this._videoHtml.style.zIndex="0",this._videoMapViewContainer.appendChild(this._videoHtml),this._videoHtml.style.width="100%",this._videoHtml.style.height="100%",n===o.VideoSourceType.MP4?(this._videoHtml.crossOrigin="anonymous",this._videoHtml.autoplay=!0,this._videoHtml.loop=!0,this._videoHtml.src=r,this._videoHtml.play(),this._videoHtml.controls=!0):n===o.VideoSourceType.HLS?(this._hlsPlayer=videojs(this._videoHtml,{fluid:!0}),this._hlsPlayer.src({type:"application/x-mpegURL",src:r}),this._hlsPlayer.load(r),this._hlsPlayer.play(),this._hlsPlayer.loop(!0),this._hlsPlayer.el().querySelector("video").controls=!0):n===o.VideoSourceType.RTMP&&(this._rtmpPlayer=videojs(this._videoHtml,{sources:[{src:r,type:"rtmp/flv"}],fluid:!0},()=>{this._rtmpPlayer.play(),this._rtmpPlayer.loop(!0)}),this._rtmpPlayer.on("play",()=>{this._rtmpPlayer.width(this._rtmpPlayer.videoWidth()),this._rtmpPlayer.height(this._rtmpPlayer.videoHeight()),this._videoHtml.onloadeddata()})),this._videoHtml.onloadeddata=(()=>{this.loadStatus=o.LoadStatus.loaded,this.loaded=!0,this._width=this._videoHtml.videoWidth?this._videoHtml.videoWidth:this._rtmpPlayer?this._rtmpPlayer.videoWidth():1,this._height=this._videoHtml.videoHeight?this._videoHtml.videoHeight:this._rtmpPlayer?this._rtmpPlayer.videoHeight():1,this.fire("layerview-created",{}),this._videoHtml.style.width=this._width,this._videoHtml.style.height=this._height,e(this)}),this._videoHtml.onerror=(()=>{let e="未知错误";switch(this._videoHtml.error.code){case 1:e="视频加载中断";break;case 2:e="网络链接错误";break;case 3:e="视频解码失败";break;case 4:e="不支持的视频"}o.Log.error(`出现错误:${e}错误代码:${this._videoHtml.error.code}`),this.loadStatus=o.LoadStatus.failed,t(this._videoHtml.error)})}else r.on("play",()=>{this._width=r.videoWidth(),this._height=r.videoHeight(),e(this)})})}_addInnerLayerDOM(){const e=this._videoHtml,t=this._width,i=this._height,{width:o,height:r,left:n,top:a,scale:s}=function(e,t,i){const o=i.clientWidth,r=i.clientHeight,n=Math.min(o/e,r/t),a=e*n,s=t*n;return{width:a,height:s,left:(o-a)/2,top:(r-s)/2,scale:n}}(t,i,this._videoMapViewContainer);this._videoPixelScale=s,this.view._videoPixelScale=s,e&&(e.style.left=`${n}px`,e.style.top=`${a}px`,e.style.width=`${o}px`,e.style.height=`${r}px`),this._fabricCanvas||(this._fabricContainer=document.createElement("div"),this._fabricContainer.id="fabricContainer",this._fabricContainer.style.position="absolute",this._fabricContainer.style.top=`${a}px`,this._fabricContainer.style.left=`${n}px`,this._fabricContainer.style.width=`${o}px`,this._fabricContainer.style.height=`${r}px`,this._videoMapViewContainer.appendChild(this._fabricContainer),this._fabricContainer.style.pointerEvents="none")}onUpdate(e){return Promise.resolve(this)}};class v extends o.BaseView{constructor(e){super(e),e=Object(o.defaultValue)(e,{}),this._viewId=e.viewId,this._mapViewId=`${this._viewId}-video-map-view`,this._videoMapViewContainer=document.getElementById(this._viewId),this._spatialReference=null,this.engineType="video",this.popup=Object(o.defaultValue)(e.popup,void 0),this._waitAddEventStorage=[]}_processLayerLoad(e){if(!e)return;const{addDetail:t}=e;this._prePromise||(this._prePromise=Promise.resolve()),this._prePromise=this._prePromise.then(()=>this._loadInnerView(t).then(()=>(this._waitAddEventStorage=this._waitAddEventStorage.concat(t),Object(o.allSettled)(this._waitAddEventStorage.map((e,t)=>{const{added:i,sourceTarget:o}=e,r=this._findGroupLayerViewById(o.id);let n;if(r){const e=i.filter(e=>"video"!==e.type);n=r.addMany(e).then(e=>{r._fireLayerViewCreatedByLayerViews(e),r._reorderByLayerViews&&r._reorderByLayerViews(e)})}else n=null;return this._waitAddEventStorage.length===t&&(this._waitAddEventStorage=[]),n})))).catch(e=>{o.Log.info(e)}))}_loadInnerView(e){let t,i;return new Promise((o,r)=>{if(this._innerView)o();else{for(const o in e){const r=e[o],{added:n,sourceTarget:a}=r;for(const e in n){"video"===n[e].type&&(t=n[e],i=this._findGroupLayerViewById(a.id));break}if(t)break}t?i.addMany([t]).then(e=>{i._fireLayerViewCreatedByLayerViews(e),i._reorderByLayerViews&&i._reorderByLayerViews(e),this._initView(),o()}):(this._waitAddEventStorage=this._waitAddEventStorage.concat(e),r("请先添加一个VideoMapLayer图层!"))}})}_destroyInnerView(){this._innerView&&(this._innerView.remove(),this._innerView=null)}_initView(){this._getContainerSize();const e=r.CRS.Simple;e.transformation=new r.Transformation(1,0,1,0),e.projection.project=(e=>{const t=this._videoPixelCoordTransforms.geoCoordToPixelCoord(new o.Point({coordinates:[e.lng,e.lat]})),i={x:t.x*this._videoPixelScale,y:t.y*this._videoPixelScale};return new r.Point(i.x,i.y)}),e.projection.unproject=(e=>{const t={x:e.x/this._videoPixelScale,y:e.y/this._videoPixelScale},i=this._videoPixelCoordTransforms.pixelCoordToGeoCoord(t);return new r.LatLng(i.coordinates[1],i.coordinates[0])});this._innerView=r.map("fabricContainer",{crs:e,attributionControl:!1,zoomControl:!1,doubleClickZoom:!1,dragging:!1,trackResize:!1,keyboard:!1,scrollWheelZoom:!1,rotate:!1}),this._disableInnerViewAction(),this._innerView.whenReady(()=>{this._getSize(),this._initPopup();const e=this.toMap({x:0,y:0}),t=this.toMap({x:this.width,y:0}),i=this.toMap({x:this.width,y:this.height}),o=this.toMap({x:0,y:this.height}),r=Math.max(e.coordinates[0],t.coordinates[0],i.coordinates[0],o.coordinates[0]),n=Math.min(e.coordinates[0],t.coordinates[0],i.coordinates[0],o.coordinates[0]),a=Math.max(e.coordinates[1],t.coordinates[1],i.coordinates[1],o.coordinates[1]),s=[[Math.min(e.coordinates[1],t.coordinates[1],i.coordinates[1],o.coordinates[1]),n],[a,r]];this._innerView.fitBounds(s),this._innerView._container.style.backgroundColor="#00000000",this._initViewEvent()});const t=this.toMap({x:0,y:0});this._innerView.setView([t.coordinates[1],t.coordinates[0]],0)}_initVideoMetaData(e){const t=Object(o.defaultValue)(e,{});this._videoPixelCoordTransforms||(this._videoPixelCoordTransforms=new u),this._videoMetaData=new l(t),this._videoPixelCoordTransforms.init(this._videoMetaData.videoRegistrationParam),this._spatialReference=this._videoPixelCoordTransforms._spatialReference}_initViewEvent(){const e=this;this._clickStore=null,this._dragParams={isDrag:!1,origin:null,action:"",button:null,dragMouseUp:!1},e.fire(o.ViewEventType.loaded,{}),this._innerView.on("click",t=>{e._dragParams.dragMouseUp?e._dragParams.dragMouseUp=!1:(e._clickStore=setTimeout(function(){e._clickStore&&e.fire(o.ViewEventType.click,_.getMouseEvent(t,e))},300),e.fire(o.ViewEventType.immediateClick,_.getMouseEvent(t,e)))}),this._innerView.on("contextmenu",t=>{e._clickStore=setTimeout(function(){e._clickStore&&e.fire(o.ViewEventType.click,_.getMouseEvent(t,e))},300),e.fire(o.ViewEventType.immediateClick,_.getMouseEvent(t,e))}),this._innerView.on("dblclick",t=>{e._clickStore&&(clearTimeout(this._clickStore),e._clickStore=null),e.fire(o.ViewEventType.doubleClick,_.getMouseEvent(t,e))}),this._innerView.on("mousedown",t=>{e.fire(o.ViewEventType.pointerDown,_.getMouseEvent(t,e)),this._dragParams.isDrag||(this._dragParams.origin={x:t.originalEvent.layerX,y:t.originalEvent.layerY},this._dragParams.button=t.originalEvent.button,this._dragParams.action="mouse-down",this._dragParams.isDrag=!1)}),this._innerView.on("mouseup",t=>{e.fire(o.ViewEventType.pointerUp,_.getMouseEvent(t,e)),e._dragParams.isDrag&&"update"===this._dragParams.action&&(this._dragParams.action="end",this._innerView.dragging._enabled||(e._dragParams.dragMouseUp=!0),e.fire(o.ViewEventType.drag,_.getDragEvent(t,e,e._dragParams.origin,this._dragParams.action))),e._dragParams.isDrag=!1,e._dragParams.origin=null,e._dragParams.action="",e._dragParams.button=null}),this._innerView.on("mousemove",t=>{e.fire(o.ViewEventType.pointerMove,_.getMouseEvent(t,e)),e._dragParams.isDrag?(e.fire(o.ViewEventType.drag,_.getDragEvent(t,e,e._dragParams.origin,e._dragParams.action,e._dragParams.button)),e._dragParams.action="update"):"mouse-down"===this._dragParams.action&&(this._dragParams.action="start",e._dragParams.isDrag=!0)}),this._innerView.on("keydown",t=>{e.fire(o.ViewEventType.keyDown,_.getKeyEvent(t,e,o.ViewEventType.keyDown))}),this._innerView.on("keyup",t=>{e.fire(o.ViewEventType.keyUp,_.getKeyEvent(t,e,o.ViewEventType.keyUp))}),this._innerView.on("movestart",()=>{e.stationary=!1}),this._innerView.on("zoom",t=>{e.fire(o.ViewEventType.zoom,{zoom:t.target._zoom,event:t})}),this._innerView.on("zoomend",t=>{e.fire(o.ViewEventType.viewChange,_.getViewChangeEvent(t,e))}),this._innerView.on("moveend",t=>{e.fire(o.ViewEventType.viewChange,_.getViewChangeEvent(t,e)),e.stationary=!0}),this._innerView.on("resize",t=>{e.fire(o.ViewEventType.resize,{oldWidth:t.oldSize.x,oldHeight:t.oldSize.y,width:t.newSize.x,height:t.newSize.y}),e._initSize()}),this.fire(o.ViewEventType.viewCreated,this._innerView)}_initPopup(){this.popup=new n.Popup({view:this})}_initSize(){}toMap(e){let t;if(this._videoPixelCoordTransforms){const i={x:e.x/this._videoPixelScale,y:e.y/this._videoPixelScale};t=this._videoPixelCoordTransforms.pixelCoordToGeoCoord(i)}else t=new o.Point({coordinates:[e.x,e.y]});return t}toScreen(e){let t;if(this._videoPixelCoordTransforms){const i=this._videoPixelCoordTransforms.geoCoordToPixelCoord(e);t={x:i.x*this._videoPixelScale,y:i.y*this._videoPixelScale}}else t={x:e[0],y:e[1]};return t}hitTest(e){let t=[];return t=this.preferCanvas?this._hitTestCanvas(e):this._hitTestSVG(e)}_hitTestSVG(e){const t=this,i=[],r=this._innerView._container.getBoundingClientRect();document.elementsFromPoint(r.x+e.x,r.y+e.y).forEach(e=>{e&&e._leaflet_id&&e.classList.contains("leaflet-interactive")&&e._leaflet_id&&i.push(t._innerView._targets[e._leaflet_id])});const n=[];return i.forEach(t=>{const i=this._getInnerLayerId(t);if(Object(o.isNull)(i.commonLayerId))return;const r=this.getLayer(i.commonLayerId);let a=null;if(r.type===o.LayerType.IGSFeature||r.type===o.LayerType.GeoJSON){a=this._getLayerView(r)._featureSetCache.filter(e=>{if(e.id===i.commonFeatureId)return e})}else r.type===o.LayerType.graphics&&(a=r.graphics.filter(e=>{if(e.id===i.commonFeatureId)return e}));const s={graphic:a&&a.items.length>0?a.items[0]:null,layer:r,mapPoint:this.toMap(e),type:"graphic"};n.push(s)}),n}_hitTestCanvas(e){const t=[],i=this._innerView._renderer,r={clientX:e.x,clientY:e.y},n=i._map.mouseEventToContainerPoint(r);for(let e=i._dragFirst;e;e=e.next){const o=e.layer;o.options.interactive&&o._containsPoint(n)&&("click"!==r.type&&"preclick"!==r.type||!i._map._draggableMoved(o))&&o.feature&&t.push(o)}const a=[];return t.forEach(t=>{const i=this._getInnerLayerId(t);if(Object(o.isNull)(i.commonLayerId))return;const r=this.getLayer(i.commonLayerId);let n=null;if(r.type===o.LayerType.IGSFeature||r.type===o.LayerType.GeoJSON){n=this.getLayerView(r)._featureSetCache.filter(e=>{if(e.id===i.commonFeatureId)return e})}else r.type===o.LayerType.graphics&&(n=r.graphics.filter(e=>{if(e.id===i.commonFeatureId)return e}));const s={graphic:n.items.length>0?n.items[0]:null,layer:r,mapPoint:this.toMap(e),type:"graphic"};a.push(s)}),a}_getInnerLayerId(e){let t;const i=function(e){let t,o;for(const r in e){if(void 0!==e[r].commonLayerId){t=e[r].commonLayerId,o=e[r].commonFeatureId;break}{const n=i(e[r]._eventParents);t=n.commonLayerId,o=n.commonFeatureId}}return{commonLayerId:t,commonFeatureId:o}};return t=void 0===e.commonLayerId?i(e._eventParents):{commonLayerId:e.commonLayerId,commonFeatureId:e.commonFeatureId}}_mapActionControl(e,t){this._innerView&&"video-map-active"===e&&(document.getElementById("fabricContainer").style.pointerEvents=t?"auto":"none")}_getSize(){const e=this._innerView.getSize();this.width=e.x,this.height=e.y}_getContainerSize(){const e=document.getElementById(this._viewId);this.width=e.clientWidth,this.height=e.clientHeight}_disableInnerViewAction(){this._innerView.dragging.disable(),this._innerView.doubleClickZoom.disable(),this._innerView.scrollWheelZoom=!1}_createLayerView(e){if(!this.layerViewFilter._isFilterById(e.id))return null;let t;return"video"===e.type?t=new m({view:this,layer:e}):e.type!==o.LayerType.graphics&&e.type!==o.LayerType.GeoJSON&&e.type!==o.LayerType.group||(t=Object(n.getLayerView)(this,e)),t}flyTo(){}}Object.defineProperties(v.prototype,{viewId:{get(){return this._viewId},set(){}},spatialReference:{get(){return this._spatialReference},set(){}}});var y=v;var P=class extends n.SketchEditorLeaflet{constructor(e){super(e)}};i.d(t,"VideoMapView",function(){return y}),i.d(t,"MapView",function(){return y}),i.d(t,"VideoSketchEditor",function(){return P}),i.d(t,"SketchEditor",function(){return P}),o.zondy.video={},o.zondy.video.MapView=y,o.zondy.video.tool={},o.zondy.video.tool.sketch={},o.zondy.video.tool.sketch.SketchEditor=P,o.zondy.video.VERSION="17.6.0",o.Zondy.VideoMapView=y,o.Zondy.VideoSketchEditor=P,o.Zondy.VideoPluginVersion=o.zondy.video.VERSION}])});