function addInternalMapTileLayer(n,t){var r,f="https://maptiles{s}.geocaching.com";MapTilesEnvironment&&MapTilesEnvironment==="staging"&&(f="https://maptiles-staging.geocaching.com");var i={accessToken:"",attribution:'&copy; <a href="https://www.maptiler.com/copyright/">MapTiler<\/a> &copy; <a href="http://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors<\/a>. <a href="/about/maps.aspx#leaflet" target="_blank">About<\/a>',maxZoom:18,minZoom:0,subdomains:["01","02","03","04","05","06","07","08"],tileUrl:f+"/tile/{z}/{x}/{y}.png?token={accessToken}"},e=0,u=0,o=!1,s=function(){e++;u++;e>4&&!o&&u<12&&(o=!0,$.ajax({type:"POST",url:"/account/oauth/token",timeout:1e4}).done(function(n){i.accessToken=n.access_token;r.setUrl(f+"/tile/{z}/{x}/{y}.png?token="+i.accessToken);o=!1}),e=0)},h=function(){r=new L.TileLayer(i.tileUrl,i).addTo(n);r.on("tileerror",s);n.on("zoomend",function(){u=0});n.on("dragend",function(){u=0});t&&t(r)}.bind(this);setTimeout(function(){$.ajax({type:"POST",url:"/account/oauth/token",timeout:1e4}).done(function(n){i.accessToken=n.access_token;h()})},0)}function setStaticMap(){var n=L.map("map_canvas",{center:[mapLatLng.lat,mapLatLng.lng],zoom:14,doubleClickZoom:!0,dragging:!0,touchZoom:!1,scrollWheelZoom:!1,zoomControl:!0,attributionControl:!1}).addControl(new L.Control.Attribution({})).addControl(new L.Control.Scale);addInternalMapTileLayer(n,function(){var r,i,f,t,u;if(cmapAdditionalWaypoints!=null&&cmapAdditionalWaypoints.length>0){for(r=L.latLngBounds([mapLatLng.lat,mapLatLng.lng],[mapLatLng.lat,mapLatLng.lng]),i=0,f=cmapAdditionalWaypoints.length;i<f;i++)t=cmapAdditionalWaypoints[i],u=[t.lat,t.lng],L.marker(u,{icon:L.icon({iconUrl:"/images/wpttypes/pins/"+t.type+".png",iconSize:[20,23],iconAnchor:[10,23]}),title:t.name,clickable:!1}).addTo(n),r.extend(u);window.setTimeout(function(){n.fitBounds(r.pad(.5))},100)}L.marker([mapLatLng.lat,mapLatLng.lng],{icon:L.icon({iconUrl:"/images/wpttypes/pins/"+mapLatLng.type+".png",iconSize:[20,23],iconAnchor:[10,23]}),clickable:!1,title:mapLatLng.name}).addTo(n)})}!function(n,t,i){var e=n.L,r={},u,f;r.version="0.7.2";"object"==typeof module&&"object"==typeof module.exports?module.exports=r:"function"==typeof define&&define.amd&&define(r);r.noConflict=function(){return n.L=e,this};n.L=r;r.Util={extend:function(n){for(var t,r,f=Array.prototype.slice.call(arguments,1),i=0,u=f.length;u>i;i++){r=f[i]||{};for(t in r)r.hasOwnProperty(t)&&(n[t]=r[t])}return n},bind:function(n,t){var i=arguments.length>2?Array.prototype.slice.call(arguments,2):null;return function(){return n.apply(t,i||arguments)}},stamp:function(){var t=0,n="_leaflet_id";return function(i){return i[n]=i[n]||++t,i[n]}}(),invokeEach:function(n,t,i){var r,u;if("object"==typeof n){u=Array.prototype.slice.call(arguments,3);for(r in n)t.apply(i,[r,n[r]].concat(u));return!0}return!1},limitExecByInterval:function(n,t,i){var r,u;return function f(){var e=arguments;return r?void(u=!0):(r=!0,setTimeout(function(){r=!1;u&&(f.apply(i,e),u=!1)},t),void n.apply(i,e))}},falseFn:function(){return!1},formatNum:function(n,t){var i=Math.pow(10,t||5);return Math.round(n*i)/i},trim:function(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")},splitWords:function(n){return r.Util.trim(n).split(/\s+/)},setOptions:function(n,t){return n.options=r.extend({},n.options,t),n.options},getParamString:function(n,t,i){var u=[];for(var r in n)u.push(encodeURIComponent(i?r.toUpperCase():r)+"="+encodeURIComponent(n[r]));return(t&&-1!==t.indexOf("?")?"&":"?")+u.join("&")},template:function(n,t){return n.replace(/\{ *([\w_]+) *\}/g,function(n,r){var u=t[r];if(u===i)throw new Error("No value provided for variable "+n);return"function"==typeof u&&(u=u(t)),u})},isArray:Array.isArray||function(n){return"[object Array]"===Object.prototype.toString.call(n)},emptyImageUrl:"data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="},function(){function t(t){for(var r,u=["webkit","moz","o","ms"],i=0;i<u.length&&!r;i++)r=n[u[i]+t];return r}function i(t){var i=+new Date,r=Math.max(0,16-(i-u));return u=i+r,n.setTimeout(t,r)}var u=0,f=n.requestAnimationFrame||t("RequestAnimationFrame")||i,e=n.cancelAnimationFrame||t("CancelAnimationFrame")||t("CancelRequestAnimationFrame")||function(t){n.clearTimeout(t)};r.Util.requestAnimFrame=function(t,u,e,o){return t=r.bind(t,u),e&&f===i?void t():f.call(n,t,o)};r.Util.cancelAnimFrame=function(t){t&&e.call(n,t)}}();r.extend=r.Util.extend;r.bind=r.Util.bind;r.stamp=r.Util.stamp;r.setOptions=r.Util.setOptions;r.Class=function(){};r.Class.extend=function(n){var i=function(){this.initialize&&this.initialize.apply(this,arguments);this._initHooks&&this.callInitHooks()},e=function(){},t,u,f;e.prototype=this.prototype;t=new e;t.constructor=i;i.prototype=t;for(u in this)this.hasOwnProperty(u)&&"prototype"!==u&&(i[u]=this[u]);return n.statics&&(r.extend(i,n.statics),delete n.statics),n.includes&&(r.Util.extend.apply(null,[t].concat(n.includes)),delete n.includes),n.options&&t.options&&(n.options=r.extend({},t.options,n.options)),r.extend(t,n),t._initHooks=[],f=this,i.__super__=f.prototype,t.callInitHooks=function(){if(!this._initHooksCalled){f.prototype.callInitHooks&&f.prototype.callInitHooks.call(this);this._initHooksCalled=!0;for(var n=0,i=t._initHooks.length;i>n;n++)t._initHooks[n].call(this)}},i};r.Class.include=function(n){r.extend(this.prototype,n)};r.Class.mergeOptions=function(n){r.extend(this.prototype.options,n)};r.Class.addInitHook=function(n){var t=Array.prototype.slice.call(arguments,1),i="function"==typeof n?n:function(){this[n].apply(this,t)};this.prototype._initHooks=this.prototype._initHooks||[];this.prototype._initHooks.push(i)};u="_leaflet_events";r.Mixin={};r.Mixin.Events={addEventListener:function(n,t,i){if(r.Util.invokeEach(n,this.addEventListener,this,t,i))return this;var o,v,l,e,s,a,h,f=this[u]=this[u]||{},c=i&&i!==this&&r.stamp(i);for(n=r.Util.splitWords(n),o=0,v=n.length;v>o;o++)l={action:t,context:i||this},e=n[o],c?(s=e+"_idx",a=s+"_len",h=f[s]=f[s]||{},h[c]||(h[c]=[],f[a]=(f[a]||0)+1),h[c].push(l)):(f[e]=f[e]||[],f[e].push(l));return this},hasEventListeners:function(n){var t=this[u];return!!t&&(n in t&&t[n].length>0||n+"_idx"in t&&t[n+"_idx_len"]>0)},removeEventListener:function(n,t,i){if(!this[u])return this;if(!n)return this.clearAllEventListeners();if(r.Util.invokeEach(n,this.removeEventListener,this,t,i))return this;var h,y,c,f,e,l,a,s,p,o=this[u],v=i&&i!==this&&r.stamp(i);for(n=r.Util.splitWords(n),h=0,y=n.length;y>h;h++)if(c=n[h],l=c+"_idx",a=l+"_len",s=o[l],t){if(f=v&&s?s[v]:o[c]){for(e=f.length-1;e>=0;e--)f[e].action!==t||i&&f[e].context!==i||(p=f.splice(e,1),p[0].action=r.Util.falseFn);i&&s&&0===f.length&&(delete s[v],o[a]--)}}else delete o[c],delete o[l],delete o[a];return this},clearAllEventListeners:function(){return delete this[u],this},fireEvent:function(n,t){if(!this.hasEventListeners(n))return this;var f,i,e,o,h,c=r.Util.extend({},t,{type:n,target:this}),s=this[u];if(s[n])for(f=s[n].slice(),i=0,e=f.length;e>i;i++)f[i].action.call(f[i].context,c);o=s[n+"_idx"];for(h in o)if(f=o[h].slice())for(i=0,e=f.length;e>i;i++)f[i].action.call(f[i].context,c);return this},addOneTimeEventListener:function(n,t,i){if(r.Util.invokeEach(n,this.addOneTimeEventListener,this,t,i))return this;var u=r.bind(function(){this.removeEventListener(n,t,i).removeEventListener(n,u,i)},this);return this.addEventListener(n,t,i).addEventListener(n,u,i)}};r.Mixin.Events.on=r.Mixin.Events.addEventListener;r.Mixin.Events.off=r.Mixin.Events.removeEventListener;r.Mixin.Events.once=r.Mixin.Events.addOneTimeEventListener;r.Mixin.Events.fire=r.Mixin.Events.fireEvent,function(){var f="ActiveXObject"in n,b=f&&!t.addEventListener,u=navigator.userAgent.toLowerCase(),s=-1!==u.indexOf("webkit"),k=-1!==u.indexOf("chrome"),c=-1!==u.indexOf("phantom"),d=-1!==u.indexOf("android"),l=-1!==u.search("android [23]"),g=-1!==u.indexOf("gecko"),e=typeof orientation!=i+"",a=n.navigator&&n.navigator.msPointerEnabled&&n.navigator.msMaxTouchPoints&&!n.PointerEvent,v=n.PointerEvent&&n.navigator.pointerEnabled&&n.navigator.maxTouchPoints||a,nt="devicePixelRatio"in n&&n.devicePixelRatio>1||"matchMedia"in n&&n.matchMedia("(min-resolution:144dpi)")&&n.matchMedia("(min-resolution:144dpi)").matches,o=t.documentElement,y=f&&"transition"in o.style,h="WebKitCSSMatrix"in n&&"m11"in new n.WebKitCSSMatrix&&!l,p="MozPerspective"in o.style,w="OTransition"in o.style,tt=!n.L_DISABLE_3D&&(y||h||p||w)&&!c,it=!n.L_NO_TOUCH&&!c&&function(){var i="ontouchstart",n,r;return v||i in o?!0:(n=t.createElement("div"),r=!1,n.setAttribute?(n.setAttribute(i,"return;"),"function"==typeof n[i]&&(r=!0),n.removeAttribute(i),n=null,r):!1)}();r.Browser={ie:f,ielt9:b,webkit:s,gecko:g&&!s&&!n.opera&&!f,android:d,android23:l,chrome:k,ie3d:y,webkit3d:h,gecko3d:p,opera3d:w,any3d:tt,mobile:e,mobileWebkit:e&&s,mobileWebkit3d:e&&h,mobileOpera:e&&n.opera,touch:it,msPointer:a,pointer:v,retina:nt}}();r.Point=function(n,t,i){this.x=i?Math.round(n):n;this.y=i?Math.round(t):t};r.Point.prototype={clone:function(){return new r.Point(this.x,this.y)},add:function(n){return this.clone()._add(r.point(n))},_add:function(n){return this.x+=n.x,this.y+=n.y,this},subtract:function(n){return this.clone()._subtract(r.point(n))},_subtract:function(n){return this.x-=n.x,this.y-=n.y,this},divideBy:function(n){return this.clone()._divideBy(n)},_divideBy:function(n){return this.x/=n,this.y/=n,this},multiplyBy:function(n){return this.clone()._multiplyBy(n)},_multiplyBy:function(n){return this.x*=n,this.y*=n,this},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},distanceTo:function(n){n=r.point(n);var t=n.x-this.x,i=n.y-this.y;return Math.sqrt(t*t+i*i)},equals:function(n){return n=r.point(n),n.x===this.x&&n.y===this.y},contains:function(n){return n=r.point(n),Math.abs(n.x)<=Math.abs(this.x)&&Math.abs(n.y)<=Math.abs(this.y)},toString:function(){return"Point("+r.Util.formatNum(this.x)+", "+r.Util.formatNum(this.y)+")"}};r.point=function(n,t,u){return n instanceof r.Point?n:r.Util.isArray(n)?new r.Point(n[0],n[1]):n===i||null===n?n:new r.Point(n,t,u)};r.Bounds=function(n,t){if(n)for(var r=t?[n,t]:n,i=0,u=r.length;u>i;i++)this.extend(r[i])};r.Bounds.prototype={extend:function(n){return n=r.point(n),this.min||this.max?(this.min.x=Math.min(n.x,this.min.x),this.max.x=Math.max(n.x,this.max.x),this.min.y=Math.min(n.y,this.min.y),this.max.y=Math.max(n.y,this.max.y)):(this.min=n.clone(),this.max=n.clone()),this},getCenter:function(n){return new r.Point((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,n)},getBottomLeft:function(){return new r.Point(this.min.x,this.max.y)},getTopRight:function(){return new r.Point(this.max.x,this.min.y)},getSize:function(){return this.max.subtract(this.min)},contains:function(n){var t,i;return n="number"==typeof n[0]||n instanceof r.Point?r.point(n):r.bounds(n),n instanceof r.Bounds?(t=n.min,i=n.max):t=i=n,t.x>=this.min.x&&i.x<=this.max.x&&t.y>=this.min.y&&i.y<=this.max.y},intersects:function(n){n=r.bounds(n);var t=this.min,i=this.max,u=n.min,f=n.max,e=f.x>=t.x&&u.x<=i.x,o=f.y>=t.y&&u.y<=i.y;return e&&o},isValid:function(){return!(!this.min||!this.max)}};r.bounds=function(n,t){return!n||n instanceof r.Bounds?n:new r.Bounds(n,t)};r.Transformation=function(n,t,i,r){this._a=n;this._b=t;this._c=i;this._d=r};r.Transformation.prototype={transform:function(n,t){return this._transform(n.clone(),t)},_transform:function(n,t){return t=t||1,n.x=t*(this._a*n.x+this._b),n.y=t*(this._c*n.y+this._d),n},untransform:function(n,t){return t=t||1,new r.Point((n.x/t-this._b)/this._a,(n.y/t-this._d)/this._c)}};r.DomUtil={get:function(n){return"string"==typeof n?t.getElementById(n):n},getStyle:function(n,i){var r=n.style[i],u;return(!r&&n.currentStyle&&(r=n.currentStyle[i]),(!r||"auto"===r)&&t.defaultView)&&(u=t.defaultView.getComputedStyle(n,null),r=u?u[i]:null),"auto"===r?null:r},getViewportOffset:function(n){var o,u=0,f=0,i=n,e=t.body,s=t.documentElement;do{if(u+=i.offsetTop||0,f+=i.offsetLeft||0,u+=parseInt(r.DomUtil.getStyle(i,"borderTopWidth"),10)||0,f+=parseInt(r.DomUtil.getStyle(i,"borderLeftWidth"),10)||0,o=r.DomUtil.getStyle(i,"position"),i.offsetParent===e&&"absolute"===o)break;if("fixed"===o){u+=e.scrollTop||s.scrollTop||0;f+=e.scrollLeft||s.scrollLeft||0;break}if("relative"===o&&!i.offsetLeft){var c=r.DomUtil.getStyle(i,"width"),l=r.DomUtil.getStyle(i,"max-width"),h=i.getBoundingClientRect();("none"!==c||"none"!==l)&&(f+=h.left+i.clientLeft);u+=h.top+(e.scrollTop||s.scrollTop||0);break}i=i.offsetParent}while(i);i=n;do{if(i===e)break;u-=i.scrollTop||0;f-=i.scrollLeft||0;i=i.parentNode}while(i);return new r.Point(f,u)},documentIsLtr:function(){return r.DomUtil._docIsLtrCached||(r.DomUtil._docIsLtrCached=!0,r.DomUtil._docIsLtr="ltr"===r.DomUtil.getStyle(t.body,"direction")),r.DomUtil._docIsLtr},create:function(n,i,r){var u=t.createElement(n);return u.className=i,r&&r.appendChild(u),u},hasClass:function(n,t){if(n.classList!==i)return n.classList.contains(t);var u=r.DomUtil._getClass(n);return u.length>0&&new RegExp("(^|\\s)"+t+"(\\s|$)").test(u)},addClass:function(n,t){var f;if(n.classList!==i)for(var e=r.Util.splitWords(t),u=0,o=e.length;o>u;u++)n.classList.add(e[u]);else r.DomUtil.hasClass(n,t)||(f=r.DomUtil._getClass(n),r.DomUtil._setClass(n,(f?f+" ":"")+t))},removeClass:function(n,t){n.classList!==i?n.classList.remove(t):r.DomUtil._setClass(n,r.Util.trim((" "+r.DomUtil._getClass(n)+" ").replace(" "+t+" "," ")))},_setClass:function(n,t){n.className.baseVal===i?n.className=t:n.className.baseVal=t},_getClass:function(n){return n.className.baseVal===i?n.className:n.className.baseVal},setOpacity:function(n,t){if("opacity"in n.style)n.style.opacity=t;else if("filter"in n.style){var i=!1,r="DXImageTransform.Microsoft.Alpha";try{i=n.filters.item(r)}catch(u){if(1===t)return}t=Math.round(100*t);i?(i.Enabled=100!==t,i.Opacity=t):n.style.filter+=" progid:"+r+"(opacity="+t+")"}},testProp:function(n){for(var r=t.documentElement.style,i=0;i<n.length;i++)if(n[i]in r)return n[i];return!1},getTranslateString:function(n){var t=r.Browser.webkit3d,i="translate"+(t?"3d":"")+"(",u=(t?",0":"")+")";return i+n.x+"px,"+n.y+"px"+u},getScaleString:function(n,t){var i=r.DomUtil.getTranslateString(t.add(t.multiplyBy(-1*n))),u=" scale("+n+") ";return i+u},setPosition:function(n,t,i){n._leaflet_pos=t;!i&&r.Browser.any3d?n.style[r.DomUtil.TRANSFORM]=r.DomUtil.getTranslateString(t):(n.style.left=t.x+"px",n.style.top=t.y+"px")},getPosition:function(n){return n._leaflet_pos}};r.DomUtil.TRANSFORM=r.DomUtil.testProp(["transform","WebkitTransform","OTransform","MozTransform","msTransform"]);r.DomUtil.TRANSITION=r.DomUtil.testProp(["webkitTransition","transition","OTransition","MozTransition","msTransition"]);r.DomUtil.TRANSITION_END="webkitTransition"===r.DomUtil.TRANSITION||"OTransition"===r.DomUtil.TRANSITION?r.DomUtil.TRANSITION+"End":"transitionend",function(){if("onselectstart"in t)r.extend(r.DomUtil,{disableTextSelection:function(){r.DomEvent.on(n,"selectstart",r.DomEvent.preventDefault)},enableTextSelection:function(){r.DomEvent.off(n,"selectstart",r.DomEvent.preventDefault)}});else{var i=r.DomUtil.testProp(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);r.extend(r.DomUtil,{disableTextSelection:function(){if(i){var n=t.documentElement.style;this._userSelect=n[i];n[i]="none"}},enableTextSelection:function(){i&&(t.documentElement.style[i]=this._userSelect,delete this._userSelect)}})}r.extend(r.DomUtil,{disableImageDrag:function(){r.DomEvent.on(n,"dragstart",r.DomEvent.preventDefault)},enableImageDrag:function(){r.DomEvent.off(n,"dragstart",r.DomEvent.preventDefault)}})}();r.LatLng=function(n,t,r){if(n=parseFloat(n),t=parseFloat(t),isNaN(n)||isNaN(t))throw new Error("Invalid LatLng object: ("+n+", "+t+")");this.lat=n;this.lng=t;r!==i&&(this.alt=parseFloat(r))};r.extend(r.LatLng,{DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI,MAX_MARGIN:1e-9});r.LatLng.prototype={equals:function(n){if(!n)return!1;n=r.latLng(n);var t=Math.max(Math.abs(this.lat-n.lat),Math.abs(this.lng-n.lng));return t<=r.LatLng.MAX_MARGIN},toString:function(n){return"LatLng("+r.Util.formatNum(this.lat,n)+", "+r.Util.formatNum(this.lng,n)+")"},distanceTo:function(n){n=r.latLng(n);var t=r.LatLng.DEG_TO_RAD,e=(n.lat-this.lat)*t,o=(n.lng-this.lng)*t,s=this.lat*t,h=n.lat*t,i=Math.sin(e/2),u=Math.sin(o/2),f=i*i+u*u*Math.cos(s)*Math.cos(h);return 12756274*Math.atan2(Math.sqrt(f),Math.sqrt(1-f))},wrap:function(n,t){var i=this.lng;return n=n||-180,t=t||180,i=(i+t)%(t-n)+(n>i||i===t?t:n),new r.LatLng(this.lat,i)}};r.latLng=function(n,t){return n instanceof r.LatLng?n:r.Util.isArray(n)?"number"==typeof n[0]||"string"==typeof n[0]?new r.LatLng(n[0],n[1],n[2]):null:n===i||null===n?n:"object"==typeof n&&"lat"in n?new r.LatLng(n.lat,"lng"in n?n.lng:n.lon):t===i?null:new r.LatLng(n,t)};r.LatLngBounds=function(n,t){if(n)for(var r=t?[n,t]:n,i=0,u=r.length;u>i;i++)this.extend(r[i])};r.LatLngBounds.prototype={extend:function(n){if(!n)return this;var t=r.latLng(n);return n=null!==t?t:r.latLngBounds(n),n instanceof r.LatLng?this._southWest||this._northEast?(this._southWest.lat=Math.min(n.lat,this._southWest.lat),this._southWest.lng=Math.min(n.lng,this._southWest.lng),this._northEast.lat=Math.max(n.lat,this._northEast.lat),this._northEast.lng=Math.max(n.lng,this._northEast.lng)):(this._southWest=new r.LatLng(n.lat,n.lng),this._northEast=new r.LatLng(n.lat,n.lng)):n instanceof r.LatLngBounds&&(this.extend(n._southWest),this.extend(n._northEast)),this},pad:function(n){var t=this._southWest,i=this._northEast,u=Math.abs(t.lat-i.lat)*n,f=Math.abs(t.lng-i.lng)*n;return new r.LatLngBounds(new r.LatLng(t.lat-u,t.lng-f),new r.LatLng(i.lat+u,i.lng+f))},getCenter:function(){return new r.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 r.LatLng(this.getNorth(),this.getWest())},getSouthEast:function(){return new r.LatLng(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(n){n="number"==typeof n[0]||n instanceof r.LatLng?r.latLng(n):r.latLngBounds(n);var t,i,u=this._southWest,f=this._northEast;return n instanceof r.LatLngBounds?(t=n.getSouthWest(),i=n.getNorthEast()):t=i=n,t.lat>=u.lat&&i.lat<=f.lat&&t.lng>=u.lng&&i.lng<=f.lng},intersects:function(n){n=r.latLngBounds(n);var t=this._southWest,i=this._northEast,u=n.getSouthWest(),f=n.getNorthEast(),e=f.lat>=t.lat&&u.lat<=i.lat,o=f.lng>=t.lng&&u.lng<=i.lng;return e&&o},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(n){return n?(n=r.latLngBounds(n),this._southWest.equals(n.getSouthWest())&&this._northEast.equals(n.getNorthEast())):!1},isValid:function(){return!(!this._southWest||!this._northEast)}};r.latLngBounds=function(n,t){return!n||n instanceof r.LatLngBounds?n:new r.LatLngBounds(n,t)};r.Projection={};r.Projection.SphericalMercator={MAX_LATITUDE:85.0511287798,project:function(n){var i=r.LatLng.DEG_TO_RAD,u=this.MAX_LATITUDE,f=Math.max(Math.min(u,n.lat),-u),e=n.lng*i,t=f*i;return t=Math.log(Math.tan(Math.PI/4+t/2)),new r.Point(e,t)},unproject:function(n){var t=r.LatLng.RAD_TO_DEG,i=n.x*t,u=(2*Math.atan(Math.exp(n.y))-Math.PI/2)*t;return new r.LatLng(u,i)}};r.Projection.LonLat={project:function(n){return new r.Point(n.lng,n.lat)},unproject:function(n){return new r.LatLng(n.y,n.x)}};r.CRS={latLngToPoint:function(n,t){var i=this.projection.project(n),r=this.scale(t);return this.transformation._transform(i,r)},pointToLatLng:function(n,t){var i=this.scale(t),r=this.transformation.untransform(n,i);return this.projection.unproject(r)},project:function(n){return this.projection.project(n)},scale:function(n){return 256*Math.pow(2,n)},getSize:function(n){var t=this.scale(n);return r.point(t,t)}};r.CRS.Simple=r.extend({},r.CRS,{projection:r.Projection.LonLat,transformation:new r.Transformation(1,0,-1,0),scale:function(n){return Math.pow(2,n)}});r.CRS.EPSG3857=r.extend({},r.CRS,{code:"EPSG:3857",projection:r.Projection.SphericalMercator,transformation:new r.Transformation(.5/Math.PI,.5,-.5/Math.PI,.5),project:function(n){var t=this.projection.project(n);return t.multiplyBy(6378137)}});r.CRS.EPSG900913=r.extend({},r.CRS.EPSG3857,{code:"EPSG:900913"});r.CRS.EPSG4326=r.extend({},r.CRS,{code:"EPSG:4326",projection:r.Projection.LonLat,transformation:new r.Transformation(1/360,.5,-1/360,.5)});r.Map=r.Class.extend({includes:r.Mixin.Events,options:{crs:r.CRS.EPSG3857,fadeAnimation:r.DomUtil.TRANSITION&&!r.Browser.android23,trackResize:!0,markerZoomAnimation:r.DomUtil.TRANSITION&&r.Browser.any3d},initialize:function(n,t){t=r.setOptions(this,t);this._initContainer(n);this._initLayout();this._onResize=r.bind(this._onResize,this);this._initEvents();t.maxBounds&&this.setMaxBounds(t.maxBounds);t.center&&t.zoom!==i&&this.setView(r.latLng(t.center),t.zoom,{reset:!0});this._handlers=[];this._layers={};this._zoomBoundLayers={};this._tileLayersNum=0;this.callInitHooks();this._addLayers(t.layers)},setView:function(n,t){return t=t===i?this.getZoom():t,this._resetView(r.latLng(n),this._limitZoom(t)),this},setZoom:function(n,t){return this._loaded?this.setView(this.getCenter(),n,{zoom:t}):(this._zoom=this._limitZoom(n),this)},zoomIn:function(n,t){return this.setZoom(this._zoom+(n||1),t)},zoomOut:function(n,t){return this.setZoom(this._zoom-(n||1),t)},setZoomAround:function(n,t,i){var f=this.getZoomScale(t),u=this.getSize().divideBy(2),e=n instanceof r.Point?n:this.latLngToContainerPoint(n),o=e.subtract(u).multiplyBy(1-1/f),s=this.containerPointToLatLng(u.add(o));return this.setView(s,t,{zoom:i})},fitBounds:function(n,t){t=t||{};n=n.getBounds?n.getBounds():r.latLngBounds(n);var u=r.point(t.paddingTopLeft||t.padding||[0,0]),f=r.point(t.paddingBottomRight||t.padding||[0,0]),i=this.getBoundsZoom(n,!1,u.add(f)),e=f.subtract(u).divideBy(2),o=this.project(n.getSouthWest(),i),s=this.project(n.getNorthEast(),i),h=this.unproject(o.add(s).divideBy(2).add(e),i);return i=t&&t.maxZoom?Math.min(t.maxZoom,i):i,this.setView(h,i,t)},fitWorld:function(n){return this.fitBounds([[-90,-180],[90,180]],n)},panTo:function(n,t){return this.setView(n,this._zoom,{pan:t})},panBy:function(n){return this.fire("movestart"),this._rawPanBy(r.point(n)),this.fire("move"),this.fire("moveend")},setMaxBounds:function(n){return n=r.latLngBounds(n),this.options.maxBounds=n,n?(this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds,this)):this.off("moveend",this._panInsideMaxBounds,this)},panInsideBounds:function(n,t){var i=this.getCenter(),r=this._limitCenter(i,this._zoom,n);return i.equals(r)?this:this.panTo(r,t)},addLayer:function(n){var t=r.stamp(n);return this._layers[t]?this:(this._layers[t]=n,!n.options||isNaN(n.options.maxZoom)&&isNaN(n.options.minZoom)||(this._zoomBoundLayers[t]=n,this._updateZoomLevels()),this.options.zoomAnimation&&r.TileLayer&&n instanceof r.TileLayer&&(this._tileLayersNum++,this._tileLayersToLoad++,n.on("load",this._onTileLayerLoad,this)),this._loaded&&this._layerAdd(n),this)},removeLayer:function(n){var t=r.stamp(n);return this._layers[t]?(this._loaded&&n.onRemove(this),delete this._layers[t],this._loaded&&this.fire("layerremove",{layer:n}),this._zoomBoundLayers[t]&&(delete this._zoomBoundLayers[t],this._updateZoomLevels()),this.options.zoomAnimation&&r.TileLayer&&n instanceof r.TileLayer&&(this._tileLayersNum--,this._tileLayersToLoad--,n.off("load",this._onTileLayerLoad,this)),this):this},hasLayer:function(n){return n?r.stamp(n)in this._layers:!1},eachLayer:function(n,t){for(var i in this._layers)n.call(t,this._layers[i]);return this},invalidateSize:function(n){var i;if(!this._loaded)return this;n=r.extend({animate:!1,pan:!0},n===!0?{animate:!0}:n);i=this.getSize();this._sizeChanged=!0;this._initialCenter=null;var u=this.getSize(),f=i.divideBy(2).round(),e=u.divideBy(2).round(),t=f.subtract(e);return t.x||t.y?(n.animate&&n.pan?this.panBy(t):(n.pan&&this._rawPanBy(t),this.fire("move"),n.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(r.bind(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:i,newSize:u})):this},addHandler:function(n,t){if(!t)return this;var i=this[n]=new t(this);return this._handlers.push(i),this.options[n]&&i.enable(),this},remove:function(){this._loaded&&this.fire("unload");this._initEvents("off");try{delete this._container._leaflet}catch(n){this._container._leaflet=i}return this._clearPanes(),this._clearControlPos&&this._clearControlPos(),this._clearHandlers(),this},getCenter:function(){return this._checkIfLoaded(),this._initialCenter&&!this._moved()?this._initialCenter:this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var n=this.getPixelBounds(),t=this.unproject(n.getBottomLeft()),i=this.unproject(n.getTopRight());return new r.LatLngBounds(t,i)},getMinZoom:function(){return this.options.minZoom===i?this._layersMinZoom===i?0:this._layersMinZoom:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===i?this._layersMaxZoom===i?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(n,t,i){n=r.latLngBounds(n);var f,u=this.getMinZoom()-(t?1:0),s=this.getMaxZoom(),e=this.getSize(),h=n.getNorthWest(),c=n.getSouthEast(),o=!0;i=r.point(i||[0,0]);do u++,f=this.project(c,u).subtract(this.project(h,u)).add(i),o=t?f.x<e.x||f.y<e.y:e.contains(f);while(o&&s>=u);return o&&t?null:t?u:u-1},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new r.Point(this._container.clientWidth,this._container.clientHeight),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(){var n=this._getTopLeftPoint();return new r.Bounds(n,n.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._initialTopLeftPoint},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(n){var t=this.options.crs;return t.scale(n)/t.scale(this._zoom)},getScaleZoom:function(n){return this._zoom+Math.log(n)/Math.LN2},project:function(n,t){return t=t===i?this._zoom:t,this.options.crs.latLngToPoint(r.latLng(n),t)},unproject:function(n,t){return t=t===i?this._zoom:t,this.options.crs.pointToLatLng(r.point(n),t)},layerPointToLatLng:function(n){var t=r.point(n).add(this.getPixelOrigin());return this.unproject(t)},latLngToLayerPoint:function(n){var t=this.project(r.latLng(n))._round();return t._subtract(this.getPixelOrigin())},containerPointToLayerPoint:function(n){return r.point(n).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(n){return r.point(n).add(this._getMapPanePos())},containerPointToLatLng:function(n){var t=this.containerPointToLayerPoint(r.point(n));return this.layerPointToLatLng(t)},latLngToContainerPoint:function(n){return this.layerPointToContainerPoint(this.latLngToLayerPoint(r.latLng(n)))},mouseEventToContainerPoint:function(n){return r.DomEvent.getMousePosition(n,this._container)},mouseEventToLayerPoint:function(n){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(n))},mouseEventToLatLng:function(n){return this.layerPointToLatLng(this.mouseEventToLayerPoint(n))},_initContainer:function(n){var t=this._container=r.DomUtil.get(n);if(!t)throw new Error("Map container not found.");if(t._leaflet)throw new Error("Map container is already initialized.");t._leaflet=!0},_initLayout:function(){var t=this._container,n;r.DomUtil.addClass(t,"leaflet-container"+(r.Browser.touch?" leaflet-touch":"")+(r.Browser.retina?" leaflet-retina":"")+(r.Browser.ielt9?" leaflet-oldie":"")+(this.options.fadeAnimation?" leaflet-fade-anim":""));n=r.DomUtil.getStyle(t,"position");"absolute"!==n&&"relative"!==n&&"fixed"!==n&&(t.style.position="relative");this._initPanes();this._initControlPos&&this._initControlPos()},_initPanes:function(){var n=this._panes={},t;this._mapPane=n.mapPane=this._createPane("leaflet-map-pane",this._container);this._tilePane=n.tilePane=this._createPane("leaflet-tile-pane",this._mapPane);n.objectsPane=this._createPane("leaflet-objects-pane",this._mapPane);n.shadowPane=this._createPane("leaflet-shadow-pane");n.overlayPane=this._createPane("leaflet-overlay-pane");n.markerPane=this._createPane("leaflet-marker-pane");n.popupPane=this._createPane("leaflet-popup-pane");t=" leaflet-zoom-hide";this.options.markerZoomAnimation||(r.DomUtil.addClass(n.markerPane,t),r.DomUtil.addClass(n.shadowPane,t),r.DomUtil.addClass(n.popupPane,t))},_createPane:function(n,t){return r.DomUtil.create("div",n,t||this._panes.objectsPane)},_clearPanes:function(){this._container.removeChild(this._mapPane)},_addLayers:function(n){n=n?r.Util.isArray(n)?n:[n]:[];for(var t=0,i=n.length;i>t;t++)this.addLayer(n[t])},_resetView:function(n,t,i,u){var f=this._zoom!==t,e;u||(this.fire("movestart"),f&&this.fire("zoomstart"));this._zoom=t;this._initialCenter=n;this._initialTopLeftPoint=this._getNewTopLeftPoint(n);i?this._initialTopLeftPoint._add(this._getMapPanePos()):r.DomUtil.setPosition(this._mapPane,new r.Point(0,0));this._tileLayersToLoad=this._tileLayersNum;e=!this._loaded;this._loaded=!0;e&&(this.fire("load"),this.eachLayer(this._layerAdd,this));this.fire("viewreset",{hard:!i});this.fire("move");(f||u)&&this.fire("zoomend");this.fire("moveend",{hard:!i})},_rawPanBy:function(n){r.DomUtil.setPosition(this._mapPane,this._getMapPanePos().subtract(n))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_updateZoomLevels:function(){var t,r=1/0,u=-1/0,f=this._getZoomSpan(),n;for(t in this._zoomBoundLayers)n=this._zoomBoundLayers[t],isNaN(n.options.minZoom)||(r=Math.min(r,n.options.minZoom)),isNaN(n.options.maxZoom)||(u=Math.max(u,n.options.maxZoom));t===i?this._layersMaxZoom=this._layersMinZoom=i:(this._layersMaxZoom=u,this._layersMinZoom=r);f!==this._getZoomSpan()&&this.fire("zoomlevelschange")},_panInsideMaxBounds:function(){this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.");},_initEvents:function(t){if(r.DomEvent){t=t||"on";r.DomEvent[t](this._container,"click",this._onMouseClick,this);for(var f=["dblclick","mousedown","mouseup","mouseenter","mouseleave","mousemove","contextmenu"],i=0,u=f.length;u>i;i++)r.DomEvent[t](this._container,f[i],this._fireMouseEvent,this);this.options.trackResize&&r.DomEvent[t](n,"resize",this._onResize,this)}},_onResize:function(){r.Util.cancelAnimFrame(this._resizeRequest);this._resizeRequest=r.Util.requestAnimFrame(function(){this.invalidateSize({debounceMoveend:!0})},this,!1,this._container)},_onMouseClick:function(n){!this._loaded||!n._simulated&&(this.dragging&&this.dragging.moved()||this.boxZoom&&this.boxZoom.moved())||r.DomEvent._skipped(n)||(this.fire("preclick"),this._fireMouseEvent(n))},_fireMouseEvent:function(n){var t;if(this._loaded&&!r.DomEvent._skipped(n)&&(t=n.type,t="mouseenter"===t?"mouseover":"mouseleave"===t?"mouseout":t,this.hasEventListeners(t))){"contextmenu"===t&&r.DomEvent.preventDefault(n);var i=this.mouseEventToContainerPoint(n),u=this.containerPointToLayerPoint(i),f=this.layerPointToLatLng(u);this.fire(t,{latlng:f,layerPoint:u,containerPoint:i,originalEvent:n})}},_onTileLayerLoad:function(){this._tileLayersToLoad--;this._tileLayersNum&&!this._tileLayersToLoad&&this.fire("tilelayersload")},_clearHandlers:function(){for(var n=0,t=this._handlers.length;t>n;n++)this._handlers[n].disable()},whenReady:function(n,t){return this._loaded?n.call(t||this,this):this.on("load",n,t),this},_layerAdd:function(n){n.onAdd(this);this.fire("layeradd",{layer:n})},_getMapPanePos:function(){return r.DomUtil.getPosition(this._mapPane)},_moved:function(){var n=this._getMapPanePos();return n&&!n.equals([0,0])},_getTopLeftPoint:function(){return this.getPixelOrigin().subtract(this._getMapPanePos())},_getNewTopLeftPoint:function(n,t){var i=this.getSize()._divideBy(2);return this.project(n,t)._subtract(i)._round()},_latLngToNewLayerPoint:function(n,t,i){var r=this._getNewTopLeftPoint(i,t).add(this._getMapPanePos());return this.project(n,t)._subtract(r)},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(n){return this.latLngToLayerPoint(n).subtract(this._getCenterLayerPoint())},_limitCenter:function(n,t,i){if(!i)return n;var u=this.project(n,t),f=this.getSize().divideBy(2),e=new r.Bounds(u.subtract(f),u.add(f)),o=this._getBoundsOffset(e,i,t);return this.unproject(u.add(o),t)},_limitOffset:function(n,t){if(!t)return n;var i=this.getPixelBounds(),u=new r.Bounds(i.min.add(n),i.max.add(n));return n.add(this._getBoundsOffset(u,t))},_getBoundsOffset:function(n,t,i){var u=this.project(t.getNorthWest(),i).subtract(n.min),f=this.project(t.getSouthEast(),i).subtract(n.max),e=this._rebound(u.x,-f.x),o=this._rebound(u.y,-f.y);return new r.Point(e,o)},_rebound:function(n,t){return n+t>0?Math.round(n-t)/2:Math.max(0,Math.ceil(n))-Math.max(0,Math.floor(t))},_limitZoom:function(n){var t=this.getMinZoom(),i=this.getMaxZoom();return Math.max(t,Math.min(i,n))}});r.map=function(n,t){return new r.Map(n,t)};r.Projection.Mercator={MAX_LATITUDE:85.0840591556,R_MINOR:6356752.3142451793,R_MAJOR:6378137,project:function(n){var f=r.LatLng.DEG_TO_RAD,e=this.MAX_LATITUDE,c=Math.max(Math.min(e,n.lat),-e),u=this.R_MAJOR,l=this.R_MINOR,a=n.lng*f*u,t=c*f,o=l/u,s=Math.sqrt(1-o*o),i=s*Math.sin(t),h;return i=Math.pow((1-i)/(1+i),.5*s),h=Math.tan(.5*(.5*Math.PI-t))/i,t=-u*Math.log(h),new r.Point(a,t)},unproject:function(n){for(var i,e=r.LatLng.RAD_TO_DEG,u=this.R_MAJOR,c=this.R_MINOR,l=n.x*e/u,o=c/u,s=Math.sqrt(1-o*o),h=Math.exp(-n.y/u),t=Math.PI/2-2*Math.atan(h),a=15,f=.1;Math.abs(f)>1e-7&&--a>0;)i=s*Math.sin(t),f=Math.PI/2-2*Math.atan(h*Math.pow((1-i)/(1+i),.5*s))-t,t+=f;return new r.LatLng(t*e,l)}};r.CRS.EPSG3395=r.extend({},r.CRS,{code:"EPSG:3395",projection:r.Projection.Mercator,transformation:function(){var t=r.Projection.Mercator,i=t.R_MAJOR,n=.5/(Math.PI*i);return new r.Transformation(n,.5,-n,.5)}()});r.TileLayer=r.Class.extend({includes:r.Mixin.Events,options:{minZoom:0,maxZoom:18,tileSize:256,subdomains:"abc",errorTileUrl:"",attribution:"",zoomOffset:0,opacity:1,unloadInvisibleTiles:r.Browser.mobile,updateWhenIdle:r.Browser.mobile},initialize:function(n,t){t=r.setOptions(this,t);t.detectRetina&&r.Browser.retina&&t.maxZoom>0&&(t.tileSize=Math.floor(t.tileSize/2),t.zoomOffset++,t.minZoom>0&&t.minZoom--,this.options.maxZoom--);t.bounds&&(t.bounds=r.latLngBounds(t.bounds));this._url=n;var i=this.options.subdomains;"string"==typeof i&&(this.options.subdomains=i.split(""))},onAdd:function(n){this._map=n;this._animated=n._zoomAnimated;this._initContainer();n.on({viewreset:this._reset,moveend:this._update},this);this._animated&&n.on({zoomanim:this._animateZoom,zoomend:this._endZoomAnim},this);this.options.updateWhenIdle||(this._limitedUpdate=r.Util.limitExecByInterval(this._update,150,this),n.on("move",this._limitedUpdate,this));this._reset();this._update()},addTo:function(n){return n.addLayer(this),this},onRemove:function(n){this._container.parentNode.removeChild(this._container);n.off({viewreset:this._reset,moveend:this._update},this);this._animated&&n.off({zoomanim:this._animateZoom,zoomend:this._endZoomAnim},this);this.options.updateWhenIdle||n.off("move",this._limitedUpdate,this);this._container=null;this._map=null},bringToFront:function(){var n=this._map._panes.tilePane;return this._container&&(n.appendChild(this._container),this._setAutoZIndex(n,Math.max)),this},bringToBack:function(){var n=this._map._panes.tilePane;return this._container&&(n.insertBefore(this._container,n.firstChild),this._setAutoZIndex(n,Math.min)),this},getAttribution:function(){return this.options.attribution},getContainer:function(){return this._container},setOpacity:function(n){return this.options.opacity=n,this._map&&this._updateOpacity(),this},setZIndex:function(n){return this.options.zIndex=n,this._updateZIndex(),this},setUrl:function(n,t){return this._url=n,t||this.redraw(),this},redraw:function(){return this._map&&(this._reset({hard:!0}),this._update()),this},_updateZIndex:function(){this._container&&this.options.zIndex!==i&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(n,t){for(var u,f=n.children,r=-t(1/0,-1/0),i=0,e=f.length;e>i;i++)f[i]!==this._container&&(u=parseInt(f[i].style.zIndex,10),isNaN(u)||(r=t(r,u)));this.options.zIndex=this._container.style.zIndex=(isFinite(r)?r:0)+t(1,-1)},_updateOpacity:function(){var n,t=this._tiles;if(r.Browser.ielt9)for(n in t)r.DomUtil.setOpacity(t[n],this.options.opacity);else r.DomUtil.setOpacity(this._container,this.options.opacity)},_initContainer:function(){var t=this._map._panes.tilePane,n;this._container||((this._container=r.DomUtil.create("div","leaflet-layer"),this._updateZIndex(),this._animated)?(n="leaflet-tile-container",this._bgBuffer=r.DomUtil.create("div",n,this._container),this._tileContainer=r.DomUtil.create("div",n,this._container)):this._tileContainer=this._container,t.appendChild(this._container),this.options.opacity<1&&this._updateOpacity())},_reset:function(n){for(var t in this._tiles)this.fire("tileunload",{tile:this._tiles[t]});this._tiles={};this._tilesToLoad=0;this.options.reuseTiles&&(this._unusedTiles=[]);this._tileContainer.innerHTML="";this._animated&&n&&n.hard&&this._clearBgBuffer();this._initContainer()},_getTileSize:function(){var n=this._map,r=n.getZoom()+this.options.zoomOffset,t=this.options.maxNativeZoom,i=this.options.tileSize;return t&&r>t&&(i=Math.round(n.getZoomScale(r)/n.getZoomScale(t)*i)),i},_update:function(){var n;if(this._map){var t=this._map,i=t.getPixelBounds(),u=t.getZoom(),f=this._getTileSize();u>this.options.maxZoom||u<this.options.minZoom||(n=r.bounds(i.min.divideBy(f)._floor(),i.max.divideBy(f)._floor()),this._addTilesFromCenterOut(n),(this.options.unloadInvisibleTiles||this.options.reuseTiles)&&this._removeOtherTiles(n))}},_addTilesFromCenterOut:function(n){for(var i,o,f=[],h=n.getCenter(),e,s,u=n.min.y;u<=n.max.y;u++)for(i=n.min.x;i<=n.max.x;i++)o=new r.Point(i,u),this._tileShouldBeLoaded(o)&&f.push(o);if(e=f.length,0!==e){for(f.sort(function(n,t){return n.distanceTo(h)-t.distanceTo(h)}),s=t.createDocumentFragment(),this._tilesToLoad||this.fire("loading"),this._tilesToLoad+=e,i=0;e>i;i++)this._addTile(f[i],s);this._tileContainer.appendChild(s)}},_tileShouldBeLoaded:function(n){var t,i;if(n.x+":"+n.y in this._tiles||(t=this.options,!t.continuousWorld&&(i=this._getWrapTileNum(),t.noWrap&&(n.x<0||n.x>=i.x)||n.y<0||n.y>=i.y)))return!1;if(t.bounds){var r=t.tileSize,e=n.multiplyBy(r),o=e.add([r,r]),u=this._map.unproject(e),f=this._map.unproject(o);if(t.continuousWorld||t.noWrap||(u=u.wrap(),f=f.wrap()),!t.bounds.intersects([u,f]))return!1}return!0},_removeOtherTiles:function(n){var t,i,r;for(var u in this._tiles)t=u.split(":"),i=parseInt(t[0],10),r=parseInt(t[1],10),(i<n.min.x||i>n.max.x||r<n.min.y||r>n.max.y)&&this._removeTile(u)},_removeTile:function(n){var t=this._tiles[n];this.fire("tileunload",{tile:t,url:t.src});this.options.reuseTiles?(r.DomUtil.removeClass(t,"leaflet-tile-loaded"),this._unusedTiles.push(t)):t.parentNode===this._tileContainer&&this._tileContainer.removeChild(t);r.Browser.android||(t.onload=null,t.src=r.Util.emptyImageUrl);delete this._tiles[n]},_addTile:function(n,t){var u=this._getTilePos(n),i=this._getTile();r.DomUtil.setPosition(i,u,r.Browser.chrome);this._tiles[n.x+":"+n.y]=i;this._loadTile(i,n);i.parentNode!==this._tileContainer&&t.appendChild(i)},_getZoomForUrl:function(){var n=this.options,t=this._map.getZoom();return n.zoomReverse&&(t=n.maxZoom-t),t+=n.zoomOffset,n.maxNativeZoom?Math.min(t,n.maxNativeZoom):t},_getTilePos:function(n){var t=this._map.getPixelOrigin(),i=this._getTileSize();return n.multiplyBy(i).subtract(t)},getTileUrl:function(n){return r.Util.template(this._url,r.extend({s:this._getSubdomain(n),z:n.z,x:n.x,y:n.y},this.options))},_getWrapTileNum:function(){var n=this._map.options.crs,t=n.getSize(this._map.getZoom());return t.divideBy(this._getTileSize())._floor()},_adjustTilePoint:function(n){var t=this._getWrapTileNum();this.options.continuousWorld||this.options.noWrap||(n.x=(n.x%t.x+t.x)%t.x);this.options.tms&&(n.y=t.y-n.y-1);n.z=this._getZoomForUrl()},_getSubdomain:function(n){var t=Math.abs(n.x+n.y)%this.options.subdomains.length;return this.options.subdomains[t]},_getTile:function(){if(this.options.reuseTiles&&this._unusedTiles.length>0){var n=this._unusedTiles.pop();return this._resetTile(n),n}return this._createTile()},_resetTile:function(){},_createTile:function(){var n=r.DomUtil.create("img","leaflet-tile");return n.style.width=n.style.height=this._getTileSize()+"px",n.galleryimg="no",n.onselectstart=n.onmousemove=r.Util.falseFn,r.Browser.ielt9&&this.options.opacity!==i&&r.DomUtil.setOpacity(n,this.options.opacity),r.Browser.mobileWebkit3d&&(n.style.WebkitBackfaceVisibility="hidden"),n},_loadTile:function(n,t){n._layer=this;n.onload=this._tileOnLoad;n.onerror=this._tileOnError;this._adjustTilePoint(t);n.src=this.getTileUrl(t);this.fire("tileloadstart",{tile:n,url:n.src})},_tileLoaded:function(){this._tilesToLoad--;this._animated&&r.DomUtil.addClass(this._tileContainer,"leaflet-zoom-animated");this._tilesToLoad||(this.fire("load"),this._animated&&(clearTimeout(this._clearBgBufferTimer),this._clearBgBufferTimer=setTimeout(r.bind(this._clearBgBuffer,this),500)))},_tileOnLoad:function(){var n=this._layer;this.src!==r.Util.emptyImageUrl&&(r.DomUtil.addClass(this,"leaflet-tile-loaded"),n.fire("tileload",{tile:this,url:this.src}));n._tileLoaded()},_tileOnError:function(){var n=this._layer,t;n.fire("tileerror",{tile:this,url:this.src});t=n.options.errorTileUrl;t&&(this.src=t);n._tileLoaded()}});r.tileLayer=function(n,t){return new r.TileLayer(n,t)};r.TileLayer.WMS=r.TileLayer.extend({defaultWmsParams:{service:"WMS",request:"GetMap",version:"1.1.1",layers:"",styles:"",format:"image/jpeg",transparent:!1},initialize:function(n,t){var i,f,u;this._url=n;i=r.extend({},this.defaultWmsParams);f=t.tileSize||this.options.tileSize;i.width=i.height=t.detectRetina&&r.Browser.retina?2*f:f;for(u in t)this.options.hasOwnProperty(u)||"crs"===u||(i[u]=t[u]);this.wmsParams=i;r.setOptions(this,t)},onAdd:function(n){this._crs=this.options.crs||n.options.crs;this._wmsVersion=parseFloat(this.wmsParams.version);var t=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[t]=this._crs.code;r.TileLayer.prototype.onAdd.call(this,n)},getTileUrl:function(n){var f=this._map,u=this.options.tileSize,e=n.multiplyBy(u),s=e.add([u,u]),t=this._crs.project(f.unproject(e,n.z)),i=this._crs.project(f.unproject(s,n.z)),h=this._wmsVersion>=1.3&&this._crs===r.CRS.EPSG4326?[i.y,t.x,t.y,i.x].join(","):[t.x,i.y,i.x,t.y].join(","),o=r.Util.template(this._url,{s:this._getSubdomain(n)});return o+r.Util.getParamString(this.wmsParams,o,!0)+"&BBOX="+h},setParams:function(n,t){return r.extend(this.wmsParams,n),t||this.redraw(),this}});r.tileLayer.wms=function(n,t){return new r.TileLayer.WMS(n,t)};r.TileLayer.Canvas=r.TileLayer.extend({options:{async:!1},initialize:function(n){r.setOptions(this,n)},redraw:function(){this._map&&(this._reset({hard:!0}),this._update());for(var n in this._tiles)this._redrawTile(this._tiles[n]);return this},_redrawTile:function(n){this.drawTile(n,n._tilePoint,this._map._zoom)},_createTile:function(){var n=r.DomUtil.create("canvas","leaflet-tile");return n.width=n.height=this.options.tileSize,n.onselectstart=n.onmousemove=r.Util.falseFn,n},_loadTile:function(n,t){n._layer=this;n._tilePoint=t;this._redrawTile(n);this.options.async||this.tileDrawn(n)},drawTile:function(){},tileDrawn:function(n){this._tileOnLoad.call(n)}});r.tileLayer.canvas=function(n){return new r.TileLayer.Canvas(n)};r.ImageOverlay=r.Class.extend({includes:r.Mixin.Events,options:{opacity:1},initialize:function(n,t,i){this._url=n;this._bounds=r.latLngBounds(t);r.setOptions(this,i)},onAdd:function(n){this._map=n;this._image||this._initImage();n._panes.overlayPane.appendChild(this._image);n.on("viewreset",this._reset,this);n.options.zoomAnimation&&r.Browser.any3d&&n.on("zoomanim",this._animateZoom,this);this._reset()},onRemove:function(n){n.getPanes().overlayPane.removeChild(this._image);n.off("viewreset",this._reset,this);n.options.zoomAnimation&&n.off("zoomanim",this._animateZoom,this)},addTo:function(n){return n.addLayer(this),this},setOpacity:function(n){return this.options.opacity=n,this._updateOpacity(),this},bringToFront:function(){return this._image&&this._map._panes.overlayPane.appendChild(this._image),this},bringToBack:function(){var n=this._map._panes.overlayPane;return this._image&&n.insertBefore(this._image,n.firstChild),this},setUrl:function(n){this._url=n;this._image.src=this._url},getAttribution:function(){return this.options.attribution},_initImage:function(){this._image=r.DomUtil.create("img","leaflet-image-layer");this._map.options.zoomAnimation&&r.Browser.any3d?r.DomUtil.addClass(this._image,"leaflet-zoom-animated"):r.DomUtil.addClass(this._image,"leaflet-zoom-hide");this._updateOpacity();r.extend(this._image,{galleryimg:"no",onselectstart:r.Util.falseFn,onmousemove:r.Util.falseFn,onload:r.bind(this._onImageLoad,this),src:this._url})},_animateZoom:function(n){var t=this._map,f=this._image,i=t.getZoomScale(n.zoom),e=this._bounds.getNorthWest(),o=this._bounds.getSouthEast(),u=t._latLngToNewLayerPoint(e,n.zoom,n.center),s=t._latLngToNewLayerPoint(o,n.zoom,n.center)._subtract(u),h=u._add(s._multiplyBy(.5*(1-1/i)));f.style[r.DomUtil.TRANSFORM]=r.DomUtil.getTranslateString(h)+" scale("+i+") "},_reset:function(){var n=this._image,t=this._map.latLngToLayerPoint(this._bounds.getNorthWest()),i=this._map.latLngToLayerPoint(this._bounds.getSouthEast())._subtract(t);r.DomUtil.setPosition(n,t);n.style.width=i.x+"px";n.style.height=i.y+"px"},_onImageLoad:function(){this.fire("load")},_updateOpacity:function(){r.DomUtil.setOpacity(this._image,this.options.opacity)}});r.imageOverlay=function(n,t,i){return new r.ImageOverlay(n,t,i)};r.Icon=r.Class.extend({options:{className:""},initialize:function(n){r.setOptions(this,n)},createIcon:function(n){return this._createIcon("icon",n)},createShadow:function(n){return this._createIcon("shadow",n)},_createIcon:function(n,t){var i=this._getIconUrl(n),r;if(!i){if("icon"===n)throw new Error("iconUrl not set in Icon options (see the docs).");return null}return r=t&&"IMG"===t.tagName?this._createImg(i,t):this._createImg(i),this._setIconStyles(r,n),r},_setIconStyles:function(n,t){var i,u=this.options,f=r.point(u[t+"Size"]);i=r.point("shadow"===t?u.shadowAnchor||u.iconAnchor:u.iconAnchor);!i&&f&&(i=f.divideBy(2,!0));n.className="leaflet-marker-"+t+" "+u.className;i&&(n.style.marginLeft=-i.x+"px",n.style.marginTop=-i.y+"px");f&&(n.style.width=f.x+"px",n.style.height=f.y+"px")},_createImg:function(n,i){return i=i||t.createElement("img"),i.src=n,i},_getIconUrl:function(n){return r.Browser.retina&&this.options[n+"RetinaUrl"]?this.options[n+"RetinaUrl"]:this.options[n+"Url"]}});r.icon=function(n){return new r.Icon(n)};r.Icon.Default=r.Icon.extend({options:{iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],shadowSize:[41,41]},_getIconUrl:function(n){var i=n+"Url",t;if(this.options[i])return this.options[i];if(r.Browser.retina&&"icon"===n&&(n+="-2x"),t=r.Icon.Default.imagePath,!t)throw new Error("Couldn't autodetect L.Icon.Default.imagePath, set it manually.");return t+"/marker-"+n+".png"}});r.Icon.Default.imagePath=function(){for(var i,o,r,f=t.getElementsByTagName("script"),e=/[\/^]leaflet[\-\._]?([\w\-\._]*)\.js\??/,n=0,u=f.length;u>n;n++)if(i=f[n].src,o=i.match(e))return r=i.split(e)[0],(r?r+"/":"")+"images"}();r.Marker=r.Class.extend({includes:r.Mixin.Events,options:{icon:new r.Icon.Default,title:"",alt:"",clickable:!0,draggable:!1,keyboard:!0,zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250},initialize:function(n,t){r.setOptions(this,t);this._latlng=r.latLng(n)},onAdd:function(n){this._map=n;n.on("viewreset",this.update,this);this._initIcon();this.update();this.fire("add");n.options.zoomAnimation&&n.options.markerZoomAnimation&&n.on("zoomanim",this._animateZoom,this)},addTo:function(n){return n.addLayer(this),this},onRemove:function(n){this.dragging&&this.dragging.disable();this._removeIcon();this._removeShadow();this.fire("remove");n.off({viewreset:this.update,zoomanim:this._animateZoom},this);this._map=null},getLatLng:function(){return this._latlng},setLatLng:function(n){return this._latlng=r.latLng(n),this.update(),this.fire("move",{latlng:this._latlng})},setZIndexOffset:function(n){return this.options.zIndexOffset=n,this.update(),this},setIcon:function(n){return this.options.icon=n,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup),this},update:function(){if(this._icon){var n=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(n)}return this},_initIcon:function(){var n=this.options,e=this._map,h=e.options.zoomAnimation&&e.options.markerZoomAnimation,o=h?"leaflet-zoom-animated":"leaflet-zoom-hide",t=n.icon.createIcon(this._icon),s=!1,i,u,f;t!==this._icon&&(this._icon&&this._removeIcon(),s=!0,n.title&&(t.title=n.title),n.alt&&(t.alt=n.alt));r.DomUtil.addClass(t,o);n.keyboard&&(t.tabIndex="0");this._icon=t;this._initInteraction();n.riseOnHover&&r.DomEvent.on(t,"mouseover",this._bringToFront,this).on(t,"mouseout",this._resetZIndex,this);i=n.icon.createShadow(this._shadow);u=!1;i!==this._shadow&&(this._removeShadow(),u=!0);i&&r.DomUtil.addClass(i,o);this._shadow=i;n.opacity<1&&this._updateOpacity();f=this._map._panes;s&&f.markerPane.appendChild(this._icon);i&&u&&f.shadowPane.appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&r.DomEvent.off(this._icon,"mouseover",this._bringToFront).off(this._icon,"mouseout",this._resetZIndex);this._map._panes.markerPane.removeChild(this._icon);this._icon=null},_removeShadow:function(){this._shadow&&this._map._panes.shadowPane.removeChild(this._shadow);this._shadow=null},_setPos:function(n){r.DomUtil.setPosition(this._icon,n);this._shadow&&r.DomUtil.setPosition(this._shadow,n);this._zIndex=n.y+this.options.zIndexOffset;this._resetZIndex()},_updateZIndex:function(n){this._icon.style.zIndex=this._zIndex+n},_animateZoom:function(n){var t=this._map._latLngToNewLayerPoint(this._latlng,n.zoom,n.center).round();this._setPos(t)},_initInteraction:function(){var n,i,t;if(this.options.clickable){for(n=this._icon,i=["dblclick","mousedown","mouseover","mouseout","contextmenu"],r.DomUtil.addClass(n,"leaflet-clickable"),r.DomEvent.on(n,"click",this._onMouseClick,this),r.DomEvent.on(n,"keypress",this._onKeyPress,this),t=0;t<i.length;t++)r.DomEvent.on(n,i[t],this._fireMouseEvent,this);r.Handler.MarkerDrag&&(this.dragging=new r.Handler.MarkerDrag(this),this.options.draggable&&this.dragging.enable())}},_onMouseClick:function(n){var t=this.dragging&&this.dragging.moved();(this.hasEventListeners(n.type)||t)&&r.DomEvent.stopPropagation(n);t||(this.dragging&&this.dragging._enabled||!this._map.dragging||!this._map.dragging.moved())&&this.fire(n.type,{originalEvent:n,latlng:this._latlng})},_onKeyPress:function(n){13===n.keyCode&&this.fire("click",{originalEvent:n,latlng:this._latlng})},_fireMouseEvent:function(n){this.fire(n.type,{originalEvent:n,latlng:this._latlng});"contextmenu"===n.type&&this.hasEventListeners(n.type)&&r.DomEvent.preventDefault(n);"mousedown"!==n.type?r.DomEvent.stopPropagation(n):r.DomEvent.preventDefault(n)},setOpacity:function(n){return this.options.opacity=n,this._map&&this._updateOpacity(),this},_updateOpacity:function(){r.DomUtil.setOpacity(this._icon,this.options.opacity);this._shadow&&r.DomUtil.setOpacity(this._shadow,this.options.opacity)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)}});r.marker=function(n,t){return new r.Marker(n,t)};r.DivIcon=r.Icon.extend({options:{iconSize:[12,12],className:"leaflet-div-icon",html:!1},createIcon:function(n){var r=n&&"DIV"===n.tagName?n:t.createElement("div"),i=this.options;return r.innerHTML=i.html!==!1?i.html:"",i.bgPos&&(r.style.backgroundPosition=-i.bgPos.x+"px "+-i.bgPos.y+"px"),this._setIconStyles(r,"icon"),r},createShadow:function(){return null}});r.divIcon=function(n){return new r.DivIcon(n)};r.Map.mergeOptions({closePopupOnClick:!0});r.Popup=r.Class.extend({includes:r.Mixin.Events,options:{minWidth:50,maxWidth:300,autoPan:!0,closeButton:!0,offset:[0,7],autoPanPadding:[5,5],keepInView:!1,className:"",zoomAnimation:!0},initialize:function(n,t){r.setOptions(this,n);this._source=t;this._animated=r.Browser.any3d&&this.options.zoomAnimation;this._isOpen=!1},onAdd:function(n){this._map=n;this._container||this._initLayout();var t=n.options.fadeAnimation;t&&r.DomUtil.setOpacity(this._container,0);n._panes.popupPane.appendChild(this._container);n.on(this._getEvents(),this);this.update();t&&r.DomUtil.setOpacity(this._container,1);this.fire("open");n.fire("popupopen",{popup:this});this._source&&this._source.fire("popupopen",{popup:this})},addTo:function(n){return n.addLayer(this),this},openOn:function(n){return n.openPopup(this),this},onRemove:function(n){n._panes.popupPane.removeChild(this._container);r.Util.falseFn(this._container.offsetWidth);n.off(this._getEvents(),this);n.options.fadeAnimation&&r.DomUtil.setOpacity(this._container,0);this._map=null;this.fire("close");n.fire("popupclose",{popup:this});this._source&&this._source.fire("popupclose",{popup:this})},getLatLng:function(){return this._latlng},setLatLng:function(n){return this._latlng=r.latLng(n),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(n){return this._content=n,this.update(),this},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},_getEvents:function(){var n={viewreset:this._updatePosition};return this._animated&&(n.zoomanim=this._zoomAnimation),("closeOnClick"in this.options?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(n.preclick=this._close),this.options.keepInView&&(n.moveend=this._adjustPan),n},_close:function(){this._map&&this._map.closePopup(this)},_initLayout:function(){var t,n="leaflet-popup",f=n+" "+this.options.className+" leaflet-zoom-"+(this._animated?"animated":"hide"),u=this._container=r.DomUtil.create("div",f),i;this.options.closeButton&&(t=this._closeButton=r.DomUtil.create("a",n+"-close-button",u),t.href="#close",t.innerHTML="&#215;",r.DomEvent.disableClickPropagation(t),r.DomEvent.on(t,"click",this._onCloseButtonClick,this));i=this._wrapper=r.DomUtil.create("div",n+"-content-wrapper",u);r.DomEvent.disableClickPropagation(i);this._contentNode=r.DomUtil.create("div",n+"-content",i);r.DomEvent.disableScrollPropagation(this._contentNode);r.DomEvent.on(i,"contextmenu",r.DomEvent.stopPropagation);this._tipContainer=r.DomUtil.create("div",n+"-tip-container",u);this._tip=r.DomUtil.create("div",n+"-tip",this._tipContainer)},_updateContent:function(){if(this._content){if("string"==typeof this._content)this._contentNode.innerHTML=this._content;else{for(;this._contentNode.hasChildNodes();)this._contentNode.removeChild(this._contentNode.firstChild);this._contentNode.appendChild(this._content)}this.fire("contentupdate")}},_updateLayout:function(){var i=this._contentNode,n=i.style,t;n.width="";n.whiteSpace="nowrap";t=i.offsetWidth;t=Math.min(t,this.options.maxWidth);t=Math.max(t,this.options.minWidth);n.width=t+1+"px";n.whiteSpace="";n.height="";var e=i.offsetHeight,u=this.options.maxHeight,f="leaflet-popup-scrolled";u&&e>u?(n.height=u+"px",r.DomUtil.addClass(i,f)):r.DomUtil.removeClass(i,f);this._containerWidth=this._container.offsetWidth},_updatePosition:function(){if(this._map){var n=this._map.latLngToLayerPoint(this._latlng),t=this._animated,i=r.point(this.options.offset);t&&r.DomUtil.setPosition(this._container,n);this._containerBottom=-i.y-(t?0:n.y);this._containerLeft=-Math.round(this._containerWidth/2)+i.x+(t?0:n.x);this._container.style.bottom=this._containerBottom+"px";this._container.style.left=this._containerLeft+"px"}},_zoomAnimation:function(n){var t=this._map._latLngToNewLayerPoint(this._latlng,n.zoom,n.center);r.DomUtil.setPosition(this._container,t)},_adjustPan:function(){if(this.options.autoPan){var o=this._map,s=this._container.offsetHeight,h=this._containerWidth,c=new r.Point(this._containerLeft,-s-this._containerBottom);this._animated&&c._add(r.DomUtil.getPosition(this._container));var n=o.layerPointToContainerPoint(c),l=r.point(this.options.autoPanPadding),u=r.point(this.options.autoPanPaddingTopLeft||l),f=r.point(this.options.autoPanPaddingBottomRight||l),e=o.getSize(),t=0,i=0;n.x+h+f.x>e.x&&(t=n.x+h-e.x+f.x);n.x-t-u.x<0&&(t=n.x-u.x);n.y+s+f.y>e.y&&(i=n.y+s-e.y+f.y);n.y-i-u.y<0&&(i=n.y-u.y);(t||i)&&o.fire("autopanstart").panBy([t,i])}},_onCloseButtonClick:function(n){this._close();r.DomEvent.stop(n)}});r.popup=function(n,t){return new r.Popup(n,t)};r.Map.include({openPopup:function(n,t,i){if(this.closePopup(),!(n instanceof r.Popup)){var u=n;n=new r.Popup(i).setLatLng(t).setContent(u)}return n._isOpen=!0,this._popup=n,this.addLayer(n)},closePopup:function(n){return n&&n!==this._popup||(n=this._popup,this._popup=null),n&&(this.removeLayer(n),n._isOpen=!1),this}});r.Marker.include({openPopup:function(){return this._popup&&this._map&&!this._map.hasLayer(this._popup)&&(this._popup.setLatLng(this._latlng),this._map.openPopup(this._popup)),this},closePopup:function(){return this._popup&&this._popup._close(),this},togglePopup:function(){return this._popup&&(this._popup._isOpen?this.closePopup():this.openPopup()),this},bindPopup:function(n,t){var i=r.point(this.options.icon.options.popupAnchor||[0,0]);return i=i.add(r.Popup.prototype.options.offset),t&&t.offset&&(i=i.add(t.offset)),t=r.extend({offset:i},t),this._popupHandlersAdded||(this.on("click",this.togglePopup,this).on("remove",this.closePopup,this).on("move",this._movePopup,this),this._popupHandlersAdded=!0),n instanceof r.Popup?(r.setOptions(n,t),this._popup=n):this._popup=new r.Popup(t,this).setContent(n),this},setPopupContent:function(n){return this._popup&&this._popup.setContent(n),this},unbindPopup:function(){return this._popup&&(this._popup=null,this.off("click",this.togglePopup,this).off("remove",this.closePopup,this).off("move",this._movePopup,this),this._popupHandlersAdded=!1),this},getPopup:function(){return this._popup},_movePopup:function(n){this._popup.setLatLng(n.latlng)}});r.LayerGroup=r.Class.extend({initialize:function(n){this._layers={};var t,i;if(n)for(t=0,i=n.length;i>t;t++)this.addLayer(n[t])},addLayer:function(n){var t=this.getLayerId(n);return this._layers[t]=n,this._map&&this._map.addLayer(n),this},removeLayer:function(n){var t=n in this._layers?n:this.getLayerId(n);return this._map&&this._layers[t]&&this._map.removeLayer(this._layers[t]),delete this._layers[t],this},hasLayer:function(n){return n?n in this._layers||this.getLayerId(n)in this._layers:!1},clearLayers:function(){return this.eachLayer(this.removeLayer,this),this},invoke:function(n){var i,t,r=Array.prototype.slice.call(arguments,1);for(i in this._layers)t=this._layers[i],t[n]&&t[n].apply(t,r);return this},onAdd:function(n){this._map=n;this.eachLayer(n.addLayer,n)},onRemove:function(n){this.eachLayer(n.removeLayer,n);this._map=null},addTo:function(n){return n.addLayer(this),this},eachLayer:function(n,t){for(var i in this._layers)n.call(t,this._layers[i]);return this},getLayer:function(n){return this._layers[n]},getLayers:function(){var n=[];for(var t in this._layers)n.push(this._layers[t]);return n},setZIndex:function(n){return this.invoke("setZIndex",n)},getLayerId:function(n){return r.stamp(n)}});r.layerGroup=function(n){return new r.LayerGroup(n)};r.FeatureGroup=r.LayerGroup.extend({includes:r.Mixin.Events,statics:{EVENTS:"click dblclick mouseover mouseout mousemove contextmenu popupopen popupclose"},addLayer:function(n){return this.hasLayer(n)?this:("on"in n&&n.on(r.FeatureGroup.EVENTS,this._propagateEvent,this),r.LayerGroup.prototype.addLayer.call(this,n),this._popupContent&&n.bindPopup&&n.bindPopup(this._popupContent,this._popupOptions),this.fire("layeradd",{layer:n}))},removeLayer:function(n){return this.hasLayer(n)?(n in this._layers&&(n=this._layers[n]),n.off(r.FeatureGroup.EVENTS,this._propagateEvent,this),r.LayerGroup.prototype.removeLayer.call(this,n),this._popupContent&&this.invoke("unbindPopup"),this.fire("layerremove",{layer:n})):this},bindPopup:function(n,t){return this._popupContent=n,this._popupOptions=t,this.invoke("bindPopup",n,t)},openPopup:function(n){for(var t in this._layers){this._layers[t].openPopup(n);break}return this},setStyle:function(n){return this.invoke("setStyle",n)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var n=new r.LatLngBounds;return this.eachLayer(function(t){n.extend(t instanceof r.Marker?t.getLatLng():t.getBounds())}),n},_propagateEvent:function(n){n=r.extend({layer:n.target,target:this},n);this.fire(n.type,n)}});r.featureGroup=function(n){return new r.FeatureGroup(n)};r.Path=r.Class.extend({includes:[r.Mixin.Events],statics:{CLIP_PADDING:function(){var t=r.Browser.mobile?1280:2e3,i=(t/Math.max(n.outerWidth,n.outerHeight)-1)/2;return Math.max(0,Math.min(.5,i))}()},options:{stroke:!0,color:"#0033ff",dashArray:null,lineCap:null,lineJoin:null,weight:5,opacity:.5,fill:!1,fillColor:null,fillOpacity:.2,clickable:!0},initialize:function(n){r.setOptions(this,n)},onAdd:function(n){this._map=n;this._container||(this._initElements(),this._initEvents());this.projectLatlngs();this._updatePath();this._container&&this._map._pathRoot.appendChild(this._container);this.fire("add");n.on({viewreset:this.projectLatlngs,moveend:this._updatePath},this)},addTo:function(n){return n.addLayer(this),this},onRemove:function(n){n._pathRoot.removeChild(this._container);this.fire("remove");this._map=null;r.Browser.vml&&(this._container=null,this._stroke=null,this._fill=null);n.off({viewreset:this.projectLatlngs,moveend:this._updatePath},this)},projectLatlngs:function(){},setStyle:function(n){return r.setOptions(this,n),this._container&&this._updateStyle(),this},redraw:function(){return this._map&&(this.projectLatlngs(),this._updatePath()),this}});r.Map.include({_updatePathViewport:function(){var n=r.Path.CLIP_PADDING,t=this.getSize(),u=r.DomUtil.getPosition(this._mapPane),i=u.multiplyBy(-1)._subtract(t.multiplyBy(n)._round()),f=i.add(t.multiplyBy(1+2*n)._round());this._pathViewport=new r.Bounds(i,f)}});r.Path.SVG_NS="http://www.w3.org/2000/svg";r.Browser.svg=!(!t.createElementNS||!t.createElementNS(r.Path.SVG_NS,"svg").createSVGRect);r.Path=r.Path.extend({statics:{SVG:r.Browser.svg},bringToFront:function(){var t=this._map._pathRoot,n=this._container;return n&&t.lastChild!==n&&t.appendChild(n),this},bringToBack:function(){var t=this._map._pathRoot,n=this._container,i=t.firstChild;return n&&i!==n&&t.insertBefore(n,i),this},getPathString:function(){},_createElement:function(n){return t.createElementNS(r.Path.SVG_NS,n)},_initElements:function(){this._map._initPathRoot();this._initPath();this._initStyle()},_initPath:function(){this._container=this._createElement("g");this._path=this._createElement("path");this.options.className&&r.DomUtil.addClass(this._path,this.options.className);this._container.appendChild(this._path)},_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.options.pointerEvents&&this._path.setAttribute("pointer-events",this.options.pointerEvents);this.options.clickable||this.options.pointerEvents||this._path.setAttribute("pointer-events","none");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.options.dashArray?this._path.setAttribute("stroke-dasharray",this.options.dashArray):this._path.removeAttribute("stroke-dasharray"),this.options.lineCap&&this._path.setAttribute("stroke-linecap",this.options.lineCap),this.options.lineJoin&&this._path.setAttribute("stroke-linejoin",this.options.lineJoin)):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 n=this.getPathString();n||(n="M0 0");this._path.setAttribute("d",n)},_initEvents:function(){if(this.options.clickable){(r.Browser.svg||!r.Browser.vml)&&r.DomUtil.addClass(this._path,"leaflet-clickable");r.DomEvent.on(this._container,"click",this._onMouseClick,this);for(var t=["dblclick","mousedown","mouseover","mouseout","mousemove","contextmenu"],n=0;n<t.length;n++)r.DomEvent.on(this._container,t[n],this._fireMouseEvent,this)}},_onMouseClick:function(n){this._map.dragging&&this._map.dragging.moved()||this._fireMouseEvent(n)},_fireMouseEvent:function(n){if(this.hasEventListeners(n.type)){var t=this._map,i=t.mouseEventToContainerPoint(n),u=t.containerPointToLayerPoint(i),f=t.layerPointToLatLng(u);this.fire(n.type,{latlng:f,layerPoint:u,containerPoint:i,originalEvent:n});"contextmenu"===n.type&&r.DomEvent.preventDefault(n);"mousemove"!==n.type&&r.DomEvent.stopPropagation(n)}}});r.Map.include({_initPathRoot:function(){this._pathRoot||(this._pathRoot=r.Path.prototype._createElement("svg"),this._panes.overlayPane.appendChild(this._pathRoot),this.options.zoomAnimation&&r.Browser.any3d?(r.DomUtil.addClass(this._pathRoot,"leaflet-zoom-animated"),this.on({zoomanim:this._animatePathZoom,zoomend:this._endPathZoom})):r.DomUtil.addClass(this._pathRoot,"leaflet-zoom-hide"),this.on("moveend",this._updateSvgViewport),this._updateSvgViewport())},_animatePathZoom:function(n){var t=this.getZoomScale(n.zoom),i=this._getCenterOffset(n.center)._multiplyBy(-t)._add(this._pathViewport.min);this._pathRoot.style[r.DomUtil.TRANSFORM]=r.DomUtil.getTranslateString(i)+" scale("+t+") ";this._pathZooming=!0},_endPathZoom:function(){this._pathZooming=!1},_updateSvgViewport:function(){if(!this._pathZooming){this._updatePathViewport();var i=this._pathViewport,t=i.min,u=i.max,f=u.x-t.x,e=u.y-t.y,n=this._pathRoot,o=this._panes.overlayPane;r.Browser.mobileWebkit&&o.removeChild(n);r.DomUtil.setPosition(n,t);n.setAttribute("width",f);n.setAttribute("height",e);n.setAttribute("viewBox",[t.x,t.y,f,e].join(" "));r.Browser.mobileWebkit&&o.appendChild(n)}}});r.Path.include({bindPopup:function(n,t){return n instanceof r.Popup?this._popup=n:((!this._popup||t)&&(this._popup=new r.Popup(t,this)),this._popup.setContent(n)),this._popupHandlersAdded||(this.on("click",this._openPopup,this).on("remove",this.closePopup,this),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this._popup=null,this.off("click",this._openPopup).off("remove",this.closePopup),this._popupHandlersAdded=!1),this},openPopup:function(n){return this._popup&&(n=n||this._latlng||this._latlngs[Math.floor(this._latlngs.length/2)],this._openPopup({latlng:n})),this},closePopup:function(){return this._popup&&this._popup._close(),this},_openPopup:function(n){this._popup.setLatLng(n.latlng);this._map.openPopup(this._popup)}});r.Browser.vml=!r.Browser.svg&&function(){var i,n;try{return i=t.createElement("div"),i.innerHTML='<v:shape adj="1"/>',n=i.firstChild,n.style.behavior="url(#default#VML)",n&&"object"==typeof n.adj}catch(r){return!1}}();r.Path=r.Browser.svg||!r.Browser.vml?r.Path:r.Path.extend({statics:{VML:!0,CLIP_PADDING:.02},_createElement:function(){try{return t.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(n){return t.createElement("<lvml:"+n+' class="lvml">')}}catch(n){return function(n){return t.createElement("<"+n+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),_initPath:function(){var n=this._container=this._createElement("shape");r.DomUtil.addClass(n,"leaflet-vml-shape"+(this.options.className?" "+this.options.className:""));this.options.clickable&&r.DomUtil.addClass(n,"leaflet-clickable");n.coordsize="1 1";this._path=this._createElement("path");n.appendChild(this._path);this._map._pathRoot.appendChild(n)},_initStyle:function(){this._updateStyle()},_updateStyle:function(){var t=this._stroke,i=this._fill,n=this.options,u=this._container;u.stroked=n.stroke;u.filled=n.fill;n.stroke?(t||(t=this._stroke=this._createElement("stroke"),t.endcap="round",u.appendChild(t)),t.weight=n.weight+"px",t.color=n.color,t.opacity=n.opacity,t.dashStyle=n.dashArray?r.Util.isArray(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):"",n.lineCap&&(t.endcap=n.lineCap.replace("butt","flat")),n.lineJoin&&(t.joinstyle=n.lineJoin)):t&&(u.removeChild(t),this._stroke=null);n.fill?(i||(i=this._fill=this._createElement("fill"),u.appendChild(i)),i.color=n.fillColor||n.color,i.opacity=n.fillOpacity):i&&(u.removeChild(i),this._fill=null)},_updatePath:function(){var n=this._container.style;n.display="none";this._path.v=this.getPathString()+" ";n.display=""}});r.Map.include(r.Browser.svg||!r.Browser.vml?{}:{_initPathRoot:function(){if(!this._pathRoot){var n=this._pathRoot=t.createElement("div");n.className="leaflet-vml-container";this._panes.overlayPane.appendChild(n);this.on("moveend",this._updatePathViewport);this._updatePathViewport()}}});r.Browser.canvas=function(){return!!t.createElement("canvas").getContext}();r.Path=r.Path.SVG&&!n.L_PREFER_CANVAS||!r.Browser.canvas?r.Path:r.Path.extend({statics:{CANVAS:!0,SVG:!1},redraw:function(){return this._map&&(this.projectLatlngs(),this._requestUpdate()),this},setStyle:function(n){return r.setOptions(this,n),this._map&&(this._updateStyle(),this._requestUpdate()),this},onRemove:function(n){n.off("viewreset",this.projectLatlngs,this).off("moveend",this._updatePath,this);this.options.clickable&&(this._map.off("click",this._onClick,this),this._map.off("mousemove",this._onMouseMove,this));this._requestUpdate();this._map=null},_requestUpdate:function(){this._map&&!r.Path._updateRequest&&(r.Path._updateRequest=r.Util.requestAnimFrame(this._fireMapMoveEnd,this._map))},_fireMapMoveEnd:function(){r.Path._updateRequest=null;this.fire("moveend")},_initElements:function(){this._map._initPathRoot();this._ctx=this._map._canvasCtx},_updateStyle:function(){var n=this.options;n.stroke&&(this._ctx.lineWidth=n.weight,this._ctx.strokeStyle=n.color);n.fill&&(this._ctx.fillStyle=n.fillColor||n.color)},_drawPath:function(){var n,t,u,f,i,e;for(this._ctx.beginPath(),n=0,u=this._parts.length;u>n;n++){for(t=0,f=this._parts[n].length;f>t;t++)i=this._parts[n][t],e=(0===t?"move":"line")+"To",this._ctx[e](i.x,i.y);this instanceof r.Polygon&&this._ctx.closePath()}},_checkIfEmpty:function(){return!this._parts.length},_updatePath:function(){if(!this._checkIfEmpty()){var n=this._ctx,t=this.options;this._drawPath();n.save();this._updateStyle();t.fill&&(n.globalAlpha=t.fillOpacity,n.fill());t.stroke&&(n.globalAlpha=t.opacity,n.stroke());n.restore()}},_initEvents:function(){this.options.clickable&&(this._map.on("mousemove",this._onMouseMove,this),this._map.on("click",this._onClick,this))},_onClick:function(n){this._containsPoint(n.layerPoint)&&this.fire("click",n)},_onMouseMove:function(n){this._map&&!this._map._animatingZoom&&(this._containsPoint(n.layerPoint)?(this._ctx.canvas.style.cursor="pointer",this._mouseInside=!0,this.fire("mouseover",n)):this._mouseInside&&(this._ctx.canvas.style.cursor="",this._mouseInside=!1,this.fire("mouseout",n)))}});r.Map.include(r.Path.SVG&&!n.L_PREFER_CANVAS||!r.Browser.canvas?{}:{_initPathRoot:function(){var i,n=this._pathRoot;n||(n=this._pathRoot=t.createElement("canvas"),n.style.position="absolute",i=this._canvasCtx=n.getContext("2d"),i.lineCap="round",i.lineJoin="round",this._panes.overlayPane.appendChild(n),this.options.zoomAnimation&&(this._pathRoot.className="leaflet-zoom-animated",this.on("zoomanim",this._animatePathZoom),this.on("zoomend",this._endPathZoom)),this.on("moveend",this._updateCanvasViewport),this._updateCanvasViewport())},_updateCanvasViewport:function(){if(!this._pathZooming){this._updatePathViewport();var i=this._pathViewport,n=i.min,u=i.max.subtract(n),t=this._pathRoot;r.DomUtil.setPosition(t,n);t.width=u.x;t.height=u.y;t.getContext("2d").translate(-n.x,-n.y)}}});r.LineUtil={simplify:function(n,t){if(!t||!n.length)return n.slice();var i=t*t;return n=this._reducePoints(n,i),n=this._simplifyDP(n,i)},pointToSegmentDistance:function(n,t,i){return Math.sqrt(this._sqClosestPointOnSegment(n,t,i,!0))},closestPointOnSegment:function(n,t,i){return this._sqClosestPointOnSegment(n,t,i)},_simplifyDP:function(n,t){var u=n.length,o=typeof Uint8Array!=i+""?Uint8Array:Array,f=new o(u),r,e;for(f[0]=f[u-1]=1,this._simplifyDPStep(n,f,t,0,u-1),e=[],r=0;u>r;r++)f[r]&&e.push(n[r]);return e},_simplifyDPStep:function(n,t,i,r,u){for(var e,o,s=0,f=r+1;u-1>=f;f++)o=this._sqClosestPointOnSegment(n[f],n[r],n[u],!0),o>s&&(e=f,s=o);s>i&&(t[e]=1,this._simplifyDPStep(n,t,i,r,e),this._simplifyDPStep(n,t,i,e,u))},_reducePoints:function(n,t){for(var r=[n[0]],i=1,u=0,f=n.length;f>i;i++)this._sqDist(n[i],n[u])>t&&(r.push(n[i]),u=i);return f-1>u&&r.push(n[f-1]),r},clipSegment:function(n,t,i,r){var o,e,s,u=r?this._lastCode:this._getBitCode(n,i),f=this._getBitCode(t,i);for(this._lastCode=f;;){if(!(u|f))return[n,t];if(u&f)return!1;o=u||f;e=this._getEdgeIntersection(n,t,o,i);s=this._getBitCode(e,i);o===u?(n=e,u=s):(t=e,f=s)}},_getEdgeIntersection:function(n,t,i,u){var f=t.x-n.x,e=t.y-n.y,o=u.min,s=u.max;return 8&i?new r.Point(n.x+f*(s.y-n.y)/e,s.y):4&i?new r.Point(n.x+f*(o.y-n.y)/e,o.y):2&i?new r.Point(s.x,n.y+e*(s.x-n.x)/f):1&i?new r.Point(o.x,n.y+e*(o.x-n.x)/f):void 0},_getBitCode:function(n,t){var i=0;return n.x<t.min.x?i|=1:n.x>t.max.x&&(i|=2),n.y<t.min.y?i|=4:n.y>t.max.y&&(i|=8),i},_sqDist:function(n,t){var i=t.x-n.x,r=t.y-n.y;return i*i+r*r},_sqClosestPointOnSegment:function(n,t,i,u){var h,o=t.x,s=t.y,f=i.x-o,e=i.y-s,c=f*f+e*e;return c>0&&(h=((n.x-o)*f+(n.y-s)*e)/c,h>1?(o=i.x,s=i.y):h>0&&(o+=f*h,s+=e*h)),f=n.x-o,e=n.y-s,u?f*f+e*e:new r.Point(o,s)}};r.Polyline=r.Path.extend({initialize:function(n,t){r.Path.prototype.initialize.call(this,t);this._latlngs=this._convertLatLngs(n)},options:{smoothFactor:1,noClip:!1},projectLatlngs:function(){this._originalPoints=[];for(var n=0,t=this._latlngs.length;t>n;n++)this._originalPoints[n]=this._map.latLngToLayerPoint(this._latlngs[n])},getPathString:function(){for(var n=0,i=this._parts.length,t="";i>n;n++)t+=this._getPathPartStr(this._parts[n]);return t},getLatLngs:function(){return this._latlngs},setLatLngs:function(n){return this._latlngs=this._convertLatLngs(n),this.redraw()},addLatLng:function(n){return this._latlngs.push(r.latLng(n)),this.redraw()},spliceLatLngs:function(){var n=[].splice.apply(this._latlngs,arguments);return this._convertLatLngs(this._latlngs,!0),this.redraw(),n},closestLayerPoint:function(n){for(var h,u,f,e=1/0,c=this._parts,t=null,o=0,l=c.length;l>o;o++)for(var s=c[o],i=1,a=s.length;a>i;i++)u=s[i-1],f=s[i],h=r.LineUtil._sqClosestPointOnSegment(n,u,f,!0),e>h&&(e=h,t=r.LineUtil._sqClosestPointOnSegment(n,u,f));return t&&(t.distance=Math.sqrt(e)),t},getBounds:function(){return new r.LatLngBounds(this.getLatLngs())},_convertLatLngs:function(n,t){for(var f=t?n:[],i=0,u=n.length;u>i;i++){if(r.Util.isArray(n[i])&&"number"!=typeof n[i][0])return;f[i]=r.latLng(n[i])}return f},_initEvents:function(){r.Path.prototype._initEvents.call(this)},_getPathPartStr:function(n){for(var t,f=r.Path.VML,i=0,e=n.length,u="";e>i;i++)t=n[i],f&&t._round(),u+=(i?"L":"M")+t.x+" "+t.y;return u},_clipPoints:function(){var n,t,i,u=this._originalPoints,e=u.length;if(this.options.noClip)return void(this._parts=[u]);this._parts=[];var f=this._parts,o=this._map._pathViewport,s=r.LineUtil;for(n=0,t=0;e-1>n;n++)i=s.clipSegment(u[n],u[n+1],o,n),i&&(f[t]=f[t]||[],f[t].push(i[0]),(i[1]!==u[n+1]||n===e-2)&&(f[t].push(i[1]),t++))},_simplifyPoints:function(){for(var t=this._parts,i=r.LineUtil,n=0,u=t.length;u>n;n++)t[n]=i.simplify(t[n],this.options.smoothFactor)},_updatePath:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),r.Path.prototype._updatePath.call(this))}});r.polyline=function(n,t){return new r.Polyline(n,t)};r.PolyUtil={};r.PolyUtil.clipPolygon=function(n,t){for(var e,a,l,o,s,f,u,v=[1,4,2,8],c=r.LineUtil,i=0,h=n.length;h>i;i++)n[i]._code=c._getBitCode(n[i],t);for(l=0;4>l;l++){for(f=v[l],e=[],i=0,h=n.length,a=h-1;h>i;a=i++)o=n[i],s=n[a],o._code&f?s._code&f||(u=c._getEdgeIntersection(s,o,f,t),u._code=c._getBitCode(u,t),e.push(u)):(s._code&f&&(u=c._getEdgeIntersection(s,o,f,t),u._code=c._getBitCode(u,t),e.push(u)),e.push(o));n=e}return n};r.Polygon=r.Polyline.extend({options:{fill:!0},initialize:function(n,t){r.Polyline.prototype.initialize.call(this,n,t);this._initWithHoles(n)},_initWithHoles:function(n){var t,u,i;if(n&&r.Util.isArray(n[0])&&"number"!=typeof n[0][0])for(this._latlngs=this._convertLatLngs(n[0]),this._holes=n.slice(1),t=0,u=this._holes.length;u>t;t++)i=this._holes[t]=this._convertLatLngs(this._holes[t]),i[0].equals(i[i.length-1])&&i.pop();n=this._latlngs;n.length>=2&&n[0].equals(n[n.length-1])&&n.pop()},projectLatlngs:function(){if(r.Polyline.prototype.projectLatlngs.call(this),this._holePoints=[],this._holes)for(var t,u,n=0,i=this._holes.length;i>n;n++)for(this._holePoints[n]=[],t=0,u=this._holes[n].length;u>t;t++)this._holePoints[n][t]=this._map.latLngToLayerPoint(this._holes[n][t])},setLatLngs:function(n){return n&&r.Util.isArray(n[0])&&"number"!=typeof n[0][0]?(this._initWithHoles(n),this.redraw()):r.Polyline.prototype.setLatLngs.call(this,n)},_clipPoints:function(){var f=this._originalPoints,i=[],n,u,t;if(this._parts=[f].concat(this._holePoints),!this.options.noClip){for(n=0,u=this._parts.length;u>n;n++)t=r.PolyUtil.clipPolygon(this._parts[n],this._map._pathViewport),t.length&&i.push(t);this._parts=i}},_getPathPartStr:function(n){var t=r.Polyline.prototype._getPathPartStr.call(this,n);return t+(r.Browser.svg?"z":"x")}});r.polygon=function(n,t){return new r.Polygon(n,t)},function(){function n(n){return r.FeatureGroup.extend({initialize:function(n,t){this._layers={};this._options=t;this.setLatLngs(n)},setLatLngs:function(t){var i=0,r=t.length;for(this.eachLayer(function(n){r>i?n.setLatLngs(t[i++]):this.removeLayer(n)},this);r>i;)this.addLayer(new n(t[i++],this._options));return this},getLatLngs:function(){var n=[];return this.eachLayer(function(t){n.push(t.getLatLngs())}),n}})}r.MultiPolyline=n(r.Polyline);r.MultiPolygon=n(r.Polygon);r.multiPolyline=function(n,t){return new r.MultiPolyline(n,t)};r.multiPolygon=function(n,t){return new r.MultiPolygon(n,t)}}();r.Rectangle=r.Polygon.extend({initialize:function(n,t){r.Polygon.prototype.initialize.call(this,this._boundsToLatLngs(n),t)},setBounds:function(n){this.setLatLngs(this._boundsToLatLngs(n))},_boundsToLatLngs:function(n){return n=r.latLngBounds(n),[n.getSouthWest(),n.getNorthWest(),n.getNorthEast(),n.getSouthEast()]}});r.rectangle=function(n,t){return new r.Rectangle(n,t)};r.Circle=r.Path.extend({initialize:function(n,t,i){r.Path.prototype.initialize.call(this,i);this._latlng=r.latLng(n);this._mRadius=t},options:{fill:!0},setLatLng:function(n){return this._latlng=r.latLng(n),this.redraw()},setRadius:function(n){return this._mRadius=n,this.redraw()},projectLatlngs:function(){var t=this._getLngRadius(),n=this._latlng,i=this._map.latLngToLayerPoint([n.lat,n.lng-t]);this._point=this._map.latLngToLayerPoint(n);this._radius=Math.max(this._point.x-i.x,1)},getBounds:function(){var t=this._getLngRadius(),i=this._mRadius/40075017*360,n=this._latlng;return new r.LatLngBounds([n.lat-i,n.lng-t],[n.lat+i,n.lng+t])},getLatLng:function(){return this._latlng},getPathString:function(){var t=this._point,n=this._radius;return this._checkIfEmpty()?"":r.Browser.svg?"M"+t.x+","+(t.y-n)+"A"+n+","+n+",0,1,1,"+(t.x-.1)+","+(t.y-n)+" z":(t._round(),n=Math.round(n),"AL "+t.x+","+t.y+" "+n+","+n+" 0,23592600")},getRadius:function(){return this._mRadius},_getLatRadius:function(){return this._mRadius/40075017*360},_getLngRadius:function(){return this._getLatRadius()/Math.cos(r.LatLng.DEG_TO_RAD*this._latlng.lat)},_checkIfEmpty:function(){if(!this._map)return!1;var n=this._map._pathViewport,t=this._radius,i=this._point;return i.x-t>n.max.x||i.y-t>n.max.y||i.x+t<n.min.x||i.y+t<n.min.y}});r.circle=function(n,t,i){return new r.Circle(n,t,i)};r.CircleMarker=r.Circle.extend({options:{radius:10,weight:2},initialize:function(n,t){r.Circle.prototype.initialize.call(this,n,null,t);this._radius=this.options.radius},projectLatlngs:function(){this._point=this._map.latLngToLayerPoint(this._latlng)},_updateStyle:function(){r.Circle.prototype._updateStyle.call(this);this.setRadius(this.options.radius)},setLatLng:function(n){return r.Circle.prototype.setLatLng.call(this,n),this._popup&&this._popup._isOpen&&this._popup.setLatLng(n),this},setRadius:function(n){return this.options.radius=this._radius=n,this.redraw()},getRadius:function(){return this._radius}});r.circleMarker=function(n,t){return new r.CircleMarker(n,t)};r.Polyline.include(r.Path.CANVAS?{_containsPoint:function(n,t){var u,i,e,s,o,h,f,c=this.options.weight/2;for(r.Browser.touch&&(c+=10),u=0,s=this._parts.length;s>u;u++)for(f=this._parts[u],i=0,o=f.length,e=o-1;o>i;e=i++)if((t||0!==i)&&(h=r.LineUtil.pointToSegmentDistance(n,f[e],f[i]),c>=h))return!0;return!1}}:{});r.Polygon.include(r.Path.CANVAS?{_containsPoint:function(n){var i,t,u,f,e,o,c,s,h=!1;if(r.Polyline.prototype._containsPoint.call(this,n,!0))return!0;for(f=0,c=this._parts.length;c>f;f++)for(i=this._parts[f],e=0,s=i.length,o=s-1;s>e;o=e++)t=i[e],u=i[o],t.y>n.y!=u.y>n.y&&n.x<(u.x-t.x)*(n.y-t.y)/(u.y-t.y)+t.x&&(h=!h);return h}}:{});r.Circle.include(r.Path.CANVAS?{_drawPath:function(){var n=this._point;this._ctx.beginPath();this._ctx.arc(n.x,n.y,this._radius,0,2*Math.PI,!1)},_containsPoint:function(n){var t=this._point,i=this.options.stroke?this.options.weight/2:0;return n.distanceTo(t)<=this._radius+i}}:{});r.CircleMarker.include(r.Path.CANVAS?{_updateStyle:function(){r.Path.prototype._updateStyle.call(this)}}:{});r.GeoJSON=r.FeatureGroup.extend({initialize:function(n,t){r.setOptions(this,t);this._layers={};n&&this.addData(n)},addData:function(n){var u,o,f,e=r.Util.isArray(n)?n:n.features,t,i;if(e){for(u=0,o=e.length;o>u;u++)f=e[u],(f.geometries||f.geometry||f.features||f.coordinates)&&this.addData(e[u]);return this}return t=this.options,!t.filter||t.filter(n)?(i=r.GeoJSON.geometryToLayer(n,t.pointToLayer,t.coordsToLatLng,t),i.feature=r.GeoJSON.asFeature(n),i.defaultOptions=i.options,this.resetStyle(i),t.onEachFeature&&t.onEachFeature(n,i),this.addLayer(i)):void 0},resetStyle:function(n){var t=this.options.style;t&&(r.Util.extend(n.options,n.defaultOptions),this._setLayerStyle(n,t))},setStyle:function(n){this.eachLayer(function(t){this._setLayerStyle(t,n)},this)},_setLayerStyle:function(n,t){"function"==typeof t&&(t=t(n.feature));n.setStyle&&n.setStyle(t)}});r.extend(r.GeoJSON,{geometryToLayer:function(n,t,i,u){var s,e,o,h,c="Feature"===n.type?n.geometry:n,f=c.coordinates,l=[];switch(i=i||this.coordsToLatLng,c.type){case"Point":return s=i(f),t?t(n,s):new r.Marker(s);case"MultiPoint":for(o=0,h=f.length;h>o;o++)s=i(f[o]),l.push(t?t(n,s):new r.Marker(s));return new r.FeatureGroup(l);case"LineString":return e=this.coordsToLatLngs(f,0,i),new r.Polyline(e,u);case"Polygon":if(2===f.length&&!f[1].length)throw new Error("Invalid GeoJSON object.");return e=this.coordsToLatLngs(f,1,i),new r.Polygon(e,u);case"MultiLineString":return e=this.coordsToLatLngs(f,1,i),new r.MultiPolyline(e,u);case"MultiPolygon":return e=this.coordsToLatLngs(f,2,i),new r.MultiPolygon(e,u);case"GeometryCollection":for(o=0,h=c.geometries.length;h>o;o++)l.push(this.geometryToLayer({geometry:c.geometries[o],type:"Feature",properties:n.properties},t,i,u));return new r.FeatureGroup(l);default:throw new Error("Invalid GeoJSON object.");}},coordsToLatLng:function(n){return new r.LatLng(n[1],n[0],n[2])},coordsToLatLngs:function(n,t,i){for(var u,e=[],r=0,f=n.length;f>r;r++)u=t?this.coordsToLatLngs(n[r],t-1,i):(i||this.coordsToLatLng)(n[r]),e.push(u);return e},latLngToCoords:function(n){var t=[n.lng,n.lat];return n.alt!==i&&t.push(n.alt),t},latLngsToCoords:function(n){for(var i=[],t=0,u=n.length;u>t;t++)i.push(r.GeoJSON.latLngToCoords(n[t]));return i},getFeature:function(n,t){return n.feature?r.extend({},n.feature,{geometry:t}):r.GeoJSON.asFeature(t)},asFeature:function(n){return"Feature"===n.type?n:{type:"Feature",properties:{},geometry:n}}});f={toGeoJSON:function(){return r.GeoJSON.getFeature(this,{type:"Point",coordinates:r.GeoJSON.latLngToCoords(this.getLatLng())})}};r.Marker.include(f);r.Circle.include(f);r.CircleMarker.include(f);r.Polyline.include({toGeoJSON:function(){return r.GeoJSON.getFeature(this,{type:"LineString",coordinates:r.GeoJSON.latLngsToCoords(this.getLatLngs())})}});r.Polygon.include({toGeoJSON:function(){var n,u,t,i=[r.GeoJSON.latLngsToCoords(this.getLatLngs())];if(i[0].push(i[0][0]),this._holes)for(n=0,u=this._holes.length;u>n;n++)t=r.GeoJSON.latLngsToCoords(this._holes[n]),t.push(t[0]),i.push(t);return r.GeoJSON.getFeature(this,{type:"Polygon",coordinates:i})}}),function(){function n(n){return function(){var t=[];return this.eachLayer(function(n){t.push(n.toGeoJSON().geometry.coordinates)}),r.GeoJSON.getFeature(this,{type:n,coordinates:t})}}r.MultiPolyline.include({toGeoJSON:n("MultiLineString")});r.MultiPolygon.include({toGeoJSON:n("MultiPolygon")});r.LayerGroup.include({toGeoJSON:function(){var i,t=this.feature&&this.feature.geometry,u=[],f;return t&&"MultiPoint"===t.type?n("MultiPoint").call(this):(f=t&&"GeometryCollection"===t.type,this.eachLayer(function(n){n.toGeoJSON&&(i=n.toGeoJSON(),u.push(f?i.geometry:r.GeoJSON.asFeature(i)))}),f?r.GeoJSON.getFeature(this,{geometries:u,type:"GeometryCollection"}):{type:"FeatureCollection",features:u})}})}();r.geoJson=function(n,t){return new r.GeoJSON(n,t)};r.DomEvent={addListener:function(n,t,i,u){var f,e,s,o=r.stamp(i),h="_leaflet_"+t+o;return n[h]?this:(f=function(t){return i.call(u||n,t||r.DomEvent._getEvent())},r.Browser.pointer&&0===t.indexOf("touch")?this.addPointerListener(n,t,f,o):(r.Browser.touch&&"dblclick"===t&&this.addDoubleTapListener&&this.addDoubleTapListener(n,f,o),"addEventListener"in n?"mousewheel"===t?(n.addEventListener("DOMMouseScroll",f,!1),n.addEventListener(t,f,!1)):"mouseenter"===t||"mouseleave"===t?(e=f,s="mouseenter"===t?"mouseover":"mouseout",f=function(t){if(r.DomEvent._checkMouse(n,t))return e(t)},n.addEventListener(s,f,!1)):"click"===t&&r.Browser.android?(e=f,f=function(n){return r.DomEvent._filterClick(n,e)},n.addEventListener(t,f,!1)):n.addEventListener(t,f,!1):"attachEvent"in n&&n.attachEvent("on"+t,f),n[h]=f,this))},removeListener:function(n,t,i){var f=r.stamp(i),e="_leaflet_"+t+f,u=n[e];return u?(r.Browser.pointer&&0===t.indexOf("touch")?this.removePointerListener(n,t,f):r.Browser.touch&&"dblclick"===t&&this.removeDoubleTapListener?this.removeDoubleTapListener(n,f):"removeEventListener"in n?"mousewheel"===t?(n.removeEventListener("DOMMouseScroll",u,!1),n.removeEventListener(t,u,!1)):"mouseenter"===t||"mouseleave"===t?n.removeEventListener("mouseenter"===t?"mouseover":"mouseout",u,!1):n.removeEventListener(t,u,!1):"detachEvent"in n&&n.detachEvent("on"+t,u),n[e]=null,this):this},stopPropagation:function(n){return n.stopPropagation?n.stopPropagation():n.cancelBubble=!0,r.DomEvent._skipped(n),this},disableScrollPropagation:function(n){var t=r.DomEvent.stopPropagation;return r.DomEvent.on(n,"mousewheel",t).on(n,"MozMousePixelScroll",t)},disableClickPropagation:function(n){for(var i=r.DomEvent.stopPropagation,t=r.Draggable.START.length-1;t>=0;t--)r.DomEvent.on(n,r.Draggable.START[t],i);return r.DomEvent.on(n,"click",r.DomEvent._fakeStop).on(n,"dblclick",i)},preventDefault:function(n){return n.preventDefault?n.preventDefault():n.returnValue=!1,this},stop:function(n){return r.DomEvent.preventDefault(n).stopPropagation(n)},getMousePosition:function(n,t){if(!t)return new r.Point(n.clientX,n.clientY);var i=t.getBoundingClientRect();return new r.Point(n.clientX-i.left-t.clientLeft,n.clientY-i.top-t.clientTop)},getWheelDelta:function(n){var t=0;return n.wheelDelta&&(t=n.wheelDelta/120),n.detail&&(t=-n.detail/3),t},_skipEvents:{},_fakeStop:function(n){r.DomEvent._skipEvents[n.type]=!0},_skipped:function(n){var t=this._skipEvents[n.type];return this._skipEvents[n.type]=!1,t},_checkMouse:function(n,t){var i=t.relatedTarget;if(!i)return!0;try{for(;i&&i!==n;)i=i.parentNode}catch(r){return!1}return i!==n},_getEvent:function(){var t=n.event,i;if(!t)for(i=arguments.callee.caller;i&&(t=i.arguments[0],!t||n.Event!==t.constructor);)i=i.caller;return t},_filterClick:function(n,t){var u=n.timeStamp||n.originalEvent.timeStamp,i=r.DomEvent._lastClick&&u-r.DomEvent._lastClick;return i&&i>100&&1e3>i||n.target._simulatedClick&&!n._simulated?void r.DomEvent.stop(n):(r.DomEvent._lastClick=u,t(n))}};r.DomEvent.on=r.DomEvent.addListener;r.DomEvent.off=r.DomEvent.removeListener;r.Draggable=r.Class.extend({includes:r.Mixin.Events,statics:{START:r.Browser.touch?["touchstart","mousedown"]:["mousedown"],END:{mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},MOVE:{mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"}},initialize:function(n,t){this._element=n;this._dragStartTarget=t||n},enable:function(){if(!this._enabled){for(var n=r.Draggable.START.length-1;n>=0;n--)r.DomEvent.on(this._dragStartTarget,r.Draggable.START[n],this._onDown,this);this._enabled=!0}},disable:function(){if(this._enabled){for(var n=r.Draggable.START.length-1;n>=0;n--)r.DomEvent.off(this._dragStartTarget,r.Draggable.START[n],this._onDown,this);this._enabled=!1;this._moved=!1}},_onDown:function(n){if(this._moved=!1,!(n.shiftKey||1!==n.which&&1!==n.button&&!n.touches||(r.DomEvent.stopPropagation(n),r.Draggable._disabled||(r.DomUtil.disableImageDrag(),r.DomUtil.disableTextSelection(),this._moving)))){var i=n.touches?n.touches[0]:n;this._startPoint=new r.Point(i.clientX,i.clientY);this._startPos=this._newPos=r.DomUtil.getPosition(this._element);r.DomEvent.on(t,r.Draggable.MOVE[n.type],this._onMove,this).on(t,r.Draggable.END[n.type],this._onUp,this)}},_onMove:function(n){if(n.touches&&n.touches.length>1)return void(this._moved=!0);var u=n.touches&&1===n.touches.length?n.touches[0]:n,f=new r.Point(u.clientX,u.clientY),i=f.subtract(this._startPoint);(i.x||i.y)&&(r.DomEvent.preventDefault(n),this._moved||(this.fire("dragstart"),this._moved=!0,this._startPos=r.DomUtil.getPosition(this._element).subtract(i),r.DomUtil.addClass(t.body,"leaflet-dragging"),r.DomUtil.addClass(n.target||n.srcElement,"leaflet-drag-target")),this._newPos=this._startPos.add(i),this._moving=!0,r.Util.cancelAnimFrame(this._animRequest),this._animRequest=r.Util.requestAnimFrame(this._updatePosition,this,!0,this._dragStartTarget))},_updatePosition:function(){this.fire("predrag");r.DomUtil.setPosition(this._element,this._newPos);this.fire("drag")},_onUp:function(n){r.DomUtil.removeClass(t.body,"leaflet-dragging");r.DomUtil.removeClass(n.target||n.srcElement,"leaflet-drag-target");for(var i in r.Draggable.MOVE)r.DomEvent.off(t,r.Draggable.MOVE[i],this._onMove).off(t,r.Draggable.END[i],this._onUp);r.DomUtil.enableImageDrag();r.DomUtil.enableTextSelection();this._moved&&this._moving&&(r.Util.cancelAnimFrame(this._animRequest),this.fire("dragend",{distance:this._newPos.distanceTo(this._startPos)}));this._moving=!1}});r.Handler=r.Class.extend({initialize:function(n){this._map=n},enable:function(){this._enabled||(this._enabled=!0,this.addHooks())},disable:function(){this._enabled&&(this._enabled=!1,this.removeHooks())},enabled:function(){return!!this._enabled}});r.Map.mergeOptions({dragging:!0,inertia:!r.Browser.android23,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,inertiaThreshold:r.Browser.touch?32:18,easeLinearity:.25,worldCopyJump:!1});r.Map.Drag=r.Handler.extend({addHooks:function(){if(!this._draggable){var n=this._map;this._draggable=new r.Draggable(n._mapPane,n._container);this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this);n.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDrag,this),n.on("viewreset",this._onViewReset,this),n.whenReady(this._onViewReset,this))}this._draggable.enable()},removeHooks:function(){this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},_onDragStart:function(){var n=this._map;n._panAnim&&n._panAnim.stop();n.fire("movestart").fire("dragstart");n.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(){if(this._map.options.inertia){var n=this._lastTime=+new Date,t=this._lastPos=this._draggable._newPos;this._positions.push(t);this._times.push(n);n-this._times[0]>200&&(this._positions.shift(),this._times.shift())}this._map.fire("move").fire("drag")},_onViewReset:function(){var n=this._map.getSize()._divideBy(2),t=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=t.subtract(n).x;this._worldWidth=this._map.project([0,180]).x},_onPreDrag:function(){var i=this._worldWidth,t=Math.round(i/2),n=this._initialWorldOffset,r=this._draggable._newPos.x,u=(r-t+n)%i+t-n,f=(r+t+n)%i-t-n,e=Math.abs(u+n)<Math.abs(f+n)?u:f;this._draggable._newPos.x=e},_onDragEnd:function(n){var t=this._map,i=t.options,e=+new Date-this._lastTime,l=!i.inertia||e>i.inertiaThreshold||!this._positions[0];if(t.fire("dragend",n),l)t.fire("moveend");else{var a=this._lastPos.subtract(this._positions[0]),v=(this._lastTime+e-this._times[0])/1e3,f=i.easeLinearity,o=a.multiplyBy(f/v),s=o.distanceTo([0,0]),h=Math.min(i.inertiaMaxSpeed,s),y=o.multiplyBy(h/s),c=h/(i.inertiaDeceleration*f),u=y.multiplyBy(-c/2).round();u.x&&u.y?(u=t._limitOffset(u,t.options.maxBounds),r.Util.requestAnimFrame(function(){t.panBy(u,{duration:c,easeLinearity:f,noMoveStart:!0})})):t.fire("moveend")}}});r.Map.addInitHook("addHandler","dragging",r.Map.Drag);r.Map.mergeOptions({doubleClickZoom:!0});r.Map.DoubleClickZoom=r.Handler.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(n){var t=this._map,i=t.getZoom()+(n.originalEvent.shiftKey?-1:1);"center"===t.options.doubleClickZoom?t.setZoom(i):t.setZoomAround(n.containerPoint,i)}});r.Map.addInitHook("addHandler","doubleClickZoom",r.Map.DoubleClickZoom);r.Map.mergeOptions({scrollWheelZoom:!0});r.Map.ScrollWheelZoom=r.Handler.extend({addHooks:function(){r.DomEvent.on(this._map._container,"mousewheel",this._onWheelScroll,this);r.DomEvent.on(this._map._container,"MozMousePixelScroll",r.DomEvent.preventDefault);this._delta=0},removeHooks:function(){r.DomEvent.off(this._map._container,"mousewheel",this._onWheelScroll);r.DomEvent.off(this._map._container,"MozMousePixelScroll",r.DomEvent.preventDefault)},_onWheelScroll:function(n){var i=r.DomEvent.getWheelDelta(n),t;this._delta+=i;this._lastMousePos=this._map.mouseEventToContainerPoint(n);this._startTime||(this._startTime=+new Date);t=Math.max(40-(+new Date-this._startTime),0);clearTimeout(this._timer);this._timer=setTimeout(r.bind(this._performZoom,this),t);r.DomEvent.preventDefault(n);r.DomEvent.stopPropagation(n)},_performZoom:function(){var t=this._map,n=this._delta,i=t.getZoom();n=n>0?Math.ceil(n):Math.floor(n);n=Math.max(Math.min(n,4),-4);n=t._limitZoom(i+n)-i;this._delta=0;this._startTime=null;n&&("center"===t.options.scrollWheelZoom?t.setZoom(i+n):t.setZoomAround(this._lastMousePos,i+n))}});r.Map.addInitHook("addHandler","scrollWheelZoom",r.Map.ScrollWheelZoom);r.extend(r.DomEvent,{_touchstart:r.Browser.msPointer?"MSPointerDown":r.Browser.pointer?"pointerdown":"touchstart",_touchend:r.Browser.msPointer?"MSPointerUp":r.Browser.pointer?"pointerup":"touchend",addDoubleTapListener:function(n,i,u){function c(n){var i,t,u;(r.Browser.pointer?(e.push(n.pointerId),i=e.length):i=n.touches.length,i>1)||(t=Date.now(),u=t-(s||t),f=n.touches?n.touches[0]:n,l=u>0&&p>=u,s=t)}function o(n){var u,t,o,h;if(r.Browser.pointer){if(u=e.indexOf(n.pointerId),-1===u)return;e.splice(u,1)}if(l){if(r.Browser.pointer){o={};for(h in f)t=f[h],o[h]="function"==typeof t?t.bind(f):t;f=o}f.type="dblclick";i(f);s=null}}var s,f,l=!1,p=250,a="_leaflet_",v=this._touchstart,y=this._touchend,e=[],h;return n[a+v+u]=c,n[a+y+u]=o,h=r.Browser.pointer?t.documentElement:n,n.addEventListener(v,c,!1),h.addEventListener(y,o,!1),r.Browser.pointer&&h.addEventListener(r.DomEvent.POINTER_CANCEL,o,!1),this},removeDoubleTapListener:function(n,i){var u="_leaflet_";return n.removeEventListener(this._touchstart,n[u+this._touchstart+i],!1),(r.Browser.pointer?t.documentElement:n).removeEventListener(this._touchend,n[u+this._touchend+i],!1),r.Browser.pointer&&t.documentElement.removeEventListener(r.DomEvent.POINTER_CANCEL,n[u+this._touchend+i],!1),this}});r.extend(r.DomEvent,{POINTER_DOWN:r.Browser.msPointer?"MSPointerDown":"pointerdown",POINTER_MOVE:r.Browser.msPointer?"MSPointerMove":"pointermove",POINTER_UP:r.Browser.msPointer?"MSPointerUp":"pointerup",POINTER_CANCEL:r.Browser.msPointer?"MSPointerCancel":"pointercancel",_pointers:[],_pointerDocumentListener:!1,addPointerListener:function(n,t,i,r){switch(t){case"touchstart":return this.addPointerListenerStart(n,t,i,r);case"touchend":return this.addPointerListenerEnd(n,t,i,r);case"touchmove":return this.addPointerListenerMove(n,t,i,r);default:throw"Unknown touch event type";}},addPointerListenerStart:function(n,i,u,f){var e=this._pointers,s=function(n){r.DomEvent.preventDefault(n);for(var i=!1,t=0;t<e.length;t++)if(e[t].pointerId===n.pointerId){i=!0;break}i||e.push(n);n.touches=e.slice();n.changedTouches=[n];u(n)},o;return(n["_leaflet_touchstart"+f]=s,n.addEventListener(this.POINTER_DOWN,s,!1),this._pointerDocumentListener)||(o=function(n){for(var t=0;t<e.length;t++)if(e[t].pointerId===n.pointerId){e.splice(t,1);break}},t.documentElement.addEventListener(this.POINTER_UP,o,!1),t.documentElement.addEventListener(this.POINTER_CANCEL,o,!1),this._pointerDocumentListener=!0),this},addPointerListenerMove:function(n,t,i,r){function f(n){if(n.pointerType!==n.MSPOINTER_TYPE_MOUSE&&"mouse"!==n.pointerType||0!==n.buttons){for(var t=0;t<u.length;t++)if(u[t].pointerId===n.pointerId){u[t]=n;break}n.touches=u.slice();n.changedTouches=[n];i(n)}}var u=this._pointers;return n["_leaflet_touchmove"+r]=f,n.addEventListener(this.POINTER_MOVE,f,!1),this},addPointerListenerEnd:function(n,t,i,r){var u=this._pointers,f=function(n){for(var t=0;t<u.length;t++)if(u[t].pointerId===n.pointerId){u.splice(t,1);break}n.touches=u.slice();n.changedTouches=[n];i(n)};return n["_leaflet_touchend"+r]=f,n.addEventListener(this.POINTER_UP,f,!1),n.addEventListener(this.POINTER_CANCEL,f,!1),this},removePointerListener:function(n,t,i){var r=n["_leaflet_"+t+i];switch(t){case"touchstart":n.removeEventListener(this.POINTER_DOWN,r,!1);break;case"touchmove":n.removeEventListener(this.POINTER_MOVE,r,!1);break;case"touchend":n.removeEventListener(this.POINTER_UP,r,!1);n.removeEventListener(this.POINTER_CANCEL,r,!1)}return this}});r.Map.mergeOptions({touchZoom:r.Browser.touch&&!r.Browser.android23,bounceAtZoomLimits:!0});r.Map.TouchZoom=r.Handler.extend({addHooks:function(){r.DomEvent.on(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){r.DomEvent.off(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(n){var i=this._map;if(n.touches&&2===n.touches.length&&!i._animatingZoom&&!this._zooming){var u=i.mouseEventToLayerPoint(n.touches[0]),f=i.mouseEventToLayerPoint(n.touches[1]),e=i._getCenterLayerPoint();this._startCenter=u.add(f)._divideBy(2);this._startDist=u.distanceTo(f);this._moved=!1;this._zooming=!0;this._centerOffset=e.subtract(this._startCenter);i._panAnim&&i._panAnim.stop();r.DomEvent.on(t,"touchmove",this._onTouchMove,this).on(t,"touchend",this._onTouchEnd,this);r.DomEvent.preventDefault(n)}},_onTouchMove:function(n){var t=this._map,i,u;n.touches&&2===n.touches.length&&this._zooming&&(i=t.mouseEventToLayerPoint(n.touches[0]),u=t.mouseEventToLayerPoint(n.touches[1]),this._scale=i.distanceTo(u)/this._startDist,this._delta=i._add(u)._divideBy(2)._subtract(this._startCenter),1!==this._scale&&(t.options.bounceAtZoomLimits||!(t.getZoom()===t.getMinZoom()&&this._scale<1||t.getZoom()===t.getMaxZoom()&&this._scale>1))&&(this._moved||(r.DomUtil.addClass(t._mapPane,"leaflet-touching"),t.fire("movestart").fire("zoomstart"),this._moved=!0),r.Util.cancelAnimFrame(this._animRequest),this._animRequest=r.Util.requestAnimFrame(this._updateOnMove,this,!0,this._map._container),r.DomEvent.preventDefault(n)))},_updateOnMove:function(){var n=this._map,t=this._getScaleOrigin(),i=n.layerPointToLatLng(t),r=n.getScaleZoom(this._scale);n._animateZoom(i,r,this._startCenter,this._scale,this._delta)},_onTouchEnd:function(){var n;if(!this._moved||!this._zooming)return void(this._zooming=!1);n=this._map;this._zooming=!1;r.DomUtil.removeClass(n._mapPane,"leaflet-touching");r.Util.cancelAnimFrame(this._animRequest);r.DomEvent.off(t,"touchmove",this._onTouchMove).off(t,"touchend",this._onTouchEnd);var u=this._getScaleOrigin(),o=n.layerPointToLatLng(u),f=n.getZoom(),i=n.getScaleZoom(this._scale)-f,s=i>0?Math.ceil(i):Math.floor(i),e=n._limitZoom(f+s),h=n.getZoomScale(e)/this._scale;n._animateZoom(o,e,u,h)},_getScaleOrigin:function(){var n=this._centerOffset.subtract(this._delta).divideBy(this._scale);return this._startCenter.add(n)}});r.Map.addInitHook("addHandler","touchZoom",r.Map.TouchZoom);r.Map.mergeOptions({tap:!0,tapTolerance:15});r.Map.Tap=r.Handler.extend({addHooks:function(){r.DomEvent.on(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){r.DomEvent.off(this._map._container,"touchstart",this._onDown,this)},_onDown:function(n){if(n.touches){if(r.DomEvent.preventDefault(n),this._fireClick=!0,n.touches.length>1)return this._fireClick=!1,void clearTimeout(this._holdTimeout);var i=n.touches[0],u=i.target;this._startPos=this._newPos=new r.Point(i.clientX,i.clientY);u.tagName&&"a"===u.tagName.toLowerCase()&&r.DomUtil.addClass(u,"leaflet-active");this._holdTimeout=setTimeout(r.bind(function(){this._isTapValid()&&(this._fireClick=!1,this._onUp(),this._simulateEvent("contextmenu",i))},this),1e3);r.DomEvent.on(t,"touchmove",this._onMove,this).on(t,"touchend",this._onUp,this)}},_onUp:function(n){if(clearTimeout(this._holdTimeout),r.DomEvent.off(t,"touchmove",this._onMove,this).off(t,"touchend",this._onUp,this),this._fireClick&&n&&n.changedTouches){var u=n.changedTouches[0],i=u.target;i&&i.tagName&&"a"===i.tagName.toLowerCase()&&r.DomUtil.removeClass(i,"leaflet-active");this._isTapValid()&&this._simulateEvent("click",u)}},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_onMove:function(n){var t=n.touches[0];this._newPos=new r.Point(t.clientX,t.clientY)},_simulateEvent:function(i,r){var u=t.createEvent("MouseEvents");u._simulated=!0;r.target._simulatedClick=!0;u.initMouseEvent(i,!0,!0,n,1,r.screenX,r.screenY,r.clientX,r.clientY,!1,!1,!1,!1,0,null);r.target.dispatchEvent(u)}});r.Browser.touch&&!r.Browser.pointer&&r.Map.addInitHook("addHandler","tap",r.Map.Tap);r.Map.mergeOptions({boxZoom:!0});r.Map.BoxZoom=r.Handler.extend({initialize:function(n){this._map=n;this._container=n._container;this._pane=n._panes.overlayPane;this._moved=!1},addHooks:function(){r.DomEvent.on(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){r.DomEvent.off(this._container,"mousedown",this._onMouseDown);this._moved=!1},moved:function(){return this._moved},_onMouseDown:function(n){return this._moved=!1,!n.shiftKey||1!==n.which&&1!==n.button?!1:(r.DomUtil.disableTextSelection(),r.DomUtil.disableImageDrag(),this._startLayerPoint=this._map.mouseEventToLayerPoint(n),void r.DomEvent.on(t,"mousemove",this._onMouseMove,this).on(t,"mouseup",this._onMouseUp,this).on(t,"keydown",this._onKeyDown,this))},_onMouseMove:function(n){this._moved||(this._box=r.DomUtil.create("div","leaflet-zoom-box",this._pane),r.DomUtil.setPosition(this._box,this._startLayerPoint),this._container.style.cursor="crosshair",this._map.fire("boxzoomstart"));var t=this._startLayerPoint,i=this._box,u=this._map.mouseEventToLayerPoint(n),f=u.subtract(t),e=new r.Point(Math.min(u.x,t.x),Math.min(u.y,t.y));r.DomUtil.setPosition(i,e);this._moved=!0;i.style.width=Math.max(0,Math.abs(f.x)-4)+"px";i.style.height=Math.max(0,Math.abs(f.y)-4)+"px"},_finish:function(){this._moved&&(this._pane.removeChild(this._box),this._container.style.cursor="");r.DomUtil.enableTextSelection();r.DomUtil.enableImageDrag();r.DomEvent.off(t,"mousemove",this._onMouseMove).off(t,"mouseup",this._onMouseUp).off(t,"keydown",this._onKeyDown)},_onMouseUp:function(n){var t,i,u;this._finish();t=this._map;i=t.mouseEventToLayerPoint(n);this._startLayerPoint.equals(i)||(u=new r.LatLngBounds(t.layerPointToLatLng(this._startLayerPoint),t.layerPointToLatLng(i)),t.fitBounds(u),t.fire("boxzoomend",{boxZoomBounds:u}))},_onKeyDown:function(n){27===n.keyCode&&this._finish()}});r.Map.addInitHook("addHandler","boxZoom",r.Map.BoxZoom);r.Map.mergeOptions({keyboard:!0,keyboardPanOffset:80,keyboardZoomOffset:1});r.Map.Keyboard=r.Handler.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,173]},initialize:function(n){this._map=n;this._setPanOffset(n.options.keyboardPanOffset);this._setZoomOffset(n.options.keyboardZoomOffset)},addHooks:function(){var n=this._map._container;-1===n.tabIndex&&(n.tabIndex="0");r.DomEvent.on(n,"focus",this._onFocus,this).on(n,"blur",this._onBlur,this).on(n,"mousedown",this._onMouseDown,this);this._map.on("focus",this._addHooks,this).on("blur",this._removeHooks,this)},removeHooks:function(){this._removeHooks();var n=this._map._container;r.DomEvent.off(n,"focus",this._onFocus,this).off(n,"blur",this._onBlur,this).off(n,"mousedown",this._onMouseDown,this);this._map.off("focus",this._addHooks,this).off("blur",this._removeHooks,this)},_onMouseDown:function(){if(!this._focused){var i=t.body,r=t.documentElement,u=i.scrollTop||r.scrollTop,f=i.scrollLeft||r.scrollLeft;this._map._container.focus();n.scrollTo(f,u)}},_onFocus:function(){this._focused=!0;this._map.fire("focus")},_onBlur:function(){this._focused=!1;this._map.fire("blur")},_setPanOffset:function(n){for(var u=this._panKeys={},r=this.keyCodes,t=0,i=r.left.length;i>t;t++)u[r.left[t]]=[-1*n,0];for(t=0,i=r.right.length;i>t;t++)u[r.right[t]]=[n,0];for(t=0,i=r.down.length;i>t;t++)u[r.down[t]]=[0,n];for(t=0,i=r.up.length;i>t;t++)u[r.up[t]]=[0,-1*n]},_setZoomOffset:function(n){for(var u=this._zoomKeys={},r=this.keyCodes,t=0,i=r.zoomIn.length;i>t;t++)u[r.zoomIn[t]]=n;for(t=0,i=r.zoomOut.length;i>t;t++)u[r.zoomOut[t]]=-n},_addHooks:function(){r.DomEvent.on(t,"keydown",this._onKeyDown,this)},_removeHooks:function(){r.DomEvent.off(t,"keydown",this._onKeyDown,this)},_onKeyDown:function(n){var i=n.keyCode,t=this._map;if(i in this._panKeys){if(t._panAnim&&t._panAnim._inProgress)return;t.panBy(this._panKeys[i]);t.options.maxBounds&&t.panInsideBounds(t.options.maxBounds)}else{if(!(i in this._zoomKeys))return;t.setZoom(t.getZoom()+this._zoomKeys[i])}r.DomEvent.stop(n)}});r.Map.addInitHook("addHandler","keyboard",r.Map.Keyboard);r.Handler.MarkerDrag=r.Handler.extend({initialize:function(n){this._marker=n},addHooks:function(){var n=this._marker._icon;this._draggable||(this._draggable=new r.Draggable(n,n));this._draggable.on("dragstart",this._onDragStart,this).on("drag",this._onDrag,this).on("dragend",this._onDragEnd,this);this._draggable.enable();r.DomUtil.addClass(this._marker._icon,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off("dragstart",this._onDragStart,this).off("drag",this._onDrag,this).off("dragend",this._onDragEnd,this);this._draggable.disable();r.DomUtil.removeClass(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_onDragStart:function(){this._marker.closePopup().fire("movestart").fire("dragstart")},_onDrag:function(){var n=this._marker,t=n._shadow,i=r.DomUtil.getPosition(n._icon),u=n._map.layerPointToLatLng(i);t&&r.DomUtil.setPosition(t,i);n._latlng=u;n.fire("move",{latlng:u}).fire("drag")},_onDragEnd:function(n){this._marker.fire("moveend").fire("dragend",n)}});r.Control=r.Class.extend({options:{position:"topright"},initialize:function(n){r.setOptions(this,n)},getPosition:function(){return this.options.position},setPosition:function(n){var t=this._map;return t&&t.removeControl(this),this.options.position=n,t&&t.addControl(this),this},getContainer:function(){return this._container},addTo:function(n){this._map=n;var t=this._container=this.onAdd(n),u=this.getPosition(),i=n._controlCorners[u];return r.DomUtil.addClass(t,"leaflet-control"),-1!==u.indexOf("bottom")?i.insertBefore(t,i.firstChild):i.appendChild(t),this},removeFrom:function(n){var t=this.getPosition(),i=n._controlCorners[t];return i.removeChild(this._container),this._map=null,this.onRemove&&this.onRemove(n),this},_refocusOnMap:function(){this._map&&this._map.getContainer().focus()}});r.control=function(n){return new r.Control(n)};r.Map.include({addControl:function(n){return n.addTo(this),this},removeControl:function(n){return n.removeFrom(this),this},_initControlPos:function(){function n(n,f){var e=t+n+" "+t+f;i[n+f]=r.DomUtil.create("div",e,u)}var i=this._controlCorners={},t="leaflet-",u=this._controlContainer=r.DomUtil.create("div",t+"control-container",this._container);n("top","left");n("top","right");n("bottom","left");n("bottom","right")},_clearControlPos:function(){this._container.removeChild(this._controlContainer)}});r.Control.Zoom=r.Control.extend({options:{position:"topleft",zoomInText:"+",zoomInTitle:"Zoom in",zoomOutText:"-",zoomOutTitle:"Zoom out"},onAdd:function(n){var t="leaflet-control-zoom",i=r.DomUtil.create("div",t+" leaflet-bar");return this._map=n,this._zoomInButton=this._createButton(this.options.zoomInText,this.options.zoomInTitle,t+"-in",i,this._zoomIn,this),this._zoomOutButton=this._createButton(this.options.zoomOutText,this.options.zoomOutTitle,t+"-out",i,this._zoomOut,this),this._updateDisabled(),n.on("zoomend zoomlevelschange",this._updateDisabled,this),i},onRemove:function(n){n.off("zoomend zoomlevelschange",this._updateDisabled,this)},_zoomIn:function(n){this._map.zoomIn(n.shiftKey?3:1)},_zoomOut:function(n){this._map.zoomOut(n.shiftKey?3:1)},_createButton:function(n,t,i,u,f,e){var o=r.DomUtil.create("a",i,u),s;return o.innerHTML=n,o.href="#",o.title=t,s=r.DomEvent.stopPropagation,r.DomEvent.on(o,"click",s).on(o,"mousedown",s).on(o,"dblclick",s).on(o,"click",r.DomEvent.preventDefault).on(o,"click",f,e).on(o,"click",this._refocusOnMap,e),o},_updateDisabled:function(){var n=this._map,t="leaflet-disabled";r.DomUtil.removeClass(this._zoomInButton,t);r.DomUtil.removeClass(this._zoomOutButton,t);n._zoom===n.getMinZoom()&&r.DomUtil.addClass(this._zoomOutButton,t);n._zoom===n.getMaxZoom()&&r.DomUtil.addClass(this._zoomInButton,t)}});r.Map.mergeOptions({zoomControl:!0});r.Map.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new r.Control.Zoom,this.addControl(this.zoomControl))});r.control.zoom=function(n){return new r.Control.Zoom(n)};r.Control.Attribution=r.Control.extend({options:{position:"bottomright",prefix:'<a href="http://leafletjs.com" title="A JS library for interactive maps">Leaflet<\/a>'},initialize:function(n){r.setOptions(this,n);this._attributions={}},onAdd:function(n){this._container=r.DomUtil.create("div","leaflet-control-attribution");r.DomEvent.disableClickPropagation(this._container);for(var t in n._layers)n._layers[t].getAttribution&&this.addAttribution(n._layers[t].getAttribution());return n.on("layeradd",this._onLayerAdd,this).on("layerremove",this._onLayerRemove,this),this._update(),this._container},onRemove:function(n){n.off("layeradd",this._onLayerAdd).off("layerremove",this._onLayerRemove)},setPrefix:function(n){return this.options.prefix=n,this._update(),this},addAttribution:function(n){if(n)return(this._attributions[n]||(this._attributions[n]=0),this._attributions[n]++,this._update(),this)},removeAttribution:function(n){if(n)return(this._attributions[n]&&(this._attributions[n]--,this._update()),this)},_update:function(){var n,i,t;if(this._map){n=[];for(i in this._attributions)this._attributions[i]&&n.push(i);t=[];this.options.prefix&&t.push(this.options.prefix);n.length&&t.push(n.join(", "));this._container.innerHTML=t.join(" | ")}},_onLayerAdd:function(n){n.layer.getAttribution&&this.addAttribution(n.layer.getAttribution())},_onLayerRemove:function(n){n.layer.getAttribution&&this.removeAttribution(n.layer.getAttribution())}});r.Map.mergeOptions({attributionControl:!0});r.Map.addInitHook(function(){this.options.attributionControl&&(this.attributionControl=(new r.Control.Attribution).addTo(this))});r.control.attribution=function(n){return new r.Control.Attribution(n)};r.Control.Scale=r.Control.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0,updateWhenIdle:!1},onAdd:function(n){this._map=n;var t="leaflet-control-scale",i=r.DomUtil.create("div",t),u=this.options;return this._addScales(u,t,i),n.on(u.updateWhenIdle?"moveend":"move",this._update,this),n.whenReady(this._update,this),i},onRemove:function(n){n.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(n,t,i){n.metric&&(this._mScale=r.DomUtil.create("div",t+"-line",i));n.imperial&&(this._iScale=r.DomUtil.create("div",t+"-line",i))},_update:function(){var n=this._map.getBounds(),u=n.getCenter().lat,f=6378137*Math.PI*Math.cos(u*Math.PI/180),e=f*(n.getNorthEast().lng-n.getSouthWest().lng)/180,t=this._map.getSize(),i=this.options,r=0;t.x>0&&(r=e*(i.maxWidth/t.x));this._updateScales(i,r)},_updateScales:function(n,t){n.metric&&t&&this._updateMetric(t);n.imperial&&t&&this._updateImperial(t)},_updateMetric:function(n){var t=this._getRoundNum(n);this._mScale.style.width=this._getScaleWidth(t/n)+"px";this._mScale.innerHTML=1e3>t?t+" m":t/1e3+" km"},_updateImperial:function(n){var r,u,f,t=3.2808399*n,i=this._iScale;t>5280?(r=t/5280,u=this._getRoundNum(r),i.style.width=this._getScaleWidth(u/r)+"px",i.innerHTML=u+" mi"):(f=this._getRoundNum(t),i.style.width=this._getScaleWidth(f/t)+"px",i.innerHTML=f+" ft")},_getScaleWidth:function(n){return Math.round(this.options.maxWidth*n)-10},_getRoundNum:function(n){var i=Math.pow(10,(Math.floor(n)+"").length-1),t=n/i;return t=t>=10?10:t>=5?5:t>=3?3:t>=2?2:1,i*t}});r.control.scale=function(n){return new r.Control.Scale(n)};r.Control.Layers=r.Control.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0},initialize:function(n,t,i){r.setOptions(this,i);this._layers={};this._lastZIndex=0;this._handlingClick=!1;for(var u in n)this._addLayer(n[u],u);for(u in t)this._addLayer(t[u],u,!0)},onAdd:function(n){return this._initLayout(),this._update(),n.on("layeradd",this._onLayerChange,this).on("layerremove",this._onLayerChange,this),this._container},onRemove:function(n){n.off("layeradd",this._onLayerChange).off("layerremove",this._onLayerChange)},addBaseLayer:function(n,t){return this._addLayer(n,t),this._update(),this},addOverlay:function(n,t){return this._addLayer(n,t,!0),this._update(),this},removeLayer:function(n){var t=r.stamp(n);return delete this._layers[t],this._update(),this},_initLayout:function(){var t="leaflet-control-layers",n=this._container=r.DomUtil.create("div",t),i,u;n.setAttribute("aria-haspopup",!0);r.Browser.touch?r.DomEvent.on(n,"click",r.DomEvent.stopPropagation):r.DomEvent.disableClickPropagation(n).disableScrollPropagation(n);i=this._form=r.DomUtil.create("form",t+"-list");this.options.collapsed?(r.Browser.android||r.DomEvent.on(n,"mouseover",this._expand,this).on(n,"mouseout",this._collapse,this),u=this._layersLink=r.DomUtil.create("a",t+"-toggle",n),u.href="#",u.title="Layers",r.Browser.touch?r.DomEvent.on(u,"click",r.DomEvent.stop).on(u,"click",this._expand,this):r.DomEvent.on(u,"focus",this._expand,this),r.DomEvent.on(i,"click",function(){setTimeout(r.bind(this._onInputClick,this),0)},this),this._map.on("click",this._collapse,this)):this._expand();this._baseLayersList=r.DomUtil.create("div",t+"-base",i);this._separator=r.DomUtil.create("div",t+"-separator",i);this._overlaysList=r.DomUtil.create("div",t+"-overlays",i);n.appendChild(i)},_addLayer:function(n,t,i){var u=r.stamp(n);this._layers[u]={layer:n,name:t,overlay:i};this.options.autoZIndex&&n.setZIndex&&(this._lastZIndex++,n.setZIndex(this._lastZIndex))},_update:function(){if(this._container){this._baseLayersList.innerHTML="";this._overlaysList.innerHTML="";var r,n,t=!1,i=!1;for(r in this._layers)n=this._layers[r],this._addItem(n),i=i||n.overlay,t=t||!n.overlay;this._separator.style.display=i&&t?"":"none"}},_onLayerChange:function(n){var t=this._layers[r.stamp(n.layer)],i;t&&(this._handlingClick||this._update(),i=t.overlay?"layeradd"===n.type?"overlayadd":"overlayremove":"layeradd"===n.type?"baselayerchange":null,i&&this._map.fire(i,t))},_createRadioElement:function(n,i){var r='<input type="radio" class="leaflet-control-layers-selector" name="'+n+'"',u;return i&&(r+=' checked="checked"'),r+="/>",u=t.createElement("div"),u.innerHTML=r,u.firstChild},_addItem:function(n){var i,u=t.createElement("label"),e=this._map.hasLayer(n.layer),f,o;return n.overlay?(i=t.createElement("input"),i.type="checkbox",i.className="leaflet-control-layers-selector",i.defaultChecked=e):i=this._createRadioElement("leaflet-base-layers",e),i.layerId=r.stamp(n.layer),r.DomEvent.on(i,"click",this._onInputClick,this),f=t.createElement("span"),f.innerHTML=" "+n.name,u.appendChild(i),u.appendChild(f),o=n.overlay?this._overlaysList:this._baseLayersList,o.appendChild(u),u},_onInputClick:function(){var t,i,n,r=this._form.getElementsByTagName("input"),u=r.length;for(this._handlingClick=!0,t=0;u>t;t++)i=r[t],n=this._layers[i.layerId],i.checked&&!this._map.hasLayer(n.layer)?this._map.addLayer(n.layer):!i.checked&&this._map.hasLayer(n.layer)&&this._map.removeLayer(n.layer);this._handlingClick=!1;this._refocusOnMap()},_expand:function(){r.DomUtil.addClass(this._container,"leaflet-control-layers-expanded")},_collapse:function(){this._container.className=this._container.className.replace(" leaflet-control-layers-expanded","")}});r.control.layers=function(n,t,i){return new r.Control.Layers(n,t,i)};r.PosAnimation=r.Class.extend({includes:r.Mixin.Events,run:function(n,t,i,u){this.stop();this._el=n;this._inProgress=!0;this._newPos=t;this.fire("start");n.style[r.DomUtil.TRANSITION]="all "+(i||.25)+"s cubic-bezier(0,0,"+(u||.5)+",1)";r.DomEvent.on(n,r.DomUtil.TRANSITION_END,this._onTransitionEnd,this);r.DomUtil.setPosition(n,t);r.Util.falseFn(n.offsetWidth);this._stepTimer=setInterval(r.bind(this._onStep,this),50)},stop:function(){this._inProgress&&(r.DomUtil.setPosition(this._el,this._getPos()),this._onTransitionEnd(),r.Util.falseFn(this._el.offsetWidth))},_onStep:function(){var n=this._getPos();return n?(this._el._leaflet_pos=n,void this.fire("step")):void this._onTransitionEnd()},_transformRe:/([-+]?(?:\d*\.)?\d+)\D*, ([-+]?(?:\d*\.)?\d+)\D*\)/,_getPos:function(){var i,u,t,e=this._el,f=n.getComputedStyle(e);if(r.Browser.any3d){if(t=f[r.DomUtil.TRANSFORM].match(this._transformRe),!t)return;i=parseFloat(t[1]);u=parseFloat(t[2])}else i=parseFloat(f.left),u=parseFloat(f.top);return new r.Point(i,u,!0)},_onTransitionEnd:function(){r.DomEvent.off(this._el,r.DomUtil.TRANSITION_END,this._onTransitionEnd,this);this._inProgress&&(this._inProgress=!1,this._el.style[r.DomUtil.TRANSITION]="",this._el._leaflet_pos=this._newPos,clearInterval(this._stepTimer),this.fire("step").fire("end"))}});r.Map.include({setView:function(n,t,u){if(t=t===i?this._zoom:this._limitZoom(t),n=this._limitCenter(r.latLng(n),t,this.options.maxBounds),u=u||{},this._panAnim&&this._panAnim.stop(),this._loaded&&!u.reset&&u!==!0){u.animate!==i&&(u.zoom=r.extend({animate:u.animate},u.zoom),u.pan=r.extend({animate:u.animate},u.pan));var f=this._zoom!==t?this._tryAnimatedZoom&&this._tryAnimatedZoom(n,t,u.zoom):this._tryAnimatedPan(n,u.pan);if(f)return clearTimeout(this._sizeTimer),this}return this._resetView(n,t),this},panBy:function(n,t){if(n=r.point(n).round(),t=t||{},!n.x&&!n.y)return this;if(this._panAnim||(this._panAnim=new r.PosAnimation,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),t.noMoveStart||this.fire("movestart"),t.animate!==!1){r.DomUtil.addClass(this._mapPane,"leaflet-pan-anim");var i=this._getMapPanePos().subtract(n);this._panAnim.run(this._mapPane,i,t.duration||.25,t.easeLinearity)}else this._rawPanBy(n),this.fire("move").fire("moveend");return this},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){r.DomUtil.removeClass(this._mapPane,"leaflet-pan-anim");this.fire("moveend")},_tryAnimatedPan:function(n,t){var i=this._getCenterOffset(n)._floor();return(t&&t.animate)===!0||this.getSize().contains(i)?(this.panBy(i,t),!0):!1}});r.PosAnimation=r.DomUtil.TRANSITION?r.PosAnimation:r.PosAnimation.extend({run:function(n,t,i,u){this.stop();this._el=n;this._inProgress=!0;this._duration=i||.25;this._easeOutPower=1/Math.max(u||.5,.2);this._startPos=r.DomUtil.getPosition(n);this._offset=t.subtract(this._startPos);this._startTime=+new Date;this.fire("start");this._animate()},stop:function(){this._inProgress&&(this._step(),this._complete())},_animate:function(){this._animId=r.Util.requestAnimFrame(this._animate,this);this._step()},_step:function(){var n=+new Date-this._startTime,t=1e3*this._duration;t>n?this._runFrame(this._easeOut(n/t)):(this._runFrame(1),this._complete())},_runFrame:function(n){var t=this._startPos.add(this._offset.multiplyBy(n));r.DomUtil.setPosition(this._el,t);this.fire("step")},_complete:function(){r.Util.cancelAnimFrame(this._animId);this._inProgress=!1;this.fire("end")},_easeOut:function(n){return 1-Math.pow(1-n,this._easeOutPower)}});r.Map.mergeOptions({zoomAnimation:!0,zoomAnimationThreshold:4});r.DomUtil.TRANSITION&&r.Map.addInitHook(function(){this._zoomAnimated=this.options.zoomAnimation&&r.DomUtil.TRANSITION&&r.Browser.any3d&&!r.Browser.android23&&!r.Browser.mobileOpera;this._zoomAnimated&&r.DomEvent.on(this._mapPane,r.DomUtil.TRANSITION_END,this._catchTransitionEnd,this)});r.Map.include(r.DomUtil.TRANSITION?{_catchTransitionEnd:function(n){this._animatingZoom&&n.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(n,t,i){if(this._animatingZoom)return!0;if(i=i||{},!this._zoomAnimated||i.animate===!1||this._nothingToAnimate()||Math.abs(t-this._zoom)>this.options.zoomAnimationThreshold)return!1;var r=this.getZoomScale(t),u=this._getCenterOffset(n)._divideBy(1-1/r),f=this._getCenterLayerPoint()._add(u);return i.animate===!0||this.getSize().contains(u)?(this.fire("movestart").fire("zoomstart"),this._animateZoom(n,t,f,r,null,!0),!0):!1},_animateZoom:function(n,t,i,u,f,e){this._animatingZoom=!0;r.DomUtil.addClass(this._mapPane,"leaflet-zoom-anim");this._animateToCenter=n;this._animateToZoom=t;r.Draggable&&(r.Draggable._disabled=!0);this.fire("zoomanim",{center:n,zoom:t,origin:i,scale:u,delta:f,backwards:e})},_onZoomTransitionEnd:function(){this._animatingZoom=!1;r.DomUtil.removeClass(this._mapPane,"leaflet-zoom-anim");this._resetView(this._animateToCenter,this._animateToZoom,!0,!0);r.Draggable&&(r.Draggable._disabled=!1)}}:{});r.TileLayer.include({_animateZoom:function(n){this._animating||(this._animating=!0,this._prepareBgBuffer());var t=this._bgBuffer,i=r.DomUtil.TRANSFORM,u=n.delta?r.DomUtil.getTranslateString(n.delta):t.style[i],f=r.DomUtil.getScaleString(n.scale,n.origin);t.style[i]=n.backwards?f+" "+u:u+" "+f},_endZoomAnim:function(){var n=this._tileContainer,t=this._bgBuffer;n.style.visibility="";n.parentNode.appendChild(n);r.Util.falseFn(t.offsetWidth);this._animating=!1},_clearBgBuffer:function(){var n=this._map;!n||n._animatingZoom||n.touchZoom._zooming||(this._bgBuffer.innerHTML="",this._bgBuffer.style[r.DomUtil.TRANSFORM]="")},_prepareBgBuffer:function(){var t=this._tileContainer,n=this._bgBuffer,i=this._getLoadedTilesPercentage(n),u=this._getLoadedTilesPercentage(t);return n&&i>.5&&.5>u?(t.style.visibility="hidden",void this._stopLoadingImages(t)):(n.style.visibility="hidden",n.style[r.DomUtil.TRANSFORM]="",this._tileContainer=n,n=this._bgBuffer=t,this._stopLoadingImages(n),void clearTimeout(this._clearBgBufferTimer))},_getLoadedTilesPercentage:function(n){for(var r=n.getElementsByTagName("img"),u=0,t=0,i=r.length;i>t;t++)r[t].complete&&u++;return u/i},_stopLoadingImages:function(n){for(var t,f=Array.prototype.slice.call(n.getElementsByTagName("img")),i=0,u=f.length;u>i;i++)t=f[i],t.complete||(t.onload=r.Util.falseFn,t.onerror=r.Util.falseFn,t.src=r.Util.emptyImageUrl,t.parentNode.removeChild(t))}});r.Map.include({_defaultLocateOptions:{watch:!1,setView:!1,maxZoom:1/0,timeout:1e4,maximumAge:0,enableHighAccuracy:!1},locate:function(n){if(n=this._locateOptions=r.extend(this._defaultLocateOptions,n),!navigator.geolocation)return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var t=r.bind(this._handleGeolocationResponse,this),i=r.bind(this._handleGeolocationError,this);return n.watch?this._locationWatchId=navigator.geolocation.watchPosition(t,i,n):navigator.geolocation.getCurrentPosition(t,i,n),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(n){var t=n.code,i=n.message||(1===t?"permission denied":2===t?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld();this.fire("locationerror",{code:t,message:"Geolocation error: "+i+"."})},_handleGeolocationResponse:function(n){var t=n.coords.latitude,u=n.coords.longitude,o=new r.LatLng(t,u),f=180*n.coords.accuracy/40075017,s=f/Math.cos(r.LatLng.DEG_TO_RAD*t),h=r.latLngBounds([t-f,u-s],[t+f,u+s]),c=this._locateOptions,l,e,i;c.setView&&(l=Math.min(this.getBoundsZoom(h),c.maxZoom),this.setView(o,l));e={latlng:o,bounds:h,timestamp:n.timestamp};for(i in n.coords)"number"==typeof n.coords[i]&&(e[i]=n.coords[i]);this.fire("locationfound",e)}})}(window,document)