/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = "./index.js"); /******/ }) /************************************************************************/ /******/ ({ /***/ "./index.js": /*!******************!*\ !*** ./index.js ***! \******************/ /*! no exports provided */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _src_map_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./src/map.js */ \"./src/map.js\");\n/* harmony import */ var _src_currentTile_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./src/currentTile.js */ \"./src/currentTile.js\");\n\n\n\n//# sourceURL=webpack:///./index.js?"); /***/ }), /***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/leaflet/dist/leaflet.css": /*!*************************************************************************************!*\ !*** ./node_modules/css-loader/dist/cjs.js!./node_modules/leaflet/dist/leaflet.css ***! \*************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("exports = module.exports = __webpack_require__(/*! ../../css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\")(false);\n// Imports\nvar urlEscape = __webpack_require__(/*! ../../css-loader/dist/runtime/url-escape.js */ \"./node_modules/css-loader/dist/runtime/url-escape.js\");\nvar ___CSS_LOADER_URL___0___ = urlEscape(__webpack_require__(/*! ./images/layers.png */ \"./node_modules/leaflet/dist/images/layers.png\"));\nvar ___CSS_LOADER_URL___1___ = urlEscape(__webpack_require__(/*! ./images/layers-2x.png */ \"./node_modules/leaflet/dist/images/layers-2x.png\"));\nvar ___CSS_LOADER_URL___2___ = urlEscape(__webpack_require__(/*! ./images/marker-icon.png */ \"./node_modules/leaflet/dist/images/marker-icon.png\"));\n\n// Module\nexports.push([module.i, \"/* required styles */\\r\\n\\r\\n.leaflet-pane,\\r\\n.leaflet-tile,\\r\\n.leaflet-marker-icon,\\r\\n.leaflet-marker-shadow,\\r\\n.leaflet-tile-container,\\r\\n.leaflet-pane > svg,\\r\\n.leaflet-pane > canvas,\\r\\n.leaflet-zoom-box,\\r\\n.leaflet-image-layer,\\r\\n.leaflet-layer {\\r\\n\\tposition: absolute;\\r\\n\\tleft: 0;\\r\\n\\ttop: 0;\\r\\n\\t}\\r\\n.leaflet-container {\\r\\n\\toverflow: hidden;\\r\\n\\t}\\r\\n.leaflet-tile,\\r\\n.leaflet-marker-icon,\\r\\n.leaflet-marker-shadow {\\r\\n\\t-webkit-user-select: none;\\r\\n\\t -moz-user-select: none;\\r\\n\\t user-select: none;\\r\\n\\t -webkit-user-drag: none;\\r\\n\\t}\\r\\n/* Safari renders non-retina tile on retina better with this, but Chrome is worse */\\r\\n.leaflet-safari .leaflet-tile {\\r\\n\\timage-rendering: -webkit-optimize-contrast;\\r\\n\\t}\\r\\n/* hack that prevents hw layers \\\"stretching\\\" when loading new tiles */\\r\\n.leaflet-safari .leaflet-tile-container {\\r\\n\\twidth: 1600px;\\r\\n\\theight: 1600px;\\r\\n\\t-webkit-transform-origin: 0 0;\\r\\n\\t}\\r\\n.leaflet-marker-icon,\\r\\n.leaflet-marker-shadow {\\r\\n\\tdisplay: block;\\r\\n\\t}\\r\\n/* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */\\r\\n/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */\\r\\n.leaflet-container .leaflet-overlay-pane svg,\\r\\n.leaflet-container .leaflet-marker-pane img,\\r\\n.leaflet-container .leaflet-shadow-pane img,\\r\\n.leaflet-container .leaflet-tile-pane img,\\r\\n.leaflet-container img.leaflet-image-layer,\\r\\n.leaflet-container .leaflet-tile {\\r\\n\\tmax-width: none !important;\\r\\n\\tmax-height: none !important;\\r\\n\\t}\\r\\n\\r\\n.leaflet-container.leaflet-touch-zoom {\\r\\n\\t-ms-touch-action: pan-x pan-y;\\r\\n\\ttouch-action: pan-x pan-y;\\r\\n\\t}\\r\\n.leaflet-container.leaflet-touch-drag {\\r\\n\\t-ms-touch-action: pinch-zoom;\\r\\n\\t/* Fallback for FF which doesn't support pinch-zoom */\\r\\n\\ttouch-action: none;\\r\\n\\ttouch-action: pinch-zoom;\\r\\n}\\r\\n.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {\\r\\n\\t-ms-touch-action: none;\\r\\n\\ttouch-action: none;\\r\\n}\\r\\n.leaflet-container {\\r\\n\\t-webkit-tap-highlight-color: transparent;\\r\\n}\\r\\n.leaflet-container a {\\r\\n\\t-webkit-tap-highlight-color: rgba(51, 181, 229, 0.4);\\r\\n}\\r\\n.leaflet-tile {\\r\\n\\tfilter: inherit;\\r\\n\\tvisibility: hidden;\\r\\n\\t}\\r\\n.leaflet-tile-loaded {\\r\\n\\tvisibility: inherit;\\r\\n\\t}\\r\\n.leaflet-zoom-box {\\r\\n\\twidth: 0;\\r\\n\\theight: 0;\\r\\n\\t-moz-box-sizing: border-box;\\r\\n\\t box-sizing: border-box;\\r\\n\\tz-index: 800;\\r\\n\\t}\\r\\n/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */\\r\\n.leaflet-overlay-pane svg {\\r\\n\\t-moz-user-select: none;\\r\\n\\t}\\r\\n\\r\\n.leaflet-pane { z-index: 400; }\\r\\n\\r\\n.leaflet-tile-pane { z-index: 200; }\\r\\n.leaflet-overlay-pane { z-index: 400; }\\r\\n.leaflet-shadow-pane { z-index: 500; }\\r\\n.leaflet-marker-pane { z-index: 600; }\\r\\n.leaflet-tooltip-pane { z-index: 650; }\\r\\n.leaflet-popup-pane { z-index: 700; }\\r\\n\\r\\n.leaflet-map-pane canvas { z-index: 100; }\\r\\n.leaflet-map-pane svg { z-index: 200; }\\r\\n\\r\\n.leaflet-vml-shape {\\r\\n\\twidth: 1px;\\r\\n\\theight: 1px;\\r\\n\\t}\\r\\n.lvml {\\r\\n\\tbehavior: url(#default#VML);\\r\\n\\tdisplay: inline-block;\\r\\n\\tposition: absolute;\\r\\n\\t}\\r\\n\\r\\n\\r\\n/* control positioning */\\r\\n\\r\\n.leaflet-control {\\r\\n\\tposition: relative;\\r\\n\\tz-index: 800;\\r\\n\\tpointer-events: visiblePainted; /* IE 9-10 doesn't have auto */\\r\\n\\tpointer-events: auto;\\r\\n\\t}\\r\\n.leaflet-top,\\r\\n.leaflet-bottom {\\r\\n\\tposition: absolute;\\r\\n\\tz-index: 1000;\\r\\n\\tpointer-events: none;\\r\\n\\t}\\r\\n.leaflet-top {\\r\\n\\ttop: 0;\\r\\n\\t}\\r\\n.leaflet-right {\\r\\n\\tright: 0;\\r\\n\\t}\\r\\n.leaflet-bottom {\\r\\n\\tbottom: 0;\\r\\n\\t}\\r\\n.leaflet-left {\\r\\n\\tleft: 0;\\r\\n\\t}\\r\\n.leaflet-control {\\r\\n\\tfloat: left;\\r\\n\\tclear: both;\\r\\n\\t}\\r\\n.leaflet-right .leaflet-control {\\r\\n\\tfloat: right;\\r\\n\\t}\\r\\n.leaflet-top .leaflet-control {\\r\\n\\tmargin-top: 10px;\\r\\n\\t}\\r\\n.leaflet-bottom .leaflet-control {\\r\\n\\tmargin-bottom: 10px;\\r\\n\\t}\\r\\n.leaflet-left .leaflet-control {\\r\\n\\tmargin-left: 10px;\\r\\n\\t}\\r\\n.leaflet-right .leaflet-control {\\r\\n\\tmargin-right: 10px;\\r\\n\\t}\\r\\n\\r\\n\\r\\n/* zoom and fade animations */\\r\\n\\r\\n.leaflet-fade-anim .leaflet-tile {\\r\\n\\twill-change: opacity;\\r\\n\\t}\\r\\n.leaflet-fade-anim .leaflet-popup {\\r\\n\\topacity: 0;\\r\\n\\t-webkit-transition: opacity 0.2s linear;\\r\\n\\t -moz-transition: opacity 0.2s linear;\\r\\n\\t transition: opacity 0.2s linear;\\r\\n\\t}\\r\\n.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {\\r\\n\\topacity: 1;\\r\\n\\t}\\r\\n.leaflet-zoom-animated {\\r\\n\\t-webkit-transform-origin: 0 0;\\r\\n\\t -ms-transform-origin: 0 0;\\r\\n\\t transform-origin: 0 0;\\r\\n\\t}\\r\\n.leaflet-zoom-anim .leaflet-zoom-animated {\\r\\n\\twill-change: transform;\\r\\n\\t}\\r\\n.leaflet-zoom-anim .leaflet-zoom-animated {\\r\\n\\t-webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);\\r\\n\\t -moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1);\\r\\n\\t transition: transform 0.25s cubic-bezier(0,0,0.25,1);\\r\\n\\t}\\r\\n.leaflet-zoom-anim .leaflet-tile,\\r\\n.leaflet-pan-anim .leaflet-tile {\\r\\n\\t-webkit-transition: none;\\r\\n\\t -moz-transition: none;\\r\\n\\t transition: none;\\r\\n\\t}\\r\\n\\r\\n.leaflet-zoom-anim .leaflet-zoom-hide {\\r\\n\\tvisibility: hidden;\\r\\n\\t}\\r\\n\\r\\n\\r\\n/* cursors */\\r\\n\\r\\n.leaflet-interactive {\\r\\n\\tcursor: pointer;\\r\\n\\t}\\r\\n.leaflet-grab {\\r\\n\\tcursor: -webkit-grab;\\r\\n\\tcursor: -moz-grab;\\r\\n\\tcursor: grab;\\r\\n\\t}\\r\\n.leaflet-crosshair,\\r\\n.leaflet-crosshair .leaflet-interactive {\\r\\n\\tcursor: crosshair;\\r\\n\\t}\\r\\n.leaflet-popup-pane,\\r\\n.leaflet-control {\\r\\n\\tcursor: auto;\\r\\n\\t}\\r\\n.leaflet-dragging .leaflet-grab,\\r\\n.leaflet-dragging .leaflet-grab .leaflet-interactive,\\r\\n.leaflet-dragging .leaflet-marker-draggable {\\r\\n\\tcursor: move;\\r\\n\\tcursor: -webkit-grabbing;\\r\\n\\tcursor: -moz-grabbing;\\r\\n\\tcursor: grabbing;\\r\\n\\t}\\r\\n\\r\\n/* marker & overlays interactivity */\\r\\n.leaflet-marker-icon,\\r\\n.leaflet-marker-shadow,\\r\\n.leaflet-image-layer,\\r\\n.leaflet-pane > svg path,\\r\\n.leaflet-tile-container {\\r\\n\\tpointer-events: none;\\r\\n\\t}\\r\\n\\r\\n.leaflet-marker-icon.leaflet-interactive,\\r\\n.leaflet-image-layer.leaflet-interactive,\\r\\n.leaflet-pane > svg path.leaflet-interactive {\\r\\n\\tpointer-events: visiblePainted; /* IE 9-10 doesn't have auto */\\r\\n\\tpointer-events: auto;\\r\\n\\t}\\r\\n\\r\\n/* visual tweaks */\\r\\n\\r\\n.leaflet-container {\\r\\n\\tbackground: #ddd;\\r\\n\\toutline: 0;\\r\\n\\t}\\r\\n.leaflet-container a {\\r\\n\\tcolor: #0078A8;\\r\\n\\t}\\r\\n.leaflet-container a.leaflet-active {\\r\\n\\toutline: 2px solid orange;\\r\\n\\t}\\r\\n.leaflet-zoom-box {\\r\\n\\tborder: 2px dotted #38f;\\r\\n\\tbackground: rgba(255,255,255,0.5);\\r\\n\\t}\\r\\n\\r\\n\\r\\n/* general typography */\\r\\n.leaflet-container {\\r\\n\\tfont: 12px/1.5 \\\"Helvetica Neue\\\", Arial, Helvetica, sans-serif;\\r\\n\\t}\\r\\n\\r\\n\\r\\n/* general toolbar styles */\\r\\n\\r\\n.leaflet-bar {\\r\\n\\tbox-shadow: 0 1px 5px rgba(0,0,0,0.65);\\r\\n\\tborder-radius: 4px;\\r\\n\\t}\\r\\n.leaflet-bar a,\\r\\n.leaflet-bar a:hover {\\r\\n\\tbackground-color: #fff;\\r\\n\\tborder-bottom: 1px solid #ccc;\\r\\n\\twidth: 26px;\\r\\n\\theight: 26px;\\r\\n\\tline-height: 26px;\\r\\n\\tdisplay: block;\\r\\n\\ttext-align: center;\\r\\n\\ttext-decoration: none;\\r\\n\\tcolor: black;\\r\\n\\t}\\r\\n.leaflet-bar a,\\r\\n.leaflet-control-layers-toggle {\\r\\n\\tbackground-position: 50% 50%;\\r\\n\\tbackground-repeat: no-repeat;\\r\\n\\tdisplay: block;\\r\\n\\t}\\r\\n.leaflet-bar a:hover {\\r\\n\\tbackground-color: #f4f4f4;\\r\\n\\t}\\r\\n.leaflet-bar a:first-child {\\r\\n\\tborder-top-left-radius: 4px;\\r\\n\\tborder-top-right-radius: 4px;\\r\\n\\t}\\r\\n.leaflet-bar a:last-child {\\r\\n\\tborder-bottom-left-radius: 4px;\\r\\n\\tborder-bottom-right-radius: 4px;\\r\\n\\tborder-bottom: none;\\r\\n\\t}\\r\\n.leaflet-bar a.leaflet-disabled {\\r\\n\\tcursor: default;\\r\\n\\tbackground-color: #f4f4f4;\\r\\n\\tcolor: #bbb;\\r\\n\\t}\\r\\n\\r\\n.leaflet-touch .leaflet-bar a {\\r\\n\\twidth: 30px;\\r\\n\\theight: 30px;\\r\\n\\tline-height: 30px;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-bar a:first-child {\\r\\n\\tborder-top-left-radius: 2px;\\r\\n\\tborder-top-right-radius: 2px;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-bar a:last-child {\\r\\n\\tborder-bottom-left-radius: 2px;\\r\\n\\tborder-bottom-right-radius: 2px;\\r\\n\\t}\\r\\n\\r\\n/* zoom control */\\r\\n\\r\\n.leaflet-control-zoom-in,\\r\\n.leaflet-control-zoom-out {\\r\\n\\tfont: bold 18px 'Lucida Console', Monaco, monospace;\\r\\n\\ttext-indent: 1px;\\r\\n\\t}\\r\\n\\r\\n.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out {\\r\\n\\tfont-size: 22px;\\r\\n\\t}\\r\\n\\r\\n\\r\\n/* layers control */\\r\\n\\r\\n.leaflet-control-layers {\\r\\n\\tbox-shadow: 0 1px 5px rgba(0,0,0,0.4);\\r\\n\\tbackground: #fff;\\r\\n\\tborder-radius: 5px;\\r\\n\\t}\\r\\n.leaflet-control-layers-toggle {\\r\\n\\tbackground-image: url(\" + ___CSS_LOADER_URL___0___ + \");\\r\\n\\twidth: 36px;\\r\\n\\theight: 36px;\\r\\n\\t}\\r\\n.leaflet-retina .leaflet-control-layers-toggle {\\r\\n\\tbackground-image: url(\" + ___CSS_LOADER_URL___1___ + \");\\r\\n\\tbackground-size: 26px 26px;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-control-layers-toggle {\\r\\n\\twidth: 44px;\\r\\n\\theight: 44px;\\r\\n\\t}\\r\\n.leaflet-control-layers .leaflet-control-layers-list,\\r\\n.leaflet-control-layers-expanded .leaflet-control-layers-toggle {\\r\\n\\tdisplay: none;\\r\\n\\t}\\r\\n.leaflet-control-layers-expanded .leaflet-control-layers-list {\\r\\n\\tdisplay: block;\\r\\n\\tposition: relative;\\r\\n\\t}\\r\\n.leaflet-control-layers-expanded {\\r\\n\\tpadding: 6px 10px 6px 6px;\\r\\n\\tcolor: #333;\\r\\n\\tbackground: #fff;\\r\\n\\t}\\r\\n.leaflet-control-layers-scrollbar {\\r\\n\\toverflow-y: scroll;\\r\\n\\toverflow-x: hidden;\\r\\n\\tpadding-right: 5px;\\r\\n\\t}\\r\\n.leaflet-control-layers-selector {\\r\\n\\tmargin-top: 2px;\\r\\n\\tposition: relative;\\r\\n\\ttop: 1px;\\r\\n\\t}\\r\\n.leaflet-control-layers label {\\r\\n\\tdisplay: block;\\r\\n\\t}\\r\\n.leaflet-control-layers-separator {\\r\\n\\theight: 0;\\r\\n\\tborder-top: 1px solid #ddd;\\r\\n\\tmargin: 5px -10px 5px -6px;\\r\\n\\t}\\r\\n\\r\\n/* Default icon URLs */\\r\\n.leaflet-default-icon-path {\\r\\n\\tbackground-image: url(\" + ___CSS_LOADER_URL___2___ + \");\\r\\n\\t}\\r\\n\\r\\n\\r\\n/* attribution and scale controls */\\r\\n\\r\\n.leaflet-container .leaflet-control-attribution {\\r\\n\\tbackground: #fff;\\r\\n\\tbackground: rgba(255, 255, 255, 0.7);\\r\\n\\tmargin: 0;\\r\\n\\t}\\r\\n.leaflet-control-attribution,\\r\\n.leaflet-control-scale-line {\\r\\n\\tpadding: 0 5px;\\r\\n\\tcolor: #333;\\r\\n\\t}\\r\\n.leaflet-control-attribution a {\\r\\n\\ttext-decoration: none;\\r\\n\\t}\\r\\n.leaflet-control-attribution a:hover {\\r\\n\\ttext-decoration: underline;\\r\\n\\t}\\r\\n.leaflet-container .leaflet-control-attribution,\\r\\n.leaflet-container .leaflet-control-scale {\\r\\n\\tfont-size: 11px;\\r\\n\\t}\\r\\n.leaflet-left .leaflet-control-scale {\\r\\n\\tmargin-left: 5px;\\r\\n\\t}\\r\\n.leaflet-bottom .leaflet-control-scale {\\r\\n\\tmargin-bottom: 5px;\\r\\n\\t}\\r\\n.leaflet-control-scale-line {\\r\\n\\tborder: 2px solid #777;\\r\\n\\tborder-top: none;\\r\\n\\tline-height: 1.1;\\r\\n\\tpadding: 2px 5px 1px;\\r\\n\\tfont-size: 11px;\\r\\n\\twhite-space: nowrap;\\r\\n\\toverflow: hidden;\\r\\n\\t-moz-box-sizing: border-box;\\r\\n\\t box-sizing: border-box;\\r\\n\\r\\n\\tbackground: #fff;\\r\\n\\tbackground: rgba(255, 255, 255, 0.5);\\r\\n\\t}\\r\\n.leaflet-control-scale-line:not(:first-child) {\\r\\n\\tborder-top: 2px solid #777;\\r\\n\\tborder-bottom: none;\\r\\n\\tmargin-top: -2px;\\r\\n\\t}\\r\\n.leaflet-control-scale-line:not(:first-child):not(:last-child) {\\r\\n\\tborder-bottom: 2px solid #777;\\r\\n\\t}\\r\\n\\r\\n.leaflet-touch .leaflet-control-attribution,\\r\\n.leaflet-touch .leaflet-control-layers,\\r\\n.leaflet-touch .leaflet-bar {\\r\\n\\tbox-shadow: none;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-control-layers,\\r\\n.leaflet-touch .leaflet-bar {\\r\\n\\tborder: 2px solid rgba(0,0,0,0.2);\\r\\n\\tbackground-clip: padding-box;\\r\\n\\t}\\r\\n\\r\\n\\r\\n/* popup */\\r\\n\\r\\n.leaflet-popup {\\r\\n\\tposition: absolute;\\r\\n\\ttext-align: center;\\r\\n\\tmargin-bottom: 20px;\\r\\n\\t}\\r\\n.leaflet-popup-content-wrapper {\\r\\n\\tpadding: 1px;\\r\\n\\ttext-align: left;\\r\\n\\tborder-radius: 12px;\\r\\n\\t}\\r\\n.leaflet-popup-content {\\r\\n\\tmargin: 13px 19px;\\r\\n\\tline-height: 1.4;\\r\\n\\t}\\r\\n.leaflet-popup-content p {\\r\\n\\tmargin: 18px 0;\\r\\n\\t}\\r\\n.leaflet-popup-tip-container {\\r\\n\\twidth: 40px;\\r\\n\\theight: 20px;\\r\\n\\tposition: absolute;\\r\\n\\tleft: 50%;\\r\\n\\tmargin-left: -20px;\\r\\n\\toverflow: hidden;\\r\\n\\tpointer-events: none;\\r\\n\\t}\\r\\n.leaflet-popup-tip {\\r\\n\\twidth: 17px;\\r\\n\\theight: 17px;\\r\\n\\tpadding: 1px;\\r\\n\\r\\n\\tmargin: -10px auto 0;\\r\\n\\r\\n\\t-webkit-transform: rotate(45deg);\\r\\n\\t -moz-transform: rotate(45deg);\\r\\n\\t -ms-transform: rotate(45deg);\\r\\n\\t transform: rotate(45deg);\\r\\n\\t}\\r\\n.leaflet-popup-content-wrapper,\\r\\n.leaflet-popup-tip {\\r\\n\\tbackground: white;\\r\\n\\tcolor: #333;\\r\\n\\tbox-shadow: 0 3px 14px rgba(0,0,0,0.4);\\r\\n\\t}\\r\\n.leaflet-container a.leaflet-popup-close-button {\\r\\n\\tposition: absolute;\\r\\n\\ttop: 0;\\r\\n\\tright: 0;\\r\\n\\tpadding: 4px 4px 0 0;\\r\\n\\tborder: none;\\r\\n\\ttext-align: center;\\r\\n\\twidth: 18px;\\r\\n\\theight: 14px;\\r\\n\\tfont: 16px/14px Tahoma, Verdana, sans-serif;\\r\\n\\tcolor: #c3c3c3;\\r\\n\\ttext-decoration: none;\\r\\n\\tfont-weight: bold;\\r\\n\\tbackground: transparent;\\r\\n\\t}\\r\\n.leaflet-container a.leaflet-popup-close-button:hover {\\r\\n\\tcolor: #999;\\r\\n\\t}\\r\\n.leaflet-popup-scrolled {\\r\\n\\toverflow: auto;\\r\\n\\tborder-bottom: 1px solid #ddd;\\r\\n\\tborder-top: 1px solid #ddd;\\r\\n\\t}\\r\\n\\r\\n.leaflet-oldie .leaflet-popup-content-wrapper {\\r\\n\\tzoom: 1;\\r\\n\\t}\\r\\n.leaflet-oldie .leaflet-popup-tip {\\r\\n\\twidth: 24px;\\r\\n\\tmargin: 0 auto;\\r\\n\\r\\n\\t-ms-filter: \\\"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)\\\";\\r\\n\\tfilter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);\\r\\n\\t}\\r\\n.leaflet-oldie .leaflet-popup-tip-container {\\r\\n\\tmargin-top: -1px;\\r\\n\\t}\\r\\n\\r\\n.leaflet-oldie .leaflet-control-zoom,\\r\\n.leaflet-oldie .leaflet-control-layers,\\r\\n.leaflet-oldie .leaflet-popup-content-wrapper,\\r\\n.leaflet-oldie .leaflet-popup-tip {\\r\\n\\tborder: 1px solid #999;\\r\\n\\t}\\r\\n\\r\\n\\r\\n/* div icon */\\r\\n\\r\\n.leaflet-div-icon {\\r\\n\\tbackground: #fff;\\r\\n\\tborder: 1px solid #666;\\r\\n\\t}\\r\\n\\r\\n\\r\\n/* Tooltip */\\r\\n/* Base styles for the element that has a tooltip */\\r\\n.leaflet-tooltip {\\r\\n\\tposition: absolute;\\r\\n\\tpadding: 6px;\\r\\n\\tbackground-color: #fff;\\r\\n\\tborder: 1px solid #fff;\\r\\n\\tborder-radius: 3px;\\r\\n\\tcolor: #222;\\r\\n\\twhite-space: nowrap;\\r\\n\\t-webkit-user-select: none;\\r\\n\\t-moz-user-select: none;\\r\\n\\t-ms-user-select: none;\\r\\n\\tuser-select: none;\\r\\n\\tpointer-events: none;\\r\\n\\tbox-shadow: 0 1px 3px rgba(0,0,0,0.4);\\r\\n\\t}\\r\\n.leaflet-tooltip.leaflet-clickable {\\r\\n\\tcursor: pointer;\\r\\n\\tpointer-events: auto;\\r\\n\\t}\\r\\n.leaflet-tooltip-top:before,\\r\\n.leaflet-tooltip-bottom:before,\\r\\n.leaflet-tooltip-left:before,\\r\\n.leaflet-tooltip-right:before {\\r\\n\\tposition: absolute;\\r\\n\\tpointer-events: none;\\r\\n\\tborder: 6px solid transparent;\\r\\n\\tbackground: transparent;\\r\\n\\tcontent: \\\"\\\";\\r\\n\\t}\\r\\n\\r\\n/* Directions */\\r\\n\\r\\n.leaflet-tooltip-bottom {\\r\\n\\tmargin-top: 6px;\\r\\n}\\r\\n.leaflet-tooltip-top {\\r\\n\\tmargin-top: -6px;\\r\\n}\\r\\n.leaflet-tooltip-bottom:before,\\r\\n.leaflet-tooltip-top:before {\\r\\n\\tleft: 50%;\\r\\n\\tmargin-left: -6px;\\r\\n\\t}\\r\\n.leaflet-tooltip-top:before {\\r\\n\\tbottom: 0;\\r\\n\\tmargin-bottom: -12px;\\r\\n\\tborder-top-color: #fff;\\r\\n\\t}\\r\\n.leaflet-tooltip-bottom:before {\\r\\n\\ttop: 0;\\r\\n\\tmargin-top: -12px;\\r\\n\\tmargin-left: -6px;\\r\\n\\tborder-bottom-color: #fff;\\r\\n\\t}\\r\\n.leaflet-tooltip-left {\\r\\n\\tmargin-left: -6px;\\r\\n}\\r\\n.leaflet-tooltip-right {\\r\\n\\tmargin-left: 6px;\\r\\n}\\r\\n.leaflet-tooltip-left:before,\\r\\n.leaflet-tooltip-right:before {\\r\\n\\ttop: 50%;\\r\\n\\tmargin-top: -6px;\\r\\n\\t}\\r\\n.leaflet-tooltip-left:before {\\r\\n\\tright: 0;\\r\\n\\tmargin-right: -12px;\\r\\n\\tborder-left-color: #fff;\\r\\n\\t}\\r\\n.leaflet-tooltip-right:before {\\r\\n\\tleft: 0;\\r\\n\\tmargin-left: -12px;\\r\\n\\tborder-right-color: #fff;\\r\\n\\t}\\r\\n\", \"\"]);\n\n\n\n//# sourceURL=webpack:///./node_modules/leaflet/dist/leaflet.css?./node_modules/css-loader/dist/cjs.js"); /***/ }), /***/ "./node_modules/css-loader/dist/runtime/api.js": /*!*****************************************************!*\ !*** ./node_modules/css-loader/dist/runtime/api.js ***! \*****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval("\n/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\n\nmodule.exports = function (useSourceMap) {\n var list = []; // return the list of modules as css string\n\n list.toString = function toString() {\n return this.map(function (item) {\n var content = cssWithMappingToString(item, useSourceMap);\n\n if (item[2]) {\n return '@media ' + item[2] + '{' + content + '}';\n } else {\n return content;\n }\n }).join('');\n }; // import a list of modules into the list\n\n\n list.i = function (modules, mediaQuery) {\n if (typeof modules === 'string') {\n modules = [[null, modules, '']];\n }\n\n var alreadyImportedModules = {};\n\n for (var i = 0; i < this.length; i++) {\n var id = this[i][0];\n\n if (id != null) {\n alreadyImportedModules[id] = true;\n }\n }\n\n for (i = 0; i < modules.length; i++) {\n var item = modules[i]; // skip already imported module\n // this implementation is not 100% perfect for weird media query combinations\n // when a module is imported multiple times with different media queries.\n // I hope this will never occur (Hey this way we have smaller bundles)\n\n if (item[0] == null || !alreadyImportedModules[item[0]]) {\n if (mediaQuery && !item[2]) {\n item[2] = mediaQuery;\n } else if (mediaQuery) {\n item[2] = '(' + item[2] + ') and (' + mediaQuery + ')';\n }\n\n list.push(item);\n }\n }\n };\n\n return list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n var content = item[1] || '';\n var cssMapping = item[3];\n\n if (!cssMapping) {\n return content;\n }\n\n if (useSourceMap && typeof btoa === 'function') {\n var sourceMapping = toComment(cssMapping);\n var sourceURLs = cssMapping.sources.map(function (source) {\n return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */';\n });\n return [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n }\n\n return [content].join('\\n');\n} // Adapted from convert-source-map (MIT)\n\n\nfunction toComment(sourceMap) {\n // eslint-disable-next-line no-undef\n var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n return '/*# ' + data + ' */';\n}\n\n//# sourceURL=webpack:///./node_modules/css-loader/dist/runtime/api.js?"); /***/ }), /***/ "./node_modules/css-loader/dist/runtime/url-escape.js": /*!************************************************************!*\ !*** ./node_modules/css-loader/dist/runtime/url-escape.js ***! \************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval("\n\nmodule.exports = function escape(url, needQuotes) {\n if (typeof url !== 'string') {\n return url;\n } // If url is already wrapped in quotes, remove them\n\n\n if (/^['\"].*['\"]$/.test(url)) {\n url = url.slice(1, -1);\n } // Should url be wrapped?\n // See https://drafts.csswg.org/css-values-3/#urls\n\n\n if (/[\"'() \\t\\n]/.test(url) || needQuotes) {\n return '\"' + url.replace(/\"/g, '\\\\\"').replace(/\\n/g, '\\\\n') + '\"';\n }\n\n return url;\n};\n\n//# sourceURL=webpack:///./node_modules/css-loader/dist/runtime/url-escape.js?"); /***/ }), /***/ "./node_modules/leaflet/dist/images/layers-2x.png": /*!********************************************************!*\ !*** ./node_modules/leaflet/dist/images/layers-2x.png ***! \********************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("module.exports = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAQAAABvcdNgAAAEsklEQVR4AWL4TydIhpZK1kpWOlg0w3ZXP6D2soBtG42jeI6ZmQTHzAxiTbSJsYLjO9HhP+WOmcuhciVnmHVQcJnp7DFvScowZorad/+V/fVzMdMT2g9Cv9guXGv/7pYOrXh2U+RRR3dSd9JRx6bIFc/ekqHI29JC6pJ5ZEh1yWkhkbcFeSjxgx3L2m1cb1C7bceyxA+CNjT/Ifff+/kDk2u/w/33/IeCMOSaWZ4glosqT3DNnNZQ7Cs58/3Ce5HL78iZH/vKVIaYlqzfdLu8Vi7dnvUbEza5Idt36tquZFldl6N5Z/POLof0XLK61mZCmJSWjVF9tEjUluu74IUXvgttuVIHE7YxSkaYhJZam7yiM9Pv82JYfl9nptxZaxMJE4YSPty+vF0+Y2up9d3wwijfjZbabqm/3bZ9ecKHsiGmRflnn1MW4pjHf9oLufyn2z3y1D6n8g8TZhxyzipLNPnAUpsOiuWimg52psrTZYnOWYNDTMuWBWa0tJb4rgq1UvmutpaYEbZlwU3CLJm/ayYjHW5/h7xWLn9Hh1vepDkyf7dE7MtT5LR4e7yYpHrkhOUpEfssBLq2pPhAqoSWKUkk7EDqkmK6RrCEzqDjhNDWNE+XSMvkJRDWlZTmCW0l0PHQGRZY5t1L83kT0Y3l2SItk5JAWHl2dCOBm+fPu3fo5/3v61RMCO9Jx2EEYYhb0rmNQMX/vm7gqOEJLcXTGw3CAuRNeyaPWwjR8PRqKQ1PDA/dpv+on9Shox52WFnx0KY8onHayrJzm87i5h9xGw/tfkev0jGsQizqezUKjk12hBMKJ4kbCqGPVNXudyyrShovGw5CgxsRICxF6aRmSjlBnHRzg7Gx8fKqEubI2rahQYdR1YgDIRQO7JvQyD52hoIQx0mxa0ODtW2Iozn1le2iIRdzwWewedyZzewidueOGqlsn1MvcnQpuVwLGG3/IR1hIKxCjelIDZ8ldqWz25jWAsnldEnK0Zxro19TGVb2ffIZEsIO89EIEDvKMPrzmBOQcKQ+rroye6NgRRxqR4U8EAkz0CL6uSGOm6KQCdWjvjRiSP1BPalCRS5iQYiEIvxuBMJEWgzSoHADcVMuN7IuqqTeyUPq22qFimFtxDyBBJEwNyt6TM88blFHao/6tWWhuuOM4SAK4EI4QmFHA+SEyWlp4EQoJ13cYGzMu7yszEIBOm2rVmHUNqwAIQabISNMRstmdhNWcFLsSm+0tjJH1MdRxO5Nx0WDMhCtgD6OKgZeljJqJKc9po8juskR9XN0Y1lZ3mWjLR9JCO1jRDMd0fpYC2VnvjBSEFg7wBENc0R9HFlb0xvF1+TBEpF68d+DHR6IOWVv2BECtxo46hOFUBd/APU57WIoEwJhIi2CdpyZX0m93BZicktMj1AS9dClteUFAUNUIEygRZCtik5zSxI9MubTBH1GOiHsiLJ3OCoSZkILa9PxiN0EbvhsAo8tdAf9Seepd36lGWHmtNANTv5Jd0z4QYyeo/UEJqxKRpg5LZx6btLPsOaEmdMyxYdlc8LMaJnikDlhclqmPiQnTEpLUIZEwkRagjYkEibQErwhkTAKCLQEbUgkzJQWc/0PstHHcfEdQ+UAAAAASUVORK5CYII=\"\n\n//# sourceURL=webpack:///./node_modules/leaflet/dist/images/layers-2x.png?"); /***/ }), /***/ "./node_modules/leaflet/dist/images/layers.png": /*!*****************************************************!*\ !*** ./node_modules/leaflet/dist/images/layers.png ***! \*****************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("module.exports = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAQAAAADQ4RFAAACf0lEQVR4AY1UM3gkARTePdvdoTxXKc+qTl3aU5U6b2Kbkz3Gtq3Zw6ziLGNPzrYx7946Tr6/ee/XeCQ4D3ykPtL5tHno4n0d/h3+xfuWHGLX81cn7r0iTNzjr7LrlxCqPtkbTQEHeqOrTy4Yyt3VCi/IOB0v7rVC7q45Q3Gr5K6jt+3Gl5nCoDD4MtO+j96Wu8atmhGqcNGHObuf8OM/x3AMx38+4Z2sPqzCxRFK2aF2e5Jol56XTLyggAMTL56XOMoS1W4pOyjUcGGQdZxU6qRh7B9Zp+PfpOFlqt0zyDZckPi1ttmIp03jX8gyJ8a/PG2yutpS/Vol7peZIbZcKBAEEheEIAgFbDkz5H6Zrkm2hVWGiXKiF4Ycw0RWKdtC16Q7qe3X4iOMxruonzegJzWaXFrU9utOSsLUmrc0YjeWYjCW4PDMADElpJSSQ0vQvA1Tm6/JlKnqFs1EGyZiFCqnRZTEJJJiKRYzVYzJck2Rm6P4iH+cmSY0YzimYa8l0EtTODFWhcMIMVqdsI2uiTvKmTisIDHJ3od5GILVhBCarCfVRmo4uTjkhrhzkiBV7SsaqS+TzrzM1qpGGUFt28pIySQHR6h7F6KSwGWm97ay+Z+ZqMcEjEWebE7wxCSQwpkhJqoZA5ivCdZDjJepuJ9IQjGGUmuXJdBFUygxVqVsxFsLMbDe8ZbDYVCGKxs+W080max1hFCarCfV+C1KATwcnvE9gRRuMP2prdbWGowm1KB1y+zwMMENkM755cJ2yPDtqhTI6ED1M/82yIDtC/4j4BijjeObflpO9I9MwXTCsSX8jWAFeHr05WoLTJ5G8IQVS/7vwR6ohirYM7f6HzYpogfS3R2OAAAAAElFTkSuQmCC\"\n\n//# sourceURL=webpack:///./node_modules/leaflet/dist/images/layers.png?"); /***/ }), /***/ "./node_modules/leaflet/dist/images/marker-icon.png": /*!**********************************************************!*\ !*** ./node_modules/leaflet/dist/images/marker-icon.png ***! \**********************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("module.exports = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=\"\n\n//# sourceURL=webpack:///./node_modules/leaflet/dist/images/marker-icon.png?"); /***/ }), /***/ "./node_modules/leaflet/dist/leaflet-src.js": /*!**************************************************!*\ !*** ./node_modules/leaflet/dist/leaflet-src.js ***! \**************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("/* @preserve\n * Leaflet 1.4.0, a JS library for interactive maps. http://leafletjs.com\n * (c) 2010-2018 Vladimir Agafonkin, (c) 2010-2011 CloudMade\n */\n(function (global, factory) {\n true ? factory(exports) : undefined;\n})(this, function (exports) {\n 'use strict';\n\n var version = \"1.4.0\";\n /*\r\n * @namespace Util\r\n *\r\n * Various utility functions, used by Leaflet internally.\r\n */\n\n var freeze = Object.freeze;\n\n Object.freeze = function (obj) {\n return obj;\n }; // @function extend(dest: Object, src?: Object): Object\n // Merges the properties of the `src` object (or multiple objects) into `dest` object and returns the latter. Has an `L.extend` shortcut.\n\n\n function extend(dest) {\n var i, j, len, src;\n\n for (j = 1, len = arguments.length; j < len; j++) {\n src = arguments[j];\n\n for (i in src) {\n dest[i] = src[i];\n }\n }\n\n return dest;\n } // @function create(proto: Object, properties?: Object): Object\n // Compatibility polyfill for [Object.create](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/create)\n\n\n var create = Object.create || function () {\n function F() {}\n\n return function (proto) {\n F.prototype = proto;\n return new F();\n };\n }(); // @function bind(fn: Function, …): Function\n // Returns a new function bound to the arguments passed, like [Function.prototype.bind](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).\n // Has a `L.bind()` shortcut.\n\n\n function bind(fn, obj) {\n var slice = Array.prototype.slice;\n\n if (fn.bind) {\n return fn.bind.apply(fn, slice.call(arguments, 1));\n }\n\n var args = slice.call(arguments, 2);\n return function () {\n return fn.apply(obj, args.length ? args.concat(slice.call(arguments)) : arguments);\n };\n } // @property lastId: Number\n // Last unique ID used by [`stamp()`](#util-stamp)\n\n\n var lastId = 0; // @function stamp(obj: Object): Number\n // Returns the unique ID of an object, assigning it one if it doesn't have it.\n\n function stamp(obj) {\n /*eslint-disable */\n obj._leaflet_id = obj._leaflet_id || ++lastId;\n return obj._leaflet_id;\n /* eslint-enable */\n } // @function throttle(fn: Function, time: Number, context: Object): Function\n // Returns a function which executes function `fn` with the given scope `context`\n // (so that the `this` keyword refers to `context` inside `fn`'s code). The function\n // `fn` will be called no more than one time per given amount of `time`. The arguments\n // received by the bound function will be any arguments passed when binding the\n // function, followed by any arguments passed when invoking the bound function.\n // Has an `L.throttle` shortcut.\n\n\n function throttle(fn, time, context) {\n var lock, args, wrapperFn, later;\n\n later = function () {\n // reset lock and call if queued\n lock = false;\n\n if (args) {\n wrapperFn.apply(context, args);\n args = false;\n }\n };\n\n wrapperFn = function () {\n if (lock) {\n // called too soon, queue to call later\n args = arguments;\n } else {\n // call and lock until later\n fn.apply(context, arguments);\n setTimeout(later, time);\n lock = true;\n }\n };\n\n return wrapperFn;\n } // @function wrapNum(num: Number, range: Number[], includeMax?: Boolean): Number\n // Returns the number `num` modulo `range` in such a way so it lies within\n // `range[0]` and `range[1]`. The returned value will be always smaller than\n // `range[1]` unless `includeMax` is set to `true`.\n\n\n function wrapNum(x, range, includeMax) {\n var max = range[1],\n min = range[0],\n d = max - min;\n return x === max && includeMax ? x : ((x - min) % d + d) % d + min;\n } // @function falseFn(): Function\n // Returns a function which always returns `false`.\n\n\n function falseFn() {\n return false;\n } // @function formatNum(num: Number, digits?: Number): Number\n // Returns the number `num` rounded to `digits` decimals, or to 6 decimals by default.\n\n\n function formatNum(num, digits) {\n var pow = Math.pow(10, digits === undefined ? 6 : digits);\n return Math.round(num * pow) / pow;\n } // @function trim(str: String): String\n // Compatibility polyfill for [String.prototype.trim](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim)\n\n\n function trim(str) {\n return str.trim ? str.trim() : str.replace(/^\\s+|\\s+$/g, '');\n } // @function splitWords(str: String): String[]\n // Trims and splits the string on whitespace and returns the array of parts.\n\n\n function splitWords(str) {\n return trim(str).split(/\\s+/);\n } // @function setOptions(obj: Object, options: Object): Object\n // Merges the given properties to the `options` of the `obj` object, returning the resulting options. See `Class options`. Has an `L.setOptions` shortcut.\n\n\n function setOptions(obj, options) {\n if (!obj.hasOwnProperty('options')) {\n obj.options = obj.options ? create(obj.options) : {};\n }\n\n for (var i in options) {\n obj.options[i] = options[i];\n }\n\n return obj.options;\n } // @function getParamString(obj: Object, existingUrl?: String, uppercase?: Boolean): String\n // Converts an object into a parameter URL string, e.g. `{a: \"foo\", b: \"bar\"}`\n // translates to `'?a=foo&b=bar'`. If `existingUrl` is set, the parameters will\n // be appended at the end. If `uppercase` is `true`, the parameter names will\n // be uppercased (e.g. `'?A=foo&B=bar'`)\n\n\n function getParamString(obj, existingUrl, uppercase) {\n var params = [];\n\n for (var i in obj) {\n params.push(encodeURIComponent(uppercase ? i.toUpperCase() : i) + '=' + encodeURIComponent(obj[i]));\n }\n\n return (!existingUrl || existingUrl.indexOf('?') === -1 ? '?' : '&') + params.join('&');\n }\n\n var templateRe = /\\{ *([\\w_-]+) *\\}/g; // @function template(str: String, data: Object): String\n // Simple templating facility, accepts a template string of the form `'Hello {a}, {b}'`\n // and a data object like `{a: 'foo', b: 'bar'}`, returns evaluated string\n // `('Hello foo, bar')`. You can also specify functions instead of strings for\n // data values — they will be evaluated passing `data` as an argument.\n\n function template(str, data) {\n return str.replace(templateRe, function (str, key) {\n var value = data[key];\n\n if (value === undefined) {\n throw new Error('No value provided for variable ' + str);\n } else if (typeof value === 'function') {\n value = value(data);\n }\n\n return value;\n });\n } // @function isArray(obj): Boolean\n // Compatibility polyfill for [Array.isArray](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray)\n\n\n var isArray = Array.isArray || function (obj) {\n return Object.prototype.toString.call(obj) === '[object Array]';\n }; // @function indexOf(array: Array, el: Object): Number\n // Compatibility polyfill for [Array.prototype.indexOf](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf)\n\n\n function indexOf(array, el) {\n for (var i = 0; i < array.length; i++) {\n if (array[i] === el) {\n return i;\n }\n }\n\n return -1;\n } // @property emptyImageUrl: String\n // Data URI string containing a base64-encoded empty GIF image.\n // Used as a hack to free memory from unused images on WebKit-powered\n // mobile devices (by setting image `src` to this string).\n\n\n var emptyImageUrl = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs='; // inspired by http://paulirish.com/2011/requestanimationframe-for-smart-animating/\n\n function getPrefixed(name) {\n return window['webkit' + name] || window['moz' + name] || window['ms' + name];\n }\n\n var lastTime = 0; // fallback for IE 7-8\n\n function timeoutDefer(fn) {\n var time = +new Date(),\n timeToCall = Math.max(0, 16 - (time - lastTime));\n lastTime = time + timeToCall;\n return window.setTimeout(fn, timeToCall);\n }\n\n var requestFn = window.requestAnimationFrame || getPrefixed('RequestAnimationFrame') || timeoutDefer;\n\n var cancelFn = window.cancelAnimationFrame || getPrefixed('CancelAnimationFrame') || getPrefixed('CancelRequestAnimationFrame') || function (id) {\n window.clearTimeout(id);\n }; // @function requestAnimFrame(fn: Function, context?: Object, immediate?: Boolean): Number\n // Schedules `fn` to be executed when the browser repaints. `fn` is bound to\n // `context` if given. When `immediate` is set, `fn` is called immediately if\n // the browser doesn't have native support for\n // [`window.requestAnimationFrame`](https://developer.mozilla.org/docs/Web/API/window/requestAnimationFrame),\n // otherwise it's delayed. Returns a request ID that can be used to cancel the request.\n\n\n function requestAnimFrame(fn, context, immediate) {\n if (immediate && requestFn === timeoutDefer) {\n fn.call(context);\n } else {\n return requestFn.call(window, bind(fn, context));\n }\n } // @function cancelAnimFrame(id: Number): undefined\n // Cancels a previous `requestAnimFrame`. See also [window.cancelAnimationFrame](https://developer.mozilla.org/docs/Web/API/window/cancelAnimationFrame).\n\n\n function cancelAnimFrame(id) {\n if (id) {\n cancelFn.call(window, id);\n }\n }\n\n var Util = (Object.freeze || Object)({\n freeze: freeze,\n extend: extend,\n create: create,\n bind: bind,\n lastId: lastId,\n stamp: stamp,\n throttle: throttle,\n wrapNum: wrapNum,\n falseFn: falseFn,\n formatNum: formatNum,\n trim: trim,\n splitWords: splitWords,\n setOptions: setOptions,\n getParamString: getParamString,\n template: template,\n isArray: isArray,\n indexOf: indexOf,\n emptyImageUrl: emptyImageUrl,\n requestFn: requestFn,\n cancelFn: cancelFn,\n requestAnimFrame: requestAnimFrame,\n cancelAnimFrame: cancelAnimFrame\n }); // @class Class\n // @aka L.Class\n // @section\n // @uninheritable\n // Thanks to John Resig and Dean Edwards for inspiration!\n\n function Class() {}\n\n Class.extend = function (props) {\n // @function extend(props: Object): Function\n // [Extends the current class](#class-inheritance) given the properties to be included.\n // Returns a Javascript function that is a class constructor (to be called with `new`).\n var NewClass = function () {\n // call the constructor\n if (this.initialize) {\n this.initialize.apply(this, arguments);\n } // call all constructor hooks\n\n\n this.callInitHooks();\n };\n\n var parentProto = NewClass.__super__ = this.prototype;\n var proto = create(parentProto);\n proto.constructor = NewClass;\n NewClass.prototype = proto; // inherit parent's statics\n\n for (var i in this) {\n if (this.hasOwnProperty(i) && i !== 'prototype' && i !== '__super__') {\n NewClass[i] = this[i];\n }\n } // mix static properties into the class\n\n\n if (props.statics) {\n extend(NewClass, props.statics);\n delete props.statics;\n } // mix includes into the prototype\n\n\n if (props.includes) {\n checkDeprecatedMixinEvents(props.includes);\n extend.apply(null, [proto].concat(props.includes));\n delete props.includes;\n } // merge options\n\n\n if (proto.options) {\n props.options = extend(create(proto.options), props.options);\n } // mix given properties into the prototype\n\n\n extend(proto, props);\n proto._initHooks = []; // add method for calling all hooks\n\n proto.callInitHooks = function () {\n if (this._initHooksCalled) {\n return;\n }\n\n if (parentProto.callInitHooks) {\n parentProto.callInitHooks.call(this);\n }\n\n this._initHooksCalled = true;\n\n for (var i = 0, len = proto._initHooks.length; i < len; i++) {\n proto._initHooks[i].call(this);\n }\n };\n\n return NewClass;\n }; // @function include(properties: Object): this\n // [Includes a mixin](#class-includes) into the current class.\n\n\n Class.include = function (props) {\n extend(this.prototype, props);\n return this;\n }; // @function mergeOptions(options: Object): this\n // [Merges `options`](#class-options) into the defaults of the class.\n\n\n Class.mergeOptions = function (options) {\n extend(this.prototype.options, options);\n return this;\n }; // @function addInitHook(fn: Function): this\n // Adds a [constructor hook](#class-constructor-hooks) to the class.\n\n\n Class.addInitHook = function (fn) {\n // (Function) || (String, args...)\n var args = Array.prototype.slice.call(arguments, 1);\n var init = typeof fn === 'function' ? fn : function () {\n this[fn].apply(this, args);\n };\n this.prototype._initHooks = this.prototype._initHooks || [];\n\n this.prototype._initHooks.push(init);\n\n return this;\n };\n\n function checkDeprecatedMixinEvents(includes) {\n if (typeof L === 'undefined' || !L || !L.Mixin) {\n return;\n }\n\n includes = isArray(includes) ? includes : [includes];\n\n for (var i = 0; i < includes.length; i++) {\n if (includes[i] === L.Mixin.Events) {\n console.warn('Deprecated include of L.Mixin.Events: ' + 'this property will be removed in future releases, ' + 'please inherit from L.Evented instead.', new Error().stack);\n }\n }\n }\n /*\r\n * @class Evented\r\n * @aka L.Evented\r\n * @inherits Class\r\n *\r\n * A set of methods shared between event-powered classes (like `Map` and `Marker`). Generally, events allow you to execute some function when something happens with an object (e.g. the user clicks on the map, causing the map to fire `'click'` event).\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * map.on('click', function(e) {\r\n * \talert(e.latlng);\r\n * } );\r\n * ```\r\n *\r\n * Leaflet deals with event listeners by reference, so if you want to add a listener and then remove it, define it as a function:\r\n *\r\n * ```js\r\n * function onClick(e) { ... }\r\n *\r\n * map.on('click', onClick);\r\n * map.off('click', onClick);\r\n * ```\r\n */\n\n\n var Events = {\n /* @method on(type: String, fn: Function, context?: Object): this\r\n * Adds a listener function (`fn`) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. `'click dblclick'`).\r\n *\r\n * @alternative\r\n * @method on(eventMap: Object): this\r\n * Adds a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}`\r\n */\n on: function (types, fn, context) {\n // types can be a map of types/handlers\n if (typeof types === 'object') {\n for (var type in types) {\n // we don't process space-separated events here for performance;\n // it's a hot path since Layer uses the on(obj) syntax\n this._on(type, types[type], fn);\n }\n } else {\n // types can be a string of space-separated words\n types = splitWords(types);\n\n for (var i = 0, len = types.length; i < len; i++) {\n this._on(types[i], fn, context);\n }\n }\n\n return this;\n },\n\n /* @method off(type: String, fn?: Function, context?: Object): this\r\n * Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to `on`, you must pass the same context to `off` in order to remove the listener.\r\n *\r\n * @alternative\r\n * @method off(eventMap: Object): this\r\n * Removes a set of type/listener pairs.\r\n *\r\n * @alternative\r\n * @method off: this\r\n * Removes all listeners to all events on the object.\r\n */\n off: function (types, fn, context) {\n if (!types) {\n // clear all listeners if called without arguments\n delete this._events;\n } else if (typeof types === 'object') {\n for (var type in types) {\n this._off(type, types[type], fn);\n }\n } else {\n types = splitWords(types);\n\n for (var i = 0, len = types.length; i < len; i++) {\n this._off(types[i], fn, context);\n }\n }\n\n return this;\n },\n // attach listener (without syntactic sugar now)\n _on: function (type, fn, context) {\n this._events = this._events || {};\n /* get/init listeners for type */\n\n var typeListeners = this._events[type];\n\n if (!typeListeners) {\n typeListeners = [];\n this._events[type] = typeListeners;\n }\n\n if (context === this) {\n // Less memory footprint.\n context = undefined;\n }\n\n var newListener = {\n fn: fn,\n ctx: context\n },\n listeners = typeListeners; // check if fn already there\n\n for (var i = 0, len = listeners.length; i < len; i++) {\n if (listeners[i].fn === fn && listeners[i].ctx === context) {\n return;\n }\n }\n\n listeners.push(newListener);\n },\n _off: function (type, fn, context) {\n var listeners, i, len;\n\n if (!this._events) {\n return;\n }\n\n listeners = this._events[type];\n\n if (!listeners) {\n return;\n }\n\n if (!fn) {\n // Set all removed listeners to noop so they are not called if remove happens in fire\n for (i = 0, len = listeners.length; i < len; i++) {\n listeners[i].fn = falseFn;\n } // clear all listeners for a type if function isn't specified\n\n\n delete this._events[type];\n return;\n }\n\n if (context === this) {\n context = undefined;\n }\n\n if (listeners) {\n // find fn and remove it\n for (i = 0, len = listeners.length; i < len; i++) {\n var l = listeners[i];\n\n if (l.ctx !== context) {\n continue;\n }\n\n if (l.fn === fn) {\n // set the removed listener to noop so that's not called if remove happens in fire\n l.fn = falseFn;\n\n if (this._firingCount) {\n /* copy array in case events are being fired */\n this._events[type] = listeners = listeners.slice();\n }\n\n listeners.splice(i, 1);\n return;\n }\n }\n }\n },\n // @method fire(type: String, data?: Object, propagate?: Boolean): this\n // Fires an event of the specified type. You can optionally provide an data\n // object — the first argument of the listener function will contain its\n // properties. The event can optionally be propagated to event parents.\n fire: function (type, data, propagate) {\n if (!this.listens(type, propagate)) {\n return this;\n }\n\n var event = extend({}, data, {\n type: type,\n target: this,\n sourceTarget: data && data.sourceTarget || this\n });\n\n if (this._events) {\n var listeners = this._events[type];\n\n if (listeners) {\n this._firingCount = this._firingCount + 1 || 1;\n\n for (var i = 0, len = listeners.length; i < len; i++) {\n var l = listeners[i];\n l.fn.call(l.ctx || this, event);\n }\n\n this._firingCount--;\n }\n }\n\n if (propagate) {\n // propagate the event to parents (set with addEventParent)\n this._propagateEvent(event);\n }\n\n return this;\n },\n // @method listens(type: String): Boolean\n // Returns `true` if a particular event type has any listeners attached to it.\n listens: function (type, propagate) {\n var listeners = this._events && this._events[type];\n\n if (listeners && listeners.length) {\n return true;\n }\n\n if (propagate) {\n // also check parents for listeners if event propagates\n for (var id in this._eventParents) {\n if (this._eventParents[id].listens(type, propagate)) {\n return true;\n }\n }\n }\n\n return false;\n },\n // @method once(…): this\n // Behaves as [`on(…)`](#evented-on), except the listener will only get fired once and then removed.\n once: function (types, fn, context) {\n if (typeof types === 'object') {\n for (var type in types) {\n this.once(type, types[type], fn);\n }\n\n return this;\n }\n\n var handler = bind(function () {\n this.off(types, fn, context).off(types, handler, context);\n }, this); // add a listener that's executed once and removed after that\n\n return this.on(types, fn, context).on(types, handler, context);\n },\n // @method addEventParent(obj: Evented): this\n // Adds an event parent - an `Evented` that will receive propagated events\n addEventParent: function (obj) {\n this._eventParents = this._eventParents || {};\n this._eventParents[stamp(obj)] = obj;\n return this;\n },\n // @method removeEventParent(obj: Evented): this\n // Removes an event parent, so it will stop receiving propagated events\n removeEventParent: function (obj) {\n if (this._eventParents) {\n delete this._eventParents[stamp(obj)];\n }\n\n return this;\n },\n _propagateEvent: function (e) {\n for (var id in this._eventParents) {\n this._eventParents[id].fire(e.type, extend({\n layer: e.target,\n propagatedFrom: e.target\n }, e), true);\n }\n }\n }; // aliases; we should ditch those eventually\n // @method addEventListener(…): this\n // Alias to [`on(…)`](#evented-on)\n\n Events.addEventListener = Events.on; // @method removeEventListener(…): this\n // Alias to [`off(…)`](#evented-off)\n // @method clearAllEventListeners(…): this\n // Alias to [`off()`](#evented-off)\n\n Events.removeEventListener = Events.clearAllEventListeners = Events.off; // @method addOneTimeEventListener(…): this\n // Alias to [`once(…)`](#evented-once)\n\n Events.addOneTimeEventListener = Events.once; // @method fireEvent(…): this\n // Alias to [`fire(…)`](#evented-fire)\n\n Events.fireEvent = Events.fire; // @method hasEventListeners(…): Boolean\n // Alias to [`listens(…)`](#evented-listens)\n\n Events.hasEventListeners = Events.listens;\n var Evented = Class.extend(Events);\n /*\r\n * @class Point\r\n * @aka L.Point\r\n *\r\n * Represents a point with `x` and `y` coordinates in pixels.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * var point = L.point(200, 300);\r\n * ```\r\n *\r\n * All Leaflet methods and options that accept `Point` objects also accept them in a simple Array form (unless noted otherwise), so these lines are equivalent:\r\n *\r\n * ```js\r\n * map.panBy([200, 300]);\r\n * map.panBy(L.point(200, 300));\r\n * ```\r\n *\r\n * Note that `Point` does not inherit from Leafet's `Class` object,\r\n * which means new classes can't inherit from it, and new methods\r\n * can't be added to it with the `include` function.\r\n */\n\n function Point(x, y, round) {\n // @property x: Number; The `x` coordinate of the point\n this.x = round ? Math.round(x) : x; // @property y: Number; The `y` coordinate of the point\n\n this.y = round ? Math.round(y) : y;\n }\n\n var trunc = Math.trunc || function (v) {\n return v > 0 ? Math.floor(v) : Math.ceil(v);\n };\n\n Point.prototype = {\n // @method clone(): Point\n // Returns a copy of the current point.\n clone: function () {\n return new Point(this.x, this.y);\n },\n // @method add(otherPoint: Point): Point\n // Returns the result of addition of the current and the given points.\n add: function (point) {\n // non-destructive, returns a new point\n return this.clone()._add(toPoint(point));\n },\n _add: function (point) {\n // destructive, used directly for performance in situations where it's safe to modify existing point\n this.x += point.x;\n this.y += point.y;\n return this;\n },\n // @method subtract(otherPoint: Point): Point\n // Returns the result of subtraction of the given point from the current.\n subtract: function (point) {\n return this.clone()._subtract(toPoint(point));\n },\n _subtract: function (point) {\n this.x -= point.x;\n this.y -= point.y;\n return this;\n },\n // @method divideBy(num: Number): Point\n // Returns the result of division of the current point by the given number.\n divideBy: function (num) {\n return this.clone()._divideBy(num);\n },\n _divideBy: function (num) {\n this.x /= num;\n this.y /= num;\n return this;\n },\n // @method multiplyBy(num: Number): Point\n // Returns the result of multiplication of the current point by the given number.\n multiplyBy: function (num) {\n return this.clone()._multiplyBy(num);\n },\n _multiplyBy: function (num) {\n this.x *= num;\n this.y *= num;\n return this;\n },\n // @method scaleBy(scale: Point): Point\n // Multiply each coordinate of the current point by each coordinate of\n // `scale`. In linear algebra terms, multiply the point by the\n // [scaling matrix](https://en.wikipedia.org/wiki/Scaling_%28geometry%29#Matrix_representation)\n // defined by `scale`.\n scaleBy: function (point) {\n return new Point(this.x * point.x, this.y * point.y);\n },\n // @method unscaleBy(scale: Point): Point\n // Inverse of `scaleBy`. Divide each coordinate of the current point by\n // each coordinate of `scale`.\n unscaleBy: function (point) {\n return new Point(this.x / point.x, this.y / point.y);\n },\n // @method round(): Point\n // Returns a copy of the current point with rounded coordinates.\n round: function () {\n return this.clone()._round();\n },\n _round: function () {\n this.x = Math.round(this.x);\n this.y = Math.round(this.y);\n return this;\n },\n // @method floor(): Point\n // Returns a copy of the current point with floored coordinates (rounded down).\n floor: function () {\n return this.clone()._floor();\n },\n _floor: function () {\n this.x = Math.floor(this.x);\n this.y = Math.floor(this.y);\n return this;\n },\n // @method ceil(): Point\n // Returns a copy of the current point with ceiled coordinates (rounded up).\n ceil: function () {\n return this.clone()._ceil();\n },\n _ceil: function () {\n this.x = Math.ceil(this.x);\n this.y = Math.ceil(this.y);\n return this;\n },\n // @method trunc(): Point\n // Returns a copy of the current point with truncated coordinates (rounded towards zero).\n trunc: function () {\n return this.clone()._trunc();\n },\n _trunc: function () {\n this.x = trunc(this.x);\n this.y = trunc(this.y);\n return this;\n },\n // @method distanceTo(otherPoint: Point): Number\n // Returns the cartesian distance between the current and the given points.\n distanceTo: function (point) {\n point = toPoint(point);\n var x = point.x - this.x,\n y = point.y - this.y;\n return Math.sqrt(x * x + y * y);\n },\n // @method equals(otherPoint: Point): Boolean\n // Returns `true` if the given point has the same coordinates.\n equals: function (point) {\n point = toPoint(point);\n return point.x === this.x && point.y === this.y;\n },\n // @method contains(otherPoint: Point): Boolean\n // Returns `true` if both coordinates of the given point are less than the corresponding current point coordinates (in absolute values).\n contains: function (point) {\n point = toPoint(point);\n return Math.abs(point.x) <= Math.abs(this.x) && Math.abs(point.y) <= Math.abs(this.y);\n },\n // @method toString(): String\n // Returns a string representation of the point for debugging purposes.\n toString: function () {\n return 'Point(' + formatNum(this.x) + ', ' + formatNum(this.y) + ')';\n }\n }; // @factory L.point(x: Number, y: Number, round?: Boolean)\n // Creates a Point object with the given `x` and `y` coordinates. If optional `round` is set to true, rounds the `x` and `y` values.\n // @alternative\n // @factory L.point(coords: Number[])\n // Expects an array of the form `[x, y]` instead.\n // @alternative\n // @factory L.point(coords: Object)\n // Expects a plain object of the form `{x: Number, y: Number}` instead.\n\n function toPoint(x, y, round) {\n if (x instanceof Point) {\n return x;\n }\n\n if (isArray(x)) {\n return new Point(x[0], x[1]);\n }\n\n if (x === undefined || x === null) {\n return x;\n }\n\n if (typeof x === 'object' && 'x' in x && 'y' in x) {\n return new Point(x.x, x.y);\n }\n\n return new Point(x, y, round);\n }\n /*\r\n * @class Bounds\r\n * @aka L.Bounds\r\n *\r\n * Represents a rectangular area in pixel coordinates.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * var p1 = L.point(10, 10),\r\n * p2 = L.point(40, 60),\r\n * bounds = L.bounds(p1, p2);\r\n * ```\r\n *\r\n * All Leaflet methods that accept `Bounds` objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this:\r\n *\r\n * ```js\r\n * otherBounds.intersects([[10, 10], [40, 60]]);\r\n * ```\r\n *\r\n * Note that `Bounds` does not inherit from Leafet's `Class` object,\r\n * which means new classes can't inherit from it, and new methods\r\n * can't be added to it with the `include` function.\r\n */\n\n\n function Bounds(a, b) {\n if (!a) {\n return;\n }\n\n var points = b ? [a, b] : a;\n\n for (var i = 0, len = points.length; i < len; i++) {\n this.extend(points[i]);\n }\n }\n\n Bounds.prototype = {\n // @method extend(point: Point): this\n // Extends the bounds to contain the given point.\n extend: function (point) {\n // (Point)\n point = toPoint(point); // @property min: Point\n // The top left corner of the rectangle.\n // @property max: Point\n // The bottom right corner of the rectangle.\n\n if (!this.min && !this.max) {\n this.min = point.clone();\n this.max = point.clone();\n } else {\n this.min.x = Math.min(point.x, this.min.x);\n this.max.x = Math.max(point.x, this.max.x);\n this.min.y = Math.min(point.y, this.min.y);\n this.max.y = Math.max(point.y, this.max.y);\n }\n\n return this;\n },\n // @method getCenter(round?: Boolean): Point\n // Returns the center point of the bounds.\n getCenter: function (round) {\n return new Point((this.min.x + this.max.x) / 2, (this.min.y + this.max.y) / 2, round);\n },\n // @method getBottomLeft(): Point\n // Returns the bottom-left point of the bounds.\n getBottomLeft: function () {\n return new Point(this.min.x, this.max.y);\n },\n // @method getTopRight(): Point\n // Returns the top-right point of the bounds.\n getTopRight: function () {\n // -> Point\n return new Point(this.max.x, this.min.y);\n },\n // @method getTopLeft(): Point\n // Returns the top-left point of the bounds (i.e. [`this.min`](#bounds-min)).\n getTopLeft: function () {\n return this.min; // left, top\n },\n // @method getBottomRight(): Point\n // Returns the bottom-right point of the bounds (i.e. [`this.max`](#bounds-max)).\n getBottomRight: function () {\n return this.max; // right, bottom\n },\n // @method getSize(): Point\n // Returns the size of the given bounds\n getSize: function () {\n return this.max.subtract(this.min);\n },\n // @method contains(otherBounds: Bounds): Boolean\n // Returns `true` if the rectangle contains the given one.\n // @alternative\n // @method contains(point: Point): Boolean\n // Returns `true` if the rectangle contains the given point.\n contains: function (obj) {\n var min, max;\n\n if (typeof obj[0] === 'number' || obj instanceof Point) {\n obj = toPoint(obj);\n } else {\n obj = toBounds(obj);\n }\n\n if (obj instanceof Bounds) {\n min = obj.min;\n max = obj.max;\n } else {\n min = max = obj;\n }\n\n return min.x >= this.min.x && max.x <= this.max.x && min.y >= this.min.y && max.y <= this.max.y;\n },\n // @method intersects(otherBounds: Bounds): Boolean\n // Returns `true` if the rectangle intersects the given bounds. Two bounds\n // intersect if they have at least one point in common.\n intersects: function (bounds) {\n // (Bounds) -> Boolean\n bounds = toBounds(bounds);\n var min = this.min,\n max = this.max,\n min2 = bounds.min,\n max2 = bounds.max,\n xIntersects = max2.x >= min.x && min2.x <= max.x,\n yIntersects = max2.y >= min.y && min2.y <= max.y;\n return xIntersects && yIntersects;\n },\n // @method overlaps(otherBounds: Bounds): Boolean\n // Returns `true` if the rectangle overlaps the given bounds. Two bounds\n // overlap if their intersection is an area.\n overlaps: function (bounds) {\n // (Bounds) -> Boolean\n bounds = toBounds(bounds);\n var min = this.min,\n max = this.max,\n min2 = bounds.min,\n max2 = bounds.max,\n xOverlaps = max2.x > min.x && min2.x < max.x,\n yOverlaps = max2.y > min.y && min2.y < max.y;\n return xOverlaps && yOverlaps;\n },\n isValid: function () {\n return !!(this.min && this.max);\n }\n }; // @factory L.bounds(corner1: Point, corner2: Point)\n // Creates a Bounds object from two corners coordinate pairs.\n // @alternative\n // @factory L.bounds(points: Point[])\n // Creates a Bounds object from the given array of points.\n\n function toBounds(a, b) {\n if (!a || a instanceof Bounds) {\n return a;\n }\n\n return new Bounds(a, b);\n }\n /*\r\n * @class LatLngBounds\r\n * @aka L.LatLngBounds\r\n *\r\n * Represents a rectangular geographical area on a map.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * var corner1 = L.latLng(40.712, -74.227),\r\n * corner2 = L.latLng(40.774, -74.125),\r\n * bounds = L.latLngBounds(corner1, corner2);\r\n * ```\r\n *\r\n * All Leaflet methods that accept LatLngBounds objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this:\r\n *\r\n * ```js\r\n * map.fitBounds([\r\n * \t[40.712, -74.227],\r\n * \t[40.774, -74.125]\r\n * ]);\r\n * ```\r\n *\r\n * Caution: if the area crosses the antimeridian (often confused with the International Date Line), you must specify corners _outside_ the [-180, 180] degrees longitude range.\r\n *\r\n * Note that `LatLngBounds` does not inherit from Leafet's `Class` object,\r\n * which means new classes can't inherit from it, and new methods\r\n * can't be added to it with the `include` function.\r\n */\n\n\n function LatLngBounds(corner1, corner2) {\n // (LatLng, LatLng) or (LatLng[])\n if (!corner1) {\n return;\n }\n\n var latlngs = corner2 ? [corner1, corner2] : corner1;\n\n for (var i = 0, len = latlngs.length; i < len; i++) {\n this.extend(latlngs[i]);\n }\n }\n\n LatLngBounds.prototype = {\n // @method extend(latlng: LatLng): this\n // Extend the bounds to contain the given point\n // @alternative\n // @method extend(otherBounds: LatLngBounds): this\n // Extend the bounds to contain the given bounds\n extend: function (obj) {\n var sw = this._southWest,\n ne = this._northEast,\n sw2,\n ne2;\n\n if (obj instanceof LatLng) {\n sw2 = obj;\n ne2 = obj;\n } else if (obj instanceof LatLngBounds) {\n sw2 = obj._southWest;\n ne2 = obj._northEast;\n\n if (!sw2 || !ne2) {\n return this;\n }\n } else {\n return obj ? this.extend(toLatLng(obj) || toLatLngBounds(obj)) : this;\n }\n\n if (!sw && !ne) {\n this._southWest = new LatLng(sw2.lat, sw2.lng);\n this._northEast = new LatLng(ne2.lat, ne2.lng);\n } else {\n sw.lat = Math.min(sw2.lat, sw.lat);\n sw.lng = Math.min(sw2.lng, sw.lng);\n ne.lat = Math.max(ne2.lat, ne.lat);\n ne.lng = Math.max(ne2.lng, ne.lng);\n }\n\n return this;\n },\n // @method pad(bufferRatio: Number): LatLngBounds\n // Returns bounds created by extending or retracting the current bounds by a given ratio in each direction.\n // For example, a ratio of 0.5 extends the bounds by 50% in each direction.\n // Negative values will retract the bounds.\n pad: function (bufferRatio) {\n var sw = this._southWest,\n ne = this._northEast,\n heightBuffer = Math.abs(sw.lat - ne.lat) * bufferRatio,\n widthBuffer = Math.abs(sw.lng - ne.lng) * bufferRatio;\n return new LatLngBounds(new LatLng(sw.lat - heightBuffer, sw.lng - widthBuffer), new LatLng(ne.lat + heightBuffer, ne.lng + widthBuffer));\n },\n // @method getCenter(): LatLng\n // Returns the center point of the bounds.\n getCenter: function () {\n return new LatLng((this._southWest.lat + this._northEast.lat) / 2, (this._southWest.lng + this._northEast.lng) / 2);\n },\n // @method getSouthWest(): LatLng\n // Returns the south-west point of the bounds.\n getSouthWest: function () {\n return this._southWest;\n },\n // @method getNorthEast(): LatLng\n // Returns the north-east point of the bounds.\n getNorthEast: function () {\n return this._northEast;\n },\n // @method getNorthWest(): LatLng\n // Returns the north-west point of the bounds.\n getNorthWest: function () {\n return new LatLng(this.getNorth(), this.getWest());\n },\n // @method getSouthEast(): LatLng\n // Returns the south-east point of the bounds.\n getSouthEast: function () {\n return new LatLng(this.getSouth(), this.getEast());\n },\n // @method getWest(): Number\n // Returns the west longitude of the bounds\n getWest: function () {\n return this._southWest.lng;\n },\n // @method getSouth(): Number\n // Returns the south latitude of the bounds\n getSouth: function () {\n return this._southWest.lat;\n },\n // @method getEast(): Number\n // Returns the east longitude of the bounds\n getEast: function () {\n return this._northEast.lng;\n },\n // @method getNorth(): Number\n // Returns the north latitude of the bounds\n getNorth: function () {\n return this._northEast.lat;\n },\n // @method contains(otherBounds: LatLngBounds): Boolean\n // Returns `true` if the rectangle contains the given one.\n // @alternative\n // @method contains (latlng: LatLng): Boolean\n // Returns `true` if the rectangle contains the given point.\n contains: function (obj) {\n // (LatLngBounds) or (LatLng) -> Boolean\n if (typeof obj[0] === 'number' || obj instanceof LatLng || 'lat' in obj) {\n obj = toLatLng(obj);\n } else {\n obj = toLatLngBounds(obj);\n }\n\n var sw = this._southWest,\n ne = this._northEast,\n sw2,\n ne2;\n\n if (obj instanceof LatLngBounds) {\n sw2 = obj.getSouthWest();\n ne2 = obj.getNorthEast();\n } else {\n sw2 = ne2 = obj;\n }\n\n return sw2.lat >= sw.lat && ne2.lat <= ne.lat && sw2.lng >= sw.lng && ne2.lng <= ne.lng;\n },\n // @method intersects(otherBounds: LatLngBounds): Boolean\n // Returns `true` if the rectangle intersects the given bounds. Two bounds intersect if they have at least one point in common.\n intersects: function (bounds) {\n bounds = toLatLngBounds(bounds);\n var sw = this._southWest,\n ne = this._northEast,\n sw2 = bounds.getSouthWest(),\n ne2 = bounds.getNorthEast(),\n latIntersects = ne2.lat >= sw.lat && sw2.lat <= ne.lat,\n lngIntersects = ne2.lng >= sw.lng && sw2.lng <= ne.lng;\n return latIntersects && lngIntersects;\n },\n // @method overlaps(otherBounds: Bounds): Boolean\n // Returns `true` if the rectangle overlaps the given bounds. Two bounds overlap if their intersection is an area.\n overlaps: function (bounds) {\n bounds = toLatLngBounds(bounds);\n var sw = this._southWest,\n ne = this._northEast,\n sw2 = bounds.getSouthWest(),\n ne2 = bounds.getNorthEast(),\n latOverlaps = ne2.lat > sw.lat && sw2.lat < ne.lat,\n lngOverlaps = ne2.lng > sw.lng && sw2.lng < ne.lng;\n return latOverlaps && lngOverlaps;\n },\n // @method toBBoxString(): String\n // Returns a string with bounding box coordinates in a 'southwest_lng,southwest_lat,northeast_lng,northeast_lat' format. Useful for sending requests to web services that return geo data.\n toBBoxString: function () {\n return [this.getWest(), this.getSouth(), this.getEast(), this.getNorth()].join(',');\n },\n // @method equals(otherBounds: LatLngBounds, maxMargin?: Number): Boolean\n // Returns `true` if the rectangle is equivalent (within a small margin of error) to the given bounds. The margin of error can be overridden by setting `maxMargin` to a small number.\n equals: function (bounds, maxMargin) {\n if (!bounds) {\n return false;\n }\n\n bounds = toLatLngBounds(bounds);\n return this._southWest.equals(bounds.getSouthWest(), maxMargin) && this._northEast.equals(bounds.getNorthEast(), maxMargin);\n },\n // @method isValid(): Boolean\n // Returns `true` if the bounds are properly initialized.\n isValid: function () {\n return !!(this._southWest && this._northEast);\n }\n }; // TODO International date line?\n // @factory L.latLngBounds(corner1: LatLng, corner2: LatLng)\n // Creates a `LatLngBounds` object by defining two diagonally opposite corners of the rectangle.\n // @alternative\n // @factory L.latLngBounds(latlngs: LatLng[])\n // Creates a `LatLngBounds` object defined by the geographical points it contains. Very useful for zooming the map to fit a particular set of locations with [`fitBounds`](#map-fitbounds).\n\n function toLatLngBounds(a, b) {\n if (a instanceof LatLngBounds) {\n return a;\n }\n\n return new LatLngBounds(a, b);\n }\n /* @class LatLng\r\n * @aka L.LatLng\r\n *\r\n * Represents a geographical point with a certain latitude and longitude.\r\n *\r\n * @example\r\n *\r\n * ```\r\n * var latlng = L.latLng(50.5, 30.5);\r\n * ```\r\n *\r\n * All Leaflet methods that accept LatLng objects also accept them in a simple Array form and simple object form (unless noted otherwise), so these lines are equivalent:\r\n *\r\n * ```\r\n * map.panTo([50, 30]);\r\n * map.panTo({lon: 30, lat: 50});\r\n * map.panTo({lat: 50, lng: 30});\r\n * map.panTo(L.latLng(50, 30));\r\n * ```\r\n *\r\n * Note that `LatLng` does not inherit from Leaflet's `Class` object,\r\n * which means new classes can't inherit from it, and new methods\r\n * can't be added to it with the `include` function.\r\n */\n\n\n function LatLng(lat, lng, alt) {\n if (isNaN(lat) || isNaN(lng)) {\n throw new Error('Invalid LatLng object: (' + lat + ', ' + lng + ')');\n } // @property lat: Number\n // Latitude in degrees\n\n\n this.lat = +lat; // @property lng: Number\n // Longitude in degrees\n\n this.lng = +lng; // @property alt: Number\n // Altitude in meters (optional)\n\n if (alt !== undefined) {\n this.alt = +alt;\n }\n }\n\n LatLng.prototype = {\n // @method equals(otherLatLng: LatLng, maxMargin?: Number): Boolean\n // Returns `true` if the given `LatLng` point is at the same position (within a small margin of error). The margin of error can be overridden by setting `maxMargin` to a small number.\n equals: function (obj, maxMargin) {\n if (!obj) {\n return false;\n }\n\n obj = toLatLng(obj);\n var margin = Math.max(Math.abs(this.lat - obj.lat), Math.abs(this.lng - obj.lng));\n return margin <= (maxMargin === undefined ? 1.0E-9 : maxMargin);\n },\n // @method toString(): String\n // Returns a string representation of the point (for debugging purposes).\n toString: function (precision) {\n return 'LatLng(' + formatNum(this.lat, precision) + ', ' + formatNum(this.lng, precision) + ')';\n },\n // @method distanceTo(otherLatLng: LatLng): Number\n // Returns the distance (in meters) to the given `LatLng` calculated using the [Spherical Law of Cosines](https://en.wikipedia.org/wiki/Spherical_law_of_cosines).\n distanceTo: function (other) {\n return Earth.distance(this, toLatLng(other));\n },\n // @method wrap(): LatLng\n // Returns a new `LatLng` object with the longitude wrapped so it's always between -180 and +180 degrees.\n wrap: function () {\n return Earth.wrapLatLng(this);\n },\n // @method toBounds(sizeInMeters: Number): LatLngBounds\n // Returns a new `LatLngBounds` object in which each boundary is `sizeInMeters/2` meters apart from the `LatLng`.\n toBounds: function (sizeInMeters) {\n var latAccuracy = 180 * sizeInMeters / 40075017,\n lngAccuracy = latAccuracy / Math.cos(Math.PI / 180 * this.lat);\n return toLatLngBounds([this.lat - latAccuracy, this.lng - lngAccuracy], [this.lat + latAccuracy, this.lng + lngAccuracy]);\n },\n clone: function () {\n return new LatLng(this.lat, this.lng, this.alt);\n }\n }; // @factory L.latLng(latitude: Number, longitude: Number, altitude?: Number): LatLng\n // Creates an object representing a geographical point with the given latitude and longitude (and optionally altitude).\n // @alternative\n // @factory L.latLng(coords: Array): LatLng\n // Expects an array of the form `[Number, Number]` or `[Number, Number, Number]` instead.\n // @alternative\n // @factory L.latLng(coords: Object): LatLng\n // Expects an plain object of the form `{lat: Number, lng: Number}` or `{lat: Number, lng: Number, alt: Number}` instead.\n\n function toLatLng(a, b, c) {\n if (a instanceof LatLng) {\n return a;\n }\n\n if (isArray(a) && typeof a[0] !== 'object') {\n if (a.length === 3) {\n return new LatLng(a[0], a[1], a[2]);\n }\n\n if (a.length === 2) {\n return new LatLng(a[0], a[1]);\n }\n\n return null;\n }\n\n if (a === undefined || a === null) {\n return a;\n }\n\n if (typeof a === 'object' && 'lat' in a) {\n return new LatLng(a.lat, 'lng' in a ? a.lng : a.lon, a.alt);\n }\n\n if (b === undefined) {\n return null;\n }\n\n return new LatLng(a, b, c);\n }\n /*\r\n * @namespace CRS\r\n * @crs L.CRS.Base\r\n * Object that defines coordinate reference systems for projecting\r\n * geographical points into pixel (screen) coordinates and back (and to\r\n * coordinates in other units for [WMS](https://en.wikipedia.org/wiki/Web_Map_Service) services). See\r\n * [spatial reference system](http://en.wikipedia.org/wiki/Coordinate_reference_system).\r\n *\r\n * Leaflet defines the most usual CRSs by default. If you want to use a\r\n * CRS not defined by default, take a look at the\r\n * [Proj4Leaflet](https://github.com/kartena/Proj4Leaflet) plugin.\r\n *\r\n * Note that the CRS instances do not inherit from Leafet's `Class` object,\r\n * and can't be instantiated. Also, new classes can't inherit from them,\r\n * and methods can't be added to them with the `include` function.\r\n */\n\n\n var CRS = {\n // @method latLngToPoint(latlng: LatLng, zoom: Number): Point\n // Projects geographical coordinates into pixel coordinates for a given zoom.\n latLngToPoint: function (latlng, zoom) {\n var projectedPoint = this.projection.project(latlng),\n scale = this.scale(zoom);\n return this.transformation._transform(projectedPoint, scale);\n },\n // @method pointToLatLng(point: Point, zoom: Number): LatLng\n // The inverse of `latLngToPoint`. Projects pixel coordinates on a given\n // zoom into geographical coordinates.\n pointToLatLng: function (point, zoom) {\n var scale = this.scale(zoom),\n untransformedPoint = this.transformation.untransform(point, scale);\n return this.projection.unproject(untransformedPoint);\n },\n // @method project(latlng: LatLng): Point\n // Projects geographical coordinates into coordinates in units accepted for\n // this CRS (e.g. meters for EPSG:3857, for passing it to WMS services).\n project: function (latlng) {\n return this.projection.project(latlng);\n },\n // @method unproject(point: Point): LatLng\n // Given a projected coordinate returns the corresponding LatLng.\n // The inverse of `project`.\n unproject: function (point) {\n return this.projection.unproject(point);\n },\n // @method scale(zoom: Number): Number\n // Returns the scale used when transforming projected coordinates into\n // pixel coordinates for a particular zoom. For example, it returns\n // `256 * 2^zoom` for Mercator-based CRS.\n scale: function (zoom) {\n return 256 * Math.pow(2, zoom);\n },\n // @method zoom(scale: Number): Number\n // Inverse of `scale()`, returns the zoom level corresponding to a scale\n // factor of `scale`.\n zoom: function (scale) {\n return Math.log(scale / 256) / Math.LN2;\n },\n // @method getProjectedBounds(zoom: Number): Bounds\n // Returns the projection's bounds scaled and transformed for the provided `zoom`.\n getProjectedBounds: function (zoom) {\n if (this.infinite) {\n return null;\n }\n\n var b = this.projection.bounds,\n s = this.scale(zoom),\n min = this.transformation.transform(b.min, s),\n max = this.transformation.transform(b.max, s);\n return new Bounds(min, max);\n },\n // @method distance(latlng1: LatLng, latlng2: LatLng): Number\n // Returns the distance between two geographical coordinates.\n // @property code: String\n // Standard code name of the CRS passed into WMS services (e.g. `'EPSG:3857'`)\n //\n // @property wrapLng: Number[]\n // An array of two numbers defining whether the longitude (horizontal) coordinate\n // axis wraps around a given range and how. Defaults to `[-180, 180]` in most\n // geographical CRSs. If `undefined`, the longitude axis does not wrap around.\n //\n // @property wrapLat: Number[]\n // Like `wrapLng`, but for the latitude (vertical) axis.\n // wrapLng: [min, max],\n // wrapLat: [min, max],\n // @property infinite: Boolean\n // If true, the coordinate space will be unbounded (infinite in both axes)\n infinite: false,\n // @method wrapLatLng(latlng: LatLng): LatLng\n // Returns a `LatLng` where lat and lng has been wrapped according to the\n // CRS's `wrapLat` and `wrapLng` properties, if they are outside the CRS's bounds.\n wrapLatLng: function (latlng) {\n var lng = this.wrapLng ? wrapNum(latlng.lng, this.wrapLng, true) : latlng.lng,\n lat = this.wrapLat ? wrapNum(latlng.lat, this.wrapLat, true) : latlng.lat,\n alt = latlng.alt;\n return new LatLng(lat, lng, alt);\n },\n // @method wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds\n // Returns a `LatLngBounds` with the same size as the given one, ensuring\n // that its center is within the CRS's bounds.\n // Only accepts actual `L.LatLngBounds` instances, not arrays.\n wrapLatLngBounds: function (bounds) {\n var center = bounds.getCenter(),\n newCenter = this.wrapLatLng(center),\n latShift = center.lat - newCenter.lat,\n lngShift = center.lng - newCenter.lng;\n\n if (latShift === 0 && lngShift === 0) {\n return bounds;\n }\n\n var sw = bounds.getSouthWest(),\n ne = bounds.getNorthEast(),\n newSw = new LatLng(sw.lat - latShift, sw.lng - lngShift),\n newNe = new LatLng(ne.lat - latShift, ne.lng - lngShift);\n return new LatLngBounds(newSw, newNe);\n }\n };\n /*\n * @namespace CRS\n * @crs L.CRS.Earth\n *\n * Serves as the base for CRS that are global such that they cover the earth.\n * Can only be used as the base for other CRS and cannot be used directly,\n * since it does not have a `code`, `projection` or `transformation`. `distance()` returns\n * meters.\n */\n\n var Earth = extend({}, CRS, {\n wrapLng: [-180, 180],\n // Mean Earth Radius, as recommended for use by\n // the International Union of Geodesy and Geophysics,\n // see http://rosettacode.org/wiki/Haversine_formula\n R: 6371000,\n // distance between two geographical points using spherical law of cosines approximation\n distance: function (latlng1, latlng2) {\n var rad = Math.PI / 180,\n lat1 = latlng1.lat * rad,\n lat2 = latlng2.lat * rad,\n sinDLat = Math.sin((latlng2.lat - latlng1.lat) * rad / 2),\n sinDLon = Math.sin((latlng2.lng - latlng1.lng) * rad / 2),\n a = sinDLat * sinDLat + Math.cos(lat1) * Math.cos(lat2) * sinDLon * sinDLon,\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n return this.R * c;\n }\n });\n /*\r\n * @namespace Projection\r\n * @projection L.Projection.SphericalMercator\r\n *\r\n * Spherical Mercator projection — the most common projection for online maps,\r\n * used by almost all free and commercial tile providers. Assumes that Earth is\r\n * a sphere. Used by the `EPSG:3857` CRS.\r\n */\n\n var SphericalMercator = {\n R: 6378137,\n MAX_LATITUDE: 85.0511287798,\n project: function (latlng) {\n var d = Math.PI / 180,\n max = this.MAX_LATITUDE,\n lat = Math.max(Math.min(max, latlng.lat), -max),\n sin = Math.sin(lat * d);\n return new Point(this.R * latlng.lng * d, this.R * Math.log((1 + sin) / (1 - sin)) / 2);\n },\n unproject: function (point) {\n var d = 180 / Math.PI;\n return new LatLng((2 * Math.atan(Math.exp(point.y / this.R)) - Math.PI / 2) * d, point.x * d / this.R);\n },\n bounds: function () {\n var d = 6378137 * Math.PI;\n return new Bounds([-d, -d], [d, d]);\n }()\n };\n /*\r\n * @class Transformation\r\n * @aka L.Transformation\r\n *\r\n * Represents an affine transformation: a set of coefficients `a`, `b`, `c`, `d`\r\n * for transforming a point of a form `(x, y)` into `(a*x + b, c*y + d)` and doing\r\n * the reverse. Used by Leaflet in its projections code.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * var transformation = L.transformation(2, 5, -1, 10),\r\n * \tp = L.point(1, 2),\r\n * \tp2 = transformation.transform(p), // L.point(7, 8)\r\n * \tp3 = transformation.untransform(p2); // L.point(1, 2)\r\n * ```\r\n */\n // factory new L.Transformation(a: Number, b: Number, c: Number, d: Number)\n // Creates a `Transformation` object with the given coefficients.\n\n function Transformation(a, b, c, d) {\n if (isArray(a)) {\n // use array properties\n this._a = a[0];\n this._b = a[1];\n this._c = a[2];\n this._d = a[3];\n return;\n }\n\n this._a = a;\n this._b = b;\n this._c = c;\n this._d = d;\n }\n\n Transformation.prototype = {\n // @method transform(point: Point, scale?: Number): Point\n // Returns a transformed point, optionally multiplied by the given scale.\n // Only accepts actual `L.Point` instances, not arrays.\n transform: function (point, scale) {\n // (Point, Number) -> Point\n return this._transform(point.clone(), scale);\n },\n // destructive transform (faster)\n _transform: function (point, scale) {\n scale = scale || 1;\n point.x = scale * (this._a * point.x + this._b);\n point.y = scale * (this._c * point.y + this._d);\n return point;\n },\n // @method untransform(point: Point, scale?: Number): Point\n // Returns the reverse transformation of the given point, optionally divided\n // by the given scale. Only accepts actual `L.Point` instances, not arrays.\n untransform: function (point, scale) {\n scale = scale || 1;\n return new Point((point.x / scale - this._b) / this._a, (point.y / scale - this._d) / this._c);\n }\n }; // factory L.transformation(a: Number, b: Number, c: Number, d: Number)\n // @factory L.transformation(a: Number, b: Number, c: Number, d: Number)\n // Instantiates a Transformation object with the given coefficients.\n // @alternative\n // @factory L.transformation(coefficients: Array): Transformation\n // Expects an coefficients array of the form\n // `[a: Number, b: Number, c: Number, d: Number]`.\n\n function toTransformation(a, b, c, d) {\n return new Transformation(a, b, c, d);\n }\n /*\r\n * @namespace CRS\r\n * @crs L.CRS.EPSG3857\r\n *\r\n * The most common CRS for online maps, used by almost all free and commercial\r\n * tile providers. Uses Spherical Mercator projection. Set in by default in\r\n * Map's `crs` option.\r\n */\n\n\n var EPSG3857 = extend({}, Earth, {\n code: 'EPSG:3857',\n projection: SphericalMercator,\n transformation: function () {\n var scale = 0.5 / (Math.PI * SphericalMercator.R);\n return toTransformation(scale, 0.5, -scale, 0.5);\n }()\n });\n var EPSG900913 = extend({}, EPSG3857, {\n code: 'EPSG:900913'\n }); // @namespace SVG; @section\n // There are several static functions which can be called without instantiating L.SVG:\n // @function create(name: String): SVGElement\n // Returns a instance of [SVGElement](https://developer.mozilla.org/docs/Web/API/SVGElement),\n // corresponding to the class name passed. For example, using 'line' will return\n // an instance of [SVGLineElement](https://developer.mozilla.org/docs/Web/API/SVGLineElement).\n\n function svgCreate(name) {\n return document.createElementNS('http://www.w3.org/2000/svg', name);\n } // @function pointsToPath(rings: Point[], closed: Boolean): String\n // Generates a SVG path string for multiple rings, with each ring turning\n // into \"M..L..L..\" instructions\n\n\n function pointsToPath(rings, closed) {\n var str = '',\n i,\n j,\n len,\n len2,\n points,\n p;\n\n for (i = 0, len = rings.length; i < len; i++) {\n points = rings[i];\n\n for (j = 0, len2 = points.length; j < len2; j++) {\n p = points[j];\n str += (j ? 'L' : 'M') + p.x + ' ' + p.y;\n } // closes the ring for polygons; \"x\" is VML syntax\n\n\n str += closed ? svg ? 'z' : 'x' : '';\n } // SVG complains about empty path strings\n\n\n return str || 'M0 0';\n }\n /*\r\n * @namespace Browser\r\n * @aka L.Browser\r\n *\r\n * A namespace with static properties for browser/feature detection used by Leaflet internally.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * if (L.Browser.ielt9) {\r\n * alert('Upgrade your browser, dude!');\r\n * }\r\n * ```\r\n */\n\n\n var style$1 = document.documentElement.style; // @property ie: Boolean; `true` for all Internet Explorer versions (not Edge).\n\n var ie = 'ActiveXObject' in window; // @property ielt9: Boolean; `true` for Internet Explorer versions less than 9.\n\n var ielt9 = ie && !document.addEventListener; // @property edge: Boolean; `true` for the Edge web browser.\n\n var edge = 'msLaunchUri' in navigator && !('documentMode' in document); // @property webkit: Boolean;\n // `true` for webkit-based browsers like Chrome and Safari (including mobile versions).\n\n var webkit = userAgentContains('webkit'); // @property android: Boolean\n // `true` for any browser running on an Android platform.\n\n var android = userAgentContains('android'); // @property android23: Boolean; `true` for browsers running on Android 2 or Android 3.\n\n var android23 = userAgentContains('android 2') || userAgentContains('android 3');\n /* See https://stackoverflow.com/a/17961266 for details on detecting stock Android */\n\n var webkitVer = parseInt(/WebKit\\/([0-9]+)|$/.exec(navigator.userAgent)[1], 10); // also matches AppleWebKit\n // @property androidStock: Boolean; `true` for the Android stock browser (i.e. not Chrome)\n\n var androidStock = android && userAgentContains('Google') && webkitVer < 537 && !('AudioNode' in window); // @property opera: Boolean; `true` for the Opera browser\n\n var opera = !!window.opera; // @property chrome: Boolean; `true` for the Chrome browser.\n\n var chrome = userAgentContains('chrome'); // @property gecko: Boolean; `true` for gecko-based browsers like Firefox.\n\n var gecko = userAgentContains('gecko') && !webkit && !opera && !ie; // @property safari: Boolean; `true` for the Safari browser.\n\n var safari = !chrome && userAgentContains('safari');\n var phantom = userAgentContains('phantom'); // @property opera12: Boolean\n // `true` for the Opera browser supporting CSS transforms (version 12 or later).\n\n var opera12 = 'OTransition' in style$1; // @property win: Boolean; `true` when the browser is running in a Windows platform\n\n var win = navigator.platform.indexOf('Win') === 0; // @property ie3d: Boolean; `true` for all Internet Explorer versions supporting CSS transforms.\n\n var ie3d = ie && 'transition' in style$1; // @property webkit3d: Boolean; `true` for webkit-based browsers supporting CSS transforms.\n\n var webkit3d = 'WebKitCSSMatrix' in window && 'm11' in new window.WebKitCSSMatrix() && !android23; // @property gecko3d: Boolean; `true` for gecko-based browsers supporting CSS transforms.\n\n var gecko3d = 'MozPerspective' in style$1; // @property any3d: Boolean\n // `true` for all browsers supporting CSS transforms.\n\n var any3d = !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d) && !opera12 && !phantom; // @property mobile: Boolean; `true` for all browsers running in a mobile device.\n\n var mobile = typeof orientation !== 'undefined' || userAgentContains('mobile'); // @property mobileWebkit: Boolean; `true` for all webkit-based browsers in a mobile device.\n\n var mobileWebkit = mobile && webkit; // @property mobileWebkit3d: Boolean\n // `true` for all webkit-based browsers in a mobile device supporting CSS transforms.\n\n var mobileWebkit3d = mobile && webkit3d; // @property msPointer: Boolean\n // `true` for browsers implementing the Microsoft touch events model (notably IE10).\n\n var msPointer = !window.PointerEvent && window.MSPointerEvent; // @property pointer: Boolean\n // `true` for all browsers supporting [pointer events](https://msdn.microsoft.com/en-us/library/dn433244%28v=vs.85%29.aspx).\n\n var pointer = !!(window.PointerEvent || msPointer); // @property touch: Boolean\n // `true` for all browsers supporting [touch events](https://developer.mozilla.org/docs/Web/API/Touch_events).\n // This does not necessarily mean that the browser is running in a computer with\n // a touchscreen, it only means that the browser is capable of understanding\n // touch events.\n\n var touch = !window.L_NO_TOUCH && (pointer || 'ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch); // @property mobileOpera: Boolean; `true` for the Opera browser in a mobile device.\n\n var mobileOpera = mobile && opera; // @property mobileGecko: Boolean\n // `true` for gecko-based browsers running in a mobile device.\n\n var mobileGecko = mobile && gecko; // @property retina: Boolean\n // `true` for browsers on a high-resolution \"retina\" screen or on any screen when browser's display zoom is more than 100%.\n\n var retina = (window.devicePixelRatio || window.screen.deviceXDPI / window.screen.logicalXDPI) > 1; // @property canvas: Boolean\n // `true` when the browser supports [``](https://developer.mozilla.org/docs/Web/API/Canvas_API).\n\n var canvas = function () {\n return !!document.createElement('canvas').getContext;\n }(); // @property svg: Boolean\n // `true` when the browser supports [SVG](https://developer.mozilla.org/docs/Web/SVG).\n\n\n var svg = !!(document.createElementNS && svgCreate('svg').createSVGRect); // @property vml: Boolean\n // `true` if the browser supports [VML](https://en.wikipedia.org/wiki/Vector_Markup_Language).\n\n var vml = !svg && function () {\n try {\n var div = document.createElement('div');\n div.innerHTML = '';\n var shape = div.firstChild;\n shape.style.behavior = 'url(#default#VML)';\n return shape && typeof shape.adj === 'object';\n } catch (e) {\n return false;\n }\n }();\n\n function userAgentContains(str) {\n return navigator.userAgent.toLowerCase().indexOf(str) >= 0;\n }\n\n var Browser = (Object.freeze || Object)({\n ie: ie,\n ielt9: ielt9,\n edge: edge,\n webkit: webkit,\n android: android,\n android23: android23,\n androidStock: androidStock,\n opera: opera,\n chrome: chrome,\n gecko: gecko,\n safari: safari,\n phantom: phantom,\n opera12: opera12,\n win: win,\n ie3d: ie3d,\n webkit3d: webkit3d,\n gecko3d: gecko3d,\n any3d: any3d,\n mobile: mobile,\n mobileWebkit: mobileWebkit,\n mobileWebkit3d: mobileWebkit3d,\n msPointer: msPointer,\n pointer: pointer,\n touch: touch,\n mobileOpera: mobileOpera,\n mobileGecko: mobileGecko,\n retina: retina,\n canvas: canvas,\n svg: svg,\n vml: vml\n });\n /*\n * Extends L.DomEvent to provide touch support for Internet Explorer and Windows-based devices.\n */\n\n var POINTER_DOWN = msPointer ? 'MSPointerDown' : 'pointerdown';\n var POINTER_MOVE = msPointer ? 'MSPointerMove' : 'pointermove';\n var POINTER_UP = msPointer ? 'MSPointerUp' : 'pointerup';\n var POINTER_CANCEL = msPointer ? 'MSPointerCancel' : 'pointercancel';\n var TAG_WHITE_LIST = ['INPUT', 'SELECT', 'OPTION'];\n var _pointers = {};\n var _pointerDocListener = false; // DomEvent.DoubleTap needs to know about this\n\n var _pointersCount = 0; // Provides a touch events wrapper for (ms)pointer events.\n // ref http://www.w3.org/TR/pointerevents/ https://www.w3.org/Bugs/Public/show_bug.cgi?id=22890\n\n function addPointerListener(obj, type, handler, id) {\n if (type === 'touchstart') {\n _addPointerStart(obj, handler, id);\n } else if (type === 'touchmove') {\n _addPointerMove(obj, handler, id);\n } else if (type === 'touchend') {\n _addPointerEnd(obj, handler, id);\n }\n\n return this;\n }\n\n function removePointerListener(obj, type, id) {\n var handler = obj['_leaflet_' + type + id];\n\n if (type === 'touchstart') {\n obj.removeEventListener(POINTER_DOWN, handler, false);\n } else if (type === 'touchmove') {\n obj.removeEventListener(POINTER_MOVE, handler, false);\n } else if (type === 'touchend') {\n obj.removeEventListener(POINTER_UP, handler, false);\n obj.removeEventListener(POINTER_CANCEL, handler, false);\n }\n\n return this;\n }\n\n function _addPointerStart(obj, handler, id) {\n var onDown = bind(function (e) {\n if (e.pointerType !== 'mouse' && e.MSPOINTER_TYPE_MOUSE && e.pointerType !== e.MSPOINTER_TYPE_MOUSE) {\n // In IE11, some touch events needs to fire for form controls, or\n // the controls will stop working. We keep a whitelist of tag names that\n // need these events. For other target tags, we prevent default on the event.\n if (TAG_WHITE_LIST.indexOf(e.target.tagName) < 0) {\n preventDefault(e);\n } else {\n return;\n }\n }\n\n _handlePointer(e, handler);\n });\n obj['_leaflet_touchstart' + id] = onDown;\n obj.addEventListener(POINTER_DOWN, onDown, false); // need to keep track of what pointers and how many are active to provide e.touches emulation\n\n if (!_pointerDocListener) {\n // we listen documentElement as any drags that end by moving the touch off the screen get fired there\n document.documentElement.addEventListener(POINTER_DOWN, _globalPointerDown, true);\n document.documentElement.addEventListener(POINTER_MOVE, _globalPointerMove, true);\n document.documentElement.addEventListener(POINTER_UP, _globalPointerUp, true);\n document.documentElement.addEventListener(POINTER_CANCEL, _globalPointerUp, true);\n _pointerDocListener = true;\n }\n }\n\n function _globalPointerDown(e) {\n _pointers[e.pointerId] = e;\n _pointersCount++;\n }\n\n function _globalPointerMove(e) {\n if (_pointers[e.pointerId]) {\n _pointers[e.pointerId] = e;\n }\n }\n\n function _globalPointerUp(e) {\n delete _pointers[e.pointerId];\n _pointersCount--;\n }\n\n function _handlePointer(e, handler) {\n e.touches = [];\n\n for (var i in _pointers) {\n e.touches.push(_pointers[i]);\n }\n\n e.changedTouches = [e];\n handler(e);\n }\n\n function _addPointerMove(obj, handler, id) {\n var onMove = function (e) {\n // don't fire touch moves when mouse isn't down\n if ((e.pointerType === e.MSPOINTER_TYPE_MOUSE || e.pointerType === 'mouse') && e.buttons === 0) {\n return;\n }\n\n _handlePointer(e, handler);\n };\n\n obj['_leaflet_touchmove' + id] = onMove;\n obj.addEventListener(POINTER_MOVE, onMove, false);\n }\n\n function _addPointerEnd(obj, handler, id) {\n var onUp = function (e) {\n _handlePointer(e, handler);\n };\n\n obj['_leaflet_touchend' + id] = onUp;\n obj.addEventListener(POINTER_UP, onUp, false);\n obj.addEventListener(POINTER_CANCEL, onUp, false);\n }\n /*\r\n * Extends the event handling code with double tap support for mobile browsers.\r\n */\n\n\n var _touchstart = msPointer ? 'MSPointerDown' : pointer ? 'pointerdown' : 'touchstart';\n\n var _touchend = msPointer ? 'MSPointerUp' : pointer ? 'pointerup' : 'touchend';\n\n var _pre = '_leaflet_'; // inspired by Zepto touch code by Thomas Fuchs\n\n function addDoubleTapListener(obj, handler, id) {\n var last,\n touch$$1,\n doubleTap = false,\n delay = 250;\n\n function onTouchStart(e) {\n var count;\n\n if (pointer) {\n if (!edge || e.pointerType === 'mouse') {\n return;\n }\n\n count = _pointersCount;\n } else {\n count = e.touches.length;\n }\n\n if (count > 1) {\n return;\n }\n\n var now = Date.now(),\n delta = now - (last || now);\n touch$$1 = e.touches ? e.touches[0] : e;\n doubleTap = delta > 0 && delta <= delay;\n last = now;\n }\n\n function onTouchEnd(e) {\n if (doubleTap && !touch$$1.cancelBubble) {\n if (pointer) {\n if (!edge || e.pointerType === 'mouse') {\n return;\n } // work around .type being readonly with MSPointer* events\n\n\n var newTouch = {},\n prop,\n i;\n\n for (i in touch$$1) {\n prop = touch$$1[i];\n newTouch[i] = prop && prop.bind ? prop.bind(touch$$1) : prop;\n }\n\n touch$$1 = newTouch;\n }\n\n touch$$1.type = 'dblclick';\n handler(touch$$1);\n last = null;\n }\n }\n\n obj[_pre + _touchstart + id] = onTouchStart;\n obj[_pre + _touchend + id] = onTouchEnd;\n obj[_pre + 'dblclick' + id] = handler;\n obj.addEventListener(_touchstart, onTouchStart, false);\n obj.addEventListener(_touchend, onTouchEnd, false); // On some platforms (notably, chrome<55 on win10 + touchscreen + mouse),\n // the browser doesn't fire touchend/pointerup events but does fire\n // native dblclicks. See #4127.\n // Edge 14 also fires native dblclicks, but only for pointerType mouse, see #5180.\n\n obj.addEventListener('dblclick', handler, false);\n return this;\n }\n\n function removeDoubleTapListener(obj, id) {\n var touchstart = obj[_pre + _touchstart + id],\n touchend = obj[_pre + _touchend + id],\n dblclick = obj[_pre + 'dblclick' + id];\n obj.removeEventListener(_touchstart, touchstart, false);\n obj.removeEventListener(_touchend, touchend, false);\n\n if (!edge) {\n obj.removeEventListener('dblclick', dblclick, false);\n }\n\n return this;\n }\n /*\r\n * @namespace DomUtil\r\n *\r\n * Utility functions to work with the [DOM](https://developer.mozilla.org/docs/Web/API/Document_Object_Model)\r\n * tree, used by Leaflet internally.\r\n *\r\n * Most functions expecting or returning a `HTMLElement` also work for\r\n * SVG elements. The only difference is that classes refer to CSS classes\r\n * in HTML and SVG classes in SVG.\r\n */\n // @property TRANSFORM: String\n // Vendor-prefixed transform style name (e.g. `'webkitTransform'` for WebKit).\n\n\n var TRANSFORM = testProp(['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform']); // webkitTransition comes first because some browser versions that drop vendor prefix don't do\n // the same for the transitionend event, in particular the Android 4.1 stock browser\n // @property TRANSITION: String\n // Vendor-prefixed transition style name.\n\n var TRANSITION = testProp(['webkitTransition', 'transition', 'OTransition', 'MozTransition', 'msTransition']); // @property TRANSITION_END: String\n // Vendor-prefixed transitionend event name.\n\n var TRANSITION_END = TRANSITION === 'webkitTransition' || TRANSITION === 'OTransition' ? TRANSITION + 'End' : 'transitionend'; // @function get(id: String|HTMLElement): HTMLElement\n // Returns an element given its DOM id, or returns the element itself\n // if it was passed directly.\n\n function get(id) {\n return typeof id === 'string' ? document.getElementById(id) : id;\n } // @function getStyle(el: HTMLElement, styleAttrib: String): String\n // Returns the value for a certain style attribute on an element,\n // including computed values or values set through CSS.\n\n\n function getStyle(el, style) {\n var value = el.style[style] || el.currentStyle && el.currentStyle[style];\n\n if ((!value || value === 'auto') && document.defaultView) {\n var css = document.defaultView.getComputedStyle(el, null);\n value = css ? css[style] : null;\n }\n\n return value === 'auto' ? null : value;\n } // @function create(tagName: String, className?: String, container?: HTMLElement): HTMLElement\n // Creates an HTML element with `tagName`, sets its class to `className`, and optionally appends it to `container` element.\n\n\n function create$1(tagName, className, container) {\n var el = document.createElement(tagName);\n el.className = className || '';\n\n if (container) {\n container.appendChild(el);\n }\n\n return el;\n } // @function remove(el: HTMLElement)\n // Removes `el` from its parent element\n\n\n function remove(el) {\n var parent = el.parentNode;\n\n if (parent) {\n parent.removeChild(el);\n }\n } // @function empty(el: HTMLElement)\n // Removes all of `el`'s children elements from `el`\n\n\n function empty(el) {\n while (el.firstChild) {\n el.removeChild(el.firstChild);\n }\n } // @function toFront(el: HTMLElement)\n // Makes `el` the last child of its parent, so it renders in front of the other children.\n\n\n function toFront(el) {\n var parent = el.parentNode;\n\n if (parent && parent.lastChild !== el) {\n parent.appendChild(el);\n }\n } // @function toBack(el: HTMLElement)\n // Makes `el` the first child of its parent, so it renders behind the other children.\n\n\n function toBack(el) {\n var parent = el.parentNode;\n\n if (parent && parent.firstChild !== el) {\n parent.insertBefore(el, parent.firstChild);\n }\n } // @function hasClass(el: HTMLElement, name: String): Boolean\n // Returns `true` if the element's class attribute contains `name`.\n\n\n function hasClass(el, name) {\n if (el.classList !== undefined) {\n return el.classList.contains(name);\n }\n\n var className = getClass(el);\n return className.length > 0 && new RegExp('(^|\\\\s)' + name + '(\\\\s|$)').test(className);\n } // @function addClass(el: HTMLElement, name: String)\n // Adds `name` to the element's class attribute.\n\n\n function addClass(el, name) {\n if (el.classList !== undefined) {\n var classes = splitWords(name);\n\n for (var i = 0, len = classes.length; i < len; i++) {\n el.classList.add(classes[i]);\n }\n } else if (!hasClass(el, name)) {\n var className = getClass(el);\n setClass(el, (className ? className + ' ' : '') + name);\n }\n } // @function removeClass(el: HTMLElement, name: String)\n // Removes `name` from the element's class attribute.\n\n\n function removeClass(el, name) {\n if (el.classList !== undefined) {\n el.classList.remove(name);\n } else {\n setClass(el, trim((' ' + getClass(el) + ' ').replace(' ' + name + ' ', ' ')));\n }\n } // @function setClass(el: HTMLElement, name: String)\n // Sets the element's class.\n\n\n function setClass(el, name) {\n if (el.className.baseVal === undefined) {\n el.className = name;\n } else {\n // in case of SVG element\n el.className.baseVal = name;\n }\n } // @function getClass(el: HTMLElement): String\n // Returns the element's class.\n\n\n function getClass(el) {\n // Check if the element is an SVGElementInstance and use the correspondingElement instead\n // (Required for linked SVG elements in IE11.)\n if (el.correspondingElement) {\n el = el.correspondingElement;\n }\n\n return el.className.baseVal === undefined ? el.className : el.className.baseVal;\n } // @function setOpacity(el: HTMLElement, opacity: Number)\n // Set the opacity of an element (including old IE support).\n // `opacity` must be a number from `0` to `1`.\n\n\n function setOpacity(el, value) {\n if ('opacity' in el.style) {\n el.style.opacity = value;\n } else if ('filter' in el.style) {\n _setOpacityIE(el, value);\n }\n }\n\n function _setOpacityIE(el, value) {\n var filter = false,\n filterName = 'DXImageTransform.Microsoft.Alpha'; // filters collection throws an error if we try to retrieve a filter that doesn't exist\n\n try {\n filter = el.filters.item(filterName);\n } catch (e) {\n // don't set opacity to 1 if we haven't already set an opacity,\n // it isn't needed and breaks transparent pngs.\n if (value === 1) {\n return;\n }\n }\n\n value = Math.round(value * 100);\n\n if (filter) {\n filter.Enabled = value !== 100;\n filter.Opacity = value;\n } else {\n el.style.filter += ' progid:' + filterName + '(opacity=' + value + ')';\n }\n } // @function testProp(props: String[]): String|false\n // Goes through the array of style names and returns the first name\n // that is a valid style name for an element. If no such name is found,\n // it returns false. Useful for vendor-prefixed styles like `transform`.\n\n\n function testProp(props) {\n var style = document.documentElement.style;\n\n for (var i = 0; i < props.length; i++) {\n if (props[i] in style) {\n return props[i];\n }\n }\n\n return false;\n } // @function setTransform(el: HTMLElement, offset: Point, scale?: Number)\n // Resets the 3D CSS transform of `el` so it is translated by `offset` pixels\n // and optionally scaled by `scale`. Does not have an effect if the\n // browser doesn't support 3D CSS transforms.\n\n\n function setTransform(el, offset, scale) {\n var pos = offset || new Point(0, 0);\n el.style[TRANSFORM] = (ie3d ? 'translate(' + pos.x + 'px,' + pos.y + 'px)' : 'translate3d(' + pos.x + 'px,' + pos.y + 'px,0)') + (scale ? ' scale(' + scale + ')' : '');\n } // @function setPosition(el: HTMLElement, position: Point)\n // Sets the position of `el` to coordinates specified by `position`,\n // using CSS translate or top/left positioning depending on the browser\n // (used by Leaflet internally to position its layers).\n\n\n function setPosition(el, point) {\n /*eslint-disable */\n el._leaflet_pos = point;\n /* eslint-enable */\n\n if (any3d) {\n setTransform(el, point);\n } else {\n el.style.left = point.x + 'px';\n el.style.top = point.y + 'px';\n }\n } // @function getPosition(el: HTMLElement): Point\n // Returns the coordinates of an element previously positioned with setPosition.\n\n\n function getPosition(el) {\n // this method is only used for elements previously positioned using setPosition,\n // so it's safe to cache the position for performance\n return el._leaflet_pos || new Point(0, 0);\n } // @function disableTextSelection()\n // Prevents the user from generating `selectstart` DOM events, usually generated\n // when the user drags the mouse through a page with text. Used internally\n // by Leaflet to override the behaviour of any click-and-drag interaction on\n // the map. Affects drag interactions on the whole document.\n // @function enableTextSelection()\n // Cancels the effects of a previous [`L.DomUtil.disableTextSelection`](#domutil-disabletextselection).\n\n\n var disableTextSelection;\n var enableTextSelection;\n\n var _userSelect;\n\n if ('onselectstart' in document) {\n disableTextSelection = function () {\n on(window, 'selectstart', preventDefault);\n };\n\n enableTextSelection = function () {\n off(window, 'selectstart', preventDefault);\n };\n } else {\n var userSelectProperty = testProp(['userSelect', 'WebkitUserSelect', 'OUserSelect', 'MozUserSelect', 'msUserSelect']);\n\n disableTextSelection = function () {\n if (userSelectProperty) {\n var style = document.documentElement.style;\n _userSelect = style[userSelectProperty];\n style[userSelectProperty] = 'none';\n }\n };\n\n enableTextSelection = function () {\n if (userSelectProperty) {\n document.documentElement.style[userSelectProperty] = _userSelect;\n _userSelect = undefined;\n }\n };\n } // @function disableImageDrag()\n // As [`L.DomUtil.disableTextSelection`](#domutil-disabletextselection), but\n // for `dragstart` DOM events, usually generated when the user drags an image.\n\n\n function disableImageDrag() {\n on(window, 'dragstart', preventDefault);\n } // @function enableImageDrag()\n // Cancels the effects of a previous [`L.DomUtil.disableImageDrag`](#domutil-disabletextselection).\n\n\n function enableImageDrag() {\n off(window, 'dragstart', preventDefault);\n }\n\n var _outlineElement;\n\n var _outlineStyle; // @function preventOutline(el: HTMLElement)\n // Makes the [outline](https://developer.mozilla.org/docs/Web/CSS/outline)\n // of the element `el` invisible. Used internally by Leaflet to prevent\n // focusable elements from displaying an outline when the user performs a\n // drag interaction on them.\n\n\n function preventOutline(element) {\n while (element.tabIndex === -1) {\n element = element.parentNode;\n }\n\n if (!element.style) {\n return;\n }\n\n restoreOutline();\n _outlineElement = element;\n _outlineStyle = element.style.outline;\n element.style.outline = 'none';\n on(window, 'keydown', restoreOutline);\n } // @function restoreOutline()\n // Cancels the effects of a previous [`L.DomUtil.preventOutline`]().\n\n\n function restoreOutline() {\n if (!_outlineElement) {\n return;\n }\n\n _outlineElement.style.outline = _outlineStyle;\n _outlineElement = undefined;\n _outlineStyle = undefined;\n off(window, 'keydown', restoreOutline);\n } // @function getSizedParentNode(el: HTMLElement): HTMLElement\n // Finds the closest parent node which size (width and height) is not null.\n\n\n function getSizedParentNode(element) {\n do {\n element = element.parentNode;\n } while ((!element.offsetWidth || !element.offsetHeight) && element !== document.body);\n\n return element;\n } // @function getScale(el: HTMLElement): Object\n // Computes the CSS scale currently applied on the element.\n // Returns an object with `x` and `y` members as horizontal and vertical scales respectively,\n // and `boundingClientRect` as the result of [`getBoundingClientRect()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect).\n\n\n function getScale(element) {\n var rect = element.getBoundingClientRect(); // Read-only in old browsers.\n\n return {\n x: rect.width / element.offsetWidth || 1,\n y: rect.height / element.offsetHeight || 1,\n boundingClientRect: rect\n };\n }\n\n var DomUtil = (Object.freeze || Object)({\n TRANSFORM: TRANSFORM,\n TRANSITION: TRANSITION,\n TRANSITION_END: TRANSITION_END,\n get: get,\n getStyle: getStyle,\n create: create$1,\n remove: remove,\n empty: empty,\n toFront: toFront,\n toBack: toBack,\n hasClass: hasClass,\n addClass: addClass,\n removeClass: removeClass,\n setClass: setClass,\n getClass: getClass,\n setOpacity: setOpacity,\n testProp: testProp,\n setTransform: setTransform,\n setPosition: setPosition,\n getPosition: getPosition,\n disableTextSelection: disableTextSelection,\n enableTextSelection: enableTextSelection,\n disableImageDrag: disableImageDrag,\n enableImageDrag: enableImageDrag,\n preventOutline: preventOutline,\n restoreOutline: restoreOutline,\n getSizedParentNode: getSizedParentNode,\n getScale: getScale\n });\n /*\r\n * @namespace DomEvent\r\n * Utility functions to work with the [DOM events](https://developer.mozilla.org/docs/Web/API/Event), used by Leaflet internally.\r\n */\n // Inspired by John Resig, Dean Edwards and YUI addEvent implementations.\n // @function on(el: HTMLElement, types: String, fn: Function, context?: Object): this\n // Adds a listener function (`fn`) to a particular DOM event type of the\n // element `el`. You can optionally specify the context of the listener\n // (object the `this` keyword will point to). You can also pass several\n // space-separated types (e.g. `'click dblclick'`).\n // @alternative\n // @function on(el: HTMLElement, eventMap: Object, context?: Object): this\n // Adds a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}`\n\n function on(obj, types, fn, context) {\n if (typeof types === 'object') {\n for (var type in types) {\n addOne(obj, type, types[type], fn);\n }\n } else {\n types = splitWords(types);\n\n for (var i = 0, len = types.length; i < len; i++) {\n addOne(obj, types[i], fn, context);\n }\n }\n\n return this;\n }\n\n var eventsKey = '_leaflet_events'; // @function off(el: HTMLElement, types: String, fn: Function, context?: Object): this\n // Removes a previously added listener function.\n // Note that if you passed a custom context to on, you must pass the same\n // context to `off` in order to remove the listener.\n // @alternative\n // @function off(el: HTMLElement, eventMap: Object, context?: Object): this\n // Removes a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}`\n\n function off(obj, types, fn, context) {\n if (typeof types === 'object') {\n for (var type in types) {\n removeOne(obj, type, types[type], fn);\n }\n } else if (types) {\n types = splitWords(types);\n\n for (var i = 0, len = types.length; i < len; i++) {\n removeOne(obj, types[i], fn, context);\n }\n } else {\n for (var j in obj[eventsKey]) {\n removeOne(obj, j, obj[eventsKey][j]);\n }\n\n delete obj[eventsKey];\n }\n\n return this;\n }\n\n function addOne(obj, type, fn, context) {\n var id = type + stamp(fn) + (context ? '_' + stamp(context) : '');\n\n if (obj[eventsKey] && obj[eventsKey][id]) {\n return this;\n }\n\n var handler = function (e) {\n return fn.call(context || obj, e || window.event);\n };\n\n var originalHandler = handler;\n\n if (pointer && type.indexOf('touch') === 0) {\n // Needs DomEvent.Pointer.js\n addPointerListener(obj, type, handler, id);\n } else if (touch && type === 'dblclick' && addDoubleTapListener && !(pointer && chrome)) {\n // Chrome >55 does not need the synthetic dblclicks from addDoubleTapListener\n // See #5180\n addDoubleTapListener(obj, handler, id);\n } else if ('addEventListener' in obj) {\n if (type === 'mousewheel') {\n obj.addEventListener('onwheel' in obj ? 'wheel' : 'mousewheel', handler, false);\n } else if (type === 'mouseenter' || type === 'mouseleave') {\n handler = function (e) {\n e = e || window.event;\n\n if (isExternalTarget(obj, e)) {\n originalHandler(e);\n }\n };\n\n obj.addEventListener(type === 'mouseenter' ? 'mouseover' : 'mouseout', handler, false);\n } else {\n if (type === 'click' && android) {\n handler = function (e) {\n filterClick(e, originalHandler);\n };\n }\n\n obj.addEventListener(type, handler, false);\n }\n } else if ('attachEvent' in obj) {\n obj.attachEvent('on' + type, handler);\n }\n\n obj[eventsKey] = obj[eventsKey] || {};\n obj[eventsKey][id] = handler;\n }\n\n function removeOne(obj, type, fn, context) {\n var id = type + stamp(fn) + (context ? '_' + stamp(context) : ''),\n handler = obj[eventsKey] && obj[eventsKey][id];\n\n if (!handler) {\n return this;\n }\n\n if (pointer && type.indexOf('touch') === 0) {\n removePointerListener(obj, type, id);\n } else if (touch && type === 'dblclick' && removeDoubleTapListener && !(pointer && chrome)) {\n removeDoubleTapListener(obj, id);\n } else if ('removeEventListener' in obj) {\n if (type === 'mousewheel') {\n obj.removeEventListener('onwheel' in obj ? 'wheel' : 'mousewheel', handler, false);\n } else {\n obj.removeEventListener(type === 'mouseenter' ? 'mouseover' : type === 'mouseleave' ? 'mouseout' : type, handler, false);\n }\n } else if ('detachEvent' in obj) {\n obj.detachEvent('on' + type, handler);\n }\n\n obj[eventsKey][id] = null;\n } // @function stopPropagation(ev: DOMEvent): this\n // Stop the given event from propagation to parent elements. Used inside the listener functions:\n // ```js\n // L.DomEvent.on(div, 'click', function (ev) {\n // \tL.DomEvent.stopPropagation(ev);\n // });\n // ```\n\n\n function stopPropagation(e) {\n if (e.stopPropagation) {\n e.stopPropagation();\n } else if (e.originalEvent) {\n // In case of Leaflet event.\n e.originalEvent._stopped = true;\n } else {\n e.cancelBubble = true;\n }\n\n skipped(e);\n return this;\n } // @function disableScrollPropagation(el: HTMLElement): this\n // Adds `stopPropagation` to the element's `'mousewheel'` events (plus browser variants).\n\n\n function disableScrollPropagation(el) {\n addOne(el, 'mousewheel', stopPropagation);\n return this;\n } // @function disableClickPropagation(el: HTMLElement): this\n // Adds `stopPropagation` to the element's `'click'`, `'doubleclick'`,\n // `'mousedown'` and `'touchstart'` events (plus browser variants).\n\n\n function disableClickPropagation(el) {\n on(el, 'mousedown touchstart dblclick', stopPropagation);\n addOne(el, 'click', fakeStop);\n return this;\n } // @function preventDefault(ev: DOMEvent): this\n // Prevents the default action of the DOM Event `ev` from happening (such as\n // following a link in the href of the a element, or doing a POST request\n // with page reload when a `
` is submitted).\n // Use it inside listener functions.\n\n\n function preventDefault(e) {\n if (e.preventDefault) {\n e.preventDefault();\n } else {\n e.returnValue = false;\n }\n\n return this;\n } // @function stop(ev: DOMEvent): this\n // Does `stopPropagation` and `preventDefault` at the same time.\n\n\n function stop(e) {\n preventDefault(e);\n stopPropagation(e);\n return this;\n } // @function getMousePosition(ev: DOMEvent, container?: HTMLElement): Point\n // Gets normalized mouse position from a DOM event relative to the\n // `container` (border excluded) or to the whole page if not specified.\n\n\n function getMousePosition(e, container) {\n if (!container) {\n return new Point(e.clientX, e.clientY);\n }\n\n var scale = getScale(container),\n offset = scale.boundingClientRect; // left and top values are in page scale (like the event clientX/Y)\n\n return new Point( // offset.left/top values are in page scale (like clientX/Y),\n // whereas clientLeft/Top (border width) values are the original values (before CSS scale applies).\n (e.clientX - offset.left) / scale.x - container.clientLeft, (e.clientY - offset.top) / scale.y - container.clientTop);\n } // Chrome on Win scrolls double the pixels as in other platforms (see #4538),\n // and Firefox scrolls device pixels, not CSS pixels\n\n\n var wheelPxFactor = win && chrome ? 2 * window.devicePixelRatio : gecko ? window.devicePixelRatio : 1; // @function getWheelDelta(ev: DOMEvent): Number\n // Gets normalized wheel delta from a mousewheel DOM event, in vertical\n // pixels scrolled (negative if scrolling down).\n // Events from pointing devices without precise scrolling are mapped to\n // a best guess of 60 pixels.\n\n function getWheelDelta(e) {\n return edge ? e.wheelDeltaY / 2 : // Don't trust window-geometry-based delta\n e.deltaY && e.deltaMode === 0 ? -e.deltaY / wheelPxFactor : // Pixels\n e.deltaY && e.deltaMode === 1 ? -e.deltaY * 20 : // Lines\n e.deltaY && e.deltaMode === 2 ? -e.deltaY * 60 : // Pages\n e.deltaX || e.deltaZ ? 0 : // Skip horizontal/depth wheel events\n e.wheelDelta ? (e.wheelDeltaY || e.wheelDelta) / 2 : // Legacy IE pixels\n e.detail && Math.abs(e.detail) < 32765 ? -e.detail * 20 : // Legacy Moz lines\n e.detail ? e.detail / -32765 * 60 : // Legacy Moz pages\n 0;\n }\n\n var skipEvents = {};\n\n function fakeStop(e) {\n // fakes stopPropagation by setting a special event flag, checked/reset with skipped(e)\n skipEvents[e.type] = true;\n }\n\n function skipped(e) {\n var events = skipEvents[e.type]; // reset when checking, as it's only used in map container and propagates outside of the map\n\n skipEvents[e.type] = false;\n return events;\n } // check if element really left/entered the event target (for mouseenter/mouseleave)\n\n\n function isExternalTarget(el, e) {\n var related = e.relatedTarget;\n\n if (!related) {\n return true;\n }\n\n try {\n while (related && related !== el) {\n related = related.parentNode;\n }\n } catch (err) {\n return false;\n }\n\n return related !== el;\n }\n\n var lastClick; // this is a horrible workaround for a bug in Android where a single touch triggers two click events\n\n function filterClick(e, handler) {\n var timeStamp = e.timeStamp || e.originalEvent && e.originalEvent.timeStamp,\n elapsed = lastClick && timeStamp - lastClick; // are they closer together than 500ms yet more than 100ms?\n // Android typically triggers them ~300ms apart while multiple listeners\n // on the same event should be triggered far faster;\n // or check if click is simulated on the element, and if it is, reject any non-simulated events\n\n if (elapsed && elapsed > 100 && elapsed < 500 || e.target._simulatedClick && !e._simulated) {\n stop(e);\n return;\n }\n\n lastClick = timeStamp;\n handler(e);\n }\n\n var DomEvent = (Object.freeze || Object)({\n on: on,\n off: off,\n stopPropagation: stopPropagation,\n disableScrollPropagation: disableScrollPropagation,\n disableClickPropagation: disableClickPropagation,\n preventDefault: preventDefault,\n stop: stop,\n getMousePosition: getMousePosition,\n getWheelDelta: getWheelDelta,\n fakeStop: fakeStop,\n skipped: skipped,\n isExternalTarget: isExternalTarget,\n addListener: on,\n removeListener: off\n });\n /*\n * @class PosAnimation\n * @aka L.PosAnimation\n * @inherits Evented\n * Used internally for panning animations, utilizing CSS3 Transitions for modern browsers and a timer fallback for IE6-9.\n *\n * @example\n * ```js\n * var fx = new L.PosAnimation();\n * fx.run(el, [300, 500], 0.5);\n * ```\n *\n * @constructor L.PosAnimation()\n * Creates a `PosAnimation` object.\n *\n */\n\n var PosAnimation = Evented.extend({\n // @method run(el: HTMLElement, newPos: Point, duration?: Number, easeLinearity?: Number)\n // Run an animation of a given element to a new position, optionally setting\n // duration in seconds (`0.25` by default) and easing linearity factor (3rd\n // argument of the [cubic bezier curve](http://cubic-bezier.com/#0,0,.5,1),\n // `0.5` by default).\n run: function (el, newPos, duration, easeLinearity) {\n this.stop();\n this._el = el;\n this._inProgress = true;\n this._duration = duration || 0.25;\n this._easeOutPower = 1 / Math.max(easeLinearity || 0.5, 0.2);\n this._startPos = getPosition(el);\n this._offset = newPos.subtract(this._startPos);\n this._startTime = +new Date(); // @event start: Event\n // Fired when the animation starts\n\n this.fire('start');\n\n this._animate();\n },\n // @method stop()\n // Stops the animation (if currently running).\n stop: function () {\n if (!this._inProgress) {\n return;\n }\n\n this._step(true);\n\n this._complete();\n },\n _animate: function () {\n // animation loop\n this._animId = requestAnimFrame(this._animate, this);\n\n this._step();\n },\n _step: function (round) {\n var elapsed = +new Date() - this._startTime,\n duration = this._duration * 1000;\n\n if (elapsed < duration) {\n this._runFrame(this._easeOut(elapsed / duration), round);\n } else {\n this._runFrame(1);\n\n this._complete();\n }\n },\n _runFrame: function (progress, round) {\n var pos = this._startPos.add(this._offset.multiplyBy(progress));\n\n if (round) {\n pos._round();\n }\n\n setPosition(this._el, pos); // @event step: Event\n // Fired continuously during the animation.\n\n this.fire('step');\n },\n _complete: function () {\n cancelAnimFrame(this._animId);\n this._inProgress = false; // @event end: Event\n // Fired when the animation ends.\n\n this.fire('end');\n },\n _easeOut: function (t) {\n return 1 - Math.pow(1 - t, this._easeOutPower);\n }\n });\n /*\r\n * @class Map\r\n * @aka L.Map\r\n * @inherits Evented\r\n *\r\n * The central class of the API — it is used to create a map on a page and manipulate it.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * // initialize the map on the \"map\" div with a given center and zoom\r\n * var map = L.map('map', {\r\n * \tcenter: [51.505, -0.09],\r\n * \tzoom: 13\r\n * });\r\n * ```\r\n *\r\n */\n\n var Map = Evented.extend({\n options: {\n // @section Map State Options\n // @option crs: CRS = L.CRS.EPSG3857\n // The [Coordinate Reference System](#crs) to use. Don't change this if you're not\n // sure what it means.\n crs: EPSG3857,\n // @option center: LatLng = undefined\n // Initial geographic center of the map\n center: undefined,\n // @option zoom: Number = undefined\n // Initial map zoom level\n zoom: undefined,\n // @option minZoom: Number = *\n // Minimum zoom level of the map.\n // If not specified and at least one `GridLayer` or `TileLayer` is in the map,\n // the lowest of their `minZoom` options will be used instead.\n minZoom: undefined,\n // @option maxZoom: Number = *\n // Maximum zoom level of the map.\n // If not specified and at least one `GridLayer` or `TileLayer` is in the map,\n // the highest of their `maxZoom` options will be used instead.\n maxZoom: undefined,\n // @option layers: Layer[] = []\n // Array of layers that will be added to the map initially\n layers: [],\n // @option maxBounds: LatLngBounds = null\n // When this option is set, the map restricts the view to the given\n // geographical bounds, bouncing the user back if the user tries to pan\n // outside the view. To set the restriction dynamically, use\n // [`setMaxBounds`](#map-setmaxbounds) method.\n maxBounds: undefined,\n // @option renderer: Renderer = *\n // The default method for drawing vector layers on the map. `L.SVG`\n // or `L.Canvas` by default depending on browser support.\n renderer: undefined,\n // @section Animation Options\n // @option zoomAnimation: Boolean = true\n // Whether the map zoom animation is enabled. By default it's enabled\n // in all browsers that support CSS3 Transitions except Android.\n zoomAnimation: true,\n // @option zoomAnimationThreshold: Number = 4\n // Won't animate zoom if the zoom difference exceeds this value.\n zoomAnimationThreshold: 4,\n // @option fadeAnimation: Boolean = true\n // Whether the tile fade animation is enabled. By default it's enabled\n // in all browsers that support CSS3 Transitions except Android.\n fadeAnimation: true,\n // @option markerZoomAnimation: Boolean = true\n // Whether markers animate their zoom with the zoom animation, if disabled\n // they will disappear for the length of the animation. By default it's\n // enabled in all browsers that support CSS3 Transitions except Android.\n markerZoomAnimation: true,\n // @option transform3DLimit: Number = 2^23\n // Defines the maximum size of a CSS translation transform. The default\n // value should not be changed unless a web browser positions layers in\n // the wrong place after doing a large `panBy`.\n transform3DLimit: 8388608,\n // Precision limit of a 32-bit float\n // @section Interaction Options\n // @option zoomSnap: Number = 1\n // Forces the map's zoom level to always be a multiple of this, particularly\n // right after a [`fitBounds()`](#map-fitbounds) or a pinch-zoom.\n // By default, the zoom level snaps to the nearest integer; lower values\n // (e.g. `0.5` or `0.1`) allow for greater granularity. A value of `0`\n // means the zoom level will not be snapped after `fitBounds` or a pinch-zoom.\n zoomSnap: 1,\n // @option zoomDelta: Number = 1\n // Controls how much the map's zoom level will change after a\n // [`zoomIn()`](#map-zoomin), [`zoomOut()`](#map-zoomout), pressing `+`\n // or `-` on the keyboard, or using the [zoom controls](#control-zoom).\n // Values smaller than `1` (e.g. `0.5`) allow for greater granularity.\n zoomDelta: 1,\n // @option trackResize: Boolean = true\n // Whether the map automatically handles browser window resize to update itself.\n trackResize: true\n },\n initialize: function (id, options) {\n // (HTMLElement or String, Object)\n options = setOptions(this, options); // Make sure to assign internal flags at the beginning,\n // to avoid inconsistent state in some edge cases.\n\n this._handlers = [];\n this._layers = {};\n this._zoomBoundLayers = {};\n this._sizeChanged = true;\n\n this._initContainer(id);\n\n this._initLayout(); // hack for https://github.com/Leaflet/Leaflet/issues/1980\n\n\n this._onResize = bind(this._onResize, this);\n\n this._initEvents();\n\n if (options.maxBounds) {\n this.setMaxBounds(options.maxBounds);\n }\n\n if (options.zoom !== undefined) {\n this._zoom = this._limitZoom(options.zoom);\n }\n\n if (options.center && options.zoom !== undefined) {\n this.setView(toLatLng(options.center), options.zoom, {\n reset: true\n });\n }\n\n this.callInitHooks(); // don't animate on browsers without hardware-accelerated transitions or old Android/Opera\n\n this._zoomAnimated = TRANSITION && any3d && !mobileOpera && this.options.zoomAnimation; // zoom transitions run with the same duration for all layers, so if one of transitionend events\n // happens after starting zoom animation (propagating to the map pane), we know that it ended globally\n\n if (this._zoomAnimated) {\n this._createAnimProxy();\n\n on(this._proxy, TRANSITION_END, this._catchTransitionEnd, this);\n }\n\n this._addLayers(this.options.layers);\n },\n // @section Methods for modifying map state\n // @method setView(center: LatLng, zoom: Number, options?: Zoom/pan options): this\n // Sets the view of the map (geographical center and zoom) with the given\n // animation options.\n setView: function (center, zoom, options) {\n zoom = zoom === undefined ? this._zoom : this._limitZoom(zoom);\n center = this._limitCenter(toLatLng(center), zoom, this.options.maxBounds);\n options = options || {};\n\n this._stop();\n\n if (this._loaded && !options.reset && options !== true) {\n if (options.animate !== undefined) {\n options.zoom = extend({\n animate: options.animate\n }, options.zoom);\n options.pan = extend({\n animate: options.animate,\n duration: options.duration\n }, options.pan);\n } // try animating pan or zoom\n\n\n var moved = this._zoom !== zoom ? this._tryAnimatedZoom && this._tryAnimatedZoom(center, zoom, options.zoom) : this._tryAnimatedPan(center, options.pan);\n\n if (moved) {\n // prevent resize handler call, the view will refresh after animation anyway\n clearTimeout(this._sizeTimer);\n return this;\n }\n } // animation didn't start, just reset the map view\n\n\n this._resetView(center, zoom);\n\n return this;\n },\n // @method setZoom(zoom: Number, options?: Zoom/pan options): this\n // Sets the zoom of the map.\n setZoom: function (zoom, options) {\n if (!this._loaded) {\n this._zoom = zoom;\n return this;\n }\n\n return this.setView(this.getCenter(), zoom, {\n zoom: options\n });\n },\n // @method zoomIn(delta?: Number, options?: Zoom options): this\n // Increases the zoom of the map by `delta` ([`zoomDelta`](#map-zoomdelta) by default).\n zoomIn: function (delta, options) {\n delta = delta || (any3d ? this.options.zoomDelta : 1);\n return this.setZoom(this._zoom + delta, options);\n },\n // @method zoomOut(delta?: Number, options?: Zoom options): this\n // Decreases the zoom of the map by `delta` ([`zoomDelta`](#map-zoomdelta) by default).\n zoomOut: function (delta, options) {\n delta = delta || (any3d ? this.options.zoomDelta : 1);\n return this.setZoom(this._zoom - delta, options);\n },\n // @method setZoomAround(latlng: LatLng, zoom: Number, options: Zoom options): this\n // Zooms the map while keeping a specified geographical point on the map\n // stationary (e.g. used internally for scroll zoom and double-click zoom).\n // @alternative\n // @method setZoomAround(offset: Point, zoom: Number, options: Zoom options): this\n // Zooms the map while keeping a specified pixel on the map (relative to the top-left corner) stationary.\n setZoomAround: function (latlng, zoom, options) {\n var scale = this.getZoomScale(zoom),\n viewHalf = this.getSize().divideBy(2),\n containerPoint = latlng instanceof Point ? latlng : this.latLngToContainerPoint(latlng),\n centerOffset = containerPoint.subtract(viewHalf).multiplyBy(1 - 1 / scale),\n newCenter = this.containerPointToLatLng(viewHalf.add(centerOffset));\n return this.setView(newCenter, zoom, {\n zoom: options\n });\n },\n _getBoundsCenterZoom: function (bounds, options) {\n options = options || {};\n bounds = bounds.getBounds ? bounds.getBounds() : toLatLngBounds(bounds);\n var paddingTL = toPoint(options.paddingTopLeft || options.padding || [0, 0]),\n paddingBR = toPoint(options.paddingBottomRight || options.padding || [0, 0]),\n zoom = this.getBoundsZoom(bounds, false, paddingTL.add(paddingBR));\n zoom = typeof options.maxZoom === 'number' ? Math.min(options.maxZoom, zoom) : zoom;\n\n if (zoom === Infinity) {\n return {\n center: bounds.getCenter(),\n zoom: zoom\n };\n }\n\n var paddingOffset = paddingBR.subtract(paddingTL).divideBy(2),\n swPoint = this.project(bounds.getSouthWest(), zoom),\n nePoint = this.project(bounds.getNorthEast(), zoom),\n center = this.unproject(swPoint.add(nePoint).divideBy(2).add(paddingOffset), zoom);\n return {\n center: center,\n zoom: zoom\n };\n },\n // @method fitBounds(bounds: LatLngBounds, options?: fitBounds options): this\n // Sets a map view that contains the given geographical bounds with the\n // maximum zoom level possible.\n fitBounds: function (bounds, options) {\n bounds = toLatLngBounds(bounds);\n\n if (!bounds.isValid()) {\n throw new Error('Bounds are not valid.');\n }\n\n var target = this._getBoundsCenterZoom(bounds, options);\n\n return this.setView(target.center, target.zoom, options);\n },\n // @method fitWorld(options?: fitBounds options): this\n // Sets a map view that mostly contains the whole world with the maximum\n // zoom level possible.\n fitWorld: function (options) {\n return this.fitBounds([[-90, -180], [90, 180]], options);\n },\n // @method panTo(latlng: LatLng, options?: Pan options): this\n // Pans the map to a given center.\n panTo: function (center, options) {\n // (LatLng)\n return this.setView(center, this._zoom, {\n pan: options\n });\n },\n // @method panBy(offset: Point, options?: Pan options): this\n // Pans the map by a given number of pixels (animated).\n panBy: function (offset, options) {\n offset = toPoint(offset).round();\n options = options || {};\n\n if (!offset.x && !offset.y) {\n return this.fire('moveend');\n } // If we pan too far, Chrome gets issues with tiles\n // and makes them disappear or appear in the wrong place (slightly offset) #2602\n\n\n if (options.animate !== true && !this.getSize().contains(offset)) {\n this._resetView(this.unproject(this.project(this.getCenter()).add(offset)), this.getZoom());\n\n return this;\n }\n\n if (!this._panAnim) {\n this._panAnim = new PosAnimation();\n\n this._panAnim.on({\n 'step': this._onPanTransitionStep,\n 'end': this._onPanTransitionEnd\n }, this);\n } // don't fire movestart if animating inertia\n\n\n if (!options.noMoveStart) {\n this.fire('movestart');\n } // animate pan unless animate: false specified\n\n\n if (options.animate !== false) {\n addClass(this._mapPane, 'leaflet-pan-anim');\n\n var newPos = this._getMapPanePos().subtract(offset).round();\n\n this._panAnim.run(this._mapPane, newPos, options.duration || 0.25, options.easeLinearity);\n } else {\n this._rawPanBy(offset);\n\n this.fire('move').fire('moveend');\n }\n\n return this;\n },\n // @method flyTo(latlng: LatLng, zoom?: Number, options?: Zoom/pan options): this\n // Sets the view of the map (geographical center and zoom) performing a smooth\n // pan-zoom animation.\n flyTo: function (targetCenter, targetZoom, options) {\n options = options || {};\n\n if (options.animate === false || !any3d) {\n return this.setView(targetCenter, targetZoom, options);\n }\n\n this._stop();\n\n var from = this.project(this.getCenter()),\n to = this.project(targetCenter),\n size = this.getSize(),\n startZoom = this._zoom;\n targetCenter = toLatLng(targetCenter);\n targetZoom = targetZoom === undefined ? startZoom : targetZoom;\n var w0 = Math.max(size.x, size.y),\n w1 = w0 * this.getZoomScale(startZoom, targetZoom),\n u1 = to.distanceTo(from) || 1,\n rho = 1.42,\n rho2 = rho * rho;\n\n function r(i) {\n var s1 = i ? -1 : 1,\n s2 = i ? w1 : w0,\n t1 = w1 * w1 - w0 * w0 + s1 * rho2 * rho2 * u1 * u1,\n b1 = 2 * s2 * rho2 * u1,\n b = t1 / b1,\n sq = Math.sqrt(b * b + 1) - b; // workaround for floating point precision bug when sq = 0, log = -Infinite,\n // thus triggering an infinite loop in flyTo\n\n var log = sq < 0.000000001 ? -18 : Math.log(sq);\n return log;\n }\n\n function sinh(n) {\n return (Math.exp(n) - Math.exp(-n)) / 2;\n }\n\n function cosh(n) {\n return (Math.exp(n) + Math.exp(-n)) / 2;\n }\n\n function tanh(n) {\n return sinh(n) / cosh(n);\n }\n\n var r0 = r(0);\n\n function w(s) {\n return w0 * (cosh(r0) / cosh(r0 + rho * s));\n }\n\n function u(s) {\n return w0 * (cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2;\n }\n\n function easeOut(t) {\n return 1 - Math.pow(1 - t, 1.5);\n }\n\n var start = Date.now(),\n S = (r(1) - r0) / rho,\n duration = options.duration ? 1000 * options.duration : 1000 * S * 0.8;\n\n function frame() {\n var t = (Date.now() - start) / duration,\n s = easeOut(t) * S;\n\n if (t <= 1) {\n this._flyToFrame = requestAnimFrame(frame, this);\n\n this._move(this.unproject(from.add(to.subtract(from).multiplyBy(u(s) / u1)), startZoom), this.getScaleZoom(w0 / w(s), startZoom), {\n flyTo: true\n });\n } else {\n this._move(targetCenter, targetZoom)._moveEnd(true);\n }\n }\n\n this._moveStart(true, options.noMoveStart);\n\n frame.call(this);\n return this;\n },\n // @method flyToBounds(bounds: LatLngBounds, options?: fitBounds options): this\n // Sets the view of the map with a smooth animation like [`flyTo`](#map-flyto),\n // but takes a bounds parameter like [`fitBounds`](#map-fitbounds).\n flyToBounds: function (bounds, options) {\n var target = this._getBoundsCenterZoom(bounds, options);\n\n return this.flyTo(target.center, target.zoom, options);\n },\n // @method setMaxBounds(bounds: Bounds): this\n // Restricts the map view to the given bounds (see the [maxBounds](#map-maxbounds) option).\n setMaxBounds: function (bounds) {\n bounds = toLatLngBounds(bounds);\n\n if (!bounds.isValid()) {\n this.options.maxBounds = null;\n return this.off('moveend', this._panInsideMaxBounds);\n } else if (this.options.maxBounds) {\n this.off('moveend', this._panInsideMaxBounds);\n }\n\n this.options.maxBounds = bounds;\n\n if (this._loaded) {\n this._panInsideMaxBounds();\n }\n\n return this.on('moveend', this._panInsideMaxBounds);\n },\n // @method setMinZoom(zoom: Number): this\n // Sets the lower limit for the available zoom levels (see the [minZoom](#map-minzoom) option).\n setMinZoom: function (zoom) {\n var oldZoom = this.options.minZoom;\n this.options.minZoom = zoom;\n\n if (this._loaded && oldZoom !== zoom) {\n this.fire('zoomlevelschange');\n\n if (this.getZoom() < this.options.minZoom) {\n return this.setZoom(zoom);\n }\n }\n\n return this;\n },\n // @method setMaxZoom(zoom: Number): this\n // Sets the upper limit for the available zoom levels (see the [maxZoom](#map-maxzoom) option).\n setMaxZoom: function (zoom) {\n var oldZoom = this.options.maxZoom;\n this.options.maxZoom = zoom;\n\n if (this._loaded && oldZoom !== zoom) {\n this.fire('zoomlevelschange');\n\n if (this.getZoom() > this.options.maxZoom) {\n return this.setZoom(zoom);\n }\n }\n\n return this;\n },\n // @method panInsideBounds(bounds: LatLngBounds, options?: Pan options): this\n // Pans the map to the closest view that would lie inside the given bounds (if it's not already), controlling the animation using the options specific, if any.\n panInsideBounds: function (bounds, options) {\n this._enforcingBounds = true;\n\n var center = this.getCenter(),\n newCenter = this._limitCenter(center, this._zoom, toLatLngBounds(bounds));\n\n if (!center.equals(newCenter)) {\n this.panTo(newCenter, options);\n }\n\n this._enforcingBounds = false;\n return this;\n },\n // @method panInside(latlng: LatLng, options?: options): this\n // Pans the map the minimum amount to make the `latlng` visible. Use\n // `padding`, `paddingTopLeft` and `paddingTopRight` options to fit\n // the display to more restricted bounds, like [`fitBounds`](#map-fitbounds).\n // If `latlng` is already within the (optionally padded) display bounds,\n // the map will not be panned.\n panInside: function (latlng, options) {\n options = options || {};\n var paddingTL = toPoint(options.paddingTopLeft || options.padding || [0, 0]),\n paddingBR = toPoint(options.paddingBottomRight || options.padding || [0, 0]),\n center = this.getCenter(),\n pixelCenter = this.project(center),\n pixelPoint = this.project(latlng),\n pixelBounds = this.getPixelBounds(),\n halfPixelBounds = pixelBounds.getSize().divideBy(2),\n paddedBounds = toBounds([pixelBounds.min.add(paddingTL), pixelBounds.max.subtract(paddingBR)]);\n\n if (!paddedBounds.contains(pixelPoint)) {\n this._enforcingBounds = true;\n var diff = pixelCenter.subtract(pixelPoint),\n newCenter = toPoint(pixelPoint.x + diff.x, pixelPoint.y + diff.y);\n\n if (pixelPoint.x < paddedBounds.min.x || pixelPoint.x > paddedBounds.max.x) {\n newCenter.x = pixelCenter.x - diff.x;\n\n if (diff.x > 0) {\n newCenter.x += halfPixelBounds.x - paddingTL.x;\n } else {\n newCenter.x -= halfPixelBounds.x - paddingBR.x;\n }\n }\n\n if (pixelPoint.y < paddedBounds.min.y || pixelPoint.y > paddedBounds.max.y) {\n newCenter.y = pixelCenter.y - diff.y;\n\n if (diff.y > 0) {\n newCenter.y += halfPixelBounds.y - paddingTL.y;\n } else {\n newCenter.y -= halfPixelBounds.y - paddingBR.y;\n }\n }\n\n this.panTo(this.unproject(newCenter), options);\n this._enforcingBounds = false;\n }\n\n return this;\n },\n // @method invalidateSize(options: Zoom/pan options): this\n // Checks if the map container size changed and updates the map if so —\n // call it after you've changed the map size dynamically, also animating\n // pan by default. If `options.pan` is `false`, panning will not occur.\n // If `options.debounceMoveend` is `true`, it will delay `moveend` event so\n // that it doesn't happen often even if the method is called many\n // times in a row.\n // @alternative\n // @method invalidateSize(animate: Boolean): this\n // Checks if the map container size changed and updates the map if so —\n // call it after you've changed the map size dynamically, also animating\n // pan by default.\n invalidateSize: function (options) {\n if (!this._loaded) {\n return this;\n }\n\n options = extend({\n animate: false,\n pan: true\n }, options === true ? {\n animate: true\n } : options);\n var oldSize = this.getSize();\n this._sizeChanged = true;\n this._lastCenter = null;\n var newSize = this.getSize(),\n oldCenter = oldSize.divideBy(2).round(),\n newCenter = newSize.divideBy(2).round(),\n offset = oldCenter.subtract(newCenter);\n\n if (!offset.x && !offset.y) {\n return this;\n }\n\n if (options.animate && options.pan) {\n this.panBy(offset);\n } else {\n if (options.pan) {\n this._rawPanBy(offset);\n }\n\n this.fire('move');\n\n if (options.debounceMoveend) {\n clearTimeout(this._sizeTimer);\n this._sizeTimer = setTimeout(bind(this.fire, this, 'moveend'), 200);\n } else {\n this.fire('moveend');\n }\n } // @section Map state change events\n // @event resize: ResizeEvent\n // Fired when the map is resized.\n\n\n return this.fire('resize', {\n oldSize: oldSize,\n newSize: newSize\n });\n },\n // @section Methods for modifying map state\n // @method stop(): this\n // Stops the currently running `panTo` or `flyTo` animation, if any.\n stop: function () {\n this.setZoom(this._limitZoom(this._zoom));\n\n if (!this.options.zoomSnap) {\n this.fire('viewreset');\n }\n\n return this._stop();\n },\n // @section Geolocation methods\n // @method locate(options?: Locate options): this\n // Tries to locate the user using the Geolocation API, firing a [`locationfound`](#map-locationfound)\n // event with location data on success or a [`locationerror`](#map-locationerror) event on failure,\n // and optionally sets the map view to the user's location with respect to\n // detection accuracy (or to the world view if geolocation failed).\n // Note that, if your page doesn't use HTTPS, this method will fail in\n // modern browsers ([Chrome 50 and newer](https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins))\n // See `Locate options` for more details.\n locate: function (options) {\n options = this._locateOptions = extend({\n timeout: 10000,\n watch: false // setView: false\n // maxZoom: \n // maximumAge: 0\n // enableHighAccuracy: false\n\n }, options);\n\n if (!('geolocation' in navigator)) {\n this._handleGeolocationError({\n code: 0,\n message: 'Geolocation not supported.'\n });\n\n return this;\n }\n\n var onResponse = bind(this._handleGeolocationResponse, this),\n onError = bind(this._handleGeolocationError, this);\n\n if (options.watch) {\n this._locationWatchId = navigator.geolocation.watchPosition(onResponse, onError, options);\n } else {\n navigator.geolocation.getCurrentPosition(onResponse, onError, options);\n }\n\n return this;\n },\n // @method stopLocate(): this\n // Stops watching location previously initiated by `map.locate({watch: true})`\n // and aborts resetting the map view if map.locate was called with\n // `{setView: true}`.\n stopLocate: function () {\n if (navigator.geolocation && navigator.geolocation.clearWatch) {\n navigator.geolocation.clearWatch(this._locationWatchId);\n }\n\n if (this._locateOptions) {\n this._locateOptions.setView = false;\n }\n\n return this;\n },\n _handleGeolocationError: function (error) {\n var c = error.code,\n message = error.message || (c === 1 ? 'permission denied' : c === 2 ? 'position unavailable' : 'timeout');\n\n if (this._locateOptions.setView && !this._loaded) {\n this.fitWorld();\n } // @section Location events\n // @event locationerror: ErrorEvent\n // Fired when geolocation (using the [`locate`](#map-locate) method) failed.\n\n\n this.fire('locationerror', {\n code: c,\n message: 'Geolocation error: ' + message + '.'\n });\n },\n _handleGeolocationResponse: function (pos) {\n var lat = pos.coords.latitude,\n lng = pos.coords.longitude,\n latlng = new LatLng(lat, lng),\n bounds = latlng.toBounds(pos.coords.accuracy * 2),\n options = this._locateOptions;\n\n if (options.setView) {\n var zoom = this.getBoundsZoom(bounds);\n this.setView(latlng, options.maxZoom ? Math.min(zoom, options.maxZoom) : zoom);\n }\n\n var data = {\n latlng: latlng,\n bounds: bounds,\n timestamp: pos.timestamp\n };\n\n for (var i in pos.coords) {\n if (typeof pos.coords[i] === 'number') {\n data[i] = pos.coords[i];\n }\n } // @event locationfound: LocationEvent\n // Fired when geolocation (using the [`locate`](#map-locate) method)\n // went successfully.\n\n\n this.fire('locationfound', data);\n },\n // TODO Appropriate docs section?\n // @section Other Methods\n // @method addHandler(name: String, HandlerClass: Function): this\n // Adds a new `Handler` to the map, given its name and constructor function.\n addHandler: function (name, HandlerClass) {\n if (!HandlerClass) {\n return this;\n }\n\n var handler = this[name] = new HandlerClass(this);\n\n this._handlers.push(handler);\n\n if (this.options[name]) {\n handler.enable();\n }\n\n return this;\n },\n // @method remove(): this\n // Destroys the map and clears all related event listeners.\n remove: function () {\n this._initEvents(true);\n\n if (this._containerId !== this._container._leaflet_id) {\n throw new Error('Map container is being reused by another instance');\n }\n\n try {\n // throws error in IE6-8\n delete this._container._leaflet_id;\n delete this._containerId;\n } catch (e) {\n /*eslint-disable */\n this._container._leaflet_id = undefined;\n /* eslint-enable */\n\n this._containerId = undefined;\n }\n\n if (this._locationWatchId !== undefined) {\n this.stopLocate();\n }\n\n this._stop();\n\n remove(this._mapPane);\n\n if (this._clearControlPos) {\n this._clearControlPos();\n }\n\n if (this._resizeRequest) {\n cancelAnimFrame(this._resizeRequest);\n this._resizeRequest = null;\n }\n\n this._clearHandlers();\n\n if (this._loaded) {\n // @section Map state change events\n // @event unload: Event\n // Fired when the map is destroyed with [remove](#map-remove) method.\n this.fire('unload');\n }\n\n var i;\n\n for (i in this._layers) {\n this._layers[i].remove();\n }\n\n for (i in this._panes) {\n remove(this._panes[i]);\n }\n\n this._layers = [];\n this._panes = [];\n delete this._mapPane;\n delete this._renderer;\n return this;\n },\n // @section Other Methods\n // @method createPane(name: String, container?: HTMLElement): HTMLElement\n // Creates a new [map pane](#map-pane) with the given name if it doesn't exist already,\n // then returns it. The pane is created as a child of `container`, or\n // as a child of the main map pane if not set.\n createPane: function (name, container) {\n var className = 'leaflet-pane' + (name ? ' leaflet-' + name.replace('Pane', '') + '-pane' : ''),\n pane = create$1('div', className, container || this._mapPane);\n\n if (name) {\n this._panes[name] = pane;\n }\n\n return pane;\n },\n // @section Methods for Getting Map State\n // @method getCenter(): LatLng\n // Returns the geographical center of the map view\n getCenter: function () {\n this._checkIfLoaded();\n\n if (this._lastCenter && !this._moved()) {\n return this._lastCenter;\n }\n\n return this.layerPointToLatLng(this._getCenterLayerPoint());\n },\n // @method getZoom(): Number\n // Returns the current zoom level of the map view\n getZoom: function () {\n return this._zoom;\n },\n // @method getBounds(): LatLngBounds\n // Returns the geographical bounds visible in the current map view\n getBounds: function () {\n var bounds = this.getPixelBounds(),\n sw = this.unproject(bounds.getBottomLeft()),\n ne = this.unproject(bounds.getTopRight());\n return new LatLngBounds(sw, ne);\n },\n // @method getMinZoom(): Number\n // Returns the minimum zoom level of the map (if set in the `minZoom` option of the map or of any layers), or `0` by default.\n getMinZoom: function () {\n return this.options.minZoom === undefined ? this._layersMinZoom || 0 : this.options.minZoom;\n },\n // @method getMaxZoom(): Number\n // Returns the maximum zoom level of the map (if set in the `maxZoom` option of the map or of any layers).\n getMaxZoom: function () {\n return this.options.maxZoom === undefined ? this._layersMaxZoom === undefined ? Infinity : this._layersMaxZoom : this.options.maxZoom;\n },\n // @method getBoundsZoom(bounds: LatLngBounds, inside?: Boolean, padding?: Point): Number\n // Returns the maximum zoom level on which the given bounds fit to the map\n // view in its entirety. If `inside` (optional) is set to `true`, the method\n // instead returns the minimum zoom level on which the map view fits into\n // the given bounds in its entirety.\n getBoundsZoom: function (bounds, inside, padding) {\n // (LatLngBounds[, Boolean, Point]) -> Number\n bounds = toLatLngBounds(bounds);\n padding = toPoint(padding || [0, 0]);\n var zoom = this.getZoom() || 0,\n min = this.getMinZoom(),\n max = this.getMaxZoom(),\n nw = bounds.getNorthWest(),\n se = bounds.getSouthEast(),\n size = this.getSize().subtract(padding),\n boundsSize = toBounds(this.project(se, zoom), this.project(nw, zoom)).getSize(),\n snap = any3d ? this.options.zoomSnap : 1,\n scalex = size.x / boundsSize.x,\n scaley = size.y / boundsSize.y,\n scale = inside ? Math.max(scalex, scaley) : Math.min(scalex, scaley);\n zoom = this.getScaleZoom(scale, zoom);\n\n if (snap) {\n zoom = Math.round(zoom / (snap / 100)) * (snap / 100); // don't jump if within 1% of a snap level\n\n zoom = inside ? Math.ceil(zoom / snap) * snap : Math.floor(zoom / snap) * snap;\n }\n\n return Math.max(min, Math.min(max, zoom));\n },\n // @method getSize(): Point\n // Returns the current size of the map container (in pixels).\n getSize: function () {\n if (!this._size || this._sizeChanged) {\n this._size = new Point(this._container.clientWidth || 0, this._container.clientHeight || 0);\n this._sizeChanged = false;\n }\n\n return this._size.clone();\n },\n // @method getPixelBounds(): Bounds\n // Returns the bounds of the current map view in projected pixel\n // coordinates (sometimes useful in layer and overlay implementations).\n getPixelBounds: function (center, zoom) {\n var topLeftPoint = this._getTopLeftPoint(center, zoom);\n\n return new Bounds(topLeftPoint, topLeftPoint.add(this.getSize()));\n },\n // TODO: Check semantics - isn't the pixel origin the 0,0 coord relative to\n // the map pane? \"left point of the map layer\" can be confusing, specially\n // since there can be negative offsets.\n // @method getPixelOrigin(): Point\n // Returns the projected pixel coordinates of the top left point of\n // the map layer (useful in custom layer and overlay implementations).\n getPixelOrigin: function () {\n this._checkIfLoaded();\n\n return this._pixelOrigin;\n },\n // @method getPixelWorldBounds(zoom?: Number): Bounds\n // Returns the world's bounds in pixel coordinates for zoom level `zoom`.\n // If `zoom` is omitted, the map's current zoom level is used.\n getPixelWorldBounds: function (zoom) {\n return this.options.crs.getProjectedBounds(zoom === undefined ? this.getZoom() : zoom);\n },\n // @section Other Methods\n // @method getPane(pane: String|HTMLElement): HTMLElement\n // Returns a [map pane](#map-pane), given its name or its HTML element (its identity).\n getPane: function (pane) {\n return typeof pane === 'string' ? this._panes[pane] : pane;\n },\n // @method getPanes(): Object\n // Returns a plain object containing the names of all [panes](#map-pane) as keys and\n // the panes as values.\n getPanes: function () {\n return this._panes;\n },\n // @method getContainer: HTMLElement\n // Returns the HTML element that contains the map.\n getContainer: function () {\n return this._container;\n },\n // @section Conversion Methods\n // @method getZoomScale(toZoom: Number, fromZoom: Number): Number\n // Returns the scale factor to be applied to a map transition from zoom level\n // `fromZoom` to `toZoom`. Used internally to help with zoom animations.\n getZoomScale: function (toZoom, fromZoom) {\n // TODO replace with universal implementation after refactoring projections\n var crs = this.options.crs;\n fromZoom = fromZoom === undefined ? this._zoom : fromZoom;\n return crs.scale(toZoom) / crs.scale(fromZoom);\n },\n // @method getScaleZoom(scale: Number, fromZoom: Number): Number\n // Returns the zoom level that the map would end up at, if it is at `fromZoom`\n // level and everything is scaled by a factor of `scale`. Inverse of\n // [`getZoomScale`](#map-getZoomScale).\n getScaleZoom: function (scale, fromZoom) {\n var crs = this.options.crs;\n fromZoom = fromZoom === undefined ? this._zoom : fromZoom;\n var zoom = crs.zoom(scale * crs.scale(fromZoom));\n return isNaN(zoom) ? Infinity : zoom;\n },\n // @method project(latlng: LatLng, zoom: Number): Point\n // Projects a geographical coordinate `LatLng` according to the projection\n // of the map's CRS, then scales it according to `zoom` and the CRS's\n // `Transformation`. The result is pixel coordinate relative to\n // the CRS origin.\n project: function (latlng, zoom) {\n zoom = zoom === undefined ? this._zoom : zoom;\n return this.options.crs.latLngToPoint(toLatLng(latlng), zoom);\n },\n // @method unproject(point: Point, zoom: Number): LatLng\n // Inverse of [`project`](#map-project).\n unproject: function (point, zoom) {\n zoom = zoom === undefined ? this._zoom : zoom;\n return this.options.crs.pointToLatLng(toPoint(point), zoom);\n },\n // @method layerPointToLatLng(point: Point): LatLng\n // Given a pixel coordinate relative to the [origin pixel](#map-getpixelorigin),\n // returns the corresponding geographical coordinate (for the current zoom level).\n layerPointToLatLng: function (point) {\n var projectedPoint = toPoint(point).add(this.getPixelOrigin());\n return this.unproject(projectedPoint);\n },\n // @method latLngToLayerPoint(latlng: LatLng): Point\n // Given a geographical coordinate, returns the corresponding pixel coordinate\n // relative to the [origin pixel](#map-getpixelorigin).\n latLngToLayerPoint: function (latlng) {\n var projectedPoint = this.project(toLatLng(latlng))._round();\n\n return projectedPoint._subtract(this.getPixelOrigin());\n },\n // @method wrapLatLng(latlng: LatLng): LatLng\n // Returns a `LatLng` where `lat` and `lng` has been wrapped according to the\n // map's CRS's `wrapLat` and `wrapLng` properties, if they are outside the\n // CRS's bounds.\n // By default this means longitude is wrapped around the dateline so its\n // value is between -180 and +180 degrees.\n wrapLatLng: function (latlng) {\n return this.options.crs.wrapLatLng(toLatLng(latlng));\n },\n // @method wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds\n // Returns a `LatLngBounds` with the same size as the given one, ensuring that\n // its center is within the CRS's bounds.\n // By default this means the center longitude is wrapped around the dateline so its\n // value is between -180 and +180 degrees, and the majority of the bounds\n // overlaps the CRS's bounds.\n wrapLatLngBounds: function (latlng) {\n return this.options.crs.wrapLatLngBounds(toLatLngBounds(latlng));\n },\n // @method distance(latlng1: LatLng, latlng2: LatLng): Number\n // Returns the distance between two geographical coordinates according to\n // the map's CRS. By default this measures distance in meters.\n distance: function (latlng1, latlng2) {\n return this.options.crs.distance(toLatLng(latlng1), toLatLng(latlng2));\n },\n // @method containerPointToLayerPoint(point: Point): Point\n // Given a pixel coordinate relative to the map container, returns the corresponding\n // pixel coordinate relative to the [origin pixel](#map-getpixelorigin).\n containerPointToLayerPoint: function (point) {\n // (Point)\n return toPoint(point).subtract(this._getMapPanePos());\n },\n // @method layerPointToContainerPoint(point: Point): Point\n // Given a pixel coordinate relative to the [origin pixel](#map-getpixelorigin),\n // returns the corresponding pixel coordinate relative to the map container.\n layerPointToContainerPoint: function (point) {\n // (Point)\n return toPoint(point).add(this._getMapPanePos());\n },\n // @method containerPointToLatLng(point: Point): LatLng\n // Given a pixel coordinate relative to the map container, returns\n // the corresponding geographical coordinate (for the current zoom level).\n containerPointToLatLng: function (point) {\n var layerPoint = this.containerPointToLayerPoint(toPoint(point));\n return this.layerPointToLatLng(layerPoint);\n },\n // @method latLngToContainerPoint(latlng: LatLng): Point\n // Given a geographical coordinate, returns the corresponding pixel coordinate\n // relative to the map container.\n latLngToContainerPoint: function (latlng) {\n return this.layerPointToContainerPoint(this.latLngToLayerPoint(toLatLng(latlng)));\n },\n // @method mouseEventToContainerPoint(ev: MouseEvent): Point\n // Given a MouseEvent object, returns the pixel coordinate relative to the\n // map container where the event took place.\n mouseEventToContainerPoint: function (e) {\n return getMousePosition(e, this._container);\n },\n // @method mouseEventToLayerPoint(ev: MouseEvent): Point\n // Given a MouseEvent object, returns the pixel coordinate relative to\n // the [origin pixel](#map-getpixelorigin) where the event took place.\n mouseEventToLayerPoint: function (e) {\n return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e));\n },\n // @method mouseEventToLatLng(ev: MouseEvent): LatLng\n // Given a MouseEvent object, returns geographical coordinate where the\n // event took place.\n mouseEventToLatLng: function (e) {\n // (MouseEvent)\n return this.layerPointToLatLng(this.mouseEventToLayerPoint(e));\n },\n // map initialization methods\n _initContainer: function (id) {\n var container = this._container = get(id);\n\n if (!container) {\n throw new Error('Map container not found.');\n } else if (container._leaflet_id) {\n throw new Error('Map container is already initialized.');\n }\n\n on(container, 'scroll', this._onScroll, this);\n this._containerId = stamp(container);\n },\n _initLayout: function () {\n var container = this._container;\n this._fadeAnimated = this.options.fadeAnimation && any3d;\n addClass(container, 'leaflet-container' + (touch ? ' leaflet-touch' : '') + (retina ? ' leaflet-retina' : '') + (ielt9 ? ' leaflet-oldie' : '') + (safari ? ' leaflet-safari' : '') + (this._fadeAnimated ? ' leaflet-fade-anim' : ''));\n var position = getStyle(container, 'position');\n\n if (position !== 'absolute' && position !== 'relative' && position !== 'fixed') {\n container.style.position = 'relative';\n }\n\n this._initPanes();\n\n if (this._initControlPos) {\n this._initControlPos();\n }\n },\n _initPanes: function () {\n var panes = this._panes = {};\n this._paneRenderers = {}; // @section\n //\n // Panes are DOM elements used to control the ordering of layers on the map. You\n // can access panes with [`map.getPane`](#map-getpane) or\n // [`map.getPanes`](#map-getpanes) methods. New panes can be created with the\n // [`map.createPane`](#map-createpane) method.\n //\n // Every map has the following default panes that differ only in zIndex.\n //\n // @pane mapPane: HTMLElement = 'auto'\n // Pane that contains all other map panes\n\n this._mapPane = this.createPane('mapPane', this._container);\n setPosition(this._mapPane, new Point(0, 0)); // @pane tilePane: HTMLElement = 200\n // Pane for `GridLayer`s and `TileLayer`s\n\n this.createPane('tilePane'); // @pane overlayPane: HTMLElement = 400\n // Pane for vectors (`Path`s, like `Polyline`s and `Polygon`s), `ImageOverlay`s and `VideoOverlay`s\n\n this.createPane('shadowPane'); // @pane shadowPane: HTMLElement = 500\n // Pane for overlay shadows (e.g. `Marker` shadows)\n\n this.createPane('overlayPane'); // @pane markerPane: HTMLElement = 600\n // Pane for `Icon`s of `Marker`s\n\n this.createPane('markerPane'); // @pane tooltipPane: HTMLElement = 650\n // Pane for `Tooltip`s.\n\n this.createPane('tooltipPane'); // @pane popupPane: HTMLElement = 700\n // Pane for `Popup`s.\n\n this.createPane('popupPane');\n\n if (!this.options.markerZoomAnimation) {\n addClass(panes.markerPane, 'leaflet-zoom-hide');\n addClass(panes.shadowPane, 'leaflet-zoom-hide');\n }\n },\n // private methods that modify map state\n // @section Map state change events\n _resetView: function (center, zoom) {\n setPosition(this._mapPane, new Point(0, 0));\n var loading = !this._loaded;\n this._loaded = true;\n zoom = this._limitZoom(zoom);\n this.fire('viewprereset');\n var zoomChanged = this._zoom !== zoom;\n\n this._moveStart(zoomChanged, false)._move(center, zoom)._moveEnd(zoomChanged); // @event viewreset: Event\n // Fired when the map needs to redraw its content (this usually happens\n // on map zoom or load). Very useful for creating custom overlays.\n\n\n this.fire('viewreset'); // @event load: Event\n // Fired when the map is initialized (when its center and zoom are set\n // for the first time).\n\n if (loading) {\n this.fire('load');\n }\n },\n _moveStart: function (zoomChanged, noMoveStart) {\n // @event zoomstart: Event\n // Fired when the map zoom is about to change (e.g. before zoom animation).\n // @event movestart: Event\n // Fired when the view of the map starts changing (e.g. user starts dragging the map).\n if (zoomChanged) {\n this.fire('zoomstart');\n }\n\n if (!noMoveStart) {\n this.fire('movestart');\n }\n\n return this;\n },\n _move: function (center, zoom, data) {\n if (zoom === undefined) {\n zoom = this._zoom;\n }\n\n var zoomChanged = this._zoom !== zoom;\n this._zoom = zoom;\n this._lastCenter = center;\n this._pixelOrigin = this._getNewPixelOrigin(center); // @event zoom: Event\n // Fired repeatedly during any change in zoom level, including zoom\n // and fly animations.\n\n if (zoomChanged || data && data.pinch) {\n // Always fire 'zoom' if pinching because #3530\n this.fire('zoom', data);\n } // @event move: Event\n // Fired repeatedly during any movement of the map, including pan and\n // fly animations.\n\n\n return this.fire('move', data);\n },\n _moveEnd: function (zoomChanged) {\n // @event zoomend: Event\n // Fired when the map has changed, after any animations.\n if (zoomChanged) {\n this.fire('zoomend');\n } // @event moveend: Event\n // Fired when the center of the map stops changing (e.g. user stopped\n // dragging the map).\n\n\n return this.fire('moveend');\n },\n _stop: function () {\n cancelAnimFrame(this._flyToFrame);\n\n if (this._panAnim) {\n this._panAnim.stop();\n }\n\n return this;\n },\n _rawPanBy: function (offset) {\n setPosition(this._mapPane, this._getMapPanePos().subtract(offset));\n },\n _getZoomSpan: function () {\n return this.getMaxZoom() - this.getMinZoom();\n },\n _panInsideMaxBounds: function () {\n if (!this._enforcingBounds) {\n this.panInsideBounds(this.options.maxBounds);\n }\n },\n _checkIfLoaded: function () {\n if (!this._loaded) {\n throw new Error('Set map center and zoom first.');\n }\n },\n // DOM event handling\n // @section Interaction events\n _initEvents: function (remove$$1) {\n this._targets = {};\n this._targets[stamp(this._container)] = this;\n var onOff = remove$$1 ? off : on; // @event click: MouseEvent\n // Fired when the user clicks (or taps) the map.\n // @event dblclick: MouseEvent\n // Fired when the user double-clicks (or double-taps) the map.\n // @event mousedown: MouseEvent\n // Fired when the user pushes the mouse button on the map.\n // @event mouseup: MouseEvent\n // Fired when the user releases the mouse button on the map.\n // @event mouseover: MouseEvent\n // Fired when the mouse enters the map.\n // @event mouseout: MouseEvent\n // Fired when the mouse leaves the map.\n // @event mousemove: MouseEvent\n // Fired while the mouse moves over the map.\n // @event contextmenu: MouseEvent\n // Fired when the user pushes the right mouse button on the map, prevents\n // default browser context menu from showing if there are listeners on\n // this event. Also fired on mobile when the user holds a single touch\n // for a second (also called long press).\n // @event keypress: KeyboardEvent\n // Fired when the user presses a key from the keyboard while the map is focused.\n\n onOff(this._container, 'click dblclick mousedown mouseup ' + 'mouseover mouseout mousemove contextmenu keypress', this._handleDOMEvent, this);\n\n if (this.options.trackResize) {\n onOff(window, 'resize', this._onResize, this);\n }\n\n if (any3d && this.options.transform3DLimit) {\n (remove$$1 ? this.off : this.on).call(this, 'moveend', this._onMoveEnd);\n }\n },\n _onResize: function () {\n cancelAnimFrame(this._resizeRequest);\n this._resizeRequest = requestAnimFrame(function () {\n this.invalidateSize({\n debounceMoveend: true\n });\n }, this);\n },\n _onScroll: function () {\n this._container.scrollTop = 0;\n this._container.scrollLeft = 0;\n },\n _onMoveEnd: function () {\n var pos = this._getMapPanePos();\n\n if (Math.max(Math.abs(pos.x), Math.abs(pos.y)) >= this.options.transform3DLimit) {\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1203873 but Webkit also have\n // a pixel offset on very high values, see: http://jsfiddle.net/dg6r5hhb/\n this._resetView(this.getCenter(), this.getZoom());\n }\n },\n _findEventTargets: function (e, type) {\n var targets = [],\n target,\n isHover = type === 'mouseout' || type === 'mouseover',\n src = e.target || e.srcElement,\n dragging = false;\n\n while (src) {\n target = this._targets[stamp(src)];\n\n if (target && (type === 'click' || type === 'preclick') && !e._simulated && this._draggableMoved(target)) {\n // Prevent firing click after you just dragged an object.\n dragging = true;\n break;\n }\n\n if (target && target.listens(type, true)) {\n if (isHover && !isExternalTarget(src, e)) {\n break;\n }\n\n targets.push(target);\n\n if (isHover) {\n break;\n }\n }\n\n if (src === this._container) {\n break;\n }\n\n src = src.parentNode;\n }\n\n if (!targets.length && !dragging && !isHover && isExternalTarget(src, e)) {\n targets = [this];\n }\n\n return targets;\n },\n _handleDOMEvent: function (e) {\n if (!this._loaded || skipped(e)) {\n return;\n }\n\n var type = e.type;\n\n if (type === 'mousedown' || type === 'keypress') {\n // prevents outline when clicking on keyboard-focusable element\n preventOutline(e.target || e.srcElement);\n }\n\n this._fireDOMEvent(e, type);\n },\n _mouseEvents: ['click', 'dblclick', 'mouseover', 'mouseout', 'contextmenu'],\n _fireDOMEvent: function (e, type, targets) {\n if (e.type === 'click') {\n // Fire a synthetic 'preclick' event which propagates up (mainly for closing popups).\n // @event preclick: MouseEvent\n // Fired before mouse click on the map (sometimes useful when you\n // want something to happen on click before any existing click\n // handlers start running).\n var synth = extend({}, e);\n synth.type = 'preclick';\n\n this._fireDOMEvent(synth, synth.type, targets);\n }\n\n if (e._stopped) {\n return;\n } // Find the layer the event is propagating from and its parents.\n\n\n targets = (targets || []).concat(this._findEventTargets(e, type));\n\n if (!targets.length) {\n return;\n }\n\n var target = targets[0];\n\n if (type === 'contextmenu' && target.listens(type, true)) {\n preventDefault(e);\n }\n\n var data = {\n originalEvent: e\n };\n\n if (e.type !== 'keypress') {\n var isMarker = target.getLatLng && (!target._radius || target._radius <= 10);\n data.containerPoint = isMarker ? this.latLngToContainerPoint(target.getLatLng()) : this.mouseEventToContainerPoint(e);\n data.layerPoint = this.containerPointToLayerPoint(data.containerPoint);\n data.latlng = isMarker ? target.getLatLng() : this.layerPointToLatLng(data.layerPoint);\n }\n\n for (var i = 0; i < targets.length; i++) {\n targets[i].fire(type, data, true);\n\n if (data.originalEvent._stopped || targets[i].options.bubblingMouseEvents === false && indexOf(this._mouseEvents, type) !== -1) {\n return;\n }\n }\n },\n _draggableMoved: function (obj) {\n obj = obj.dragging && obj.dragging.enabled() ? obj : this;\n return obj.dragging && obj.dragging.moved() || this.boxZoom && this.boxZoom.moved();\n },\n _clearHandlers: function () {\n for (var i = 0, len = this._handlers.length; i < len; i++) {\n this._handlers[i].disable();\n }\n },\n // @section Other Methods\n // @method whenReady(fn: Function, context?: Object): this\n // Runs the given function `fn` when the map gets initialized with\n // a view (center and zoom) and at least one layer, or immediately\n // if it's already initialized, optionally passing a function context.\n whenReady: function (callback, context) {\n if (this._loaded) {\n callback.call(context || this, {\n target: this\n });\n } else {\n this.on('load', callback, context);\n }\n\n return this;\n },\n // private methods for getting map state\n _getMapPanePos: function () {\n return getPosition(this._mapPane) || new Point(0, 0);\n },\n _moved: function () {\n var pos = this._getMapPanePos();\n\n return pos && !pos.equals([0, 0]);\n },\n _getTopLeftPoint: function (center, zoom) {\n var pixelOrigin = center && zoom !== undefined ? this._getNewPixelOrigin(center, zoom) : this.getPixelOrigin();\n return pixelOrigin.subtract(this._getMapPanePos());\n },\n _getNewPixelOrigin: function (center, zoom) {\n var viewHalf = this.getSize()._divideBy(2);\n\n return this.project(center, zoom)._subtract(viewHalf)._add(this._getMapPanePos())._round();\n },\n _latLngToNewLayerPoint: function (latlng, zoom, center) {\n var topLeft = this._getNewPixelOrigin(center, zoom);\n\n return this.project(latlng, zoom)._subtract(topLeft);\n },\n _latLngBoundsToNewLayerBounds: function (latLngBounds, zoom, center) {\n var topLeft = this._getNewPixelOrigin(center, zoom);\n\n return toBounds([this.project(latLngBounds.getSouthWest(), zoom)._subtract(topLeft), this.project(latLngBounds.getNorthWest(), zoom)._subtract(topLeft), this.project(latLngBounds.getSouthEast(), zoom)._subtract(topLeft), this.project(latLngBounds.getNorthEast(), zoom)._subtract(topLeft)]);\n },\n // layer point of the current center\n _getCenterLayerPoint: function () {\n return this.containerPointToLayerPoint(this.getSize()._divideBy(2));\n },\n // offset of the specified place to the current center in pixels\n _getCenterOffset: function (latlng) {\n return this.latLngToLayerPoint(latlng).subtract(this._getCenterLayerPoint());\n },\n // adjust center for view to get inside bounds\n _limitCenter: function (center, zoom, bounds) {\n if (!bounds) {\n return center;\n }\n\n var centerPoint = this.project(center, zoom),\n viewHalf = this.getSize().divideBy(2),\n viewBounds = new Bounds(centerPoint.subtract(viewHalf), centerPoint.add(viewHalf)),\n offset = this._getBoundsOffset(viewBounds, bounds, zoom); // If offset is less than a pixel, ignore.\n // This prevents unstable projections from getting into\n // an infinite loop of tiny offsets.\n\n\n if (offset.round().equals([0, 0])) {\n return center;\n }\n\n return this.unproject(centerPoint.add(offset), zoom);\n },\n // adjust offset for view to get inside bounds\n _limitOffset: function (offset, bounds) {\n if (!bounds) {\n return offset;\n }\n\n var viewBounds = this.getPixelBounds(),\n newBounds = new Bounds(viewBounds.min.add(offset), viewBounds.max.add(offset));\n return offset.add(this._getBoundsOffset(newBounds, bounds));\n },\n // returns offset needed for pxBounds to get inside maxBounds at a specified zoom\n _getBoundsOffset: function (pxBounds, maxBounds, zoom) {\n var projectedMaxBounds = toBounds(this.project(maxBounds.getNorthEast(), zoom), this.project(maxBounds.getSouthWest(), zoom)),\n minOffset = projectedMaxBounds.min.subtract(pxBounds.min),\n maxOffset = projectedMaxBounds.max.subtract(pxBounds.max),\n dx = this._rebound(minOffset.x, -maxOffset.x),\n dy = this._rebound(minOffset.y, -maxOffset.y);\n\n return new Point(dx, dy);\n },\n _rebound: function (left, right) {\n return left + right > 0 ? Math.round(left - right) / 2 : Math.max(0, Math.ceil(left)) - Math.max(0, Math.floor(right));\n },\n _limitZoom: function (zoom) {\n var min = this.getMinZoom(),\n max = this.getMaxZoom(),\n snap = any3d ? this.options.zoomSnap : 1;\n\n if (snap) {\n zoom = Math.round(zoom / snap) * snap;\n }\n\n return Math.max(min, Math.min(max, zoom));\n },\n _onPanTransitionStep: function () {\n this.fire('move');\n },\n _onPanTransitionEnd: function () {\n removeClass(this._mapPane, 'leaflet-pan-anim');\n this.fire('moveend');\n },\n _tryAnimatedPan: function (center, options) {\n // difference between the new and current centers in pixels\n var offset = this._getCenterOffset(center)._trunc(); // don't animate too far unless animate: true specified in options\n\n\n if ((options && options.animate) !== true && !this.getSize().contains(offset)) {\n return false;\n }\n\n this.panBy(offset, options);\n return true;\n },\n _createAnimProxy: function () {\n var proxy = this._proxy = create$1('div', 'leaflet-proxy leaflet-zoom-animated');\n\n this._panes.mapPane.appendChild(proxy);\n\n this.on('zoomanim', function (e) {\n var prop = TRANSFORM,\n transform = this._proxy.style[prop];\n setTransform(this._proxy, this.project(e.center, e.zoom), this.getZoomScale(e.zoom, 1)); // workaround for case when transform is the same and so transitionend event is not fired\n\n if (transform === this._proxy.style[prop] && this._animatingZoom) {\n this._onZoomTransitionEnd();\n }\n }, this);\n this.on('load moveend', function () {\n var c = this.getCenter(),\n z = this.getZoom();\n setTransform(this._proxy, this.project(c, z), this.getZoomScale(z, 1));\n }, this);\n\n this._on('unload', this._destroyAnimProxy, this);\n },\n _destroyAnimProxy: function () {\n remove(this._proxy);\n delete this._proxy;\n },\n _catchTransitionEnd: function (e) {\n if (this._animatingZoom && e.propertyName.indexOf('transform') >= 0) {\n this._onZoomTransitionEnd();\n }\n },\n _nothingToAnimate: function () {\n return !this._container.getElementsByClassName('leaflet-zoom-animated').length;\n },\n _tryAnimatedZoom: function (center, zoom, options) {\n if (this._animatingZoom) {\n return true;\n }\n\n options = options || {}; // don't animate if disabled, not supported or zoom difference is too large\n\n if (!this._zoomAnimated || options.animate === false || this._nothingToAnimate() || Math.abs(zoom - this._zoom) > this.options.zoomAnimationThreshold) {\n return false;\n } // offset is the pixel coords of the zoom origin relative to the current center\n\n\n var scale = this.getZoomScale(zoom),\n offset = this._getCenterOffset(center)._divideBy(1 - 1 / scale); // don't animate if the zoom origin isn't within one screen from the current center, unless forced\n\n\n if (options.animate !== true && !this.getSize().contains(offset)) {\n return false;\n }\n\n requestAnimFrame(function () {\n this._moveStart(true, false)._animateZoom(center, zoom, true);\n }, this);\n return true;\n },\n _animateZoom: function (center, zoom, startAnim, noUpdate) {\n if (!this._mapPane) {\n return;\n }\n\n if (startAnim) {\n this._animatingZoom = true; // remember what center/zoom to set after animation\n\n this._animateToCenter = center;\n this._animateToZoom = zoom;\n addClass(this._mapPane, 'leaflet-zoom-anim');\n } // @event zoomanim: ZoomAnimEvent\n // Fired at least once per zoom animation. For continous zoom, like pinch zooming, fired once per frame during zoom.\n\n\n this.fire('zoomanim', {\n center: center,\n zoom: zoom,\n noUpdate: noUpdate\n }); // Work around webkit not firing 'transitionend', see https://github.com/Leaflet/Leaflet/issues/3689, 2693\n\n setTimeout(bind(this._onZoomTransitionEnd, this), 250);\n },\n _onZoomTransitionEnd: function () {\n if (!this._animatingZoom) {\n return;\n }\n\n if (this._mapPane) {\n removeClass(this._mapPane, 'leaflet-zoom-anim');\n }\n\n this._animatingZoom = false;\n\n this._move(this._animateToCenter, this._animateToZoom); // This anim frame should prevent an obscure iOS webkit tile loading race condition.\n\n\n requestAnimFrame(function () {\n this._moveEnd(true);\n }, this);\n }\n }); // @section\n // @factory L.map(id: String, options?: Map options)\n // Instantiates a map object given the DOM ID of a `
` element\n // and optionally an object literal with `Map options`.\n //\n // @alternative\n // @factory L.map(el: HTMLElement, options?: Map options)\n // Instantiates a map object given an instance of a `
` HTML element\n // and optionally an object literal with `Map options`.\n\n function createMap(id, options) {\n return new Map(id, options);\n }\n /*\r\n * @class Control\r\n * @aka L.Control\r\n * @inherits Class\r\n *\r\n * L.Control is a base class for implementing map controls. Handles positioning.\r\n * All other controls extend from this class.\r\n */\n\n\n var Control = Class.extend({\n // @section\n // @aka Control options\n options: {\n // @option position: String = 'topright'\n // The position of the control (one of the map corners). Possible values are `'topleft'`,\n // `'topright'`, `'bottomleft'` or `'bottomright'`\n position: 'topright'\n },\n initialize: function (options) {\n setOptions(this, options);\n },\n\n /* @section\r\n * Classes extending L.Control will inherit the following methods:\r\n *\r\n * @method getPosition: string\r\n * Returns the position of the control.\r\n */\n getPosition: function () {\n return this.options.position;\n },\n // @method setPosition(position: string): this\n // Sets the position of the control.\n setPosition: function (position) {\n var map = this._map;\n\n if (map) {\n map.removeControl(this);\n }\n\n this.options.position = position;\n\n if (map) {\n map.addControl(this);\n }\n\n return this;\n },\n // @method getContainer: HTMLElement\n // Returns the HTMLElement that contains the control.\n getContainer: function () {\n return this._container;\n },\n // @method addTo(map: Map): this\n // Adds the control to the given map.\n addTo: function (map) {\n this.remove();\n this._map = map;\n var container = this._container = this.onAdd(map),\n pos = this.getPosition(),\n corner = map._controlCorners[pos];\n addClass(container, 'leaflet-control');\n\n if (pos.indexOf('bottom') !== -1) {\n corner.insertBefore(container, corner.firstChild);\n } else {\n corner.appendChild(container);\n }\n\n return this;\n },\n // @method remove: this\n // Removes the control from the map it is currently active on.\n remove: function () {\n if (!this._map) {\n return this;\n }\n\n remove(this._container);\n\n if (this.onRemove) {\n this.onRemove(this._map);\n }\n\n this._map = null;\n return this;\n },\n _refocusOnMap: function (e) {\n // if map exists and event is not a keyboard event\n if (this._map && e && e.screenX > 0 && e.screenY > 0) {\n this._map.getContainer().focus();\n }\n }\n });\n\n var control = function (options) {\n return new Control(options);\n };\n /* @section Extension methods\r\n * @uninheritable\r\n *\r\n * Every control should extend from `L.Control` and (re-)implement the following methods.\r\n *\r\n * @method onAdd(map: Map): HTMLElement\r\n * Should return the container DOM element for the control and add listeners on relevant map events. Called on [`control.addTo(map)`](#control-addTo).\r\n *\r\n * @method onRemove(map: Map)\r\n * Optional method. Should contain all clean up code that removes the listeners previously added in [`onAdd`](#control-onadd). Called on [`control.remove()`](#control-remove).\r\n */\n\n /* @namespace Map\r\n * @section Methods for Layers and Controls\r\n */\n\n\n Map.include({\n // @method addControl(control: Control): this\n // Adds the given control to the map\n addControl: function (control) {\n control.addTo(this);\n return this;\n },\n // @method removeControl(control: Control): this\n // Removes the given control from the map\n removeControl: function (control) {\n control.remove();\n return this;\n },\n _initControlPos: function () {\n var corners = this._controlCorners = {},\n l = 'leaflet-',\n container = this._controlContainer = create$1('div', l + 'control-container', this._container);\n\n function createCorner(vSide, hSide) {\n var className = l + vSide + ' ' + l + hSide;\n corners[vSide + hSide] = create$1('div', className, container);\n }\n\n createCorner('top', 'left');\n createCorner('top', 'right');\n createCorner('bottom', 'left');\n createCorner('bottom', 'right');\n },\n _clearControlPos: function () {\n for (var i in this._controlCorners) {\n remove(this._controlCorners[i]);\n }\n\n remove(this._controlContainer);\n delete this._controlCorners;\n delete this._controlContainer;\n }\n });\n /*\r\n * @class Control.Layers\r\n * @aka L.Control.Layers\r\n * @inherits Control\r\n *\r\n * The layers control gives users the ability to switch between different base layers and switch overlays on/off (check out the [detailed example](http://leafletjs.com/examples/layers-control/)). Extends `Control`.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * var baseLayers = {\r\n * \t\"Mapbox\": mapbox,\r\n * \t\"OpenStreetMap\": osm\r\n * };\r\n *\r\n * var overlays = {\r\n * \t\"Marker\": marker,\r\n * \t\"Roads\": roadsLayer\r\n * };\r\n *\r\n * L.control.layers(baseLayers, overlays).addTo(map);\r\n * ```\r\n *\r\n * The `baseLayers` and `overlays` parameters are object literals with layer names as keys and `Layer` objects as values:\r\n *\r\n * ```js\r\n * {\r\n * \"\": layer1,\r\n * \"\": layer2\r\n * }\r\n * ```\r\n *\r\n * The layer names can contain HTML, which allows you to add additional styling to the items:\r\n *\r\n * ```js\r\n * {\" My Layer\": myLayer}\r\n * ```\r\n */\n\n var Layers = Control.extend({\n // @section\n // @aka Control.Layers options\n options: {\n // @option collapsed: Boolean = true\n // If `true`, the control will be collapsed into an icon and expanded on mouse hover or touch.\n collapsed: true,\n position: 'topright',\n // @option autoZIndex: Boolean = true\n // If `true`, the control will assign zIndexes in increasing order to all of its layers so that the order is preserved when switching them on/off.\n autoZIndex: true,\n // @option hideSingleBase: Boolean = false\n // If `true`, the base layers in the control will be hidden when there is only one.\n hideSingleBase: false,\n // @option sortLayers: Boolean = false\n // Whether to sort the layers. When `false`, layers will keep the order\n // in which they were added to the control.\n sortLayers: false,\n // @option sortFunction: Function = *\n // A [compare function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)\n // that will be used for sorting the layers, when `sortLayers` is `true`.\n // The function receives both the `L.Layer` instances and their names, as in\n // `sortFunction(layerA, layerB, nameA, nameB)`.\n // By default, it sorts layers alphabetically by their name.\n sortFunction: function (layerA, layerB, nameA, nameB) {\n return nameA < nameB ? -1 : nameB < nameA ? 1 : 0;\n }\n },\n initialize: function (baseLayers, overlays, options) {\n setOptions(this, options);\n this._layerControlInputs = [];\n this._layers = [];\n this._lastZIndex = 0;\n this._handlingClick = false;\n\n for (var i in baseLayers) {\n this._addLayer(baseLayers[i], i);\n }\n\n for (i in overlays) {\n this._addLayer(overlays[i], i, true);\n }\n },\n onAdd: function (map) {\n this._initLayout();\n\n this._update();\n\n this._map = map;\n map.on('zoomend', this._checkDisabledLayers, this);\n\n for (var i = 0; i < this._layers.length; i++) {\n this._layers[i].layer.on('add remove', this._onLayerChange, this);\n }\n\n return this._container;\n },\n addTo: function (map) {\n Control.prototype.addTo.call(this, map); // Trigger expand after Layers Control has been inserted into DOM so that is now has an actual height.\n\n return this._expandIfNotCollapsed();\n },\n onRemove: function () {\n this._map.off('zoomend', this._checkDisabledLayers, this);\n\n for (var i = 0; i < this._layers.length; i++) {\n this._layers[i].layer.off('add remove', this._onLayerChange, this);\n }\n },\n // @method addBaseLayer(layer: Layer, name: String): this\n // Adds a base layer (radio button entry) with the given name to the control.\n addBaseLayer: function (layer, name) {\n this._addLayer(layer, name);\n\n return this._map ? this._update() : this;\n },\n // @method addOverlay(layer: Layer, name: String): this\n // Adds an overlay (checkbox entry) with the given name to the control.\n addOverlay: function (layer, name) {\n this._addLayer(layer, name, true);\n\n return this._map ? this._update() : this;\n },\n // @method removeLayer(layer: Layer): this\n // Remove the given layer from the control.\n removeLayer: function (layer) {\n layer.off('add remove', this._onLayerChange, this);\n\n var obj = this._getLayer(stamp(layer));\n\n if (obj) {\n this._layers.splice(this._layers.indexOf(obj), 1);\n }\n\n return this._map ? this._update() : this;\n },\n // @method expand(): this\n // Expand the control container if collapsed.\n expand: function () {\n addClass(this._container, 'leaflet-control-layers-expanded');\n this._section.style.height = null;\n var acceptableHeight = this._map.getSize().y - (this._container.offsetTop + 50);\n\n if (acceptableHeight < this._section.clientHeight) {\n addClass(this._section, 'leaflet-control-layers-scrollbar');\n this._section.style.height = acceptableHeight + 'px';\n } else {\n removeClass(this._section, 'leaflet-control-layers-scrollbar');\n }\n\n this._checkDisabledLayers();\n\n return this;\n },\n // @method collapse(): this\n // Collapse the control container if expanded.\n collapse: function () {\n removeClass(this._container, 'leaflet-control-layers-expanded');\n return this;\n },\n _initLayout: function () {\n var className = 'leaflet-control-layers',\n container = this._container = create$1('div', className),\n collapsed = this.options.collapsed; // makes this work on IE touch devices by stopping it from firing a mouseout event when the touch is released\n\n container.setAttribute('aria-haspopup', true);\n disableClickPropagation(container);\n disableScrollPropagation(container);\n var section = this._section = create$1('section', className + '-list');\n\n if (collapsed) {\n this._map.on('click', this.collapse, this);\n\n if (!android) {\n on(container, {\n mouseenter: this.expand,\n mouseleave: this.collapse\n }, this);\n }\n }\n\n var link = this._layersLink = create$1('a', className + '-toggle', container);\n link.href = '#';\n link.title = 'Layers';\n\n if (touch) {\n on(link, 'click', stop);\n on(link, 'click', this.expand, this);\n } else {\n on(link, 'focus', this.expand, this);\n }\n\n if (!collapsed) {\n this.expand();\n }\n\n this._baseLayersList = create$1('div', className + '-base', section);\n this._separator = create$1('div', className + '-separator', section);\n this._overlaysList = create$1('div', className + '-overlays', section);\n container.appendChild(section);\n },\n _getLayer: function (id) {\n for (var i = 0; i < this._layers.length; i++) {\n if (this._layers[i] && stamp(this._layers[i].layer) === id) {\n return this._layers[i];\n }\n }\n },\n _addLayer: function (layer, name, overlay) {\n if (this._map) {\n layer.on('add remove', this._onLayerChange, this);\n }\n\n this._layers.push({\n layer: layer,\n name: name,\n overlay: overlay\n });\n\n if (this.options.sortLayers) {\n this._layers.sort(bind(function (a, b) {\n return this.options.sortFunction(a.layer, b.layer, a.name, b.name);\n }, this));\n }\n\n if (this.options.autoZIndex && layer.setZIndex) {\n this._lastZIndex++;\n layer.setZIndex(this._lastZIndex);\n }\n\n this._expandIfNotCollapsed();\n },\n _update: function () {\n if (!this._container) {\n return this;\n }\n\n empty(this._baseLayersList);\n empty(this._overlaysList);\n this._layerControlInputs = [];\n var baseLayersPresent,\n overlaysPresent,\n i,\n obj,\n baseLayersCount = 0;\n\n for (i = 0; i < this._layers.length; i++) {\n obj = this._layers[i];\n\n this._addItem(obj);\n\n overlaysPresent = overlaysPresent || obj.overlay;\n baseLayersPresent = baseLayersPresent || !obj.overlay;\n baseLayersCount += !obj.overlay ? 1 : 0;\n } // Hide base layers section if there's only one layer.\n\n\n if (this.options.hideSingleBase) {\n baseLayersPresent = baseLayersPresent && baseLayersCount > 1;\n this._baseLayersList.style.display = baseLayersPresent ? '' : 'none';\n }\n\n this._separator.style.display = overlaysPresent && baseLayersPresent ? '' : 'none';\n return this;\n },\n _onLayerChange: function (e) {\n if (!this._handlingClick) {\n this._update();\n }\n\n var obj = this._getLayer(stamp(e.target)); // @namespace Map\n // @section Layer events\n // @event baselayerchange: LayersControlEvent\n // Fired when the base layer is changed through the [layer control](#control-layers).\n // @event overlayadd: LayersControlEvent\n // Fired when an overlay is selected through the [layer control](#control-layers).\n // @event overlayremove: LayersControlEvent\n // Fired when an overlay is deselected through the [layer control](#control-layers).\n // @namespace Control.Layers\n\n\n var type = obj.overlay ? e.type === 'add' ? 'overlayadd' : 'overlayremove' : e.type === 'add' ? 'baselayerchange' : null;\n\n if (type) {\n this._map.fire(type, obj);\n }\n },\n // IE7 bugs out if you create a radio dynamically, so you have to do it this hacky way (see http://bit.ly/PqYLBe)\n _createRadioElement: function (name, checked) {\n var radioHtml = '';\n var radioFragment = document.createElement('div');\n radioFragment.innerHTML = radioHtml;\n return radioFragment.firstChild;\n },\n _addItem: function (obj) {\n var label = document.createElement('label'),\n checked = this._map.hasLayer(obj.layer),\n input;\n\n if (obj.overlay) {\n input = document.createElement('input');\n input.type = 'checkbox';\n input.className = 'leaflet-control-layers-selector';\n input.defaultChecked = checked;\n } else {\n input = this._createRadioElement('leaflet-base-layers', checked);\n }\n\n this._layerControlInputs.push(input);\n\n input.layerId = stamp(obj.layer);\n on(input, 'click', this._onInputClick, this);\n var name = document.createElement('span');\n name.innerHTML = ' ' + obj.name; // Helps from preventing layer control flicker when checkboxes are disabled\n // https://github.com/Leaflet/Leaflet/issues/2771\n\n var holder = document.createElement('div');\n label.appendChild(holder);\n holder.appendChild(input);\n holder.appendChild(name);\n var container = obj.overlay ? this._overlaysList : this._baseLayersList;\n container.appendChild(label);\n\n this._checkDisabledLayers();\n\n return label;\n },\n _onInputClick: function () {\n var inputs = this._layerControlInputs,\n input,\n layer;\n var addedLayers = [],\n removedLayers = [];\n this._handlingClick = true;\n\n for (var i = inputs.length - 1; i >= 0; i--) {\n input = inputs[i];\n layer = this._getLayer(input.layerId).layer;\n\n if (input.checked) {\n addedLayers.push(layer);\n } else if (!input.checked) {\n removedLayers.push(layer);\n }\n } // Bugfix issue 2318: Should remove all old layers before readding new ones\n\n\n for (i = 0; i < removedLayers.length; i++) {\n if (this._map.hasLayer(removedLayers[i])) {\n this._map.removeLayer(removedLayers[i]);\n }\n }\n\n for (i = 0; i < addedLayers.length; i++) {\n if (!this._map.hasLayer(addedLayers[i])) {\n this._map.addLayer(addedLayers[i]);\n }\n }\n\n this._handlingClick = false;\n\n this._refocusOnMap();\n },\n _checkDisabledLayers: function () {\n var inputs = this._layerControlInputs,\n input,\n layer,\n zoom = this._map.getZoom();\n\n for (var i = inputs.length - 1; i >= 0; i--) {\n input = inputs[i];\n layer = this._getLayer(input.layerId).layer;\n input.disabled = layer.options.minZoom !== undefined && zoom < layer.options.minZoom || layer.options.maxZoom !== undefined && zoom > layer.options.maxZoom;\n }\n },\n _expandIfNotCollapsed: function () {\n if (this._map && !this.options.collapsed) {\n this.expand();\n }\n\n return this;\n },\n _expand: function () {\n // Backward compatibility, remove me in 1.1.\n return this.expand();\n },\n _collapse: function () {\n // Backward compatibility, remove me in 1.1.\n return this.collapse();\n }\n }); // @factory L.control.layers(baselayers?: Object, overlays?: Object, options?: Control.Layers options)\n // Creates an attribution control with the given layers. Base layers will be switched with radio buttons, while overlays will be switched with checkboxes. Note that all base layers should be passed in the base layers object, but only one should be added to the map during map instantiation.\n\n var layers = function (baseLayers, overlays, options) {\n return new Layers(baseLayers, overlays, options);\n };\n /*\r\n * @class Control.Zoom\r\n * @aka L.Control.Zoom\r\n * @inherits Control\r\n *\r\n * A basic zoom control with two buttons (zoom in and zoom out). It is put on the map by default unless you set its [`zoomControl` option](#map-zoomcontrol) to `false`. Extends `Control`.\r\n */\n\n\n var Zoom = Control.extend({\n // @section\n // @aka Control.Zoom options\n options: {\n position: 'topleft',\n // @option zoomInText: String = '+'\n // The text set on the 'zoom in' button.\n zoomInText: '+',\n // @option zoomInTitle: String = 'Zoom in'\n // The title set on the 'zoom in' button.\n zoomInTitle: 'Zoom in',\n // @option zoomOutText: String = '−'\n // The text set on the 'zoom out' button.\n zoomOutText: '−',\n // @option zoomOutTitle: String = 'Zoom out'\n // The title set on the 'zoom out' button.\n zoomOutTitle: 'Zoom out'\n },\n onAdd: function (map) {\n var zoomName = 'leaflet-control-zoom',\n container = create$1('div', zoomName + ' leaflet-bar'),\n options = this.options;\n this._zoomInButton = this._createButton(options.zoomInText, options.zoomInTitle, zoomName + '-in', container, this._zoomIn);\n this._zoomOutButton = this._createButton(options.zoomOutText, options.zoomOutTitle, zoomName + '-out', container, this._zoomOut);\n\n this._updateDisabled();\n\n map.on('zoomend zoomlevelschange', this._updateDisabled, this);\n return container;\n },\n onRemove: function (map) {\n map.off('zoomend zoomlevelschange', this._updateDisabled, this);\n },\n disable: function () {\n this._disabled = true;\n\n this._updateDisabled();\n\n return this;\n },\n enable: function () {\n this._disabled = false;\n\n this._updateDisabled();\n\n return this;\n },\n _zoomIn: function (e) {\n if (!this._disabled && this._map._zoom < this._map.getMaxZoom()) {\n this._map.zoomIn(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1));\n }\n },\n _zoomOut: function (e) {\n if (!this._disabled && this._map._zoom > this._map.getMinZoom()) {\n this._map.zoomOut(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1));\n }\n },\n _createButton: function (html, title, className, container, fn) {\n var link = create$1('a', className, container);\n link.innerHTML = html;\n link.href = '#';\n link.title = title;\n /*\r\n * Will force screen readers like VoiceOver to read this as \"Zoom in - button\"\r\n */\n\n link.setAttribute('role', 'button');\n link.setAttribute('aria-label', title);\n disableClickPropagation(link);\n on(link, 'click', stop);\n on(link, 'click', fn, this);\n on(link, 'click', this._refocusOnMap, this);\n return link;\n },\n _updateDisabled: function () {\n var map = this._map,\n className = 'leaflet-disabled';\n removeClass(this._zoomInButton, className);\n removeClass(this._zoomOutButton, className);\n\n if (this._disabled || map._zoom === map.getMinZoom()) {\n addClass(this._zoomOutButton, className);\n }\n\n if (this._disabled || map._zoom === map.getMaxZoom()) {\n addClass(this._zoomInButton, className);\n }\n }\n }); // @namespace Map\n // @section Control options\n // @option zoomControl: Boolean = true\n // Whether a [zoom control](#control-zoom) is added to the map by default.\n\n Map.mergeOptions({\n zoomControl: true\n });\n Map.addInitHook(function () {\n if (this.options.zoomControl) {\n // @section Controls\n // @property zoomControl: Control.Zoom\n // The default zoom control (only available if the\n // [`zoomControl` option](#map-zoomcontrol) was `true` when creating the map).\n this.zoomControl = new Zoom();\n this.addControl(this.zoomControl);\n }\n }); // @namespace Control.Zoom\n // @factory L.control.zoom(options: Control.Zoom options)\n // Creates a zoom control\n\n var zoom = function (options) {\n return new Zoom(options);\n };\n /*\n * @class Control.Scale\n * @aka L.Control.Scale\n * @inherits Control\n *\n * A simple scale control that shows the scale of the current center of screen in metric (m/km) and imperial (mi/ft) systems. Extends `Control`.\n *\n * @example\n *\n * ```js\n * L.control.scale().addTo(map);\n * ```\n */\n\n\n var Scale = Control.extend({\n // @section\n // @aka Control.Scale options\n options: {\n position: 'bottomleft',\n // @option maxWidth: Number = 100\n // Maximum width of the control in pixels. The width is set dynamically to show round values (e.g. 100, 200, 500).\n maxWidth: 100,\n // @option metric: Boolean = True\n // Whether to show the metric scale line (m/km).\n metric: true,\n // @option imperial: Boolean = True\n // Whether to show the imperial scale line (mi/ft).\n imperial: true // @option updateWhenIdle: Boolean = false\n // If `true`, the control is updated on [`moveend`](#map-moveend), otherwise it's always up-to-date (updated on [`move`](#map-move)).\n\n },\n onAdd: function (map) {\n var className = 'leaflet-control-scale',\n container = create$1('div', className),\n options = this.options;\n\n this._addScales(options, className + '-line', container);\n\n map.on(options.updateWhenIdle ? 'moveend' : 'move', this._update, this);\n map.whenReady(this._update, this);\n return container;\n },\n onRemove: function (map) {\n map.off(this.options.updateWhenIdle ? 'moveend' : 'move', this._update, this);\n },\n _addScales: function (options, className, container) {\n if (options.metric) {\n this._mScale = create$1('div', className, container);\n }\n\n if (options.imperial) {\n this._iScale = create$1('div', className, container);\n }\n },\n _update: function () {\n var map = this._map,\n y = map.getSize().y / 2;\n var maxMeters = map.distance(map.containerPointToLatLng([0, y]), map.containerPointToLatLng([this.options.maxWidth, y]));\n\n this._updateScales(maxMeters);\n },\n _updateScales: function (maxMeters) {\n if (this.options.metric && maxMeters) {\n this._updateMetric(maxMeters);\n }\n\n if (this.options.imperial && maxMeters) {\n this._updateImperial(maxMeters);\n }\n },\n _updateMetric: function (maxMeters) {\n var meters = this._getRoundNum(maxMeters),\n label = meters < 1000 ? meters + ' m' : meters / 1000 + ' km';\n\n this._updateScale(this._mScale, label, meters / maxMeters);\n },\n _updateImperial: function (maxMeters) {\n var maxFeet = maxMeters * 3.2808399,\n maxMiles,\n miles,\n feet;\n\n if (maxFeet > 5280) {\n maxMiles = maxFeet / 5280;\n miles = this._getRoundNum(maxMiles);\n\n this._updateScale(this._iScale, miles + ' mi', miles / maxMiles);\n } else {\n feet = this._getRoundNum(maxFeet);\n\n this._updateScale(this._iScale, feet + ' ft', feet / maxFeet);\n }\n },\n _updateScale: function (scale, text, ratio) {\n scale.style.width = Math.round(this.options.maxWidth * ratio) + 'px';\n scale.innerHTML = text;\n },\n _getRoundNum: function (num) {\n var pow10 = Math.pow(10, (Math.floor(num) + '').length - 1),\n d = num / pow10;\n d = d >= 10 ? 10 : d >= 5 ? 5 : d >= 3 ? 3 : d >= 2 ? 2 : 1;\n return pow10 * d;\n }\n }); // @factory L.control.scale(options?: Control.Scale options)\n // Creates an scale control with the given options.\n\n var scale = function (options) {\n return new Scale(options);\n };\n /*\r\n * @class Control.Attribution\r\n * @aka L.Control.Attribution\r\n * @inherits Control\r\n *\r\n * The attribution control allows you to display attribution data in a small text box on a map. It is put on the map by default unless you set its [`attributionControl` option](#map-attributioncontrol) to `false`, and it fetches attribution texts from layers with the [`getAttribution` method](#layer-getattribution) automatically. Extends Control.\r\n */\n\n\n var Attribution = Control.extend({\n // @section\n // @aka Control.Attribution options\n options: {\n position: 'bottomright',\n // @option prefix: String = 'Leaflet'\n // The HTML text shown before the attributions. Pass `false` to disable.\n prefix: 'Leaflet'\n },\n initialize: function (options) {\n setOptions(this, options);\n this._attributions = {};\n },\n onAdd: function (map) {\n map.attributionControl = this;\n this._container = create$1('div', 'leaflet-control-attribution');\n disableClickPropagation(this._container); // TODO ugly, refactor\n\n for (var i in map._layers) {\n if (map._layers[i].getAttribution) {\n this.addAttribution(map._layers[i].getAttribution());\n }\n }\n\n this._update();\n\n return this._container;\n },\n // @method setPrefix(prefix: String): this\n // Sets the text before the attributions.\n setPrefix: function (prefix) {\n this.options.prefix = prefix;\n\n this._update();\n\n return this;\n },\n // @method addAttribution(text: String): this\n // Adds an attribution text (e.g. `'Vector data © Mapbox'`).\n addAttribution: function (text) {\n if (!text) {\n return this;\n }\n\n if (!this._attributions[text]) {\n this._attributions[text] = 0;\n }\n\n this._attributions[text]++;\n\n this._update();\n\n return this;\n },\n // @method removeAttribution(text: String): this\n // Removes an attribution text.\n removeAttribution: function (text) {\n if (!text) {\n return this;\n }\n\n if (this._attributions[text]) {\n this._attributions[text]--;\n\n this._update();\n }\n\n return this;\n },\n _update: function () {\n if (!this._map) {\n return;\n }\n\n var attribs = [];\n\n for (var i in this._attributions) {\n if (this._attributions[i]) {\n attribs.push(i);\n }\n }\n\n var prefixAndAttribs = [];\n\n if (this.options.prefix) {\n prefixAndAttribs.push(this.options.prefix);\n }\n\n if (attribs.length) {\n prefixAndAttribs.push(attribs.join(', '));\n }\n\n this._container.innerHTML = prefixAndAttribs.join(' | ');\n }\n }); // @namespace Map\n // @section Control options\n // @option attributionControl: Boolean = true\n // Whether a [attribution control](#control-attribution) is added to the map by default.\n\n Map.mergeOptions({\n attributionControl: true\n });\n Map.addInitHook(function () {\n if (this.options.attributionControl) {\n new Attribution().addTo(this);\n }\n }); // @namespace Control.Attribution\n // @factory L.control.attribution(options: Control.Attribution options)\n // Creates an attribution control.\n\n var attribution = function (options) {\n return new Attribution(options);\n };\n\n Control.Layers = Layers;\n Control.Zoom = Zoom;\n Control.Scale = Scale;\n Control.Attribution = Attribution;\n control.layers = layers;\n control.zoom = zoom;\n control.scale = scale;\n control.attribution = attribution;\n /*\n \tL.Handler is a base class for handler classes that are used internally to inject\n \tinteraction features like dragging to classes like Map and Marker.\n */\n // @class Handler\n // @aka L.Handler\n // Abstract class for map interaction handlers\n\n var Handler = Class.extend({\n initialize: function (map) {\n this._map = map;\n },\n // @method enable(): this\n // Enables the handler\n enable: function () {\n if (this._enabled) {\n return this;\n }\n\n this._enabled = true;\n this.addHooks();\n return this;\n },\n // @method disable(): this\n // Disables the handler\n disable: function () {\n if (!this._enabled) {\n return this;\n }\n\n this._enabled = false;\n this.removeHooks();\n return this;\n },\n // @method enabled(): Boolean\n // Returns `true` if the handler is enabled\n enabled: function () {\n return !!this._enabled;\n } // @section Extension methods\n // Classes inheriting from `Handler` must implement the two following methods:\n // @method addHooks()\n // Called when the handler is enabled, should add event hooks.\n // @method removeHooks()\n // Called when the handler is disabled, should remove the event hooks added previously.\n\n }); // @section There is static function which can be called without instantiating L.Handler:\n // @function addTo(map: Map, name: String): this\n // Adds a new Handler to the given map with the given name.\n\n Handler.addTo = function (map, name) {\n map.addHandler(name, this);\n return this;\n };\n\n var Mixin = {\n Events: Events\n };\n /*\r\n * @class Draggable\r\n * @aka L.Draggable\r\n * @inherits Evented\r\n *\r\n * A class for making DOM elements draggable (including touch support).\r\n * Used internally for map and marker dragging. Only works for elements\r\n * that were positioned with [`L.DomUtil.setPosition`](#domutil-setposition).\r\n *\r\n * @example\r\n * ```js\r\n * var draggable = new L.Draggable(elementToDrag);\r\n * draggable.enable();\r\n * ```\r\n */\n\n var START = touch ? 'touchstart mousedown' : 'mousedown';\n var END = {\n mousedown: 'mouseup',\n touchstart: 'touchend',\n pointerdown: 'touchend',\n MSPointerDown: 'touchend'\n };\n var MOVE = {\n mousedown: 'mousemove',\n touchstart: 'touchmove',\n pointerdown: 'touchmove',\n MSPointerDown: 'touchmove'\n };\n var Draggable = Evented.extend({\n options: {\n // @section\n // @aka Draggable options\n // @option clickTolerance: Number = 3\n // The max number of pixels a user can shift the mouse pointer during a click\n // for it to be considered a valid click (as opposed to a mouse drag).\n clickTolerance: 3\n },\n // @constructor L.Draggable(el: HTMLElement, dragHandle?: HTMLElement, preventOutline?: Boolean, options?: Draggable options)\n // Creates a `Draggable` object for moving `el` when you start dragging the `dragHandle` element (equals `el` itself by default).\n initialize: function (element, dragStartTarget, preventOutline$$1, options) {\n setOptions(this, options);\n this._element = element;\n this._dragStartTarget = dragStartTarget || element;\n this._preventOutline = preventOutline$$1;\n },\n // @method enable()\n // Enables the dragging ability\n enable: function () {\n if (this._enabled) {\n return;\n }\n\n on(this._dragStartTarget, START, this._onDown, this);\n this._enabled = true;\n },\n // @method disable()\n // Disables the dragging ability\n disable: function () {\n if (!this._enabled) {\n return;\n } // If we're currently dragging this draggable,\n // disabling it counts as first ending the drag.\n\n\n if (Draggable._dragging === this) {\n this.finishDrag();\n }\n\n off(this._dragStartTarget, START, this._onDown, this);\n this._enabled = false;\n this._moved = false;\n },\n _onDown: function (e) {\n // Ignore simulated events, since we handle both touch and\n // mouse explicitly; otherwise we risk getting duplicates of\n // touch events, see #4315.\n // Also ignore the event if disabled; this happens in IE11\n // under some circumstances, see #3666.\n if (e._simulated || !this._enabled) {\n return;\n }\n\n this._moved = false;\n\n if (hasClass(this._element, 'leaflet-zoom-anim')) {\n return;\n }\n\n if (Draggable._dragging || e.shiftKey || e.which !== 1 && e.button !== 1 && !e.touches) {\n return;\n }\n\n Draggable._dragging = this; // Prevent dragging multiple objects at once.\n\n if (this._preventOutline) {\n preventOutline(this._element);\n }\n\n disableImageDrag();\n disableTextSelection();\n\n if (this._moving) {\n return;\n } // @event down: Event\n // Fired when a drag is about to start.\n\n\n this.fire('down');\n var first = e.touches ? e.touches[0] : e,\n sizedParent = getSizedParentNode(this._element);\n this._startPoint = new Point(first.clientX, first.clientY); // Cache the scale, so that we can continuously compensate for it during drag (_onMove).\n\n this._parentScale = getScale(sizedParent);\n on(document, MOVE[e.type], this._onMove, this);\n on(document, END[e.type], this._onUp, this);\n },\n _onMove: function (e) {\n // Ignore simulated events, since we handle both touch and\n // mouse explicitly; otherwise we risk getting duplicates of\n // touch events, see #4315.\n // Also ignore the event if disabled; this happens in IE11\n // under some circumstances, see #3666.\n if (e._simulated || !this._enabled) {\n return;\n }\n\n if (e.touches && e.touches.length > 1) {\n this._moved = true;\n return;\n }\n\n var first = e.touches && e.touches.length === 1 ? e.touches[0] : e,\n offset = new Point(first.clientX, first.clientY)._subtract(this._startPoint);\n\n if (!offset.x && !offset.y) {\n return;\n }\n\n if (Math.abs(offset.x) + Math.abs(offset.y) < this.options.clickTolerance) {\n return;\n } // We assume that the parent container's position, border and scale do not change for the duration of the drag.\n // Therefore there is no need to account for the position and border (they are eliminated by the subtraction)\n // and we can use the cached value for the scale.\n\n\n offset.x /= this._parentScale.x;\n offset.y /= this._parentScale.y;\n preventDefault(e);\n\n if (!this._moved) {\n // @event dragstart: Event\n // Fired when a drag starts\n this.fire('dragstart');\n this._moved = true;\n this._startPos = getPosition(this._element).subtract(offset);\n addClass(document.body, 'leaflet-dragging');\n this._lastTarget = e.target || e.srcElement; // IE and Edge do not give the element, so fetch it\n // if necessary\n\n if (window.SVGElementInstance && this._lastTarget instanceof SVGElementInstance) {\n this._lastTarget = this._lastTarget.correspondingUseElement;\n }\n\n addClass(this._lastTarget, 'leaflet-drag-target');\n }\n\n this._newPos = this._startPos.add(offset);\n this._moving = true;\n cancelAnimFrame(this._animRequest);\n this._lastEvent = e;\n this._animRequest = requestAnimFrame(this._updatePosition, this, true);\n },\n _updatePosition: function () {\n var e = {\n originalEvent: this._lastEvent\n }; // @event predrag: Event\n // Fired continuously during dragging *before* each corresponding\n // update of the element's position.\n\n this.fire('predrag', e);\n setPosition(this._element, this._newPos); // @event drag: Event\n // Fired continuously during dragging.\n\n this.fire('drag', e);\n },\n _onUp: function (e) {\n // Ignore simulated events, since we handle both touch and\n // mouse explicitly; otherwise we risk getting duplicates of\n // touch events, see #4315.\n // Also ignore the event if disabled; this happens in IE11\n // under some circumstances, see #3666.\n if (e._simulated || !this._enabled) {\n return;\n }\n\n this.finishDrag();\n },\n finishDrag: function () {\n removeClass(document.body, 'leaflet-dragging');\n\n if (this._lastTarget) {\n removeClass(this._lastTarget, 'leaflet-drag-target');\n this._lastTarget = null;\n }\n\n for (var i in MOVE) {\n off(document, MOVE[i], this._onMove, this);\n off(document, END[i], this._onUp, this);\n }\n\n enableImageDrag();\n enableTextSelection();\n\n if (this._moved && this._moving) {\n // ensure drag is not fired after dragend\n cancelAnimFrame(this._animRequest); // @event dragend: DragEndEvent\n // Fired when the drag ends.\n\n this.fire('dragend', {\n distance: this._newPos.distanceTo(this._startPos)\n });\n }\n\n this._moving = false;\n Draggable._dragging = false;\n }\n });\n /*\r\n * @namespace LineUtil\r\n *\r\n * Various utility functions for polyline points processing, used by Leaflet internally to make polylines lightning-fast.\r\n */\n // Simplify polyline with vertex reduction and Douglas-Peucker simplification.\n // Improves rendering performance dramatically by lessening the number of points to draw.\n // @function simplify(points: Point[], tolerance: Number): Point[]\n // Dramatically reduces the number of points in a polyline while retaining\n // its shape and returns a new array of simplified points, using the\n // [Douglas-Peucker algorithm](http://en.wikipedia.org/wiki/Douglas-Peucker_algorithm).\n // Used for a huge performance boost when processing/displaying Leaflet polylines for\n // each zoom level and also reducing visual noise. tolerance affects the amount of\n // simplification (lesser value means higher quality but slower and with more points).\n // Also released as a separated micro-library [Simplify.js](http://mourner.github.com/simplify-js/).\n\n function simplify(points, tolerance) {\n if (!tolerance || !points.length) {\n return points.slice();\n }\n\n var sqTolerance = tolerance * tolerance; // stage 1: vertex reduction\n\n points = _reducePoints(points, sqTolerance); // stage 2: Douglas-Peucker simplification\n\n points = _simplifyDP(points, sqTolerance);\n return points;\n } // @function pointToSegmentDistance(p: Point, p1: Point, p2: Point): Number\n // Returns the distance between point `p` and segment `p1` to `p2`.\n\n\n function pointToSegmentDistance(p, p1, p2) {\n return Math.sqrt(_sqClosestPointOnSegment(p, p1, p2, true));\n } // @function closestPointOnSegment(p: Point, p1: Point, p2: Point): Number\n // Returns the closest point from a point `p` on a segment `p1` to `p2`.\n\n\n function closestPointOnSegment(p, p1, p2) {\n return _sqClosestPointOnSegment(p, p1, p2);\n } // Douglas-Peucker simplification, see http://en.wikipedia.org/wiki/Douglas-Peucker_algorithm\n\n\n function _simplifyDP(points, sqTolerance) {\n var len = points.length,\n ArrayConstructor = typeof Uint8Array !== undefined + '' ? Uint8Array : Array,\n markers = new ArrayConstructor(len);\n markers[0] = markers[len - 1] = 1;\n\n _simplifyDPStep(points, markers, sqTolerance, 0, len - 1);\n\n var i,\n newPoints = [];\n\n for (i = 0; i < len; i++) {\n if (markers[i]) {\n newPoints.push(points[i]);\n }\n }\n\n return newPoints;\n }\n\n function _simplifyDPStep(points, markers, sqTolerance, first, last) {\n var maxSqDist = 0,\n index,\n i,\n sqDist;\n\n for (i = first + 1; i <= last - 1; i++) {\n sqDist = _sqClosestPointOnSegment(points[i], points[first], points[last], true);\n\n if (sqDist > maxSqDist) {\n index = i;\n maxSqDist = sqDist;\n }\n }\n\n if (maxSqDist > sqTolerance) {\n markers[index] = 1;\n\n _simplifyDPStep(points, markers, sqTolerance, first, index);\n\n _simplifyDPStep(points, markers, sqTolerance, index, last);\n }\n } // reduce points that are too close to each other to a single point\n\n\n function _reducePoints(points, sqTolerance) {\n var reducedPoints = [points[0]];\n\n for (var i = 1, prev = 0, len = points.length; i < len; i++) {\n if (_sqDist(points[i], points[prev]) > sqTolerance) {\n reducedPoints.push(points[i]);\n prev = i;\n }\n }\n\n if (prev < len - 1) {\n reducedPoints.push(points[len - 1]);\n }\n\n return reducedPoints;\n }\n\n var _lastCode; // @function clipSegment(a: Point, b: Point, bounds: Bounds, useLastCode?: Boolean, round?: Boolean): Point[]|Boolean\n // Clips the segment a to b by rectangular bounds with the\n // [Cohen-Sutherland algorithm](https://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm)\n // (modifying the segment points directly!). Used by Leaflet to only show polyline\n // points that are on the screen or near, increasing performance.\n\n\n function clipSegment(a, b, bounds, useLastCode, round) {\n var codeA = useLastCode ? _lastCode : _getBitCode(a, bounds),\n codeB = _getBitCode(b, bounds),\n codeOut,\n p,\n newCode; // save 2nd code to avoid calculating it on the next segment\n\n\n _lastCode = codeB;\n\n while (true) {\n // if a,b is inside the clip window (trivial accept)\n if (!(codeA | codeB)) {\n return [a, b];\n } // if a,b is outside the clip window (trivial reject)\n\n\n if (codeA & codeB) {\n return false;\n } // other cases\n\n\n codeOut = codeA || codeB;\n p = _getEdgeIntersection(a, b, codeOut, bounds, round);\n newCode = _getBitCode(p, bounds);\n\n if (codeOut === codeA) {\n a = p;\n codeA = newCode;\n } else {\n b = p;\n codeB = newCode;\n }\n }\n }\n\n function _getEdgeIntersection(a, b, code, bounds, round) {\n var dx = b.x - a.x,\n dy = b.y - a.y,\n min = bounds.min,\n max = bounds.max,\n x,\n y;\n\n if (code & 8) {\n // top\n x = a.x + dx * (max.y - a.y) / dy;\n y = max.y;\n } else if (code & 4) {\n // bottom\n x = a.x + dx * (min.y - a.y) / dy;\n y = min.y;\n } else if (code & 2) {\n // right\n x = max.x;\n y = a.y + dy * (max.x - a.x) / dx;\n } else if (code & 1) {\n // left\n x = min.x;\n y = a.y + dy * (min.x - a.x) / dx;\n }\n\n return new Point(x, y, round);\n }\n\n function _getBitCode(p, bounds) {\n var code = 0;\n\n if (p.x < bounds.min.x) {\n // left\n code |= 1;\n } else if (p.x > bounds.max.x) {\n // right\n code |= 2;\n }\n\n if (p.y < bounds.min.y) {\n // bottom\n code |= 4;\n } else if (p.y > bounds.max.y) {\n // top\n code |= 8;\n }\n\n return code;\n } // square distance (to avoid unnecessary Math.sqrt calls)\n\n\n function _sqDist(p1, p2) {\n var dx = p2.x - p1.x,\n dy = p2.y - p1.y;\n return dx * dx + dy * dy;\n } // return closest point on segment or distance to that point\n\n\n function _sqClosestPointOnSegment(p, p1, p2, sqDist) {\n var x = p1.x,\n y = p1.y,\n dx = p2.x - x,\n dy = p2.y - y,\n dot = dx * dx + dy * dy,\n t;\n\n if (dot > 0) {\n t = ((p.x - x) * dx + (p.y - y) * dy) / dot;\n\n if (t > 1) {\n x = p2.x;\n y = p2.y;\n } else if (t > 0) {\n x += dx * t;\n y += dy * t;\n }\n }\n\n dx = p.x - x;\n dy = p.y - y;\n return sqDist ? dx * dx + dy * dy : new Point(x, y);\n } // @function isFlat(latlngs: LatLng[]): Boolean\n // Returns true if `latlngs` is a flat array, false is nested.\n\n\n function isFlat(latlngs) {\n return !isArray(latlngs[0]) || typeof latlngs[0][0] !== 'object' && typeof latlngs[0][0] !== 'undefined';\n }\n\n function _flat(latlngs) {\n console.warn('Deprecated use of _flat, please use L.LineUtil.isFlat instead.');\n return isFlat(latlngs);\n }\n\n var LineUtil = (Object.freeze || Object)({\n simplify: simplify,\n pointToSegmentDistance: pointToSegmentDistance,\n closestPointOnSegment: closestPointOnSegment,\n clipSegment: clipSegment,\n _getEdgeIntersection: _getEdgeIntersection,\n _getBitCode: _getBitCode,\n _sqClosestPointOnSegment: _sqClosestPointOnSegment,\n isFlat: isFlat,\n _flat: _flat\n });\n /*\r\n * @namespace PolyUtil\r\n * Various utility functions for polygon geometries.\r\n */\n\n /* @function clipPolygon(points: Point[], bounds: Bounds, round?: Boolean): Point[]\r\n * Clips the polygon geometry defined by the given `points` by the given bounds (using the [Sutherland-Hodgman algorithm](https://en.wikipedia.org/wiki/Sutherland%E2%80%93Hodgman_algorithm)).\r\n * Used by Leaflet to only show polygon points that are on the screen or near, increasing\r\n * performance. Note that polygon points needs different algorithm for clipping\r\n * than polyline, so there's a separate method for it.\r\n */\n\n function clipPolygon(points, bounds, round) {\n var clippedPoints,\n edges = [1, 4, 2, 8],\n i,\n j,\n k,\n a,\n b,\n len,\n edge,\n p;\n\n for (i = 0, len = points.length; i < len; i++) {\n points[i]._code = _getBitCode(points[i], bounds);\n } // for each edge (left, bottom, right, top)\n\n\n for (k = 0; k < 4; k++) {\n edge = edges[k];\n clippedPoints = [];\n\n for (i = 0, len = points.length, j = len - 1; i < len; j = i++) {\n a = points[i];\n b = points[j]; // if a is inside the clip window\n\n if (!(a._code & edge)) {\n // if b is outside the clip window (a->b goes out of screen)\n if (b._code & edge) {\n p = _getEdgeIntersection(b, a, edge, bounds, round);\n p._code = _getBitCode(p, bounds);\n clippedPoints.push(p);\n }\n\n clippedPoints.push(a); // else if b is inside the clip window (a->b enters the screen)\n } else if (!(b._code & edge)) {\n p = _getEdgeIntersection(b, a, edge, bounds, round);\n p._code = _getBitCode(p, bounds);\n clippedPoints.push(p);\n }\n }\n\n points = clippedPoints;\n }\n\n return points;\n }\n\n var PolyUtil = (Object.freeze || Object)({\n clipPolygon: clipPolygon\n });\n /*\r\n * @namespace Projection\r\n * @section\r\n * Leaflet comes with a set of already defined Projections out of the box:\r\n *\r\n * @projection L.Projection.LonLat\r\n *\r\n * Equirectangular, or Plate Carree projection — the most simple projection,\r\n * mostly used by GIS enthusiasts. Directly maps `x` as longitude, and `y` as\r\n * latitude. Also suitable for flat worlds, e.g. game maps. Used by the\r\n * `EPSG:4326` and `Simple` CRS.\r\n */\n\n var LonLat = {\n project: function (latlng) {\n return new Point(latlng.lng, latlng.lat);\n },\n unproject: function (point) {\n return new LatLng(point.y, point.x);\n },\n bounds: new Bounds([-180, -90], [180, 90])\n };\n /*\r\n * @namespace Projection\r\n * @projection L.Projection.Mercator\r\n *\r\n * Elliptical Mercator projection — more complex than Spherical Mercator. Takes into account that Earth is a geoid, not a perfect sphere. Used by the EPSG:3395 CRS.\r\n */\n\n var Mercator = {\n R: 6378137,\n R_MINOR: 6356752.314245179,\n bounds: new Bounds([-20037508.34279, -15496570.73972], [20037508.34279, 18764656.23138]),\n project: function (latlng) {\n var d = Math.PI / 180,\n r = this.R,\n y = latlng.lat * d,\n tmp = this.R_MINOR / r,\n e = Math.sqrt(1 - tmp * tmp),\n con = e * Math.sin(y);\n var ts = Math.tan(Math.PI / 4 - y / 2) / Math.pow((1 - con) / (1 + con), e / 2);\n y = -r * Math.log(Math.max(ts, 1E-10));\n return new Point(latlng.lng * d * r, y);\n },\n unproject: function (point) {\n var d = 180 / Math.PI,\n r = this.R,\n tmp = this.R_MINOR / r,\n e = Math.sqrt(1 - tmp * tmp),\n ts = Math.exp(-point.y / r),\n phi = Math.PI / 2 - 2 * Math.atan(ts);\n\n for (var i = 0, dphi = 0.1, con; i < 15 && Math.abs(dphi) > 1e-7; i++) {\n con = e * Math.sin(phi);\n con = Math.pow((1 - con) / (1 + con), e / 2);\n dphi = Math.PI / 2 - 2 * Math.atan(ts * con) - phi;\n phi += dphi;\n }\n\n return new LatLng(phi * d, point.x * d / r);\n }\n };\n /*\n * @class Projection\n \n * An object with methods for projecting geographical coordinates of the world onto\n * a flat surface (and back). See [Map projection](http://en.wikipedia.org/wiki/Map_projection).\n \n * @property bounds: Bounds\n * The bounds (specified in CRS units) where the projection is valid\n \n * @method project(latlng: LatLng): Point\n * Projects geographical coordinates into a 2D point.\n * Only accepts actual `L.LatLng` instances, not arrays.\n \n * @method unproject(point: Point): LatLng\n * The inverse of `project`. Projects a 2D point into a geographical location.\n * Only accepts actual `L.Point` instances, not arrays.\n \n * Note that the projection instances do not inherit from Leafet's `Class` object,\n * and can't be instantiated. Also, new classes can't inherit from them,\n * and methods can't be added to them with the `include` function.\n \n */\n\n var index = (Object.freeze || Object)({\n LonLat: LonLat,\n Mercator: Mercator,\n SphericalMercator: SphericalMercator\n });\n /*\r\n * @namespace CRS\r\n * @crs L.CRS.EPSG3395\r\n *\r\n * Rarely used by some commercial tile providers. Uses Elliptical Mercator projection.\r\n */\n\n var EPSG3395 = extend({}, Earth, {\n code: 'EPSG:3395',\n projection: Mercator,\n transformation: function () {\n var scale = 0.5 / (Math.PI * Mercator.R);\n return toTransformation(scale, 0.5, -scale, 0.5);\n }()\n });\n /*\r\n * @namespace CRS\r\n * @crs L.CRS.EPSG4326\r\n *\r\n * A common CRS among GIS enthusiasts. Uses simple Equirectangular projection.\r\n *\r\n * Leaflet 1.0.x complies with the [TMS coordinate scheme for EPSG:4326](https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification#global-geodetic),\r\n * which is a breaking change from 0.7.x behaviour. If you are using a `TileLayer`\r\n * with this CRS, ensure that there are two 256x256 pixel tiles covering the\r\n * whole earth at zoom level zero, and that the tile coordinate origin is (-180,+90),\r\n * or (-180,-90) for `TileLayer`s with [the `tms` option](#tilelayer-tms) set.\r\n */\n\n var EPSG4326 = extend({}, Earth, {\n code: 'EPSG:4326',\n projection: LonLat,\n transformation: toTransformation(1 / 180, 1, -1 / 180, 0.5)\n });\n /*\n * @namespace CRS\n * @crs L.CRS.Simple\n *\n * A simple CRS that maps longitude and latitude into `x` and `y` directly.\n * May be used for maps of flat surfaces (e.g. game maps). Note that the `y`\n * axis should still be inverted (going from bottom to top). `distance()` returns\n * simple euclidean distance.\n */\n\n var Simple = extend({}, CRS, {\n projection: LonLat,\n transformation: toTransformation(1, 0, -1, 0),\n scale: function (zoom) {\n return Math.pow(2, zoom);\n },\n zoom: function (scale) {\n return Math.log(scale) / Math.LN2;\n },\n distance: function (latlng1, latlng2) {\n var dx = latlng2.lng - latlng1.lng,\n dy = latlng2.lat - latlng1.lat;\n return Math.sqrt(dx * dx + dy * dy);\n },\n infinite: true\n });\n CRS.Earth = Earth;\n CRS.EPSG3395 = EPSG3395;\n CRS.EPSG3857 = EPSG3857;\n CRS.EPSG900913 = EPSG900913;\n CRS.EPSG4326 = EPSG4326;\n CRS.Simple = Simple;\n /*\n * @class Layer\n * @inherits Evented\n * @aka L.Layer\n * @aka ILayer\n *\n * A set of methods from the Layer base class that all Leaflet layers use.\n * Inherits all methods, options and events from `L.Evented`.\n *\n * @example\n *\n * ```js\n * var layer = L.Marker(latlng).addTo(map);\n * layer.addTo(map);\n * layer.remove();\n * ```\n *\n * @event add: Event\n * Fired after the layer is added to a map\n *\n * @event remove: Event\n * Fired after the layer is removed from a map\n */\n\n var Layer = Evented.extend({\n // Classes extending `L.Layer` will inherit the following options:\n options: {\n // @option pane: String = 'overlayPane'\n // By default the layer will be added to the map's [overlay pane](#map-overlaypane). Overriding this option will cause the layer to be placed on another pane by default.\n pane: 'overlayPane',\n // @option attribution: String = null\n // String to be shown in the attribution control, e.g. \"© OpenStreetMap contributors\". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.\n attribution: null,\n bubblingMouseEvents: true\n },\n\n /* @section\n * Classes extending `L.Layer` will inherit the following methods:\n *\n * @method addTo(map: Map|LayerGroup): this\n * Adds the layer to the given map or layer group.\n */\n addTo: function (map) {\n map.addLayer(this);\n return this;\n },\n // @method remove: this\n // Removes the layer from the map it is currently active on.\n remove: function () {\n return this.removeFrom(this._map || this._mapToAdd);\n },\n // @method removeFrom(map: Map): this\n // Removes the layer from the given map\n removeFrom: function (obj) {\n if (obj) {\n obj.removeLayer(this);\n }\n\n return this;\n },\n // @method getPane(name? : String): HTMLElement\n // Returns the `HTMLElement` representing the named pane on the map. If `name` is omitted, returns the pane for this layer.\n getPane: function (name) {\n return this._map.getPane(name ? this.options[name] || name : this.options.pane);\n },\n addInteractiveTarget: function (targetEl) {\n this._map._targets[stamp(targetEl)] = this;\n return this;\n },\n removeInteractiveTarget: function (targetEl) {\n delete this._map._targets[stamp(targetEl)];\n return this;\n },\n // @method getAttribution: String\n // Used by the `attribution control`, returns the [attribution option](#gridlayer-attribution).\n getAttribution: function () {\n return this.options.attribution;\n },\n _layerAdd: function (e) {\n var map = e.target; // check in case layer gets added and then removed before the map is ready\n\n if (!map.hasLayer(this)) {\n return;\n }\n\n this._map = map;\n this._zoomAnimated = map._zoomAnimated;\n\n if (this.getEvents) {\n var events = this.getEvents();\n map.on(events, this);\n this.once('remove', function () {\n map.off(events, this);\n }, this);\n }\n\n this.onAdd(map);\n\n if (this.getAttribution && map.attributionControl) {\n map.attributionControl.addAttribution(this.getAttribution());\n }\n\n this.fire('add');\n map.fire('layeradd', {\n layer: this\n });\n }\n });\n /* @section Extension methods\n * @uninheritable\n *\n * Every layer should extend from `L.Layer` and (re-)implement the following methods.\n *\n * @method onAdd(map: Map): this\n * Should contain code that creates DOM elements for the layer, adds them to `map panes` where they should belong and puts listeners on relevant map events. Called on [`map.addLayer(layer)`](#map-addlayer).\n *\n * @method onRemove(map: Map): this\n * Should contain all clean up code that removes the layer's elements from the DOM and removes listeners previously added in [`onAdd`](#layer-onadd). Called on [`map.removeLayer(layer)`](#map-removelayer).\n *\n * @method getEvents(): Object\n * This optional method should return an object like `{ viewreset: this._reset }` for [`addEventListener`](#evented-addeventlistener). The event handlers in this object will be automatically added and removed from the map with your layer.\n *\n * @method getAttribution(): String\n * This optional method should return a string containing HTML to be shown on the `Attribution control` whenever the layer is visible.\n *\n * @method beforeAdd(map: Map): this\n * Optional method. Called on [`map.addLayer(layer)`](#map-addlayer), before the layer is added to the map, before events are initialized, without waiting until the map is in a usable state. Use for early initialization only.\n */\n\n /* @namespace Map\n * @section Layer events\n *\n * @event layeradd: LayerEvent\n * Fired when a new layer is added to the map.\n *\n * @event layerremove: LayerEvent\n * Fired when some layer is removed from the map\n *\n * @section Methods for Layers and Controls\n */\n\n Map.include({\n // @method addLayer(layer: Layer): this\n // Adds the given layer to the map\n addLayer: function (layer) {\n if (!layer._layerAdd) {\n throw new Error('The provided object is not a Layer.');\n }\n\n var id = stamp(layer);\n\n if (this._layers[id]) {\n return this;\n }\n\n this._layers[id] = layer;\n layer._mapToAdd = this;\n\n if (layer.beforeAdd) {\n layer.beforeAdd(this);\n }\n\n this.whenReady(layer._layerAdd, layer);\n return this;\n },\n // @method removeLayer(layer: Layer): this\n // Removes the given layer from the map.\n removeLayer: function (layer) {\n var id = stamp(layer);\n\n if (!this._layers[id]) {\n return this;\n }\n\n if (this._loaded) {\n layer.onRemove(this);\n }\n\n if (layer.getAttribution && this.attributionControl) {\n this.attributionControl.removeAttribution(layer.getAttribution());\n }\n\n delete this._layers[id];\n\n if (this._loaded) {\n this.fire('layerremove', {\n layer: layer\n });\n layer.fire('remove');\n }\n\n layer._map = layer._mapToAdd = null;\n return this;\n },\n // @method hasLayer(layer: Layer): Boolean\n // Returns `true` if the given layer is currently added to the map\n hasLayer: function (layer) {\n return !!layer && stamp(layer) in this._layers;\n },\n\n /* @method eachLayer(fn: Function, context?: Object): this\n * Iterates over the layers of the map, optionally specifying context of the iterator function.\n * ```\n * map.eachLayer(function(layer){\n * layer.bindPopup('Hello');\n * });\n * ```\n */\n eachLayer: function (method, context) {\n for (var i in this._layers) {\n method.call(context, this._layers[i]);\n }\n\n return this;\n },\n _addLayers: function (layers) {\n layers = layers ? isArray(layers) ? layers : [layers] : [];\n\n for (var i = 0, len = layers.length; i < len; i++) {\n this.addLayer(layers[i]);\n }\n },\n _addZoomLimit: function (layer) {\n if (isNaN(layer.options.maxZoom) || !isNaN(layer.options.minZoom)) {\n this._zoomBoundLayers[stamp(layer)] = layer;\n\n this._updateZoomLevels();\n }\n },\n _removeZoomLimit: function (layer) {\n var id = stamp(layer);\n\n if (this._zoomBoundLayers[id]) {\n delete this._zoomBoundLayers[id];\n\n this._updateZoomLevels();\n }\n },\n _updateZoomLevels: function () {\n var minZoom = Infinity,\n maxZoom = -Infinity,\n oldZoomSpan = this._getZoomSpan();\n\n for (var i in this._zoomBoundLayers) {\n var options = this._zoomBoundLayers[i].options;\n minZoom = options.minZoom === undefined ? minZoom : Math.min(minZoom, options.minZoom);\n maxZoom = options.maxZoom === undefined ? maxZoom : Math.max(maxZoom, options.maxZoom);\n }\n\n this._layersMaxZoom = maxZoom === -Infinity ? undefined : maxZoom;\n this._layersMinZoom = minZoom === Infinity ? undefined : minZoom; // @section Map state change events\n // @event zoomlevelschange: Event\n // Fired when the number of zoomlevels on the map is changed due\n // to adding or removing a layer.\n\n if (oldZoomSpan !== this._getZoomSpan()) {\n this.fire('zoomlevelschange');\n }\n\n if (this.options.maxZoom === undefined && this._layersMaxZoom && this.getZoom() > this._layersMaxZoom) {\n this.setZoom(this._layersMaxZoom);\n }\n\n if (this.options.minZoom === undefined && this._layersMinZoom && this.getZoom() < this._layersMinZoom) {\n this.setZoom(this._layersMinZoom);\n }\n }\n });\n /*\r\n * @class LayerGroup\r\n * @aka L.LayerGroup\r\n * @inherits Layer\r\n *\r\n * Used to group several layers and handle them as one. If you add it to the map,\r\n * any layers added or removed from the group will be added/removed on the map as\r\n * well. Extends `Layer`.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * L.layerGroup([marker1, marker2])\r\n * \t.addLayer(polyline)\r\n * \t.addTo(map);\r\n * ```\r\n */\n\n var LayerGroup = Layer.extend({\n initialize: function (layers, options) {\n setOptions(this, options);\n this._layers = {};\n var i, len;\n\n if (layers) {\n for (i = 0, len = layers.length; i < len; i++) {\n this.addLayer(layers[i]);\n }\n }\n },\n // @method addLayer(layer: Layer): this\n // Adds the given layer to the group.\n addLayer: function (layer) {\n var id = this.getLayerId(layer);\n this._layers[id] = layer;\n\n if (this._map) {\n this._map.addLayer(layer);\n }\n\n return this;\n },\n // @method removeLayer(layer: Layer): this\n // Removes the given layer from the group.\n // @alternative\n // @method removeLayer(id: Number): this\n // Removes the layer with the given internal ID from the group.\n removeLayer: function (layer) {\n var id = layer in this._layers ? layer : this.getLayerId(layer);\n\n if (this._map && this._layers[id]) {\n this._map.removeLayer(this._layers[id]);\n }\n\n delete this._layers[id];\n return this;\n },\n // @method hasLayer(layer: Layer): Boolean\n // Returns `true` if the given layer is currently added to the group.\n // @alternative\n // @method hasLayer(id: Number): Boolean\n // Returns `true` if the given internal ID is currently added to the group.\n hasLayer: function (layer) {\n return !!layer && (layer in this._layers || this.getLayerId(layer) in this._layers);\n },\n // @method clearLayers(): this\n // Removes all the layers from the group.\n clearLayers: function () {\n return this.eachLayer(this.removeLayer, this);\n },\n // @method invoke(methodName: String, …): this\n // Calls `methodName` on every layer contained in this group, passing any\n // additional parameters. Has no effect if the layers contained do not\n // implement `methodName`.\n invoke: function (methodName) {\n var args = Array.prototype.slice.call(arguments, 1),\n i,\n layer;\n\n for (i in this._layers) {\n layer = this._layers[i];\n\n if (layer[methodName]) {\n layer[methodName].apply(layer, args);\n }\n }\n\n return this;\n },\n onAdd: function (map) {\n this.eachLayer(map.addLayer, map);\n },\n onRemove: function (map) {\n this.eachLayer(map.removeLayer, map);\n },\n // @method eachLayer(fn: Function, context?: Object): this\n // Iterates over the layers of the group, optionally specifying context of the iterator function.\n // ```js\n // group.eachLayer(function (layer) {\n // \tlayer.bindPopup('Hello');\n // });\n // ```\n eachLayer: function (method, context) {\n for (var i in this._layers) {\n method.call(context, this._layers[i]);\n }\n\n return this;\n },\n // @method getLayer(id: Number): Layer\n // Returns the layer with the given internal ID.\n getLayer: function (id) {\n return this._layers[id];\n },\n // @method getLayers(): Layer[]\n // Returns an array of all the layers added to the group.\n getLayers: function () {\n var layers = [];\n this.eachLayer(layers.push, layers);\n return layers;\n },\n // @method setZIndex(zIndex: Number): this\n // Calls `setZIndex` on every layer contained in this group, passing the z-index.\n setZIndex: function (zIndex) {\n return this.invoke('setZIndex', zIndex);\n },\n // @method getLayerId(layer: Layer): Number\n // Returns the internal ID for a layer\n getLayerId: function (layer) {\n return stamp(layer);\n }\n }); // @factory L.layerGroup(layers?: Layer[], options?: Object)\n // Create a layer group, optionally given an initial set of layers and an `options` object.\n\n var layerGroup = function (layers, options) {\n return new LayerGroup(layers, options);\n };\n /*\r\n * @class FeatureGroup\r\n * @aka L.FeatureGroup\r\n * @inherits LayerGroup\r\n *\r\n * Extended `LayerGroup` that makes it easier to do the same thing to all its member layers:\r\n * * [`bindPopup`](#layer-bindpopup) binds a popup to all of the layers at once (likewise with [`bindTooltip`](#layer-bindtooltip))\r\n * * Events are propagated to the `FeatureGroup`, so if the group has an event\r\n * handler, it will handle events from any of the layers. This includes mouse events\r\n * and custom events.\r\n * * Has `layeradd` and `layerremove` events\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * L.featureGroup([marker1, marker2, polyline])\r\n * \t.bindPopup('Hello world!')\r\n * \t.on('click', function() { alert('Clicked on a member of the group!'); })\r\n * \t.addTo(map);\r\n * ```\r\n */\n\n\n var FeatureGroup = LayerGroup.extend({\n addLayer: function (layer) {\n if (this.hasLayer(layer)) {\n return this;\n }\n\n layer.addEventParent(this);\n LayerGroup.prototype.addLayer.call(this, layer); // @event layeradd: LayerEvent\n // Fired when a layer is added to this `FeatureGroup`\n\n return this.fire('layeradd', {\n layer: layer\n });\n },\n removeLayer: function (layer) {\n if (!this.hasLayer(layer)) {\n return this;\n }\n\n if (layer in this._layers) {\n layer = this._layers[layer];\n }\n\n layer.removeEventParent(this);\n LayerGroup.prototype.removeLayer.call(this, layer); // @event layerremove: LayerEvent\n // Fired when a layer is removed from this `FeatureGroup`\n\n return this.fire('layerremove', {\n layer: layer\n });\n },\n // @method setStyle(style: Path options): this\n // Sets the given path options to each layer of the group that has a `setStyle` method.\n setStyle: function (style) {\n return this.invoke('setStyle', style);\n },\n // @method bringToFront(): this\n // Brings the layer group to the top of all other layers\n bringToFront: function () {\n return this.invoke('bringToFront');\n },\n // @method bringToBack(): this\n // Brings the layer group to the back of all other layers\n bringToBack: function () {\n return this.invoke('bringToBack');\n },\n // @method getBounds(): LatLngBounds\n // Returns the LatLngBounds of the Feature Group (created from bounds and coordinates of its children).\n getBounds: function () {\n var bounds = new LatLngBounds();\n\n for (var id in this._layers) {\n var layer = this._layers[id];\n bounds.extend(layer.getBounds ? layer.getBounds() : layer.getLatLng());\n }\n\n return bounds;\n }\n }); // @factory L.featureGroup(layers: Layer[])\n // Create a feature group, optionally given an initial set of layers.\n\n var featureGroup = function (layers) {\n return new FeatureGroup(layers);\n };\n /*\r\n * @class Icon\r\n * @aka L.Icon\r\n *\r\n * Represents an icon to provide when creating a marker.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * var myIcon = L.icon({\r\n * iconUrl: 'my-icon.png',\r\n * iconRetinaUrl: 'my-icon@2x.png',\r\n * iconSize: [38, 95],\r\n * iconAnchor: [22, 94],\r\n * popupAnchor: [-3, -76],\r\n * shadowUrl: 'my-icon-shadow.png',\r\n * shadowRetinaUrl: 'my-icon-shadow@2x.png',\r\n * shadowSize: [68, 95],\r\n * shadowAnchor: [22, 94]\r\n * });\r\n *\r\n * L.marker([50.505, 30.57], {icon: myIcon}).addTo(map);\r\n * ```\r\n *\r\n * `L.Icon.Default` extends `L.Icon` and is the blue icon Leaflet uses for markers by default.\r\n *\r\n */\n\n\n var Icon = Class.extend({\n /* @section\r\n * @aka Icon options\r\n *\r\n * @option iconUrl: String = null\r\n * **(required)** The URL to the icon image (absolute or relative to your script path).\r\n *\r\n * @option iconRetinaUrl: String = null\r\n * The URL to a retina sized version of the icon image (absolute or relative to your\r\n * script path). Used for Retina screen devices.\r\n *\r\n * @option iconSize: Point = null\r\n * Size of the icon image in pixels.\r\n *\r\n * @option iconAnchor: Point = null\r\n * The coordinates of the \"tip\" of the icon (relative to its top left corner). The icon\r\n * will be aligned so that this point is at the marker's geographical location. Centered\r\n * by default if size is specified, also can be set in CSS with negative margins.\r\n *\r\n * @option popupAnchor: Point = [0, 0]\r\n * The coordinates of the point from which popups will \"open\", relative to the icon anchor.\r\n *\r\n * @option tooltipAnchor: Point = [0, 0]\r\n * The coordinates of the point from which tooltips will \"open\", relative to the icon anchor.\r\n *\r\n * @option shadowUrl: String = null\r\n * The URL to the icon shadow image. If not specified, no shadow image will be created.\r\n *\r\n * @option shadowRetinaUrl: String = null\r\n *\r\n * @option shadowSize: Point = null\r\n * Size of the shadow image in pixels.\r\n *\r\n * @option shadowAnchor: Point = null\r\n * The coordinates of the \"tip\" of the shadow (relative to its top left corner) (the same\r\n * as iconAnchor if not specified).\r\n *\r\n * @option className: String = ''\r\n * A custom class name to assign to both icon and shadow images. Empty by default.\r\n */\n options: {\n popupAnchor: [0, 0],\n tooltipAnchor: [0, 0]\n },\n initialize: function (options) {\n setOptions(this, options);\n },\n // @method createIcon(oldIcon?: HTMLElement): HTMLElement\n // Called internally when the icon has to be shown, returns a `` HTML element\n // styled according to the options.\n createIcon: function (oldIcon) {\n return this._createIcon('icon', oldIcon);\n },\n // @method createShadow(oldIcon?: HTMLElement): HTMLElement\n // As `createIcon`, but for the shadow beneath it.\n createShadow: function (oldIcon) {\n return this._createIcon('shadow', oldIcon);\n },\n _createIcon: function (name, oldIcon) {\n var src = this._getIconUrl(name);\n\n if (!src) {\n if (name === 'icon') {\n throw new Error('iconUrl not set in Icon options (see the docs).');\n }\n\n return null;\n }\n\n var img = this._createImg(src, oldIcon && oldIcon.tagName === 'IMG' ? oldIcon : null);\n\n this._setIconStyles(img, name);\n\n return img;\n },\n _setIconStyles: function (img, name) {\n var options = this.options;\n var sizeOption = options[name + 'Size'];\n\n if (typeof sizeOption === 'number') {\n sizeOption = [sizeOption, sizeOption];\n }\n\n var size = toPoint(sizeOption),\n anchor = toPoint(name === 'shadow' && options.shadowAnchor || options.iconAnchor || size && size.divideBy(2, true));\n img.className = 'leaflet-marker-' + name + ' ' + (options.className || '');\n\n if (anchor) {\n img.style.marginLeft = -anchor.x + 'px';\n img.style.marginTop = -anchor.y + 'px';\n }\n\n if (size) {\n img.style.width = size.x + 'px';\n img.style.height = size.y + 'px';\n }\n },\n _createImg: function (src, el) {\n el = el || document.createElement('img');\n el.src = src;\n return el;\n },\n _getIconUrl: function (name) {\n return retina && this.options[name + 'RetinaUrl'] || this.options[name + 'Url'];\n }\n }); // @factory L.icon(options: Icon options)\n // Creates an icon instance with the given options.\n\n function icon(options) {\n return new Icon(options);\n }\n /*\n * @miniclass Icon.Default (Icon)\n * @aka L.Icon.Default\n * @section\n *\n * A trivial subclass of `Icon`, represents the icon to use in `Marker`s when\n * no icon is specified. Points to the blue marker image distributed with Leaflet\n * releases.\n *\n * In order to customize the default icon, just change the properties of `L.Icon.Default.prototype.options`\n * (which is a set of `Icon options`).\n *\n * If you want to _completely_ replace the default icon, override the\n * `L.Marker.prototype.options.icon` with your own icon instead.\n */\n\n\n var IconDefault = Icon.extend({\n options: {\n iconUrl: 'marker-icon.png',\n iconRetinaUrl: 'marker-icon-2x.png',\n shadowUrl: 'marker-shadow.png',\n iconSize: [25, 41],\n iconAnchor: [12, 41],\n popupAnchor: [1, -34],\n tooltipAnchor: [16, -28],\n shadowSize: [41, 41]\n },\n _getIconUrl: function (name) {\n if (!IconDefault.imagePath) {\n // Deprecated, backwards-compatibility only\n IconDefault.imagePath = this._detectIconPath();\n } // @option imagePath: String\n // `Icon.Default` will try to auto-detect the location of the\n // blue icon images. If you are placing these images in a non-standard\n // way, set this option to point to the right path.\n\n\n return (this.options.imagePath || IconDefault.imagePath) + Icon.prototype._getIconUrl.call(this, name);\n },\n _detectIconPath: function () {\n var el = create$1('div', 'leaflet-default-icon-path', document.body);\n var path = getStyle(el, 'background-image') || getStyle(el, 'backgroundImage'); // IE8\n\n document.body.removeChild(el);\n\n if (path === null || path.indexOf('url') !== 0) {\n path = '';\n } else {\n path = path.replace(/^url\\([\"']?/, '').replace(/marker-icon\\.png[\"']?\\)$/, '');\n }\n\n return path;\n }\n });\n /*\n * L.Handler.MarkerDrag is used internally by L.Marker to make the markers draggable.\n */\n\n /* @namespace Marker\n * @section Interaction handlers\n *\n * Interaction handlers are properties of a marker instance that allow you to control interaction behavior in runtime, enabling or disabling certain features such as dragging (see `Handler` methods). Example:\n *\n * ```js\n * marker.dragging.disable();\n * ```\n *\n * @property dragging: Handler\n * Marker dragging handler (by both mouse and touch). Only valid when the marker is on the map (Otherwise set [`marker.options.draggable`](#marker-draggable)).\n */\n\n var MarkerDrag = Handler.extend({\n initialize: function (marker) {\n this._marker = marker;\n },\n addHooks: function () {\n var icon = this._marker._icon;\n\n if (!this._draggable) {\n this._draggable = new Draggable(icon, icon, true);\n }\n\n this._draggable.on({\n dragstart: this._onDragStart,\n predrag: this._onPreDrag,\n drag: this._onDrag,\n dragend: this._onDragEnd\n }, this).enable();\n\n addClass(icon, 'leaflet-marker-draggable');\n },\n removeHooks: function () {\n this._draggable.off({\n dragstart: this._onDragStart,\n predrag: this._onPreDrag,\n drag: this._onDrag,\n dragend: this._onDragEnd\n }, this).disable();\n\n if (this._marker._icon) {\n removeClass(this._marker._icon, 'leaflet-marker-draggable');\n }\n },\n moved: function () {\n return this._draggable && this._draggable._moved;\n },\n _adjustPan: function (e) {\n var marker = this._marker,\n map = marker._map,\n speed = this._marker.options.autoPanSpeed,\n padding = this._marker.options.autoPanPadding,\n iconPos = getPosition(marker._icon),\n bounds = map.getPixelBounds(),\n origin = map.getPixelOrigin();\n var panBounds = toBounds(bounds.min._subtract(origin).add(padding), bounds.max._subtract(origin).subtract(padding));\n\n if (!panBounds.contains(iconPos)) {\n // Compute incremental movement\n var movement = toPoint((Math.max(panBounds.max.x, iconPos.x) - panBounds.max.x) / (bounds.max.x - panBounds.max.x) - (Math.min(panBounds.min.x, iconPos.x) - panBounds.min.x) / (bounds.min.x - panBounds.min.x), (Math.max(panBounds.max.y, iconPos.y) - panBounds.max.y) / (bounds.max.y - panBounds.max.y) - (Math.min(panBounds.min.y, iconPos.y) - panBounds.min.y) / (bounds.min.y - panBounds.min.y)).multiplyBy(speed);\n map.panBy(movement, {\n animate: false\n });\n\n this._draggable._newPos._add(movement);\n\n this._draggable._startPos._add(movement);\n\n setPosition(marker._icon, this._draggable._newPos);\n\n this._onDrag(e);\n\n this._panRequest = requestAnimFrame(this._adjustPan.bind(this, e));\n }\n },\n _onDragStart: function () {\n // @section Dragging events\n // @event dragstart: Event\n // Fired when the user starts dragging the marker.\n // @event movestart: Event\n // Fired when the marker starts moving (because of dragging).\n this._oldLatLng = this._marker.getLatLng();\n\n this._marker.closePopup().fire('movestart').fire('dragstart');\n },\n _onPreDrag: function (e) {\n if (this._marker.options.autoPan) {\n cancelAnimFrame(this._panRequest);\n this._panRequest = requestAnimFrame(this._adjustPan.bind(this, e));\n }\n },\n _onDrag: function (e) {\n var marker = this._marker,\n shadow = marker._shadow,\n iconPos = getPosition(marker._icon),\n latlng = marker._map.layerPointToLatLng(iconPos); // update shadow position\n\n\n if (shadow) {\n setPosition(shadow, iconPos);\n }\n\n marker._latlng = latlng;\n e.latlng = latlng;\n e.oldLatLng = this._oldLatLng; // @event drag: Event\n // Fired repeatedly while the user drags the marker.\n\n marker.fire('move', e).fire('drag', e);\n },\n _onDragEnd: function (e) {\n // @event dragend: DragEndEvent\n // Fired when the user stops dragging the marker.\n cancelAnimFrame(this._panRequest); // @event moveend: Event\n // Fired when the marker stops moving (because of dragging).\n\n delete this._oldLatLng;\n\n this._marker.fire('moveend').fire('dragend', e);\n }\n });\n /*\r\n * @class Marker\r\n * @inherits Interactive layer\r\n * @aka L.Marker\r\n * L.Marker is used to display clickable/draggable icons on the map. Extends `Layer`.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * L.marker([50.5, 30.5]).addTo(map);\r\n * ```\r\n */\n\n var Marker = Layer.extend({\n // @section\n // @aka Marker options\n options: {\n // @option icon: Icon = *\n // Icon instance to use for rendering the marker.\n // See [Icon documentation](#L.Icon) for details on how to customize the marker icon.\n // If not specified, a common instance of `L.Icon.Default` is used.\n icon: new IconDefault(),\n // Option inherited from \"Interactive layer\" abstract class\n interactive: true,\n // @option keyboard: Boolean = true\n // Whether the marker can be tabbed to with a keyboard and clicked by pressing enter.\n keyboard: true,\n // @option title: String = ''\n // Text for the browser tooltip that appear on marker hover (no tooltip by default).\n title: '',\n // @option alt: String = ''\n // Text for the `alt` attribute of the icon image (useful for accessibility).\n alt: '',\n // @option zIndexOffset: Number = 0\n // By default, marker images zIndex is set automatically based on its latitude. Use this option if you want to put the marker on top of all others (or below), specifying a high value like `1000` (or high negative value, respectively).\n zIndexOffset: 0,\n // @option opacity: Number = 1.0\n // The opacity of the marker.\n opacity: 1,\n // @option riseOnHover: Boolean = false\n // If `true`, the marker will get on top of others when you hover the mouse over it.\n riseOnHover: false,\n // @option riseOffset: Number = 250\n // The z-index offset used for the `riseOnHover` feature.\n riseOffset: 250,\n // @option pane: String = 'markerPane'\n // `Map pane` where the markers icon will be added.\n pane: 'markerPane',\n // @option bubblingMouseEvents: Boolean = false\n // When `true`, a mouse event on this marker will trigger the same event on the map\n // (unless [`L.DomEvent.stopPropagation`](#domevent-stoppropagation) is used).\n bubblingMouseEvents: false,\n // @section Draggable marker options\n // @option draggable: Boolean = false\n // Whether the marker is draggable with mouse/touch or not.\n draggable: false,\n // @option autoPan: Boolean = false\n // Whether to pan the map when dragging this marker near its edge or not.\n autoPan: false,\n // @option autoPanPadding: Point = Point(50, 50)\n // Distance (in pixels to the left/right and to the top/bottom) of the\n // map edge to start panning the map.\n autoPanPadding: [50, 50],\n // @option autoPanSpeed: Number = 10\n // Number of pixels the map should pan by.\n autoPanSpeed: 10\n },\n\n /* @section\r\n *\r\n * In addition to [shared layer methods](#Layer) like `addTo()` and `remove()` and [popup methods](#Popup) like bindPopup() you can also use the following methods:\r\n */\n initialize: function (latlng, options) {\n setOptions(this, options);\n this._latlng = toLatLng(latlng);\n },\n onAdd: function (map) {\n this._zoomAnimated = this._zoomAnimated && map.options.markerZoomAnimation;\n\n if (this._zoomAnimated) {\n map.on('zoomanim', this._animateZoom, this);\n }\n\n this._initIcon();\n\n this.update();\n },\n onRemove: function (map) {\n if (this.dragging && this.dragging.enabled()) {\n this.options.draggable = true;\n this.dragging.removeHooks();\n }\n\n delete this.dragging;\n\n if (this._zoomAnimated) {\n map.off('zoomanim', this._animateZoom, this);\n }\n\n this._removeIcon();\n\n this._removeShadow();\n },\n getEvents: function () {\n return {\n zoom: this.update,\n viewreset: this.update\n };\n },\n // @method getLatLng: LatLng\n // Returns the current geographical position of the marker.\n getLatLng: function () {\n return this._latlng;\n },\n // @method setLatLng(latlng: LatLng): this\n // Changes the marker position to the given point.\n setLatLng: function (latlng) {\n var oldLatLng = this._latlng;\n this._latlng = toLatLng(latlng);\n this.update(); // @event move: Event\n // Fired when the marker is moved via [`setLatLng`](#marker-setlatlng) or by [dragging](#marker-dragging). Old and new coordinates are included in event arguments as `oldLatLng`, `latlng`.\n\n return this.fire('move', {\n oldLatLng: oldLatLng,\n latlng: this._latlng\n });\n },\n // @method setZIndexOffset(offset: Number): this\n // Changes the [zIndex offset](#marker-zindexoffset) of the marker.\n setZIndexOffset: function (offset) {\n this.options.zIndexOffset = offset;\n return this.update();\n },\n // @method setIcon(icon: Icon): this\n // Changes the marker icon.\n setIcon: function (icon) {\n this.options.icon = icon;\n\n if (this._map) {\n this._initIcon();\n\n this.update();\n }\n\n if (this._popup) {\n this.bindPopup(this._popup, this._popup.options);\n }\n\n return this;\n },\n getElement: function () {\n return this._icon;\n },\n update: function () {\n if (this._icon && this._map) {\n var pos = this._map.latLngToLayerPoint(this._latlng).round();\n\n this._setPos(pos);\n }\n\n return this;\n },\n _initIcon: function () {\n var options = this.options,\n classToAdd = 'leaflet-zoom-' + (this._zoomAnimated ? 'animated' : 'hide');\n var icon = options.icon.createIcon(this._icon),\n addIcon = false; // if we're not reusing the icon, remove the old one and init new one\n\n if (icon !== this._icon) {\n if (this._icon) {\n this._removeIcon();\n }\n\n addIcon = true;\n\n if (options.title) {\n icon.title = options.title;\n }\n\n if (icon.tagName === 'IMG') {\n icon.alt = options.alt || '';\n }\n }\n\n addClass(icon, classToAdd);\n\n if (options.keyboard) {\n icon.tabIndex = '0';\n }\n\n this._icon = icon;\n\n if (options.riseOnHover) {\n this.on({\n mouseover: this._bringToFront,\n mouseout: this._resetZIndex\n });\n }\n\n var newShadow = options.icon.createShadow(this._shadow),\n addShadow = false;\n\n if (newShadow !== this._shadow) {\n this._removeShadow();\n\n addShadow = true;\n }\n\n if (newShadow) {\n addClass(newShadow, classToAdd);\n newShadow.alt = '';\n }\n\n this._shadow = newShadow;\n\n if (options.opacity < 1) {\n this._updateOpacity();\n }\n\n if (addIcon) {\n this.getPane().appendChild(this._icon);\n }\n\n this._initInteraction();\n\n if (newShadow && addShadow) {\n this.getPane('shadowPane').appendChild(this._shadow);\n }\n },\n _removeIcon: function () {\n if (this.options.riseOnHover) {\n this.off({\n mouseover: this._bringToFront,\n mouseout: this._resetZIndex\n });\n }\n\n remove(this._icon);\n this.removeInteractiveTarget(this._icon);\n this._icon = null;\n },\n _removeShadow: function () {\n if (this._shadow) {\n remove(this._shadow);\n }\n\n this._shadow = null;\n },\n _setPos: function (pos) {\n setPosition(this._icon, pos);\n\n if (this._shadow) {\n setPosition(this._shadow, pos);\n }\n\n this._zIndex = pos.y + this.options.zIndexOffset;\n\n this._resetZIndex();\n },\n _updateZIndex: function (offset) {\n this._icon.style.zIndex = this._zIndex + offset;\n },\n _animateZoom: function (opt) {\n var pos = this._map._latLngToNewLayerPoint(this._latlng, opt.zoom, opt.center).round();\n\n this._setPos(pos);\n },\n _initInteraction: function () {\n if (!this.options.interactive) {\n return;\n }\n\n addClass(this._icon, 'leaflet-interactive');\n this.addInteractiveTarget(this._icon);\n\n if (MarkerDrag) {\n var draggable = this.options.draggable;\n\n if (this.dragging) {\n draggable = this.dragging.enabled();\n this.dragging.disable();\n }\n\n this.dragging = new MarkerDrag(this);\n\n if (draggable) {\n this.dragging.enable();\n }\n }\n },\n // @method setOpacity(opacity: Number): this\n // Changes the opacity of the marker.\n setOpacity: function (opacity) {\n this.options.opacity = opacity;\n\n if (this._map) {\n this._updateOpacity();\n }\n\n return this;\n },\n _updateOpacity: function () {\n var opacity = this.options.opacity;\n setOpacity(this._icon, opacity);\n\n if (this._shadow) {\n setOpacity(this._shadow, opacity);\n }\n },\n _bringToFront: function () {\n this._updateZIndex(this.options.riseOffset);\n },\n _resetZIndex: function () {\n this._updateZIndex(0);\n },\n _getPopupAnchor: function () {\n return this.options.icon.options.popupAnchor;\n },\n _getTooltipAnchor: function () {\n return this.options.icon.options.tooltipAnchor;\n }\n }); // factory L.marker(latlng: LatLng, options? : Marker options)\n // @factory L.marker(latlng: LatLng, options? : Marker options)\n // Instantiates a Marker object given a geographical point and optionally an options object.\n\n function marker(latlng, options) {\n return new Marker(latlng, options);\n }\n /*\n * @class Path\n * @aka L.Path\n * @inherits Interactive layer\n *\n * An abstract class that contains options and constants shared between vector\n * overlays (Polygon, Polyline, Circle). Do not use it directly. Extends `Layer`.\n */\n\n\n var Path = Layer.extend({\n // @section\n // @aka Path options\n options: {\n // @option stroke: Boolean = true\n // Whether to draw stroke along the path. Set it to `false` to disable borders on polygons or circles.\n stroke: true,\n // @option color: String = '#3388ff'\n // Stroke color\n color: '#3388ff',\n // @option weight: Number = 3\n // Stroke width in pixels\n weight: 3,\n // @option opacity: Number = 1.0\n // Stroke opacity\n opacity: 1,\n // @option lineCap: String= 'round'\n // A string that defines [shape to be used at the end](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linecap) of the stroke.\n lineCap: 'round',\n // @option lineJoin: String = 'round'\n // A string that defines [shape to be used at the corners](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linejoin) of the stroke.\n lineJoin: 'round',\n // @option dashArray: String = null\n // A string that defines the stroke [dash pattern](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dasharray). Doesn't work on `Canvas`-powered layers in [some old browsers](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility).\n dashArray: null,\n // @option dashOffset: String = null\n // A string that defines the [distance into the dash pattern to start the dash](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dashoffset). Doesn't work on `Canvas`-powered layers in [some old browsers](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility).\n dashOffset: null,\n // @option fill: Boolean = depends\n // Whether to fill the path with color. Set it to `false` to disable filling on polygons or circles.\n fill: false,\n // @option fillColor: String = *\n // Fill color. Defaults to the value of the [`color`](#path-color) option\n fillColor: null,\n // @option fillOpacity: Number = 0.2\n // Fill opacity.\n fillOpacity: 0.2,\n // @option fillRule: String = 'evenodd'\n // A string that defines [how the inside of a shape](https://developer.mozilla.org/docs/Web/SVG/Attribute/fill-rule) is determined.\n fillRule: 'evenodd',\n // className: '',\n // Option inherited from \"Interactive layer\" abstract class\n interactive: true,\n // @option bubblingMouseEvents: Boolean = true\n // When `true`, a mouse event on this path will trigger the same event on the map\n // (unless [`L.DomEvent.stopPropagation`](#domevent-stoppropagation) is used).\n bubblingMouseEvents: true\n },\n beforeAdd: function (map) {\n // Renderer is set here because we need to call renderer.getEvents\n // before this.getEvents.\n this._renderer = map.getRenderer(this);\n },\n onAdd: function () {\n this._renderer._initPath(this);\n\n this._reset();\n\n this._renderer._addPath(this);\n },\n onRemove: function () {\n this._renderer._removePath(this);\n },\n // @method redraw(): this\n // Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.\n redraw: function () {\n if (this._map) {\n this._renderer._updatePath(this);\n }\n\n return this;\n },\n // @method setStyle(style: Path options): this\n // Changes the appearance of a Path based on the options in the `Path options` object.\n setStyle: function (style) {\n setOptions(this, style);\n\n if (this._renderer) {\n this._renderer._updateStyle(this);\n }\n\n return this;\n },\n // @method bringToFront(): this\n // Brings the layer to the top of all path layers.\n bringToFront: function () {\n if (this._renderer) {\n this._renderer._bringToFront(this);\n }\n\n return this;\n },\n // @method bringToBack(): this\n // Brings the layer to the bottom of all path layers.\n bringToBack: function () {\n if (this._renderer) {\n this._renderer._bringToBack(this);\n }\n\n return this;\n },\n getElement: function () {\n return this._path;\n },\n _reset: function () {\n // defined in child classes\n this._project();\n\n this._update();\n },\n _clickTolerance: function () {\n // used when doing hit detection for Canvas layers\n return (this.options.stroke ? this.options.weight / 2 : 0) + this._renderer.options.tolerance;\n }\n });\n /*\n * @class CircleMarker\n * @aka L.CircleMarker\n * @inherits Path\n *\n * A circle of a fixed size with radius specified in pixels. Extends `Path`.\n */\n\n var CircleMarker = Path.extend({\n // @section\n // @aka CircleMarker options\n options: {\n fill: true,\n // @option radius: Number = 10\n // Radius of the circle marker, in pixels\n radius: 10\n },\n initialize: function (latlng, options) {\n setOptions(this, options);\n this._latlng = toLatLng(latlng);\n this._radius = this.options.radius;\n },\n // @method setLatLng(latLng: LatLng): this\n // Sets the position of a circle marker to a new location.\n setLatLng: function (latlng) {\n this._latlng = toLatLng(latlng);\n this.redraw();\n return this.fire('move', {\n latlng: this._latlng\n });\n },\n // @method getLatLng(): LatLng\n // Returns the current geographical position of the circle marker\n getLatLng: function () {\n return this._latlng;\n },\n // @method setRadius(radius: Number): this\n // Sets the radius of a circle marker. Units are in pixels.\n setRadius: function (radius) {\n this.options.radius = this._radius = radius;\n return this.redraw();\n },\n // @method getRadius(): Number\n // Returns the current radius of the circle\n getRadius: function () {\n return this._radius;\n },\n setStyle: function (options) {\n var radius = options && options.radius || this._radius;\n Path.prototype.setStyle.call(this, options);\n this.setRadius(radius);\n return this;\n },\n _project: function () {\n this._point = this._map.latLngToLayerPoint(this._latlng);\n\n this._updateBounds();\n },\n _updateBounds: function () {\n var r = this._radius,\n r2 = this._radiusY || r,\n w = this._clickTolerance(),\n p = [r + w, r2 + w];\n\n this._pxBounds = new Bounds(this._point.subtract(p), this._point.add(p));\n },\n _update: function () {\n if (this._map) {\n this._updatePath();\n }\n },\n _updatePath: function () {\n this._renderer._updateCircle(this);\n },\n _empty: function () {\n return this._radius && !this._renderer._bounds.intersects(this._pxBounds);\n },\n // Needed by the `Canvas` renderer for interactivity\n _containsPoint: function (p) {\n return p.distanceTo(this._point) <= this._radius + this._clickTolerance();\n }\n }); // @factory L.circleMarker(latlng: LatLng, options?: CircleMarker options)\n // Instantiates a circle marker object given a geographical point, and an optional options object.\n\n function circleMarker(latlng, options) {\n return new CircleMarker(latlng, options);\n }\n /*\n * @class Circle\n * @aka L.Circle\n * @inherits CircleMarker\n *\n * A class for drawing circle overlays on a map. Extends `CircleMarker`.\n *\n * It's an approximation and starts to diverge from a real circle closer to poles (due to projection distortion).\n *\n * @example\n *\n * ```js\n * L.circle([50.5, 30.5], {radius: 200}).addTo(map);\n * ```\n */\n\n\n var Circle = CircleMarker.extend({\n initialize: function (latlng, options, legacyOptions) {\n if (typeof options === 'number') {\n // Backwards compatibility with 0.7.x factory (latlng, radius, options?)\n options = extend({}, legacyOptions, {\n radius: options\n });\n }\n\n setOptions(this, options);\n this._latlng = toLatLng(latlng);\n\n if (isNaN(this.options.radius)) {\n throw new Error('Circle radius cannot be NaN');\n } // @section\n // @aka Circle options\n // @option radius: Number; Radius of the circle, in meters.\n\n\n this._mRadius = this.options.radius;\n },\n // @method setRadius(radius: Number): this\n // Sets the radius of a circle. Units are in meters.\n setRadius: function (radius) {\n this._mRadius = radius;\n return this.redraw();\n },\n // @method getRadius(): Number\n // Returns the current radius of a circle. Units are in meters.\n getRadius: function () {\n return this._mRadius;\n },\n // @method getBounds(): LatLngBounds\n // Returns the `LatLngBounds` of the path.\n getBounds: function () {\n var half = [this._radius, this._radiusY || this._radius];\n return new LatLngBounds(this._map.layerPointToLatLng(this._point.subtract(half)), this._map.layerPointToLatLng(this._point.add(half)));\n },\n setStyle: Path.prototype.setStyle,\n _project: function () {\n var lng = this._latlng.lng,\n lat = this._latlng.lat,\n map = this._map,\n crs = map.options.crs;\n\n if (crs.distance === Earth.distance) {\n var d = Math.PI / 180,\n latR = this._mRadius / Earth.R / d,\n top = map.project([lat + latR, lng]),\n bottom = map.project([lat - latR, lng]),\n p = top.add(bottom).divideBy(2),\n lat2 = map.unproject(p).lat,\n lngR = Math.acos((Math.cos(latR * d) - Math.sin(lat * d) * Math.sin(lat2 * d)) / (Math.cos(lat * d) * Math.cos(lat2 * d))) / d;\n\n if (isNaN(lngR) || lngR === 0) {\n lngR = latR / Math.cos(Math.PI / 180 * lat); // Fallback for edge case, #2425\n }\n\n this._point = p.subtract(map.getPixelOrigin());\n this._radius = isNaN(lngR) ? 0 : p.x - map.project([lat2, lng - lngR]).x;\n this._radiusY = p.y - top.y;\n } else {\n var latlng2 = crs.unproject(crs.project(this._latlng).subtract([this._mRadius, 0]));\n this._point = map.latLngToLayerPoint(this._latlng);\n this._radius = this._point.x - map.latLngToLayerPoint(latlng2).x;\n }\n\n this._updateBounds();\n }\n }); // @factory L.circle(latlng: LatLng, options?: Circle options)\n // Instantiates a circle object given a geographical point, and an options object\n // which contains the circle radius.\n // @alternative\n // @factory L.circle(latlng: LatLng, radius: Number, options?: Circle options)\n // Obsolete way of instantiating a circle, for compatibility with 0.7.x code.\n // Do not use in new applications or plugins.\n\n function circle(latlng, options, legacyOptions) {\n return new Circle(latlng, options, legacyOptions);\n }\n /*\n * @class Polyline\n * @aka L.Polyline\n * @inherits Path\n *\n * A class for drawing polyline overlays on a map. Extends `Path`.\n *\n * @example\n *\n * ```js\n * // create a red polyline from an array of LatLng points\n * var latlngs = [\n * \t[45.51, -122.68],\n * \t[37.77, -122.43],\n * \t[34.04, -118.2]\n * ];\n *\n * var polyline = L.polyline(latlngs, {color: 'red'}).addTo(map);\n *\n * // zoom the map to the polyline\n * map.fitBounds(polyline.getBounds());\n * ```\n *\n * You can also pass a multi-dimensional array to represent a `MultiPolyline` shape:\n *\n * ```js\n * // create a red polyline from an array of arrays of LatLng points\n * var latlngs = [\n * \t[[45.51, -122.68],\n * \t [37.77, -122.43],\n * \t [34.04, -118.2]],\n * \t[[40.78, -73.91],\n * \t [41.83, -87.62],\n * \t [32.76, -96.72]]\n * ];\n * ```\n */\n\n\n var Polyline = Path.extend({\n // @section\n // @aka Polyline options\n options: {\n // @option smoothFactor: Number = 1.0\n // How much to simplify the polyline on each zoom level. More means\n // better performance and smoother look, and less means more accurate representation.\n smoothFactor: 1.0,\n // @option noClip: Boolean = false\n // Disable polyline clipping.\n noClip: false\n },\n initialize: function (latlngs, options) {\n setOptions(this, options);\n\n this._setLatLngs(latlngs);\n },\n // @method getLatLngs(): LatLng[]\n // Returns an array of the points in the path, or nested arrays of points in case of multi-polyline.\n getLatLngs: function () {\n return this._latlngs;\n },\n // @method setLatLngs(latlngs: LatLng[]): this\n // Replaces all the points in the polyline with the given array of geographical points.\n setLatLngs: function (latlngs) {\n this._setLatLngs(latlngs);\n\n return this.redraw();\n },\n // @method isEmpty(): Boolean\n // Returns `true` if the Polyline has no LatLngs.\n isEmpty: function () {\n return !this._latlngs.length;\n },\n // @method closestLayerPoint(p: Point): Point\n // Returns the point closest to `p` on the Polyline.\n closestLayerPoint: function (p) {\n var minDistance = Infinity,\n minPoint = null,\n closest = _sqClosestPointOnSegment,\n p1,\n p2;\n\n for (var j = 0, jLen = this._parts.length; j < jLen; j++) {\n var points = this._parts[j];\n\n for (var i = 1, len = points.length; i < len; i++) {\n p1 = points[i - 1];\n p2 = points[i];\n var sqDist = closest(p, p1, p2, true);\n\n if (sqDist < minDistance) {\n minDistance = sqDist;\n minPoint = closest(p, p1, p2);\n }\n }\n }\n\n if (minPoint) {\n minPoint.distance = Math.sqrt(minDistance);\n }\n\n return minPoint;\n },\n // @method getCenter(): LatLng\n // Returns the center ([centroid](http://en.wikipedia.org/wiki/Centroid)) of the polyline.\n getCenter: function () {\n // throws error when not yet added to map as this center calculation requires projected coordinates\n if (!this._map) {\n throw new Error('Must add layer to map before using getCenter()');\n }\n\n var i,\n halfDist,\n segDist,\n dist,\n p1,\n p2,\n ratio,\n points = this._rings[0],\n len = points.length;\n\n if (!len) {\n return null;\n } // polyline centroid algorithm; only uses the first ring if there are multiple\n\n\n for (i = 0, halfDist = 0; i < len - 1; i++) {\n halfDist += points[i].distanceTo(points[i + 1]) / 2;\n } // The line is so small in the current view that all points are on the same pixel.\n\n\n if (halfDist === 0) {\n return this._map.layerPointToLatLng(points[0]);\n }\n\n for (i = 0, dist = 0; i < len - 1; i++) {\n p1 = points[i];\n p2 = points[i + 1];\n segDist = p1.distanceTo(p2);\n dist += segDist;\n\n if (dist > halfDist) {\n ratio = (dist - halfDist) / segDist;\n return this._map.layerPointToLatLng([p2.x - ratio * (p2.x - p1.x), p2.y - ratio * (p2.y - p1.y)]);\n }\n }\n },\n // @method getBounds(): LatLngBounds\n // Returns the `LatLngBounds` of the path.\n getBounds: function () {\n return this._bounds;\n },\n // @method addLatLng(latlng: LatLng, latlngs? LatLng[]): this\n // Adds a given point to the polyline. By default, adds to the first ring of\n // the polyline in case of a multi-polyline, but can be overridden by passing\n // a specific ring as a LatLng array (that you can earlier access with [`getLatLngs`](#polyline-getlatlngs)).\n addLatLng: function (latlng, latlngs) {\n latlngs = latlngs || this._defaultShape();\n latlng = toLatLng(latlng);\n latlngs.push(latlng);\n\n this._bounds.extend(latlng);\n\n return this.redraw();\n },\n _setLatLngs: function (latlngs) {\n this._bounds = new LatLngBounds();\n this._latlngs = this._convertLatLngs(latlngs);\n },\n _defaultShape: function () {\n return isFlat(this._latlngs) ? this._latlngs : this._latlngs[0];\n },\n // recursively convert latlngs input into actual LatLng instances; calculate bounds along the way\n _convertLatLngs: function (latlngs) {\n var result = [],\n flat = isFlat(latlngs);\n\n for (var i = 0, len = latlngs.length; i < len; i++) {\n if (flat) {\n result[i] = toLatLng(latlngs[i]);\n\n this._bounds.extend(result[i]);\n } else {\n result[i] = this._convertLatLngs(latlngs[i]);\n }\n }\n\n return result;\n },\n _project: function () {\n var pxBounds = new Bounds();\n this._rings = [];\n\n this._projectLatlngs(this._latlngs, this._rings, pxBounds);\n\n var w = this._clickTolerance(),\n p = new Point(w, w);\n\n if (this._bounds.isValid() && pxBounds.isValid()) {\n pxBounds.min._subtract(p);\n\n pxBounds.max._add(p);\n\n this._pxBounds = pxBounds;\n }\n },\n // recursively turns latlngs into a set of rings with projected coordinates\n _projectLatlngs: function (latlngs, result, projectedBounds) {\n var flat = latlngs[0] instanceof LatLng,\n len = latlngs.length,\n i,\n ring;\n\n if (flat) {\n ring = [];\n\n for (i = 0; i < len; i++) {\n ring[i] = this._map.latLngToLayerPoint(latlngs[i]);\n projectedBounds.extend(ring[i]);\n }\n\n result.push(ring);\n } else {\n for (i = 0; i < len; i++) {\n this._projectLatlngs(latlngs[i], result, projectedBounds);\n }\n }\n },\n // clip polyline by renderer bounds so that we have less to render for performance\n _clipPoints: function () {\n var bounds = this._renderer._bounds;\n this._parts = [];\n\n if (!this._pxBounds || !this._pxBounds.intersects(bounds)) {\n return;\n }\n\n if (this.options.noClip) {\n this._parts = this._rings;\n return;\n }\n\n var parts = this._parts,\n i,\n j,\n k,\n len,\n len2,\n segment,\n points;\n\n for (i = 0, k = 0, len = this._rings.length; i < len; i++) {\n points = this._rings[i];\n\n for (j = 0, len2 = points.length; j < len2 - 1; j++) {\n segment = clipSegment(points[j], points[j + 1], bounds, j, true);\n\n if (!segment) {\n continue;\n }\n\n parts[k] = parts[k] || [];\n parts[k].push(segment[0]); // if segment goes out of screen, or it's the last one, it's the end of the line part\n\n if (segment[1] !== points[j + 1] || j === len2 - 2) {\n parts[k].push(segment[1]);\n k++;\n }\n }\n }\n },\n // simplify each clipped part of the polyline for performance\n _simplifyPoints: function () {\n var parts = this._parts,\n tolerance = this.options.smoothFactor;\n\n for (var i = 0, len = parts.length; i < len; i++) {\n parts[i] = simplify(parts[i], tolerance);\n }\n },\n _update: function () {\n if (!this._map) {\n return;\n }\n\n this._clipPoints();\n\n this._simplifyPoints();\n\n this._updatePath();\n },\n _updatePath: function () {\n this._renderer._updatePoly(this);\n },\n // Needed by the `Canvas` renderer for interactivity\n _containsPoint: function (p, closed) {\n var i,\n j,\n k,\n len,\n len2,\n part,\n w = this._clickTolerance();\n\n if (!this._pxBounds || !this._pxBounds.contains(p)) {\n return false;\n } // hit detection for polylines\n\n\n for (i = 0, len = this._parts.length; i < len; i++) {\n part = this._parts[i];\n\n for (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) {\n if (!closed && j === 0) {\n continue;\n }\n\n if (pointToSegmentDistance(p, part[k], part[j]) <= w) {\n return true;\n }\n }\n }\n\n return false;\n }\n }); // @factory L.polyline(latlngs: LatLng[], options?: Polyline options)\n // Instantiates a polyline object given an array of geographical points and\n // optionally an options object. You can create a `Polyline` object with\n // multiple separate lines (`MultiPolyline`) by passing an array of arrays\n // of geographic points.\n\n function polyline(latlngs, options) {\n return new Polyline(latlngs, options);\n } // Retrocompat. Allow plugins to support Leaflet versions before and after 1.1.\n\n\n Polyline._flat = _flat;\n /*\n * @class Polygon\n * @aka L.Polygon\n * @inherits Polyline\n *\n * A class for drawing polygon overlays on a map. Extends `Polyline`.\n *\n * Note that points you pass when creating a polygon shouldn't have an additional last point equal to the first one — it's better to filter out such points.\n *\n *\n * @example\n *\n * ```js\n * // create a red polygon from an array of LatLng points\n * var latlngs = [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]];\n *\n * var polygon = L.polygon(latlngs, {color: 'red'}).addTo(map);\n *\n * // zoom the map to the polygon\n * map.fitBounds(polygon.getBounds());\n * ```\n *\n * You can also pass an array of arrays of latlngs, with the first array representing the outer shape and the other arrays representing holes in the outer shape:\n *\n * ```js\n * var latlngs = [\n * [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring\n * [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole\n * ];\n * ```\n *\n * Additionally, you can pass a multi-dimensional array to represent a MultiPolygon shape.\n *\n * ```js\n * var latlngs = [\n * [ // first polygon\n * [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring\n * [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole\n * ],\n * [ // second polygon\n * [[41, -111.03],[45, -111.04],[45, -104.05],[41, -104.05]]\n * ]\n * ];\n * ```\n */\n\n var Polygon = Polyline.extend({\n options: {\n fill: true\n },\n isEmpty: function () {\n return !this._latlngs.length || !this._latlngs[0].length;\n },\n getCenter: function () {\n // throws error when not yet added to map as this center calculation requires projected coordinates\n if (!this._map) {\n throw new Error('Must add layer to map before using getCenter()');\n }\n\n var i,\n j,\n p1,\n p2,\n f,\n area,\n x,\n y,\n center,\n points = this._rings[0],\n len = points.length;\n\n if (!len) {\n return null;\n } // polygon centroid algorithm; only uses the first ring if there are multiple\n\n\n area = x = y = 0;\n\n for (i = 0, j = len - 1; i < len; j = i++) {\n p1 = points[i];\n p2 = points[j];\n f = p1.y * p2.x - p2.y * p1.x;\n x += (p1.x + p2.x) * f;\n y += (p1.y + p2.y) * f;\n area += f * 3;\n }\n\n if (area === 0) {\n // Polygon is so small that all points are on same pixel.\n center = points[0];\n } else {\n center = [x / area, y / area];\n }\n\n return this._map.layerPointToLatLng(center);\n },\n _convertLatLngs: function (latlngs) {\n var result = Polyline.prototype._convertLatLngs.call(this, latlngs),\n len = result.length; // remove last point if it equals first one\n\n\n if (len >= 2 && result[0] instanceof LatLng && result[0].equals(result[len - 1])) {\n result.pop();\n }\n\n return result;\n },\n _setLatLngs: function (latlngs) {\n Polyline.prototype._setLatLngs.call(this, latlngs);\n\n if (isFlat(this._latlngs)) {\n this._latlngs = [this._latlngs];\n }\n },\n _defaultShape: function () {\n return isFlat(this._latlngs[0]) ? this._latlngs[0] : this._latlngs[0][0];\n },\n _clipPoints: function () {\n // polygons need a different clipping algorithm so we redefine that\n var bounds = this._renderer._bounds,\n w = this.options.weight,\n p = new Point(w, w); // increase clip padding by stroke width to avoid stroke on clip edges\n\n bounds = new Bounds(bounds.min.subtract(p), bounds.max.add(p));\n this._parts = [];\n\n if (!this._pxBounds || !this._pxBounds.intersects(bounds)) {\n return;\n }\n\n if (this.options.noClip) {\n this._parts = this._rings;\n return;\n }\n\n for (var i = 0, len = this._rings.length, clipped; i < len; i++) {\n clipped = clipPolygon(this._rings[i], bounds, true);\n\n if (clipped.length) {\n this._parts.push(clipped);\n }\n }\n },\n _updatePath: function () {\n this._renderer._updatePoly(this, true);\n },\n // Needed by the `Canvas` renderer for interactivity\n _containsPoint: function (p) {\n var inside = false,\n part,\n p1,\n p2,\n i,\n j,\n k,\n len,\n len2;\n\n if (!this._pxBounds || !this._pxBounds.contains(p)) {\n return false;\n } // ray casting algorithm for detecting if point is in polygon\n\n\n for (i = 0, len = this._parts.length; i < len; i++) {\n part = this._parts[i];\n\n for (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) {\n p1 = part[j];\n p2 = part[k];\n\n if (p1.y > p.y !== p2.y > p.y && p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x) {\n inside = !inside;\n }\n }\n } // also check if it's on polygon stroke\n\n\n return inside || Polyline.prototype._containsPoint.call(this, p, true);\n }\n }); // @factory L.polygon(latlngs: LatLng[], options?: Polyline options)\n\n function polygon(latlngs, options) {\n return new Polygon(latlngs, options);\n }\n /*\r\n * @class GeoJSON\r\n * @aka L.GeoJSON\r\n * @inherits FeatureGroup\r\n *\r\n * Represents a GeoJSON object or an array of GeoJSON objects. Allows you to parse\r\n * GeoJSON data and display it on the map. Extends `FeatureGroup`.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * L.geoJSON(data, {\r\n * \tstyle: function (feature) {\r\n * \t\treturn {color: feature.properties.color};\r\n * \t}\r\n * }).bindPopup(function (layer) {\r\n * \treturn layer.feature.properties.description;\r\n * }).addTo(map);\r\n * ```\r\n */\n\n\n var GeoJSON = FeatureGroup.extend({\n /* @section\r\n * @aka GeoJSON options\r\n *\r\n * @option pointToLayer: Function = *\r\n * A `Function` defining how GeoJSON points spawn Leaflet layers. It is internally\r\n * called when data is added, passing the GeoJSON point feature and its `LatLng`.\r\n * The default is to spawn a default `Marker`:\r\n * ```js\r\n * function(geoJsonPoint, latlng) {\r\n * \treturn L.marker(latlng);\r\n * }\r\n * ```\r\n *\r\n * @option style: Function = *\r\n * A `Function` defining the `Path options` for styling GeoJSON lines and polygons,\r\n * called internally when data is added.\r\n * The default value is to not override any defaults:\r\n * ```js\r\n * function (geoJsonFeature) {\r\n * \treturn {}\r\n * }\r\n * ```\r\n *\r\n * @option onEachFeature: Function = *\r\n * A `Function` that will be called once for each created `Feature`, after it has\r\n * been created and styled. Useful for attaching events and popups to features.\r\n * The default is to do nothing with the newly created layers:\r\n * ```js\r\n * function (feature, layer) {}\r\n * ```\r\n *\r\n * @option filter: Function = *\r\n * A `Function` that will be used to decide whether to include a feature or not.\r\n * The default is to include all features:\r\n * ```js\r\n * function (geoJsonFeature) {\r\n * \treturn true;\r\n * }\r\n * ```\r\n * Note: dynamically changing the `filter` option will have effect only on newly\r\n * added data. It will _not_ re-evaluate already included features.\r\n *\r\n * @option coordsToLatLng: Function = *\r\n * A `Function` that will be used for converting GeoJSON coordinates to `LatLng`s.\r\n * The default is the `coordsToLatLng` static method.\r\n */\n initialize: function (geojson, options) {\n setOptions(this, options);\n this._layers = {};\n\n if (geojson) {\n this.addData(geojson);\n }\n },\n // @method addData( data ): this\n // Adds a GeoJSON object to the layer.\n addData: function (geojson) {\n var features = isArray(geojson) ? geojson : geojson.features,\n i,\n len,\n feature;\n\n if (features) {\n for (i = 0, len = features.length; i < len; i++) {\n // only add this if geometry or geometries are set and not null\n feature = features[i];\n\n if (feature.geometries || feature.geometry || feature.features || feature.coordinates) {\n this.addData(feature);\n }\n }\n\n return this;\n }\n\n var options = this.options;\n\n if (options.filter && !options.filter(geojson)) {\n return this;\n }\n\n var layer = geometryToLayer(geojson, options);\n\n if (!layer) {\n return this;\n }\n\n layer.feature = asFeature(geojson);\n layer.defaultOptions = layer.options;\n this.resetStyle(layer);\n\n if (options.onEachFeature) {\n options.onEachFeature(geojson, layer);\n }\n\n return this.addLayer(layer);\n },\n // @method resetStyle( layer ): this\n // Resets the given vector layer's style to the original GeoJSON style, useful for resetting style after hover events.\n resetStyle: function (layer) {\n // reset any custom styles\n layer.options = extend({}, layer.defaultOptions);\n\n this._setLayerStyle(layer, this.options.style);\n\n return this;\n },\n // @method setStyle( style ): this\n // Changes styles of GeoJSON vector layers with the given style function.\n setStyle: function (style) {\n return this.eachLayer(function (layer) {\n this._setLayerStyle(layer, style);\n }, this);\n },\n _setLayerStyle: function (layer, style) {\n if (typeof style === 'function') {\n style = style(layer.feature);\n }\n\n if (layer.setStyle) {\n layer.setStyle(style);\n }\n }\n }); // @section\n // There are several static functions which can be called without instantiating L.GeoJSON:\n // @function geometryToLayer(featureData: Object, options?: GeoJSON options): Layer\n // Creates a `Layer` from a given GeoJSON feature. Can use a custom\n // [`pointToLayer`](#geojson-pointtolayer) and/or [`coordsToLatLng`](#geojson-coordstolatlng)\n // functions if provided as options.\n\n function geometryToLayer(geojson, options) {\n var geometry = geojson.type === 'Feature' ? geojson.geometry : geojson,\n coords = geometry ? geometry.coordinates : null,\n layers = [],\n pointToLayer = options && options.pointToLayer,\n _coordsToLatLng = options && options.coordsToLatLng || coordsToLatLng,\n latlng,\n latlngs,\n i,\n len;\n\n if (!coords && !geometry) {\n return null;\n }\n\n switch (geometry.type) {\n case 'Point':\n latlng = _coordsToLatLng(coords);\n return pointToLayer ? pointToLayer(geojson, latlng) : new Marker(latlng);\n\n case 'MultiPoint':\n for (i = 0, len = coords.length; i < len; i++) {\n latlng = _coordsToLatLng(coords[i]);\n layers.push(pointToLayer ? pointToLayer(geojson, latlng) : new Marker(latlng));\n }\n\n return new FeatureGroup(layers);\n\n case 'LineString':\n case 'MultiLineString':\n latlngs = coordsToLatLngs(coords, geometry.type === 'LineString' ? 0 : 1, _coordsToLatLng);\n return new Polyline(latlngs, options);\n\n case 'Polygon':\n case 'MultiPolygon':\n latlngs = coordsToLatLngs(coords, geometry.type === 'Polygon' ? 1 : 2, _coordsToLatLng);\n return new Polygon(latlngs, options);\n\n case 'GeometryCollection':\n for (i = 0, len = geometry.geometries.length; i < len; i++) {\n var layer = geometryToLayer({\n geometry: geometry.geometries[i],\n type: 'Feature',\n properties: geojson.properties\n }, options);\n\n if (layer) {\n layers.push(layer);\n }\n }\n\n return new FeatureGroup(layers);\n\n default:\n throw new Error('Invalid GeoJSON object.');\n }\n } // @function coordsToLatLng(coords: Array): LatLng\n // Creates a `LatLng` object from an array of 2 numbers (longitude, latitude)\n // or 3 numbers (longitude, latitude, altitude) used in GeoJSON for points.\n\n\n function coordsToLatLng(coords) {\n return new LatLng(coords[1], coords[0], coords[2]);\n } // @function coordsToLatLngs(coords: Array, levelsDeep?: Number, coordsToLatLng?: Function): Array\n // Creates a multidimensional array of `LatLng`s from a GeoJSON coordinates array.\n // `levelsDeep` specifies the nesting level (0 is for an array of points, 1 for an array of arrays of points, etc., 0 by default).\n // Can use a custom [`coordsToLatLng`](#geojson-coordstolatlng) function.\n\n\n function coordsToLatLngs(coords, levelsDeep, _coordsToLatLng) {\n var latlngs = [];\n\n for (var i = 0, len = coords.length, latlng; i < len; i++) {\n latlng = levelsDeep ? coordsToLatLngs(coords[i], levelsDeep - 1, _coordsToLatLng) : (_coordsToLatLng || coordsToLatLng)(coords[i]);\n latlngs.push(latlng);\n }\n\n return latlngs;\n } // @function latLngToCoords(latlng: LatLng, precision?: Number): Array\n // Reverse of [`coordsToLatLng`](#geojson-coordstolatlng)\n\n\n function latLngToCoords(latlng, precision) {\n precision = typeof precision === 'number' ? precision : 6;\n return latlng.alt !== undefined ? [formatNum(latlng.lng, precision), formatNum(latlng.lat, precision), formatNum(latlng.alt, precision)] : [formatNum(latlng.lng, precision), formatNum(latlng.lat, precision)];\n } // @function latLngsToCoords(latlngs: Array, levelsDeep?: Number, closed?: Boolean): Array\n // Reverse of [`coordsToLatLngs`](#geojson-coordstolatlngs)\n // `closed` determines whether the first point should be appended to the end of the array to close the feature, only used when `levelsDeep` is 0. False by default.\n\n\n function latLngsToCoords(latlngs, levelsDeep, closed, precision) {\n var coords = [];\n\n for (var i = 0, len = latlngs.length; i < len; i++) {\n coords.push(levelsDeep ? latLngsToCoords(latlngs[i], levelsDeep - 1, closed, precision) : latLngToCoords(latlngs[i], precision));\n }\n\n if (!levelsDeep && closed) {\n coords.push(coords[0]);\n }\n\n return coords;\n }\n\n function getFeature(layer, newGeometry) {\n return layer.feature ? extend({}, layer.feature, {\n geometry: newGeometry\n }) : asFeature(newGeometry);\n } // @function asFeature(geojson: Object): Object\n // Normalize GeoJSON geometries/features into GeoJSON features.\n\n\n function asFeature(geojson) {\n if (geojson.type === 'Feature' || geojson.type === 'FeatureCollection') {\n return geojson;\n }\n\n return {\n type: 'Feature',\n properties: {},\n geometry: geojson\n };\n }\n\n var PointToGeoJSON = {\n toGeoJSON: function (precision) {\n return getFeature(this, {\n type: 'Point',\n coordinates: latLngToCoords(this.getLatLng(), precision)\n });\n }\n }; // @namespace Marker\n // @method toGeoJSON(): Object\n // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the marker (as a GeoJSON `Point` Feature).\n\n Marker.include(PointToGeoJSON); // @namespace CircleMarker\n // @method toGeoJSON(): Object\n // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the circle marker (as a GeoJSON `Point` Feature).\n\n Circle.include(PointToGeoJSON);\n CircleMarker.include(PointToGeoJSON); // @namespace Polyline\n // @method toGeoJSON(): Object\n // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the polyline (as a GeoJSON `LineString` or `MultiLineString` Feature).\n\n Polyline.include({\n toGeoJSON: function (precision) {\n var multi = !isFlat(this._latlngs);\n var coords = latLngsToCoords(this._latlngs, multi ? 1 : 0, false, precision);\n return getFeature(this, {\n type: (multi ? 'Multi' : '') + 'LineString',\n coordinates: coords\n });\n }\n }); // @namespace Polygon\n // @method toGeoJSON(): Object\n // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the polygon (as a GeoJSON `Polygon` or `MultiPolygon` Feature).\n\n Polygon.include({\n toGeoJSON: function (precision) {\n var holes = !isFlat(this._latlngs),\n multi = holes && !isFlat(this._latlngs[0]);\n var coords = latLngsToCoords(this._latlngs, multi ? 2 : holes ? 1 : 0, true, precision);\n\n if (!holes) {\n coords = [coords];\n }\n\n return getFeature(this, {\n type: (multi ? 'Multi' : '') + 'Polygon',\n coordinates: coords\n });\n }\n }); // @namespace LayerGroup\n\n LayerGroup.include({\n toMultiPoint: function (precision) {\n var coords = [];\n this.eachLayer(function (layer) {\n coords.push(layer.toGeoJSON(precision).geometry.coordinates);\n });\n return getFeature(this, {\n type: 'MultiPoint',\n coordinates: coords\n });\n },\n // @method toGeoJSON(): Object\n // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the layer group (as a GeoJSON `FeatureCollection`, `GeometryCollection`, or `MultiPoint`).\n toGeoJSON: function (precision) {\n var type = this.feature && this.feature.geometry && this.feature.geometry.type;\n\n if (type === 'MultiPoint') {\n return this.toMultiPoint(precision);\n }\n\n var isGeometryCollection = type === 'GeometryCollection',\n jsons = [];\n this.eachLayer(function (layer) {\n if (layer.toGeoJSON) {\n var json = layer.toGeoJSON(precision);\n\n if (isGeometryCollection) {\n jsons.push(json.geometry);\n } else {\n var feature = asFeature(json); // Squash nested feature collections\n\n if (feature.type === 'FeatureCollection') {\n jsons.push.apply(jsons, feature.features);\n } else {\n jsons.push(feature);\n }\n }\n }\n });\n\n if (isGeometryCollection) {\n return getFeature(this, {\n geometries: jsons,\n type: 'GeometryCollection'\n });\n }\n\n return {\n type: 'FeatureCollection',\n features: jsons\n };\n }\n }); // @namespace GeoJSON\n // @factory L.geoJSON(geojson?: Object, options?: GeoJSON options)\n // Creates a GeoJSON layer. Optionally accepts an object in\n // [GeoJSON format](https://tools.ietf.org/html/rfc7946) to display on the map\n // (you can alternatively add it later with `addData` method) and an `options` object.\n\n function geoJSON(geojson, options) {\n return new GeoJSON(geojson, options);\n } // Backward compatibility.\n\n\n var geoJson = geoJSON;\n /*\r\n * @class ImageOverlay\r\n * @aka L.ImageOverlay\r\n * @inherits Interactive layer\r\n *\r\n * Used to load and display a single image over specific bounds of the map. Extends `Layer`.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * var imageUrl = 'http://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg',\r\n * \timageBounds = [[40.712216, -74.22655], [40.773941, -74.12544]];\r\n * L.imageOverlay(imageUrl, imageBounds).addTo(map);\r\n * ```\r\n */\n\n var ImageOverlay = Layer.extend({\n // @section\n // @aka ImageOverlay options\n options: {\n // @option opacity: Number = 1.0\n // The opacity of the image overlay.\n opacity: 1,\n // @option alt: String = ''\n // Text for the `alt` attribute of the image (useful for accessibility).\n alt: '',\n // @option interactive: Boolean = false\n // If `true`, the image overlay will emit [mouse events](#interactive-layer) when clicked or hovered.\n interactive: false,\n // @option crossOrigin: Boolean|String = false\n // Whether the crossOrigin attribute will be added to the image.\n // If a String is provided, the image will have its crossOrigin attribute set to the String provided. This is needed if you want to access image pixel data.\n // Refer to [CORS Settings](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) for valid String values.\n crossOrigin: false,\n // @option errorOverlayUrl: String = ''\n // URL to the overlay image to show in place of the overlay that failed to load.\n errorOverlayUrl: '',\n // @option zIndex: Number = 1\n // The explicit [zIndex](https://developer.mozilla.org/docs/Web/CSS/CSS_Positioning/Understanding_z_index) of the overlay layer.\n zIndex: 1,\n // @option className: String = ''\n // A custom class name to assign to the image. Empty by default.\n className: ''\n },\n initialize: function (url, bounds, options) {\n // (String, LatLngBounds, Object)\n this._url = url;\n this._bounds = toLatLngBounds(bounds);\n setOptions(this, options);\n },\n onAdd: function () {\n if (!this._image) {\n this._initImage();\n\n if (this.options.opacity < 1) {\n this._updateOpacity();\n }\n }\n\n if (this.options.interactive) {\n addClass(this._image, 'leaflet-interactive');\n this.addInteractiveTarget(this._image);\n }\n\n this.getPane().appendChild(this._image);\n\n this._reset();\n },\n onRemove: function () {\n remove(this._image);\n\n if (this.options.interactive) {\n this.removeInteractiveTarget(this._image);\n }\n },\n // @method setOpacity(opacity: Number): this\n // Sets the opacity of the overlay.\n setOpacity: function (opacity) {\n this.options.opacity = opacity;\n\n if (this._image) {\n this._updateOpacity();\n }\n\n return this;\n },\n setStyle: function (styleOpts) {\n if (styleOpts.opacity) {\n this.setOpacity(styleOpts.opacity);\n }\n\n return this;\n },\n // @method bringToFront(): this\n // Brings the layer to the top of all overlays.\n bringToFront: function () {\n if (this._map) {\n toFront(this._image);\n }\n\n return this;\n },\n // @method bringToBack(): this\n // Brings the layer to the bottom of all overlays.\n bringToBack: function () {\n if (this._map) {\n toBack(this._image);\n }\n\n return this;\n },\n // @method setUrl(url: String): this\n // Changes the URL of the image.\n setUrl: function (url) {\n this._url = url;\n\n if (this._image) {\n this._image.src = url;\n }\n\n return this;\n },\n // @method setBounds(bounds: LatLngBounds): this\n // Update the bounds that this ImageOverlay covers\n setBounds: function (bounds) {\n this._bounds = toLatLngBounds(bounds);\n\n if (this._map) {\n this._reset();\n }\n\n return this;\n },\n getEvents: function () {\n var events = {\n zoom: this._reset,\n viewreset: this._reset\n };\n\n if (this._zoomAnimated) {\n events.zoomanim = this._animateZoom;\n }\n\n return events;\n },\n // @method setZIndex(value: Number): this\n // Changes the [zIndex](#imageoverlay-zindex) of the image overlay.\n setZIndex: function (value) {\n this.options.zIndex = value;\n\n this._updateZIndex();\n\n return this;\n },\n // @method getBounds(): LatLngBounds\n // Get the bounds that this ImageOverlay covers\n getBounds: function () {\n return this._bounds;\n },\n // @method getElement(): HTMLElement\n // Returns the instance of [`HTMLImageElement`](https://developer.mozilla.org/docs/Web/API/HTMLImageElement)\n // used by this overlay.\n getElement: function () {\n return this._image;\n },\n _initImage: function () {\n var wasElementSupplied = this._url.tagName === 'IMG';\n var img = this._image = wasElementSupplied ? this._url : create$1('img');\n addClass(img, 'leaflet-image-layer');\n\n if (this._zoomAnimated) {\n addClass(img, 'leaflet-zoom-animated');\n }\n\n if (this.options.className) {\n addClass(img, this.options.className);\n }\n\n img.onselectstart = falseFn;\n img.onmousemove = falseFn; // @event load: Event\n // Fired when the ImageOverlay layer has loaded its image\n\n img.onload = bind(this.fire, this, 'load');\n img.onerror = bind(this._overlayOnError, this, 'error');\n\n if (this.options.crossOrigin || this.options.crossOrigin === '') {\n img.crossOrigin = this.options.crossOrigin === true ? '' : this.options.crossOrigin;\n }\n\n if (this.options.zIndex) {\n this._updateZIndex();\n }\n\n if (wasElementSupplied) {\n this._url = img.src;\n return;\n }\n\n img.src = this._url;\n img.alt = this.options.alt;\n },\n _animateZoom: function (e) {\n var scale = this._map.getZoomScale(e.zoom),\n offset = this._map._latLngBoundsToNewLayerBounds(this._bounds, e.zoom, e.center).min;\n\n setTransform(this._image, offset, scale);\n },\n _reset: function () {\n var image = this._image,\n bounds = new Bounds(this._map.latLngToLayerPoint(this._bounds.getNorthWest()), this._map.latLngToLayerPoint(this._bounds.getSouthEast())),\n size = bounds.getSize();\n setPosition(image, bounds.min);\n image.style.width = size.x + 'px';\n image.style.height = size.y + 'px';\n },\n _updateOpacity: function () {\n setOpacity(this._image, this.options.opacity);\n },\n _updateZIndex: function () {\n if (this._image && this.options.zIndex !== undefined && this.options.zIndex !== null) {\n this._image.style.zIndex = this.options.zIndex;\n }\n },\n _overlayOnError: function () {\n // @event error: Event\n // Fired when the ImageOverlay layer fails to load its image\n this.fire('error');\n var errorUrl = this.options.errorOverlayUrl;\n\n if (errorUrl && this._url !== errorUrl) {\n this._url = errorUrl;\n this._image.src = errorUrl;\n }\n }\n }); // @factory L.imageOverlay(imageUrl: String, bounds: LatLngBounds, options?: ImageOverlay options)\n // Instantiates an image overlay object given the URL of the image and the\n // geographical bounds it is tied to.\n\n var imageOverlay = function (url, bounds, options) {\n return new ImageOverlay(url, bounds, options);\n };\n /*\r\n * @class VideoOverlay\r\n * @aka L.VideoOverlay\r\n * @inherits ImageOverlay\r\n *\r\n * Used to load and display a video player over specific bounds of the map. Extends `ImageOverlay`.\r\n *\r\n * A video overlay uses the [`