mmg
Version:
Simple markers for Modest Maps
6 lines • 92.2 kB
JavaScript
/*
Copyright (c) 2010-2012, CloudMade, Vladimir Agafonkin
Leaflet is a modern open-source JavaScript library for interactive maps.
http://leaflet.cloudmade.com
*/
(function(){var e,t;typeof exports!="undefined"?e=exports:(e={},t=window.L,e.noConflict=function(){return window.L=t,e},window.L=e),e.version="0.4",e.Util={extend:function(e){var t=Array.prototype.slice.call(arguments,1);for(var n=0,r=t.length,i;n<r;n++){i=t[n]||{};for(var s in i)i.hasOwnProperty(s)&&(e[s]=i[s])}return e},bind:function(e,t){var n=arguments.length>2?Array.prototype.slice.call(arguments,2):null;return function(){return e.apply(t,n||arguments)}},stamp:function(){var e=0,t="_leaflet_id";return function(n){return n[t]=n[t]||++e,n[t]}}(),requestAnimFrame:function(){function t(e){window.setTimeout(e,1e3/60)}var n=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||t;return function(r,i,s,o){r=i?e.Util.bind(r,i):r;if(!s||n!==t)return n.call(window,r,o);r()}}(),cancelAnimFrame:function(){var e=window.cancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||clearTimeout;return function(t){if(!t)return;return e.call(window,t)}}(),limitExecByInterval:function(e,t,n){var r,i;return function s(){var o=arguments;if(r){i=!0;return}r=!0,setTimeout(function(){r=!1,i&&(s.apply(n,o),i=!1)},t),e.apply(n,o)}},falseFn:function(){return!1},formatNum:function(e,t){var n=Math.pow(10,t||5);return Math.round(e*n)/n},setOptions:function(t,n){return t.options=e.Util.extend({},t.options,n),t.options},getParamString:function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n+"="+e[n]);return"?"+t.join("&")},template:function(e,t){return e.replace(/\{ *([\w_]+) *\}/g,function(e,n){var r=t[n];if(!t.hasOwnProperty(n))throw Error("No value provided for variable "+e);return r})},emptyImageUrl:"data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="},e.Class=function(){},e.Class.extend=function(t){var n=function(){this.initialize&&this.initialize.apply(this,arguments)},r=function(){};r.prototype=this.prototype;var i=new r;i.constructor=n,n.prototype=i;for(var s in this)this.hasOwnProperty(s)&&s!=="prototype"&&(n[s]=this[s]);return t.statics&&(e.Util.extend(n,t.statics),delete t.statics),t.includes&&(e.Util.extend.apply(null,[i].concat(t.includes)),delete t.includes),t.options&&i.options&&(t.options=e.Util.extend({},i.options,t.options)),e.Util.extend(i,t),n},e.Class.include=function(t){e.Util.extend(this.prototype,t)},e.Class.mergeOptions=function(t){e.Util.extend(this.prototype.options,t)},e.Mixin={},e.Mixin.Events={addEventListener:function(e,t,n){var r=this._leaflet_events=this._leaflet_events||{};return r[e]=r[e]||[],r[e].push({action:t,context:n||this}),this},hasEventListeners:function(e){var t="_leaflet_events";return t in this&&e in this[t]&&this[t][e].length>0},removeEventListener:function(e,t,n){if(!this.hasEventListeners(e))return this;for(var r=0,i=this._leaflet_events,s=i[e].length;r<s;r++)if(i[e][r].action===t&&(!n||i[e][r].context===n))return i[e].splice(r,1),this;return this},fireEvent:function(t,n){if(!this.hasEventListeners(t))return this;var r=e.Util.extend({type:t,target:this},n),i=this._leaflet_events[t].slice();for(var s=0,o=i.length;s<o;s++)i[s].action.call(i[s].context||this,r);return this}},e.Mixin.Events.on=e.Mixin.Events.addEventListener,e.Mixin.Events.off=e.Mixin.Events.removeEventListener,e.Mixin.Events.fire=e.Mixin.Events.fireEvent,function(){var t=navigator.userAgent.toLowerCase(),n=!!window.ActiveXObject,r=t.indexOf("webkit")!==-1,i=typeof orientation!="undefined"?!0:!1,s=t.indexOf("android")!==-1,o=window.opera;e.Browser={ie:n,ie6:n&&!window.XMLHttpRequest,webkit:r,webkit3d:r&&"WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix,gecko:t.indexOf("gecko")!==-1,opera:o,android:s,mobileWebkit:i&&r,mobileOpera:i&&o,mobile:i,touch:function(){var e=!1,t="ontouchstart";if(t in document.documentElement)return!0;var n=document.createElement("div");return!n.setAttribute||!n.removeAttribute?!1:(n.setAttribute(t,"return;"),typeof n[t]=="function"&&(e=!0),n.removeAttribute(t),n=null,e)}()}}(),e.Point=function(e,t,n){this.x=n?Math.round(e):e,this.y=n?Math.round(t):t},e.Point.prototype={add:function(e){return this.clone()._add(e)},_add:function(e){return this.x+=e.x,this.y+=e.y,this},subtract:function(e){return this.clone()._subtract(e)},_subtract:function(e){return this.x-=e.x,this.y-=e.y,this},divideBy:function(t,n){return new e.Point(this.x/t,this.y/t,n)},multiplyBy:function(t){return new e.Point(this.x*t,this.y*t)},distanceTo:function(e){var t=e.x-this.x,n=e.y-this.y;return Math.sqrt(t*t+n*n)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},clone:function(){return new e.Point(this.x,this.y)},toString:function(){return"Point("+e.Util.formatNum(this.x)+", "+e.Util.formatNum(this.y)+")"}},e.Bounds=e.Class.extend({initialize:function(e,t){if(!e)return;var n=e instanceof Array?e:[e,t];for(var r=0,i=n.length;r<i;r++)this.extend(n[r])},extend:function(t){!this.min&&!this.max?(this.min=new e.Point(t.x,t.y),this.max=new e.Point(t.x,t.y)):(this.min.x=Math.min(t.x,this.min.x),this.max.x=Math.max(t.x,this.max.x),this.min.y=Math.min(t.y,this.min.y),this.max.y=Math.max(t.y,this.max.y))},getCenter:function(t){return new e.Point((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},contains:function(t){var n,r;return t instanceof e.Bounds?(n=t.min,r=t.max):n=r=t,n.x>=this.min.x&&r.x<=this.max.x&&n.y>=this.min.y&&r.y<=this.max.y},intersects:function(e){var t=this.min,n=this.max,r=e.min,i=e.max,s=i.x>=t.x&&r.x<=n.x,o=i.y>=t.y&&r.y<=n.y;return s&&o}}),e.Transformation=e.Class.extend({initialize:function(e,t,n,r){this._a=e,this._b=t,this._c=n,this._d=r},transform:function(e,t){return this._transform(e.clone(),t)},_transform:function(e,t){return t=t||1,e.x=t*(this._a*e.x+this._b),e.y=t*(this._c*e.y+this._d),e},untransform:function(t,n){return n=n||1,new e.Point((t.x/n-this._b)/this._a,(t.y/n-this._d)/this._c)}}),e.DomUtil={get:function(e){return typeof e=="string"?document.getElementById(e):e},getStyle:function(e,t){var n=e.style[t];!n&&e.currentStyle&&(n=e.currentStyle[t]);if(!n||n==="auto"){var r=document.defaultView.getComputedStyle(e,null);n=r?r[t]:null}return n==="auto"?null:n},getViewportOffset:function(t){var n=0,r=0,i=t,s=document.body;do{n+=i.offsetTop||0,r+=i.offsetLeft||0;if(i.offsetParent===s&&e.DomUtil.getStyle(i,"position")==="absolute")break;if(e.DomUtil.getStyle(i,"position")==="fixed"){n+=s.scrollTop||0,r+=s.scrollLeft||0;break}i=i.offsetParent}while(i);i=t;do{if(i===s)break;n-=i.scrollTop||0,r-=i.scrollLeft||0,i=i.parentNode}while(i);return new e.Point(r,n)},create:function(e,t,n){var r=document.createElement(e);return r.className=t,n&&n.appendChild(r),r},disableTextSelection:function(){document.selection&&document.selection.empty&&document.selection.empty(),this._onselectstart||(this._onselectstart=document.onselectstart,document.onselectstart=e.Util.falseFn)},enableTextSelection:function(){document.onselectstart=this._onselectstart,this._onselectstart=null},hasClass:function(e,t){return e.className.length>0&&RegExp("(^|\\s)"+t+"(\\s|$)").test(e.className)},addClass:function(t,n){e.DomUtil.hasClass(t,n)||(t.className+=(t.className?" ":"")+n)},removeClass:function(e,t){e.className=e.className.replace(/(\S+)\s*/g,function(e,n){return n===t?"":e}).replace(/^\s+/,"")},setOpacity:function(t,n){e.Browser.ie?t.style.filter+=n!==1?"alpha(opacity="+Math.round(n*100)+")":"":t.style.opacity=n},testProp:function(e){var t=document.documentElement.style;for(var n=0;n<e.length;n++)if(e[n]in t)return e[n];return!1},getTranslateString:function(t){return e.DomUtil.TRANSLATE_OPEN+t.x+"px,"+t.y+"px"+e.DomUtil.TRANSLATE_CLOSE},getScaleString:function(t,n){var r=e.DomUtil.getTranslateString(n),i=" scale("+t+") ",s=e.DomUtil.getTranslateString(n.multiplyBy(-1));return r+i+s},setPosition:function(t,n){t._leaflet_pos=n,e.Browser.webkit3d?(t.style[e.DomUtil.TRANSFORM]=e.DomUtil.getTranslateString(n),t.style["-webkit-backface-visibility"]="hidden"):(t.style.left=n.x+"px",t.style.top=n.y+"px")},getPosition:function(e){return e._leaflet_pos}},e.Util.extend(e.DomUtil,{TRANSITION:e.DomUtil.testProp(["transition","webkitTransition","OTransition","MozTransition","msTransition"]),TRANSFORM:e.DomUtil.testProp(["transformProperty","WebkitTransform","OTransform","MozTransform","msTransform"]),TRANSLATE_OPEN:"translate"+(e.Browser.webkit3d?"3d(":"("),TRANSLATE_CLOSE:e.Browser.webkit3d?",0)":")"}),e.LatLng=function(e,t,n){var r=parseFloat(e),i=parseFloat(t);if(isNaN(r)||isNaN(i))throw Error("Invalid LatLng object: ("+e+", "+t+")");n!==!0&&(r=Math.max(Math.min(r,90),-90),i=(i+180)%360+(i<-180||i===180?180:-180)),this.lat=r,this.lng=i},e.Util.extend(e.LatLng,{DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI,MAX_MARGIN:1e-9}),e.LatLng.prototype={equals:function(t){if(t instanceof e.LatLng){var n=Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng));return n<=e.LatLng.MAX_MARGIN}return!1},toString:function(){return"LatLng("+e.Util.formatNum(this.lat)+", "+e.Util.formatNum(this.lng)+")"},distanceTo:function(t){var n=6378137,r=e.LatLng.DEG_TO_RAD,i=(t.lat-this.lat)*r,s=(t.lng-this.lng)*r,o=this.lat*r,u=t.lat*r,a=Math.sin(i/2),f=Math.sin(s/2),l=a*a+f*f*Math.cos(o)*Math.cos(u);return n*2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l))}},e.LatLngBounds=e.Class.extend({initialize:function(e,t){if(!e)return;var n=e instanceof Array?e:[e,t];for(var r=0,i=n.length;r<i;r++)this.extend(n[r])},extend:function(t){return t instanceof e.LatLng?!this._southWest&&!this._northEast?(this._southWest=new e.LatLng(t.lat,t.lng,!0),this._northEast=new e.LatLng(t.lat,t.lng,!0)):(this._southWest.lat=Math.min(t.lat,this._southWest.lat),this._southWest.lng=Math.min(t.lng,this._southWest.lng),this._northEast.lat=Math.max(t.lat,this._northEast.lat),this._northEast.lng=Math.max(t.lng,this._northEast.lng)):t instanceof e.LatLngBounds&&(this.extend(t._southWest),this.extend(t._northEast)),this},pad:function(t){var n=this._southWest,r=this._northEast,i=Math.abs(n.lat-r.lat)*t,s=Math.abs(n.lng-r.lng)*t;return new e.LatLngBounds(new e.LatLng(n.lat-i,n.lng-s),new e.LatLng(r.lat+i,r.lng+s))},getCenter:function(){return new e.LatLng((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new e.LatLng(this._northEast.lat,this._southWest.lng,!0)},getSouthEast:function(){return new e.LatLng(this._southWest.lat,this._northEast.lng,!0)},contains:function(t){var n=this._southWest,r=this._northEast,i,s;return t instanceof e.LatLngBounds?(i=t.getSouthWest(),s=t.getNorthEast()):i=s=t,i.lat>=n.lat&&s.lat<=r.lat&&i.lng>=n.lng&&s.lng<=r.lng},intersects:function(e){var t=this._southWest,n=this._northEast,r=e.getSouthWest(),i=e.getNorthEast(),s=i.lat>=t.lat&&r.lat<=n.lat,o=i.lng>=t.lng&&r.lng<=n.lng;return s&&o},toBBoxString:function(){var e=this._southWest,t=this._northEast;return[e.lng,e.lat,t.lng,t.lat].join(",")},equals:function(e){return e?this._southWest.equals(e.getSouthWest())&&this._northEast.equals(e.getNorthEast()):!1}}),e.Projection={},e.Projection.SphericalMercator={MAX_LATITUDE:85.0511287798,project:function(t){var n=e.LatLng.DEG_TO_RAD,r=this.MAX_LATITUDE,i=Math.max(Math.min(r,t.lat),-r),s=t.lng*n,o=i*n;return o=Math.log(Math.tan(Math.PI/4+o/2)),new e.Point(s,o)},unproject:function(t,n){var r=e.LatLng.RAD_TO_DEG,i=t.x*r,s=(2*Math.atan(Math.exp(t.y))-Math.PI/2)*r;return new e.LatLng(s,i,n)}},e.Projection.LonLat={project:function(t){return new e.Point(t.lng,t.lat)},unproject:function(t,n){return new e.LatLng(t.y,t.x,n)}},e.CRS={latLngToPoint:function(e,t){var n=this.projection.project(e),r=this.scale(t);return this.transformation._transform(n,r)},pointToLatLng:function(e,t,n){var r=this.scale(t),i=this.transformation.untransform(e,r);return this.projection.unproject(i,n)},project:function(e){return this.projection.project(e)},scale:function(e){return 256*Math.pow(2,e)}},e.CRS.EPSG3857=e.Util.extend({},e.CRS,{code:"EPSG:3857",projection:e.Projection.SphericalMercator,transformation:new e.Transformation(.5/Math.PI,.5,-0.5/Math.PI,.5),project:function(e){var t=this.projection.project(e),n=6378137;return t.multiplyBy(n)}}),e.CRS.EPSG900913=e.Util.extend({},e.CRS.EPSG3857,{code:"EPSG:900913"}),e.CRS.EPSG4326=e.Util.extend({},e.CRS,{code:"EPSG:4326",projection:e.Projection.LonLat,transformation:new e.Transformation(1/360,.5,-1/360,.5)}),e.Map=e.Class.extend({includes:e.Mixin.Events,options:{crs:e.CRS.EPSG3857,fadeAnimation:e.DomUtil.TRANSITION&&!e.Browser.android,trackResize:!0},initialize:function(t,n){n=e.Util.setOptions(this,n),this._initContainer(t),this._initLayout(),this._initHooks(),this._initEvents(),n.maxBounds&&this.setMaxBounds(n.maxBounds),n.center&&typeof n.zoom!="undefined"&&this.setView(n.center,n.zoom,!0),this._initLayers(n.layers)},setView:function(e,t){return this._resetView(e,this._limitZoom(t)),this},setZoom:function(e){return this.setView(this.getCenter(),e)},zoomIn:function(){return this.setZoom(this._zoom+1)},zoomOut:function(){return this.setZoom(this._zoom-1)},fitBounds:function(e){var t=this.getBoundsZoom(e);return this.setView(e.getCenter(),t)},fitWorld:function(){var t=new e.LatLng(-60,-170),n=new e.LatLng(85,179);return this.fitBounds(new e.LatLngBounds(t,n))},panTo:function(e){return this.setView(e,this._zoom)},panBy:function(e){return this.fire("movestart"),this._rawPanBy(e),this.fire("move"),this.fire("moveend")},setMaxBounds:function(e){this.options.maxBounds=e;if(!e)return this._boundsMinZoom=null,this;var t=this.getBoundsZoom(e,!0);return this._boundsMinZoom=t,this._loaded&&(this._zoom<t?this.setView(e.getCenter(),t):this.panInsideBounds(e)),this},panInsideBounds:function(t){var n=this.getBounds(),r=this.project(n.getSouthWest()),i=this.project(n.getNorthEast()),s=this.project(t.getSouthWest()),o=this.project(t.getNorthEast()),u=0,a=0;return i.y<o.y&&(a=o.y-i.y),i.x>o.x&&(u=o.x-i.x),r.y>s.y&&(a=s.y-r.y),r.x<s.x&&(u=s.x-r.x),this.panBy(new e.Point(u,a,!0))},addLayer:function(t,n){var r=e.Util.stamp(t);if(this._layers[r])return this;this._layers[r]=t,t.options&&!isNaN(t.options.maxZoom)&&(this._layersMaxZoom=Math.max(this._layersMaxZoom||0,t.options.maxZoom)),t.options&&!isNaN(t.options.minZoom)&&(this._layersMinZoom=Math.min(this._layersMinZoom||Infinity,t.options.minZoom)),this.options.zoomAnimation&&e.TileLayer&&t instanceof e.TileLayer&&(this._tileLayersNum++,this._tileLayersToLoad++,t.on("load",this._onTileLayerLoad,this));var i=function(){t.onAdd(this,n),this.fire("layeradd",{layer:t})};return this._loaded?i.call(this):this.on("load",i,this),this},removeLayer:function(t){var n=e.Util.stamp(t);if(!this._layers[n])return;return t.onRemove(this),delete this._layers[n],this.options.zoomAnimation&&e.TileLayer&&t instanceof e.TileLayer&&(this._tileLayersNum--,this._tileLayersToLoad--,t.off("load",this._onTileLayerLoad,this)),this.fire("layerremove",{layer:t})},hasLayer:function(t){var n=e.Util.stamp(t);return this._layers.hasOwnProperty(n)},invalidateSize:function(){var t=this.getSize();this._sizeChanged=!0,this.options.maxBounds&&this.setMaxBounds(this.options.maxBounds);if(!this._loaded)return this;var n=t.subtract(this.getSize()).divideBy(2,!0);return this._rawPanBy(n),this.fire("move"),clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(e.Util.bind(this.fire,this,"moveend"),200),this},addHandler:function(e,t){if(!t)return;return this[e]=new t(this),this.options[e]&&this[e].enable(),this},getCenter:function(e){var t=this.getSize().divideBy(2),n=this._getTopLeftPoint().add(t);return this.unproject(n,this._zoom,e)},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds(),n=this.unproject(new e.Point(t.min.x,t.max.y),this._zoom,!0),r=this.unproject(new e.Point(t.max.x,t.min.y),this._zoom,!0);return new e.LatLngBounds(n,r)},getMinZoom:function(){var e=this.options.minZoom||0,t=this._layersMinZoom||0,n=this._boundsMinZoom||0;return Math.max(e,t,n)},getMaxZoom:function(){var e=typeof this.options.maxZoom=="undefined"?Infinity:this.options.maxZoom,t=typeof this._layersMaxZoom=="undefined"?Infinity:this._layersMaxZoom;return Math.min(e,t)},getBoundsZoom:function(t,n){var r=this.getSize(),i=this.options.minZoom||0,s=this.getMaxZoom(),o=t.getNorthEast(),u=t.getSouthWest(),a,f,l,c=!0;n&&i--;do i++,f=this.project(o,i),l=this.project(u,i),a=new e.Point(f.x-l.x,l.y-f.y),n?c=a.x<r.x||a.y<r.y:c=a.x<=r.x&&a.y<=r.y;while(c&&i<=s);return c&&n?null:n?i:i-1},getSize:function(){if(!this._size||this._sizeChanged)this._size=new e.Point(this._container.clientWidth,this._container.clientHeight),this._sizeChanged=!1;return this._size},getPixelBounds:function(){var t=this._getTopLeftPoint();return new e.Bounds(t,t.add(this.getSize()))},getPixelOrigin:function(){return this._initialTopLeftPoint},getPanes:function(){return this._panes},getContainer:function(){return this._container},mouseEventToContainerPoint:function(t){return e.DomEvent.getMousePosition(t,this._container)},mouseEventToLayerPoint:function(e){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e))},mouseEventToLatLng:function(e){return this.layerPointToLatLng(this.mouseEventToLayerPoint(e))},containerPointToLayerPoint:function(t){return t.subtract(e.DomUtil.getPosition(this._mapPane))},layerPointToContainerPoint:function(t){return t.add(e.DomUtil.getPosition(this._mapPane))},layerPointToLatLng:function(e){return this.unproject(e.add(this._initialTopLeftPoint))},latLngToLayerPoint:function(e){return this.project(e)._round()._subtract(this._initialTopLeftPoint)},containerPointToLatLng:function(e){return this.layerPointToLatLng(this.containerPointToLayerPoint(e))},latLngToContainerPoint:function(e){return this.layerPointToContainerPoint(this.latLngToLayerPoint(e))},project:function(e,t){return t=typeof t=="undefined"?this._zoom:t,this.options.crs.latLngToPoint(e,t)},unproject:function(e,t,n){return t=typeof t=="undefined"?this._zoom:t,this.options.crs.pointToLatLng(e,t,n)},_initContainer:function(t){var n=this._container=e.DomUtil.get(t);if(n._leaflet)throw Error("Map container is already initialized.");n._leaflet=!0},_initLayout:function(){var t=this._container;t.innerHTML="",t.className+=" leaflet-container",e.Browser.touch&&(t.className+=" leaflet-touch"),this.options.fadeAnimation&&(t.className+=" leaflet-fade-anim");var n=e.DomUtil.getStyle(t,"position");n!=="absolute"&&n!=="relative"&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var e=this._panes={};this._mapPane=e.mapPane=this._createPane("leaflet-map-pane",this._container),this._tilePane=e.tilePane=this._createPane("leaflet-tile-pane",this._mapPane),this._objectsPane=e.objectsPane=this._createPane("leaflet-objects-pane",this._mapPane),e.shadowPane=this._createPane("leaflet-shadow-pane"),e.overlayPane=this._createPane("leaflet-overlay-pane"),e.markerPane=this._createPane("leaflet-marker-pane"),e.popupPane=this._createPane("leaflet-popup-pane")},_createPane:function(t,n){return e.DomUtil.create("div",t,n||this._objectsPane)},_initializers:[],_initHooks:function(){var e,t;for(e=0,t=this._initializers.length;e<t;e++)this._initializers[e].call(this)},_resetView:function(t,n,r,i){var s=this._zoom!==n;i||(this.fire("movestart"),s&&this.fire("zoomstart")),this._zoom=n,this._initialTopLeftPoint=this._getNewTopLeftPoint(t),r?this._initialTopLeftPoint._add(e.DomUtil.getPosition(this._mapPane)):e.DomUtil.setPosition(this._mapPane,new e.Point(0,0)),this._tileLayersToLoad=this._tileLayersNum,this.fire("viewreset",{hard:!r}),this.fire("move"),(s||i)&&this.fire("zoomend"),this.fire("moveend"),this._loaded||(this._loaded=!0,this.fire("load"))},_initLayers:function(e){e=e?e instanceof Array?e:[e]:[],this._layers={},this._tileLayersNum=0;var t,n;for(t=0,n=e.length;t<n;t++)this.addLayer(e[t])},_rawPanBy:function(t){var n=e.DomUtil.getPosition(this._mapPane).subtract(t);e.DomUtil.setPosition(this._mapPane,n)},_initEvents:function(){if(!e.DomEvent)return;e.DomEvent.addListener(this._container,"click",this._onMouseClick,this);var t=["dblclick","mousedown","mouseenter","mouseleave","mousemove","contextmenu"],n,r;for(n=0,r=t.length;n<r;n++)e.DomEvent.addListener(this._container,t[n],this._fireMouseEvent,this);this.options.trackResize&&e.DomEvent.addListener(window,"resize",this._onResize,this)},_onResize:function(){e.Util.requestAnimFrame(this.invalidateSize,this,!1,this._container)},_onMouseClick:function(e){if(!this._loaded||this.dragging&&this.dragging.moved())return;this.fire("pre"+e.type),this._fireMouseEvent(e)},_fireMouseEvent:function(t){if(!this._loaded)return;var n=t.type;n=n==="mouseenter"?"mouseover":n==="mouseleave"?"mouseout":n;if(!this.hasEventListeners(n))return;n==="contextmenu"&&e.DomEvent.preventDefault(t);var r=this.mouseEventToContainerPoint(t),i=this.containerPointToLayerPoint(r),s=this.layerPointToLatLng(i);this.fire(n,{latlng:s,layerPoint:i,containerPoint:r,originalEvent:t})},_onTileLayerLoad:function(){this._tileLayersToLoad--,this._tileLayersNum&&!this._tileLayersToLoad&&this._tileBg&&(clearTimeout(this._clearTileBgTimer),this._clearTileBgTimer=setTimeout(e.Util.bind(this._clearTileBg,this),500))},_getTopLeftPoint:function(){if(!this._loaded)throw Error("Set map center and zoom first.");var t=e.DomUtil.getPosition(this._mapPane);return this._initialTopLeftPoint.subtract(t)},_getNewTopLeftPoint:function(e){var t=this.getSize().divideBy(2);return this.project(e)._subtract(t)._round()},_limitZoom:function(e){var t=this.getMinZoom(),n=this.getMaxZoom();return Math.max(t,Math.min(n,e))}}),e.Map.addInitHook=function(e){var t=Array.prototype.slice.call(arguments,1),n=typeof e=="function"?e:function(){this[e].apply(this,t)};this.prototype._initializers.push(n)},e.Projection.Mercator={MAX_LATITUDE:85.0840591556,R_MINOR:6356752.3142,R_MAJOR:6378137,project:function(t){var n=e.LatLng.DEG_TO_RAD,r=this.MAX_LATITUDE,i=Math.max(Math.min(r,t.lat),-r),s=this.R_MAJOR,o=this.R_MINOR,u=t.lng*n*s,a=i*n,f=o/s,l=Math.sqrt(1-f*f),c=l*Math.sin(a);c=Math.pow((1-c)/(1+c),l*.5);var h=Math.tan(.5*(Math.PI*.5-a))/c;return a=-o*Math.log(h),new e.Point(u,a)},unproject:function(t,n){var r=e.LatLng.RAD_TO_DEG,i=this.R_MAJOR,s=this.R_MINOR,o=t.x*r/i,u=s/i,a=Math.sqrt(1-u*u),f=Math.exp(-t.y/s),l=Math.PI/2-2*Math.atan(f),c=15,h=1e-7,p=c,d=.1,v;while(Math.abs(d)>h&&--p>0)v=a*Math.sin(l),d=Math.PI/2-2*Math.atan(f*Math.pow((1-v)/(1+v),.5*a))-l,l+=d;return new e.LatLng(l*r,o,n)}},e.CRS.EPSG3395=e.Util.extend({},e.CRS,{code:"EPSG:3395",projection:e.Projection.Mercator,transformation:function(){var t=e.Projection.Mercator,n=t.R_MAJOR,r=t.R_MINOR;return new e.Transformation(.5/(Math.PI*n),.5,-0.5/(Math.PI*r),.5)}()}),e.TileLayer=e.Class.extend({includes:e.Mixin.Events,options:{minZoom:0,maxZoom:18,tileSize:256,subdomains:"abc",errorTileUrl:"",attribution:"",opacity:1,scheme:"xyz",continuousWorld:!1,noWrap:!1,zoomOffset:0,zoomReverse:!1,detectRetina:!1,unloadInvisibleTiles:e.Browser.mobile,updateWhenIdle:e.Browser.mobile,reuseTiles:!1},initialize:function(t,n){n=e.Util.setOptions(this,n),n.detectRetina&&window.devicePixelRatio>1&&n.maxZoom>0&&(n.tileSize=Math.floor(n.tileSize/2),n.zoomOffset++,n.minZoom>0&&n.minZoom--,this.options.maxZoom--),this._url=t;var r=this.options.subdomains;typeof r=="string"&&(this.options.subdomains=r.split(""))},onAdd:function(t,n){this._map=t,this._insertAtTheBottom=n,this._initContainer(),this._createTileProto(),t.on("viewreset",this._resetCallback,this),t.on("moveend",this._update,this),this.options.updateWhenIdle||(this._limitedUpdate=e.Util.limitExecByInterval(this._update,150,this),t.on("move",this._limitedUpdate,this)),this._reset(),this._update()},onRemove:function(e){e._panes.tilePane.removeChild(this._container),e.off("viewreset",this._resetCallback,this),e.off("moveend",this._update,this),this.options.updateWhenIdle||e.off("move",this._limitedUpdate,this),this._container=null,this._map=null},getAttribution:function(){return this.options.attribution},setOpacity:function(t){this.options.opacity=t,this._map&&this._updateOpacity();var n,r=this._tiles;if(e.Browser.webkit)for(n in r)r.hasOwnProperty(n)&&(r[n].style.webkitTransform+=" translate(0,0)")},_updateOpacity:function(){e.DomUtil.setOpacity(this._container,this.options.opacity)},_initContainer:function(){var t=this._map._panes.tilePane,n=t.firstChild;if(!this._container||t.empty)this._container=e.DomUtil.create("div","leaflet-layer"),this._insertAtTheBottom&&n?t.insertBefore(this._container,n):t.appendChild(this._container),this.options.opacity<1&&this._updateOpacity()},_resetCallback:function(e){this._reset(e.hard)},_reset:function(e){var t,n=this._tiles;for(t in n)n.hasOwnProperty(t)&&this.fire("tileunload",{tile:n[t]});this._tiles={},this.options.reuseTiles&&(this._unusedTiles=[]),e&&this._container&&(this._container.innerHTML=""),this._initContainer()},_update:function(t){if(this._map._panTransition&&this._map._panTransition._inProgress)return;var n=this._map.getPixelBounds(),r=this._map.getZoom(),i=this.options.tileSize;if(r>this.options.maxZoom||r<this.options.minZoom)return;var s=new e.Point(Math.floor(n.min.x/i),Math.floor(n.min.y/i)),o=new e.Point(Math.floor(n.max.x/i),Math.floor(n.max.y/i)),u=new e.Bounds(s,o);this._addTilesFromCenterOut(u),(this.options.unloadInvisibleTiles||this.options.reuseTiles)&&this._removeOtherTiles(u)},_addTilesFromCenterOut:function(t){var n=[],r=t.getCenter(),i,s;for(i=t.min.y;i<=t.max.y;i++)for(s=t.min.x;s<=t.max.x;s++)s+":"+i in this._tiles||n.push(new e.Point(s,i));n.sort(function(e,t){return e.distanceTo(r)-t.distanceTo(r)});var o=document.createDocumentFragment();this._tilesToLoad=n.length;var u,a;for(u=0,a=this._tilesToLoad;u<a;u++)this._addTile(n[u],o);this._container.appendChild(o)},_removeOtherTiles:function(e){var t,n,r,i,s;for(i in this._tiles)this._tiles.hasOwnProperty(i)&&(t=i.split(":"),n=parseInt(t[0],10),r=parseInt(t[1],10),(n<e.min.x||n>e.max.x||r<e.min.y||r>e.max.y)&&this._removeTile(i))},_removeTile:function(t){var n=this._tiles[t];this.fire("tileunload",{tile:n,url:n.src}),n.parentNode===this._container&&this._container.removeChild(n),this.options.reuseTiles&&this._unusedTiles.push(n),n.src=e.Util.emptyImageUrl,delete this._tiles[t]},_addTile:function(t,n){var r=this._getTilePos(t),i=this._map.getZoom(),s=t.x+":"+t.y,o=Math.pow(2,this._getOffsetZoom(i));if(!this.options.continuousWorld){if(!this.options.noWrap)t.x=(t.x%o+o)%o;else if(t.x<0||t.x>=o){this._tilesToLoad--;return}if(t.y<0||t.y>=o){this._tilesToLoad--;return}}var u=this._getTile();e.DomUtil.setPosition(u,r),this._tiles[s]=u,this.options.scheme==="tms"&&(t.y=o-t.y-1),this._loadTile(u,t,i),n.appendChild(u)},_getOffsetZoom:function(e){var t=this.options;return e=t.zoomReverse?t.maxZoom-e:e,e+t.zoomOffset},_getTilePos:function(e){var t=this._map.getPixelOrigin(),n=this.options.tileSize;return e.multiplyBy(n).subtract(t)},getTileUrl:function(t,n){var r=this.options.subdomains,i=(t.x+t.y)%r.length,s=this.options.subdomains[i];return e.Util.template(this._url,e.Util.extend({s:s,z:this._getOffsetZoom(n),x:t.x,y:t.y},this.options))},_createTileProto:function(){var t=this._tileImg=e.DomUtil.create("img","leaflet-tile");t.galleryimg="no";var n=this.options.tileSize;t.style.width=n+"px",t.style.height=n+"px"},_getTile:function(){if(this.options.reuseTiles&&this._unusedTiles.length>0){var e=this._unusedTiles.pop();return this._resetTile(e),e}return this._createTile()},_resetTile:function(e){},_createTile:function(){var t=this._tileImg.cloneNode(!1);return t.onselectstart=t.onmousemove=e.Util.falseFn,t},_loadTile:function(e,t,n){e._layer=this,e.onload=this._tileOnLoad,e.onerror=this._tileOnError,e.src=this.getTileUrl(t,n)},_tileLoaded:function(){this._tilesToLoad--,this._tilesToLoad||this.fire("load")},_tileOnLoad:function(e){var t=this._layer;this.className+=" leaflet-tile-loaded",t.fire("tileload",{tile:this,url:this.src}),t._tileLoaded()},_tileOnError:function(e){var t=this._layer;t.fire("tileerror",{tile:this,url:this.src});var n=t.options.errorTileUrl;n&&(this.src=n),t._tileLoaded()}}),e.TileLayer.WMS=e.TileLayer.extend({defaultWmsParams:{service:"WMS",request:"GetMap",version:"1.1.1",layers:"",styles:"",format:"image/jpeg",transparent:!1},initialize:function(t,n){this._url=t;var r=e.Util.extend({},this.defaultWmsParams);r.width=r.height=this.options.tileSize;for(var i in n)this.options.hasOwnProperty(i)||(r[i]=n[i]);this.wmsParams=r,e.Util.setOptions(this,n)},onAdd:function(t,n){var r=parseFloat(this.wmsParams.version)>=1.3?"crs":"srs";this.wmsParams[r]=t.options.crs.code,e.TileLayer.prototype.onAdd.call(this,t,n)},getTileUrl:function(t,n){var r=this._map,i=r.options.crs,s=this.options.tileSize,o=t.multiplyBy(s),u=o.add(new e.Point(s,s)),a=r.unproject(o,n,!0),f=r.unproject(u,n,!0),l=i.project(a),c=i.project(f),h=[l.x,c.y,c.x,l.y].join(",");return this._url+e.Util.getParamString(this.wmsParams)+"&bbox="+h}}),e.TileLayer.Canvas=e.TileLayer.extend({options:{async:!1},initialize:function(t){e.Util.setOptions(this,t)},redraw:function(){var e,t=this._tiles;for(e in t)t.hasOwnProperty(e)&&this._redrawTile(t[e])},_redrawTile:function(e){this.drawTile(e,e._tilePoint,e._zoom)},_createTileProto:function(){var t=this._canvasProto=e.DomUtil.create("canvas","leaflet-tile"),n=this.options.tileSize;t.width=n,t.height=n},_createTile:function(){var t=this._canvasProto.cloneNode(!1);return t.onselectstart=t.onmousemove=e.Util.falseFn,t},_loadTile:function(e,t,n){e._layer=this,e._tilePoint=t,e._zoom=n,this.drawTile(e,t,n),this.options.async||this.tileDrawn(e)},drawTile:function(e,t,n){},tileDrawn:function(e){this._tileOnLoad.call(e)}}),e.ImageOverlay=e.Class.extend({includes:e.Mixin.Events,initialize:function(e,t){this._url=e,this._bounds=t},onAdd:function(e){this._map=e,this._image||this._initImage(),e._panes.overlayPane.appendChild(this._image),e.on("viewreset",this._reset,this),this._reset()},onRemove:function(e){e.getPanes().overlayPane.removeChild(this._image),e.off("viewreset",this._reset,this)},_initImage:function(){this._image=e.DomUtil.create("img","leaflet-image-layer"),this._image.style.visibility="hidden",e.Util.extend(this._image,{galleryimg:"no",onselectstart:e.Util.falseFn,onmousemove:e.Util.falseFn,onload:e.Util.bind(this._onImageLoad,this),src:this._url})},_reset:function(){var t=this._image,n=this._map.latLngToLayerPoint(this._bounds.getNorthWest()),r=this._map.latLngToLayerPoint(this._bounds.getSouthEast()).subtract(n);e.DomUtil.setPosition(t,n),t.style.width=r.x+"px",t.style.height=r.y+"px"},_onImageLoad:function(){this._image.style.visibility="",this.fire("load")}}),e.Icon=e.Class.extend({options:{className:""},initialize:function(t){e.Util.setOptions(this,t)},createIcon:function(){return this._createIcon("icon")},createShadow:function(){return this._createIcon("shadow")},_createIcon:function(e){var t=this._getIconUrl(e);if(!t)return null;var n=this._createImg(t);return this._setIconStyles(n,e),n},_setIconStyles:function(e,t){var n=this.options,r=n[t+"Size"],i=n.iconAnchor;!i&&r&&(i=r.divideBy(2,!0)),t==="shadow"&&i&&n.shadowOffset&&i._add(n.shadowOffset),e.className="leaflet-marker-"+t+" "+n.className,i&&(e.style.marginLeft=-i.x+"px",e.style.marginTop=-i.y+"px"),r&&(e.style.width=r.x+"px",e.style.height=r.y+"px")},_createImg:function(t){var n;return e.Browser.ie6?(n=document.createElement("div"),n.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+t+'")'):(n=document.createElement("img"),n.src=t),n},_getIconUrl:function(e){return this.options[e+"Url"]}}),e.Icon.Default=e.Icon.extend({options:{iconSize:new e.Point(25,41),iconAnchor:new e.Point(13,41),popupAnchor:new e.Point(0,-33),shadowSize:new e.Point(41,41)},_getIconUrl:function(t){var n=e.Icon.Default.imagePath;if(!n)throw Error("Couldn't autodetect L.Icon.Default.imagePath, set it manually.");return n+"/marker-"+t+".png"}}),e.Icon.Default.imagePath=function(){var e=document.getElementsByTagName("script"),t=/\/?leaflet[\-\._]?([\w\-\._]*)\.js\??/,n,r,i,s;for(n=0,r=e.length;n<r;n++){i=e[n].src,s=i.match(t);if(s)return i.split(t)[0]+"/images"}}(),e.Marker=e.Class.extend({includes:e.Mixin.Events,options:{icon:new e.Icon.Default,title:"",clickable:!0,draggable:!1,zIndexOffset:0,opacity:1},initialize:function(t,n){e.Util.setOptions(this,n),this._latlng=t},onAdd:function(e){this._map=e,e.on("viewreset",this._reset,this),this._initIcon(),this._reset()},onRemove:function(e){this._removeIcon(),this.closePopup&&this.closePopup(),e.off("viewreset",this._reset,this),this._map=null},getLatLng:function(){return this._latlng},setLatLng:function(e){this._latlng=e,this._reset(),this._popup&&this._popup.setLatLng(e)},setZIndexOffset:function(e){this.options.zIndexOffset=e,this._reset()},setIcon:function(e){this._map&&this._removeIcon(),this.options.icon=e,this._map&&(this._initIcon(),this._reset())},_initIcon:function(){var e=this.options;this._icon||(this._icon=e.icon.createIcon(),e.title&&(this._icon.title=e.title),this._initInteraction(),this._updateOpacity()),this._shadow||(this._shadow=e.icon.createShadow());var t=this._map._panes;t.markerPane.appendChild(this._icon),this._shadow&&t.shadowPane.appendChild(this._shadow)},_removeIcon:function(){var e=this._map._panes;e.markerPane.removeChild(this._icon),this._shadow&&e.shadowPane.removeChild(this._shadow),this._icon=this._shadow=null},_reset:function(){var t=this._icon;if(!t)return;var n=this._map.latLngToLayerPoint(this._latlng).round();e.DomUtil.setPosition(t,n),this._shadow&&e.DomUtil.setPosition(this._shadow,n),t.style.zIndex=n.y+this.options.zIndexOffset},_initInteraction:function(){if(!this.options.clickable)return;var t=this._icon,n=["dblclick","mousedown","mouseover","mouseout"];t.className+=" leaflet-clickable",e.DomEvent.addListener(t,"click",this._onMouseClick,this);for(var r=0;r<n.length;r++)e.DomEvent.addListener(t,n[r],this._fireMouseEvent,this);e.Handler.MarkerDrag&&(this.dragging=new e.Handler.MarkerDrag(this),this.options.draggable&&this.dragging.enable())},_onMouseClick:function(t){e.DomEvent.stopPropagation(t);if(this.dragging&&this.dragging.moved())return;if(this._map.dragging&&this._map.dragging.moved())return;this.fire(t.type,{originalEvent:t})},_fireMouseEvent:function(t){this.fire(t.type,{originalEvent:t}),t.type!=="mousedown"&&e.DomEvent.stopPropagation(t)},setOpacity:function(e){this.options.opacity=e,this._map&&this._updateOpacity()},_updateOpacity:function(t){e.DomUtil.setOpacity(this._icon,this.options.opacity)}}),e.DivIcon=e.Icon.extend({options:{iconSize:new e.Point(12,12),className:"leaflet-div-icon"},createIcon:function(){var e=document.createElement("div");return this._setIconStyles(e,"icon"),e},createShadow:function(){return null}}),e.Map.mergeOptions({closePopupOnClick:!0}),e.Popup=e.Class.extend({includes:e.Mixin.Events,options:{minWidth:50,maxWidth:300,maxHeight:null,autoPan:!0,closeButton:!0,offset:new e.Point(0,2),autoPanPadding:new e.Point(5,5),className:""},initialize:function(t,n){e.Util.setOptions(this,t),this._source=n},onAdd:function(e){this._map=e,this._container||this._initLayout(),this._updateContent(),this._container.style.opacity="0",e._panes.popupPane.appendChild(this._container),e.on("viewreset",this._updatePosition,this),e.options.closePopupOnClick&&e.on("preclick",this._close,this),this._update(),this._container.style.opacity="1"},onRemove:function(t){t._panes.popupPane.removeChild(this._container),e.Util.falseFn(this._container.offsetWidth),t.off("viewreset",this._updatePosition,this).off("preclick",this._close,this),this._container.style.opacity="0",this._map=null},setLatLng:function(e){return this._latlng=e,this._update(),this},setContent:function(e){return this._content=e,this._update(),this},_close:function(){var e=this._map;e&&(e._popup=null,e.removeLayer(this).fire("popupclose",{popup:this}))},_initLayout:function(){var t="leaflet-popup",n=this._container=e.DomUtil.create("div",t+" "+this.options.className),r;this.options.closeButton&&(r=this._closeButton=e.DomUtil.create("a",t+"-close-button",n),r.href="#close",e.DomEvent.addListener(r,"click",this._onCloseButtonClick,this));var i=this._wrapper=e.DomUtil.create("div",t+"-content-wrapper",n);e.DomEvent.disableClickPropagation(i),this._contentNode=e.DomUtil.create("div",t+"-content",i),e.DomEvent.addListener(this._contentNode,"mousewheel",e.DomEvent.stopPropagation),this._tipContainer=e.DomUtil.create("div",t+"-tip-container",n),this._tip=e.DomUtil.create("div",t+"-tip",this._tipContainer)},_update:function(){if(!this._map)return;this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan()},_updateContent:function(){if(!this._content)return;typeof this._content=="string"?this._contentNode.innerHTML=this._content:(this._contentNode.innerHTML="",this._contentNode.appendChild(this._content)),this.fire("contentupdate")},_updateLayout:function(){var e=this._contentNode;e.style.width="",e.style.whiteSpace="nowrap";var t=e.offsetWidth;t=Math.min(t,this.options.maxWidth),t=Math.max(t,this.options.minWidth),e.style.width=t+1+"px",e.style.whiteSpace="",e.style.height="";var n=e.offsetHeight,r=this.options.maxHeight,i=" leaflet-popup-scrolled";r&&n>r?(e.style.height=r+"px",e.className+=i):e.className=e.className.replace(i,""),this._containerWidth=this._container.offsetWidth},_updatePosition:function(){var e=this._map.latLngToLayerPoint(this._latlng);this._containerBottom=-e.y-this.options.offset.y,this._containerLeft=e.x-Math.round(this._containerWidth/2)+this.options.offset.x,this._container.style.bottom=this._containerBottom+"px",this._container.style.left=this._containerLeft+"px"},_adjustPan:function(){if(!this.options.autoPan)return;var t=this._map,n=this._container.offsetHeight,r=this._containerWidth,i=new e.Point(this._containerLeft,-n-this._containerBottom),s=t.layerPointToContainerPoint(i),o=new e.Point(0,0),u=this.options.autoPanPadding,a=t.getSize();s.x<0&&(o.x=s.x-u.x),s.x+r>a.x&&(o.x=s.x+r-a.x+u.x),s.y<0&&(o.y=s.y-u.y),s.y+n>a.y&&(o.y=s.y+n-a.y+u.y),(o.x||o.y)&&t.panBy(o)},_onCloseButtonClick:function(t){this._close(),e.DomEvent.stop(t)}}),e.Marker.include({openPopup:function(){return this._popup&&this._map&&(this._popup.setLatLng(this._latlng),this._map.openPopup(this._popup)),this},closePopup:function(){return this._popup&&this._popup._close(),this},bindPopup:function(t,n){var r=this.options.icon.options.popupAnchor||new e.Point(0,0);return n&&n.offset&&(r=r.add(n.offset)),n=e.Util.extend({offset:r},n),this._popup||this.on("click",this.openPopup,this),this._popup=(new e.Popup(n,this)).setContent(t),this},unbindPopup:function(){return this._popup&&(this._popup=null,this.off("click",this.openPopup)),this}}),e.Map.include({openPopup:function(e){return this.closePopup(),this._popup=e,this.addLayer(e).fire("popupopen",{popup:this._popup})},closePopup:function(){return this._popup&&this._popup._close(),this}}),e.LayerGroup=e.Class.extend({initialize:function(e){this._layers={};var t,n;if(e)for(t=0,n=e.length;t<n;t++)this.addLayer(e[t])},addLayer:function(t){var n=e.Util.stamp(t);return this._layers[n]=t,this._map&&this._map.addLayer(t),this},removeLayer:function(t){var n=e.Util.stamp(t);return delete this._layers[n],this._map&&this._map.removeLayer(t),this},clearLayers:function(){return this._iterateLayers(this.removeLayer,this),this},invoke:function(e){var t=Array.prototype.slice.call(arguments,1),n,r;for(n in this._layers)this._layers.hasOwnProperty(n)&&(r=this._layers[n],r[e]&&r[e].apply(r,t));return this},onAdd:function(e){this._map=e,this._iterateLayers(e.addLayer,e)},onRemove:function(e){this._iterateLayers(e.removeLayer,e),this._map=null},_iterateLayers:function(e,t){for(var n in this._layers)this._layers.hasOwnProperty(n)&&e.call(t,this._layers[n])}}),e.FeatureGroup=e.LayerGroup.extend({includes:e.Mixin.Events,addLayer:function(t){this._initEvents(t),e.LayerGroup.prototype.addLayer.call(this,t),this._popupContent&&t.bindPopup&&t.bindPopup(this._popupContent)},bindPopup:function(e){return this._popupContent=e,this.invoke("bindPopup",e)},setStyle:function(e){return this.invoke("setStyle",e)},getBounds:function(){var t=new e.LatLngBounds;return this._iterateLayers(function(n){t.extend(n instanceof e.Marker?n.getLatLng():n.getBounds())},this),t},_initEvents:function(e){var t=["click","dblclick","mouseover","mouseout"],n,r;for(n=0,r=t.length;n<r;n++)e.on(t[n],this._propagateEvent,this)},_propagateEvent:function(e){e.layer=e.target,e.target=this,this.fire(e.type,e)}}),e.Path=e.Class.extend({includes:[e.Mixin.Events],statics:{CLIP_PADDING:.5},options:{stroke:!0,color:"#0033ff",weight:5,opacity:.5,fill:!1,fillColor:null,fillOpacity:.2,clickable:!0},initialize:function(t){e.Util.setOptions(this,t)},onAdd:function(e){this._map=e,this._initElements(),this._initEvents(),this.projectLatlngs(),this._updatePath(),e.on("viewreset",this.projectLatlngs,this).on("moveend",this._updatePath,this)},onRemove:function(e){this._map=null,e._pathRoot.removeChild(this._container),e.off("viewreset",this.projectLatlngs,this).off("moveend",this._updatePath,this)},projectLatlngs:function(){},setStyle:function(t){return e.Util.setOptions(this,t),this._container&&this._updateStyle(),this},redraw:function(){return this._map&&(this.projectLatlngs(),this._updatePath()),this}}),e.Map.include({_updatePathViewport:function(){var t=e.Path.CLIP_PADDING,n=this.getSize(),r=e.DomUtil.getPosition(this._mapPane),i=r.multiplyBy(-1)._subtract(n.multiplyBy(t)),s=i.add(n.multiplyBy(1+t*2));this._pathViewport=new e.Bounds(i,s)}}),e.Path.SVG_NS="http://www.w3.org/2000/svg",e.Browser.svg=!!document.createElementNS&&!!document.createElementNS(e.Path.SVG_NS,"svg").createSVGRect,e.Path=e.Path.extend({statics:{SVG:e.Browser.svg},getPathString:function(){},_createElement:function(t){return document.createElementNS(e.Path.SVG_NS,t)},_initElements:function(){this._map._initPathRoot(),this._initPath(),this._initStyle()},_initPath:function(){this._container=this._createElement("g"),this._path=this._createElement("path"),this._container.appendChild(this._path),this._map._pathRoot.appendChild(this._container)},_initStyle:function(){this.options.stroke&&(this._path.setAttribute("stroke-linejoin","round"),this._path.setAttribute("stroke-linecap","round")),this.options.fill&&this._path.setAttribute("fill-rule","evenodd"),this._updateStyle()},_updateStyle:function(){this.options.stroke?(this._path.setAttribute("stroke",this.options.color),this._path.setAttribute("stroke-opacity",this.options.opacity),this._path.setAttribute("stroke-width",this.options.weight)):this._path.setAttribute("stroke","none"),this.options.fill?(this._path.setAttribute("fill",this.options.fillColor||this.options.color),this._path.setAttribute("fill-opacity",this.options.fillOpacity)):this._path.setAttribute("fill","none")},_updatePath:function(){var e=this.getPathString();e||(e="M0 0"),this._path.setAttribute("d",e)},_initEvents:function(){if(this.options.clickable){(e.Browser.svg||!e.Browser.vml)&&this._path.setAttribute("class","leaflet-clickable"),e.DomEvent.addListener(this._container,"click",this._onMouseClick,this);var t=["dblclick","mousedown","mouseover","mouseout","mousemove","contextmenu"];for(var n=0;n<t.length;n++)e.DomEvent.addListener(this._container,t[n],this._fireMouseEvent,this)}},_onMouseClick:function(t){if(this._map.dragging&&this._map.dragging.moved())return;t.type==="contextmenu"&&e.DomEvent.preventDefault(t),this._fireMouseEvent(t)},_fireMouseEvent:function(t){if(!this.hasEventListeners(t.type))return;var n=this._map,r=n.mouseEventToContainerPoint(t),i=n.containerPointToLayerPoint(r),s=n.layerPointToLatLng(i);this.fire(t.type,{latlng:s,layerPoint:i,containerPoint:r,originalEvent:t}),e.DomEvent.stopPropagation(t)}}),e.Map.include({_initPathRoot:function(){this._pathRoot||(this._pathRoot=e.Path.prototype._createElement("svg"),this._panes.overlayPane.appendChild(this._pathRoot),this.on("moveend",this._updateSvgViewport),this._updateSvgViewport())},_updateSvgViewport:function(){this._updatePathViewport();var t=this._pathViewport,n=t.min,r=t.max,i=r.x-n.x,s=r.y-n.y,o=this._pathRoot,u=this._panes.overlayPane;e.Browser.webkit&&u.removeChild(o),e.DomUtil.setPosition(o,n),o.setAttribute("width",i),o.setAttribute("height",s),o.setAttribute("viewBox",[n.x,n.y,i,s].join(" ")),e.Browser.webkit&&u.appendChild(o)}}),e.Path.include({bindPopup:function(t,n){if(!this._popup||this._popup.options!==n)this._popup=new e.Popup(n,this);return this._popup.setContent(t),this._openPopupAdded||(this.on("click",this._openPopup,this),this._openPopupAdded=!0),this},_openPopup:function(e){this._popup.setLatLng(e.latlng),this._map.openPopup(this._popup)}}),e.Browser.vml=function(){var e=document.createElement("div");e.innerHTML='<v:shape adj="1"/>';var t=e.firstChild;return t.style.behavior="url(#default#VML)",t&&typeof t.adj=="object"}(),e.Path=e.Browser.svg||!e.Browser.vml?e.Path:e.Path.extend({statics:{VML:!0,CLIP_PADDING:.02},_createElement:function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(e){return document.createElement("<lvml:"+e+' class="lvml">')}}catch(e){return function(e){return document.createElement("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),_initPath:function(){var e=this._container=this._createElement("shape");e.className+=" leaflet-vml-shape"+(this.options.clickable?" leaflet-clickable":""),e.coordsize="1 1",this._path=this._createElement("path"),e.appendChild(this._path),this._map._pathRoot.appendChild(e)},_initStyle:function(){var e=this._container,t,n;this.options.stroke&&(t=this._stroke=this._createElement("stroke"),t.endcap="round",e.appendChild(t)),this.options.fill&&(n=this._fill=this._createElement("fill"),e.appendChild(n)),this._updateStyle()},_updateStyle:function(){var e=this._stroke,t=this._fill,n=this.options,r=this._container;r.stroked=n.stroke,r.filled=n.fill,n.stroke&&(e.weight=n.weight+"px",e.color=n.color,e.opacity=n.opacity),n.fill&&(t.color=n.fillColor||n.color,t.opacity=n.fillOpacity)},_updatePath:function(){var e=this._container.style;e.display="none",this._path.v=this.getPathString()+" ",e.display=""}}),e.Map.include(e.Browser.svg||!e.Browser.vml?{}:{_initPathRoot:function(){if(this._pathRoot)return;var e=this._pathRoot=document.createElement("div");e.className="leaflet-vml-container",this._panes.overlayPane.appendChild(e),this.on("moveend",this._updatePathViewport),this._updatePathViewport()}}),e.Browser.canvas=function(){return!!document.createElement("canvas").getContext}(),e.Path=e.Path.SVG&&!window.L_PREFER_CANVAS||!e.Browser.canvas?e.Path:e.Path.extend({statics:{CANVAS:!0,SVG:!1},_initElements:function(){this._map._initPathRoot(),this._ctx=this._map._canvasCtx},_updateStyle:function(){var e=this.options;e.stroke&&(this._ctx.lineWidth=e.weight,this._ctx.strokeStyle=e.color),e.fill&&(this._ctx.fillStyle=e.fillColor||e.color)},_drawPath:function(){var t,n,r,i,s,o;this._ctx.beginPath();for(t=0,r=this._parts.length;t<r;t++){for(n=0,i=this._parts[t].length;n<i;n++)s=this._parts[t][n],o=(n===0?"move":"line")+"To",this._ctx[o](s.x,s.y);this instanceof e.Polygon&&this._ctx.closePath()}},_checkIfEmpty:function(){return!this._parts.length},_updatePath:function(){if(this._checkIfEmpty())return;var e=this._ctx,t=this.options;this._drawPath(),e.save(),this._updateStyle(),t.fill&&(t.fillOpacity<1&&(e.globalAlpha=t.fillOpacity),e.fill()),t.stroke&&(t.opacity<1&&(e.globalAlpha=t.opacity),e.stroke()),e.restore()},_initEvents:function(){this.options.clickable&&this._map.on("click",this._onClick,this)},_onClick:function(e){this._containsPoint(e.layerPoint)&&this.fire("click",e)},onRemove:function(e){e.off("viewreset",this._projectLatlngs,this).off("moveend",this._updatePath,this).fire("moveend")}}),e.Map.include(e.Path.SVG&&!window.L_PREFER_CANVAS||!e.Browser.canvas?{}:{_initPathRoot:function(){var e=this._pathRoot,t;e||(e=this._pathRoot=document.createElement("canvas"),e.style.position="absolute",t=this._canvasCtx=e.getContext("2d"),t.lineCap="round",t.lineJoin="round",this._panes.overlayPane.appendChild(e),this.on("moveend",this._updateCanvasViewport),this._updateCanvasViewport())},_updateCanvasViewport:function(){this._updatePathViewport();var t=this._pathViewport,n=t.min,r=t.max.subtract(n),i=this._pathRoot;e.DomUtil.setPosition(i,n),i.width=r.x,i.height=r.y,i.getContext("2d").translate(-n.x,-n.y)}}),e.LineUtil={simplify:function(e,t){if(!t||!e.length)return e.slice();var n=t*t;return e=this._reducePoints(e,n),e=this._simplifyDP(e,n),e},pointToSegmentDistance:function(e,t,n){return Math.sqrt(this._sqClosestPointOnSegment(e,t,n,!0))},closestPointOnSegment:function(e,t,n){return this._sqClosestPointOnSegment(e,t,n)},_simplifyDP:function(e,t){var n=e.length,r=typeof Uint8Array!="undefined"?Uint8Array:Array,i=new r(n);i[0]=i[n-1]=1,this._simplifyDPStep(e,i,t,0,n-1);var s,o=[];for(s=0;s<n;s++)i[s]&&o.push(e[s]);return o},_simplifyDPStep:function(e,t,n,r,i){var s=0,o,u,a;for(u=r+1;u<=i-1;u++)a=this._sqClosestPointOnSegment(e[u],e[r],e[i],!0),a>s&&(o=u,s=a);s>n&&(t[o]=1,this._simplifyDPStep(e,t,n,r,o),this._simplifyDPStep(e,t,n,o,i))},_reducePoints:function(e,t){var n=[e[0]];for(var r=1,i=0,s=e.length;r<s;r++)this._sqDist(e[r],e[i])>t&&(n.push(e[r]),i=r);return i<s-1&&n.push(e[s-1]),n},clipSegment:function(e,t,n,r){var i=n.min,s=n.max,o=r?this._lastCode:this._getBitCode(e,n),u=this._getBitCode(t,n);this._lastCode=u;for(;;){if(!(o|u))return[e,t];if(o&u)return!1;var a=o||u,f=this._getEdgeIntersection(e,t,a,n),l=this._getBitCode(f,n);a===o?(e=f,o=l):(t=f,u=l)}},_getEdgeIntersection:function(t,n,r,i){var s=n.x-t.x,o=n.y-t.y,u=i.min,a=i.max;if(r&8)return new