2gis-maps
Version:
Interactive 2GIS maps API, based on Leaflet
7 lines (6 loc) • 770 kB
JavaScript
/*
Maps api created at 2GIS. Build on Leaflet.
(c) 2013-2016, 2GIS
*/
!function(){function t(e,i,o){function n(s,a){if(!i[s]){if(!e[s]){var l="function"==typeof require&&require;if(!a&&l)return l(s,!0);if(r)return r(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var c=i[s]={exports:{}};e[s][0].call(c.exports,function(t){var i=e[s][1][t];return n(i||t)},c,c.exports,t,e,i,o)}return i[s].exports}for(var r="function"==typeof require&&require,s=0;s<o.length;s++)n(o[s]);return n}return t}()({1:[function(_dereq_,module,exports){(function(process){(function(){function toPoint(t,e,i){return t instanceof DG.Point?t:DG.Util.isArray(t)?new DG.Point(t[0],t[1]):void 0===t||null===t?t:"object"==typeof t&&"x"in t&&"y"in t?new DG.Point(t.x,t.y):new DG.Point(t,e,i)}"function"!=typeof Array.prototype.reduce&&(Array.prototype.reduce=function(t,e){"use strict";if(null===this||"undefined"==typeof this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof t)throw new TypeError(t+" is not a function");var i,o,n=this.length>>>0,r=!1;for(1<arguments.length&&(o=e,r=!0),i=0;n>i;++i)this.hasOwnProperty(i)&&(r?o=t(o,this[i],i,this):(o=this[i],r=!0));if(!r)throw new TypeError("Reduce of empty array with no initial value");return o}),Array.prototype.forEach||(Array.prototype.forEach=function(t,e){"use strict";var i,o;if(null==this)throw new TypeError("this is null or not defined");var n,r=Object(this),s=r.length>>>0;if("[object Function]"!=={}.toString.call(t))throw new TypeError(t+" is not a function");for(arguments.length>=2&&(i=e),o=0;o<s;)o in r&&(n=r[o],t.call(i,n,o,r)),o++}),Object.keys||(Object.keys=function(){"use strict";var t=Object.prototype.hasOwnProperty,e=!{toString:null}.propertyIsEnumerable("toString"),i=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],o=i.length;return function(n){if("object"!=typeof n&&("function"!=typeof n||null===n))throw new TypeError("Object.keys called on non-object");var r,s,a=[];for(r in n)t.call(n,r)&&a.push(r);if(e)for(s=0;s<o;s++)t.call(n,i[s])&&a.push(i[s]);return a}}()),Array.prototype.some||(Array.prototype.some=function(t){"use strict";if(void 0===this||null===this)throw new TypeError;var e=Object(this),i=e.length>>>0;if("function"!=typeof t)throw new TypeError;for(var o=arguments.length>=2?arguments[1]:void 0,n=0;n<i;n++)if(n in e&&t.call(o,e[n],n,e))return!0;return!1}),Array.prototype.map||(Array.prototype.map=function(t){"use strict";if(void 0===this||null===this)throw new TypeError;var e=Object(this),i=e.length>>>0;if("function"!=typeof t)throw new TypeError;for(var o=new Array(i),n=arguments.length>=2?arguments[1]:void 0,r=0;r<i;r++)r in e&&(o[r]=t.call(n,e[r],r,e));return o}),Array.prototype.filter||(Array.prototype.filter=function(t){"use strict";if(void 0===this||null===this)throw new TypeError;var e=Object(this),i=e.length>>>0;if("function"!=typeof t)throw new TypeError;for(var o=[],n=arguments.length>=2?arguments[1]:void 0,r=0;r<i;r++)if(r in e){var s=e[r];t.call(n,s,r,e)&&o.push(s)}return o}),Function.prototype.bind||(Function.prototype.bind=function(t){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var e=Array.prototype.slice.call(arguments,1),i=this,o=function(){},n=function(){return i.apply(this instanceof o&&t?this:t,e.concat(Array.prototype.slice.call(arguments)))};return o.prototype=this.prototype,n.prototype=new o,n}),Array.prototype.indexOf||(Array.prototype.indexOf=function(t,e){if(void 0===this||null===this)throw new TypeError('"this" is null or not defined');var i=this.length>>>0;for(e=+e||0,Math.abs(e)===1/0&&(e=0),e<0&&(e+=i,e<0&&(e=0));e<i;e++)if(this[e]===t)return e;return-1}),"function"!=typeof Promise&&!function(){var t,e,i,o;!function(){var n={},r={};t=function(t,e,i){n[t]={deps:e,callback:i}},o=i=e=function(t){function i(e){if("."!==e.charAt(0))return e;for(var i=e.split("/"),o=t.split("/").slice(0,-1),n=0,r=i.length;n<r;n++){var s=i[n];if(".."===s)o.pop();else{if("."===s)continue;o.push(s)}}return o.join("/")}if(o._eak_seen=n,r[t])return r[t];if(r[t]={},!n[t])throw new Error("Could not find module "+t);for(var s,a=n[t],l=a.deps,u=a.callback,c=[],h=0,d=l.length;h<d;h++)"exports"===l[h]?c.push(s={}):c.push(e(i(l[h])));var _=u.apply(this,c);return r[t]=s||_}}(),t("promise/all",["./utils","exports"],function(t,e){"use strict";function i(t){var e=this;if(!o(t))throw new TypeError("You must pass an array to all.");return new e(function(e,i){function o(t){return function(e){r(t,e)}}function r(t,i){a[t]=i,0===--l&&e(a)}var s,a=[],l=t.length;0===l&&e([]);for(var u=0;u<t.length;u++)s=t[u],s&&n(s.then)?s.then(o(u),i):r(u,s)})}var o=t.isArray,n=t.isFunction;e.all=i}),t("promise/asap",["exports"],function(t){"use strict";function e(){return function(){process.nextTick(n)}}function i(){var t=0,e=new l(n),i=document.createTextNode("");return e.observe(i,{characterData:!0}),function(){i.data=t=++t%2}}function o(){return function(){u.setTimeout(n,1)}}function n(){for(var t=0;t<c.length;t++){var e=c[t],i=e[0],o=e[1];i(o)}c=[]}function r(t,e){var i=c.push([t,e]);1===i&&s()}var s,a="undefined"!=typeof window?window:{},l=a.MutationObserver||a.WebKitMutationObserver,u=window,c=[];s="undefined"!=typeof process&&"[object process]"==={}.toString.call(process)?e():l?i():o(),t.asap=r}),t("promise/config",["exports"],function(t){"use strict";function e(t,e){return 2!==arguments.length?i[t]:void(i[t]=e)}var i={instrument:!1};t.config=i,t.configure=e}),t("promise/polyfill",["./promise","./utils","exports"],function(t,e,i){"use strict";function o(){var t;t="undefined"!=typeof window&&window.document?window:self;var e="Promise"in t&&"resolve"in t.Promise&&"reject"in t.Promise&&"all"in t.Promise&&"race"in t.Promise&&function(){var e;return new t.Promise(function(t){e=t}),r(e)}();e||(t.Promise=n)}var n=t.Promise,r=e.isFunction;i.polyfill=o}),t("promise/promise",["./config","./utils","./all","./race","./resolve","./reject","./asap","exports"],function(t,e,i,o,n,r,s,a){"use strict";function l(t){if(!w(t))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof l))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=[],u(t,this)}function u(t,e){function i(t){p(e,t)}function o(t){f(e,t)}try{t(i,o)}catch(n){o(n)}}function c(t,e,i,o){var n,r,s,a,l=w(i);if(l)try{n=i(o),s=!0}catch(u){a=!0,r=u}else n=o,s=!0;_(e,n)||(l&&s?p(e,n):a?f(e,r):t===T?p(e,n):t===O&&f(e,n))}function h(t,e,i,o){var n=t._subscribers,r=n.length;n[r]=e,n[r+T]=i,n[r+O]=o}function d(t,e){for(var i,o,n=t._subscribers,r=t._detail,s=0;s<n.length;s+=3)i=n[s],o=n[s+e],c(e,i,o,r);t._subscribers=null}function _(t,e){var i,o=null;try{if(t===e)throw new TypeError("A promises callback cannot return that same promise.");if(b(e)&&(o=e.then,w(o)))return o.call(e,function(o){return!!i||(i=!0,void(e!==o?p(t,o):m(t,o)))},function(e){return!!i||(i=!0,void f(t,e))}),!0}catch(n){return!!i||(f(t,n),!0)}return!1}function p(t,e){t===e?m(t,e):_(t,e)||m(t,e)}function m(t,e){t._state===G&&(t._state=C,t._detail=e,v.async(g,t))}function f(t,e){t._state===G&&(t._state=C,t._detail=e,v.async(y,t))}function g(t){d(t,t._state=T)}function y(t){d(t,t._state=O)}var v=t.config,b=(t.configure,e.objectOrFunction),w=e.isFunction,k=(e.now,i.all),D=o.race,x=n.resolve,L=r.reject,P=s.asap;v.async=P;var G=void 0,C=0,T=1,O=2;l.prototype={constructor:l,_state:void 0,_detail:void 0,_subscribers:void 0,then:function(t,e){var i=this,o=new this.constructor(function(){});if(this._state){var n=arguments;v.async(function(){c(i._state,o,n[i._state-1],i._detail)})}else h(this,o,t,e);return o},"catch":function(t){return this.then(null,t)}},l.all=k,l.race=D,l.resolve=x,l.reject=L,a.Promise=l}),t("promise/race",["./utils","exports"],function(t,e){"use strict";function i(t){var e=this;if(!o(t))throw new TypeError("You must pass an array to race.");return new e(function(e,i){for(var o,n=0;n<t.length;n++)o=t[n],o&&"function"==typeof o.then?o.then(e,i):e(o)})}var o=t.isArray;e.race=i}),t("promise/reject",["exports"],function(t){"use strict";function e(t){var e=this;return new e(function(e,i){i(t)})}t.reject=e}),t("promise/resolve",["exports"],function(t){"use strict";function e(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=this;return new e(function(e){e(t)})}t.resolve=e}),t("promise/utils",["exports"],function(t){"use strict";function e(t){return i(t)||"object"==typeof t&&null!==t}function i(t){return"function"==typeof t}function o(t){return"[object Array]"===Object.prototype.toString.call(t)}var n=Date.now||function(){return(new Date).getTime()};t.objectOrFunction=e,t.isFunction=i,t.isArray=o,t.now=n}),e("promise/polyfill").polyfill()}(),_dereq_("leaflet"),_dereq_("html5shiv");var oldDG=window.DG,DG=new(function(){var t=function(){},e=function(){};return e.prototype=L,t.prototype=new e,t}());for(var prop in oldDG)oldDG.hasOwnProperty(prop)&&"undefined"==typeof DG[prop]&&(DG[prop]=oldDG[prop]);window.__dgApi__=window.__dgApi__||{},DG.version=window.__dgApi__.version,DG.Icon.Default.imagePath="../img/vendors/leaflet",DG.Map.include({addHandler:function(t,e){if(!e)return this;var i=this.options[t],o=i===Object(i)?i:null,n=this[t]=new e(this,o);return this._handlers.push(n),i&&n.enable(),this}}),DG.Map.addInitHook(function(){DG.Browser.touchEnabled||DG.DomUtil.addClass(this._container,"no-touch")}),window.DG=DG,module.exports=DG;var handlers=window.__dgApi__.callbacks||[],chain=Promise.resolve();handlers.forEach(function(t){chain=chain.then(t[0],t[1])}),DG.then=function(t,e){return chain.then(t,e)},chain["catch"](function(t){console.error(t)}),DG.plugin=function(t){var e,i=new RegExp(/.js$/i),o=new RegExp(/.css$/i);return new Promise(function(n){function r(){e--,0===e&&n()}function s(t){var e=document.createElement("script");e.setAttribute("type","text/javascript"),e.setAttribute("src",t),e.onload=function(){r()},e.onerror=function(){r()},e.onreadystatechange=function(){"complete"!==e.readyState&&"loaded"!==e.readyState||r()},document.getElementsByTagName("head")[0].appendChild(e)}function a(t){var e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),e.setAttribute("href",t),document.getElementsByTagName("head")[0].appendChild(e),r()}function l(t){return i.test(t)}function u(t){return o.test(t)}function c(t){l(t)?s(t):u(t)?a(t):e--}DG.Util.isArray(t)&&(e=t.length,t.forEach(function(t){c(t)})),"string"==typeof t&&(e=1,c(t))})},DG.ajax=function(){function handleReadyState(t,e,i){return function(){return t._aborted?i(t.request):void(t.request&&4===t.request[readyState]&&(t.request.onreadystatechange=noop,twoHundo.test(t.request.status)?e(t.request):i(t.request)))}}function setHeaders(t,e){var i,o=e.headers||{};o.Accept=o.Accept||defaultHeaders.accept[e.dataType]||defaultHeaders.accept["*"],e.crossDomain||o[requestedWith]||(o[requestedWith]=defaultHeaders.requestedWith),o[contentType]||(o[contentType]=e.contentType||defaultHeaders.contentType);for(i in o)o.hasOwnProperty(i)&&"setRequestHeader"in t&&t.setRequestHeader(i,o[i])}function setCredentials(t,e){"undefined"!=typeof e.withCredentials&&"undefined"!=typeof t.withCredentials&&(t.withCredentials=!!e.withCredentials)}function generalCallback(t){lastValue=t}function urlappend(t,e){return t+(/\?/.test(t)?"&":"?")+e}function handleJsonp(t,e,i,o){var n=uniqid++,r=t.jsonpCallback||"callback",s=t.jsonpCallbackName||callbackPrefix,a=new RegExp("((^|\\?|&)"+r+")=([^&]+)"),l=o.match(a),u=doc.createElement("script"),c=0,h=navigator.userAgent.indexOf("MSIE 10.0")!==-1;return l?"?"===l[3]?o=o.replace(a,"$1="+s):s=l[3]:o=urlappend(o,r+"="+s),win[s]=generalCallback,u.type="text/javascript",u.src=o,u.async=!0,"undefined"==typeof u.onreadystatechange||h||(u.event="onclick",u.htmlFor=u.id="_request_"+n),u.onerror=function(){u.onerror=u.onload=u.onreadystatechange=null,i({},"Request unknown error",{}),lastValue=void 0,head.removeChild(u),c=1},u.onload=u.onreadystatechange=function(){return!(u[readyState]&&"complete"!==u[readyState]&&"loaded"!==u[readyState]||c)&&(u.onerror=u.onload=u.onreadystatechange=null,u.onclick&&u.onclick(),e(lastValue),lastValue=void 0,head.removeChild(u),void(c=1))},head.appendChild(u),{abort:function(){u.onerror=u.onload=u.onreadystatechange=null,i({},"Request is aborted: timeout",{}),lastValue=void 0,head.removeChild(u),c=1}}}function getRequest(t,e){var i,o=this.options,n=(o.type||"GET").toUpperCase(),r="string"==typeof o?o:o.url,s=o.processData!==!1&&o.data&&"string"!=typeof o.data?Ajax.toQueryString(o.data):o.data||null,a=!1;return"jsonp"!==o.type&&"GET"!==n||!s||(r=urlappend(r,s),s=null),"jsonp"===o.type?handleJsonp(o,t,e,r):(i=xhr(o),i.open(n,r,o.async!==!1),setHeaders(i,o),setCredentials(i,o),win[xDomainRequest]&&i instanceof win[xDomainRequest]?(i.onload=t,i.onprogress=function(){},i.ontimeout=function(){},i.onerror=e,a=!0):i.onreadystatechange=handleReadyState(this,t,e),a?setTimeout(function(){i.send(s)},200):i.send(s),i)}function buildParams(t,e,i,o){var n,r,s,a=/\[\]$/;if(DG.Util.isArray(e))for(r=0;e&&r<e.length;r++)s=e[r],i||a.test(t)?o(t,s):buildParams(t+"["+("object"==typeof s?r:"")+"]",s,i,o);else if(e&&"[object Object]"===e.toString())for(n in e)e.hasOwnProperty(n)&&buildParams(t+"["+n+"]",e[n],i,o);else o(t,e)}function setType(t){var e=t.match(/\.(json|jsonp|html|xml)(\?|$)/);return e?e[1]:"js"}function isCrossDomain(t){var e=rurl.exec(t.toLowerCase());return!(!e||e[1]===ajaxLocParts[1]&&e[2]===ajaxLocParts[2]&&(e[3]||("http:"===e[1]?"80":"443"))===(ajaxLocParts[3]||("http:"===ajaxLocParts[1]?"80":"443")))}function doRequest(o){"crossDomain"in o||(o.crossDomain=isCrossDomain(o.url));var self={};return self.promise=new Promise(function(resolve,reject){function complete(t){o.timeout&&clearTimeout(self.timeout),self.timeout=null,self._erred?reject(t):resolve(t)}function success(resp){resp="jsonp"!==type?self.request:resp;var filteredResponse=globalSetupOptions.dataFilter(resp.responseText,type),r=filteredResponse;try{resp.responseText=r}catch(e){}if(r)switch(type){case"json":try{resp=win.JSON.parse(r)}catch(err){return error(resp,"Could not parse JSON in response",err)}break;case"js":resp=eval("("+r+")");break;case"html":resp=r;break;case"xml":resp=resp.responseXML&&resp.responseXML.parseError&&resp.responseXML.parseError.errorCode&&resp.responseXML.parseError.reason?null:resp.responseXML}self._responseArgs.resp=resp,complete(resp)}function error(t,e,i){t=self.request,self._responseArgs.resp=t,self._responseArgs.msg=e,self._responseArgs.t=i,self._erred=!0,complete(t)}self.abort=function(){self._aborted=!0,reject("aborted")},self.url=o.url,self.timeout=null,self.options=o,self._aborted=!1,self._erred=!1,self._responseArgs={};var type="jsonp"===o.type?o.type:o.dataType||setType(self.url);o.timeout&&(self.timeout=setTimeout(function(){self.abort()},o.timeout)),self.request=getRequest.call(self,success,error)}),self}function Ajax(t,e){"[object Object]"===Object.prototype.toString.call(t)&&(e=t,t=void 0),e=e||{},e.url=t||e.url;var i=doRequest(e),o=i.promise;return(e.success||e.error||e.complete)&&o.then(e.success,e.error),o.abort=i.abort,o}var win=window,doc=document,rurl=/^([\w.+-]+:)?(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,twoHundo=/^20\d$/,ajaxLocParts,ajaxLocation,byTag="getElementsByTagName",readyState="readyState",contentType="Content-Type",requestedWith="X-Requested-With",head=doc[byTag]("head")[0],uniqid=0,callbackPrefix="l_dg_ajax_callback_"+ +new Date,lastValue,xmlHttpRequest="XMLHttpRequest",xDomainRequest="XDomainRequest",noop=function(){},defaultHeaders={contentType:"application/x-www-form-urlencoded",requestedWith:xmlHttpRequest,accept:{"*":"text/javascript, text/html, application/xml, text/xml, */*",xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript",js:"application/javascript, text/javascript"}},xhr=function(t){if(t.crossDomain===!0){var e=win[xmlHttpRequest]?new XMLHttpRequest:null;if(e&&"withCredentials"in e)return e;if(win[xDomainRequest])return new XDomainRequest;throw new Error("Browser does not support cross-origin requests")}return new XMLHttpRequest},globalSetupOptions={dataFilter:function(t){return t}};try{ajaxLocation=location.href}catch(e){ajaxLocation=document.createElement("a"),ajaxLocation.href="",ajaxLocation=ajaxLocation.href}ajaxLocParts=rurl.exec(ajaxLocation.toLowerCase())||[],Ajax.setup=function(t){t=t||{};for(var e in t)t.hasOwnProperty(e)&&(globalSetupOptions[e]=t[e])},Ajax.toQueryString=function(t,e){var i,o,n=e||!1,r=[],s=encodeURIComponent,a=function(t,e){e="function"==typeof e?e():e||"",r[r.length]=s(t)+"="+s(e)};if(DG.Util.isArray(t))for(o=0;t&&o<t.length;o++)a(t[o].name,t[o].value);else for(i in t)t.hasOwnProperty(i)&&buildParams(i,t[i],n,a);return r.join("&").replace(/%20/g,"+")};var testxhr=win[xmlHttpRequest]?new XMLHttpRequest:null;return Ajax.corsSupport=!(!(testxhr&&"withCredentials"in testxhr||win[xDomainRequest])||DG.Browser.ie&&document.location.host.toLowerCase().search(/[а-я]/)!=-1),Ajax}(),DG.Wkt={},DG.Wkt.toGeoJSON=function(t){function e(e){var i=t.substring(m).match(e);return i?(m+=i[0].length,i[0]):null}function i(t){return t&&f.match(/\d+/)&&(t.crs={type:"name",properties:{name:"urn:ogc:def:crs:EPSG::"+f}}),t}function o(){e(/^\s*/)}function n(){o();for(var t,i=0,n=[],r=[n],s=n;t=e(/^(\()/)||e(/^(\))/)||e(/^(\,)/)||e(/^[-+]?([0-9]*\.[0-9]+|[0-9]+)/);){if("("===t)r.push(s),s=[],r[r.length-1].push(s),i++;else if(")"===t){if(s=r.pop(),i--,0===i)break}else","===t?(s=[],r[r.length-1].push(s)):s.push(parseFloat(t));o()}return r.length=0,0!==i?null:n}function r(){for(var t,i,n=[];i=e(/^[-+]?([0-9]*\.[0-9]+|[0-9]+)/)||e(/^(\,)/);)","===i?(n.push(t),t=[]):(t||(t=[]),t.push(parseFloat(i))),o();return t&&n.push(t),n.length?n:null}function s(){if(!e(/^(point)/i))return null;if(o(),!e(/^(\()/))return null;var t=r();return o(),e(/^(\))/)?{type:"Point",coordinates:t[0]}:null}function a(){if(!e(/^(multipoint)/i))return null;o();var t=n();return o(),{type:"MultiPoint",coordinates:t}}function l(){if(!e(/^(multilinestring)/i))return null;o();var t=n();return o(),{type:"MultiLineString",coordinates:t}}function u(){if(!e(/^(linestring)/i))return null;if(o(),!e(/^(\()/))return null;var t=r();return e(/^(\))/)?{type:"LineString",coordinates:t}:null}function c(){return e(/^(polygon)/i)?(o(),{type:"Polygon",coordinates:n()}):null}function h(){return e(/^(multipolygon)/i)?(o(),{type:"MultiPolygon",coordinates:n()}):null}function d(){var t,i=[];if(!e(/^(geometrycollection)/i))return null;if(o(),!e(/^(\()/))return null;for(;t=_();)i.push(t),o(),e(/^(\,)/),o();return e(/^(\))/)?{type:"GeometryCollection",geometries:i}:null}function _(){return s()||u()||c()||a()||l()||h()||d()}DG.Util.isArray(t)&&(t=t[0]);var p=t.split(";");t=p.pop();var m=0,f=(p.shift()||"").split("=").pop();return i(_())},DG.Wkt.geoJsonLayer=function(t,e){return DG.geoJson(DG.Wkt.toGeoJSON(t),e)},DG.Wkt._coordsToLatLngs=function(t){return DG.Util.isArray(t)&&!DG.Util.isArray(t[0])?[DG.GeoJSON.coordsToLatLng(t)]:t.map(function(t){return DG.Wkt._coordsToLatLngs(t)}).reduce(function(t,e){return t.concat(e)})},DG.Wkt.toLatLngs=function(t){return DG.Util.isArray(t)||(t=[t]),t.map(function(t){var e=DG.Wkt.toGeoJSON(t).coordinates;return DG.Wkt._coordsToLatLngs(e)}).reduce(function(t,e){return t.concat(e)})},DG.Wkt.toPoints=function(t){return DG.Wkt.toGeoJSON(t).coordinates},DG.Wkt.pointsToLatLngOnMap=function(t,e){return function i(t){return Array.isArray(t)&&Array.isArray(t[0])?t.map(i):e.containerPointToLatLng(t)}(DG.Wkt.toPoints(t))},DG.ProjectDetector=DG.Handler.extend({initialize:function(t){this._map=t,this._project=void 0,this._loadProjectList()},addHooks:function(){this._projectWatch(),this._map.on("move",this._projectWatch,this)},removeHooks:function(){this._map.off("move",this._projectWatch,this)},getProject:function(){return!!this._project&&DG.Util.extend({},this._project)},getProjectsList:function(){return this._projectList.slice(0)},isProjectHere:function(t,e,i){if(!t)return null;t instanceof DG.LatLng||t instanceof DG.LatLngBounds||(t=DG.latLng(t)),t=t instanceof DG.LatLngBounds?DG.latLngBounds(t.getSouthWest().wrap(),t.getNorthEast().wrap()):t.wrap(),i=i||(t instanceof DG.LatLngBounds?"intersects":"contains");var o="intersects"==i?this._testProjectIntersects:this._testProjectContains;return o=o.bind(this,t),e?o(e):this._projectList.filter(o)[0]},_projectWatch:function(){this._map._loaded&&(this._project&&this._zoomInProject(this._project)&&this._centerInProject(this._project)||(this._searchProject(),this._project&&this._map.attributionControl._update(null,this._project.country_code)))},_checkProjectData:function(t){function e(t){return void 0!==t&&null!==t}return t&&t.bounds&&e(t.code)&&e(t.domain)&&e(t.country_code)&&e(t.flags)&&t.zoom_level&&e(t.zoom_level.min)&&e(t.zoom_level.max)&&t.time_zone&&e(t.time_zone.offset)},_loadProjectList:function(){DG.fallbackProjectsList=DG.fallbackProjectsList||[],DG.projectsList||(DG.projectsList=DG.fallbackProjectsList),delete DG.fallbackProjectsList,this._projectList=DG.projectsList.filter(this._checkProjectData).map(function(t){var e=DG.Wkt.toGeoJSON(t.bounds),i=DG.geoJSON(e).getBounds(),o=t.default_pos?DG.latLng(t.default_pos.lat,t.default_pos.lon):null;return{id:t.id,code:t.code,minZoom:t.zoom_level.min,maxZoom:t.zoom_level.max,timeOffset:t.time_zone.offset,bound:e,latLngBounds:i,traffic:!!t.flags.traffic,transport:!!t.flags.public_transport,roads:!!t.flags.road_network,country_code:t.country_code,domain:t.domain,defaultPos:o}})},_searchProject:function(){var t=this._projectList.filter(this._zoomInProject,this),e=t.filter(this._centerInProject,this);if(0===e.length){var i=this._map.getBounds();if(e=t.filter(DG.bind(this._testProjectIntersects,this,i)),e.length>1){for(var o=this._map.getCenter(),n=e[0],r=1;r<e.length;r++){var s=e[r];s.defaultPos&&o.distanceTo(n.defaultPos)>o.distanceTo(s.defaultPos)&&(n=s)}e=[n]}}var a=e[0]||null;if(this._project!==a){var l=this;null!==this._project&&(this._project=null,setTimeout(function(){l._map.fire("projectleave")},1)),a&&(this._project=a,setTimeout(function(){l._map.fire("projectchange",{getProject:l.getProject.bind(l)})},1))}},_testProjectIntersects:function(t,e){return e.latLngBounds.intersects(t)},_testProjectContains:function(t,e){return DG.PolyUtil.inside([t.lng,t.lat],e.bound)},_centerInProject:function(t,e){return this.isProjectHere(this._map.getCenter(),t,e)},_zoomInProject:function(t){return this._map.getZoom()>=t.minZoom}}),DG.Map.mergeOptions({projectDetector:!0}),DG.Map.addInitHook("addHandler","projectDetector",DG.ProjectDetector),DG.Metric=function(){},DG.Metric.Segments=function(){this.length=0},DG.Metric.Segments.prototype={push:function(t){return this[this.length]=this.length>0?this[this.length-1]+t:t,this.length+=1,this},getLength:function(){return this[this.length-1]},getReverse:function(){var t=new DG.Metric.Segments,e=this.length-1;if(e<0)return t;for(;e--;)t.push(this[e+1]-this[e]);return t.push(this[0])},getIndex:function(t){var e=this.length-1;if(e<0)return e;for(;e--&&!(this[e]<=t););return e+1},getSegRatio:function(t){var e=this.getIndex(t),i=e>0?this[e-1]:0;return(t-i)/(this[e]-i)},getSegLength:function(t){var e=this.getIndex(t),i=e>0?this[e-1]:0;return t-i}},DG.VertexTransform=DG.Class.extend({initialize:function(t){this._vertices=t,this._scale=null,this._angle=null,this._trans=null,this._matrix=null,this.load()},load:function(){return this.vertices=this._vertices.map(function(t){return t.clone()}),this.vertices.clone=DG.VertexTransform.clone,this},save:function(){return this._vertices=this.vertices.map(function(t){return t.clone()}),this},setScale:function(t){return this._scale=t,this},getScale:function(){return this._scale},setAngle:function(t){return this._angle=t,this},getAngle:function(){return this._angle},setTranslation:function(t){return this._trans=t,this},getTranslation:function(){return this._trans},setMatrix:function(t){return this._matrix=t,this},getMatrix:function(){return this._matrix},scale:function(t){var e=this.vertices,i=e.length;for(t=t||this._scale||1;i--;)e[i].x*=t,e[i].y*=t;return this},unScale:function(t){return t=t||this._scale||1,this.scale(1/t)},rotate:function(t){for(var e,i,o=t?t.cos:this._angle?this._angle.cos:1,n=t?t.sin:this._angle?this._angle.sin:0,r=this.vertices,s=r.length;s--;)e=r[s].x,i=r[s].y,r[s].x=e*o-i*n,r[s].y=e*n+i*o;return this},unRotate:function(t){var e=t?t.cos:this._angle?this._angle.cos:1,i=t?t.sin:this._angle?this._angle.sin:0;return this.rotate({cos:e,sin:-i})},translate:function(t){for(var e=t?t.x:this._trans?this._trans.x:0,i=t?t.y:this._trans?this._trans.y:0,o=this.vertices,n=o.length;n--;)o[n].x+=e,o[n].y+=i;return this},unTranslate:function(t){var e=t?t.x:this._trans?this._trans.x:0,i=t?t.y:this._trans?this._trans.y:0;return this.translate({x:-e,y:-i})},transform:function(t){var e,i,o,n,r,s,a,l,u=this.vertices,c=u.length;for(t?(e=t[0],i=t[1],r=t[2],o=t[3],n=t[4],s=t[5]):this._matrix?(e=this._matrix[0],i=this._matrix[1],r=this._matrix[2],o=this._matrix[3],n=this._matrix[4],s=this._matrix[5]):(e=1,i=0,r=0,o=0,n=1,s=0);c--;)a=u[c].x,l=u[c].y,u[c].x=a*e+l*i+r,u[c].y=a*o+l*n+s;return this},statics:{scale:function(t,e){var i,o,n=t.vertices,r=[];e=e||1;for(var s=0;s<n.length;s++)i=n[s].x*e,o=n[s].y*e,r.push(new DG.Point(i,o));return r.clone=DG.VertexTransform.clone,r},unScale:function(t,e){return e=e||1,DG.VertexTransform.scale(t,1/e)},rotate:function(t,e){for(var i,o,n,r,s=e?e.cos:1,a=e?e.sin:0,l=t.vertices,u=[],c=0;c<l.length;c++)n=l[c].x,r=l[c].y,i=n*s-r*a,o=n*a+r*s,u.push(new DG.Point(i,o));return u.clone=DG.VertexTransform.clone,u},unRotate:function(t,e){var i=e?e.cos:1,o=e?e.sin:0;return DG.VertexTransform.rotate(t,{cos:i,sin:-o})},translate:function(t,e){for(var i,o,n=e?e.x:0,r=e?e.y:0,s=t.vertices,a=[],l=0;l<s.length;l++)i=s[l].x+n,o=s[l].y+r,a.push(new DG.Point(i,o));return a.clone=DG.VertexTransform.clone,a},unTranslate:function(t,e){var i=e?e.x:0,o=e?e.y:0;return DG.VertexTransform.translate(t,{x:-i,y:-o})},clone:function(){return new DG.VertexTransform(this).save()},getLength:function(t,e){var i,o;return"number"==typeof t?Math.sqrt(t*t+e*e):(i=e.x-t.x,o=e.y-t.y,Math.sqrt(i*i+o*o))},getScaled:function(t,e,i){var o,n;return"number"==typeof t?new DG.Point(t*i,e*i):(o=(e.x-t.x)*i,n=(e.y-t.y)*i,new DG.Point(t.x+o,t.y+n))},getAngle:function(t,e,i){var o,n,r,s,a,l;return"number"==typeof t?(o=Math.sqrt(t*t+e*e),o>0?{cos:t/o,sin:e/o}:{cos:1,sin:0}):(r=t.x,s=t.y,a=e.x,l=e.y,i&&(r-=i.x,s-=i.y,a-=i.x,l-=i.y),n=Math.sqrt(r*r+s*s)*Math.sqrt(a*a+l*l),{cos:(r*a+s*l)/n,sin:(r*l-a*s)/n})},getAnglesSum:function(t,e){return{cos:t.cos*e.cos-t.sin*e.sin,sin:t.sin*e.cos+t.cos*e.sin}},getAnglesDif:function(t,e){return{cos:t.cos*e.cos+t.sin*e.sin,sin:t.sin*e.cos-t.cos*e.sin}}}}),DG.ArrowPathTransform=DG.VertexTransform.extend({initialize:function(t){this._lengths=new DG.Metric.Segments,this._vertices=[[],[]],this._drawings=[[],[]],this._setPath(t),this.subPath(1)},load:function(){return this.subPath(1)},save:function(){return this},_setPath:function(t){var e,i,o,n,r,s,a,l=DG.ArrowPathTransform.transform,u=this._vertices,c=this._drawings,h=DG.Point,d=t.width,_=[[],[],[]],p=[];for(u.push(t.vertices),u[0].push(new DG.Point(t.offset,(+d))),u[1].push(new DG.Point(t.offset,(-d))),s=DG.ArrowPathTransform.getAngles(t),r=-t.offset,e=0;e<s.length;e++)i=t.vertices[e+1].x,o=d*s[e].cot,n=s[e].tan*d*8/3,o>0?(u[0].push(new h(i+o,(+d))),c[0].push("L"),_[2].push(1),_[1].push(u[1].length),u[1].push(new h(i+o,(-d))),u[1].push(new h(i+o-n,(-d))),l(u,s[e],{x:i,y:0}),u[1].push(new h(0-o+n,(-d))),u[1].push(new h(0-o,(-d))),c[1].push("L","C"),p.push(Math.abs(i+o)-r),r=+o):(u[1].push(new h(i-o,(-d))),c[1].push("L"),_[2].push(0),_[0].push(u[0].length),u[0].push(new h(i-o,(+d))),u[0].push(new h(i-o+n,(+d))),l(u,s[e],{x:i,y:0}),u[0].push(new h(0+o-n,(+d))),u[0].push(new h(0+o,(+d))),c[0].push("L","C"),p.push(Math.abs(i-o)-r),r=-o);o=t.vertices[e+1].x,n=4*d/3,u[0].push(new h(o,(+d))),u[1].push(new h(o,(-d))),u[0].push(new h(o-n,(+d))),u[1].push(new h(o-n,(-d))),c[0].push("L"),c[1].push("L"),p.push(Math.abs(o)-r),u[1].reverse(),c[1].reverse(),a=DG.VertexTransform.getAnglesSum(s.fullAngle,t.getAngle()),l(u,a,u.pop()[0]),o=u[0].length,n=u[1].length,this._arcs=_[2].map(function(t){return r=_[t].shift(),t>0?new DG.ArcBezier(u[1].slice(n-r-4,n-r)):new DG.ArcBezier(u[0].slice(r,r+4).reverse())}).reverse(),this._lengths.push(p.pop()),p.reverse().forEach(function(t,e){this._lengths.push(this._arcs[e].getLength()).push(t)},this),this[0]={vertices:[u[0][o-2],u[0][o-1],u[1][0],u[1][1]],drawings:["M","C"]},this[1]={vertices:u[0].concat(u[1]),drawings:["M"].concat(c[0],"C",c[1])}},_setAngleAndDisplacement:function(t,e){this.angle=DG.VertexTransform.getAngle({x:t.x-e.x,y:t.y-e.y},{x:0,y:1}),this.displ=e.clone()},subPath:function(t){if(t=t>1?1:t,0===t||1===t)return this.vertices=this[t].vertices.map(function(t){return t.clone()}),this.drawings=this[t].drawings,this._setAngleAndDisplacement(this.vertices[0],this.vertices[this.vertices.length-1]),this;for(var e,i,o=DG.VertexTransform.getScaled,n=this._vertices,r=this._drawings,s=this._lengths,a=s.getLength()*t,l=s.getIndex(a),u=s.getSegRatio(a),c=n[0].length-2,h=1,d=r[0].length-1,_=0,p=0,m=0;m++<l;)m%2==1?(c--,d--,h++,_++):("C"===r[0][d]?(c-=3,d-=1):(h+=3,_+=1),p++);return l%2==1?(p=this._arcs[p],"C"===r[0][d]?(p=p.getCurveBefore(p.getTbyL(s.getSegLength(a))),e=p.points[3],i=n[1][h],this.vertices=p.points.slice(1).reverse().concat(n[0].slice(c),n[1].slice(0,h+1)).map(function(t){return t.clone()}),this.drawings=["M"].concat(r[0].slice(d),"C",r[1].slice(0,_))):(p=p.getCurveBefore(p.getTbyL(s.getSegLength(a))),e=n[0][c],i=p.points[3],this.vertices=n[0].slice(c).concat(n[1].slice(0,h+1),p.points.slice(1)).map(function(t){return t.clone()}),this.drawings=["M"].concat(r[0].slice(d+1),"C",r[1].slice(0,_+1)))):(e=o(n[0][c],n[0][c-1],u),i=o(n[1][h],n[1][h+1],u),this.vertices=[e].concat(n[0].slice(c),n[1].slice(0,h+1),i).map(function(t){return t.clone()}),this.drawings=["M"].concat(r[0].slice(d),"C",r[1].slice(0,_+1))),this._setAngleAndDisplacement(e,i),this},statics:{getAngles:function(t){for(var e,i,o,n,r,s,a,l=DG.VertexTransform.getAngle,u={cos:1,sin:0},c=t.vertices,h=[],d=1,_=c.length-1;d<_;d++)i=l(c[d-1],c[d+1],c[d]),e=Math.abs(i.sin),e<1e-6?(c.splice(c.length-d-1,1),_--,d--):(i.cot=(1+i.cos)/i.sin,i.cos=-i.cos,r=(1+i.cos)/i.sin,a=r<0?-1:1,s=a*Math.sqrt(4*r*r+4),i.tan=-.5*(r+r-s),h.push(i),o=u.cos*i.cos-u.sin*i.sin,n=u.sin*i.cos+u.cos*i.sin,u={cos:o,sin:n});return h.fullAngle={cos:u.cos,sin:-u.sin},h},getTranslatedPath:function(t,e){var i=new DG.VertexTransform([]),o=e.length-1,n=t.project(e[o]),r=n.x,s=n.y;for(i.vertices.push(new DG.Point(0,0));o--;)n=t.project(e[o]),i.vertices.push(new DG.Point(n.x-r,n.y-s));return i.setAngle(DG.VertexTransform.getAngle(-i.vertices[1].x,-i.vertices[1].y)).unRotate()},transform:function(t,e,i){for(var o,n,r,s,a=t.length,l=e.cos,u=e.sin,c=i.x,h=i.y;a--;)for(o=t[a],s=o.length;s--;)n=o[s].x-c,r=o[s].y-h,o[s].x=n*l-r*u,o[s].y=n*u+r*l}}}),DG.ArrowTipTransform=DG.VertexTransform.extend({initialize:function(t,e){this.drawings=e.drawings,this._vertices=e.vertices,this._setShape(t,e)},_setShape:function(t,e){var i=e.vertices[0],o=Math.abs(i.y),n=t.vertices[1].x,r=i.x,s=n-r+o+o;t.width=o,t.offset=r+(s>0?s:0),t.vertices.length<3&&r>-10&&(t.offset+=2.5),this._vertices=this.load().unTranslate(i).vertices},subShape:function(t){return this.load().unRotate(t.angle).translate(t.displ),this}}),DG.ComplexPath=DG.Path.extend({options:{fill:!0,fillOpacity:1,interactive:!1},initialize:function(t){DG.setOptions(this,t),this._empty=[],this._pxEmpty=DG.bounds(DG.point(0,0),DG.point(0,0)),this._pxBounds=this._pxEmpty,this._vertices=[this._empty],this._drawings=[this._empty]},getEvents:function(){return{}},_project:function(){
var t,e,i=this.options;this._map&&(t=this._map.getZoom(),i.visibility.isShown&&i.transform[t]?(e=2.2-.2*(19-t),i.weight!==e&&this.setStyle({weight:+e.toFixed(2)}),this._vertices[0]=i.transform[t].vertices,this._drawings[0]=i.transform[t].drawings,this._pxBounds=i.transform[t]._pxBounds):(this._vertices[0]=this._empty,this._drawings[0]=this._empty,this._pxBounds=this._pxEmpty))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateComplexPath(this)}}),DG.extend(L.Canvas.prototype,{_updateComplexPath:function(t,e){var i,o,n,r,s,a,l,u,c,h,d,_=t._drawings,p=t._vertices,m=this._ctx;for(this._drawnLayers[t._leaflet_id]=t,m.beginPath(),i=0;i<p.length;i++){for(d=p[i],s=a=0,o=n=0;o<d.length;)switch(r=_[i][n++]){case"M":s=d[o].x,a=d[o].y,o+=1,m.moveTo(s,a);break;case"m":s+=d[o].x,a+=d[o].y,o+=1,m.moveTo(s,a);break;case"L":s=d[o].x,a=d[o].y,o+=1,m.lineTo(s,a);break;case"l":s+=d[o].x,a+=d[o].y,o+=1,m.lineTo(s,a);break;case"C":l=d[o].x,u=d[o].y,o+=1,c=d[o].x,h=d[o].y,o+=1,s=d[o].x,a=d[o].y,o+=1,m.bezierCurveTo(l,u,c,h,s,a);break;case"c":l=s+d[o].x,u=a+d[o].y,o+=1,c=s+d[o].x,h=a+d[o].y,o+=1,s+=d[o].x,a+=d[o].y,o+=1,m.bezierCurveTo(l,u,c,h,s,a);break;case"Q":l=d[o].x,u=d[o].y,o+=1,s=d[o].x,a=d[o].y,o+=1,m.quadraticCurveTo(l,u,s,a);break;case"q":l=s+d[o].x,u=a+d[o].y,o+=1,s+=d[o].x,a+=d[o].y,o+=1,m.quadraticCurveTo(l,u,s,a)}e&&m.closePath()}this._fillStroke(m,t)}}),DG.extend(L.SVG.prototype,{_updateComplexPath:function(t,e){this._setPath(t,L.SVG.complexPointsToPath(t._vertices,t._drawings,e))}}),DG.extend(L.SVG,{complexPointsToPath:function(t,e,i){var o,n,r,s,a,l,u="",c=DG.Browser.svg;for(o=0;o<t.length;o++){if(l=t[o],c)for(n=r=0;n<l.length;){switch(a=e[o][r++]){case"C":case"c":s=3;break;case"Q":case"q":s=2;break;default:s=1}for(u+=a;s--;)u+=l[n].x.toFixed(4)+","+l[n].y.toFixed(4)+" ",n+=1}else for(n=r=0;n<l.length;){switch(a=e[o][r++]){case"M":a="m",s=1;break;case"m":a="t",s=1;break;case"L":a="l",s=1;break;case"l":a="r",s=1;break;case"C":a="c",s=3;break;case"c":a="v",s=3;break;case"Q":u+="C"+l[n].x.toFixed(0)+","+l[n].y.toFixed(0)+" "+l[n].x.toFixed(0)+","+l[n].y.toFixed(0)+" "+l[n+1].x.toFixed(0)+","+l[n+1].y.toFixed(0)+" ",n+=2,a="",s=0;break;case"q":u+="c"+l[n].x.toFixed(0)+","+l[n].y.toFixed(0)+" "+l[n].x.toFixed(0)+","+l[n].y.toFixed(0)+" "+l[n+1].x.toFixed(0)+","+l[n+1].y.toFixed(0)+" ",n+=2,a="",s=0;break;default:s=1}for(u+=a;s--;)u+=l[n].x.toFixed(0)+","+l[n].y.toFixed(0)+" ",n+=1}u+=i?c?"z":"x":""}return u||"m0,0"}}),DG.Bezier=DG.Class.extend({initialize:function(t,e){e?this.points=t.map(function(t){return t.clone()}):this.points=t,this.dpoints=this._getDerivatives(),this.order=this.points.length-1,this._lut=[]},getPoint:function(t){var e,i,o,n,r,s,a,l=this.points;return 0===t?l[0]:1===t?l[this.order]:(e=1-t,i=e*e,o=t*t,this.order>2?(n=i*e,r=i*t*3,s=e*o*3,a=t*o):(l=[l[0],l[1],l[2],{x:0,y:0}],n=i,r=e*t*2,s=o,a=0),new DG.Point(n*l[0].x+r*l[1].x+s*l[2].x+a*l[3].x,n*l[0].y+r*l[1].y+s*l[2].y+a*l[3].y))},derivative:function(t){var e,i,o,n=this.dpoints[0],r=1-t;return this.order>2?(e=r*r,i=r*t*2,o=t*t):(n=[n[0],n[1],{x:0,y:0}],e=r,i=t,o=0),new DG.Point(e*n[0].x+i*n[1].x+o*n[2].x,e*n[0].y+i*n[1].y+o*n[2].y)},getLength:function(){for(var t,e,i,o=DG.Bezier.WEIGHT,n=DG.Bezier.ABSCISSA,r=.5,s=0,a=0;a<n.length;a++)i=r*n[a]+r,t=this.derivative(i),e=t.x*t.x+t.y*t.y,s+=o[a]*Math.sqrt(e);return r*s},getCurveBefore:function(t){var e,i,o,n,r,s,a,l,u,c=this.points;return 1===t?this.clone():(u=[],e=t*t,o=t-1,n=o*o,u[0]=new DG.Point(c[0].x,c[0].y),u[1]=new DG.Point(t*c[1].x-o*c[0].x,t*c[1].y-o*c[0].y),s=t*o*2,u[2]=new DG.Point(e*c[2].x-s*c[1].x+n*c[0].x,e*c[2].y-s*c[1].y+n*c[0].y),this.order>2&&(i=e*t,r=n*o,a=e*o*3,l=t*n*3,u[3]=new DG.Point(i*c[3].x-a*c[2].x+l*c[1].x-r*c[0].x,i*c[3].y-a*c[2].y+l*c[1].y-r*c[0].y)),new DG.Bezier(u))},getCurveAfter:function(t){var e,i,o,n,r,s,a,l,u,c=this.points,h=this.order;return 1===t?this.clone():(u=[],e=t*t,o=t-1,n=o*o,u[h]=new DG.Point(c[h].x,c[h].y),u[--h]=new DG.Point(t*c[h+1].x-o*c[h].x,t*c[h+1].y-o*c[h].y),s=t*o*2,u[--h]=new DG.Point(e*c[h+2].x-s*c[h+1].x+n*c[h].x,e*c[h+2].y-s*c[h+1].y+n*c[h].y),this.order>2&&(i=e*t,r=n*o,a=e*o*3,l=t*n*3,u[--h]=new DG.Point(i*c[h+3].x-a*c[h+2].x+l*c[h+1].x-r*c[h].x,i*c[h+3].y-a*c[h+2].y+l*c[h+1].y-r*c[h].y)),new DG.Bezier(u))},_getDerivatives:function(){var t,e,i,o,n=this.points,r=[];for(t=n.length,e=t-1;t>1;t--,e--){for(o=[],i=0;i<e;i++)o.push(new DG.Point(e*(n[i+1].x-n[i].x),e*(n[i+1].y-n[i].y)));r.push(o),n=o}return r},getLUT:function(t){return t=t||125,this._lut.length!==t+1&&(this.order>2?this._setLUT3(t):this._setLUT2(t)),this._lut},_setLUT2:function(t){var e,i,o,n,r,s=this._lut=[],a=this.points;s.push({x:a[0].x,y:a[0].y,l:0});for(var l=1;l<t;l++)e=l/t,i=1-e,o=i*i,n=i*e*2,r=e*e,s.push({x:o*a[0].x+n*a[1].x+r*a[2].x,y:o*a[0].y+n*a[1].y+r*a[2].y});s.push({x:a[2].x,y:a[2].y,l:0})},_setLUT3:function(t){var e,i,o,n,r,s,a,l,u=this._lut=[],c=this.points;u.push({x:c[0].x,y:c[0].y,l:0});for(var h=1;h<t;h++)e=h/t,o=1-e,n=o*o,i=e*e,r=n*o,s=n*e*3,a=o*i*3,l=e*i,u.push({x:r*c[0].x+s*c[1].x+a*c[2].x+l*c[3].x,y:r*c[0].y+s*c[1].y+a*c[2].y+l*c[3].y});u.push({x:c[3].x,y:c[3].y,l:0})},clone:function(){return new DG.Bezier(this.points,(!0))}}),DG.bezier=function(t){return("number"==typeof t||t instanceof DG.Point)&&(t=Array.prototype.slice.call(arguments)),"number"==typeof t[0]?(t=t.length<7?[new DG.Point(t[0],t[1]),new DG.Point(t[2],t[3]),new DG.Point(t[4],t[5])]:[new DG.Point(t[0],t[1]),new DG.Point(t[2],t[3]),new DG.Point(t[4],t[5]),new DG.Point(t[6],t[7])],new DG.Bezier(t)):new DG.Bezier(t,(!0))},DG.Bezier.WEIGHT=[.362683783378362,.362683783378362,.3137066458778873,.3137066458778873,.2223810344533745,.2223810344533745,.1012285362903763,.1012285362903763],DG.Bezier.ABSCISSA=[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],DG.TimeBezier=DG.Bezier.extend({initialize:function(t,e,i){DG.Bezier.prototype.initialize.call(this,[DG.TimeBezier.START,t,e,DG.TimeBezier.END],i)},getYbyX:function(t){var e,i=this.getLUT(),o=i.length-1,n=0;if(t<=0)return 0;if(t>=1)return 1;for(;;)if(e=n+(o-n>>1),t<i[e].x?o=e:n=e,o-n<2)break;return t=(t-i[n].x)/(i[o].x-i[n].x),i[n].y+(i[o].y-i[n].y)*t},getLUT:function(t){var e,i,o,n,r,s,a,l=this.points;if(t=t||240,this._lut.length===t+1)return this._lut;this._lut=a=[],a.push({x:0,y:0});for(var u=1;u<t;u++)e=u/t,o=1-e,i=e*e,n=o*o*e*3,r=o*i*3,s=e*i,a.push({x:n*l[1].x+r*l[2].x+s,y:n*l[1].y+r*l[2].y+s});return a.push({x:1,y:1}),a},clone:function(){return new DG.TimeBezier(this.points,(!0))}}),DG.TimeBezier.START=DG.point(0,0),DG.TimeBezier.END=DG.point(1,1),DG.ArcBezier=DG.Bezier.extend({initialize:function(t,e){DG.Bezier.prototype.initialize.call(this,t,e),this.getLUT(),this._setLutLengths()},getTbyL:function(t){var e,i,o,n=this.getLUT(),r=n.length-1,s=0;if(t<=0)return 0;if(t>=n[r].l)return 1;for(;;)if(e=s+(r-s>>1),t<n[e].l?r=e:s=e,r-s<2)break;t=(t-n[s].l)/(n[r].l-n[s].l),i=n[s].x+(n[r].x-n[s].x)*t,o=n[s].y+(n[r].y-n[s].y)*t;var a,l,u,c,h=r/n.length,d=s/n.length,_=1/n.length/10,p=Math.pow(2,53)-1;for(c=d;d<h;d+=_)a=this.getPoint(d),l=a.x-i,u=a.y-o,t=Math.sqrt(l*l+u*u),t<p&&(p=t,c=d);return c},_setLutLengths:function(){var t,e,i=this._lut;i[0].l=0;for(var o=1;o<i.length;o++)t=i[o].x-i[o-1].x,e=i[o].y-i[o-1].y,i[o].l=i[o-1].l+Math.sqrt(t*t+e*e)},getLength:function(){return this._lut[this._lut.length-1].l},clone:function(){return new DG.ArcBezier(this.points,(!0))}}),DG.Animation=DG.Evented.extend({options:{},initialize:function(t){DG.setOptions(this,t),this._animID=-1,this._startTime=0,this._running=!1,this._animation=null,this._durations=null},start:function(){this.stop(),this._prepare(),this._running=!0,this.fire("start"),this._startTime=(new Date).getTime(),this._animate()},stop:function(){this._running&&this._run(this._durations.getLength())},_prepare:function(){this._animation=DG.Util.isArray(this.options.animation)?this.options.animation:[this.options.animation],this._durations=new DG.Metric.Segments,this._animation.forEach(function(t){this.push(t.duration)},this._durations)},_animate:function(){this._animID=DG.Util.requestAnimFrame(this._animate,this),this._run()},_run:function(t){var e,i,o;t=t?t:(new Date).getTime()-this._startTime,t<this._durations.getLength()?(i=this._durations.getIndex(t),e=this._durations.getSegRatio(t),o=this._animation[i]["function"].getYbyX(e),this._step(this._getFrameValues(i,o))):(i=this._durations.length-1,this._step(this._getFrameValues(i,1)),this._complete())},_step:function(t){this.fire("step",t)},_complete:function(){DG.Util.cancelAnimFrame(this._animID),this._durations=null,this._animation=null,this._running=!1,this.fire("end")},_getFrameValues:function(t,e){var i,o,n=this._animation[t].frames,r={progress:e};if(n)for(var s in n)n[s].progress?r[s]=n[s].progress(e):(i=n[s].from,o=n[s].to,r[s]=i+(o-i)*e);return r}}),DG.animation=function(t){return new DG.Animation(t)},DG.Animation.LINEAR=new DG.TimeBezier(DG.point(0,0),DG.point(1,1)),DG.Animation.EASE=new DG.TimeBezier(DG.point(.25,.1),DG.point(.25,1)),DG.Animation.EASE_IN=new DG.TimeBezier(DG.point(.42,0),DG.point(1,1)),DG.Animation.EASE_IN_OUT=new DG.TimeBezier(DG.point(.42,0),DG.point(.58,1)),DG.Animation.EASE_OUT=new DG.TimeBezier(DG.point(0,0),DG.point(.58,1)),DG.Entrance=DG.FeatureGroup.extend({options:{vectors:[],fillColor:"#0085a0",strokeColor:"#fff",enableAnimation:!0,interactive:!1,autoClose:!0},initialize:function(t){DG.LayerGroup.prototype.initialize.call(this),DG.setOptions(this,t),this._bounds=new DG.LatLngBounds,this._animations={bounce:DG.animation(DG.Entrance.BOUNCE_ANIMATION),path:DG.animation(DG.Entrance.PATH_ANIMATION)},this._initArrows(),this._isShown=!1},onAdd:function(t){DG.LayerGroup.prototype.onAdd.call(this,t),this.show()},onRemove:function(t){this.hide(),DG.LayerGroup.prototype.onRemove.call(this,t)},getEvents:function(){var t={};return this.options.autoClose&&(t.layeradd=this._removeEntrance),this.options.enableAnimation&&(t.zoomend=this._animate),t},show:function(t){return this._layers&&(t&&this.fitBounds(),this._isShown||(this._isShown=!0,this.eachLayer(function(t){t.setVisibility(!0)}),this.options.enableAnimation&&this._animate(),this._map.fire("entranceshow"))),this},hide:function(){return this._layers&&this._isShown&&(this._isShown=!1,this.eachLayer(function(t){t.setVisibility(!1)}),this._map.fire("entrancehide")),this},isShown:function(){return this._isShown},getBounds:function(){return this._bounds},setFillColor:function(t){this.eachLayer(function(e){e.setStyle({fillColor:t})})},setStrokeColor:function(t){this.eachLayer(function(e){e.setStyle({color:t})})},_initArrows:function(){var t={color:this.options.strokeColor,fillColor:this.options.fillColor,interactive:this.options.interactive};this.options.vectors.map(function(t){return DG.Wkt.toLatLngs(t)}).forEach(function(e){var i=DG.Util.create(t),o=DG.latLngBounds(e);this._bounds.extend(o),i.latlngs=e,i.bounds=o,this.options.enableAnimation&&(e.length>2?i.animation=this._animations.path:(i.animation=this._animations.bounce,i.distance=!0)),this.addLayer(DG.entrance.arrow(i))},this)},_animate:function(){this._isShown&&(this._animations.bounce.start(),this._animations.path.start())},fitBounds:function(){var t,e=this._map,i=this.getBounds();return e.getBounds().contains(i)&&this._isAllowedZoom()||(t=this._getFitZoom(),e.projectDetector.getProject()||e.once("moveend",function(){e.setZoom(this._getFitZoom())},this),e.setView(i.getCenter(),t,{animate:!0})),this},_getFitZoom:function(){var t=this._map.projectDetector.getProject();return t?t.maxZoom:DG.Entrance.SHOW_FROM_ZOOM},_isAllowedZoom:function(){return this._map.getZoom()>=DG.Entrance.SHOW_FROM_ZOOM},_removeEntrance:function(t){(t.layer instanceof DG.Popup||t.layer instanceof DG.Entrance&&t.layer!==this)&&this.remove()}}),DG.entrance=function(t){return new DG.Entrance(t)},DG.Entrance.SHOW_FROM_ZOOM=16,DG.Entrance.PATH_ANIMATION={animation:{"function":DG.Animation.EASE_IN_OUT,duration:750}},DG.Entrance.BOUNCE_ANIMATION={animation:[{"function":DG.Animation.EASE_IN_OUT,duration:250,frames:{distance:{from:0,to:.6}}},{"function":DG.Animation.EASE_IN,duration:135,frames:{distance:{from:.6,to:0}}},{"function":DG.Animation.EASE_OUT,duration:135,frames:{distance:{from:0,to:.16}}},{"function":DG.Animation.EASE_IN,duration:90,frames:{distance:{from:.16,to:0}}},{"function":DG.Animation.EASE_OUT,duration:90,frames:{distance:{from:0,to:.06}}},{"function":DG.Animation.EASE_IN,duration:50,frames:{distance:{from:.06,to:0}}}]},DG.Entrance.Arrow=DG.FeatureGroup.extend({initialize:function(t){DG.LayerGroup.prototype.initialize.call(this),DG.setOptions(this,t),this._progress=1,this._distance=0,this._visibility={isShown:!1},this._position=t.latlngs[t.latlngs.length-1],this._shape=this.options.shape||DG.Entrance.Arrow.SHAPE,this._apt={},this._att={}},beforeAdd:function(t){var e=this.options;!e.animation||t.options.preferCanvas||DG.Browser.ielt9?e.animation=null:e.animation.on("step",this._animation,this),this.projection(),this.addLayer(new DG.ComplexPath({lineCap:"butt",color:e.color,fillColor:e.fillColor,interactive:e.interactive,visibility:this._visibility,transform:this._apt})),this.addLayer(new DG.ComplexPath({lineJoin:"miter",color:e.color,fillColor:e.fillColor,interactive:e.interactive,visibility:this._visibility,transform:this._att}))},getEvents:function(){return{zoomend:this._project,moveend:this._update,viewreset:this._reset}},setVisibility:function(t){this._visibility.isShown!==t&&(this._visibility.isShown=t,t?this.options.animation||this._reset():this._reset())},getBounds:function(){return this.options.bounds},projection:function(){var t,e,i,o,n=this._map||this._mapToAdd,r=n?n.getZoom():0,s=this._shape.vertices[r],a=this._shape.drawings[r],l=this.options.latlngs;return r&&s&&a&&(this._att[r]||(e=DG.ArrowPathTransform.getTranslatedPath(n,l),t={vertices:s,drawings:a},this._att[r]=new DG.ArrowTipTransform(e,t),this._apt[r]=new DG.ArrowPathTransform(e)),i=n.latLngToLayerPoint(this._position),o=n.latLngToLayerPoint(l[l.length-2]),this._apt[r]._pxBounds||this._setBounds(i,o,this._apt[r],this._att[r]),this.options.distance&&(i=DG.VertexTransform.getScaled(i,o,this._distance)),this._apt[r].subPath(this._progress).translate(i),this._att[r].subShape(this._apt[r]).translate(i)),this},_animation:function(t){void 0!=t.distance?this._distance=t.distance:this._progress=t.progress,this._visibility.isShown&&(this._project(),this._update())},_project:function(){this.projection().invoke("_project")},_update:function(){this.invoke("_update")},_reset:function(){this._resetBounds(),this._project(),this._update()},_resetBounds:function(){var t;for(t in this._apt)this._apt[t]._pxBounds=null;for(t in this._att)this._att[t]._pxBounds=null},_setBounds:function(t,e,i,o){var n=i.subPath(1).translate(t).vertices,r=o.subShape(i).translate(t).vertices;i._pxBounds=new DG.Bounds(n),o._pxBounds=new DG.Bounds(r)}}),DG.entrance.arrow=function(t){return new DG.Entrance.Arrow(t)},DG.Entrance.Arrow.SHAPE={vertices:{16:[[-6.5,-1.8],[-6.0522,-1.8],[-7.0975,-5.2537],[-6.6619,-6.2565],[-6.598,-6.355],[-6.1757,-6.147],[.8371,-.3552],[.9275,-.1764],[.9275,.1764],[.8371,.3552],[-6.1757,6.147],[-6.598,6.355],[-6.6619,6.2565],[-7.0975,5.2537],[-6.0522,1.8],[-6.5,1.8]],17:[[-9,-2.4],[-7.889,-2.4],[-9.9245,-7.2548],[-9.3363,-8.6404],[-9.3448,-8.6448],[-8.8717,-8.3508],[1.0285,-.3552],[1.119,-.1764],[1.119,.1764],[1.0285,.3552],[-8.8717,8.3508],[-9.3448,8.6448],[-9.3363,8.6404],[-9.9245,7.2548],[-7.889,2.4],[-9,2.4]],18:[[-11.5,-3],[-10.0795,-3],[-12.4909,-9.3173],[-11.8402,-10.7654],[-11.5986,-10.7073],[-10.938,-10.2258],[1.1497,-.3552],[1.2402,-.1764],[1.2402,.1764],[1.1497,.3552],[-10.938,10.2258],[-11.5986,10.7073],[-11.8402,10.7654],[-12.4909,9.3173],[-10.0795,3],[-11.5,3]],19:[[-13,-3.6],[-11.66,-3.6],[-14.1696,-10.8351],[-13.5189,-12.2832],[-13.2773,-12.2251],[-12.6167,-11.7436],[1.3061,-.3552],[1.3966,-.1764],[1.3966,.1764],[1.3061,.3552],[-12.6167,11.7436],[-13.2773,12.2251],[-13.5189,12.2832],[-14.1696,10.8351],[-11.66,3.6],[-13,3.6]]},drawings:{16:["M","L","L","C","L","C","L","C","L","L"],17:["M","L","L","C","L","C","L","C","L","L"],18:["M","L","L","C","L","C","L","C","L","L"],19:["M","L","L","C","L","C","L","C","L","L"]}},function(t){for(var e in t)t[e]=t[e].map(function(t){return DG.point(t)})}(DG.Entrance.Arrow.SHAPE.vertices),DG.Label=DG.Layer.extend({options:{offset:new DG.Point(12,15),className:"dg-label",zIndexOffset:0,textDirection:"auto"},_typeOfString:Object.prototype.toString.call("s"),_defaultZIndex:100,initialize:function(t,e){DG.Util.setOptions(this,e),this._animated=DG.Browser.any3d,this._content=t},onAdd:function(t){this._map=t,this._el||this._initDOM(),this._visible=!0,this.setContent(this._content)._onViewReset(),t.on("viewreset",this._onViewReset,this).on("zoomanim",this._onZoomAnimation,this)},onRemove:function(t){t.off("viewreset",this._onViewReset,this).off("zoomanim",this._onZoomAnimation,this),this._visible=!1,this._el.removeChild(this._container),DG.Util.falseFn(this._container.offsetWidth),this._container=null,t.getPanes().tooltipPane.removeChild(this._el),this._el=null},_initDOM:function(){this._el=DG.DomUtil.create("div",this.options.className+" leaflet-zoom-"+(this._animated?"animated":"hide"),this._map.getPanes().tooltipPane),this._el.style.zIndex=this._defaultZIndex+this.options.zIndexOffset,this._container=DG.DomUtil.create("div",this.options.className+"__content",this._el),this._container.setAttribute("dir",this.options.textDirection),DG.DomEvent.disableClickPropagation(this._el).on(this._container,"mousewheel",DG.DomEvent.stopPropagation).on(this._container,"contextmenu",DG.DomEvent.stopPropagation)},_onViewReset:function(){this._visible&&this._latlng&&DG.DomUtil.setPosition(this._el,this._map.latLngToLayerPoint(this._latlng).add(this.options.offset),DG.Browser.ie)},_onZoomAnimation:function