(function(n,t,i){var e=n.L,r={},u,f;r.version="0.7.7";typeof module=="object"&&typeof module.exports=="object"?module.exports=r:typeof define=="function"&&define.amd&&define(r);r.noConflict=function(){return n.L=e,this};n.L=r;r.Util={extend:function(n){for(var u=Array.prototype.slice.call(arguments,1),t,r,i=0,f=u.length;i<f;i++){r=u[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(typeof n=="object"){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;if(r){u=!0;return}r=!0;setTimeout(function(){r=!1;u&&(f.apply(i,e),u=!1)},t);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||t.indexOf("?")===-1?"?":"&")+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);else typeof u=="function"&&(u=u(t));return u})},isArray:Array.isArray||function(n){return Object.prototype.toString.call(n)==="[object Array]"},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 u(t){var r=+new Date,u=Math.max(0,16-(r-i));return i=r+u,n.setTimeout(t,u)}var i=0,f=n.requestAnimationFrame||t("RequestAnimationFrame")||u,e=n.cancelAnimationFrame||t("CancelAnimationFrame")||t("CancelRequestAnimationFrame")||function(t){n.clearTimeout(t)};r.Util.requestAnimFrame=function(t,i,e,o){if(t=r.bind(t,i),e&&f===u)t();else return 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)&&u!=="prototype"&&(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;n<i;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=typeof n=="function"?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 f=this[u]=this[u]||{},o=i&&i!==this&&r.stamp(i),s,v,l,e,h,a,c;for(n=r.Util.splitWords(n),s=0,v=n.length;s<v;s++)l={action:t,context:i||this},e=n[s],o?(h=e+"_idx",a=h+"_len",c=f[h]=f[h]||{},c[o]||(c[o]=[],f[a]=(f[a]||0)+1),c[o].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 e=this[u],a=i&&i!==this&&r.stamp(i),h,y,c,f,o,l,v,s,p;for(n=r.Util.splitWords(n),h=0,y=n.length;h<y;h++)if(c=n[h],l=c+"_idx",v=l+"_len",s=e[l],t){if(f=a&&s?s[a]:e[c],f){for(o=f.length-1;o>=0;o--)f[o].action!==t||i&&f[o].context!==i||(p=f.splice(o,1),p[0].action=r.Util.falseFn);i&&s&&f.length===0&&(delete s[a],e[v]--)}}else delete e[c],delete e[l],delete e[v];return this},clearAllEventListeners:function(){return delete this[u],this},fireEvent:function(n,t){if(!this.hasEventListeners(n))return this;var h=r.Util.extend({},t,{type:n,target:this}),o=this[u],f,i,e,s,c;if(o[n])for(f=o[n].slice(),i=0,e=f.length;i<e;i++)f[i].action.call(f[i].context,h);s=o[n+"_idx"];for(c in s)if(f=s[c].slice(),f)for(i=0,e=f.length;i<e;i++)f[i].action.call(f[i].context,h);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(),o=u.indexOf("webkit")!==-1,k=u.indexOf("chrome")!==-1,c=u.indexOf("phantom")!==-1,d=u.indexOf("android")!==-1,l=u.search("android [23]")!==-1,g=u.indexOf("gecko")!==-1,e=typeof orientation!=i+"",a=!n.PointerEvent&&n.MSPointerEvent,v=n.PointerEvent&&n.navigator.pointerEnabled||a,nt="devicePixelRatio"in n&&n.devicePixelRatio>1||"matchMedia"in n&&n.matchMedia("(min-resolution:144dpi)")&&n.matchMedia("(min-resolution:144dpi)").matches,s=t.documentElement,y=f&&"transition"in s.style,h="WebKitCSSMatrix"in n&&"m11"in new n.WebKitCSSMatrix&&!l,p="MozPerspective"in s.style,w="OTransition"in s.style,tt=!n.L_DISABLE_3D&&(y||h||p||w)&&!c,it=!n.L_NO_TOUCH&&!c&&(v||"ontouchstart"in n||n.DocumentTouch&&t instanceof n.DocumentTouch);r.Browser={ie:f,ielt9:b,webkit:o,gecko:g&&!o&&!n.opera&&!f,android:d,android23:l,chrome:k,ie3d:y,webkit3d:h,gecko3d:p,opera3d:w,any3d:tt,mobile:e,mobileWebkit:e&&o,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||n===null?n:new r.Point(n,t,u)};r.Bounds=function(n,t){var r,i,u;if(n)for(r=t?[n,t]:n,i=0,u=r.length;i<u;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=typeof n[0]=="number"||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 typeof n=="string"?t.getElementById(n):n},getStyle:function(n,i){var r=n.style[i],u;return!r&&n.currentStyle&&(r=n.currentStyle[i]),(!r||r==="auto")&&t.defaultView&&(u=t.defaultView.getComputedStyle(n,null),r=u?u[i]:null),r==="auto"?null:r},getViewportOffset:function(n){var u=0,f=0,i=n,e=t.body,s=t.documentElement,o;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&&o==="absolute")break;if(o==="fixed"){u+=e.scrollTop||s.scrollTop||0;f+=e.scrollLeft||s.scrollLeft||0;break}if(o==="relative"&&!i.offsetLeft){var c=r.DomUtil.getStyle(i,"width"),l=r.DomUtil.getStyle(i,"max-width"),h=i.getBoundingClientRect();(c!=="none"||l!=="none")&&(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=r.DomUtil.getStyle(t.body,"direction")==="ltr"),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,u,o,e;if(n.classList!==i)for(f=r.Util.splitWords(t),u=0,o=f.length;u<o;u++)n.classList.add(f[u]);else r.DomUtil.hasClass(n,t)||(e=r.DomUtil._getClass(n),r.DomUtil._setClass(n,(e?e+" ":"")+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(t===1)return}t=Math.round(t*100);i?(i.Enabled=t!==100,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=r.DomUtil.TRANSITION==="webkitTransition"||r.DomUtil.TRANSITION==="OTransition"?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)+(i<n||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)?typeof n[0]=="number"||typeof n[0]=="string"?new r.LatLng(n[0],n[1],n[2]):null:n===i||n===null?n:typeof n=="object"&&"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){var r,i,u;if(n)for(r=t?[n,t]:n,i=0,u=r.length;i<u;i++)this.extend(r[i])};r.LatLngBounds.prototype={extend:function(n){if(!n)return this;var t=r.latLng(n);return n=t!==null?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=typeof n[0]=="number"||n instanceof r.LatLng?r.latLng(n):r.latLngBounds(n);var u=this._southWest,f=this._northEast,t,i;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));i=t.maxZoom?Math.min(t.maxZoom,i):i;var 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 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})},panTo2:function(n,t,i){return this.setView(n,t,{pan:i})},panBy:function(n){return this.fire("movestart"),this._rawPanBy(r.point(n)),this.fire("move"),this.fire("moveend")},setMaxBounds:function(n){if(n=r.latLngBounds(n),this.options.maxBounds=n,!n)return this.off("moveend",this._panInsideMaxBounds,this);this._loaded&&this._panInsideMaxBounds();return this.on("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);if(this._layers[t])return this;if(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)}return this._loaded&&this._layerAdd(n),this},removeLayer:function(n){var t=r.stamp(n);if(!this._layers[t])return this;if(this._loaded)n.onRemove(this);return 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},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?this:(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}))},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?Infinity:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(n,t,i){n=r.latLngBounds(n);var u=this.getMinZoom()-(t?1:0),s=this.getMaxZoom(),e=this.getSize(),h=n.getNorthWest(),c=n.getSouthEast(),o=!0,f;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&&u<=s);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){if(t._leaflet)throw new Error("Map container is already initialized.");}else throw new Error("Map container not found.");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");n!=="absolute"&&n!=="relative"&&n!=="fixed"&&(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;t<i;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;this.fire("viewreset",{hard:!i});e&&(this.fire("load"),this.eachLayer(this._layerAdd,this));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=Infinity,u=-Infinity,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 u=["dblclick","mousedown","mouseup","mouseenter","mouseleave","mousemove","contextmenu"],i=0,f=u.length;i<f;i++)r.DomEvent[t](this._container,u[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=t==="mouseenter"?"mouseover":t==="mouseleave"?"mouseout":t,this.hasEventListeners(t))){t==="contextmenu"&&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;n<t;n++)this._handlers[n].disable()},whenReady:function(n,t){if(this._loaded)n.call(t||this,this);else this.on("load",n,t);return 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),s*.5),h=Math.tan(.5*(Math.PI*.5-t))/i,t=-u*Math.log(h),new r.Point(a,t)},unproject:function(n){for(var e=r.LatLng.RAD_TO_DEG,i=this.R_MAJOR,c=this.R_MINOR,l=n.x*e/i,o=c/i,s=Math.sqrt(1-o*o),h=Math.exp(-n.y/i),t=Math.PI/2-2*Math.atan(h),a=15,u=.1,f;Math.abs(u)>1e-7&&--a>0;)f=s*Math.sin(t),u=Math.PI/2-2*Math.atan(h*Math.pow((1-f)/(1+f),.5*s))-t,t+=u;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;typeof i=="string"&&(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);if(this._animated)n.on({zoomanim:this._animateZoom,zoomend:this._endZoomAnim},this);if(!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=n.children,r=-t(Infinity,-Infinity),f,i=0,e=u.length;i<e;i++)u[i]!==this._container&&(f=parseInt(u[i].style.zIndex,10),isNaN(f)||(r=t(r,f)));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 u=[],h=n.getCenter(),i,o,e,s,f=n.min.y;f<=n.max.y;f++)for(i=n.min.x;i<=n.max.x;i++)o=new r.Point(i,f),this._tileShouldBeLoaded(o)&&u.push(o);if(e=u.length,e!==0){for(u.sort(function(n,t){return n.distanceTo(h)-t.distanceTo(h)}),s=t.createDocumentFragment(),this._tilesToLoad||this.fire("loading"),this._tilesToLoad+=e,i=0;i<e;i++)this._addTile(u[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=this._getTileSize(),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=t.detectRetina&&r.Browser.retina?i.height=f*2:i.height=f;for(u in t)this.options.hasOwnProperty(u)||u==="crs"||(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);if(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(1/2*(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(n==="icon")throw new Error("iconUrl not set in Icon options (see the docs).");return null}return r=t&&t.tagName==="IMG"?this._createImg(i,t):this._createImg(i),this._setIconStyles(r,n),r},_setIconStyles:function(n,t){var u=this.options,f=r.point(u[t+"Size"]),i;i=t==="shadow"?r.point(u.shadowAnchor||u.iconAnchor):r.point(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&&n==="icon"&&(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 u=t.getElementsByTagName("script"),f=/[\/^]leaflet[\-\._]?([\w\-\._]*)\.js\??/,i,o,r,n=0,e=u.length;n<e;n++)if(i=u[n].src,o=i.match(f),o)return r=i.split(f)[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);if(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(){return this._icon&&this._setPos(this._map.latLngToLayerPoint(this._latlng).round()),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;if(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){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);for(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){n.keyCode===13&&this.fire("click",{originalEvent:n,latlng:this._latlng})},_fireMouseEvent:function(n){this.fire(n.type,{originalEvent:n,latlng:this._latlng});n.type==="contextmenu"&&this.hasEventListeners(n.type)&&r.DomEvent.preventDefault(n);n.type!=="mousedown"?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&&n.tagName==="DIV"?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 n="leaflet-popup",f=n+" "+this.options.className+" leaflet-zoom-"+(this._animated?"animated":"hide"),u=this._container=r.DomUtil.create("div",f),t,i;if(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(typeof this._content=="string")this._contentNode.innerHTML=this._content;else{while(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]);if(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}return n instanceof r.Popup?(r.setOptions(n,t),this._popup=n,n._source=this):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;t<i;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 r=Array.prototype.slice.call(arguments,1),i,t;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){if(this.hasLayer(n))return this;if("on"in n)n.on(r.FeatureGroup.EVENTS,this._propagateEvent,this);return 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]),"off"in 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+n*2)._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(){var t,n;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(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._map&&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});n.type==="contextmenu"&&r.DomEvent.preventDefault(n);n.type!=="mousemove"&&r.DomEvent.stopPropagation(n)}}});r.Map.include({_initPathRoot:function(){if(!this._pathRoot){if(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})}else 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){if(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}return 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&&typeof n.adj=="object"}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.fire("remove");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);n.lineCap&&(this._ctx.lineCap=n.lineCap);n.lineJoin&&(this._ctx.lineJoin=n.lineJoin)},_drawPath:function(){var n,t,u,f,i,e;for(this._ctx.beginPath(),n=0,u=this._parts.length;n<u;n++){for(t=0,f=this._parts[n].length;t<f;t++)i=this._parts[n][t],e=(t===0?"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.fillRule||"evenodd"));t.stroke&&(n.globalAlpha=t.opacity,n.stroke());n.restore()}},_initEvents:function(){if(this.options.clickable){this._map.on("mousemove",this._onMouseMove,this);this._map.on("click dblclick contextmenu",this._fireMouseEvent,this)}},_fireMouseEvent:function(n){this._containsPoint(n.layerPoint)&&this.fire(n.type,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 n=this._pathRoot,i;if(!n){if(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),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;r<u;r++)f[r]&&e.push(n[r]);return e},_simplifyDPStep:function(n,t,i,r,u){for(var o=0,e,s,f=r+1;f<=u-1;f++)s=this._sqClosestPointOnSegment(n[f],n[r],n[u],!0),s>o&&(e=f,o=s);o>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;i<f;i++)this._sqDist(n[i],n[u])>t&&(r.push(n[i]),u=i);return u<f-1&&r.push(n[f-1]),r},clipSegment:function(n,t,i,r){var u=r?this._lastCode:this._getBitCode(n,i),f=this._getBitCode(t,i),o,e,s;for(this._lastCode=f;;)if(u|f){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)}else return[n,t]},_getEdgeIntersection:function(n,t,i,u){var f=t.x-n.x,e=t.y-n.y,o=u.min,s=u.max;return i&8?new r.Point(n.x+f*(s.y-n.y)/e,s.y):i&4?new r.Point(n.x+f*(o.y-n.y)/e,o.y):i&2?new r.Point(s.x,n.y+e*(s.x-n.x)/f):i&1?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 o=t.x,s=t.y,f=i.x-o,e=i.y-s,c=f*f+e*e,h;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;n<t;n++)this._originalPoints[n]=this._map.latLngToLayerPoint(this._latlngs[n])},getPathString:function(){for(var n=0,i=this._parts.length,t="";n<i;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 u,t,l,h,f=Infinity,c=this._parts,e,o,i=null,s=0,a=c.length;s<a;s++)for(u=c[s],t=1,l=u.length;t<l;t++)e=u[t-1],o=u[t],h=r.LineUtil._sqClosestPointOnSegment(n,e,o,!0),h<f&&(f=h,i=r.LineUtil._sqClosestPointOnSegment(n,e,o));return i&&(i.distance=Math.sqrt(f)),i},getBounds:function(){return new r.LatLngBounds(this.getLatLngs())},_convertLatLngs:function(n,t){for(var f=t?n:[],i=0,u=n.length;i<u;i++){if(r.Util.isArray(n[i])&&typeof n[i][0]!="number")return;f[i]=r.latLng(n[i])}return f},_initEvents:function(){r.Path.prototype._initEvents.call(this)},_getPathPartStr:function(n){for(var f=r.Path.VML,t=0,e=n.length,u="",i;t<e;t++)i=n[t],f&&i._round(),u+=(t?"L":"M")+i.x+" "+i.y;return u},_clipPoints:function(){var i=this._originalPoints,e=i.length,n,t,u;if(this.options.noClip){this._parts=[i];return}this._parts=[];var f=this._parts,o=this._map._pathViewport,s=r.LineUtil;for(n=0,t=0;n<e-1;n++)(u=s.clipSegment(i[n],i[n+1],o,n),u)&&(f[t]=f[t]||[],f[t].push(u[0]),(u[1]!==i[n+1]||n===e-2)&&(f[t].push(u[1]),t++))},_simplifyPoints:function(){for(var t=this._parts,i=r.LineUtil,n=0,u=t.length;n<u;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,v=[1,4,2,8],a,l,o,s,f,u,c=r.LineUtil,i=0,h=n.length;i<h;i++)n[i]._code=c._getBitCode(n[i],t);for(l=0;l<4;l++){for(f=v[l],e=[],i=0,h=n.length,a=h-1;i<h;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])&&typeof n[0][0]!="number")for(this._latlngs=this._convertLatLngs(n[0]),this._holes=n.slice(1),t=0,u=this._holes.length;t<u;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;n<i;n++)for(this._holePoints[n]=[],t=0,u=this._holes[n].length;t<u;t++)this._holePoints[n][t]=this._map.latLngToLayerPoint(this._holes[n][t])},setLatLngs:function(n){return n&&r.Util.isArray(n[0])&&typeof n[0][0]!="number"?(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;n<u;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){i<r?n.setLatLngs(t[i++]):this.removeLayer(n)},this);i<r;)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;u<s;u++)for(f=this._parts[u],i=0,o=f.length,e=o-1;i<o;e=i++)if((t||i!==0)&&(h=r.LineUtil.pointToSegmentDistance(n,f[e],f[i]),h<=c))return!0;return!1}}:{});r.Polygon.include(r.Path.CANVAS?{_containsPoint:function(n){var o=!1,i,t,u,f,e,s,c,h;if(r.Polyline.prototype._containsPoint.call(this,n,!0))return!0;for(f=0,c=this._parts.length;f<c;f++)for(i=this._parts[f],e=0,h=i.length,s=h-1;e<h;s=e++)t=i[e],u=i[s],t.y>n.y!=u.y>n.y&&n.x<(u.x-t.x)*(n.y-t.y)/(u.y-t.y)+t.x&&(o=!o);return o}}:{});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,Math.PI*2,!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 e=r.Util.isArray(n)?n:n.features,u,o,f,t,i;if(e){for(u=0,o=e.length;u<o;u++)f=e[u],(f.geometries||f.geometry||f.features||f.coordinates)&&this.addData(e[u]);return this}if(t=this.options,!t.filter||t.filter(n)){if(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);return this.addLayer(i)}},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){typeof t=="function"&&(t=t(n.feature));n.setStyle&&n.setStyle(t)}});r.extend(r.GeoJSON,{geometryToLayer:function(n,t,i,u){var h=n.type==="Feature"?n.geometry:n,f=h.coordinates,c=[],s,e,o,l;i=i||this.coordsToLatLng;switch(h.type){case"Point":return s=i(f),t?t(n,s):new r.Marker(s);case"MultiPoint":for(o=0,l=f.length;o<l;o++)s=i(f[o]),c.push(t?t(n,s):new r.Marker(s));return new r.FeatureGroup(c);case"LineString":return e=this.coordsToLatLngs(f,0,i),new r.Polyline(e,u);case"Polygon":if(f.length===2&&!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,l=h.geometries.length;o<l;o++)c.push(this.geometryToLayer({geometry:h.geometries[o],type:"Feature",properties:n.properties},t,i,u));return new r.FeatureGroup(c);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;r<f;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;t<u;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 n.type==="Feature"?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=[r.GeoJSON.latLngsToCoords(this.getLatLngs())],t,u,i;if(n[0].push(n[0][0]),this._holes)for(t=0,u=this._holes.length;t<u;t++)i=r.GeoJSON.latLngsToCoords(this._holes[t]),i.push(i[0]),n.push(i);return r.GeoJSON.getFeature(this,{type:"Polygon",coordinates:n})}}),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 t=this.feature&&this.feature.geometry,i=[],u,f;return t&&t.type==="MultiPoint"?n("MultiPoint").call(this):(f=t&&t.type==="GeometryCollection",this.eachLayer(function(n){n.toGeoJSON&&(u=n.toGeoJSON(),i.push(f?u.geometry:r.GeoJSON.asFeature(u)))}),f)?r.GeoJSON.getFeature(this,{geometries:i,type:"GeometryCollection"}):{type:"FeatureCollection",features:i}}})}();r.geoJson=function(n,t){return new r.GeoJSON(n,t)};r.DomEvent={addListener:function(n,t,i,u){var o=r.stamp(i),s="_leaflet_"+t+o,f,e,h;return n[s]?this:(f=function(t){return i.call(u||n,t||r.DomEvent._getEvent())},r.Browser.pointer&&t.indexOf("touch")===0)?this.addPointerListener(n,t,f,o):(r.Browser.touch&&t==="dblclick"&&this.addDoubleTapListener&&this.addDoubleTapListener(n,f,o),"addEventListener"in n?t==="mousewheel"?(n.addEventListener("DOMMouseScroll",f,!1),n.addEventListener(t,f,!1)):t==="mouseenter"||t==="mouseleave"?(e=f,h=t==="mouseenter"?"mouseover":"mouseout",f=function(t){if(r.DomEvent._checkMouse(n,t))return e(t)},n.addEventListener(h,f,!1)):t==="click"&&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[s]=f,this)},removeListener:function(n,t,i){var f=r.stamp(i),e="_leaflet_"+t+f,u=n[e];return u?(r.Browser.pointer&&t.indexOf("touch")===0?this.removePointerListener(n,t,f):r.Browser.touch&&t==="dblclick"&&this.removeDoubleTapListener?this.removeDoubleTapListener(n,f):"removeEventListener"in n?t==="mousewheel"?(n.removeEventListener("DOMMouseScroll",u,!1),n.removeEventListener(t,u,!1)):t==="mouseenter"||t==="mouseleave"?n.removeEventListener(t==="mouseenter"?"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{while(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;){if(t=i.arguments[0],t&&n.Event===t.constructor)break;i=i.caller}return t},_filterClick:function(n,t){var u=n.timeStamp||n.originalEvent.timeStamp,i=r.DomEvent._lastClick&&u-r.DomEvent._lastClick;if(i&&i>100&&i<500||n.target._simulatedClick&&!n._simulated){r.DomEvent.stop(n);return}return 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&&(n.which===1||n.button===1||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){this._moved=!0;return}var u=n.touches&&n.touches.length===1?n.touches[0]:n,f=new r.Point(u.clientX,u.clientY),i=f.subtract(this._startPoint);(i.x||i.y)&&(r.Browser.touch&&Math.abs(i.x)+Math.abs(i.y)<3||(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"),this._lastTarget=n.target||n.srcElement,r.DomUtil.addClass(this._lastTarget,"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(){r.DomUtil.removeClass(t.body,"leaflet-dragging");this._lastTarget&&(r.DomUtil.removeClass(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null);for(var n in r.Draggable.MOVE)r.DomEvent.off(t,r.Draggable.MOVE[n],this._onMove).off(t,r.Draggable.END[n],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:Infinity,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);if(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);t.options.doubleClickZoom==="center"?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)&&(t.options.scrollWheelZoom==="center"?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 y(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-(o||t),f=n.touches?n.touches[0]:n,c=u>0&&u<=p,o=t)}function s(n){var u,s,t,h;if(r.Browser.pointer){if(u=e.indexOf(n.pointerId),u===-1)return;e.splice(u,1)}if(c){if(r.Browser.pointer){s={};for(h in f)t=f[h],s[h]=typeof t=="function"?t.bind(f):t;f=s}f.type="dblclick";i(f);o=null}}var o,c=!1,p=250,f,l="_leaflet_",a=this._touchstart,v=this._touchend,e=[],h;return n[l+a+u]=y,n[l+v+u]=s,h=r.Browser.pointer?t.documentElement:n,n.addEventListener(a,y,!1),h.addEventListener(v,s,!1),r.Browser.pointer&&h.addEventListener(r.DomEvent.POINTER_CANCEL,s,!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){var i,t;for(n.pointerType!=="mouse"&&n.pointerType!==n.MSPOINTER_TYPE_MOUSE&&r.DomEvent.preventDefault(n),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&&n.pointerType!=="mouse"||n.buttons!==0){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&&n.touches.length===2&&!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&&n.touches.length===2&&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),this._scale!==1)&&(!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,!1,!0)},_onTouchEnd:function(){var n;if(!this._moved||!this._zooming){this._zooming=!1;return}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){this._fireClick=!1;clearTimeout(this._holdTimeout);return}var i=n.touches[0],u=i.target;this._startPos=this._newPos=new r.Point(i.clientX,i.clientY);u.tagName&&u.tagName.toLowerCase()==="a"&&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&&i.tagName.toLowerCase()==="a"&&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){if(this._moved=!1,!n.shiftKey||n.which!==1&&n.button!==1)return!1;r.DomUtil.disableTextSelection();r.DomUtil.disableImageDrag();this._startLayerPoint=this._map.mouseEventToLayerPoint(n);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){n.keyCode===27&&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;n.tabIndex===-1&&(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={},i=this.keyCodes,t=0,r=i.left.length;t<r;t++)u[i.left[t]]=[-1*n,0];for(t=0,r=i.right.length;t<r;t++)u[i.right[t]]=[n,0];for(t=0,r=i.down.length;t<r;t++)u[i.down[t]]=[0,n];for(t=0,r=i.up.length;t<r;t++)u[i.up[t]]=[0,-1*n]},_setZoomOffset:function(n){for(var u=this._zoomKeys={},i=this.keyCodes,t=0,r=i.zoomIn.length;t<r;t++)u[i.zoomIn[t]]=n;for(t=0,r=i.zoomOut.length;t<r;t++)u[i.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)t.setZoom(t.getZoom()+this._zoomKeys[i]);else return;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"),u.indexOf("bottom")!==-1?i.insertBefore(t,i.firstChild):i.appendChild(t),this},removeFrom:function(n){var t=this.getPosition(),i=n._controlCorners[t];if(i.removeChild(this._container),this._map=null,this.onRemove)this.onRemove(n);return 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.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());n.on("layeradd",this._onLayerAdd,this).on("layerremove",this._onLayerRemove,this);return 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;this._addScales(u,t,i);n.on(u.updateWhenIdle?"moveend":"move",this._update,this);return 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=t<1e3?t+" m":t/1e3+" km"},_updateImperial:function(n){var t=n*3.2808399,i=this._iScale,r,u,f;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){this._initLayout();this._update();n.on("layeradd",this._onLayerChange,this).on("layerremove",this._onLayerChange,this);return this._container},onRemove:function(n){n.off("layeradd",this._onLayerChange,this).off("layerremove",this._onLayerChange,this)},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;if(n.setAttribute("aria-haspopup",!0),r.Browser.touch)r.DomEvent.on(n,"click",r.DomEvent.stopPropagation);else r.DomEvent.disableClickPropagation(n).disableScrollPropagation(n);if(i=this._form=r.DomUtil.create("form",t+"-list"),this.options.collapsed){if(!r.Browser.android)r.DomEvent.on(n,"mouseover",this._expand,this).on(n,"mouseout",this._collapse,this);if(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);else 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)}else 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 t=!1,i=!1,r,n;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?n.type==="layeradd"?"overlayadd":"overlayremove":n.type==="layeradd"?"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 u=t.createElement("label"),i,e=this._map.hasLayer(n.layer),f,o;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);return 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;t<u;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();if(!n){this._onTransitionEnd();return}this._el._leaflet_pos=n;this.fire("step")},_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)}if(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)?!1:(this.panBy(i,t),!0)}});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=this._duration*1e3;n<t?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(){if(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)?!1:(this.fire("movestart").fire("zoomstart"),this._animateZoom(n,t,f,r,null,!0),!0)},_animateZoom:function(n,t,i,u,f,e,o){o||(this._animatingZoom=!0);r.DomUtil.addClass(this._mapPane,"leaflet-zoom-anim");this._animateToCenter=n;this._animateToZoom=t;r.Draggable&&(r.Draggable._disabled=!0);r.Util.requestAnimFrame(function(){this.fire("zoomanim",{center:n,zoom:t,origin:i,scale:u,delta:f,backwards:e});setTimeout(r.bind(this._onZoomTransitionEnd,this),250)},this)},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._animatingZoom=!1,r.DomUtil.removeClass(this._mapPane,"leaflet-zoom-anim"),r.Util.requestAnimFrame(function(){this._resetView(this._animateToCenter,this._animateToZoom,!0,!0);r.Draggable&&(r.Draggable._disabled=!1)},this))}}:{});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,i=this._bgBuffer,t;n.style.visibility="";n.parentNode.appendChild(n);r.Util.falseFn(i.offsetWidth);t=this._map.getZoom();(t>this.options.maxZoom||t<this.options.minZoom)&&this._clearBgBuffer();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);if(n&&i>.5&&u<.5){t.style.visibility="hidden";this._stopLoadingImages(t);return}n.style.visibility="hidden";n.style[r.DomUtil.TRANSFORM]="";this._tileContainer=n;n=this._bgBuffer=t;this._stopLoadingImages(n);clearTimeout(this._clearBgBufferTimer)},_getLoadedTilesPercentage:function(n){for(var r=n.getElementsByTagName("img"),u=0,t=0,i=r.length;t<i;t++)r[t].complete&&u++;return u/i},_stopLoadingImages:function(n){for(var u=Array.prototype.slice.call(n.getElementsByTagName("img")),t,i=0,f=u.length;i<f;i++)t=u[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:Infinity,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||(t===1?"permission denied":t===2?"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)typeof n.coords[i]=="number"&&(e[i]=n.coords[i]);this.fire("locationfound",e)}})})(window,document);L.Control.HideMap=function(){return L.Control.extend({options:{position:"topright"},onAdd:function(n){return this._map=n,this._container=this.createZoomBtn(),this._container},createZoomBtn:function(){return button=L.DomUtil.create("a","leaflet-control-hide-display leaflet-bar-part leaflet-bar toggle-map cw-transinfo cw-hide-map on")}})}();L.Map.mergeOptions({HideMap:!0});L.Map.addInitHook(function(){if(cityWay.config.map.AddHideMap&&this.options.HideMap){this.HideMap=new L.Control.HideMap;this.addControl(this.HideMap);$(".toggle-map").attr("href","#");$(".toggle-map").on("click submit",function(){var n=$(this);return $.cookie(cityWay.consts.map.cookies.disabledMap,!n.hasClass("off"),{path:"/"}),window.location.href=window.location.href,$(".toggle-map").hasClass("off")?($(".toggle-map").removeClass("off"),$(".toggle-map").addClass("on")):($(".toggle-map").removeClass("on"),$(".toggle-map").addClass("off")),window.location.reload(!0),!1})}});L.control.HideMap=function(n){return new L.Control.HideMap(n)};L.Control.ChangeMap=function(){return L.Control.extend({options:{position:"topright"},onAdd:function(n){return this._map=n,this._container=this.createBtn(),this._container},createBtn:function(){var n=L.DomUtil.create("button","btn btn-default leaflet-control-layers leaflet-control change-map cw-transinfo cw-choose-map");return n.setAttribute("aria-label",cityWay.texts.map.Aria_select_map),n}})}();L.Map.mergeOptions({ChangeMap:!0});L.Map.addInitHook(function(){if(this.options.ChangeMap){this.ChangeMap=new L.Control.ChangeMap;this.addControl(this.ChangeMap);$(".change-map").on("mouseover focusin click",function(){var n=$(".select-map"),t=$(".change-map").offset(),u=$(window).scrollTop(),i,r;n.removeClass("hidden");i=n.width();r=document.mozFullScreen||document.webkitIsFullScreen;r&&n.css("z-index","2147483647");n.css("left",t.left-i+"px");n.css("top",t.top-u+"px")}).on("mouseout focusout",function(){$(".select-map").addClass("hidden")});$(".select-map").on("mouseover focusin",function(){$(this).removeClass("hidden")}).on("mouseout focusout",function(){$(this).addClass("hidden")});$("body").on("keydown",function(n){if(!$(".select-map").hasClass("hidden")){var i=n.keyCode||n.which,r=$(".select-map"),t=r.find(".active");i==cityWay.keys.upArrow&&(t.removeClass("active"),t.parent().prev().length==0?t.parent().siblings().last().children().addClass("active"):t.parent().prev().children().addClass("active"));i==cityWay.keys.downArrow&&(t.removeClass("active"),t.parent().next().length==0?t.parent().siblings().first().children().addClass("active"):t.parent().next().children().addClass("active"));i==cityWay.keys.enter&&r.find(".active").click();i==cityWay.keys.escape&&r.addClass("hidden");n.stopPropagation()}})}});L.control.ChangeMap=function(n){return new L.Control.ChangeMap(n)};L.Control.GeoLocation=function(){return L.Control.extend({options:{position:"topright"},onAdd:function(n){return this._map=n,this._container=this.createBtn(),this._container},createBtn:function(){return button=L.DomUtil.create("button","btn btn-default leaflet-control geoloc-map change-map geoloc-trigger cw-transinfo cw-map-geolocalisation hidden-lg hidden-md")}})}();L.Map.mergeOptions({GeoLocation:!0});L.Map.addInitHook(function(){if(this.options.HideMap){this.GeoLocation=new L.Control.GeoLocation;this.addControl(this.GeoLocation);$(".geoloc-map").on("click",function(){cityWay.page.map.geoLocationUser()})}});L.control.GeoLocation=function(n){return new L.Control.GeoLocation(n)};L.Control.ZoomDisplay=L.Control.extend({options:{position:"topright"},onAdd:function(n){this._map=n;this._container=L.DomUtil.create("div","leaflet-control-zoom-display leaflet-bar-part leaflet-bar");this.updateMapZoom(n.getZoom());n.on("zoomend",this.onMapZoomEnd,this);return this._container},onRemove:function(n){n.off("zoomend",this.onMapZoomEnd,this)},onMapZoomEnd:function(){this.updateMapZoom(this._map.getZoom())},updateMapZoom:function(n){this._container.innerHTML=n}});L.Map.mergeOptions({zoomDisplayControl:!0});L.Map.addInitHook(function(){this.options.zoomDisplayControl&&(this.zoomDisplayControl=new L.Control.ZoomDisplay,this.addControl(this.zoomDisplayControl))});L.control.zoomDisplay=function(n){return new L.Control.ZoomDisplay(n)};L.Control.Zoom=L.Control.extend({options:{position:"topright",zoomInText:"+",zoomInTitle:"Zoom in",zoomOutText:"-",zoomOutTitle:"Zoom out"},onAdd:function(n){var t="leaflet-control-zoom",i=L.DomUtil.create("div",t+" leaflet-bar");this._map=n;this._zoomInButton=this._createButton(this.options.zoomInText,cityWay.texts.map.Title_zoom_in,t+"-in",i,this._zoomIn,this);this._zoomInButton.setAttribute("role","button");this._zoomOutButton=this._createButton(this.options.zoomOutText,cityWay.texts.map.Title_zoom_out,t+"-out",i,this._zoomOut,this);this._zoomOutButton.setAttribute("role","button");this._updateDisabled();n.on("zoomend zoomlevelschange",this._updateDisabled,this);return 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,r,u,f){var e=L.DomUtil.create("a",i,r),o;e.innerHTML=n;e.href="#";e.title=t;o=L.DomEvent.stopPropagation;L.DomEvent.on(e,"click",o).on(e,"mousedown",o).on(e,"dblclick",o).on(e,"click",L.DomEvent.preventDefault).on(e,"click",u,f).on(e,"click",this._refocusOnMap,f);return e},_updateDisabled:function(){var n=this._map,t="leaflet-disabled";L.DomUtil.removeClass(this._zoomInButton,t);L.DomUtil.removeClass(this._zoomOutButton,t);n._zoom===n.getMinZoom()&&L.DomUtil.addClass(this._zoomOutButton,t);n._zoom===n.getMaxZoom()&&L.DomUtil.addClass(this._zoomInButton,t)}});L.Map.mergeOptions({zoomControl:!0});L.Map.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new L.Control.Zoom,this.addControl(this.zoomControl))});L.control.zoom=function(n){return new L.Control.Zoom(n)},function(){var n,i,t,r;if(L.Control.FullScreen=L.Control.extend({options:{position:"topright",title:"Full Screen",forceSeparateButton:!1,forcePseudoFullscreen:!1},onAdd:function(n){var t;return t=n.zoomControl&&!this.options.forceSeparateButton?n.zoomControl._container:L.DomUtil.create("div","leaflet-bar"),this._createButton(this.options.title,"leaflet-control-zoom-fullscreen cw-transinfo cw-map-full-screen",t,this.toogleFullScreen,n),t},_createButton:function(t,i,r,u,f){var e=L.DomUtil.create("a",i,r);return e.href="#",e.title=t,e.id="full-screen",L.DomEvent.addListener(e,"click",L.DomEvent.stopPropagation).addListener(e,"click",L.DomEvent.preventDefault).addListener(e,"click",u,f),L.DomEvent.addListener(r,n.fullScreenEventName,L.DomEvent.stopPropagation).addListener(r,n.fullScreenEventName,L.DomEvent.preventDefault).addListener(r,n.fullScreenEventName,this._handleEscKey,f),L.DomEvent.addListener(document,n.fullScreenEventName,L.DomEvent.stopPropagation).addListener(document,n.fullScreenEventName,L.DomEvent.preventDefault).addListener(document,n.fullScreenEventName,this._handleEscKey,f),e},toogleFullScreen:function(){this._exitFired=!1;var t=this._container;this._isFullscreen?(n.supportsFullScreen&&!this.options.forcePseudoFullscreen?n.cancelFullScreen(t):L.DomUtil.removeClass(t,"leaflet-pseudo-fullscreen"),this.invalidateSize(),this.fire("exitFullscreen"),this._exitFired=!0,this._isFullscreen=!1,$("#full-screen").attr("title",cityWay.texts.map.Label_FullScreen),$("#full-screen").removeClass("cw-map-full-screen-return"),$("#full-screen").addClass("cw-map-full-screen")):(n.supportsFullScreen&&!this.options.forcePseudoFullscreen?n.requestFullScreen(t):L.DomUtil.addClass(t,"leaflet-pseudo-fullscreen"),this.invalidateSize(),this.fire("enterFullscreen"),this._isFullscreen=!0,$("#full-screen").attr("title",cityWay.texts.map.Label_FullScreen_Return),$("#full-screen").removeClass("cw-map-full-screen"),$("#full-screen").addClass("cw-map-full-screen-return"))},_handleEscKey:function(){n.isFullScreen(this)||this._exitFired||(this.fire("exitFullscreen"),this._exitFired=!0,this._isFullscreen=!1)}}),L.Map.addInitHook(function(){this.options.fullscreenControl&&(this.fullscreenControl=L.control.fullscreen(this.options.fullscreenControlOptions),this.addControl(this.fullscreenControl))}),L.control.fullscreen=function(n){return new L.Control.FullScreen(n)},n={supportsFullScreen:!1,isFullScreen:function(){return!1},requestFullScreen:function(){},cancelFullScreen:function(){},fullScreenEventName:"",prefix:""},i="webkit moz o ms khtml".split(" "),typeof document.exitFullscreen!="undefined")n.supportsFullScreen=!0;else for(t=0,r=i.length;t<r;t++)if(n.prefix=i[t],typeof document[n.prefix+"CancelFullScreen"]!="undefined"){n.supportsFullScreen=!0;break}n.supportsFullScreen&&(n.fullScreenEventName=n.prefix+"fullscreenchange",n.isFullScreen=function(){switch(this.prefix){case"":return document.fullScreen;case"webkit":return document.webkitIsFullScreen;default:return document[this.prefix+"FullScreen"]}},n.requestFullScreen=function(n){return this.prefix===""?n.requestFullscreen():n[this.prefix+"RequestFullScreen"]()},n.cancelFullScreen=function(){return this.prefix===""?document.exitFullscreen():document[this.prefix+"CancelFullScreen"]()});typeof jQuery!="undefined"&&(jQuery.fn.requestFullScreen=function(){return this.each(function(){var t=jQuery(this);n.supportsFullScreen&&n.requestFullScreen(t)})});window.fullScreenApi=n}(),function(n,t){L.MarkerClusterGroup=L.FeatureGroup.extend({options:{maxClusterRadius:80,iconCreateFunction:null,spiderfyOnMaxZoom:!0,showCoverageOnHover:!0,zoomToBoundsOnClick:!0,singleMarkerMode:!1,disableClusteringAtZoom:null,removeOutsideVisibleBounds:!0,animateAddingMarkers:!1,spiderfyDistanceMultiplier:1,chunkedLoading:!1,chunkInterval:200,chunkDelay:50,chunkProgress:null,polygonOptions:{}},initialize:function(n){L.Util.setOptions(this,n);this.options.iconCreateFunction||(this.options.iconCreateFunction=this._defaultIconCreateFunction);this._featureGroup=L.featureGroup();this._featureGroup.on(L.FeatureGroup.EVENTS,this._propagateEvent,this);this._nonPointGroup=L.featureGroup();this._nonPointGroup.on(L.FeatureGroup.EVENTS,this._propagateEvent,this);this._inZoomAnimation=0;this._needsClustering=[];this._needsRemoving=[];this._currentShownBounds=null;this._queue=[]},addLayer:function(n){var i,r,t,u;if(n instanceof L.LayerGroup){i=[];for(r in n._layers)i.push(n._layers[r]);return this.addLayers(i)}if(!n.getLatLng)return this._nonPointGroup.addLayer(n),this;if(!this._map)return this._needsClustering.push(n),this;if(this.hasLayer(n))return this;if(this._unspiderfy&&this._unspiderfy(),this._addLayer(n,this._maxZoom),t=n,u=this._map.getZoom(),n.__parent)while(t.__parent._zoom>=u)t=t.__parent;return this._currentShownBounds.contains(t.getLatLng())&&(this.options.animateAddingMarkers?this._animationAddLayer(n,t):this._animationAddLayerNonAnimated(n,t)),this},removeLayer:function(n){var t,i;if(n instanceof L.LayerGroup){t=[];for(i in n._layers)t.push(n._layers[i]);return this.removeLayers(t)}return n.getLatLng?this._map?n.__parent?(this._unspiderfy&&(this._unspiderfy(),this._unspiderfyLayer(n)),this._removeLayer(n,!0),this._featureGroup.hasLayer(n)&&(this._featureGroup.removeLayer(n),n.setOpacity&&n.setOpacity(1)),this):this:(!this._arraySplice(this._needsClustering,n)&&this.hasLayer(n)&&this._needsRemoving.push(n),this):(this._nonPointGroup.removeLayer(n),this)},addLayers:function(n){var h=this._featureGroup,f=this._nonPointGroup,c=this.options.chunkedLoading,l=this.options.chunkInterval,e=this.options.chunkProgress,u,r,o,t;if(this._map){var i=0,a=(new Date).getTime(),s=L.bind(function(){for(var v=(new Date).getTime(),u,r,o;i<n.length;i++){if(c&&i%200==0&&(u=(new Date).getTime()-v,u>l))break;if(t=n[i],!t.getLatLng){f.addLayer(t);continue}this.hasLayer(t)||(this._addLayer(t,this._maxZoom),t.__parent&&t.__parent.getChildCount()===2&&(r=t.__parent.getAllChildMarkers(),o=r[0]===t?r[1]:r[0],h.removeLayer(o)))}e&&e(i,n.length,(new Date).getTime()-a);i===n.length?(this._featureGroup.eachLayer(function(n){n instanceof L.MarkerCluster&&n._iconNeedsUpdate&&n._updateIcon()}),this._topClusterLevel._recursivelyAddChildrenToMap(null,this._zoom,this._currentShownBounds)):setTimeout(s,this.options.chunkDelay)},this);s()}else{for(u=[],r=0,o=n.length;r<o;r++){if(t=n[r],!t.getLatLng){f.addLayer(t);continue}this.hasLayer(t)||u.push(t)}this._needsClustering=this._needsClustering.concat(u)}return this},removeLayers:function(n){var i,r,t,u=this._featureGroup,f=this._nonPointGroup;if(!this._map){for(i=0,r=n.length;i<r;i++)t=n[i],this._arraySplice(this._needsClustering,t),f.removeLayer(t);return this}for(i=0,r=n.length;i<r;i++){if(t=n[i],!t.__parent){f.removeLayer(t);continue}this._removeLayer(t,!0,!0);u.hasLayer(t)&&(u.removeLayer(t),t.setOpacity&&t.setOpacity(1))}return this._topClusterLevel._recursivelyAddChildrenToMap(null,this._zoom,this._currentShownBounds),u.eachLayer(function(n){n instanceof L.MarkerCluster&&n._updateIcon()}),this},clearLayers:function(){return this._map||(this._needsClustering=[],delete this._gridClusters,delete this._gridUnclustered),this._noanimationUnspiderfy&&this._noanimationUnspiderfy(),this._featureGroup.clearLayers(),this._nonPointGroup.clearLayers(),this.eachLayer(function(n){delete n.__parent}),this._map&&this._generateInitialClusters(),this},getBounds:function(){var n=new L.LatLngBounds,t;for(this._topClusterLevel&&n.extend(this._topClusterLevel._bounds),t=this._needsClustering.length-1;t>=0;t--)n.extend(this._needsClustering[t].getLatLng());return n.extend(this._nonPointGroup.getBounds()),n},eachLayer:function(n,t){var r=this._needsClustering.slice(),i;for(this._topClusterLevel&&this._topClusterLevel.getAllChildMarkers(r),i=r.length-1;i>=0;i--)n.call(t,r[i]);this._nonPointGroup.eachLayer(n,t)},getLayers:function(){var n=[];return this.eachLayer(function(t){n.push(t)}),n},getLayer:function(n){var t=null;return this.eachLayer(function(i){L.stamp(i)===n&&(t=i)}),t},hasLayer:function(n){if(!n)return!1;for(var i=this._needsClustering,t=i.length-1;t>=0;t--)if(i[t]===n)return!0;for(i=this._needsRemoving,t=i.length-1;t>=0;t--)if(i[t]===n)return!1;return!!(n.__parent&&n.__parent._group===this)||this._nonPointGroup.hasLayer(n)},zoomToShowLayer:function(n,t){var i=function(){if((n._icon||n.__parent._icon)&&!this._inZoomAnimation)if(this._map.off("moveend",i,this),this.off("animationend",i,this),n._icon)t();else if(n.__parent._icon){var r=function(){this.off("spiderfied",r,this);t()};this.on("spiderfied",r,this);n.__parent.spiderfy()}},r;if(n._icon&&this._map.getBounds().contains(n.getLatLng()))t();else if(n.__parent._zoom<this._map.getZoom()){this._map.on("moveend",i,this);this._map.panTo(n.getLatLng())}else{r=function(){this._map.off("movestart",r,this);r=null};this._map.on("movestart",r,this);this._map.on("moveend",i,this);this.on("animationend",i,this);n.__parent.zoomToBounds();r&&i.call(this)}},onAdd:function(n){this._map=n;var t,i,r;if(!isFinite(this._map.getMaxZoom()))throw"Map has no maxZoom specified";this._featureGroup.onAdd(n);this._nonPointGroup.onAdd(n);for(this._gridClusters||this._generateInitialClusters(),t=0,i=this._needsRemoving.length;t<i;t++)r=this._needsRemoving[t],this._removeLayer(r,!0);this._needsRemoving=[];this._zoom=this._map.getZoom();this._currentShownBounds=this._getExpandedVisibleBounds();this._map.on("zoomend",this._zoomEnd,this);this._map.on("moveend",this._moveEnd,this);this._spiderfierOnAdd&&this._spiderfierOnAdd();this._bindEvents();i=this._needsClustering;this._needsClustering=[];this.addLayers(i)},onRemove:function(n){n.off("zoomend",this._zoomEnd,this);n.off("moveend",this._moveEnd,this);this._unbindEvents();this._map._mapPane.className=this._map._mapPane.className.replace(" leaflet-cluster-anim","");this._spiderfierOnRemove&&this._spiderfierOnRemove();this._hideCoverage();this._featureGroup.onRemove(n);this._nonPointGroup.onRemove(n);this._featureGroup.clearLayers();this._map=null},getVisibleParent:function(n){for(var t=n;t&&!t._icon;)t=t.__parent;return t||null},_arraySplice:function(n,t){for(var i=n.length-1;i>=0;i--)if(n[i]===t)return n.splice(i,1),!0},_removeLayer:function(n,t,i){var c=this._gridClusters,o=this._gridUnclustered,s=this._featureGroup,e=this._map,f,r,h,u;if(t)for(f=this._maxZoom;f>=0;f--)if(!o[f].removeObject(n,e.project(n.getLatLng(),f)))break;for(r=n.__parent,h=r._markers,this._arraySplice(h,n);r;){if(r._childCount--,r._zoom<0)break;else t&&r._childCount<=1?(u=r._markers[0]===n?r._markers[1]:r._markers[0],c[r._zoom].removeObject(r,e.project(r._cLatLng,r._zoom)),o[r._zoom].addObject(u,e.project(u.getLatLng(),r._zoom)),this._arraySplice(r.__parent._childClusters,r),r.__parent._markers.push(u),u.__parent=r.__parent,r._icon&&(s.removeLayer(r),i||s.addLayer(u))):(r._recalculateBounds(),i&&r._icon||r._updateIcon());r=r.__parent}delete n.__parent},_isOrIsParent:function(n,t){while(t){if(n===t)return!0;t=t.parentNode}return!1},_propagateEvent:function(n){if(n.layer instanceof L.MarkerCluster){if(n.originalEvent&&this._isOrIsParent(n.layer._icon,n.originalEvent.relatedTarget))return;n.type="cluster"+n.type}this.fire(n.type,n)},_defaultIconCreateFunction:function(n){var t=n.getChildCount(),i=" marker-cluster-";return i+=t<10?"small":t<100?"medium":"large",new L.DivIcon({html:"<div><span>"+t+"<\/span><\/div>",className:"marker-cluster"+i,iconSize:new L.Point(40,40)})},_bindEvents:function(){var n=this._map,t=this.options.spiderfyOnMaxZoom,i=this.options.showCoverageOnHover,r=this.options.zoomToBoundsOnClick;if(t||r)this.on("clusterclick",this._zoomOrSpiderfy,this);if(i){this.on("clustermouseover",this._showCoverage,this);this.on("clustermouseout",this._hideCoverage,this);n.on("zoomend",this._hideCoverage,this)}},_zoomOrSpiderfy:function(n){var t=this._map;t.getMaxZoom()===t.getZoom()?this.options.spiderfyOnMaxZoom&&n.layer.spiderfy():this.options.zoomToBoundsOnClick&&n.layer.zoomToBounds();n.originalEvent&&n.originalEvent.keyCode===13&&t._container.focus()},_showCoverage:function(n){var t=this._map;this._inZoomAnimation||(this._shownPolygon&&t.removeLayer(this._shownPolygon),n.layer.getChildCount()>2&&n.layer!==this._spiderfied&&(this._shownPolygon=new L.Polygon(n.layer.getConvexHull(),this.options.polygonOptions),t.addLayer(this._shownPolygon)))},_hideCoverage:function(){this._shownPolygon&&(this._map.removeLayer(this._shownPolygon),this._shownPolygon=null)},_unbindEvents:function(){var n=this.options.spiderfyOnMaxZoom,t=this.options.showCoverageOnHover,i=this.options.zoomToBoundsOnClick,r=this._map;(n||i)&&this.off("clusterclick",this._zoomOrSpiderfy,this);t&&(this.off("clustermouseover",this._showCoverage,this),this.off("clustermouseout",this._hideCoverage,this),r.off("zoomend",this._hideCoverage,this))},_zoomEnd:function(){this._map&&(this._mergeSplitClusters(),this._zoom=this._map._zoom,this._currentShownBounds=this._getExpandedVisibleBounds())},_moveEnd:function(){if(!this._inZoomAnimation){var n=this._getExpandedVisibleBounds();this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,this._zoom,n);this._topClusterLevel._recursivelyAddChildrenToMap(null,this._map._zoom,n);this._currentShownBounds=n;return}},_generateInitialClusters:function(){var t=this._map.getMaxZoom(),i=this.options.maxClusterRadius,r=i,n;for(typeof i!="function"&&(r=function(){return i}),this.options.disableClusteringAtZoom&&(t=this.options.disableClusteringAtZoom-1),this._maxZoom=t,this._gridClusters={},this._gridUnclustered={},n=t;n>=0;n--)this._gridClusters[n]=new L.DistanceGrid(r(n)),this._gridUnclustered[n]=new L.DistanceGrid(r(n));this._topClusterLevel=new L.MarkerCluster(this,-1)},_addLayer:function(n,t){var s=this._gridClusters,h=this._gridUnclustered,e,r,i,o,u,f;for(this.options.singleMarkerMode&&(n.options.icon=this.options.iconCreateFunction({getChildCount:function(){return 1},getAllChildMarkers:function(){return[n]}}));t>=0;t--){if(e=this._map.project(n.getLatLng(),t),i=s[t].getNearObject(e),i){i._addChild(n);n.__parent=i;return}if(i=h[t].getNearObject(e),i){for(o=i.__parent,o&&this._removeLayer(i,!1),u=new L.MarkerCluster(this,t,i,n),s[t].addObject(u,this._map.project(u._cLatLng,t)),i.__parent=u,n.__parent=u,f=u,r=t-1;r>o._zoom;r--)f=new L.MarkerCluster(this,r,f),s[r].addObject(f,this._map.project(i.getLatLng(),r));for(o._addChild(f),r=t;r>=0;r--)if(!h[r].removeObject(i,this._map.project(i.getLatLng(),r)))break;return}h[t].addObject(n,e)}this._topClusterLevel._addChild(n);n.__parent=this._topClusterLevel;return},_enqueue:function(n){this._queue.push(n);this._queueTimeout||(this._queueTimeout=setTimeout(L.bind(this._processQueue,this),300))},_processQueue:function(){for(var n=0;n<this._queue.length;n++)this._queue[n].call(this);this._queue.length=0;clearTimeout(this._queueTimeout);this._queueTimeout=null},_mergeSplitClusters:function(){this._processQueue();this._zoom<this._map._zoom&&this._currentShownBounds.intersects(this._getExpandedVisibleBounds())?(this._animationStart(),this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,this._zoom,this._getExpandedVisibleBounds()),this._animationZoomIn(this._zoom,this._map._zoom)):this._zoom>this._map._zoom?(this._animationStart(),this._animationZoomOut(this._zoom,this._map._zoom)):this._moveEnd()},_getExpandedVisibleBounds:function(){if(!this.options.removeOutsideVisibleBounds)return this.getBounds();var f=this._map,i=f.getBounds(),n=i._southWest,t=i._northEast,r=L.Browser.mobile?0:Math.abs(n.lat-t.lat),u=L.Browser.mobile?0:Math.abs(n.lng-t.lng);return new L.LatLngBounds(new L.LatLng(n.lat-r,n.lng-u,!0),new L.LatLng(t.lat+r,t.lng+u,!0))},_animationAddLayerNonAnimated:function(n,t){if(t===n)this._featureGroup.addLayer(n);else if(t._childCount===2){t._addToMap();var i=t.getAllChildMarkers();this._featureGroup.removeLayer(i[0]);this._featureGroup.removeLayer(i[1])}else t._updateIcon()}});L.MarkerClusterGroup.include(L.DomUtil.TRANSITION?{_animationStart:function(){this._map._mapPane.className+=" leaflet-cluster-anim";this._inZoomAnimation++},_animationEnd:function(){this._map&&(this._map._mapPane.className=this._map._mapPane.className.replace(" leaflet-cluster-anim",""));this._inZoomAnimation--;this.fire("animationend")},_animationZoomIn:function(n,t){var i=this._getExpandedVisibleBounds(),r=this._featureGroup,u;this._topClusterLevel._recursively(i,n,0,function(f){var e=f._latlng,s=f._markers,o;for(i.contains(e)||(e=null),f._isSingleParent()&&n+1===t?(r.removeLayer(f),f._recursivelyAddChildrenToMap(null,t,i)):(f.setOpacity(0),f._recursivelyAddChildrenToMap(e,t,i)),u=s.length-1;u>=0;u--)o=s[u],i.contains(o._latlng)||r.removeLayer(o)});this._forceLayout();this._topClusterLevel._recursivelyBecomeVisible(i,t);r.eachLayer(function(n){n instanceof L.MarkerCluster||!n._icon||n.setOpacity(1)});this._topClusterLevel._recursively(i,n,t,function(n){n._recursivelyRestoreChildPositions(t)});this._enqueue(function(){this._topClusterLevel._recursively(i,n,0,function(n){r.removeLayer(n);n.setOpacity(1)});this._animationEnd()})},_animationZoomOut:function(n,t){this._animationZoomOutSingle(this._topClusterLevel,n-1,t);this._topClusterLevel._recursivelyAddChildrenToMap(null,t,this._getExpandedVisibleBounds());this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,n,this._getExpandedVisibleBounds())},_animationZoomOutSingle:function(n,t,i){var r=this._getExpandedVisibleBounds(),u;n._recursivelyAnimateChildrenInAndAddSelfToMap(r,t+1,i);u=this;this._forceLayout();n._recursivelyBecomeVisible(r,i);this._enqueue(function(){if(n._childCount===1){var f=n._markers[0];f.setLatLng(f.getLatLng());f.setOpacity&&f.setOpacity(1)}else n._recursively(r,i,0,function(n){n._recursivelyRemoveChildrenFromMap(r,t+1)});u._animationEnd()})},_animationAddLayer:function(n,t){var i=this,r=this._featureGroup;r.addLayer(n);t!==n&&(t._childCount>2?(t._updateIcon(),this._forceLayout(),this._animationStart(),n._setPos(this._map.latLngToLayerPoint(t.getLatLng())),n.setOpacity(0),this._enqueue(function(){r.removeLayer(n);n.setOpacity(1);i._animationEnd()})):(this._forceLayout(),i._animationStart(),i._animationZoomOutSingle(t,this._map.getMaxZoom(),this._map.getZoom())))},_forceLayout:function(){L.Util.falseFn(t.body.offsetWidth)}}:{_animationStart:function(){},_animationZoomIn:function(n,t){this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,n);this._topClusterLevel._recursivelyAddChildrenToMap(null,t,this._getExpandedVisibleBounds());this.fire("animationend")},_animationZoomOut:function(n,t){this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,n);this._topClusterLevel._recursivelyAddChildrenToMap(null,t,this._getExpandedVisibleBounds());this.fire("animationend")},_animationAddLayer:function(n,t){this._animationAddLayerNonAnimated(n,t)}});L.markerClusterGroup=function(n){return new L.MarkerClusterGroup(n)};L.MarkerCluster=L.Marker.extend({initialize:function(n,t,i,r){L.Marker.prototype.initialize.call(this,i?i._cLatLng||i.getLatLng():new L.LatLng(0,0),{icon:this});this._group=n;this._zoom=t;this._markers=[];this._childClusters=[];this._childCount=0;this._iconNeedsUpdate=!0;this._bounds=new L.LatLngBounds;i&&this._addChild(i);r&&this._addChild(r)},getAllChildMarkers:function(n){var t,i;for(n=n||[],t=this._childClusters.length-1;t>=0;t--)this._childClusters[t].getAllChildMarkers(n);for(i=this._markers.length-1;i>=0;i--)n.push(this._markers[i]);return n},getChildCount:function(){return this._childCount},zoomToBounds:function(){for(var n=this._childClusters.slice(),f=this._group._map,u=f.getBoundsZoom(this._bounds),t=this._zoom+1,e=f.getZoom(),i,r;n.length>0&&u>t;){for(t++,r=[],i=0;i<n.length;i++)r=r.concat(n[i]._childClusters);n=r}u>t?this._group._map.setView(this._latlng,t):u<=e?this._group._map.setView(this._latlng,e+1):this._group._map.fitBounds(this._bounds)},getBounds:function(){var n=new L.LatLngBounds;return n.extend(this._bounds),n},_updateIcon:function(){this._iconNeedsUpdate=!0;this._icon&&this.setIcon(this)},createIcon:function(){return this._iconNeedsUpdate&&(this._iconObj=this._group.options.iconCreateFunction(this),this._iconNeedsUpdate=!1),this._iconObj.createIcon()},createShadow:function(){return this._iconObj.createShadow()},_addChild:function(n,t){this._iconNeedsUpdate=!0;this._expandBounds(n);n instanceof L.MarkerCluster?(t||(this._childClusters.push(n),n.__parent=this),this._childCount+=n._childCount):(t||this._markers.push(n),this._childCount++);this.__parent&&this.__parent._addChild(n,!0)},_expandBounds:function(n){var i,t=n._wLatLng||n._latlng,r;n instanceof L.MarkerCluster?(this._bounds.extend(n._bounds),i=n._childCount):(this._bounds.extend(t),i=1);this._cLatLng||(this._cLatLng=n._cLatLng||t);r=this._childCount+i;this._wLatLng?(this._wLatLng.lat=(t.lat*i+this._wLatLng.lat*this._childCount)/r,this._wLatLng.lng=(t.lng*i+this._wLatLng.lng*this._childCount)/r):this._latlng=this._wLatLng=new L.LatLng(t.lat,t.lng)},_addToMap:function(n){n&&(this._backupLatlng=this._latlng,this.setLatLng(n));this._group._featureGroup.addLayer(this)},_recursivelyAnimateChildrenIn:function(n,t,i){this._recursively(n,0,i-1,function(n){for(var u=n._markers,r,i=u.length-1;i>=0;i--)r=u[i],r._icon&&(r._setPos(t),r.setOpacity(0))},function(n){for(var u=n._childClusters,r,i=u.length-1;i>=0;i--)r=u[i],r._icon&&(r._setPos(t),r.setOpacity(0))})},_recursivelyAnimateChildrenInAndAddSelfToMap:function(n,t,i){this._recursively(n,i,0,function(r){r._recursivelyAnimateChildrenIn(n,r._group._map.latLngToLayerPoint(r.getLatLng()).round(),t);r._isSingleParent()&&t-1===i?(r.setOpacity(1),r._recursivelyRemoveChildrenFromMap(n,t)):r.setOpacity(0);r._addToMap()})},_recursivelyBecomeVisible:function(n,t){this._recursively(n,0,t,null,function(n){n.setOpacity(1)})},_recursivelyAddChildrenToMap:function(n,t,i){this._recursively(i,-1,t,function(r){var f,u;if(t!==r._zoom)for(f=r._markers.length-1;f>=0;f--)(u=r._markers[f],i.contains(u._latlng))&&(n&&(u._backupLatlng=u.getLatLng(),u.setLatLng(n),u.setOpacity&&u.setOpacity(0)),r._group._featureGroup.addLayer(u))},function(t){t._addToMap(n)})},_recursivelyRestoreChildPositions:function(n){for(var t,r,u,i=this._markers.length-1;i>=0;i--)t=this._markers[i],t._backupLatlng&&(t.setLatLng(t._backupLatlng),delete t._backupLatlng);if(n-1===this._zoom)for(r=this._childClusters.length-1;r>=0;r--)this._childClusters[r]._restorePosition();else for(u=this._childClusters.length-1;u>=0;u--)this._childClusters[u]._recursivelyRestoreChildPositions(n)},_restorePosition:function(){this._backupLatlng&&(this.setLatLng(this._backupLatlng),delete this._backupLatlng)},_recursivelyRemoveChildrenFromMap:function(n,t,i){var r,u;this._recursively(n,-1,t-1,function(n){for(u=n._markers.length-1;u>=0;u--)r=n._markers[u],i&&i.contains(r._latlng)||(n._group._featureGroup.removeLayer(r),r.setOpacity&&r.setOpacity(1))},function(n){for(u=n._childClusters.length-1;u>=0;u--)r=n._childClusters[u],i&&i.contains(r._latlng)||(n._group._featureGroup.removeLayer(r),r.setOpacity&&r.setOpacity(1))})},_recursively:function(n,t,i,r,u){var o=this._childClusters,s=this._zoom,f,e;if(t>s)for(f=o.length-1;f>=0;f--)e=o[f],n.intersects(e._bounds)&&e._recursively(n,t,i,r,u);else if(r&&r(this),u&&this._zoom===i&&u(this),i>s)for(f=o.length-1;f>=0;f--)e=o[f],n.intersects(e._bounds)&&e._recursively(n,t,i,r,u)},_recalculateBounds:function(){var t=this._markers,i=this._childClusters,n;for(this._bounds=new L.LatLngBounds,delete this._wLatLng,n=t.length-1;n>=0;n--)this._expandBounds(t[n]);for(n=i.length-1;n>=0;n--)this._expandBounds(i[n])},_isSingleParent:function(){return this._childClusters.length>0&&this._childClusters[0]._childCount===this._childCount}});L.DistanceGrid=function(n){this._cellSize=n;this._sqCellSize=n*n;this._grid={};this._objectPoint={}};L.DistanceGrid.prototype={addObject:function(n,t){var i=this._getCoord(t.x),r=this._getCoord(t.y),u=this._grid,f=u[r]=u[r]||{},e=f[i]=f[i]||[],o=L.Util.stamp(n);this._objectPoint[o]=t;e.push(n)},updateObject:function(n,t){this.removeObject(n);this.addObject(n,t)},removeObject:function(n,t){var r=this._getCoord(t.x),o=this._getCoord(t.y),s=this._grid,u=s[o]=s[o]||{},f=u[r]=u[r]||[],i,e;for(delete this._objectPoint[L.Util.stamp(n)],i=0,e=f.length;i<e;i++)if(f[i]===n)return f.splice(i,1),e===1&&delete u[r],!0},eachObject:function(n,t){var e,o,i,r,u,f,s,h=this._grid;for(e in h){u=h[e];for(o in u)for(f=u[o],i=0,r=f.length;i<r;i++)s=n.call(t,f[i]),s&&(i--,r--)}},getNearObject:function(n){for(var s=this._getCoord(n.x),h=this._getCoord(n.y),i,r,f,u,c,e,o,v=this._objectPoint,l=this._sqCellSize,a=null,t=h-1;t<=h+1;t++)if(f=this._grid[t],f)for(i=s-1;i<=s+1;i++)if(u=f[i],u)for(r=0,c=u.length;r<c;r++)e=u[r],o=this._sqDist(v[L.Util.stamp(e)],n),o<l&&(l=o,a=e);return a},_getCoord:function(n){return Math.floor(n/this._cellSize)},_sqDist:function(n,t){var i=t.x-n.x,r=t.y-n.y;return i*i+r*r}},function(){L.QuickHull={getDistant:function(n,t){var i=t[1].lat-t[0].lat,r=t[0].lng-t[1].lng;return r*(n.lat-t[0].lat)+i*(n.lng-t[0].lng)},findMostDistantPointFromBaseLine:function(n,t){for(var f=0,e=null,o=[],r,u,i=t.length-1;i>=0;i--){if(r=t[i],u=this.getDistant(r,n),u>0)o.push(r);else continue;u>f&&(f=u,e=r)}return{maxPoint:e,newPoints:o}},buildConvexHull:function(n,t){var r=[],i=this.findMostDistantPointFromBaseLine(n,t);return i.maxPoint?(r=r.concat(this.buildConvexHull([n[0],i.maxPoint],i.newPoints)),r.concat(this.buildConvexHull([i.maxPoint,n[1]],i.newPoints))):[n[0]]},getConvexHull:function(n){for(var r=!1,u=!1,f=null,e=null,t,i=n.length-1;i>=0;i--)t=n[i],(r===!1||t.lat>r)&&(f=t,r=t.lat),(u===!1||t.lat<u)&&(e=t,u=t.lat);return[].concat(this.buildConvexHull([e,f],n),this.buildConvexHull([f,e],n))}}}();L.MarkerCluster.include({getConvexHull:function(){for(var t=this.getAllChildMarkers(),i=[],r,n=t.length-1;n>=0;n--)r=t[n].getLatLng(),i.push(r);return L.QuickHull.getConvexHull(i)}});L.MarkerCluster.include({_2PI:Math.PI*2,_circleFootSeparation:25,_circleStartAngle:Math.PI/6,_spiralFootSeparation:28,_spiralLengthStart:11,_spiralLengthFactor:5,_circleSpiralSwitchover:9,spiderfy:function(){if(this._group._spiderfied!==this&&!this._group._inZoomAnimation){var n=this.getAllChildMarkers(),r=this._group,u=r._map,t=u.latLngToLayerPoint(this._latlng),i;this._group._unspiderfy();this._group._spiderfied=this;n.length>=this._circleSpiralSwitchover?i=this._generatePointsSpiral(n.length,t):(t.y+=10,i=this._generatePointsCircle(n.length,t));this._animationSpiderfy(n,i)}},unspiderfy:function(n){this._group._inZoomAnimation||(this._animationUnspiderfy(n),this._group._spiderfied=null)},_generatePointsCircle:function(n,t){var e=this._group.options.spiderfyDistanceMultiplier*this._circleFootSeparation*(2+n),f=e/this._2PI,o=this._2PI/n,r=[],i,u;for(r.length=n,i=n-1;i>=0;i--)u=this._circleStartAngle+i*o,r[i]=new L.Point(t.x+f*Math.cos(u),t.y+f*Math.sin(u))._round();return r},_generatePointsSpiral:function(n,t){var r=this._group.options.spiderfyDistanceMultiplier*this._spiralLengthStart,e=this._group.options.spiderfyDistanceMultiplier*this._spiralFootSeparation,o=this._group.options.spiderfyDistanceMultiplier*this._spiralLengthFactor,u=0,f=[],i;for(f.length=n,i=n-1;i>=0;i--)u+=e/r+i*.0005,f[i]=new L.Point(t.x+r*Math.cos(u),t.y+r*Math.sin(u))._round(),r+=this._2PI*o/u;return f},_noanimationUnspiderfy:function(){var i=this._group,u=i._map,f=i._featureGroup,r=this.getAllChildMarkers(),n,t;for(this.setOpacity(1),t=r.length-1;t>=0;t--)n=r[t],f.removeLayer(n),n._preSpiderfyLatlng&&(n.setLatLng(n._preSpiderfyLatlng),delete n._preSpiderfyLatlng),n.setZIndexOffset&&n.setZIndexOffset(0),n._spiderLeg&&(u.removeLayer(n._spiderLeg),delete n._spiderLeg);i._spiderfied=null}});L.MarkerCluster.include(L.DomUtil.TRANSITION?{SVG_ANIMATION:function(){return t.createElementNS("http://www.w3.org/2000/svg","animate").toString().indexOf("SVGAnimate")>-1}(),_animationSpiderfy:function(n,i){for(var a=this,o=this._group,h=o._map,v=o._featureGroup,p=h.latLngToLayerPoint(this._latlng),r,e,c,y,l,s,u,f=n.length-1;f>=0;f--)r=n[f],r.setOpacity?(r.setZIndexOffset(1e6),r.setOpacity(0),v.addLayer(r),r._setPos(p)):v.addLayer(r);for(o._forceLayout(),o._animationStart(),y=L.Path.SVG?0:.3,l=L.Path.SVG_NS,f=n.length-1;f>=0;f--)(c=h.layerPointToLatLng(i[f]),r=n[f],r._preSpiderfyLatlng=r._latlng,r.setLatLng(c),r.setOpacity&&r.setOpacity(1),e=new L.Polyline([a._latlng,c],{weight:1.5,color:"#222",opacity:y}),h.addLayer(e),r._spiderLeg=e,L.Path.SVG&&this.SVG_ANIMATION)&&(s=e._path.getTotalLength(),e._path.setAttribute("stroke-dasharray",s+","+s),u=t.createElementNS(l,"animate"),u.setAttribute("attributeName","stroke-dashoffset"),u.setAttribute("begin","indefinite"),u.setAttribute("from",s),u.setAttribute("to",0),u.setAttribute("dur",.25),e._path.appendChild(u),u.beginElement(),u=t.createElementNS(l,"animate"),u.setAttribute("attributeName","stroke-opacity"),u.setAttribute("attributeName","stroke-opacity"),u.setAttribute("begin","indefinite"),u.setAttribute("from",0),u.setAttribute("to",.5),u.setAttribute("dur",.25),e._path.appendChild(u),u.beginElement());if(a.setOpacity(.3),L.Path.SVG)for(this._group._forceLayout(),f=n.length-1;f>=0;f--)r=n[f]._spiderLeg,r.options.opacity=.5,r._path.setAttribute("stroke-opacity",.5);setTimeout(function(){o._animationEnd();o.fire("spiderfied")},200)},_animationUnspiderfy:function(n){var f=this._group,e=f._map,o=f._featureGroup,s=n?e._latLngToNewLayerPoint(this._latlng,n.zoom,n.center):e.latLngToLayerPoint(this._latlng),u=this.getAllChildMarkers(),h=L.Path.SVG&&this.SVG_ANIMATION,t,i,r;for(f._animationStart(),this.setOpacity(1),i=u.length-1;i>=0;i--)(t=u[i],t._preSpiderfyLatlng)&&(t.setLatLng(t._preSpiderfyLatlng),delete t._preSpiderfyLatlng,t.setOpacity?(t._setPos(s),t.setOpacity(0)):o.removeLayer(t),h&&(r=t._spiderLeg._path.childNodes[0],r.setAttribute("to",r.getAttribute("from")),r.setAttribute("from",0),r.beginElement(),r=t._spiderLeg._path.childNodes[1],r.setAttribute("from",.5),r.setAttribute("to",0),r.setAttribute("stroke-opacity",0),r.beginElement(),t._spiderLeg._path.setAttribute("stroke-opacity",0)));setTimeout(function(){var n=0;for(i=u.length-1;i>=0;i--)t=u[i],t._spiderLeg&&n++;for(i=u.length-1;i>=0;i--)(t=u[i],t._spiderLeg)&&(t.setOpacity&&(t.setOpacity(1),t.setZIndexOffset(0)),n>1&&o.removeLayer(t),e.removeLayer(t._spiderLeg),delete t._spiderLeg);f._animationEnd()},200)}}:{_animationSpiderfy:function(n,t){for(var u=this._group,o=u._map,s=u._featureGroup,i,f,e,r=n.length-1;r>=0;r--)e=o.layerPointToLatLng(t[r]),i=n[r],i._preSpiderfyLatlng=i._latlng,i.setLatLng(e),i.setZIndexOffset&&i.setZIndexOffset(1e6),s.addLayer(i),f=new L.Polyline([this._latlng,e],{weight:1.5,color:"#222"}),o.addLayer(f),i._spiderLeg=f;this.setOpacity(.3);u.fire("spiderfied")},_animationUnspiderfy:function(){this._noanimationUnspiderfy()}});L.MarkerClusterGroup.include({_spiderfied:null,_spiderfierOnAdd:function(){this._map.on("click",this._unspiderfyWrapper,this);if(this._map.options.zoomAnimation)this._map.on("zoomstart",this._unspiderfyZoomStart,this);this._map.on("zoomend",this._noanimationUnspiderfy,this);L.Path.SVG&&!L.Browser.touch&&this._map._initPathRoot()},_spiderfierOnRemove:function(){this._map.off("click",this._unspiderfyWrapper,this);this._map.off("zoomstart",this._unspiderfyZoomStart,this);this._map.off("zoomanim",this._unspiderfyZoomAnim,this);this._unspiderfy()},_unspiderfyZoomStart:function(){if(this._map)this._map.on("zoomanim",this._unspiderfyZoomAnim,this)},_unspiderfyZoomAnim:function(n){L.DomUtil.hasClass(this._map._mapPane,"leaflet-touching")||(this._map.off("zoomanim",this._unspiderfyZoomAnim,this),this._unspiderfy(n))},_unspiderfyWrapper:function(){this._unspiderfy()},_unspiderfy:function(n){this._spiderfied&&this._spiderfied.unspiderfy(n)},_noanimationUnspiderfy:function(){this._spiderfied&&this._spiderfied._noanimationUnspiderfy()},_unspiderfyLayer:function(n){n._spiderLeg&&(this._featureGroup.removeLayer(n),n.setOpacity(1),n.setZIndexOffset(0),this._map.removeLayer(n._spiderLeg),delete n._spiderLeg)}})}(window,document);L.KML=L.FeatureGroup.extend({options:{async:!0},initialize:function(n,t){L.Util.setOptions(this,t);this._kml=n;this._layers={};n&&this.addKML(n,t,this.options.async)},loadXML:function(n,t,i,r){r==undefined&&(r=this.options.async);i==undefined&&(i=this.options);$.ajax(n,{type:"GET",headers:{wlCode:sessionStorage.getItem("wlCode")},dataType:"xml",async:r}).then(function(n){n&&t(n,i)})},addKML:function(n,t,i){var r=this,u=function(n,t){r._addKML(n,t)};this.loadXML(n,u,t,i)},_addKML:function(n){var t=L.KML.parseKML(n),i;if(t&&t.length){for(i=0;i<t.length;i++)this.fire("addlayer",{layer:t[i]}),this.addLayer(t[i]);this.latLngs=L.KML.getLatLngs(n);this.fire("loaded")}},latLngs:[]});L.Util.extend(L.KML,{parseKML:function(n){for(var r,e=this.parseStyle(n),t=n.getElementsByTagName("Folder"),f=[],i,u=0;u<t.length;u++)this._check_folder(t[u])&&(i=this.parseFolder(t[u],e),i&&f.push(i));for(t=n.getElementsByTagName("Placemark"),r=0;r<t.length;r++)this._check_folder(t[r])&&(i=this.parsePlacemark(t[r],n,e),i&&f.push(i));return f},_check_folder:function(n,t){for(n=n.parentElement;n&&n.tagName!=="Folder";)n=n.parentElement;return!n||n===t},parseStyle:function(n){function f(n){for(var r,u,e,o,t={},s=0;s<n.childNodes.length;s++)if(r=n.childNodes[s],u=r.tagName,c[u])if(u==="hotSpot")for(e=0;e<r.attributes.length;e++)t[r.attributes[e].name]=r.attributes[e].nodeValue;else o=r.childNodes[0].nodeValue,u==="color"?(t.opacity=parseInt(o.substring(0,2),16)/255,t.color="#"+o.substring(2,8)):u==="width"?t.weight=o:u==="Icon"?(i=f(r),i.href&&(t.href=i.href)):u==="href"&&(t.href=o);return t}for(var s={},h=n.getElementsByTagName("Style"),c={color:!0,width:!0,Icon:!0,href:!0,hotSpot:!0},o=0;o<h.length;o++){var e=h[o],t,r={},u={},i={};t=e.getElementsByTagName("LineStyle");t&&t[0]&&(r=f(t[0]));t=e.getElementsByTagName("PolyStyle");t&&t[0]&&(u=f(t[0]));u.color&&(r.fillColor=u.color);u.opacity&&(r.fillOpacity=u.opacity);t=e.getElementsByTagName("IconStyle");t&&t[0]&&(i=f(t[0]));i.href&&(r.icon=new L.KMLIcon({iconUrl:i.href,shadowUrl:null,iconAnchorRef:{x:i.x,y:i.y},iconAnchorType:{x:i.xunits,y:i.yunits}}));s["#"+e.getAttribute("id")]=r}return s},parseFolder:function(n,t){for(var r=[],u,e,i=n.getElementsByTagName("Folder"),f=0;f<i.length;f++)this._check_folder(i[f],n)&&(u=this.parseFolder(i[f],t),u&&r.push(u));for(i=n.getElementsByTagName("Placemark"),e=0;e<i.length;e++)this._check_folder(i[e],n)&&(u=this.parsePlacemark(i[e],n,t),u&&r.push(u));if(r.length)return r.length===1?r[0]:new L.FeatureGroup(r)},parsePlacemark:function(n,t,i){for(var f,p={},h,c,e,l,a,v,o,y,s,u=n.getElementsByTagName("styleUrl"),r=0;r<u.length;r++){h=u[r].childNodes[0].nodeValue;for(c in i[h])!0&&(p[c]=i[h][c])}e=[];l=["LineString","Polygon","Point"];for(f in l)if(1)for(a=l[f],u=n.getElementsByTagName(a),r=0;r<u.length;r++)v=this["parse"+a](u[r],t,p),v&&e.push(v);if(e.length){for(o=e[0],e.length>1&&(o=new L.FeatureGroup(e)),s="",u=n.getElementsByTagName("name"),u.length&&(y=u[0].childNodes[0].nodeValue),u=n.getElementsByTagName("description"),r=0;r<u.length;r++)for(f=0;f<u[r].childNodes.length;f++)s=s+u[r].childNodes[f].nodeValue;return y&&o.bindPopup('<p class="title">'+y+"<\/p><p>"+s+"<\/p>"),o}},parseCoords:function(n){var t=n.getElementsByTagName("coordinates");return this._read_coords(t[0])},parseLineString:function(n,t,i){var r=this.parseCoords(n);if(r.length)return new L.Polyline(r,i)},parsePoint:function(n,t,i){var u=n.getElementsByTagName("coordinates"),r;if(u.length)return r=u[0].childNodes[0].nodeValue.split(","),new L.KMLMarker(new L.LatLng(r[1],r[0]),i)},parsePolygon:function(n,t,i){for(var e=[],o=[],f,u=n.getElementsByTagName("outerBoundaryIs"),r=0;r<u.length;r++)f=this.parseCoords(u[r]),f&&e.push(f);for(u=n.getElementsByTagName("innerBoundaryIs"),r=0;r<u.length;r++)f=this.parseCoords(u[r]),f&&o.push(f);if(e.length)return(i.fill=i.fillColor?!0:!1,e.length===1)?new L.Polygon(e.concat(o),i):new L.MultiPolygon(e,i)},getLatLngs:function(n){for(var r=n.getElementsByTagName("coordinates"),t=[],i=0;i<r.length;i++)t=t.concat(this._read_coords(r[i]));return t},_read_coords:function(n){for(var i="",u=[],r,t=0;t<n.childNodes.length;t++)i=i+n.childNodes[t].nodeValue;for(i=i.split(/[\s\n]+/),t=0;t<i.length;t++)(r=i[t].split(","),r.length<2)||u.push(new L.LatLng(r[1],r[0]));return u}});L.KMLIcon=L.Icon.extend({createIcon:function(){var n=this._createIcon("icon");return n.onload=function(){var t=new Image;t.src=this.src;this.style.width=t.width+"px";this.style.height=t.height+"px";(this.anchorType.x==="UNITS_FRACTION"||this.anchorType.x==="fraction")&&(n.style.marginLeft=-this.anchor.x*t.width+"px");(this.anchorType.y==="UNITS_FRACTION"||this.anchorType.x==="fraction")&&(n.style.marginTop=-(1-this.anchor.y)*t.height+"px");this.style.display=""},n},_setIconStyles:function(n,t){L.Icon.prototype._setIconStyles.apply(this,[n,t]);n.anchor=this.options.iconAnchorRef;n.anchorType=this.options.iconAnchorType}});L.KMLMarker=L.Marker.extend({options:{icon:new L.KMLIcon.Default}});L.Map.mergeOptions({contextmenuItems:[]});L.Map.ContextMenu=L.Handler.extend({_touchstart:L.Browser.msPointer?"MSPointerDown":L.Browser.pointer?"pointerdown":"touchstart",statics:{BASE_CLS:"leaflet-contextmenu"},initialize:function(n){L.Handler.prototype.initialize.call(this,n);this._items=[];this._visible=!1;var t=this._container=L.DomUtil.create("div",L.Map.ContextMenu.BASE_CLS,n._container);t.style.zIndex=1e4;t.style.position="absolute";n.options.contextmenuWidth&&(t.style.width=n.options.contextmenuWidth+"px");this._createItems();L.DomEvent.on(t,"click",L.DomEvent.stop).on(t,"mousedown",L.DomEvent.stop).on(t,"dblclick",L.DomEvent.stop).on(t,"contextmenu",L.DomEvent.stop)},addHooks:function(){L.DomEvent.on(document,L.Browser.touch?this._touchstart:"mousedown",this._onMouseDown,this).on(document,"keydown",this._onKeyDown,this);this._map.on({contextmenu:this._show,mousedown:this._hide,movestart:this._hide,zoomstart:this._hide},this)},removeHooks:function(){L.DomEvent.off(document,L.Browser.touch?this._touchstart:"mousedown",this._onMouseDown,this).off(document,"keydown",this._onKeyDown,this);this._map.off({contextmenu:this._show,mouseout:this._hide,mousedown:this._hide,zoomstart:this._hide},this)},showAt:function(n,t){n instanceof L.LatLng&&(n=this._map.latLngToContainerPoint(n));this._showAtPoint(n,t)},hide:function(){this._hide()},addItem:function(n){return this.insertItem(n)},insertItem:function(n,t){t=t!==undefined?t:this._items.length;var i=this._createItem(this._container,n,t);return this._items.push(i),this._sizeChanged=!0,this._map.fire("contextmenu.additem",{contextmenu:this,el:i.el,index:t}),i.el},removeItem:function(n){var t=this._container;isNaN(n)||(n=t.children[n]);n&&(this._removeItem(L.Util.stamp(n)),this._sizeChanged=!0,this._map.fire("contextmenu.removeitem",{contextmenu:this,el:n}))},removeAllItems:function(){for(var n;this._container.children.length;)n=this._container.children[0],this._removeItem(L.Util.stamp(n))},hideAllItems:function(){for(var t,n=0,i=this._items.length;n<i;n++)t=this._items[n],t.el.style.display="none"},showAllItems:function(){for(var t,n=0,i=this._items.length;n<i;n++)t=this._items[n],t.el.style.display=""},setDisabled:function(n,t){var r=this._container,i=L.Map.ContextMenu.BASE_CLS+"-item";isNaN(n)||(n=r.children[n]);n&&L.DomUtil.hasClass(n,i)&&(t?(L.DomUtil.addClass(n,i+"-disabled"),this._map.fire("contextmenu.disableitem",{contextmenu:this,el:n})):(L.DomUtil.removeClass(n,i+"-disabled"),this._map.fire("contextmenu.enableitem",{contextmenu:this,el:n})))},isVisible:function(){return this._visible},_createItems:function(){for(var t=this._map.options.contextmenuItems,n=0,i=t.length;n<i;n++)this._items.push(this._createItem(this._container,t[n]))},_createItem:function(n,t,i){if(t.separator||t==="-")return this._createSeparator(n,i);var u=L.Map.ContextMenu.BASE_CLS+"-item",o=t.disabled?u+" "+u+"-disabled":u,r=this._insertElementAt("a",o,n,i),e=this._createEventHandler(r,t.callback,t.context,t.hideOnSelect),f="";t.icon?f='<img class="'+L.Map.ContextMenu.BASE_CLS+'-icon" src="'+t.icon+'"/>':t.iconCls&&(f='<span class="'+L.Map.ContextMenu.BASE_CLS+"-icon "+t.iconCls+'"><\/span>');r.innerHTML=f+t.text;r.href="#";L.DomEvent.on(r,"mouseover",this._onItemMouseOver,this).on(r,"mouseout",this._onItemMouseOut,this).on(r,"mousedown",L.DomEvent.stopPropagation).on(r,"click",e);return{id:L.Util.stamp(r),el:r,callback:e}},_removeItem:function(n){for(var t,i,r=0,u=this._items.length;r<u;r++)if(t=this._items[r],t.id===n)return i=t.el,callback=t.callback,callback&&L.DomEvent.off(i,"mouseover",this._onItemMouseOver,this).off(i,"mouseover",this._onItemMouseOut,this).off(i,"mousedown",L.DomEvent.stopPropagation).off(i,"click",t.callback),this._container.removeChild(i),this._items.splice(r,1),t;return null},_createSeparator:function(n,t){var i=this._insertElementAt("div",L.Map.ContextMenu.BASE_CLS+"-separator",n,t);return{id:L.Util.stamp(i),el:i}},_createEventHandler:function(n,t,i,r){var u=this,f=this._map,e=L.Map.ContextMenu.BASE_CLS+"-item-disabled",r=r!==undefined?r:!0;return function(){L.DomUtil.hasClass(n,e)||(r&&u._hide(),t&&t.call(i||f,u._showLocation),u._map.fire("contextmenu:select",{contextmenu:u,el:n}))}},_insertElementAt:function(n,t,i,r){var f,u=document.createElement(n);return u.className=t,r!==undefined&&(f=i.children[r]),f?i.insertBefore(u,f):i.appendChild(u),u},_show:function(n){this._showAtPoint(n.containerPoint)},_showAtPoint:function(n,t){if(this._items.length){var r=this._map,u=r.containerPointToLayerPoint(n),f=r.layerPointToLatLng(u),i={contextmenu:this};t&&(i=L.extend(t,i));this._showLocation={latlng:f,layerPoint:u,containerPoint:n};this._setPosition(n);this._visible?this._setPosition(n):(this._container.style.display="block",this._visible=!0);this._map.fire("contextmenu.show",i)}},_hide:function(){this._visible&&(this._visible=!1,this._container.style.display="none",this._map.fire("contextmenu.hide",{contextmenu:this}))},_setPosition:function(n){var i=this._map.getSize(),t=this._container,r=this._getElementSize(t),u;this._map.options.contextmenuAnchor&&(u=L.point(this._map.options.contextmenuAnchor),n=n.add(u));t._leaflet_pos=n;n.x+r.x>i.x?(t.style.left="auto",t.style.right=Math.max(i.x-n.x,0)+"px"):(t.style.left=Math.max(n.x,0)+"px",t.style.right="auto");n.y+r.y>i.y?(t.style.top="auto",t.style.bottom=Math.max(i.y-n.y,0)+"px"):(t.style.top=Math.max(n.y,0)+"px",t.style.bottom="auto")},_getElementSize:function(n){var t=this._size,i=n.style.display;return(!t||this._sizeChanged)&&(t={},n.style.left="-999999px",n.style.right="auto",n.style.display="block",t.x=n.offsetWidth,t.y=n.offsetHeight,n.style.left="auto",n.style.display=i,this._sizeChanged=!1),t},_onMouseDown:function(){this._hide()},_onKeyDown:function(n){var t=n.keyCode;t===27&&this._hide()},_onItemMouseOver:function(n){L.DomUtil.addClass(n.target,"over")},_onItemMouseOut:function(n){L.DomUtil.removeClass(n.target,"over")}});L.Map.addInitHook("addHandler","contextmenu",L.Map.ContextMenu);L.Mixin.ContextMenu={_initContextMenu:function(){this._items=[];this.on("contextmenu",this._showContextMenu,this)},_showContextMenu:function(n){var i,r,t,u;if(this._map.contextmenu){for(r=this._map.mouseEventToContainerPoint(n.originalEvent),this.options.contextmenuInheritItems||this._map.contextmenu.hideAllItems(),t=0,u=this.options.contextmenuItems.length;t<u;t++)i=this.options.contextmenuItems[t],this._items.push(this._map.contextmenu.insertItem(i,i.index));this._map.once("contextmenu.hide",this._hideContextMenu,this);this._map.contextmenu.showAt(r,{relatedTarget:this})}},_hideContextMenu:function(){for(var n=0,t=this._items.length;n<t;n++)this._map.contextmenu.removeItem(this._items[n]);this._items.length=0;this.options.contextmenuInheritItems||this._map.contextmenu.showAllItems()}};for(var classes=[L.Marker,L.Path,L.GeoJSON],defaultOptions={contextmenu:!1,contextmenuItems:[],contextmenuInheritItems:!0},cls,i=0,l=classes.length;i<l;i++)cls=classes[i],cls.prototype.options?cls.mergeOptions(defaultOptions):cls.prototype.options=defaultOptions,cls.addInitHook(function(){this.options.contextmenu&&this._initContextMenu()}),cls.include(L.Mixin.ContextMenu);L.BingLayer=L.TileLayer.extend({options:{subdomains:[0,1,2,3],type:"Aerial",attribution:"Bing",culture:"",isLayerMap:!0},initialize:function(n,t){L.Util.setOptions(this,t);this._key=n;this._url=null;this.meta={};this._initialized=!1},tile2quad:function(n,t,i){for(var r,e,u="",f=i;f>0;f--)r=0,e=1<<f-1,(n&e)!=0&&(r+=1),(t&e)!=0&&(r+=2),u=u+r;return u},getTileUrl:function(n,t){var t=this._getZoomForUrl(),i=this.options.subdomains,r=this.options.subdomains[Math.abs((n.x+n.y)%i.length)];return this._url.replace("{subdomain}",r).replace("{quadkey}",this.tile2quad(n.x,n.y,t)).replace("http:",document.location.protocol).replace("{culture}",this.options.culture)},onAdd:function(n){!!this._initialized||(this.loadMetadata(),this._initialized=!0);this._map=n;this._animated=n._zoomAnimated;this._initContainer();n.on({viewreset:this._reset,moveend:this._update},this);if(this._animated)n.on({zoomanim:this._animateZoom,zoomend:this._endZoomAnim},this);if(!this.options.updateWhenIdle){this._limitedUpdate=L.Util.limitExecByInterval(this._update,150,this);n.on("move",this._limitedUpdate,this)}this._reset();this._update()},loadMetadata:function(){var i=this,n="_bing_metadata_"+L.Util.stamp(this),r,t;window[n]=function(t){i.meta=t;window[n]=undefined;var r=document.getElementById(n);if(r.parentNode.removeChild(r),t.errorDetails){window.console&&console.log("Leaflet Bing Plugin Error - Got metadata: "+t.errorDetails);return}i.initMetadata()};r=document.location.protocol+"//dev.virtualearth.net/REST/v1/Imagery/Metadata/"+this.options.type+"?include=ImageryProviders&jsonp="+n+"&key="+this._key;t=document.createElement("script");t.type="text/javascript";t.src=r;t.id=n;document.getElementsByTagName("head")[0].appendChild(t)},initMetadata:function(){var t=this.meta.resourceSets[0].resources[0],i,r,u;if(this.options.subdomains=t.imageUrlSubdomains,this._url=t.imageUrl,this._providers=[],t.imageryProviders)for(i=0;i<t.imageryProviders.length;i++)for(r=t.imageryProviders[i],u=0;u<r.coverageAreas.length;u++){var n=r.coverageAreas[u],f={zoomMin:n.zoomMin,zoomMax:n.zoomMax,active:!1},e=new L.LatLngBounds(new L.LatLng(n.bbox[0]+.01,n.bbox[1]+.01),new L.LatLng(n.bbox[2]-.01,n.bbox[3]-.01));f.bounds=e;f.attrib=r.attribution;this._providers.push(f)}this._update()},_update:function(){this._url!=null&&this._map&&(this._update_attribution(),L.TileLayer.prototype._update.apply(this,[]))},_update_attribution:function(){for(var n,r=this._map.getBounds(),i=this._map.getZoom(),t=0;t<this._providers.length;t++)n=this._providers[t],i<=n.zoomMax&&i>=n.zoomMin&&r.intersects(n.bounds)?(!n.active&&this._map.attributionControl&&this._map.attributionControl.addAttribution(n.attrib),n.active=!0):(n.active&&this._map.attributionControl&&this._map.attributionControl.removeAttribution(n.attrib),n.active=!1)},onRemove:function(n){for(var i,t=0;t<this._providers.length;t++)i=this._providers[t],i.active&&this._map.attributionControl&&(this._map.attributionControl.removeAttribution(i.attrib),i.active=!1);L.TileLayer.prototype.onRemove.apply(this,[n])}});L.bingLayer=function(n,t){return new L.BingLayer(n,t)};L.Google=L.Class.extend({includes:L.Mixin.Events,options:{minZoom:0,maxZoom:18,tileSize:256,subdomains:"abc",errorTileUrl:"",attribution:"",opacity:1,continuousWorld:!1,noWrap:!1,isLayerMap:!0},initialize:function(n,t){L.Util.setOptions(this,t);this._type=google.maps.MapTypeId[n||"SATELLITE"]},onAdd:function(n,t){this._map=n;this._insertAtTheBottom=t;this._initContainer();this._initMapObject();n.on("viewreset",this._resetCallback,this);this._limitedUpdate=L.Util.limitExecByInterval(this._update,150,this);n.on("move",this._update,this);this._reset();this._update()},onRemove:function(){this._map._container.removeChild(this._container);this._map.off("viewreset",this._resetCallback,this);this._map.off("move",this._update,this)},getAttribution:function(){return this.options.attribution},setOpacity:function(n){this.options.opacity=n;n<1&&L.DomUtil.setOpacity(this._container,n)},_initContainer:function(){var t=this._map._container,n;first=t.firstChild;this._container||(this._container=L.DomUtil.create("div","leaflet-google-layer leaflet-top leaflet-left"),this._container.id="_GMapContainer");!0&&(t.insertBefore(this._container,first),this.setOpacity(this.options.opacity),n=this._map.getSize(),this._container.style.width=n.x+"px",this._container.style.height=n.y+"px",this._container.style.zIndex=0)},_initMapObject:function(){var n,t;this._google_center=new google.maps.LatLng(0,0);n=new google.maps.Map(this._container,{center:this._google_center,zoom:0,mapTypeId:this._type,disableDefaultUI:!0,keyboardShortcuts:!1,draggable:!1,disableDoubleClickZoom:!0,scrollwheel:!1,streetViewControl:!1});n.setOptions({styles:[{featureType:"transit.station.rail",stylers:[{visibility:"off"}]},{featureType:"transit.station.bus",stylers:[{visibility:"off"}]}]});t=this;this._reposition=google.maps.event.addListenerOnce(n,"center_changed",function(){t.onReposition()});n.backgroundColor="#ff0000";this._google=n},_resetCallback:function(n){this._reset(n.hard)},_reset:function(){this._initContainer()},_update:function(){this._resize();var n=this._map.getBounds(),t=n.getNorthEast(),i=n.getSouthWest(),f=new google.maps.LatLngBounds(new google.maps.LatLng(i.lat,i.lng),new google.maps.LatLng(t.lat,t.lng)),r=this._map.getCenter(),u=new google.maps.LatLng(r.lat,r.lng);this._google.setCenter(u);this._google.setZoom(this._map.getZoom())},_resize:function(){var n=this._map.getSize();(this._container.style.width!=n.x||this._container.style.height!=n.y)&&(this._container.style.width=n.x+"px",this._container.style.height=n.y+"px",google.maps.event.trigger(this._google,"resize"))},onReposition:function(){}});$(function(){$("body").on("click","[data-popup-action]",function(){var t=$(this).data("popup-action"),i=$(this).data("id"),r=$(this).data("type"),n=cityWay.page.map.getNodeByIdAndType(i,r);switch(t){case"select-departure":n.setDepartureNode();cityWay.eventManager.publish(cityWay.events.map.departureSelected,n,n.name,n.locality,n.getValue(),n.localityId);break;case"select-via":n.setViaNode();cityWay.eventManager.publish(cityWay.events.map.viaSelected,n,n.name,n.locality,n.getValue(),n.localityId);break;case"select-arrival":n.setArrivalNode();cityWay.eventManager.publish(cityWay.events.map.arrivalSelected,n,n.name,n.locality,n.getValue(),n.localityId);break;case"select-location":cityWay.eventManager.publish(cityWay.events.map.locationSelected,n,n.getValue());break;case"consult-timetostop":cityWay.eventManager.publish(cityWay.events.map.consultTimeToStopRequested,n);break;case"directtrip-fromlocality":cityWay.eventManager.publish(cityWay.events.map.directTripFromLocalitySelected,n,n.name,n.id);break;case"directtrip-tolocality":cityWay.eventManager.publish(cityWay.events.map.directTripToLocalitySelected,n,n.name,n.id);break;case"directtrip-fromstop":cityWay.eventManager.publish(cityWay.events.map.directTripFromStopSelected,n,n.name,n.id);break;case"directtrip-tostop":cityWay.eventManager.publish(cityWay.events.map.directTripToStopSelected,n,n.name,n.id);break;case"select-schedulespoi-from":cityWay.eventManager.publish(cityWay.events.map.lineTimeTablePOIFrom,n,n.name,n.id);break;case"select-nearby-specific":cityWay.eventManager.publish(cityWay.events.map.nearBySpecificSelected,n)}})});ko.bindingHandlers.stopBinding={init:function(){return{controlsDescendantBindings:!0}}};ko.virtualElements.allowedBindings.stopBinding=!0;$(function(){cityWay.consts.map={css:{defaultNode:"picto-point",defaultFocusNode:"picto-point focus-icon",selectedNode:"cw-transinfo picto-point-selected",departureNode:"cw-transinfo picto-iti picto-point-departure",viaNode:"cw-transinfo picto-iti picto-point-via",arrivalNode:"cw-transinfo picto-iti picto-point-arrival",physicalNode:"cw-transinfo picto-iti physicalstop",logicalNode:"cw-transinfo picto-iti logicalstop",physicalGroupedNode:"cw-transinfo picto-iti physicalstop physicalstop-logical-group",poiNodePrefix:"cw-transinfo picto-point picto-map categ-",roadNode:"cw-transinfo picto-point picto-map roadlink",addressNode:"TODO",trafficNode:"cw-trafficinfo picto-point picto-map traffic traffic-",disruptNode:"cw-transinfo disruption-type ",eventNode:"cw-transinfo cw-map-map4 ",focusNode:"focus-icon"},context:{defaultContext:"defaultContext",journeyPlannerSelection:"journeyPlannerSelection",journeyPlannerResult:"journeyPlannerResult",stopTimeTable:"stopTimeTable",lineTimeTable:"lineTimeTable",nearBy:"nearBy",directTrip:"directTrip",lineTimeTablePoi:"lineTimeTablePoi",lineTimeTablePoiResult:"lineTimeTablePoiResult",trafficInfo:"trafficInfo",disrupt:"disrupt",linesMap:"linesMap",vehicleTracking:"vehicleTracking",eventMap:"eventMap"},globals:{selectedDate:"selectedDate",startDate:"startDate",endDate:"endDate"},templates:{defaultPopupKey:"default-popup-template-path",poiPopupKey:"poi-popup.template-path",portionPopupKey:"portion-popup.template-path",roadlinkPopupKey:"roadlink-popup.template-path",stopPopupKey:"stop-popup.template-path",defaultLegendKey:"default-legende-template-path",trafficPopupKey:"traffic-popup.template-path",trafficWebcamPopupKey:"trafficwebcam-popup.template-path",parkingPopupKey:"parking-popup.template-path",bikePopupKey:"bike-popup.template-path",carSharingPopupKey:"carsharing-popup.template-path",disruptPopupKey:"disrupt-popup.template-path",eventPopupKey:"event-popup.template-path",myLocationPopupKey:"mylocation-popup.template-path"},legend:{groupTypes:{traffic:1,road:2,mountainPass:3,disruptions:4,bike:5,equipment:6,infrastructure:7,places:8,entertainment:9}},preferences:{mapLatCenter:"cityWay.preferences.map.MapLatCenter",mapLngCenter:"cityWay.preferences.map.MapLngCenter",mapZoom:"cityWay.preferences.map.MapZoom",legendOpen:"cityWay.preferences.map.LegendOpen",legendSeletedItem:"cityWay.preferences.map.LegendSeletedItem",multipleValuesSeparator:"|"},cookies:{rememberLayer:"cityWay.cookies.map.rememberLayer",legend:"cityWay.cookies.map.legend",disabledMap:"cityWay.cookies.map.disabled"}}});$(function(){cityWay.helpers.geometryHelper=function(){function n(n){var t=Enumerable.From(n).Skip(1),i=Enumerable.From(n).Take(n.length-1);return t.Zip(i,function(n,t){var i=L.latLng(n[0],n[1]),r=L.latLng(t[0],t[1]);return i.distanceTo(r)}).Sum()}function t(t){var l,u,f;if(t.length<2)return null;if(l=t.length-1,u=n(t),u<=0)return t[0];var s=u/2,r=l,i=0,a=u,v=0;if(t.length>2){do{var h=Math.round(i+(r-i)/2),c=t[h],y=Enumerable.From(t).TakeWhile(function(n){return n[0]!==c[0]||n[1]!==c[1]}).ToArray();y.push(c);f=n(y);s<=f?(r=h,a=f):(i=h,v=f)}while(r-i>1)}else i=0,r=1;var p=t[i],w=t[r],e=s-v,o=a-s,b=(e*w[0]+o*p[0])/(e+o),k=(e*w[1]+o*p[1])/(e+o);return[b,k]}return{getEquiDistantMiddlePoint:t}}()});$(function(){cityWay.templateHtml={};cityWay.helpers.templateHelper=function(){function n(n){(cityWay.templateHtml[n]==null||cityWay.templateHtml[n]=="")&&jQuery.ajax({url:n,success:function(t){cityWay.templateHtml[n]=t},async:!1})}function t(t){return n(t),cityWay.templateHtml[t]}return{getHtmlTemplate:t}}()});$(function(){cityWay.mapDataService=function(){"use strict";function n(){return $.ajax("/api/map/GetNodeLegendItems",{type:"GET",headers:{wlCode:sessionStorage.getItem("wlCode")},dataType:"json"})}function t(n){return $.ajax("/api/map/GetGroupedNodeLegendItems",{type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:{context:n}})}function i(n){return $.ajax("/api/map/GetSpecificLegendItems",{type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:{context:n}})}function r(n,t,i){var r={logicalId:n};return!t||(r.physicalId=t),!i||(r.selectedDate=i),$.ajax("/api/lines/GetLinesStop",{type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:r})}function u(n,t,i){var r={lineId:n,direction:t};return!i||(r.selectedDate=i),$.ajax("/api/map/GetAllItinerary",{type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:r})}function f(n,t,i){var r={lineId:n};return!t||(r.selectedDate=t),!i||(r.sens=i),$.ajax("/api/map/GetLineMap",{type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:r})}function e(n,t,i){var r={latitude:n,longitude:t,distance:i||500};return $.ajax("/api/map/GetPlacesNearPoint",{type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:r})}function o(n,t,i){var r={latitude:n,longitude:t,mode:i||0};return $.ajax("/api/map/GetNearestRoad",{type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:r})}function s(n,t,i,r,u,f){var e={latMin:n,longMin:t,latMax:i,longMax:r,categories:u||"",actualZoom:f};return $.ajax("/api/map/GetPlacesBounded",{type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:e})}function h(n,t,i,r,u){var f={latMin:n,longMin:t,latMax:i,longMax:r,actualZoom:u};return $.ajax("/api/map/GetStopsBounded",{type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:f})}function c(n,t,i,r,u){var f={actualZoom:n,latMin:t,longMin:i,latMax:r,longMax:u};return $.ajax("/api/map/RetrievePointsInBoundingBox",{type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:f})}function l(n,t,i,r,u,f,e,o){var s={startId:n,startType:t,arrivalId:i,arrivalType:r,departureLat:u||0,departureLng:f||0,arrivalLat:e||0,arrivalLng:o||0};return $.ajax("/api/journeyplanner/WalkTripJson",{type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:s})}function a(n){var t={id:n};return $.ajax("/api/lines/Get",{type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:t})}function v(n,t,i){var r={lineId:n,vehicleJourneyId:t,selectedDate:i};return $.ajax("/api/map/GetPTLineInfo",{type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:r})}function y(n,t,i){var r={id:n,type:t};return $.ajax("/api/trippoint/Get",$.extend({type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:r},i))}function p(n,t){var i={id:n};return $.ajax("/api/trippoint/GetStreetSection",$.extend({type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:i},t))}function w(n,t,i,r,u){var f=cityWay.tools.replaceAll(String(i),",","."),e=cityWay.tools.replaceAll(String(r),",","."),o={id:n,number:t,lat:f,lng:e};return $.ajax("/api/trippoint/GetRoad",$.extend({type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:o},u))}function b(n,t,i){var r={categories:n,localityId:t};return $.ajax("/api/trippoint/GetAllPointsForCategories",$.extend({type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:r},i))}function k(n){var t=Enumerable.From(n).Select(function(n){return{Latitude:n[0],Longitude:n[1]}}).ToArray();return $.ajax("/api/map/GetEquiDistantMiddlePoint",{type:"POST",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:{"":t}})}function d(n,t){var i={latitude:n,longitude:t};return $.ajax("/api/map/GetLocality",{type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:i})}function g(n,t,i,r,u,f,e,o){var s={latMin:n,longMin:t,latMax:i,longMax:r,zoom:u,context:f,dateTimeStart:e,dateTimeEnd:o};return $.ajax("/api/traffic/GetTrafficItems",{type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:s})}function nt(n,t,i,r,u,f,e,o){var s={latMin:n,longMin:t,latMax:i,longMax:r,zoom:u,context:f,dateTimeStart:e,dateTimeEnd:o};return $.ajax("/api/traffic/GetMergedTrafficItems",{type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:s})}function tt(n,t,i,r,u,f){var e={latMin:n,longMin:t,latMax:i,longMax:r,zoom:u,context:f};return $.ajax("/api/traffic/GetPmvsInBoundingBox",{type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:e})}function it(){return $.ajax("/api/traffic/GetTravelTimes",{type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:{}})}function rt(n,t,i,r){var u={dateTime:n,placeIds:t,bikeStationRefs:i};return $.ajax("/api/occupancy/GetBikeStationAvailabilities",$.extend({type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:u},r))}function ut(n,t,i,r){var u={dateTime:n,placeIds:t,parkingRefs:i};return $.ajax("/api/occupancy/GetParkingAvailabilities",$.extend({type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:u},r))}function ft(n,t){var i={placeIds:n};return $.ajax("/api/occupancy/GetOpeningPeriods",$.extend({type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:i},t))}function et(n,t){var i={ids:n};return $.ajax("/api/place/GetPlacesAddresses",$.extend({type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:i},t))}function ot(n,t,i,r){var u={dateTime:n,placeIds:t,stationRefs:i};return $.ajax("/api/occupancy/GetCarSharingAvailabilities",$.extend({type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:u},r))}function st(){return}function ht(n,t,i,r){var u={dateTimeStart:n,dateTimeEnd:t,eventQualifications:i};return $.ajax("/api/traffic/GetEvents",$.extend({type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:u},r))}function ct(n,t,i,r,u,f){var e={latMin:n,longMin:t,latMax:i,longMax:r,zoom:u,context:f};return $.ajax("/api/traffic/GetCameraPolesInBoundingBox",{type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:e})}function lt(n){var t={poleCodes:n};return $.ajax("/api/traffic/ActivateCameras",{type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:t})}function at(){return $.ajax("/api/Member/GetUserProfile/json",{type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:{}})}function vt(n){return $.ajax("/api/Member/SaveUserPreferences/json",{type:"POST",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:{values:n}})}function yt(n){var t={id:n};return $.ajax("/api/Localities/Get",{type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:t})}function pt(){return $.ajax("/api/map/GetStructuringRoutes",{type:"GET",headers:{wlCode:sessionStorage.getItem("wlCode")},dataType:"json"})}function wt(n){var t={logicalId:n};return $.ajax("/api/PhysicalStop/GetStops",{type:"GET",dataType:"json",headers:{wlCode:sessionStorage.getItem("wlCode")},data:t})}return{getNodeLegendItems:n,getGroupedNodeLegendItems:t,getSpecificLegendItems:i,getLinesForStop:r,getLineItineraries:u,getPlacesNearPoint:e,getNearestRoad:o,getPlacesInBoundingBox:s,getStopsInBoundingBox:h,getPointsInBoundingBox:c,getWalkTrip:l,getLine:a,getPTLineInfo:v,getPoint:y,getStreet:p,getRoad:w,getPointsByCategories:b,getEquiDistantMiddlePoint:k,getLocality:d,getTrafficInfoItemsInBoundingBox:g,getPmvsInBoundingBox:tt,getTravelTimes:it,getBikeStationAvailabilities:rt,getParkingAvailabilities:ut,getParkingInfos:ft,getParkingAddress:et,getCarSharingAvailabilities:ot,getTrafficEvents:ht,getCameraPolesInBoundingBox:ct,activateCameras:lt,getUserProfile:at,saveUserPreferences:vt,getMergedTrafficItems:nt,getLineMap:f,getEvents:st,getLocalityById:yt,getStructuringRoutes:pt,getStops:wt}}()});$(function(){cityWay.mapFactory=function(){function t(t){if(!t.mapId)throw new Error("Map id must be specified");if(t.create||!n[t.mapId]){var i=new cityWay.Map(t);i.attachBehavior(cityWay.FilterItemsVisibilityByZoomBehavior.id,new cityWay.FilterItemsVisibilityByZoomBehavior({map:i}),!0);i.attachBehavior(cityWay.FilterItemsVisibilityByCircleBoundsBehavior.id,new cityWay.FilterItemsVisibilityByCircleBoundsBehavior({map:i}),!0);i.attachBehavior(cityWay.SelectionRangeBehavior.id,new cityWay.SelectionRangeBehavior({map:i}),!0);i.attachBehavior(cityWay.BoundingBoxBehavior.id,new cityWay.BoundingBoxBehavior({map:i}),!0);i.attachBehavior(cityWay.LegendBehavior.id,new cityWay.LegendBehavior({map:i}),!0);i.attachBehavior(cityWay.LegendCheckableBehavior.id,new cityWay.LegendCheckableBehavior({map:i}),!0);i.attachBehavior(cityWay.LineMarkerVisibilityBehavior.id,new cityWay.LineMarkerVisibilityBehavior({map:i}),!0);i.attachBehavior(cityWay.ContextMenuBehavior.id,new cityWay.ContextMenuBehavior({map:i}),!0);i.attachBehavior(cityWay.PreferencesBehavior.id,new cityWay.PreferencesBehavior({map:i}),!0);i.attachBehavior(cityWay.StructuringRoutesBehavior.id,new cityWay.StructuringRoutesBehavior({map:i}),!0);document.getElementById(t.mapId+"_container")&&window.ko.applyBindings(i,document.getElementById(t.mapId+"_container"));i.context=cityWay.mapContextFactory[t.context]?cityWay.mapContextFactory[t.context]().setup(i,t.contextArgs):(new cityWay.DefaultMapContext).setup(i,t.contextArgs);n[t.mapId]=i}return n[t.mapId]}var n={};return{get:t}}()});$(function(){cityWay.mapNodeFactory=function(){function n(n,t,i){return new cityWay.PhysicalNode({map:n,id:t.Id,logicalId:t.LogicalStop.Id,name:t.Name,latitude:t.Latitude,longitude:t.Longitude,category:t.Category,locality:t.Locality.Name,localityId:t.Locality.Id,popupOpen:i,distance:t.Distance})}function r(n,t,i){return new cityWay.LogicalNode({map:n,id:t.Id,name:t.Name,latitude:t.Latitude,longitude:t.Longitude,locality:t.Locality.Name,localityId:t.Locality.Id,popupOpen:i,distance:t.Distance})}function t(n,t,i){var r=t.Categories.length>0?t.Categories[0].Id:0,u={map:n,id:t.Id,name:t.Name,latitude:t.Latitude,longitude:t.Longitude,category:r,locality:t.Locality.Name,localityId:t.Locality.Id,popupOpen:i,distance:t.Distance};return r==cityWay.poi.category.bikeStation||r==cityWay.poi.category.bikePark?new cityWay.BikeNode(u):r==cityWay.poi.category.parkNRide||r==cityWay.poi.category.parking?new cityWay.ParkingNode(u):r==cityWay.poi.category.carSharing?new cityWay.CarSharingNode(u):new cityWay.PoiNode(u)}function u(n,t,i){return new cityWay.RoadLinkNode({map:n,id:t.Id,latitude:t.Latitude,longitude:t.Longitude,name:t.Name,locality:t.Locality.Name,localityId:t.Locality.Id,popupOpen:i,distance:t.Distance,number:t.Number})}function e(n,t,i){return new cityWay.AddressNode({map:n,id:t.Id,latitude:t.Latitude,longitude:t.Longitude,name:t.Name,locality:t.Locality.Name,localityId:t.Locality.Id,popupOpen:i,distance:t.Distance,number:t.Number})}function f(n,t,i){var r={map:n,id:t.Id,locality:t.LocalityName,latitude:t.Latitude,longitude:t.Longitude,name:t.Name,zIndex:t.ZIndex*100,markerZIndex:t.ZIndex*100,description:t.Description,itemType:t.ItemType,popupOpen:i,className:t.Image,minZoom:t.MinZoom,children:Enumerable.From(t.Children).Select(function(t){return f(n,t,i)}).ToArray()};return r.itemType==cityWay.itemType.webcam?new cityWay.TrafficCameraNode(r):new cityWay.TrafficNode(r)}function o(n,t,i){return new cityWay.DisruptNode({map:n,id:t.Id,category:t.Type,latitude:t.Latitude,longitude:t.Longitude,name:t.Title,className:t.Type,description:t.Content,itemType:t.ItemType,popupOpen:i})}function s(n,t,i){return new cityWay.EventNode({map:n,id:t.Id,category:t.CategoryName,categoryOrder:t.CategoryOrder,categoryId:t.CategoryId,latitude:t.Latitude,locality:t.City,longitude:t.Longitude,name:t.Title,description:t.Summary,itemType:t.ItemType,popupOpen:i,className:t.CategoryCss})}function i(i,h,c){if(h.TypePoint===cityWay.pointType.poi)return t(i,h,c);if(h.TypePoint===cityWay.pointType.roadLink)return u(i,h,c);if(h.TypePoint===cityWay.pointType.physicalStop)return n(i,h,c);if(h.TypePoint===cityWay.pointType.logicalStop)return r(i,h,c);if(h.TypePoint===cityWay.pointType.address)return e(i,h,c);if(h.TypePoint===cityWay.pointType.traffic)return f(i,h,c);if(h.TypePoint===cityWay.pointType.disrupt)return o(i,h,c);if(h.TypePoint===cityWay.pointType.event)return s(i,h,c);throw new Error("Unknown point type");}function h(n,t,r){var u=$.Deferred();return setTimeout(function(){var f=i(n,t,r);u.resolve(f)},100),u.promise()}function c(n,t,i,r,u){return new cityWay.PoiNode({map:n,id:t,name:i,latitude:r,longitude:u,category:cityWay.poi.category.locality,locality:i,localityId:t})}function l(t,i){return Enumerable.From(i).Where(function(n){return!!n.Latitude&&!!n.Longitude}).Select(function(i){return n(t,i)}).ToArray()}function a(n,i){return Enumerable.From(i).Where(function(n){return!!n.Latitude&&!!n.Longitude}).Select(function(i){return t(n,i)}).ToArray()}function v(n,t){return Enumerable.From(t).Where(function(n){return!!n.Latitude&&!!n.Longitude}).Select(function(t){return i(n,t)}).ToArray()}function y(n,t){var i=$.Deferred(),r=Enumerable.From(t).Where(function(n){return!!n.Latitude&&!!n.Longitude}).Select(function(t){return h(n,t)}).ToArray();return $.when.apply($,r).then(function(){i.resolve($.makeArray(arguments))}),i.promise()}return{createNodeFromPhysicalStop:n,createNodeFromPointOfInterest:t,createNodeFromRoadLink:u,createNodeFromLogicalStop:r,createNodeFromAny:i,createLocalityNode:c,createNodeArrayFromPhysicalStops:l,createNodeArrayFromPointOfInterests:a,createNodeArrayFromAny:v,createNodeArrayFromAnyAsync:y}}()});$(function(){cityWay.mapItineraryFactory=function(){function n(n,t){var i=new cityWay.Itinerary({map:n,id:t&&t.id||0});return t&&t.portions&&i.setPortions(t.portions),i}function t(n,t){return new cityWay.ItineraryPortion({map:n,id:t.id,className:t.className,icon:t.icon,nodes:t.nodes,points:t.points,steps:t.steps,label:t.label||"",disablePopup:t.disablePopup,data:t.data})}return{createItinerary:n,createPortion:t}}()});$(function(){cityWay.mapIconFactory=function(){function n(n){var i=!!n&&n.className||"picto-point",t=!!n&&n.iconSize||[18,18],r=!!n&&n.iconAnchor||[t[0]/2,t[1]/2],u=!!n&&n.popupAnchor||[t[0]/2,t[1]/2],f=!!n&&n.html||"";return L.divIcon({className:i,iconSize:t,iconAnchor:r,popupAnchor:u,html:f})}function t(n){var i=n.imgUrl||"",t=!!n&&n.iconSize||[18,18],r=!!n&&n.iconAnchor||[t[0]/2,t[1]/2],u=!!n&&n.popupAnchor||[t[0]/2,t[1]/2];return L.icon({iconUrl:i,iconSize:t,iconAnchor:r,popupAnchor:u})}return{createDivIcon:n,createImgIcon:t}}()});$(function(){cityWay.Node=function(n){"use strict";function r(){i(!0)}function u(){i(!1)}function f(){}function e(){}var t,i;if(!n.map||!n.map.mapControl)throw new Error("The map component must be provided");return t=this,t.map=n.map,i=ko.observable(!1),t._internalOptimizeDOM=function(){},t.isLocked=i,t.lock=r,t.unlock=u,t.getId=f,t.getItemType=e,t}});$(function(){cityWay.ClusterNode=function(n){"use strict";function o(){var n;r.subscribe(function(t){n=t.slice(0)},null,"beforeChange");r.subscribe(function(t){s(n);h(t)})}function s(n){for(var t,u=[],r=0;r<n.length;r++)t=n[r],u.push(t.marker),t.hide(),t.dispose();i.removeLayers(u)}function h(n){for(var r,f=[],u=0;u<n.length;u++)r=n[u],f.push(r.marker),r.setCluster(t),r._internalSetVisibility(!0);i.addLayers(f)}function c(){f()||(u.addLayer(i),f(!0))}function l(){f()&&(u.hasLayer(i)&&u.removeLayer(i),f(!1))}function a(n){i.hasLayer(n.marker)&&(i.removeLayer(n.marker),n._internalSetVisibility(!1))}function v(n){i.hasLayer(n.marker)||(i.addLayer(n.marker),n._internalSetVisibility(!0))}function y(){i.removeLayers(Enumerable.From(r()).Select(function(n){return n.marker}).ToArray());u.removeLayer(i)}function p(n){r.push(n)}function w(n,t){var i=Enumerable.From(r()).Where(function(n){return n.isLocked()}).ToArray(),u,f;t?r(i.concat(n)):(u=Enumerable.From(r()).Join(n,function(n){return n.getId()},function(n){return n.getId()},function(n){return n}).ToArray(),f=Enumerable.From(n).Except(r(),function(n){return n.getId()}).ToArray(),r(i.concat(u).concat(f)))}function b(){Enumerable.From(r()).Where(function(n){return n.isLocked()}).ForEach(function(n){n.unlock()})}function k(){return!1}if(!n.map||!n.map.mapControl)throw new Error("The map component must be provided");var t=new cityWay.Node(n),e=t.map,u=e.mapControl,f=ko.observable(!1),r=ko.observableArray([]),i=L.markerClusterGroup({chunkedLoading:!0,showCoverageOnHover:!1,spiderfyOnMaxZoom:!0,disableClusteringAtZoom:n.disableClusteringAtZoom||cityWay.config.map.TrafficInfo.Traffic.UnclusterAt,iconCreateFunction:n.iconCreateFunction||null});return o(),t.type="clusterNode",t.nodes=window.ko.computed(function(){return r()}),t.markers=i,t.show=c,t.hide=l,t.addNode=p,t.setNodes=w,t.dispose=y,t.unlockAllNodes=b,t.hideNode=a,t.showNode=v,t.isPopupOpen=k,t}});$(function(){cityWay.LeafNode=function(n){"use strict";function it(){si(i);vt&&st();y&&!h.isLocked()&&i.dragging.enable();l(!0)}function rt(){b=i.getLatLng()}function ut(){var n=i.getLatLng();u(n.lat);f(n.lng);w();e()&&cityWay.eventManager.publish(cityWay.events.map.departureNodeDragged,t,n.lat,n.lng);o()&&cityWay.eventManager.publish(cityWay.events.map.viaNodeDragged,t,n.lat,n.lng);s()&&cityWay.eventManager.publish(cityWay.events.map.arrivalNodeDragged,t,n.lat,n.lng)}function ft(){r();p(!0);r.onPopupOpen&&r.onPopupOpen();cityWay.eventManager.publish(cityWay.events.map.responsiveOpenPopup,t)}function et(){p(!1);r.onPopupClose&&r.onPopupClose()}function ot(){cityWay.eventManager.publish(cityWay.events.map.nodeClicked,t)}function w(){var n=c.getBounds();!t.latitude||!t.longitude||!n.contains([t.latitude,t.longitude])?setTimeout(function(){setTimeout(function(){p()||c.hasLayer(i)&&c.removeLayer(i)})}):setTimeout(function(){l()&&c.addLayer(i)})}function r(){var n=r,f=n.templateUri,e=n.popupContent,o=cityWay.helpers.templateHelper.getHtmlTemplate(f),u=$(o)[0];i.setPopupContent(u);t.popupContent(e.value);ko.applyBindings({popupContent:t.popupContent},u);i.getPopup()&&i.getPopup().update();n.isLoaded=!0}function oi(){return e()?d:o()?g:s()?nt:k}function si(n){!n._icon||n._icon.setAttribute("title",t.getVerboseName())}function hi(n){var t=n.templateUri||"/Cityway.TSI.Core/Embedded/Map/templates/popup/default-popup-template.html",i=n.popupContent||cityWay.Lazy.empty;r.templateUri=t;r.popupContent=i;r.onPopupOpen=n.onPopupOpen;r.onPopupClose=n.onPopupClose}function ci(){e(!0);o(!1);s(!1);a(!1);v(!0);t.lock();i.setIcon(ii);i.getPopup().update()}function li(){e(!1);o(!0);s(!1);a(!1);v(!0);t.lock();i.setIcon(ri);i.getPopup().update()}function ai(){e(!1);o(!1);s(!0);a(!1);v(!0);t.lock();i.setIcon(ui);i.getPopup().update()}function vi(){e(!1);o(!1);s(!1);a(!1);v(!1);t.unlock();i.setIcon(tt);i.getPopup().update();t.map._internalNodes.remove(function(n){return n.pointType===cityWay.pointType.roadLink&&!n.isLocked()})}function yi(){e(!1);o(!1);s(!1);a(!0);v(!1);t.unlock();i.setIcon(fi);i.getPopup().update()}function pi(){i.off("add",it);i.off("dragstart",rt);i.off("dragend",ut);i.off("popupopen",ft);i.off("popupclose",et);i.off("click",ot)}function wi(){l()||(c.addLayer(i),l(!0),w())}function bi(){l()&&(c.hasLayer(i)&&c.removeLayer(i),l(!1))}function ki(n){c.fitBounds(ei.getBounds(),{maxZoom:n})}function st(){setTimeout(function(){return i.openPopup()})}function di(){setTimeout(function(){i.closePopup()})}function gi(){h.currentDepartureNode(t)}function nr(){h.currentViaNode(t)}function tr(){h.currentArrivalNode(t)}function ir(){h.currentFocusSelectedNode(t)}function rr(){h.currentSelectedNode(t)}function v(n){!!y!=!!n&&(y=n,i.dragging&&(y?i.dragging.enable():i.dragging.disable()))}function ur(n,t){u(n);f(t);i.setLatLng([n,t]);i.update()}function fr(){i.setLatLng(b);i.update()}function er(){return l()}function or(){return t.pointType}function sr(){return t.hasOwnProperty("_cluster")&&!!t._cluster}function hr(){return t._cluster}function cr(n){t._cluster=n}function lr(n){l(n)}function ar(){return t.name+" "+t.locality}if(!n.map||!n.map.mapControl)throw new Error("The map component must be provided");var t=new cityWay.Node(n),h=t.map,c=h.mapControl,ht=n.name||"",ct=n.locality||"",lt=n.localityId||0,u=ko.observable(n.latitude),f=ko.observable(n.longitude),b=L.latLng(u(),f()),at=n.pointType||0,vt=n.popupOpen||!1,y=n.draggable||!1,l=ko.observable(!1),yt=n.distance||0,p=ko.observable(!1),e=ko.observable(!1),o=ko.observable(!1),s=ko.observable(!1),a=ko.observable(!1),pt=ko.computed(function(){return!e()&&!o()&&!s()&&!a()}),wt=ko.computed(function(){return"https://maps.google.com/maps?q="+u()+","+f()+"&ll="+u()+","+f()+"&layer=c&cbll="+u()+","+f()+"&cbp=12,0,0,0,0"}),bt=ko.computed(function(){return"http://maps.googleapis.com/maps/api/streetview?size=600x300&location="+u()+","+f()+"&heading=151.78&pitch=-0.76&sensor=false"}),kt=ko.observable(),k=n.className||cityWay.consts.map.css.defaultNode,vr=n.className+" "+cityWay.consts.map.css.focusNode||cityWay.consts.map.css.defaultFocusNode,d=cityWay.consts.map.css.departureNode,g=cityWay.consts.map.css.viaNode,nt=cityWay.consts.map.css.arrivalNode,dt=cityWay.consts.map.css.selectedNode,gt=n.normalIconSize||[27,27],ni=n.normalIconAnchor||[9,9],ti=n.normalPopupAnchor||[1,-9],tt=cityWay.mapIconFactory.createDivIcon({className:k,iconSize:gt,iconAnchor:ni,popupAnchor:ti}),ii=cityWay.mapIconFactory.createDivIcon({className:d,iconSize:[27,27],iconAnchor:[13,13],popupAnchor:[0,-13]}),ri=cityWay.mapIconFactory.createDivIcon({className:g,iconSize:[27,27],iconAnchor:[13,13],popupAnchor:[0,-13]}),ui=cityWay.mapIconFactory.createDivIcon({className:nt,iconSize:[27,37],iconAnchor:[13,13],popupAnchor:[0,-13]}),fi=cityWay.mapIconFactory.createDivIcon({className:dt,iconSize:[48,48],iconAnchor:[24,24],popupAnchor:[1,-30]}),i=L.marker([u(),f()],{icon:tt,draggable:y,zIndexOffset:n.markerZIndex||0}),ei=L.featureGroup([i]);i.bindPopup('<div style="margin: 20px"><img src="/Content/img/common/ajax-loader.gif" /><\/div>');i.on("add",it);i.on("dragstart",rt);i.on("dragend",ut);i.on("popupopen",ft);i.on("popupclose",et);i.on("click",ot);return t.type="leafNode",t.map=h,t.pointType=at,t.className=ko.computed(oi),t.name=ht,t.locality=ct,t.localityId=lt,Object.defineProperty(t,"latitude",{get:function(){return u()}}),Object.defineProperty(t,"longitude",{get:function(){return f()}}),t.marker=i,t.streetViewUrl=wt,t.streetViewImageUrl=bt,t.isDepartureNode=e,t.isViaNode=o,t.isArrivalNode=s,t.isSelectedNode=a,t.isNormalNode=pt,t.isPopupOpen=p,t.distance=yt,t.popupContent=kt,t.dispose=pi,t.show=wi,t.hide=bi,t.isVisible=ko.computed(er),t.openPopup=st,t.closePopup=di,t.fitBounds=ki,t.cancelDragDrop=fr,t.setPosition=ur,t.setDepartureNode=gi,t.setViaNode=nr,t.setArrivalNode=tr,t.setSelectedNode=rr,t.setFocusSelectedNode=ir,t.setDraggable=v,t.getItemType=or,t.inClusterNode=sr,t.getCluster=hr,t.setCluster=cr,t.getVerboseName=ar,t._initializePopup=hi,t._internalOptimizeDOM=w,t._internalSetNormalNode=vi,t._internalSetDepartureNode=ci,t._internalSetViaNode=li,t._internalSetArrivalNode=ai,t._internalSetSelectedNode=yi,t._internalSetVisibility=lr,t};cityWay.LeafNode.prototype=Object.create(cityWay.Node.prototype);cityWay.LeafNode.prototype.constructor=cityWay.LeafNode});$(function(){cityWay.PhysicalNode=function(n){"use strict";function e(){i.value.fillAssociatedLines(t.logicalId,t.id,t.name,t.marker)}function o(){return t.id+"_"+t.pointType}function s(){return t.logicalId+"_"+cityWay.pointType.logicalStop}function h(){return cityWay.texts.map.Title_Stop+": "+t.name+" "+t.locality}var r=n.normalIconSize||[18,18],u=n.normalIconAnchor||[9,9],f=n.normalPopupAnchor||[1,-9],t=new cityWay.LeafNode($.extend(n,{className:cityWay.consts.map.css.physicalNode,normalIconSize:r,normalIconAnchor:u,normalPopupAnchor:f})),i;return t.pointType=cityWay.pointType.physicalStop,t.id=n.id||0,t.logicalId=n.logicalId||0,i=new cityWay.Lazy(function(){return new cityWay.StopPopupContent(t)}),t._initializePopup({templateUri:t.map.context[cityWay.consts.map.templates.stopPopupKey],popupContent:i,onPopupOpen:e}),t.getId=o,t.getVerboseName=h,t.getValue=s,t}});$(function(){cityWay.LogicalNode=function(n){"use strict";function o(){i.value.fillAssociatedLines(t.id,null,t.name,t.marker)}function r(){return t.id+"_"+t.pointType}function s(){return r()}function h(){return cityWay.texts.map.Title_Stop+": "+t.name+" "+t.locality}var u=n.normalIconSize||[27,27],f=n.normalIconAnchor||[9,9],e=n.normalPopupAnchor||[1,-9],t=new cityWay.LeafNode($.extend(n,{className:cityWay.consts.map.css.logicalNode,normalIconSize:u,normalIconAnchor:f,normalPopupAnchor:e})),i;return t.id=n.id||0,t.pointType=cityWay.pointType.logicalStop,i=new cityWay.Lazy(function(){return new cityWay.StopPopupContent(t)}),t._initializePopup({templateUri:t.map.context[cityWay.consts.map.templates.stopPopupKey],popupContent:i,onPopupOpen:o}),t.getId=r,t.getValue=s,t.getVerboseName=h,t}});$(function(){cityWay.PoiNode=function(n){"use strict";function o(){return t.id+"_"+t.pointType}function s(){return t.pointType+"_"+(t.category||"")}function h(){return t.category==cityWay.poi.category.locality?t.categoryName+": "+t.name:t.categoryName+": "+t.name+" "+t.locality}function c(){return t.id+"_"+t.pointType}var i=n.category||1,r=n.categoryName||cityWay.texts.map["Legend_Poi_Category_"+i],u=n.normalIconSize||[27,27],f=n.normalIconAnchor||[13,27],e=n.normalPopupAnchor||[0,-27],t=new cityWay.LeafNode($.extend(n,{className:cityWay.consts.map.css.poiNodePrefix+i,normalIconSize:u,normalIconAnchor:f,normalPopupAnchor:e}));return t.id=n.id||0,t.pointType=cityWay.pointType.poi,t.category=i,t.categoryName=r,t._initializePopup({templateUri:t.map.context[cityWay.consts.map.templates.poiPopupKey],popupContent:new cityWay.Lazy(function(){return new cityWay.PlaceOfInterestPopupContent(t)})}),t.getId=o,t.getItemType=s,t.getVerboseName=h,t.getValue=c,t}});cityWay.tools.showPoiNode=function(n,t){var r=cityWay.config.map.ZoomDisplayPoint.Poi,u=null,i;if(n===cityWay.poi.category.locality&&(r=cityWay.config.map.ZoomDisplayPoint.City),cityWay.config.map.ZoomDisplayPoint.SpecificPOI!=null)for(i=0;i<cityWay.config.map.ZoomDisplayPoint.SpecificPOI.length;i++)cityWay.config.map.ZoomDisplayPoint.SpecificPOI[i].Categ===n&&(r=cityWay.config.map.ZoomDisplayPoint.SpecificPOI[i].ZoomMin,u=cityWay.config.map.ZoomDisplayPoint.SpecificPOI[i].ZoomMax);return t>=r&&(!u||t<=u)};$(function(){cityWay.RoadLinkNode=function(n){"use strict";function e(){t.isDepartureNode()||t.isViaNode()||t.isArrivalNode()||t.isSelectedNode()||t.map._internalNodes.remove(t)}function i(){return t.number>0?t.id+"_"+t.pointType+"_"+t.number:t.id+"_"+t.pointType}function o(){return i()}var r=n.normalIconSize||[27,27],u=n.normalIconAnchor||[13,27],f=n.normalPopupAnchor||[0,-27],t=new cityWay.LeafNode($.extend(n,{className:cityWay.consts.map.css.roadNode,normalIconSize:r,normalIconAnchor:u,normalPopupAnchor:f}));return t.id=n.id||0,t.pointType=cityWay.pointType.roadLink,t.number=n.number||0,t._initializePopup({templateUri:t.map.context[cityWay.consts.map.templates.roadlinkPopupKey],popupContent:new cityWay.Lazy(function(){return new cityWay.RoadLinkPopupContent(t)}),onPopupClose:e}),t.getId=i,t.getValue=o,t};cityWay.AddressNode=function(n){"use strict";var t=new cityWay.RoadLinkNode(n);return t.pointType=cityWay.pointType.address,t}});$(function(){cityWay.PopupContent=function(n){"use strict";var t=this;return t.owner=n,t.id=0,t.pointType=0,t.latitude=0,t.longitude=0,t.isBusy=ko.observable(!1),t.title=ko.observable(""),t.titleIcon=ko.observable(""),t.titleIconVisible=ko.observable(!1),t.name=ko.observable(""),t.locality=ko.observable(""),t.localityId=ko.observable(""),t.streetViewUrl=ko.observable(""),t.streetViewImageUrl=ko.observable(""),t};cityWay.NodePopupContent=function(n){var t=new cityWay.PopupContent(n);return t.value="",t.id=n.id,t.pointType=n.pointType,t.latitude=n.latitude,t.longitude=n.longitude,t.titleIconVisible=ko.computed(function(){return!n.isNormalNode()}),t.actionBarVisible=ko.computed(function(){return!0}),t.fromViaToButtonsVisible=ko.computed(function(){return!n.isDepartureNode()&&!n.isViaNode()&&!n.isArrivalNode()}),t.titleIcon=ko.computed(function(){return n.className().replace("picto-map","")}),t.isSelectedNode=ko.computed(function(){return n.isSelectedNode()}),t};cityWay.StopPopupContent=function(n){function i(n,i,r,u){if(!t.associatedLines.length){t.isBusy(!0);var f=t.owner.map.globals[cityWay.consts.map.globals.selectedDate];cityWay.mapDataService.getLinesForStop(n,i,f).then(function(n){var u,i;if(n.Data){u=[];for(i in n.Data)u.push({id:n.Data[i].Id,name:n.Data[i].Name,number:n.Data[i].Number,pictogram:n.Data[i].Pictogram,transportIconClass:ko.observable(n.Data[i].TransportMode.Image),transportLabel:n.Data[i].TransportMode.Label,isDisrupted:n.Data[i].IsDisrupted,isDisruptedTitle:cityWay.texts.map.Label_LineDisrupted.format(n.Data[i].Number),disruptedUrl:!n.Data[i].DisruptedUrl?"":n.Data[i].DisruptedUrl,isWhiteLabelMode:n.Data[i].IsWhiteLabelMode,partnerId:!n.Data[i].Partner?0:n.Data[i].Partner.Id,partnerName:!n.Data[i].Partner?"":n.Data[i].Partner.ShortName});t.associatedLines(u);t.name(r||"")}}).always(function(){t.isBusy(!1);u&&u.getPopup()&&u.getPopup().update()})}}var t=new cityWay.NodePopupContent(n);return t.streetViewUrl=n.streetViewUrl,t.name(n.name),t.locality(n.locality),t.localityId(n.localityId),t.value=n.logicalId+"_"+cityWay.pointType.logicalStop,t.title=ko.computed(function(){return n.isDepartureNode()?cityWay.texts.map.Title_Departure+" - "+cityWay.texts.map.Title_Stop:n.isViaNode()?cityWay.texts.map.Title_Via+" - "+cityWay.texts.map.Title_Stop:n.isArrivalNode()?cityWay.texts.map.Title_Arrival+" - "+cityWay.texts.map.Title_Stop:cityWay.texts.map.Title_Stop}),t.associatedLines=ko.observableArray([]),t.fillAssociatedLines=i,t};cityWay.PlaceOfInterestPopupContent=function(n){var t=new cityWay.NodePopupContent(n);return t.title=ko.computed(function(){return n.isDepartureNode()?cityWay.texts.map.Title_Departure+" - "+n.categoryName:n.isViaNode()?cityWay.texts.map.Title_Via+" - "+n.categoryName:n.isArrivalNode()?cityWay.texts.map.Title_Arrival+" - "+n.categoryName:n.categoryName}),t.name(n.name),t.locality(n.locality),t.localityId(n.localityId),t.streetViewUrl=n.streetViewUrl,t.category=n.category,t.value=n.id+"_"+cityWay.pointType.poi,t.titleIconVisible=ko.computed(function(){return!0}),t};cityWay.RoadLinkPopupContent=function(n){var t=new cityWay.NodePopupContent(n);return t.title=ko.computed(function(){return n.isDepartureNode()?cityWay.texts.map.Title_Departure+" - "+cityWay.texts.map.Title_Address:n.isViaNode()?cityWay.texts.map.Title_Via+" - "+cityWay.texts.map.Title_Address:n.isArrivalNode()?cityWay.texts.map.Title_Arrival+" - "+cityWay.texts.map.Title_Address:cityWay.texts.map.Title_Address}),n.number!=null&&n.number>0?t.name(n.number+cityWay.texts.map.AddressNumber_Separator+n.name):t.name(n.name),t.locality(n.locality),t.localityId(n.localityId),t.streetViewUrl=n.streetViewUrl,t.value=n.id+"_"+n.pointType,t};cityWay.ItineraryPortionPopupContent=function(n,t){function r(){var r=t.selectedDate;i.title(n.label);i.titleIcon(n.icon);i.streetViewUrl(n.streetViewUrl());i.streetViewImageUrl(n.streetViewImageUrl());i.isPublicTransport&&is.not.null(t.line)&&is.not.undefined(t.line)?(i.publicTransportInfo({isDisrupted:t.line.IsDisrupted,isDisruptedTitle:cityWay.texts.map.Label_LineDisrupted.format(t.line.Number),disruptedUrl:t.line.DisruptedUrl,number:t.line.Number,name:t.line.Name,partnerName:t.line.PartnerName,destination:t.destination}),n.popup&&n.popup.update()):i.isPublicTransport&&t.lineId&&cityWay.mapDataService.getPTLineInfo(t.lineId,t.vehicleJourneyId,r).then(function(n){n.Data&&i.publicTransportInfo({isDisrupted:n.Data.IsDisrupted,isDisruptedTitle:cityWay.texts.map.Label_LineDisrupted.format(n.Data.Number),disruptedUrl:n.Data.DisruptedUrl,number:n.Data.Number,name:n.Data.Name,partnerName:n.Data.PartnerName,destination:n.Data.Destination})}).always(function(){n.popup&&n.popup.update()})}var i=new cityWay.PopupContent(n);return i.isPublicTransport=t.isPublicTransport,i.publicTransportInfo=ko.observable({}),i.load=r,i};cityWay.MyLocationPopupContent=function(n){var t=new cityWay.NodePopupContent(n);return t.title=ko.computed(function(){return n.isDepartureNode()?cityWay.texts.map.Title_Departure+" - "+cityWay.texts.map.MyLocation:n.isViaNode()?cityWay.texts.map.Title_Via+" - "+cityWay.texts.map.MyLocation:n.isArrivalNode()?cityWay.texts.map.Title_Arrival+" - "+cityWay.texts.map.MyLocation:cityWay.texts.map.MyLocation}),t.name(cityWay.texts.map.MyLocation),t.titleIconVisible=ko.computed(function(){return!0}),t};cityWay.TrafficPopupContent=function(n){var t=new cityWay.NodePopupContent(n);return t.title=ko.computed(function(){return"title"}),t.name(n.name),t.locality(n.locality),t.localityId(n.localityId),t.value=n.getId(),t.description=ko.observable(n.description()),t.titleIconVisible=ko.computed(function(){return!0}),t};cityWay.TrafficWebcamPopupContent=function(n){var t=new cityWay.TrafficPopupContent(n);t.children=window.ko.observableArray(n.children()||[]);var i=function(n){n.imageVisible(!1);n.imageErrorMessageVisible(!0)},u=function(){Enumerable.From(t.children()).ForEach(function(n){$.ajax(n.imageUrl(),{async:!1,cache:!1,headers:{wlCode:sessionStorage.getItem("wlCode")},error:function(){i(n)},success:function(t,r,u){if(u.responseText.substring(0,1)=="<")i(n);else{var f=n.imageUrl();f.indexOf("?")===-1?f+="?_="+ +new Date:f=f.substring(0,f.indexOf("?"))+"?_="+ +new Date;n.imageUrl(f);n.imageVisible(!0);n.imageErrorMessageVisible(!1)}}});cityWay.mapDataService.activateCameras([n.id])})},r=null;return t.activate=function(){cityWay.mapDataService.activateCameras(Enumerable.From(t.children()).Select(function(n){return n.id}).ToArray()).then(function(n){n.Data?r=setInterval(u,cityWay.config.map.TrafficInfo.Traffic.CameraRefreshTime):Enumerable.From(t.children()).ForEach(function(n){i(n)})})},t.desactivate=function(){!r||clearInterval(r)},t};cityWay.ParkingPopupContent=function(n){function i(n,i){cityWay.mapDataService.getParkingAvailabilities(n.toISOString(),i).then(function(n){var r,u;n.Data&&(r=Enumerable.From(n.Data).Where(function(n){return n.PlaceId==i}).FirstOrDefault(),!r||(t.bikeCapacity(r.BikeCapacity),t.carCapacity(r.CarCapacity),t.motorbikeCapacity(r.MotorbikeCapacity),t.freeSpots(r.FreePlaces),t.sourceTime(r.SourceTimeFormatted),t.recordedTime(r.RecordedAtTimeFormatted),t.hasData(r.HasData),!r.ParkingStatus||(u=r.ParkingStatus.toLowerCase(),u=="open"?t.status(cityWay.texts.map.Label_Parking_Status_Open):u=="closed"&&(t.isClosed(!0),t.status(cityWay.texts.map.Label_Parking_Status_Closed)))))});cityWay.mapDataService.getParkingInfos(i).then(function(n){if(n.Data){var i=n.Data[0],r=cityWay.formatParkingInfos(i);t.openingPeriod(r);t.parkInfo(i.InfoPlace)}});cityWay.mapDataService.getParkingAddress(i).then(function(n){if(n.Data){var i=n.Data[0],r=i.Address+"<br />"+i.PostalCode;t.address(r)}})}var t=new cityWay.PlaceOfInterestPopupContent(n);return t.bikeCapacity=ko.observable(null),t.carCapacity=ko.observable(null),t.motorbikeCapacity=ko.observable(null),t.freeSpots=ko.observable(null),t.status=ko.observable(null),t.isClosed=ko.observable(!1),t.sourceTime=ko.observable(null),t.recordedTime=ko.observable(null),t.hasData=ko.observable(!1),t.address=ko.observable(null),t.parkInfo=ko.observable(null),t.openingPeriod=ko.observable(null),t.fillSpots=i,t};cityWay.BikePopupContent=function(n){function i(n,i){cityWay.mapDataService.getBikeStationAvailabilities(n.toISOString(),i).then(function(n){var r,u;n.Data&&(r=Enumerable.From(n.Data).Where(function(n){return n.PlaceId==i}).FirstOrDefault(),!r||(t.freeBikes(r.FreeBikes),t.freePlaces(r.FreePlaces),t.sourceTime(r.SourceTimeFormatted),t.recordedTime(r.RecordedAtTimeFormatted),t.hasData(r.HasData),!r.BikeStationStatus||(u=r.BikeStationStatus.toLowerCase(),u=="open"?t.status(cityWay.texts.map.Label_BikeStation_Status_Open):u=="closed"&&(t.isClosed(!0),t.status(cityWay.texts.map.Label_BikeStation_Status_Closed)))))})}var t=new cityWay.PlaceOfInterestPopupContent(n);return t.freeBikes=ko.observable(null),t.freePlaces=ko.observable(null),t.status=ko.observable(null),t.isClosed=ko.observable(!1),t.sourceTime=ko.observable(null),t.recordedTime=ko.observable(null),t.hasData=ko.observable(!1),t.fillSpots=i,t};cityWay.CarSharingPopupContent=function(n){function i(n,i){cityWay.mapDataService.getCarSharingAvailabilities(n.toISOString(),i).then(function(n){var r,u;n.Data&&(r=Enumerable.From(n.Data).Where(function(n){return n.PlaceId==i}).FirstOrDefault(),!r||(t.freeCars(r.FreeCars),t.freePlaces(r.FreePlaces),t.sourceTime(r.SourceTimeFormatted),t.recordedTime(r.RecordedAtTimeFormatted),t.hasData(r.HasData),!r.StationStatus||(u=r.StationStatus.toLowerCase(),u=="open"?t.status(cityWay.texts.map.Label_Station_Status_Open):u=="closed"&&(t.isClosed(!0),t.status(cityWay.texts.map.Label_Station_Status_Closed)))))})}var t=new cityWay.PlaceOfInterestPopupContent(n);return t.freeCars=ko.observable(null),t.freePlaces=ko.observable(null),t.status=ko.observable(null),t.isClosed=ko.observable(!1),t.sourceTime=ko.observable(null),t.recordedTime=ko.observable(null),t.hasData=ko.observable(!1),t.fillSpots=i,t};cityWay.DisruptPopupContent=function(n){var t=new cityWay.NodePopupContent(n);return t.title=ko.computed(function(){return n.categoryName}),t.name(n.name),t.description=ko.observable(n.description()),t.titleIconVisible=ko.computed(function(){return!0}),t};cityWay.EventPopupContent=function(n){var t=new cityWay.NodePopupContent(n);return t.title=n.category,t.streetViewUrl=n.streetViewUrl,t.name(n.name),t.description=ko.observable(n.description()),t.titleIconVisible=ko.computed(function(){return!0}),t.selectDepartureUrl=cityWay.config.urls.journeyPlannerDepByLatLng.replace("{lat}",n.latitude).replace("{lng}",n.longitude),t.selectViaUrl=cityWay.config.urls.journeyPlannerViaByLatLng.replace("{lat}",n.latitude).replace("{lng}",n.longitude),t.selectArrivalUrl=cityWay.config.urls.journeyPlannerArrByLatLng.replace("{lat}",n.latitude).replace("{lng}",n.longitude),t.selectNearByUrl=cityWay.config.urls.nearByLocate.replace("{sid}","166").replace("{lat}",n.latitude).replace("{lng}",n.longitude),t};cityWay.MyLocationPopupContent=function(n){var t=new cityWay.NodePopupContent(n);return t.title=ko.computed(function(){return n.isDepartureNode()?cityWay.texts.map.Title_Departure+" - "+cityWay.texts.common.MyLocation:n.isViaNode()?cityWay.texts.map.Title_Via+" - "+cityWay.texts.common.MyLocation:n.isArrivalNode()?cityWay.texts.map.Title_Arrival+" - "+cityWay.texts.common.MyLocation:cityWay.texts.common.MyLocation}),t.name(cityWay.texts.common.MyLocation),t.titleIconVisible=ko.computed(function(){return!0}),t}});$(function(){cityWay.Itinerary=function(n){"use strict";function f(n){t.push(n)}function e(n){t.remove(n)}function o(n){t(n)}function s(n){for(var i in t())t()[i].show();n&&n()}function h(){for(var n in t())t()[n].hide()}function c(){r.mapControl.fitBounds(L.featureGroup(Enumerable.From(i()).Select(function(n){return n.marker}).ToArray()))}if(!n.map&&!n.map.mapControl)throw new Error("The map component must be provided");var r=n.map,u=n.id,t=ko.observableArray([]),i=ko.computed(function(){return Enumerable.From(t()).SelectMany(function(n){return n.nodes}).ToArray()});return{id:u,portions:ko.computed(function(){return t()}),nodes:i,addPortion:f,removePortion:e,setPortions:o,show:s,hide:h,fitBounds:c}};cityWay.ItineraryPortion=function(n){"use strict";function nt(n){var t=n.latlng.lat+","+n.latlng.lng;d("https://maps.google.com/maps?q="+t+"&ll="+t+"&layer=c&cbll="+t+"&cbp=12,0,0,0,0");g("http://maps.googleapis.com/maps/api/streetview?size=600x300&location="+t+"&heading=151.78&pitch=-0.76&sensor=false");y||c().load()}function et(){var t=cityWay.helpers.templateHelper.getHtmlTemplate(ut),n=$(t)[0];h.setContent(n);h.update();ko.applyBindings({popupContent:c},n)}function ot(n){v||(u.mapControl.addLayer(f),u.mapControl.addLayer(o),s&&u.mapControl.addLayer(l),n&&n(),v=!0)}function st(){v&&(u.mapControl.removeLayer(f),u.mapControl.removeLayer(o),s&&u.mapControl.removeLayer(l),v=!1)}function ht(){s||(u.mapControl.addLayer(l),s=!0)}function ct(){s&&(u.mapControl.removeLayer(l),s=!1)}function lt(){u.mapControl.fitBounds(f.getBounds().concat(o.getBounds()))}var i,p,w;if(!n.map&&!n.map.mapControl)throw new Error("The map component must be provided");if((!n.points||n.points.length<2)&&!n.steps)throw new Error("The points composing the itinerary portion must be specified and they must be of number of two at least.");var t=this,u=n.map,tt=n.id,it=n.label||"",rt=n.nodes||[],e=n.points,r=n.steps||[],a=n.className||"map-itinerary",b=n.icon||"",k=n.data||{},y=n.disablePopup||!1,ut=n.templateUri||u.context[cityWay.consts.map.templates.portionPopupKey],v=!1,s=!1,h=L.popup(),d=ko.observable(""),g=ko.observable(""),c=ko.observable(new cityWay.ItineraryPortionPopupContent(t,k)),f=L.polyline([],{className:a}),o=L.geoJson([],{style:function(n){return{className:n.properties.style}}}),ft=cityWay.mapIconFactory.createDivIcon({className:b.replace("mode-transport","")+" "+a+"-marker map-itinerary-marker",iconSize:[32,32],iconAnchor:[16,16]}),l=L.marker([0,0],{icon:ft});h.setContent('<div style="margin: 20px"><img src="/Content/img/common/ajax-loader.gif" /><\/div>');y||(f.bindPopup(h,{offset:[0,0]}),o.bindPopup(h,{offset:[0,0]}));f.on("click",function(n){nt(n)});o.on("click",function(n){nt(n)});f.on("popupopen",function(){c().load()});o.on("popupopen",function(){c().load()});if(n.steps){e=[];for(i in r)p=a,r[i].Style!=null&&r[i].Style!=""&&(p=r[i].Style),r[i].Geometry?r[i].Geometry.forEach(function(n){var i={type:"Feature",properties:{style:p},geometry:n},t;o.addData(i);for(t in n.coordinates)e.push([n.coordinates[t][1],n.coordinates[t][0]])}):(f.addLatLng(r[i].Departure.Value),f.addLatLng(r[i].Arrival.Value),e.push(r[i].Departure.Value),e.push(r[i].Arrival.Value))}else for(i in e)f.addLatLng(e[i]);w=cityWay.helpers.geometryHelper.getEquiDistantMiddlePoint(e);w!=null&&l.setLatLng(w);y||et();t.id=tt;t.label=it;t.nodes=rt;t.points=e;t.steps=r;t.className=a;t.data=k;t.icon=b;t.streetViewUrl=d;t.streetViewImageUrl=g;t.show=ot;t.hide=st;t.showLabelMarker=ht;t.hideLabelMarker=ct;t.fitBounds=lt;t.popup=h;t.popupContent=c}});$(function(){cityWay.Map=function(n){"use strict";function ht(n,t,i){var r;return function(){var u=this,f=arguments,e=function(){r=null;i||n.apply(u,f)},o=i&&!r;clearTimeout(r);r=setTimeout(e,t);o&&n.apply(u,f)}}function ct(){var n,t;i.on("zoomanim",ht(i._onZoomTransitionEnd,250));i.on("click",yt);i.on("zoomend moveend",function(){var n=i.getBounds(),t=n.getNorth()+"-"+n.getSouth()+"-"+n.getWest()+"-"+n.getEast();g(t)});i.on("zoomend",wt);if(!!i.zoomControl){if(!!i.zoomControl._zoomInButton)$(i.zoomControl._zoomInButton).on("keydown",function(n){(n.keyCode==cityWay.keys.enter||n.which==cityWay.keys.enter)&&setTimeout(function(){i.zoomControl._zoomInButton.focus()},200)});if(!!i.zoomControl._zoomOutButton)$(i.zoomControl._zoomOutButton).on("keydown",function(n){(n.keyCode==cityWay.keys.enter||n.which==cityWay.keys.enter)&&setTimeout(function(){i.zoomControl._zoomOutButton.focus()},200)})}g.subscribe(pt);r.subscribe(function(t){n=t.slice(0)},null,"beforeChange");r.subscribe(function(i){Enumerable.From(n).Except(i).ForEach(function(n){setTimeout(function(){n.hide();n.dispose()})});Enumerable.From(i).Except(n).ForEach(function(n){setTimeout(function(){a.build().isSatisfiedBy(n)&&n.show()})});n=null;t=null});v.subscribe(function(n){n&&n._internalSetNormalNode()},null,"beforeChange");v.subscribe(function(n){n&&n._internalSetSelectedNode()});y.subscribe(function(n){n&&n.marker._icon!=null&&n.marker._icon.classList.contains(cityWay.consts.map.css.focusNode)&&n.marker._icon.classList.remove(cityWay.consts.map.css.focusNode)},null,"beforeChange");y.subscribe(function(n){n&&(n.marker._icon.classList.contains(cityWay.consts.map.css.focusNode)||n.marker._icon.classList.add(cityWay.consts.map.css.focusNode))});p.subscribe(function(n){n&&n._internalSetNormalNode()},null,"beforeChange");p.subscribe(function(n){n&&n._internalSetDepartureNode()});w.subscribe(function(n){n&&n._internalSetNormalNode()},null,"beforeChange");w.subscribe(function(n){n&&n._internalSetViaNode()});b.subscribe(function(n){n&&n._internalSetNormalNode()},null,"beforeChange");b.subscribe(function(n){n&&n._internalSetArrivalNode()});f.subscribe(function(n){t=n.slice(0)},null,"beforeChange");f.subscribe(function(n){Enumerable.From(t).Except(n).ForEach(function(n){setTimeout(function(){n.hide()})});Enumerable.From(n).Except(t).ForEach(function(n){setTimeout(function(){n.show()})})})}function lt(n){var i=window.L.map(n,{center:new window.L.LatLng(u.centerLatitude,u.centerLongitude),zoom:u.zoom}),t,r;return $(function(){$("#"+n).wrap("<div id='"+n+"_wrapper'><\/div>")}),u.centerLatitude===0&&u.centerLongitude===0&&i.locate({setView:!0,maxZoom:10}),t=null,r=u.layers[0],tt&&(t=$.cookie(it)),is.not.null(t)&&is.not.undefined(t)&&is.inArray(t,u.layers)?s(t,i):s(r,i),window.L.control.fullscreen({title:cityWay.texts.map.Label_FullScreen}).addTo(i),k(!1),i}function at(n,t){var i=Enumerable.From(r()).Where(function(n){return n.isLocked()}).ToArray(),u,f;t?r(i.concat(n)):(u=Enumerable.From(r()).Join(n,function(n){return n.getId()},function(n){return n.getId()},function(n){return n}).ToArray(),f=Enumerable.From(n).Except(r(),function(n){return n.getId()}).ToArray(),r(i.concat(u).concat(f)))}function rt(){Enumerable.From(r()).ForEach(function(n){a.build().isSatisfiedBy(n)?setTimeout(function(){n.show()}):setTimeout(function(){n.hide()});n._internalOptimizeDOM()})}function vt(){cityWay.eventManager.publish(cityWay.events.map.initialized,t)}function yt(n){cityWay.eventManager.publish(cityWay.events.map.clicked,t,n)}function pt(){rt();cityWay.eventManager.publish(cityWay.events.map.boundsChanged,t)}function wt(){$("#"+l).removeClass("zoom"+nt);$("#"+l).addClass("zoom"+i.getZoom());nt=i.getZoom();cityWay.eventManager.publish(cityWay.events.map.zoomChanged,t)}function bt(n){f.push(n)}function kt(n){f.remove(n)}function dt(n){f(n)}function gt(n,t){at(n,t)}function ni(n){return Enumerable.From(r()).FirstOrDefault(null,function(t){return t.getId()===n})}function ti(n,t){return Enumerable.From(r()).FirstOrDefault(undefined,function(i){return i.id===n&&i.pointType===t})}function ii(n){r.push(n)}function ri(n){r.remove(n)}function ut(){rt();i.invalidateSize()}function ui(){return i.getBounds()}function ft(n,t){var u,f;ut();!!t&&$.isArray(t)&&t.length>0?i.fitBounds(t,{maxZoom:n||14}):(u=r(),u.length==1&&u[0].type=="clusterNode"&&(u=u[0].nodes()),f=window.L.featureGroup(Enumerable.From(u).Select("$.marker").Where(function(n){return!!n}).ToArray()),i.fitBounds(f.getBounds(),{maxZoom:n||14}))}function fi(){r().length>0?ft():i.setView([u.centerLatitude,u.centerLongitude],u.zoom)}function ei(n,t,i){n in e||(e[n]=t,i||t.enable())}function oi(n){var t=e[n];t&&(t.disable(),delete e[n])}function si(n){return!e[n]?!1:e[n].isEnabled()}function hi(n){c(n);h("alert-success");o(!0)}function ci(n){c(n);h("alert-info");o(!0)}function li(n){c(n);h("alert-warning");o(!0)}function ai(n){c(n);h("alert-danger");o(!0)}function vi(){o(!1)}function yi(){var n=Enumerable.From(r()).Where(function(n){return n.type==="leafNode"}).ToArray(),t=Enumerable.From(r()).Where(function(n){return n.type==="clusterNode"}).SelectMany(function(n){return n.nodes()}).ToArray();return t.concat(n)}function s(n,t){var i,r,u,f,e;if(n.indexOf("mapbox")==0)u=cityWay.config.map.mapBoxLayer[n],r=u.name,f='&copy; <a href="http://mapbox.com">Mapbox<\/a>',e="https://api.mapbox.com/styles/v1/mapbox/"+u.tiles+"/tiles/256/{z}/{x}/{y}?access_token="+u.key,i=new window.L.tileLayer(e,{attribution:f,isLayerMap:!0});else switch(n){case"bing-route":r=cityWay.texts.map.Layer_Bing_Roads;i=new window.L.BingLayer(cityWay.config.map.key.Bing,{type:"Road"});break;case"bing-aerial":r=cityWay.texts.map.Layer_Bing_Aerial;i=new window.L.BingLayer(cityWay.config.map.key.Bing,{type:"Aerial"});break;case"osm":r=cityWay.texts.map.Layer_OpenStreetMap;i=new window.L.tileLayer(cityWay.config.map.osmUrl,{attribution:'&copy; <a href="http://osm.org/copyright">OpenStreetMap<\/a> contributors',isLayerMap:!0});break;case"google-hybrid":d=!0;r=cityWay.texts.map.Layer_Google_Hybrid;i=new window.L.Google("HYBRID");break;case"google-satellite":d=!0;r=cityWay.texts.map.Layer_Google_Satellite;i=new window.L.Google("SATELLITE");break;case"trafficinfo":i=new window.L.tileLayer(cityWay.config.map.TrafficInfo.MapLayer.Url+"?app_id={app_id}&app_code={app_code}",{attribution:'Map &copy; 1987-2014 <a href="http://developer.here.com">HERE<\/a>',subdomains:"1234",mapID:"newest",app_id:cityWay.config.map.TrafficInfo.MapLayer.Id,app_code:cityWay.config.map.TrafficInfo.MapLayer.Code,base:"traffic",scheme:cityWay.config.map.TrafficInfo.MapLayer.Scheme,maxZoom:20,isLayerMap:!0});r=cityWay.texts.map.Layer_TrafficInfo;break;default:r=cityWay.texts.map.Layer_Google_Roads;i=new window.L.Google("ROADMAP")}is.not.null(i)&&is.not.undefined(i)&&(t.eachLayer(function(n){is.not.null(n.options.isLayerMap)&&is.not.undefined(n.options.isLayerMap)&&n.options.isLayerMap&&t.removeLayer(n)}),t.addLayer(i));tt&&n!="trafficinfo"&&$.cookie(it,n,{path:"/"});$("input",r).click();$("[data-select-map]").removeClass("active");$("[data-select-map='"+n+"']").addClass("active")}function pi(){k(!0);i.scrollWheelZoom.disable();i.dragging.disable();i.touchZoom.disable();i.doubleClickZoom.disable();i.boxZoom.disable();i.keyboard.disable();i.tap&&i.tap.disable()}function wi(){i.locate({setView:!0,maxZoom:15});i.on("locationfound",function(n){i.setZoom(15);n.stopPropagation()});i.on("locationerror",function(n){alert(cityWay.texts.error.Geolocation_PermissionDenied);n.stopPropagation()})}if(!n.mapId)throw new Error("Map id must be specified");var t=this,l=n.mapId||"",et=window.ko.observable(!1),f=window.ko.observableArray([]),r=window.ko.observableArray([]),ot=window.ko.computed(function(){return r().length>0}),a=new cityWay.MapSpecificationBuilder(t),v=window.ko.observable(),y=window.ko.observable(),p=window.ko.observable(),w=window.ko.observable(),b=window.ko.observable(),g=window.ko.observable("-").extend({rateLimit:{method:"notifyWhenChangesStop",timeout:200}}),o=ko.observable(!1),st=ko.computed(function(){return o()}),h=ko.observable("alert-info"),c=ko.observable(""),k=ko.observable(!1),nt=0,d=!1,tt=n.rememberLayer||!0,it=cityWay.consts.map.cookies.rememberLayer,e={},u={centerLatitude:n.mapCenter&&n.mapCenter.latitude||cityWay.config.map.Center.Latitude,centerLongitude:n.mapCenter&&n.mapCenter.longitude||cityWay.config.map.Center.Longitude,zoom:n.mapZoom||cityWay.config.map.Center.Zoom,layers:cityWay.config.map.Layers||["Bing","OpenStreetMap","Google"]},i=lt(l);ct();$("[data-select-map]").on("click",function(){var n=$(this).data("select-map"),t="//maps.google.com/maps/api/js?key="+cityWay.config.map.key.Google;n.indexOf("google")==0?d?(s(n,i),$(".select-map").addClass("hidden")):$.getScript(t).done(function(){s(n,i);$(".select-map").addClass("hidden")}).fail(function(){}):(s(n,i),$(".select-map").addClass("hidden"))});return t.context={},t.globals={},t.isBusy=et,t.mapId=l,t.mapConfig=u,t.mapControl=i,t.hasNodes=ot,t.nodes=window.ko.computed(function(){return r()}),t.flatNodes=window.ko.computed(yi),t.itineraries=window.ko.computed(function(){return f()}),t.addNode=ii,t.removeNode=ri,t.setNodes=gt,t.getNode=ni,t.getNodeByIdAndType=ti,t.addItinerary=bt,t.removeItinerary=kt,t.setItineraries=dt,t.fitBounds=ft,t.getBounds=ui,t.redrawMap=ut,t.setLayer=s,t.resetMapView=fi,t.behaviors=e,t.attachBehavior=ei,t.detachBehavior=oi,t.isBehaviorEnabled=si,t.currentSelectedNode=v,t.currentFocusSelectedNode=y,t.currentDepartureNode=p,t.currentViaNode=w,t.currentArrivalNode=b,t.message=c,t.messageVisible=st,t.messageType=h,t.showSuccessMessage=hi,t.showInfoMessage=ci,t.showWarningMessage=li,t.showErrorMessage=ai,t.hideMessage=vi,t._internalNodes=r,t._internalItineraries=f,t._nodeVisibilitySpecBuilder=a,t.isLocked=k,t.lock=pi,t.geoLocationUser=wi,vt(),t}});$(function(){cityWay.MapSpecification=function(){"use strict";var n=this;return n.isSatisfiedBy=function(){return!0},n.and=function(t){return new cityWay.AndSpecification(n,t)},n.or=function(t){return new cityWay.OrSpecification(n,t)},n.not=function(){return new cityWay.NotSpecification(n)},n};cityWay.AndSpecification=function(n,t){var i=new cityWay.MapSpecification;return i.isSatisfiedBy=function(i){return n.isSatisfiedBy(i)&&t.isSatisfiedBy(i)},i};cityWay.OrSpecification=function(n,t){var i=new cityWay.MapSpecification;return i.isSatisfiedBy=function(i){return n.isSatisfiedBy(i)||t.isSatisfiedBy(i)},i};cityWay.NotSpecification=function(n){var t=new cityWay.MapSpecification;return t.isSatisfiedBy=function(t){return!n.isSatisfiedBy(t)},t};cityWay.MapSpecificationBuilder=function(){var n=[],t=this;return t.addSpecification=function(t,i,r){if(!r||r.toLowerCase()!=="and"&&r.toLowerCase()!=="or"&&r.toLowerCase()!=="not")throw new Error("Operator must be specified, permitted values are 'and', 'or', 'not'");n.push({id:t,instance:i,operator:r})},t.removeSpecification=function(t){var i=Enumerable.From(n).FirstOrDefault(null,function(n){return n.id===t});i&&n.splice(n.indexOf(i),1)},t.build=function(){var t=new cityWay.MapSpecification;return Enumerable.From(n).ForEach(function(n){n.operator?(n.operator.toLowerCase()==="and"&&(t=t.and(n.instance)),n.operator.toLowerCase()==="or"&&(t=t.or(n.instance)),n.operator.toLowerCase()==="not"&&(t=t.not(n.instance))):t=n.instance}),t},t}});$(function(){cityWay.TrafficInfoLayer=function(n){"use strict";if(!n.url)throw Error("url must be specified");if(!n.name)throw Error("name must be specified");var t=this;return t.url=n.url||"",t.name=n.name||"",t.format=n.format||"image/png",t.transparent=n.transparent||!0,t.autoRefresh=n.autoRefresh||!0,t._layer=null,t}});$(function(){cityWay.TrafficNode=function(n){"use strict";function f(){cityWay.eventManager.publish(cityWay.events.map.trafficInfoItemPopupOpened,t)}function e(){return t.id+"_"+t.itemType}function o(){return t.itemType}var r=n.normalIconAnchor||[13,30],u=n.normalPopupAnchor||[1,-30],t=new cityWay.LeafNode($.extend(n,{className:cityWay.consts.map.css.trafficNode+n.className,normalIconAnchor:r,normalPopupAnchor:u})),i;return t.id=n.id||0,t.description=window.ko.observable(n.description||""),t.children=window.ko.observableArray(n.children||[]),t.itemType=n.itemType,t.zIndex=n.zIndex||1,t.minZoom=n.minZoom||null,i=new cityWay.Lazy(function(){return new cityWay.TrafficPopupContent(t)}),t._initializePopup({templateUri:t.map.context[cityWay.consts.map.templates.trafficPopupKey],popupContent:i,onPopupOpen:f}),t.itemSelected=function(n){var r=n.getId(),i=this;i.openPopupWhenReady=function(){setTimeout(function(){n.openPopup()},1e3);setTimeout(function(){var n=Enumerable.From(t.map.flatNodes()).Where(function(n){return n.getId()==r}).FirstOrDefault(undefined);!n||n.openPopup()},3e3);t.map.mapControl.off("moveend",i.openPopupWhenReady)};t.map.mapControl.on("moveend",i.openPopupWhenReady);n.fitBounds(12);setTimeout(function(){n.openPopup()},1e3)},t.getId=e,t.getItemType=o,t}});$(function(){cityWay.ParkingNode=function(n){"use strict";function r(){i.value.fillSpots(new Date,t.id)}var t=new cityWay.PoiNode(n),i=new cityWay.Lazy(function(){return new cityWay.ParkingPopupContent(t)});return t._initializePopup({templateUri:t.map.context[cityWay.consts.map.templates.parkingPopupKey],popupContent:i,onPopupOpen:r}),t}});$(function(){cityWay.BikeNode=function(n){"use strict";function r(){i.value.fillSpots(new Date,t.id)}var t=new cityWay.PoiNode(n),i=new cityWay.Lazy(function(){return new cityWay.BikePopupContent(t)});return t._initializePopup({templateUri:t.map.context[cityWay.consts.map.templates.bikePopupKey],popupContent:i,onPopupOpen:r}),t}});$(function(){cityWay.CarSharingNode=function(n){"use strict";function r(){i.value.fillSpots(new Date,t.id)}var t=new cityWay.PoiNode(n),i=new cityWay.Lazy(function(){return new cityWay.CarSharingPopupContent(t)});return t._initializePopup({templateUri:t.map.context[cityWay.consts.map.templates.carSharingPopupKey],popupContent:i,onPopupOpen:r}),t}});$(function(){cityWay.DisruptNode=function(n){"use strict";function e(){return t.id+"_"+t.itemType+(!t.category?"":"_"+t.category)}function o(){return t.itemType}var r=n.normalIconSize||[24,27],u=n.normalIconAnchor||[16,27],f=n.normalPopupAnchor||[1,-27],t=new cityWay.LeafNode($.extend(n,{className:cityWay.consts.map.css.disruptNode+cityWay.disruptionTypeReverse[n.className],normalIconSize:r,normalIconAnchor:u,normalPopupAnchor:f})),i;return t.id=n.id||0,t.description=window.ko.observable(n.description||""),t.itemType=cityWay.itemType.disrupt,t.category=n.category||0,t.categoryName=n.categoryName||cityWay.texts.disruption["Label_Disruption_Type_"+cityWay.disruptionTypeReverse[t.category]],i=new cityWay.Lazy(function(){return new cityWay.DisruptPopupContent(t)}),t._initializePopup({templateUri:t.map.context[cityWay.consts.map.templates.disruptPopupKey],popupContent:i}),t.getId=e,t.getItemType=o,t}});$(function(){cityWay.EventNode=function(n){"use strict";function e(){return t.id+"_"+t.itemType+(!t.categoryId?"":"_"+t.categoryId)}function o(){return t.itemType}var r=n.normalIconSize||[24,27],u=n.normalIconAnchor||[16,27],f=n.normalPopupAnchor||[1,-27],t=new cityWay.LeafNode($.extend(n,{className:cityWay.consts.map.css.eventNode+n.className,normalIconSize:r,normalIconAnchor:u,normalPopupAnchor:f})),i;return t.id=n.id||0,t.description=window.ko.observable(n.description||""),t.detailUrl="www.cityway.fr",t.itemType=cityWay.itemType.event,t.category=n.category||"",t.categoryId=n.categoryId||0,t.locality=n.locality,i=new cityWay.Lazy(function(){return new cityWay.EventPopupContent(t)}),t._initializePopup({templateUri:t.map.context[cityWay.consts.map.templates.eventPopupKey],popupContent:i}),t.getId=e,t.getItemType=o,t}});$(function(){cityWay.MyLocationNode=function(n){"use strict";var t=new cityWay.LeafNode(n),i;return t.pointType=cityWay.pointType.myPosition,i=new cityWay.Lazy(function(){return new cityWay.MyLocationPopupContent(t)}),t._initializePopup({templateUri:t.map.context[cityWay.consts.map.templates.myLocationPopupKey],popupContent:i}),t}});$(function(){cityWay.TrafficCameraNode=function(n){"use strict";function u(){i.value.activate()}function f(){i.value.desactivate()}var r=n.className,t=new cityWay.TrafficNode(n),i;return t.imageUrl=window.ko.observable(r),t.imageVisible=window.ko.observable(!1),t.imageErrorMessageVisible=window.ko.observable(!1),i=new cityWay.Lazy(function(){return new cityWay.TrafficWebcamPopupContent(t)}),t._initializePopup({templateUri:t.map.context[cityWay.consts.map.templates.trafficWebcamPopupKey],popupContent:i,onPopupOpen:u,onPopupClose:f}),t}});$(function(){cityWay.MapContext=function(){var n=this;return n.setup=function(){var t=n;return t[cityWay.consts.map.templates.defaultPopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/default-popup-template.html",t[cityWay.consts.map.templates.poiPopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/default/poi-popup.template.html",t[cityWay.consts.map.templates.portionPopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/default/portion-popup.template.html",t[cityWay.consts.map.templates.roadlinkPopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/default/roadlink-popup.template.html",t[cityWay.consts.map.templates.stopPopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/default/stop-popup.template.html",t[cityWay.consts.map.templates.trafficPopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/default/traffic-popup.template.html",t[cityWay.consts.map.templates.trafficWebcamPopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/default/trafficwebcam-popup.template.html",t[cityWay.consts.map.templates.bikePopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/default/bike-popup.template.html",t[cityWay.consts.map.templates.parkingPopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/default/parking-popup.template.html",t[cityWay.consts.map.templates.carSharingPopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/default/carsharing-popup.template.html",t[cityWay.consts.map.templates.disruptPopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/default/disrupt-popup.template.html",t[cityWay.consts.map.templates.eventPopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/default/event-popup.template.html",t[cityWay.consts.map.templates.myLocationPopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/default/mylocation-popup.template.html",t},n};cityWay.DefaultMapContext=function(){var n=new cityWay.MapContext,t=n.setup;return n.setup=function(n,i){var u=t(),f=i&&i.templateLegendPath!=null?i.templateLegendPath:null,e=i&&i.templatePreferencesPath!=null?i.templatePreferencesPath:null,r;return n.behaviors[cityWay.SelectionRangeBehavior.id].disable(),n.behaviors[cityWay.LegendCheckableBehavior.id].enable(),n.behaviors[cityWay.LegendBehavior.id].view(cityWay.DefaultLegendView(n,{templateUri:f})),n.behaviors[cityWay.LegendBehavior.id].enable(),r=[cityWay.SelectionRangeMenuItem(n)],cityWay.config.sections.isJourneyPlannerEnabled&&(r.push(cityWay.LabelMenuItem(n,{text:cityWay.texts.site.Title_Itinerary})),r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectDep,url:cityWay.config.urls.journeyPlannerDep})),cityWay.config.map.JourneyPlanner.disableVia||r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectVia,url:cityWay.config.urls.journeyPlannerVia})),r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectArr,url:cityWay.config.urls.journeyPlannerArr}))),cityWay.config.sections.isNearByEnabled&&r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectNearBy,url:cityWay.config.urls.nearBy})),n.behaviors[cityWay.ContextMenuBehavior.id].items(r),n.behaviors[cityWay.ContextMenuBehavior.id].enable(),cityWay.config.map.Preferences.isEnabled&&(n.behaviors[cityWay.PreferencesBehavior.id].view(cityWay.DefaultPreferencesView(n,{templateUri:e})),n.behaviors[cityWay.PreferencesBehavior.id].enable()),u},n};cityWay.JourneyPlannerSelectionMapContext=function(){var n=new cityWay.MapContext,t=n.setup;return n.setup=function(n,i){var f=t(),e=i&&i.templateLegendPath!=null?i.templateLegendPath:null,o=i&&i.templatePreferencesPath!=null?i.templatePreferencesPath:null,u,r;return n.behaviors[cityWay.FilterItemsVisibilityByZoomBehavior.id].enable(),n.behaviors[cityWay.SelectionRangeBehavior.id].disable(),n.behaviors[cityWay.LegendCheckableBehavior.id].enable(),n.behaviors[cityWay.LegendBehavior.id].view(cityWay.DefaultLegendView(n,{topPartVisible:cityWay.config.sections.isJourneyPlannerEnabled,bottomPartVisible:!1,templateUri:e})),n.behaviors[cityWay.LegendBehavior.id].enable(),u=function(n,t){return function(i,r,u){r.hide();r.dispose();i._internalNodes.remove(function(n){return n.getId()==r.getId()});cityWay.eventManager.publish(cityWay.events.map[t+"Selected"],r,r.name,r.locality,r.getId(),r.localityId);cityWay.eventManager.publish(cityWay.events.journeyPlanner.searchFormChanged,"Keyword"+n,u,u.Number)}},r=[cityWay.SelectionRangeMenuItem(n)],cityWay.config.sections.isJourneyPlannerEnabled&&(r.push(cityWay.LabelMenuItem(n,{text:cityWay.texts.site.Title_Itinerary})),r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectDep,foundCallback:u("Dep","departure")})),cityWay.config.map.JourneyPlanner.disableVia||r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectVia,foundCallback:u("Via","via")})),r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectArr,foundCallback:u("Arr","arrival")}))),cityWay.config.sections.isNearByEnabled&&r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectNearBy,url:cityWay.config.urls.nearBy})),n.behaviors[cityWay.ContextMenuBehavior.id].items(r),n.behaviors[cityWay.ContextMenuBehavior.id].enable(),cityWay.config.map.Preferences.isEnabled&&(n.behaviors[cityWay.PreferencesBehavior.id].view(cityWay.DefaultPreferencesView(n,{templateUri:o})),n.behaviors[cityWay.PreferencesBehavior.id].enable()),f},n};cityWay.JourneyPlannerResultMapContext=function(){var n=new cityWay.MapContext,t=n.setup;return n.setup=function(n,i){var f=t(),e=i&&i.templateLegendPath!=null?i.templateLegendPath:null,o=i&&i.templatePreferencesPath!=null?i.templatePreferencesPath:null,s=!!(i&&i.isPrint),u,r;return n.behaviors[cityWay.SelectionRangeBehavior.id].disable(),n.behaviors[cityWay.LegendCheckableBehavior.id].disable(),n.behaviors[cityWay.LegendBehavior.id].view(cityWay.DefaultLegendView(n,{useStaticDisplay:!1,templateUri:e})),n.behaviors[cityWay.LegendBehavior.id].enable(),n.behaviors[cityWay.LineMarkerVisibilityBehavior.id].enable(),u=function(n,t){return function(i,r,u){r.hide();r.dispose();i._internalNodes.remove(function(n){return n.getId()==r.getId()});cityWay.eventManager.publish(cityWay.events.map[t+"Selected"],r,r.name,r.locality,r.getId(),r.localityId);cityWay.eventManager.publish(cityWay.events.journeyPlanner.searchFormChanged,"Keyword"+n,u,u.Number)}},r=[cityWay.SelectionRangeMenuItem(n)],cityWay.config.sections.isJourneyPlannerEnabled&&(r.push(cityWay.LabelMenuItem(n,{text:cityWay.texts.site.Title_Itinerary})),r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectDep,foundCallback:u("Dep","departure")})),cityWay.config.map.JourneyPlanner.disableVia||r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectVia,foundCallback:u("Via","via")})),r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectArr,foundCallback:u("Arr","arrival")}))),cityWay.config.sections.isNearByEnabled&&r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectNearBy,url:cityWay.config.urls.nearBy})),n.behaviors[cityWay.ContextMenuBehavior.id].items(r),n.behaviors[cityWay.ContextMenuBehavior.id].enable(),!s&&cityWay.config.map.Preferences.isEnabled&&(n.behaviors[cityWay.PreferencesBehavior.id].view(cityWay.DefaultPreferencesView(n,{templateUri:o})),n.behaviors[cityWay.PreferencesBehavior.id].enable()),f},n};cityWay.StopTimeTableMapContext=function(){var n=new cityWay.MapContext,t=n.setup;return n.setup=function(n,i){var u=t(),f=i&&i.templateLegendPath!=null?i.templateLegendPath:null,e=i&&i.templatePreferencesPath!=null?i.templatePreferencesPath:null,r;return n.behaviors[cityWay.SelectionRangeBehavior.id].disable(),n.behaviors[cityWay.LegendCheckableBehavior.id].enable(),n.behaviors[cityWay.LegendBehavior.id].view(cityWay.DefaultLegendView(n,{topPartVisible:!1,templateUri:f})),n.behaviors[cityWay.LegendBehavior.id].enable(),r=[cityWay.SelectionRangeMenuItem(n)],cityWay.config.sections.isJourneyPlannerEnabled&&(r.push(cityWay.LabelMenuItem(n,{text:cityWay.texts.site.Title_Itinerary})),r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectDep,url:cityWay.config.urls.journeyPlannerDep})),cityWay.config.map.JourneyPlanner.disableVia||r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectVia,url:cityWay.config.urls.journeyPlannerVia})),r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectArr,url:cityWay.config.urls.journeyPlannerArr}))),cityWay.config.sections.isNearByEnabled&&r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectNearBy,url:cityWay.config.urls.nearBy})),n.behaviors[cityWay.ContextMenuBehavior.id].items(r),n.behaviors[cityWay.ContextMenuBehavior.id].enable(),cityWay.config.map.Preferences.isEnabled&&(n.behaviors[cityWay.PreferencesBehavior.id].view(cityWay.DefaultPreferencesView(n,{templateUri:e})),n.behaviors[cityWay.PreferencesBehavior.id].enable()),u},n};cityWay.LineTimeTableMapContext=function(){var n=new cityWay.MapContext,t=n.setup;return n.setup=function(n,i){var f=t(),e=i&&i.templateLegendPath!=null?i.templateLegendPath:null,o=i&&i.templatePreferencesPath!=null?i.templatePreferencesPath:null,u,r;return n.behaviors[cityWay.SelectionRangeBehavior.id].disable(),n.behaviors[cityWay.LegendCheckableBehavior.id].enable(),u=new cityWay.DefaultLegendView(n,{topPartVisible:!1,middlePartVisible:!0,useStaticDisplay:!1,templateUri:e}),n.behaviors[cityWay.LegendBehavior.id].view(u),n.behaviors[cityWay.LegendBehavior.id].enable(),r=[cityWay.SelectionRangeMenuItem(n)],cityWay.config.sections.isJourneyPlannerEnabled&&(r.push(cityWay.LabelMenuItem(n,{text:cityWay.texts.site.Title_Itinerary})),r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectDep,url:cityWay.config.urls.journeyPlannerDep})),cityWay.config.map.JourneyPlanner.disableVia||r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectVia,url:cityWay.config.urls.journeyPlannerVia})),r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectArr,url:cityWay.config.urls.journeyPlannerArr}))),cityWay.config.sections.isNearByEnabled&&r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectNearBy,url:cityWay.config.urls.nearBy})),n.behaviors[cityWay.ContextMenuBehavior.id].items(r),n.behaviors[cityWay.ContextMenuBehavior.id].enable(),cityWay.config.map.Preferences.isEnabled&&(n.behaviors[cityWay.PreferencesBehavior.id].view(cityWay.DefaultPreferencesView(n,{templateUri:o})),n.behaviors[cityWay.PreferencesBehavior.id].enable()),f},n};cityWay.NearByMapContext=function(){var n=new cityWay.MapContext,t=n.setup;return n.setup=function(n,i){var u=t(),e=i&&i.templateLegendPath!=null?i.templateLegendPath:null,s=i&&i.templatePreferencesPath!=null?i.templatePreferencesPath:null,o=i&&i.categories||null,f,r;return n.behaviors[cityWay.FilterItemsVisibilityByCircleBoundsBehavior.id].enable(),n.behaviors[cityWay.SelectionRangeBehavior.id].disable(),n.behaviors[cityWay.LegendCheckableBehavior.id].enable(),o!=null?(f=new cityWay.DefaultLegendView(n,{topPartVisible:!1,templateUri:e,restricted:!0}),f.nodeLegendFilter=function(n){return n.pointType!=cityWay.pointType.poi||n.pointType===cityWay.pointType.poi&&Enumerable.From(o).Any(function(t){return t==n.pointCategory})},u[cityWay.consts.map.templates.poiPopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/nearbySpecific/poi-popup.template.html",u[cityWay.consts.map.templates.bikePopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/nearbySpecific/bike-popup.template.html",u[cityWay.consts.map.templates.carSharingPopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/nearbySpecific/carsharing-popup.template.html",u[cityWay.consts.map.templates.parkingPopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/nearbySpecific/parking-popup.template.html"):f=new cityWay.DefaultLegendView(n,{topPartVisible:!1,templateUri:e}),n.behaviors[cityWay.LegendBehavior.id].view(f),n.behaviors[cityWay.LegendBehavior.id].enable(),r=[cityWay.SelectionRangeMenuItem(n)],cityWay.config.sections.isJourneyPlannerEnabled&&(r.push(cityWay.LabelMenuItem(n,{text:cityWay.texts.site.Title_Itinerary})),r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectDep,url:cityWay.config.urls.journeyPlannerDep})),cityWay.config.map.JourneyPlanner.disableVia||r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectVia,url:cityWay.config.urls.journeyPlannerVia})),r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectArr,url:cityWay.config.urls.journeyPlannerArr}))),cityWay.config.sections.isNearByEnabled&&r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectNearBy,url:cityWay.config.urls.nearBy})),n.behaviors[cityWay.ContextMenuBehavior.id].items(r),n.behaviors[cityWay.ContextMenuBehavior.id].enable(),cityWay.config.map.Preferences.isEnabled&&(n.behaviors[cityWay.PreferencesBehavior.id].view(cityWay.DefaultPreferencesView(n,{templateUri:s})),n.behaviors[cityWay.PreferencesBehavior.id].enable()),u},n};cityWay.DirectTripMapContext=function(){var n=new cityWay.MapContext,t=n.setup;return n.setup=function(n,i){var r=t(),f=i&&i.templateLegendPath!=null?i.templateLegendPath:null,e=i&&i.templatePreferencesPath!=null?i.templatePreferencesPath:null,u;return r[cityWay.consts.map.templates.poiPopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/directTrip/poi-popup.template.html",r[cityWay.consts.map.templates.stopPopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/directTrip/stop-popup.template.html",n.behaviors[cityWay.FilterItemsVisibilityByCircleBoundsBehavior.id].disable(),n.behaviors[cityWay.LegendCheckableBehavior.id].enable(),u=new cityWay.DefaultLegendView(n,{topPartVisible:!1,bottomPartVisible:!1,templateUri:f}),u.nodeLegendFilter=function(n){return n.pointType===cityWay.pointType.physicalStop||n.pointType===cityWay.pointType.poi&&n.pointCategory===cityWay.poi.category.locality},n.behaviors[cityWay.LegendBehavior.id].view(u),n.behaviors[cityWay.LegendBehavior.id].enable(),cityWay.config.map.Preferences.isEnabled&&(n.behaviors[cityWay.PreferencesBehavior.id].view(cityWay.DefaultPreferencesView(n,{templateUri:e})),n.behaviors[cityWay.PreferencesBehavior.id].enable()),r},n};cityWay.LineTimeTablePoiMapContext=function(){var n=new cityWay.MapContext,t=n.setup;return n.setup=function(n,i){var r=t(),e=i&&i.templateLegendPath!=null?i.templateLegendPath:"/Cityway.TSI.Core/Embedded/Map/templates/legend/linespoi-legend-template.html",o=i&&i.templatePreferencesPath!=null?i.templatePreferencesPath:null,f=i&&i.categories||[],s=i&&i.disablePopulateBehaviour||!1,u;return r[cityWay.consts.map.templates.poiPopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/lineTimeTablePoi/poi-popup.template.html",r[cityWay.consts.map.templates.bikePopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/lineTimeTablePoi/poi-popup.template.html",r[cityWay.consts.map.templates.parkingPopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/lineTimeTablePoi/poi-popup.template.html",r[cityWay.consts.map.templates.carSharingPopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/lineTimeTablePoi/poi-popup.template.html",n.behaviors[cityWay.LegendCheckableBehavior.id].enable(),u=new cityWay.DefaultLegendView(n,{topPartVisible:!1,templateUri:e}),u.nodeLegendFilter=function(n){return n.pointType===cityWay.pointType.poi&&Enumerable.From(f).Any(function(t){return t==n.pointCategory})},n.behaviors[cityWay.LegendBehavior.id].view(u),n.behaviors[cityWay.LegendBehavior.id].enable(),n.attachBehavior(cityWay.PopulatePoiBoundingBoxBehavior.id,new cityWay.PopulatePoiBoundingBoxBehavior({map:n,categories:f}),s),cityWay.config.map.Preferences.isEnabled&&(n.behaviors[cityWay.PreferencesBehavior.id].view(cityWay.DefaultPreferencesView(n,{templateUri:o})),n.behaviors[cityWay.PreferencesBehavior.id].enable()),r},n};cityWay.EventMapContext=function(){var n=new cityWay.MapContext,t=n.setup;return n.setup=function(n,i){var r=t(),u=i&&i.templatePreferencesPath!=null?i.templatePreferencesPath:null,f=new cityWay.EventMapLegendView(n,{topPartVisible:!0,useStaticDisplay:!1});return n.behaviors[cityWay.LegendBehavior.id].view(f),n.behaviors[cityWay.LegendBehavior.id].enable(),n.behaviors[cityWay.LegendCheckableBehavior.id].enable(),cityWay.config.map.Preferences.isEnabled&&(n.behaviors[cityWay.PreferencesBehavior.id].view(cityWay.DefaultPreferencesView(n,{templateUri:u})),n.behaviors[cityWay.PreferencesBehavior.id].enable()),r},n};cityWay.LineTimeTablePoiResultMapContext=function(){var n=new cityWay.MapContext,t=n.setup;return n.setup=function(n,i){var r=t(),f=i&&i.templateLegendPath!=null?i.templateLegendPath:"/Cityway.TSI.Core/Embedded/Map/templates/legend/linespoi-legend-template.html",e=i&&i.templatePreferencesPath!=null?i.templatePreferencesPath:null,o=i&&i.categories||[],u;return r[cityWay.consts.map.templates.poiPopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/lineTimeTablePoi/poi-result-popup.template.html",r[cityWay.consts.map.templates.bikePopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/lineTimeTablePoi/poi-result-popup.template.html",r[cityWay.consts.map.templates.parkingPopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/lineTimeTablePoi/poi-result-popup.template.html",r[cityWay.consts.map.templates.carSharingPopupKey]="/Cityway.TSI.Core/Embedded/Map/templates/popup/lineTimeTablePoi/poi-popup.template.html",u=new cityWay.DefaultLegendView(n,{topPartVisible:!1,templateUri:f}),u.nodeLegendFilter=function(n){return n.pointType===cityWay.pointType.poi&&Enumerable.From(o).Any(function(t){return t==n.pointCategory})},n.behaviors[cityWay.LegendBehavior.id].view(u),n.behaviors[cityWay.LegendBehavior.id].enable(),n.behaviors[cityWay.LegendCheckableBehavior.id].disable(),cityWay.config.map.Preferences.isEnabled&&(n.behaviors[cityWay.PreferencesBehavior.id].view(cityWay.DefaultPreferencesView(n,{templateUri:e})),n.behaviors[cityWay.PreferencesBehavior.id].enable()),r},n};cityWay.TrafficInfoMapContext=function(){var n=new cityWay.MapContext,t=n.setup;return n.setup=function(n,i){var e=t(),o=i&&i.templateLegendPath!=null?i.templateLegendPath:null,s=i&&i.templatePreferencesPath!=null?i.templatePreferencesPath:null,h=i.startDate,c=i.endDate,u=i.autoRefresh||!0,l=i.hidePoi||!0,f,r;return n.behaviors[cityWay.LegendCheckableBehavior.id].enable(),f=new cityWay.TrafficInfoLegendView(n,{templateUri:o,context:cityWay.consts.map.context.trafficInfo}),n.behaviors[cityWay.LegendBehavior.id].view(f),n.behaviors[cityWay.LegendBehavior.id].enable(),n.behaviors[cityWay.ContextMenuBehavior.id].enable(),r=[cityWay.SelectionRangeMenuItem(n)],cityWay.config.sections.isJourneyPlannerEnabled&&(r.push(cityWay.LabelMenuItem(n,{text:cityWay.texts.site.Title_Itinerary})),r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectDep,url:cityWay.config.urls.journeyPlannerDep})),cityWay.config.map.JourneyPlanner.disableVia||r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectVia,url:cityWay.config.urls.journeyPlannerVia})),r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectArr,url:cityWay.config.urls.journeyPlannerArr}))),cityWay.config.sections.isNearByEnabled&&r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectNearBy,url:cityWay.config.urls.nearBy})),n.behaviors[cityWay.ContextMenuBehavior.id].items(r),cityWay.config.map.TrafficInfo.Traffic.Url!=""&&n.attachBehavior(cityWay.TrafficInfoLayerBehavior.id,new cityWay.TrafficInfoLayerBehavior({layers:Enumerable.From(cityWay.config.map.TrafficInfo.Traffic.Layers).Select(function(n){return new cityWay.TrafficInfoLayer({url:cityWay.config.map.TrafficInfo.Traffic.Url,name:n.Name,format:cityWay.config.map.TrafficInfo.Traffic.Format,autoRefresh:u})}),map:n})),n.attachBehavior(cityWay.TrafficInfoItemsBehavior.id,new cityWay.TrafficInfoItemsBehavior({map:n,context:cityWay.consts.map.context.trafficInfo,startDate:h,endDate:c,autoRefresh:u})),l||n.attachBehavior(cityWay.PopulatePoiBoundingBoxBehavior.id,new cityWay.PopulatePoiBoundingBoxBehavior({map:n,categories:i.categories||""})),cityWay.config.map.Preferences.isEnabled&&(n.behaviors[cityWay.PreferencesBehavior.id].view(cityWay.DefaultPreferencesView(n,{templateUri:s})),n.behaviors[cityWay.PreferencesBehavior.id].enable()),e},n};cityWay.DisruptMapContext=function(){var n=new cityWay.MapContext,t=n.setup;return n.setup=function(n,i){var u=t(),f=i&&i.templateLegendPath!=null?i.templateLegendPath:null,e=i&&i.templatePreferencesPath!=null?i.templatePreferencesPath:null,r;return n.behaviors[cityWay.SelectionRangeBehavior.id].disable(),n.behaviors[cityWay.LegendCheckableBehavior.id].enable(),r=new cityWay.DefaultLegendView(n,{topPartVisible:!1,middlePartVisible:!0,useStaticDisplay:!1,templateUri:f}),n.behaviors[cityWay.LegendBehavior.id].view(r),n.behaviors[cityWay.LegendBehavior.id].enable(),n.behaviors[cityWay.ContextMenuBehavior.id].items([cityWay.SelectionRangeMenuItem(n)]),n.behaviors[cityWay.ContextMenuBehavior.id].enable(),cityWay.config.map.Preferences.isEnabled&&(n.behaviors[cityWay.PreferencesBehavior.id].view(cityWay.DefaultPreferencesView(n,{templateUri:e})),n.behaviors[cityWay.PreferencesBehavior.id].enable()),u},n};cityWay.LinesMapContext=function(){var n=new cityWay.MapContext,t=n.setup;return n.setup=function(n,i){var f=t(),e=i&&i.templateLegendPath!=null?i.templateLegendPath:"/Cityway.TSI.Core/Embedded/Map/templates/legend/linesmap-legend-template.html",o=i&&i.templatePreferencesPath!=null?i.templatePreferencesPath:null,u,r;return n.behaviors[cityWay.FilterItemsVisibilityByZoomBehavior.id].enable(),n.behaviors[cityWay.SelectionRangeBehavior.id].disable(),n.behaviors[cityWay.LegendCheckableBehavior.id].enable(),u=new cityWay.DefaultLegendView(n,{topPartVisible:!1,middlePartVisible:!0,useStaticDisplay:!1,templateUri:e}),n.behaviors[cityWay.LegendBehavior.id].view(u),n.behaviors[cityWay.LegendBehavior.id].enable(),r=[cityWay.SelectionRangeMenuItem(n)],cityWay.config.sections.isJourneyPlannerEnabled&&(r.push(cityWay.LabelMenuItem(n,{text:cityWay.texts.site.Title_Itinerary})),r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectDep,url:cityWay.config.urls.journeyPlannerDep})),cityWay.config.map.JourneyPlanner.disableVia||r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectVia,url:cityWay.config.urls.journeyPlannerVia})),r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectArr,url:cityWay.config.urls.journeyPlannerArr}))),cityWay.config.sections.isNearByEnabled&&r.push(cityWay.GoMenuItem(n,{text:cityWay.texts.map.Menu_SelectNearBy,url:cityWay.config.urls.nearBy})),n.behaviors[cityWay.ContextMenuBehavior.id].items(r),n.behaviors[cityWay.ContextMenuBehavior.id].enable(),cityWay.config.map.Preferences.isEnabled&&(n.behaviors[cityWay.PreferencesBehavior.id].view(cityWay.DefaultPreferencesView(n,{templateUri:o})),n.behaviors[cityWay.PreferencesBehavior.id].enable()),f},n};cityWay.VehicleTrackingContext=function(){var n=new cityWay.MapContext,t=n.setup;return n.setup=function(n,i){var u=t(),f=i&&i.templateLegendPath!=null?i.templateLegendPath:"/Cityway.TSI.Core/Embedded/Map/templates/vehicleTracking/legend-template.html",r;return n.behaviors[cityWay.SelectionRangeBehavior.id].disable(),n.behaviors[cityWay.LegendCheckableBehavior.id].enable(),r=new cityWay.DefaultLegendView(n,{topPartVisible:!1,middlePartVisible:!0,useStaticDisplay:!1,templateUri:f}),n.behaviors[cityWay.LegendBehavior.id].view(r),n.behaviors[cityWay.LegendBehavior.id].enable(),n.behaviors[cityWay.ContextMenuBehavior.id].disable(),u},n}});$(function(){cityWay.mapContextFactory=function(){var n=this;return n[cityWay.consts.map.context.defaultContext]=function(){return new cityWay.DefaultMapContext},n[cityWay.consts.map.context.journeyPlannerSelection]=function(){return new cityWay.JourneyPlannerSelectionMapContext},n[cityWay.consts.map.context.journeyPlannerResult]=function(){return new cityWay.JourneyPlannerResultMapContext},n[cityWay.consts.map.context.stopTimeTable]=function(){return new cityWay.StopTimeTableMapContext},n[cityWay.consts.map.context.lineTimeTable]=function(){return new cityWay.LineTimeTableMapContext},n[cityWay.consts.map.context.nearBy]=function(){return new cityWay.NearByMapContext},n[cityWay.consts.map.context.directTrip]=function(){return new cityWay.DirectTripMapContext},n[cityWay.consts.map.context.eventMap]=function(){return new cityWay.EventMapContext},n[cityWay.consts.map.context.lineTimeTablePoi]=function(){return new cityWay.LineTimeTablePoiMapContext},n[cityWay.consts.map.context.lineTimeTablePoiResult]=function(){return new cityWay.LineTimeTablePoiResultMapContext},n[cityWay.consts.map.context.trafficInfo]=function(){return new cityWay.TrafficInfoMapContext},n[cityWay.consts.map.context.disrupt]=function(){return new cityWay.DisruptMapContext},n[cityWay.consts.map.context.linesMap]=function(){return new cityWay.LinesMapContext},n[cityWay.consts.map.context.vehicleTracking]=function(){return new cityWay.VehicleTrackingContext},n}()});$(function(){cityWay.NodeVisibilityByCircleBoundsSpecification=function(){var n,t=new cityWay.MapSpecification;return t.isSatisfiedBy=function(t){if(t.type!=="leafNode"||!n||t.pointType===cityWay.pointType.roadLink)return!0;var i=L.latLng(t.latitude,t.longitude),r=L.latLng(n.latitude,n.longitude);return r.distanceTo(i)<=n.radius},t.setCircleData=function(t,i,r){n={latitude:t,longitude:i,radius:r}},t}});$(function(){cityWay.NodeVisibilityByLegendSpecification=function(){var n=new cityWay.MapSpecification;return n.isSatisfiedBy=function(n){return n.type!=="leafNode"?!0:!n._legendItem?!0:n._legendItem.isChecked()},n}});$(function(){cityWay.NodeVisibilityByZoomSpecification=function(n){var t=new cityWay.MapSpecification;return t.isSatisfiedBy=function(t){if(t.type!=="leafNode"||!t.isNormalNode())return!0;var i=n.mapControl.getZoom();return t.pointType===cityWay.pointType.poi?cityWay.tools.showPoiNode(t.category,i):t.pointType===cityWay.pointType.physicalStop?i>=cityWay.config.map.ZoomDisplayPoint.PhysicalStop:!0},t}});$(function(){cityWay.NodeVisibilityByGroupLegendSpecification=function(n){var t=new cityWay.MapSpecification;return t.map=n,t.isSatisfiedBy=function(n){if(n.type!=="leafNode"||n.isSelectedNode())return!0;var i=Enumerable.From(t.map._legendView.nodeLegends()).SelectMany(function(n){return n.group}).SelectMany(function(n){return n.items}).FirstOrDefault(undefined,function(t){return!n.category?t.pointType==n.pointType:t.pointType==n.pointType&&n.category==t.pointCategory});return!i?!0:i.isChecked()},t}});$(function(){cityWay.MapBehavior=function(n){if(!n||!n.map)throw new Error("Options must be specified");var t=this;return t.map=n.map,t._enabled=ko.observable(!1),t.isEnabled=ko.computed(function(){return t._enabled()}),t.enable=function(){t._enabled(!0)},t.disable=function(){t._enabled(!1)},t};cityWay.LegendCheckableBehavior=function(n){return new cityWay.MapBehavior(n)};cityWay.LegendCheckableBehavior.id="LegendCheckableBehavior"});$(function(){cityWay.LegendBehavior=function(n){var t=new cityWay.MapBehavior(n);return t.enable=function(){t.view()&&(t.view().load(),t.map._legendView=t.view());t._enabled(!0)},t.disable=function(){t.view()&&t.view().unload();t._enabled(!1)},t.view=ko.observable(),t.view.subscribe(function(n){n&&n.unload()},null,"beforeChange"),t.view.subscribe(function(n){n&&t._enabled()&&(n.load(),t.map._legendView=n)}),t};cityWay.LegendBehavior.id="LegendBehavior"});$(function(){cityWay.FilterItemsVisibilityByZoomBehavior=function(n){var t=new cityWay.MapBehavior(n),i=cityWay.NodeVisibilityByZoomSpecification(t.map);return t.enable=function(){t.map._nodeVisibilitySpecBuilder.addSpecification("filterItemsByZoom",i,"and");t._enabled(!0)},t.disable=function(){t.map._nodeVisibilitySpecBuilder.removeSpecification("filterItemsByZoom");t._enabled(!1)},t};cityWay.FilterItemsVisibilityByZoomBehavior.id="FilterItemsVisibilityByZoomBehavior"});$(function(){cityWay.FilterItemsVisibilityByCircleBoundsBehavior=function(n){var t=new cityWay.MapBehavior(n),i=cityWay.NodeVisibilityByCircleBoundsSpecification();return t.enable=function(){t.map._nodeVisibilitySpecBuilder.addSpecification("filterItemsByCircleBounds",i,"and");t._enabled(!0)},t.disable=function(){t.map._nodeVisibilitySpecBuilder.removeSpecification("filterItemsByCircleBounds");t._enabled(!1)},t.setCircleData=function(n,t,r){i.setCircleData(n,t,r)},t};cityWay.FilterItemsVisibilityByCircleBoundsBehavior.id="FilterItemsVisibilityByCircleBoundsBehavior"});$(function(){cityWay.SelectionRangeBehavior=function(n){function i(n){if(n===t.map){var i=t.map.mapControl.getZoom();(!cityWay.config.map.SelectionRange.ZoomMin||i>=cityWay.config.map.SelectionRange.ZoomMin)&&(!cityWay.config.map.SelectionRange.ZoomMax||i<=cityWay.config.map.SelectionRange.ZoomMax)?$("#"+t.map.mapId+"_wrapper").toggleClass("crossCursor",!0):$("#"+t.map.mapId+"_wrapper").toggleClass("crossCursor",!1)}}function r(n,i){var r=t.map.mapControl.getZoom();(!cityWay.config.map.SelectionRange.ZoomMin||r>=cityWay.config.map.SelectionRange.ZoomMin)&&(!cityWay.config.map.SelectionRange.ZoomMax||r<=cityWay.config.map.SelectionRange.ZoomMax)&&(t.map._internalNodes.remove(function(n){return n.pointType===cityWay.pointType.roadLink&&!n.isLocked()}),cityWay.mapDataService.getNearestRoad(i.latlng.lat,i.latlng.lng).then(function(n){if(n.Data){var u=n.Data,r=cityWay.mapNodeFactory.createNodeFromRoadLink(t.map,u,!0);r.setPosition(i.latlng.lat,i.latlng.lng);t.map._internalNodes.push(r);t.map.mapControl.setView([r.latitude,r.longitude],t.map.mapControl.getZoom())}else cityWay.eventManager.publish(cityWay.events.map.nearestRoadNotFound,t)},function(){cityWay.eventManager.publish(cityWay.events.map.nearestRoadNotFound,t)}))}var t=new cityWay.MapBehavior(n);return t.enable=function(){cityWay.eventManager.subscribe(cityWay.events.map.boundsChanged,i);cityWay.eventManager.subscribe(cityWay.events.map.clicked,r);t._enabled(!0)},t.disable=function(){cityWay.eventManager.unsubscribe(cityWay.events.map.boundsChanged,i);cityWay.eventManager.unsubscribe(cityWay.events.map.clicked,r);t._enabled(!1)},t};cityWay.SelectionRangeBehavior.id="SelectionRangeBehavior"});$(function(){cityWay.PopulateWithAllPointsBehavior=function(n){function i(n){if(n===t.map){var o=t.map.mapControl.getZoom(),s=t.map.mapControl.getBounds(),i=s.pad(.5),f=i.getSouthWest(),e=i.getNorthEast();cityWay.mapDataService.getPointsInBoundingBox(o,f.lat,f.lng,e.lat,e.lng).then(function(n){n.Data&&n.Data.length>0?cityWay.mapNodeFactory.createNodeArrayFromAnyAsync(t.map,n.Data).then(function(n){var i=u(n);window.ko.utils.arrayPushAll(t.map._internalNodes,i)}).then(function(){r(i.pad(1))}):r(i)})}}function r(n){var i=n.getSouthEast(),r=n.getNorthWest(),u=i.lat<r.lat?i.lat:r.lat,f=i.lat>r.lat?i.lat:r.lat,e=i.lng<r.lng?i.lng:r.lng,o=i.lng>r.lng?i.lng:r.lng;t.map._internalNodes.remove(function(n){return n.isDepartureNode()||n.isArrivalNode()||n.isViaNode()?!1:n.latitude>f||n.latitude<u||n.longitude>o||n.longitude<e})}function u(n){return Enumerable.From(n).Except(t.map._internalNodes(),function(n){return n.getId()}).ToArray()}var t=new cityWay.MapBehavior(n);return t.enable=function(){cityWay.eventManager.subscribe(cityWay.events.map.boundsChanged,i);t._enabled(!0);i(t.map)},t.disable=function(){cityWay.eventManager.unsubscribe(cityWay.events.map.boundsChanged,i);t._enabled(!1)},t};cityWay.PopulateWithAllPointsBehavior.id="PopulateWithAllPointsBehavior"});$(function(){cityWay.BoundingBoxBehavior=function(n){function r(n){cityWay.config.map.DisabledFitBound||setTimeout(function(){t.map.mapControl.fitBounds(n.target.getBounds())},500)}var t=new cityWay.MapBehavior(n),i;return t.enable=function(){i=new L.KML("/api/map/GetBoundingBoxKml",{async:!0});i.on("loaded",r);t.map.mapControl.addLayer(i);t._enabled(!0)},t.disable=function(){t.map.mapControl.removeLayer(i);i.off("loaded",r);t._enabled(!1)},t};cityWay.BoundingBoxBehavior.id="BoundingBoxBehavior"});$(function(){cityWay.PopulateWithSinglePointTypeBehavior=function(n){function u(){t.map.isBusy(!0);cityWay.mapDataService.getPointsByCategories(i,r).then(function(n){n.Data&&cityWay.mapNodeFactory.createNodeArrayFromAnyAsync(t.map,n.Data).then(function(n){window.ko.utils.arrayPushAll(t.map._internalNodes,n);t.map.isBusy(!1);cityWay.eventManager.publish(cityWay.events.ws.getPointsByCategoriesSuccess,n.Data)})})}function f(){t.map._internalNodes([])}var t=new cityWay.MapBehavior(n),i,r;if(!n.pointType)throw new Error("A point type must be specified");return i=n.categories||[],r=n.localityId||0,t.enable=function(){u();t._enabled(!0)},t.disable=function(){f();t._enabled(!1)},t};cityWay.PopulateWithSinglePointTypeBehavior.id="PopulateWithSinglePointTypeBehavior"});$(function(){cityWay.LineMarkerVisibilityBehavior=function(n){function f(n){n.forEach(function(n){n.data&&!!!n.data.isWalking&&n.showLabelMarker()});r(t.map)}function r(n){if(n===t.map){var r=t.map.mapControl.getZoom();r>=cityWay.config.map.ZoomDisplayPoint.LineMarker?Enumerable.From(i()).ForEach(function(n){n.data&&!!!n.data.isWalking&&n.showLabelMarker()}):Enumerable.From(i()).ForEach(function(n){n.data&&!!!n.data.isWalking&&n.hideLabelMarker()})}}var t=new cityWay.MapBehavior(n),u,i=ko.computed(function(){return Enumerable.From(t.map.itineraries()).SelectMany(function(n){return n.portions()}).ToArray()});return t.enable=function(){f(i());u=i.subscribe(f);cityWay.eventManager.subscribe(cityWay.events.map.zoomChanged,r);t._enabled(!0)},t.disable=function(){u.dispose();cityWay.eventManager.unsubscribe(cityWay.events.map.zoomChanged,r);t._enabled(!1)},t};cityWay.LineMarkerVisibilityBehavior.id="LineMarkerVisibilityBehavior"});$(function(){"use strict";cityWay.ContextMenuBehavior=function(n){var t=new cityWay.MapBehavior(n);return t.enable=function(){var r,i,n;for(t._menu=new L.Map.ContextMenu(t.map.mapControl),r=t.items(),i=0;i<r.length;i++)n=r[i],n.menu=t._menu,n.element(t._menu.addItem({text:n.text,callback:n.callback}));t._menu.addHooks();t._enabled(!0)},t.disable=function(){t._menu=null;t._enabled(!1)},t.items=ko.observableArray([]),t.items.subscribe(function(n){var i,u,r;if(!!t._menu)for(t._menu.removeAllItems(),i=0;i<n.length;i++)u=n[i],r=u.element(),!r.parentNode||r.parentNode.removeChild(r)},null,"beforeChange"),t.items.subscribe(function(n){var r,i;if(!!t._menu)for(r=0;r<n.length;r++)i=n[r],i.menu=t._menu,i.element(t._menu.addItem({text:i.text,callback:i.callback}))}),t._menu=null,t};cityWay.ContextMenuBehavior.id="ContextMenuBehavior"});$(function(){cityWay.TrafficInfoLayerBehavior=function(n){function f(){Enumerable.From(n.layers).ForEach(function(n){var r=L.tileLayer.wms(n.url,{layers:n.name,format:n.format,transparent:n.transparent,zIndex:5});n._layer=r;t.map.mapControl.addLayer(r);n.autoRefresh&&o(n);i[n.name]=n});u=$.extend(!0,{},i);r="added"}function s(){e(n.layers)}function e(n){Enumerable.From(n).ForEach(function(n){n.Value!=null?t.map.mapControl.removeLayer(n.Value._layer):t.map.mapControl.removeLayer(n._layer)});i={};r="removed"}function o(n){n._refresher=setInterval(function(){n._layer.setParams({reload:+new Date},!1)},cityWay.config.map.TrafficInfo.Traffic.Refresh.RefreshTime*1e3)}function h(n){!n._refresher||(clearInterval(n._refresher),delete n._refresher)}var t=new cityWay.MapBehavior(n);if(!n.layers)throw new Error("layers must be specified");var u={},i={},r="removed";return t.enable=function(){f();t._enabled(!0)},t.disable=function(){s();t._enabled(!1)},t.addAllInitialLayers=function(){f()},t.removeAllInitialLayers=function(){e(u)},t.disableLayer=function(n){var r=i[n];!!r&&t.map.mapControl.hasLayer(r._layer)&&(t.map.mapControl.removeLayer(r._layer),h(r))},t.enableLayer=function(n){var r=i[n];!r||t.map.mapControl.hasLayer(r._layer)||(t.map.mapControl.addLayer(r._layer),r.autoRefresh&&o(r))},t.getState=function(){return r},t};cityWay.TrafficInfoLayerBehavior.id="TrafficInfoLayerBehavior"});$(function(){cityWay.TrafficInfoItemsBehavior=function(n){function c(n,i,r){t.startDate=i;t.endDate=r;var f=u(n);t.autoRefresh()&&f.done(function(){t.autoRefresh(!1);t.autoRefresh(!0)})}function u(){var n=t.map.getBounds(),i=n.getNorthEast(),r=n.getSouthWest(),u=t.map.mapControl.getZoom(),f=t.context,e=!t.startDate?undefined:t.startDate.toISOString(),o=!t.endDate?undefined:t.endDate.toISOString();return t.refreshEvent(i,r,u,f,e,o)}function l(n){n&&(n=Enumerable.From(n).Select(function(n){return $.extend(n,{TypePoint:cityWay.pointType.traffic})}).ToArray(),cityWay.mapNodeFactory.createNodeArrayFromAnyAsync(t.map,n).then(function(n){for(var i,r,o,u,l,f=h(),p=[cityWay.itemType.openMountainPass,cityWay.itemType.closedMountainPass,cityWay.itemType.multiPurposeTrafficSign,cityWay.itemType.webcam,cityWay.itemType.mountainPassWithSpecialEquipmentRequired],s=[],c=[],e=0;e<n.length;e++)i=n[e],p.indexOf(i.itemType)!=-1?c.push(i):s.push(i);for(r=[],Enumerable.From(t.map._legendView.nodeLegends()).ForEach(function(n){Enumerable.From(n.group).ForEach(function(n){n.isChecked()||r.push(n.itemType)})}),f.setNodes(s,!0),v(f,r),y(r),o=Enumerable.From(t.map._internalNodes()).Where(function(n){return n.itemType==cityWay.itemType.openMountainPass||n.itemType==cityWay.itemType.closedMountainPass||n.itemType==cityWay.itemType.mountainPassWithSpecialEquipmentRequired}).ToArray(),u=0;u<o.length;u++)t.map.removeNode(o[u]);l=a(c);window.ko.utils.arrayPushAll(t.map._internalNodes,l);w(f)}))}function a(n){return Enumerable.From(n).Except(t.map._internalNodes(),function(n){return n.getId()}).ToArray()}function v(n,i){t.map.isBehaviorEnabled(cityWay.LegendCheckableBehavior.id)&&Enumerable.From(n.nodes()).ForEach(function(t){$.inArray(t.itemType,i)!=-1&&n.hideNode(t)})}function y(n){if(t.map.isBehaviorEnabled(cityWay.LegendCheckableBehavior.id)&&(cluster=t.map._internalNodes(),!!cluster))for(var i in cluster)$.inArray(cluster[i].itemType,n)!=-1&&(isShowNode?cluster[i].show():cluster[i].hide())}function p(n){if(i=0,r=cityWay.TrafficInfoItemsBehavior.ConstUnknown,Enumerable.From(n.nodes()).ForEach(function(n){n.isPopupOpen()&&(i=n.id,r=cityWay.TrafficInfoItemsBehavior.ConstCluster)}),r!=cityWay.TrafficInfoItemsBehavior.ConstCluster&&(n=t.map._internalNodes(),!!n))for(var u in n)n[u].isPopupOpen()&&(i=n[u].id,r=cityWay.TrafficInfoItemsBehavior.ConstNode)}function w(n){if(i!=0)if(r==cityWay.TrafficInfoItemsBehavior.ConstCluster)Enumerable.From(n.nodes()).ForEach(function(n){n.id===i&&n.openPopup()});else if(r==cityWay.TrafficInfoItemsBehavior.ConstNode&&(n=t.map._internalNodes(),!!n))for(var u in n)n[u].id===i&&n[u].openPopup()}function b(n){var t=n.getChildCount(),u=n.getAllChildMarkers(),i="",r=Enumerable.From(u).OrderByDescending(function(n){return n.options.zIndexOffset}).FirstOrDefault(undefined);return i=r?r.options.icon.options.className:" marker-cluster-"+(t<10?"small":t<100?"medium":"large"),new L.DivIcon({html:"<div>"+t+"<\/div>",className:"marker-cluster "+i,iconSize:new L.Point(40,40)})}function h(){var n=Enumerable.From(t.map._internalNodes()).FirstOrDefault(undefined,function(n){return n.type==="clusterNode"});return!!n||(n=new cityWay.ClusterNode({map:t.map,iconCreateFunction:b}),t.map.addNode(n)),n}function k(){t._refresher=setInterval(function(){u(t.map)},cityWay.config.map.TrafficInfo.Traffic.Refresh.RefreshTime*1e3)}function d(){!t._refresher||(clearInterval(t._refresher),delete t._refresher)}var t=new cityWay.MapBehavior(n),s;t.context=n.context||cityWay.consts.map.context.defaultContext;t.startDate=n.startDate;t.endDate=n.endDate;t.autoRefresh=window.ko.observable(!1);t._refresher=undefined;cityWay.TrafficInfoItemsBehavior.ConstCluster="cluster";cityWay.TrafficInfoItemsBehavior.ConstNode="node";cityWay.TrafficInfoItemsBehavior.ConstUnknown="unknown";var f=null,e=null,o=[],i=0,r=cityWay.TrafficInfoItemsBehavior.ConstUnknown;return t.autoRefresh.subscribe(function(n){n?k():d()}),!n.autoRefresh||t.autoRefresh(!0),t.enable=function(){u(t.map);cityWay.eventManager.subscribe(cityWay.events.map.boundsChanged,s);cityWay.eventManager.subscribe(cityWay.events.map.trafficInfoDateChanged,c);t._enabled(!0)},t.disable=function(){cityWay.eventManager.unsubscribe(cityWay.events.map.boundsChanged,s);cityWay.eventManager.unsubscribe(cityWay.events.map.trafficInfoDateChanged,c);t._enabled(!1)},s=cityWay.tools.debounce(function(n){var i=u(n);t.autoRefresh()&&i.done(function(){t.autoRefresh(!1);t.autoRefresh(!0)})},300),t.refreshEvent=function(n,i,r,u,s,c){var a,v,y;for(i.lat==n.lat&&i.lng==n.lng&&(is.not.null(f)||is.not.null(e)?(n=f,i=e):(a=t.map.mapConfig.centerLatitude,v=t.map.mapConfig.centerLongitude,i.lat=a-80/111,i.lng=v-80/111,n.lat=a+80/111,n.lng=v+80/111,f=n,e=i)),p(h()),y=cityWay.mapDataService.getMergedTrafficItems(i.lat,i.lng,n.lat,n.lng,r,u,s,c);o.length>0;)o.pop().abort();return o.push(y),y.then(function(n){var e=!n?[]:n.Data||[],u=[],i,f;for(Enumerable.From(t.map.nodes()).Where(function(n){return!!n.minZoom&&n.minZoom>r}).ForEach(function(n){n.hide();n.dispose();u.push(n)}),i=0;i<u.length;i++)t.map.removeNode(u[i]);f=h();f.setNodes(Enumerable.From(f.nodes()).Where(function(n){return!!!n.minZoom||n.minZoom<=r}).ToArray(),!0);l(e);cityWay.eventManager.publish(cityWay.events.map.trafficInfoItemsChanged,e)})},t};cityWay.TrafficInfoItemsBehavior.id="TrafficInfoItemsBehavior"});$(function(){cityWay.PopulatePoiBoundingBoxBehavior=function(n){function i(n){r(n)}function r(){var n=t.map.getBounds().pad(.5),i=n.getSouthWest(),r=n.getNorthEast(),u=is.array(t.categories)?t.categories.join("|"):t.categories;cityWay.mapDataService.getPlacesInBoundingBox(i.lat,i.lng,r.lat,r.lng,u,t.map.mapControl.getZoom()).then(function(i){i.Data&&cityWay.mapNodeFactory.createNodeArrayFromAnyAsync(t.map,i.Data).then(function(n){var i=f(n);window.ko.utils.arrayPushAll(t.map._internalNodes,i)}).then(function(){var u=n.pad(1),i=u.getSouthEast(),r=u.getNorthWest(),f=i.lat<r.lat?i.lat:r.lat,e=i.lat>r.lat?i.lat:r.lat,o=i.lng<r.lng?i.lng:r.lng,s=i.lng>r.lng?i.lng:r.lng;t.map._internalNodes.remove(function(n){return n.latitude>e||n.latitude<f||n.longitude>s||n.longitude<o})})})}function f(n){return Enumerable.From(n).Except(t.map._internalNodes(),function(n){return n.getId()}).ToArray()}var u=new cityWay.NodeVisibilityByLegendSpecification,t=new cityWay.MapBehavior(n);return t.categories=n.categories||"",t.enable=function(){t.map._nodeVisibilitySpecBuilder.addSpecification("filterItemsByLegend",u,"and");r(t.map);cityWay.eventManager.subscribe(cityWay.events.map.boundsChanged,i);t._enabled(!0)},t.disable=function(){t.map._nodeVisibilitySpecBuilder.removeSpecification("filterItemsByLegend");cityWay.eventManager.unsubscribe(cityWay.events.map.boundsChanged,i);t._enabled(!1)},t};cityWay.PopulatePoiBoundingBoxBehavior.id="PopulatePoiBoundingBoxBehavior"});$(function(){cityWay.PopulateStopBoundingBoxBehavior=function(n){function i(n){r(n)}function r(){var n=t.map.getBounds().pad(.5),i=n.getSouthWest(),r=n.getNorthEast();cityWay.mapDataService.getStopsInBoundingBox(i.lat,i.lng,r.lat,r.lng,t.map.mapControl.getZoom()).then(function(i){i.Data&&cityWay.mapNodeFactory.createNodeArrayFromAnyAsync(t.map,i.Data).then(function(n){var i=f(n);window.ko.utils.arrayPushAll(t.map._internalNodes,i)}).then(function(){var u=n.pad(1),i=u.getSouthEast(),r=u.getNorthWest(),f=i.lat<r.lat?i.lat:r.lat,e=i.lat>r.lat?i.lat:r.lat,o=i.lng<r.lng?i.lng:r.lng,s=i.lng>r.lng?i.lng:r.lng;t.map._internalNodes.remove(function(n){return n.latitude>e||n.latitude<f||n.longitude>s||n.longitude<o})})})}function f(n){return Enumerable.From(n).Except(t.map._internalNodes(),function(n){return n.getId()}).ToArray()}var u=new cityWay.NodeVisibilityByLegendSpecification,t=new cityWay.MapBehavior(n);return t.enable=function(){t.map._nodeVisibilitySpecBuilder.addSpecification("filterItemsByLegend",u,"and");r(t.map);cityWay.eventManager.subscribe(cityWay.events.map.boundsChanged,i);t._enabled(!0)},t.disable=function(){t.map._nodeVisibilitySpecBuilder.removeSpecification("filterItemsByLegend");cityWay.eventManager.unsubscribe(cityWay.events.map.boundsChanged,i);t._enabled(!1)},t};cityWay.PopulateStopBoundingBoxBehavior.id="PopulateStopBoundingBoxBehavior"});$(function(){cityWay.PreferencesBehavior=function(n){var t=new cityWay.MapBehavior(n);return t.enable=function(){t.view()&&t.view().load();t._enabled(!0)},t.disable=function(){t.view()&&t.view().unload();t._enabled(!1)},t.view=ko.observable(),t.view.subscribe(function(n){n&&n.unload()},null,"beforeChange"),t.view.subscribe(function(n){n&&t._enabled()&&n.load()}),t};cityWay.PreferencesBehavior.id="PreferencesBehavior"});$(function(){cityWay.StructuringRoutesBehavior=function(n){function i(n){var r,c,u,h,f,e;if(n.Data){var o=cityWay.mapNodeFactory.createNodeArrayFromPhysicalStops(t.map,n.Data.Stops),s=[],i=n.Data.Itineraries;for(r in i)(c=i[r].Direction,u=Enumerable.From(i[r].StopPointIds).Join(Enumerable.From(o),function(n){return n},function(n){return n.id},function(n,t){return t}).ToArray(),u.length!=0)&&(h=Enumerable.From(u).Select(function(n){return[n.latitude,n.longitude]}).ToArray(),f=cityWay.mapItineraryFactory.createItinerary(t.map,{id:i[r].Id||0}),s.push(f),e=null,i[r].Geometries&&i[r].Geometries.length>0&&(e=i[r].Geometries),f.addPortion(cityWay.mapItineraryFactory.createPortion(t.map,{points:h,nodes:u,disablePopup:!1,steps:e,className:i[r].Style,label:n.Data.Line.TransportMode.Label,icon:n.Data.Line.TransportMode.Image+" cw-transinfo",data:{isPublicTransport:!0,line:n.Data.Line}})));s.forEach(function(n){t.map.addItinerary(n)});o.forEach(function(n){t.map.addNode(n)})}}var t=new cityWay.MapBehavior(n);return t.enable=function(){cityWay.mapDataService.getStructuringRoutes().then(function(n){var t,r,u;if(n.Data&&n.Data.length>0)for(t in n.Data)r=n.Data[t].Id,u=n.Data[t].Sens,cityWay.mapDataService.getLineMap(r,null,u).then(function(n){n.StatusCode==cityWay.StatusCode.Ok&&i(n)})});t._enabled(!0)},t.disable=function(){t._enabled(!1)},t};cityWay.StructuringRoutesBehavior.id="StructuringRoutesBehavior"});$(function(){cityWay.mapView=function(n){if(!n)throw new Error("Map must be specified");var t=this;return t.map=n,t._loaded=ko.observable(!1),t.isLoaded=ko.computed(function(){return t._loaded()}),t.load=function(){},t.unload=function(){},t}});$(function(){cityWay.DefaultLegendView=function(n,t){function f(){var n,t,r;if(i.restricted())return!1;for(n=0,t=i.arrayNodeLegends().length;n<t;++n)if(r=i.arrayNodeLegends()[n],r.canHide())return!0;return!1}function o(){var n="legend-body-"+i.map.mapId,t=i.templateUri;$("<div />").load(t,function(t){var u=$(t)[0];$("#"+n).html("").append(u);ko.applyBindings(i,u);i.useStaticDisplay()&&r()})}function r(){r.isLoaded||cityWay.mapDataService.getNodeLegendItems().then(function(n){var t,o,e;if(n.Data){for(t=Enumerable.From(n.Data).Select(function(n){return new cityWay.DefaultLegendItem({map:i.map,id:n.Id,geometryType:n.GeometryType,className:n.Style,label:n.Label,canHide:i.restricted()&&n.PointType==cityWay.pointType.poi?!1:n.CanHide,pointType:n.PointType,pointIsDeparture:n.PointIsDeparture,pointIsVia:n.PointIsVia,pointIsArrival:n.PointIsArrival,pointCategory:n.PointCategory,order:n.Order,isChecked:i.restricted()&&n.PointType==cityWay.pointType.poi?!0:!1})}).OrderBy(function(n){return n.Order}).ToArray(),i.nodeLegendFilter&&(t=Enumerable.From(t).Where(i.nodeLegendFilter).ToArray()),Enumerable.From(t).ForEach(function(n){n.items=s({legendItem:n,pointType:n.pointType,category:n.pointCategory})}),o=[],e=0;e<Math.ceil(t.length/3);e++)o.push({group:Enumerable.From(t).Skip(e*3).Take(3).ToArray()});r.isLoaded=!0;i.arrayNodeLegends(t);i.linkVisible(f());u(o)}})}function s(n){var t=n.pointType+"_"+(n.category||"");return window.ko.computed(function(){return Enumerable.From(i.map._internalNodes()).Where(function(n){return t===n.pointType+"_"+(n.category||"")}).Select(function(t){return t._legendItem=n.legendItem,t}).ToArray()})}function h(){return u()}function c(){var n;if(i.map._internalNodes().length===0)return[];var t=Enumerable.From(i.map._internalNodes()).Where(function(n){return n.isNormalNode()&&n.pointType!=cityWay.pointType.roadLink}).GroupBy(function(n){return{prop1:n.pointType,prop2:n.category}},"",function(n,t){var r=t.ToArray()[0];return new cityWay.DefaultLegendItem({map:i,geometryType:cityWay.geometryType.point,className:r.className().replace("picto-map",""),pointCategory:r.category,pointType:r.pointType,label:l(r.pointType,r.categoryName||"")})},function(n){return n.prop1+"-"+(!n.prop2?"":n.prop2)}).ToArray(),r=3,u=[];for(n=0;n<Math.ceil(t.length/r);n++)u.push({group:Enumerable.From(t).Skip(n*r).Take(r).ToArray()});return i.arrayNodeLegends(t),i.linkVisible(f()),u}function l(n,t){return n==cityWay.pointType.physicalStop||n==cityWay.pointType.logicalStop?cityWay.texts.map.Legend_Stop:t}function a(){var t,f,s,h,n,e,u;if(i.map._internalItineraries().length===0)return[];t=ko.observableArray([]);f=Enumerable.From(i.map._internalItineraries()).SelectMany(function(n){return n.portions()}).ToArray();for(s in f){var n=f[s],e=Enumerable.From(t()).Where(function(t){return t.className==n.className}).ToArray(),r=null;n.steps!=null&&(r=Enumerable.From(n.steps).Where(function(n){return n.Style!=null&&n.Style!=""}).ToArray());e.length==0&&(r==null||r.length==0)&&t.push(new cityWay.DefaultLegendItem({map:i,geometryType:cityWay.geometryType.line,className:n.className,label:v(n)}));for(h in r)n=r[h],n.Style.indexOf("map-itinerary-car-traffic")>=0?i.trafficVisible(!0):(e=Enumerable.From(t()).Where(function(t){return t.className==n.Style}).ToArray(),e.length==0&&t.push(new cityWay.DefaultLegendItem({map:i,geometryType:cityWay.geometryType.line,className:n.Style,label:n.Label})))}var c=Enumerable.From(t()).ToArray(),o=2,l=[];for(u=0;u<Math.ceil(c.length/o);u++)l.push({group:Enumerable.From(c).Skip(u*o).Take(o).ToArray()});return l}function v(n){return n.data&&n.data.isPublicTransport&&n.icon!="cw-mode-tod"?!cityWay.config.map.PublicTransportation.isGathered&&n&&n.label?n.label:cityWay.texts.map.Legend_PublicTransport:n&&n.label?n.label:cityWay.texts.map.Legend_Itinerary}var e=new cityWay.NodeVisibilityByLegendSpecification,u=ko.observableArray([]),i=new cityWay.mapView(n);return i.templateUri=t.templateUri||"/Cityway.TSI.Core/Embedded/Map/templates/legend/default-legend-template.html",i.topPartVisible=ko.observable(t&&t.topPartVisible==!1?!1:!0),i.middlePartVisible=ko.observable(t&&t.middlePartVisible==!1?!1:!0),i.linkVisible=ko.observable(t&&t.linkVisible==!1?!1:!0),i.bottomPartVisible=ko.observable(t&&t.bottomPartVisible==!1?!1:!0),i.useStaticDisplay=ko.observable(t&&t.useStaticDisplay==!1?!1:!0),i.restricted=ko.observable(t&&t.restricted==!0?!0:!1),i.trafficVisible=ko.observable(t&&t.trafficVisible==!0?!0:!1),i.nodeLegends=window.ko.computed(function(){return i.useStaticDisplay()?h():c()}),i.itineraryLegends=window.ko.computed(function(){return a()}),i.arrayNodeLegends=ko.observableArray([]),i.load=function(){o();i.map._nodeVisibilitySpecBuilder.addSpecification("filterItemsByLegend",e,"and");i._loaded(!0)},i.unload=function(){i.map._nodeVisibilitySpecBuilder.removeSpecification("filterItemsByLegend");$("#legend-body-"+i.map.mapId).html("");i._loaded(!1)},i.nodeLegendFilter=function(){return!0},i.useStaticDisplay.subscribe(function(n){n&&r()}),i.selectAll=function(){for(var r,n=0,t=i.arrayNodeLegends().length;n<t;++n)r=i.arrayNodeLegends()[n],r.isChecked(!0)},i.deselectAll=function(){for(var r,n=0,t=i.arrayNodeLegends().length;n<t;++n)r=i.arrayNodeLegends()[n],r.isChecked(!1)},i};cityWay.DefaultLegendItem=function(n){function f(){var n=$.cookie(cityWay.consts.map.cookies.legend+"-"+t.id);return!n?!0:(n==="true"||u(),n==="true")}function r(){for(var n in t.items())(function(n){setTimeout(function(){n.show()})})(t.items()[n])}function u(){for(var n in t.items())(function(n){setTimeout(function(){n.hide()})})(t.items()[n])}var t,i;if(!n.map)throw new Error("The map control must be specified");if(!n.geometryType)throw Error("GeoJson type must be specified");return t=this,t.map=n.map,t.id=n.id||"",t.geometryType=n.geometryType,t.className=n.className||"",t.label=ko.observable(n.label||""),t.items=n.items||ko.observableArray([]),t.canHide=ko.observable(!!n.canHide),t.isChecked=ko.observable(n&&n.isChecked==!0?!0:f()),t.isVisible=ko.observable(!0),t.order=n.order||0,t.pointType=n.pointType,t.pointIsDeparture=n.pointIsDeparture,t.pointIsVia=n.pointIsVia,t.pointIsArrival=n.pointIsArrival,t.pointCategory=n.pointCategory,i=t.isChecked.subscribe(function(n){if(t.map.isBehaviorEnabled(cityWay.LegendCheckableBehavior.id))if(n)if(t.map.isBehaviorEnabled(cityWay.FilterItemsVisibilityByZoomBehavior.id)){var i=t.map.mapControl.getZoom();cityWay.tools.showPoiNode(t.pointCategory,i)&&r()}else r();else u();$.cookie(cityWay.consts.map.cookies.legend+"-"+t.id,n,{path:"/"});cityWay.eventManager.publish(cityWay.events.map.legendStateChanged,t,n)}),t._isCheckedSubscription=i,t}});$(function(){cityWay.EventMapLegendView=function(n,t){function f(){var n,t,r;if(i.restricted())return!1;for(n=0,t=i.arrayNodeLegends().length;n<t;++n)if(r=i.arrayNodeLegends()[n],r.canHide())return!0;return!1}function o(){var n="legend-body-"+i.map.mapId,t=i.templateUri;$("<div />").load(t,function(t){var u=$(t)[0];$("#"+n).html("").append(u);ko.applyBindings(i,u);i.useStaticDisplay()&&r()})}function r(){r.isLoaded||cityWay.mapDataService.getNodeLegendItems().then(function(n){var t,o,e;if(n.Data){for(t=Enumerable.From(n.Data).Select(function(n){return new cityWay.DefaultLegendItem({map:i.map,id:n.Id,geometryType:n.GeometryType,className:n.Style,label:n.Label,canHide:i.restricted()&&n.PointType==cityWay.pointType.poi?!1:n.CanHide,pointType:n.PointType,pointIsDeparture:n.PointIsDeparture,pointIsVia:n.PointIsVia,pointIsArrival:n.PointIsArrival,pointCategory:n.PointCategory,order:n.Order,isChecked:i.restricted()&&n.PointType==cityWay.pointType.poi?!0:!1})}).OrderBy(function(n){return n.Order}).ToArray(),i.nodeLegendFilter&&(t=Enumerable.From(t).Where(i.nodeLegendFilter).ToArray()),Enumerable.From(t).ForEach(function(n){n.items=s({legendItem:n,pointType:n.pointType,category:n.pointCategory})}),o=[],e=0;e<Math.ceil(t.length/3);e++)o.push({group:Enumerable.From(t).Skip(e*3).Take(3).ToArray()});r.isLoaded=!0;i.arrayNodeLegends(t);i.linkVisible(f());u(o)}})}function s(n){var t=n.pointType+"_"+(n.category||"");return window.ko.computed(function(){return Enumerable.From(i.map._internalNodes()).Where(function(n){return t===n.pointType+"_"+(n.category||"")}).Select(function(t){return t._legendItem=n.legendItem,t}).ToArray()})}function h(){return u()}function c(){var n;if(i.map._internalNodes().length===0)return[];var e=Enumerable.From(i.map._internalNodes()).FirstOrDefault(undefined,function(n){return n.type==="clusterNode"}),o=e||i.map,t=Enumerable.From(o.nodes()).GroupBy(function(n){return{prop1:n.pointType,prop2:n.category}},"",function(n,t){var r=t.ToArray()[0];return new cityWay.EventMapLegendItem({map:i,id:r.categoryId,geometryType:cityWay.geometryType.point,className:r.className,pointCategory:r.category,pointType:r.pointType,label:l(r.pointType,r.categoryName||"")})},function(n){return n.prop1+"-"+(!n.prop2?"":n.prop2)}).ToArray(),r=3,u=[];for(n=0;n<Math.ceil(t.length/r);n++)u.push({group:Enumerable.From(t).Skip(n*r).Take(r).ToArray()});return i.arrayNodeLegends(t),i.linkVisible(f()),u}function l(n,t){return n==cityWay.pointType.physicalStop||n==cityWay.pointType.logicalStop?cityWay.texts.map.Legend_Stop:t}var e=new cityWay.NodeVisibilityByLegendSpecification,u=ko.observableArray([]),i=new cityWay.mapView(n);return i.templateUri=t.templateUri||"/Cityway.TSI.Core/Embedded/Map/templates/legend/eventmap-legend-template.html",i.topPartVisible=ko.observable(t&&t.topPartVisible==!1?!1:!0),i.middlePartVisible=ko.observable(t&&t.middlePartVisible==!1?!1:!0),i.linkVisible=ko.observable(t&&t.linkVisible==!1?!1:!0),i.bottomPartVisible=ko.observable(t&&t.bottomPartVisible==!1?!1:!0),i.useStaticDisplay=ko.observable(t&&t.useStaticDisplay==!1?!1:!0),i.restricted=ko.observable(t&&t.restricted==!0?!0:!1),i.nodeLegends=window.ko.computed(function(){return i.useStaticDisplay()?h():c()}),i.arrayNodeLegends=ko.observableArray([]),i.load=function(){o();i.map._nodeVisibilitySpecBuilder.addSpecification("filterItemsByLegend",e,"and");i._loaded(!0)},i.unload=function(){i.map._nodeVisibilitySpecBuilder.removeSpecification("filterItemsByLegend");$("#legend-body-"+i.map.mapId).html("");i._loaded(!1)},i.nodeLegendFilter=function(){return!0},i.useStaticDisplay.subscribe(function(n){n&&r()}),i.selectAll=function(){for(var r,n=0,t=i.arrayNodeLegends().length;n<t;++n)r=i.arrayNodeLegends()[n],r.isChecked(!0)},i.deselectAll=function(){for(var r,n=0,t=i.arrayNodeLegends().length;n<t;++n)r=i.arrayNodeLegends()[n],r.isChecked(!1)},i};cityWay.EventMapLegendItem=function(n){function r(){var n=$.cookie(cityWay.consts.map.cookies.legend+"_events_"+t.id);return!n?!0:(n==="true"||u(),n==="true")}function f(){for(var n in t.items())(function(n){setTimeout(function(){n.show()})})(t.items()[n])}function u(){for(var n in t.items())(function(n){setTimeout(function(){n.hide()})})(t.items()[n])}var t,i;if(!n.map)throw new Error("The map control must be specified");if(!n.geometryType)throw Error("GeoJson type must be specified");return t=this,t.map=n.map,t.id=n.id||"",t.geometryType=n.geometryType,t.className=n.className||"",t.label=ko.observable(n.label||""),t.items=n.items||ko.observableArray([]),t.canHide=ko.observable(!!n.canHide),t.isChecked=ko.observable(n&&n.isChecked==!0?!0:r()),t.isVisible=ko.observable(!0),t.order=n.order||0,t.pointType=n.pointType,t.pointIsDeparture=n.pointIsDeparture,t.pointIsVia=n.pointIsVia,t.pointIsArrival=n.pointIsArrival,t.pointCategory=n.pointCategory,i=t.isChecked.subscribe(function(n){n?f():u();$.cookie(cityWay.consts.map.cookies.legend+"_events_"+t.id,n,{path:"/"});cityWay.eventManager.publish(cityWay.events.map.legendStateChanged,t,n)}),t._isCheckedSubscription=i,cityWay.eventManager.publish(cityWay.events.map.legendStateChanged,t,r()),t}});$(function(){cityWay.GroupedLegendView=function(n,t){function f(){var n="legend-body-"+i.map.mapId,t=i.templateUri;$("<div />").load(t,function(t){var r=$(t)[0];$("#"+n).html("").append(r);ko.applyBindings(i,r);u()})}function u(){u.isLoaded||cityWay.mapDataService.getGroupedNodeLegendItems(i.context).then(function(n){var t,o,f;if(n.Data){for(t=Enumerable.From(n.Data).Select(function(n){return new cityWay.DefaultGroupLegendItem({map:i.map,id:n.Id,name:n.Name,type:n.Type,canHide:n.CanHide,isChecked:n.IsChecked,order:n.Order,parent:i,mutuallyExclusiveWith:n.MutuallyExclusiveWith,items:Enumerable.From(n.Items).Select(function(n){return new cityWay.DefaultLegendItem({map:i.map,id:n.Id,className:n.Style,label:n.Label,canHide:n.CanHide,pointType:n.ItemType||n.PointType,pointCategory:n.PointCategory,geometryType:n.GeometryType})}).OrderBy(function(n){return n.label}).ToArray()})}).OrderBy(function(n){return n.order}).ThenBy(function(n){return n.name}).ToArray(),i.nodeLegendFilter&&(t=Enumerable.From(t).Where(i.nodeLegendFilter).ToArray()),Enumerable.From(t).ForEach(function(n){Enumerable.From(n.items).ForEach(function(n){n.items=e({legendItem:n,pointType:n.pointType,category:n.pointCategory})})}),o=[],f=0;f<Math.ceil(t.length/3);f++)o.push({group:Enumerable.From(t).Skip(f*3).Take(3).ToArray()});u.isLoaded=!0;r(o)}})}function e(n){var t=n.pointType+(!n.category?"":"_"+n.category);return window.ko.computed(function(){return Enumerable.From(i.map.flatNodes()).Where(function(n){return t==n.getItemType()}).Select(function(t){return t._legendItem=n.legendItem,t}).ToArray()})}var r=ko.observableArray([]),i=new cityWay.mapView(n);return i.templateUri=t.templateUri||"/Cityway.TSI.Core/Embedded/Map/templates/legend/grouped-legend-template.html",i.context=t.context||cityWay.consts.map.context.defaultContext,i.nodeLegends=window.ko.computed(function(){return r()}),i.load=function(){f();i._loaded(!0)},i.unload=function(){i._loaded(!1)},i.nodeLegendFilter=function(){return!0},r.subscribe(function(){var n="legend-body-"+i.map.mapId;jQuery(".cw-checkboxbutton","#"+n).checkboxbutton()}),i};cityWay.DefaultGroupLegendItem=function(n){function i(n){return!n?"":n.replace(/[^\w]/g,"")}function r(){for(var n in t.items)(function(n){var i=n.items(),r,t;for(r in i)t=i[r],t.inClusterNode()?t.getCluster().showNode(t):setTimeout(function(){t.show()})})(t.items[n])}function u(){for(var n in t.items)(function(n){var i=n.items(),r,t;for(r in i)t=i[r],t.inClusterNode()?t.getCluster().hideNode(t):setTimeout(function(){t.hide()})})(t.items[n])}if(!n.map)throw new Error("The map control must be specified");if(!n.type)throw Error("type must be specified");if(!n.parent)throw Error("parent must be specified");var t=this;return t.map=n.map,t.id=n.id,t.name=n.name,t.type=n.type,t.canHide=ko.observable(!!n.canHide),t.isChecked=ko.observable(!!n.isChecked),t.isVisible=ko.observable(!0),t.items=n.items||[],t._parent=n.parent,t.idAttr="group-legend-item-"+i(t.id),t.mutuallyExclusiveWith=n.mutuallyExclusiveWith||[],t.order=n.order||0,t.isChecked.subscribe(function(n){t.map.isBehaviorEnabled(cityWay.LegendCheckableBehavior.id)&&(t.type!=cityWay.consts.map.legend.groupTypes.traffic?n?(r(),Enumerable.From(t.items).ForEach(function(n){n.isChecked(!0)})):(u(),Enumerable.From(t.items).ForEach(function(n){n.isChecked(!1)})):t.map.isBehaviorEnabled(cityWay.TrafficInfoLayerBehavior.id)&&t.type==cityWay.consts.map.legend.groupTypes.traffic&&(n?(t.map.behaviors[cityWay.TrafficInfoLayerBehavior.id].enableLayer(t.id),Enumerable.From(t._parent.nodeLegends().map(function(n){return n.group}).mergeAll()).Where(function(n){return n.id!=t.id&&t.mutuallyExclusiveWith.indexOf(n.id)>-1}).ForEach(function(n){n.isChecked(!1);$("#"+n.idAttr).checkboxbutton("updateState")})):t.map.behaviors[cityWay.TrafficInfoLayerBehavior.id].disableLayer(t.id)));$("#"+t.idAttr).checkboxbutton("updateState",n);cityWay.eventManager.publish(cityWay.events.map.legendStateChanged,t,n)}),!t.isChecked()&&t.map.isBehaviorEnabled(cityWay.TrafficInfoLayerBehavior.id)&&t.type==cityWay.consts.map.legend.groupTypes.traffic&&t.map.behaviors[cityWay.TrafficInfoLayerBehavior.id].disableLayer(t.id),t}});$(function(){cityWay.DefaultPreferencesView=function(n,t){function f(){i.applyLegend(i);i.applyLegendOpen(i);cityWay.eventManager.publish(cityWay.events.map.preferencesApplied,i)}function e(){r.push(i.hideLegendChecked.subscribe(function(n){i.legendOpen(!n);var t={};t[cityWay.consts.map.preferences.legendOpen]=i.legendOpen();u(t)}))}function u(n){return cityWay.mapDataService.saveUserPreferences(n).then(function(){})}function o(){cityWay.mapDataService.getUserProfile().then(function(n){!n||(i.isMemberConnected(n.IsMemberConnected),i.mapLatCenter(n.MapLatCenter),i.mapLngCenter(n.MapLngCenter),i.mapZoom(n.MapZoom),i.legendSelectedItems(n.LegendSeletedItem||[]),i.memberPreferencesUrl(n.MemberPreferencesUrl),i.hideLegendChecked(n.LegendOpen==null?!1:!!!n.LegendOpen),setTimeout(function(){f()},500))})}function s(){var n="preferences-body-"+i.map.mapId,t=i.templateUri;$("<div />").load(t,function(t){var r=$(t)[0];$("#"+n).html("").append(r);ko.applyBindings(i,r)})}var i=new cityWay.mapView(n),r;return i.templateUri=t.templateUri||"/Cityway.TSI.Core/Embedded/Map/templates/preferences/default-preferences-template.html",i.isMemberConnected=window.ko.observable(!1),i.memberPreferencesUrl=window.ko.observable(""),i.mapLatCenter=window.ko.observable(!1),i.mapLngCenter=window.ko.observable(!1),i.mapZoom=window.ko.observable(!1),i.anyPosition=window.ko.computed(function(){return i.isMemberConnected()&&!!i.mapLatCenter()&&!!i.mapLngCenter()&&!!i.mapZoom()}),i.legendSelectedItems=window.ko.observableArray([]),i.anyLegendItem=window.ko.computed(function(){return i.isMemberConnected()&&!!i.legendSelectedItems()&&i.legendSelectedItems().length>0}),i.legendOpen=window.ko.observable(!0),i.hideLegendChecked=window.ko.observable(!1),i.load=function(){o();s();e();i._loaded(!0)},i.unload=function(){for(var n=0;n<r.length;n++)r[n].dispose();i._loaded(!1)},i.savePositionAndZoom=function(n,t){var e=n.map.mapControl,r=e.getCenter(),o=e.getZoom(),f={};f[cityWay.consts.map.preferences.mapLatCenter]=r.lat;f[cityWay.consts.map.preferences.mapLngCenter]=r.lng;f[cityWay.consts.map.preferences.mapZoom]=o;u(f).then(function(){!t||$(t.target).button("reset").addClass("visited");i.mapLatCenter(r.lat);i.mapLngCenter(r.lng);i.mapZoom(o)})},i.saveLegendItems=function(n,t){var f={},e=n.map._legendView,r=i.legendSelectedItems().slice(0),o=Enumerable.From(e.nodeLegends()).SelectMany(function(n){return n.group}).ToArray();Enumerable.From(o).Where(function(n){return!!n.id}).ForEach(function(n){var t=r.indexOf(n.id),i=n.isChecked();i&&t==-1&&r.push(n.id);!i&&t>-1&&r.splice(t,1)});i.legendSelectedItems(r);f[cityWay.consts.map.preferences.legendSeletedItem]=r.join(cityWay.consts.map.preferences.multipleValuesSeparator);u(f).then(function(){!t||$(t.target).button("reset").addClass("visited")})},i.applyPosition=function(n,t){i.anyPosition()&&(i.map.mapControl.setView({lat:i.mapLatCenter(),lng:i.mapLngCenter()},i.mapZoom(),{zoom:{animate:!0}}),!t||$(t.target).addClass("visited"))},i.applyLegend=function(n,t){if(i.anyLegendItem()&&i.map.isBehaviorEnabled(cityWay.LegendBehavior.id)){var r=n.map._legendView,u=Enumerable.From(r.nodeLegends()).SelectMany(function(n){return n.group}).ToArray(),f=i.legendSelectedItems().slice(0);Enumerable.From(u).ForEach(function(n){n.isChecked(f.indexOf(n.id)!==-1)});!t||$(t.target).addClass("visited")}},i.applyLegendOpen=function(){i.hideLegendChecked()&&($("#legend-"+i.map.mapId).collapse("hide"),$("a[href='#legend-"+i.map.mapId+"']").addClass("collapsed"))},r=[],i}});$(function(){cityWay.TrafficInfoLegendView=function(n,t){function e(){var n,t,r;if(i.restricted())return!1;for(n=0,t=i.arrayNodeLegends().length;n<t;++n)if(r=i.arrayNodeLegends()[n],r.canHide())return!0;return!1}function o(){var n="legend-body-"+i.map.mapId,t=i.templateUri;$("<div />").load(t,function(t){var u=$(t)[0];$("#"+n).html("").append(u);ko.applyBindings(i,u);i.useStaticDisplay()&&r()})}function r(){r.isLoaded||cityWay.mapDataService.getSpecificLegendItems(f).then(function(n){var t,o,f;if(n.Data){for(t=Enumerable.From(n.Data).Select(function(n){return new cityWay.TrafficInfoLegendItem({map:i.map,id:n.Id,geometryType:n.GeometryType,className:n.Style,label:n.Label,canHide:i.restricted()&&n.PointType==cityWay.pointType.poi?!1:n.CanHide,pointType:n.PointType,itemType:n.ItemType,order:n.Order,isChecked:i.restricted()&&n.PointType==cityWay.pointType.poi?!0:!1})}).OrderBy(function(n){return n.Order}).ToArray(),o=[],f=0;f<Math.ceil(t.length/3);f++)o.push({group:Enumerable.From(t).Skip(f*3).Take(3).ToArray()});r.isLoaded=!0;i.arrayNodeLegends(t);i.linkVisible(e());u(o)}})}function s(){return u()}var u=ko.observableArray([]),i=new cityWay.mapView(n),f=t.context;return i.templateUri=t.templateUri||"/Cityway.TSI.Core/Embedded/Map/templates/legend/trafficinfo-legend-template.html",i.topPartVisible=ko.observable(t&&t.topPartVisible==!1?!1:!0),i.middlePartVisible=ko.observable(t&&t.middlePartVisible==!1?!1:!0),i.linkVisible=ko.observable(t&&t.linkVisible==!1?!1:!0),i.bottomPartVisible=ko.observable(t&&t.bottomPartVisible==!1?!1:!0),i.useStaticDisplay=ko.observable(t&&t.useStaticDisplay==!1?!1:!0),i.restricted=ko.observable(t&&t.restricted==!0?!0:!1),i.nodeLegends=window.ko.computed(function(){return s()}),i.itineraryLegends=window.ko.computed(function(){return[]}),i.arrayNodeLegends=ko.observableArray([]),i.load=function(){o();i._loaded(!0)},i.unload=function(){$("#legend-body-"+i.map.mapId).html("");i._loaded(!1)},i.nodeLegendFilter=function(){return!0},i.useStaticDisplay.subscribe(function(n){n&&r()}),i.selectAll=function(){for(var r,n=0,t=i.arrayNodeLegends().length;n<t;++n)r=i.arrayNodeLegends()[n],r.isChecked(!0)},i.deselectAll=function(){for(var r,n=0,t=i.arrayNodeLegends().length;n<t;++n)r=i.arrayNodeLegends()[n],r.isChecked(!1)},i};cityWay.TrafficInfoLegendItem=function(n){function r(n,i){var r,u;if(n!=cityWay.itemType.openMountainPass&&n!=cityWay.itemType.closedMountainPass&&n!=cityWay.itemType.closedPermanentlyForTheWinter&&n!=cityWay.itemType.mountainPassWithSpecialEquipmentRequired)r=Enumerable.From(t.map._internalNodes()).FirstOrDefault(undefined,function(n){return n.type==="clusterNode"}),!r||Enumerable.From(r.nodes()).ForEach(function(n){n.itemType==t.itemType&&(i?r.showNode(n):r.hideNode(n))});else if(r=t.map._internalNodes(),!!r)for(u in r)r[u].itemType==t.itemType&&(i?r[u].show():r[u].hide())}var t,i;if(!n.map)throw new Error("The map control must be specified");if(!n.geometryType)throw Error("GeoJson type must be specified");return t=this,t.map=n.map,t.id=n.id||"",t.geometryType=n.geometryType,t.className=n.className||"",t.label=ko.observable(n.label||""),t.items=n.items||ko.observableArray([]),t.canHide=ko.observable(!!n.canHide),t.isChecked=ko.observable(!0),t.isVisible=ko.observable(!0),t.order=n.order||0,t.pointType=n.pointType,t.itemType=n.itemType,i=t.isChecked.subscribe(function(n){t.map.isBehaviorEnabled(cityWay.LegendCheckableBehavior.id)&&r(t.itemType,n);cityWay.eventManager.publish(cityWay.events.map.legendStateChanged,t,n)}),t._isCheckedSubscription=i,t}});$(function(){cityWay.menuItem=function(n){if(!n)throw new Error("Map must be specified");var t=this;return t.map=n,t.text=null,t.element=ko.observable(),t.menu=null,t.callback=function(){},t.disable=function(){!t.element()||!t.menu||t.menu.setDisabled(t.element(),!0)},t.enable=function(){!t.element()||!t.menu||t.menu.setDisabled(t.element(),!1)},t}});$(function(){cityWay.LabelMenuItem=function(n,t){if(!!!t||!!!t.text)throw new Error("Text must be specified");var i=new cityWay.menuItem(n);return i.text="<b>"+t.text+"<\/b>",i.foundCallback=t.foundCallback||null,i.callback=function(){return},i.disable(),i}});$(function(){cityWay.SelectionRangeMenuItem=function(n){function i(n){if(n===t.map){var i=t.map.mapControl.getZoom();(!cityWay.config.map.SelectionRange.ZoomMin||i>=cityWay.config.map.SelectionRange.ZoomMin)&&(!cityWay.config.map.SelectionRange.ZoomMax||i<=cityWay.config.map.SelectionRange.ZoomMax)?(t.element().text=cityWay.texts.map.Menu_SelectPlace,t.enable()):(t.element().text=cityWay.texts.map.Menu_ZoomToSelect,t.disable())}}var t=new cityWay.menuItem(n);t.text=cityWay.texts.map.Menu_SelectPlace;t.callback=function(n){var i=t.map.mapControl.getZoom();(!cityWay.config.map.SelectionRange.ZoomMin||i>=cityWay.config.map.SelectionRange.ZoomMin)&&(!cityWay.config.map.SelectionRange.ZoomMax||i<=cityWay.config.map.SelectionRange.ZoomMax)&&(t.map._internalNodes.remove(function(n){return n.pointType===cityWay.pointType.roadLink&&!n.isLocked()}),cityWay.mapDataService.getNearestRoad(n.latlng.lat,n.latlng.lng).then(function(i){if(i.Data){var u=i.Data,r=cityWay.mapNodeFactory.createNodeFromRoadLink(t.map,u,!0);r.setPosition(n.latlng.lat,n.latlng.lng);t.map._internalNodes.push(r);t.map.mapControl.setView([r.latitude,r.longitude],t.map.mapControl.getZoom())}else cityWay.eventManager.publish(cityWay.events.map.nearestRoadNotFound,t)},function(){cityWay.eventManager.publish(cityWay.events.map.nearestRoadNotFound,t)}))};t.map.mapControl.on("contextmenu.show",function(){i(t.map)});return t}});$(function(){cityWay.GoMenuItem=function(n,t){function r(n){if(n===i.map){var t=i.map.mapControl.getZoom();(!cityWay.config.map.SelectionRange.ZoomMin||t>=cityWay.config.map.SelectionRange.ZoomMin)&&(!cityWay.config.map.SelectionRange.ZoomMax||t<=cityWay.config.map.SelectionRange.ZoomMax)?i.enable():i.disable()}}if(!!!t||!!!t.text)throw new Error("Text must be specified");if(!!!t.url&&(!!!t.foundCallback||!$.isFunction(t.foundCallback)))throw new Error("Either url or foundCallback must be specified");var i=new cityWay.menuItem(n);i.text=t.text;i.url=t.url;i.foundCallback=t.foundCallback||null;i.callback=function(t){var r=i.map.mapControl.getZoom();(!cityWay.config.map.SelectionRange.ZoomMin||r>=cityWay.config.map.SelectionRange.ZoomMin)&&(!cityWay.config.map.SelectionRange.ZoomMax||r<=cityWay.config.map.SelectionRange.ZoomMax)&&(i.map._internalNodes.remove(function(n){return n.pointType===cityWay.pointType.roadLink&&!n.isLocked()}),cityWay.mapDataService.getNearestRoad(t.latlng.lat,t.latlng.lng).then(function(r){if(r.Data){var f=r.Data,u=cityWay.mapNodeFactory.createNodeFromRoadLink(i.map,f,!0);u.setPosition(t.latlng.lat,t.latlng.lng);i.map._internalNodes.push(u);i.map.mapControl.setView([u.latitude,u.longitude],i.map.mapControl.getZoom());$("body").toggleClass("wait");setTimeout(function(){!i.foundCallback?window.location.href=sessionStorage.getItem("wlCode")!==null&&sessionStorage.getItem("wlCode")!==""?encodeURI(i.url+u.getId()+"&wlcode="+sessionStorage.getItem("wlCode")):encodeURI(i.url+u.getId()):(i.foundCallback(n,u,r.Data,i),$("body").removeClass("wait"))},80)}else cityWay.eventManager.publish(cityWay.events.map.nearestRoadNotFound,i)},function(){cityWay.eventManager.publish(cityWay.events.map.nearestRoadNotFound,i)}))};i.map.mapControl.on("contextmenu.show",function(){r(i.map)});return i}});cityWay.modules.mapResponsive={};cityWay.modules.mapResponsive.bindPopup=function(n){var t=function(t){$("#popup-"+n.mapId).empty().html(t.popup.getContent());$("p.title","#popup-"+n.mapId).find(".leaflet-popup-close-button").remove();var i=$('<button class="btn-link leaflet-popup-close-button" href="#close" aria-label="'+cityWay.texts.common.Button_Close+'">×<\/button>');$("p.title","#popup-"+n.mapId).append(i);i.on("click",function(){return n.mapControl.closePopup(),!0});t.popup.on("contentupdate",function(){$("#popup-"+n.mapId).empty().html(t.popup.getContent());$("p.title","#popup-"+n.mapId).find(".leaflet-popup-close-button").remove();var i=$('<button class="btn-link leaflet-popup-close-button" href="#close" aria-label="'+cityWay.texts.common.Button_Close+'">×<\/button>');$("p.title","#popup-"+n.mapId).append(i);i.on("click",function(){return n.mapControl.closePopup(),!0});return cityWay.eventManager.publish(cityWay.events.map.responsivePopupContentUpdate,t.popup,$("#popup-"+n.mapId)),!1});return cityWay.eventManager.publish(cityWay.events.map.responsivePopupOpen,t.popup,$("#popup-"+n.mapId)),!1},i=function(t){return $("#popup-"+n.mapId).empty(),cityWay.eventManager.publish(cityWay.events.map.responsivePopupClose,t.popup,$("#popup-"+n.mapId)),!1};enquire.register("screen and (max-width: "+cityWay.tools.getLessVars("Responsive").screenSmMax+"px)",{match:function(){n.mapControl.on("popupopen",t);n.mapControl.on("popupclose",i);var r=$("<div/>").attr("id","popup-"+n.mapId);r.insertAfter("#"+n.mapId)},unmatch:function(){n.mapControl.off("popupopen",t);n.mapControl.off("popupclose",i)}})}