/*!
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/(function(){if(typeof google>"u"||!google.maps){typeof window<"u"&&window.addEventListener("load",function(){if(typeof google<"u"&&google.maps)l();else{const n=setInterval(function(){typeof google<"u"&&google.maps&&(clearInterval(n),l())},100)}});return}l();function l(){var n=function(t){var o;switch(t){case"thin":o="2px";break;case"medium":o="4px";break;case"thick":o="6px";break;default:o=t}return o},d=function(t){var o,e={};if(document.defaultView&&document.defaultView.getComputedStyle){if(o=t.ownerDocument.defaultView.getComputedStyle(t,""),o)return e.top=parseInt(o.borderTopWidth,10)||0,e.bottom=parseInt(o.borderBottomWidth,10)||0,e.left=parseInt(o.borderLeftWidth,10)||0,e.right=parseInt(o.borderRightWidth,10)||0,e}else if(document.documentElement.currentStyle&&t.currentStyle)return e.top=parseInt(n(t.currentStyle.borderTopWidth),10)||0,e.bottom=parseInt(n(t.currentStyle.borderBottomWidth),10)||0,e.left=parseInt(n(t.currentStyle.borderLeftWidth),10)||0,e.right=parseInt(n(t.currentStyle.borderRightWidth),10)||0,e;return e.top=parseInt(t.style["border-top-width"],10)||0,e.bottom=parseInt(t.style["border-bottom-width"],10)||0,e.left=parseInt(t.style["border-left-width"],10)||0,e.right=parseInt(t.style["border-right-width"],10)||0,e},_=function(t){var o=0,e=0;return t=t||window.event,typeof t.pageX<"u"?(o=t.pageX,e=t.pageY):typeof t.clientX<"u"&&(o=t.clientX+(typeof document.documentElement.scrollLeft<"u"?document.documentElement.scrollLeft:document.body.scrollLeft),e=t.clientY+(typeof document.documentElement.scrollTop<"u"?document.documentElement.scrollTop:document.body.scrollTop)),{left:o,top:e}},h=function(t){for(var o=t.offsetLeft,e=t.offsetTop,i=t.offsetParent;i!==null;)i!==document.body&&i!==document.documentElement&&(o-=i.scrollLeft,e-=i.scrollTop),o+=i.offsetLeft,e+=i.offsetTop,i=i.offsetParent;return{left:o,top:e}},r=function(t,o){if(t&&o)for(var e in o)o.hasOwnProperty(e)&&(t[e]=o[e]);return t},p=function(t,o){typeof o<"u"&&(t.style.opacity=o),typeof t.style.opacity<"u"&&(t.style.filter="alpha(opacity="+t.style.opacity*100+")")};function s(t,o){var e=new google.maps.OverlayView,i=this;e.onAdd=function(){i.init_(t,o)},e.draw=function(){},e.onRemove=function(){},e.setMap(t),this.prjov_=e,google.maps.event.addListener(t,"idle",function(){e.getProjection()})}s.prototype.init_=function(t,o){this.map_=t,o=o||{},this.key_=o.key||"shift",this.key_=this.key_.toLowerCase(),this.borderWidths_=d(this.map_.getDiv()),this.paneDiv_=document.createElement("div"),this.paneDiv_.onselectstart=function(){return!1},r(this.paneDiv_.style,{backgroundColor:"white",opacity:0,cursor:"crosshair"}),r(this.paneDiv_.style,o.paneStyle),r(this.paneDiv_.style,{position:"absolute",overflow:"hidden",zIndex:10001,display:"none"}),this.key_==="shift"&&(this.paneDiv_.style.MozUserSelect="none"),p(this.paneDiv_),this.paneDiv_.style.backgroundColor==="transparent"&&(this.paneDiv_.style.backgroundColor="white",p(this.paneDiv_,0)),this.map_.getDiv().appendChild(this.paneDiv_),this.boxDiv_=document.createElement("div"),r(this.boxDiv_.style,{border:"thin solid #FF0000"}),r(this.boxDiv_.style,o.boxStyle),r(this.boxDiv_.style,{position:"absolute",display:"none"}),p(this.boxDiv_),this.map_.getDiv().appendChild(this.boxDiv_),this.boxBorderWidths_=d(this.boxDiv_);var e=this;this.keyDownListener_=google.maps.event.addDomListener(document,"keydown",function(i){e.onKeyDown_(i)}),this.keyUpListener_=google.maps.event.addDomListener(document,"keyup",function(i){e.onKeyUp_(i)}),this.mouseDownListener_=google.maps.event.addDomListener(this.paneDiv_,"mousedown",function(i){e.onMouseDown_(i)}),this.mouseDownListenerDocument_=google.maps.event.addDomListener(document,"mousedown",function(i){e.onMouseDownDocument_(i)}),this.mouseMoveListener_=google.maps.event.addDomListener(document,"mousemove",function(i){e.onMouseMove_(i)}),this.mouseUpListener_=google.maps.event.addDomListener(document,"mouseup",function(i){e.onMouseUp_(i)}),this.hotKeyDown_=!1,this.dragging_=!1,this.startPt_=null,this.endPt_=null,this.boxMaxX_=null,this.boxMaxY_=null,this.mousePosn_=null,this.mapPosn_=h(this.map_.getDiv()),this.mouseDown_=!1},s.prototype.isHotKeyDown_=function(t){var o;if(t=t||window.event,o=t.shiftKey&&this.key_==="shift"||t.altKey&&this.key_==="alt"||t.ctrlKey&&this.key_==="ctrl",!o)switch(t.keyCode){case 16:this.key_==="shift"&&(o=!0);break;case 17:this.key_==="ctrl"&&(o=!0);break;case 18:this.key_==="alt"&&(o=!0);break}return o},s.prototype.isMouseOnMap_=function(){var t=this.mousePosn_;if(t){var o=this.mapPosn_,e=this.map_.getDiv();return t.left>o.left&&t.left<o.left+e.offsetWidth&&t.top>o.top&&t.top<o.top+e.offsetHeight}else return!1},s.prototype.setPaneVisibility_=function(){if(this.map_&&this.hotKeyDown_&&this.isMouseOnMap_()){var t=this.map_.getDiv();this.paneDiv_.style.left="0px",this.paneDiv_.style.top="0px",this.paneDiv_.style.width=t.offsetWidth-(this.borderWidths_.left+this.borderWidths_.right)+"px",this.paneDiv_.style.height=t.offsetHeight-(this.borderWidths_.top+this.borderWidths_.bottom)+"px",this.paneDiv_.style.display="block",this.boxMaxX_=parseInt(this.paneDiv_.style.width,10)-(this.boxBorderWidths_.left+this.boxBorderWidths_.right),this.boxMaxY_=parseInt(this.paneDiv_.style.height,10)-(this.boxBorderWidths_.top+this.boxBorderWidths_.bottom)}else this.paneDiv_.style.display="none"},s.prototype.onKeyDown_=function(t){var o=this;this.map_&&!this.hotKeyDown_&&this.isHotKeyDown_(t)&&(o.hotKeyDown_=!0,o.setPaneVisibility_(),google.maps.event.trigger(o,"activate"))},s.prototype.getMousePoint_=function(t){var o=_(t),e=new google.maps.Point;return e.x=o.left-this.mapPosn_.left-this.borderWidths_.left,e.y=o.top-this.mapPosn_.top-this.borderWidths_.top,e.x=Math.min(e.x,this.boxMaxX_),e.y=Math.min(e.y,this.boxMaxY_),e.x=Math.max(e.x,0),e.y=Math.max(e.y,0),e},s.prototype.onMouseDown_=function(t){if(this.map_&&this.hotKeyDown_){this.mapPosn_=h(this.map_.getDiv()),this.dragging_=!0,this.startPt_=this.endPt_=this.getMousePoint_(t);var o=this.prjov_.getProjection(),e=o.fromDivPixelToLatLng(this.startPt_);google.maps.event.trigger(this,"dragstart",e)}},s.prototype.onMouseDownDocument_=function(t){this.mouseDown_=!0},s.prototype.onMouseMove_=function(t){if(this.mousePosn_=_(t),this.dragging_){this.endPt_=this.getMousePoint_(t);var o=Math.min(this.startPt_.x,this.endPt_.x),e=Math.min(this.startPt_.y,this.endPt_.y),i=Math.abs(this.startPt_.x-this.endPt_.x),a=Math.abs(this.startPt_.y-this.endPt_.y);this.boxDiv_.style.left=o+"px",this.boxDiv_.style.top=e+"px",this.boxDiv_.style.width=i+"px",this.boxDiv_.style.height=a+"px",this.boxDiv_.style.display="block",google.maps.event.trigger(this,"drag",new google.maps.Point(o,e+a),new google.maps.Point(o+i,e))}else this.mouseDown_||this.setPaneVisibility_()},s.prototype.onMouseUp_=function(t){if(this.mouseDown_=!1,this.dragging_){var o=Math.min(this.startPt_.x,this.endPt_.x),e=Math.min(this.startPt_.y,this.endPt_.y),i=Math.abs(this.startPt_.x-this.endPt_.x),a=Math.abs(this.startPt_.y-this.endPt_.y),f={top:e,left:o,bottom:e+a,right:o+i},u=this.prjov_.getProjection(),g=h(this.map_.getDiv()),m=h(this.prjov_.getPanes().mapPane);o=o+(g.left-m.left),e=e+(g.top-m.top);var y=u.fromDivPixelToLatLng(new google.maps.Point(o,e+a)),v=u.fromDivPixelToLatLng(new google.maps.Point(o+i,e)),c=new google.maps.LatLngBounds(y,v);this.dragging_=!1,this.boxDiv_.style.display="none",window.selectMarkers(c),google.maps.event.trigger(this,"dragend",f)}},s.prototype.onKeyUp_=function(t){this.map_&&this.hotKeyDown_&&(this.hotKeyDown_=!1,this.dragging_=!1,this.boxDiv_.style.display="none",this.paneDiv_.style.display="none",google.maps.event.trigger(this,"deactivate"))},google.maps.Map.prototype.enableKeyDragZoom=function(t){this.dragZoom_=new s(this,t)},google.maps.Map.prototype.disableKeyDragZoom=function(){var t=this.dragZoom_;t&&(google.maps.event.removeListener(t.mouseDownListener_),google.maps.event.removeListener(t.mouseDownListenerDocument_),google.maps.event.removeListener(t.mouseMoveListener_),google.maps.event.removeListener(t.mouseUpListener_),google.maps.event.removeListener(t.keyUpListener_),google.maps.event.removeListener(t.keyDownListener_),this.getDiv().removeChild(t.boxDiv_),this.getDiv().removeChild(t.paneDiv_),this.dragZoom_=null)},google.maps.Map.prototype.keyDragZoomEnabled=function(){return this.dragZoom_!==null},google.maps.Map.prototype.getDragZoomObject=function(){return this.dragZoom_}}})();
