├── .github └── FUNDING.yml ├── config └── filament-symfony-workflow.php ├── dist ├── css │ ├── images │ │ ├── layers.png │ │ ├── layers-2x.png │ │ ├── marker-icon.png │ │ ├── marker-icon-2x.png │ │ └── marker-shadow.png │ ├── geosearch.css │ └── leaflet.css └── js │ ├── geosearch.umd.js │ └── leaflet.js ├── filament-leaflet-geosearch-demo.png ├── composer.json ├── LICENSE.md ├── src ├── FilamentLeafLetGeoSearchProvider.php └── Forms │ └── Components │ └── LeafletInput.php ├── resources └── views │ └── forms │ └── components │ └── leaflet-input.blade.php └── README.md /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [heloufir] 2 | -------------------------------------------------------------------------------- /config/filament-symfony-workflow.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/FilamentLeafLetGeoSearchProvider.php: -------------------------------------------------------------------------------- 1 | name('filament-leaflet-geosearch'); 18 | 19 | // Views 20 | $package->hasViews(); 21 | 22 | // Publish assets 23 | $this->publishes(array_merge([ 24 | __DIR__ . '/../dist/css/images' => public_path('filament/assets/css/images'), 25 | ], array_merge([ 26 | __DIR__ . '/../dist/css/leaflet.css' => public_path('filament/assets/css/leaflet.css'), 27 | __DIR__ . '/../dist/css/geosearch.css' => public_path('filament/assets/css/geosearch.css'), 28 | ], [ 29 | __DIR__ . '/../dist/js/leaflet.js' => public_path('filament/assets/js/leaflet.js'), 30 | __DIR__ . '/../dist/js/geosearch.umd.js' => public_path('filament/assets/js/geosearch.umd.js'), 31 | ])), 'filament-leaflet-geosearch-assets'); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/Forms/Components/LeafletInput.php: -------------------------------------------------------------------------------- 1 | mapHeight = $mapHeight; 21 | return $this; 22 | } 23 | 24 | public function getMapHeight(): int 25 | { 26 | return $this->mapHeight; 27 | } 28 | 29 | public function getZoomControl(): string 30 | { 31 | return $this->zoomControl ? 'true' : 'false'; 32 | } 33 | 34 | public function setZoomControl(bool $zoomControl): static 35 | { 36 | $this->zoomControl = $zoomControl; 37 | return $this; 38 | } 39 | 40 | public function getScrollWheelZoom(): string 41 | { 42 | return $this->scrollWheelZoom ? 'true' : 'false'; 43 | } 44 | 45 | public function setScrollWheelZoom(bool $scrollWheelZoom): static 46 | { 47 | $this->scrollWheelZoom = $scrollWheelZoom; 48 | return $this; 49 | } 50 | 51 | public function setZoomLevel(int $zoomLevel): static 52 | { 53 | $this->zoomLevel = $zoomLevel; 54 | return $this; 55 | } 56 | 57 | public function getZoomLevel(): int 58 | { 59 | return $this->zoomLevel; 60 | } 61 | 62 | public function isViewRecord(): bool { 63 | return $this->getLivewire() instanceof ViewRecord; 64 | } 65 | 66 | public function getMapId(): string { 67 | return str_replace('.', '-', $this->getId()) . '-map'; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /resources/views/forms/components/leaflet-input.blade.php: -------------------------------------------------------------------------------- 1 | 11 |
70 | 71 |
72 | 73 | @push('scripts') 74 | @if($isViewRecord()) 75 | 80 | @endif 81 | @endpush 82 |
83 |
84 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Filament LeafLet GeoSearch 2 | 3 | [![Latest Version on Packagist](https://img.shields.io/packagist/v/heloufir/filament-leaflet-geosearch.svg?style=flat-square)](https://packagist.org/packages/heloufir/filament-leaflet-geosearch) 4 | [![Total Downloads](https://img.shields.io/packagist/dt/heloufir/filament-leaflet-geosearch.svg?style=flat-square)](https://packagist.org/packages/heloufir/filament-leaflet-geosearch) 5 | 6 | This package provides a Filament Form Field integration of the LeafLet GeoSearch package [https://github.com/smeijer/leaflet-geosearch](https://github.com/smeijer/leaflet-geosearch) 7 | 8 | ![Filament LeafLet GeoSearch](filament-leaflet-geosearch-demo.png) 9 | 10 | 11 | ## Installation 12 | 13 | You can install the package via composer: 14 | 15 | ```bash 16 | composer require heloufir/filament-leaflet-geosearch 17 | ``` 18 | 19 | You need to publish assets used by this package: 20 | ```bash 21 | php artisan vendor:publish --tag=filament-leaflet-geosearch-assets 22 | ``` 23 | 24 | > **From the version 1.1.0, you need to register manually the assets (styles and scripts)** 25 | > 26 | > This decision was made to make the plugin standalone for users who want to use it without Filament administration (only with Filament forms) 27 | 28 | - If you are using this package with `Filament administration`, add this lines to the `boot()` function of your `AppServiceProvider` 29 | ```bash 30 | public function boot() 31 | { 32 | // ... 33 | Filament::serving(function () { 34 | // ... 35 | Filament::registerStyles([ 36 | asset('filament/assets/css/leaflet.css'), 37 | asset('filament/assets/css/geosearch.css'), 38 | ]); 39 | Filament::registerScripts([ 40 | asset('filament/assets/js/leaflet.js'), 41 | asset('filament/assets/js/geosearch.umd.js'), 42 | ], true); 43 | // ... 44 | }); 45 | // ... 46 | } 47 | ``` 48 | 49 | **Important: Don't forget the `true` flag on the `registerScripts` to make the scripts loaded before Filament core scripts** 50 | 51 | - If you are using this package without `Filament administration` (only with `Filament forms`), you can include the styles and scripts into your html layout. 52 | 53 | ## Usage 54 | ### Model configuration 55 | In your model you need to add the location column cast: 56 | ```php 57 | 'object' 69 | ]; 70 | } 71 | ``` 72 | 73 | **Important:** The `location` column must have the `longText` type in your migration (see the example below) 74 | ```php 75 | // ... 76 | Schema::create('my_models', function (Blueprint $table) { 77 | // ... 78 | $table->longText('location'); 79 | // ... 80 | }); 81 | // ... 82 | ``` 83 | 84 | ### Field usage 85 | Now that you have configured your model, you can use the `LeafletInput` into your Filament Resource form schema: 86 | 87 | ```php 88 | use Heloufir\FilamentLeafLetGeoSearch\Forms\Components\LeafletInput; 89 | 90 | public static function form(Form $form): Form 91 | { 92 | return $form 93 | ->schema([ 94 | // ... 95 | LeafletInput::make('location') 96 | ->setMapHeight(300) // Here you can specify a map height in pixels, by default the height is equal to 200 97 | ->setZoomControl(false) // Here you can enable/disable zoom control on the map (default: true) 98 | ->setScrollWheelZoom(false) // Here you can enable/disable zoom on wheel scroll (default: true) 99 | ->setZoomLevel(3) // Here you can change the default zoom level (when the map is loaded for the first time), default value is 10 100 | ->required() 101 | // ... 102 | ]); 103 | } 104 | ``` 105 | 106 | ### Good to know 107 | The object stored into the `location` database column have the following format: 108 | 109 | ``` 110 | { 111 | x: Number, // lon, 112 | y: Number, // lat, 113 | label: String, // formatted address 114 | bounds: [ 115 | [Number, Number], // s, w - lat, lon 116 | [Number, Number], // n, e - lat, lon 117 | ], 118 | raw: {}, // raw provider result 119 | } 120 | ``` 121 | 122 | ## Support 123 | 124 | For fast support, please join the [**Filament** community](https://filamentphp.com/discord) discord and send me a message in this channel [#leaflet-geosearch](https://discord.com/channels/883083792112300104/1001049950983041044) 125 | 126 | ## Credits 127 | 128 | - [heloufir](https://github.com/heloufir) 129 | - [All Contributors](https://github.com/heloufir/filament-leaflet-geosearch/graphs/contributors) 130 | 131 | ## License 132 | 133 | The MIT License (MIT). Please see [License File](LICENSE.md) for more information. 134 | -------------------------------------------------------------------------------- /dist/css/geosearch.css: -------------------------------------------------------------------------------- 1 | /* global styling */ 2 | .leaflet-control-geosearch *, 3 | .leaflet-control-geosearch *:before, 4 | .leaflet-control-geosearch *:after { 5 | box-sizing: border-box; 6 | } 7 | 8 | /* leaflet button styling */ 9 | .leaflet-control-geosearch .leaflet-bar-part { 10 | border-radius: 4px; 11 | border-bottom: none; 12 | } 13 | 14 | .leaflet-control-geosearch a.leaflet-bar-part:before, 15 | .leaflet-control-geosearch a.leaflet-bar-part:after { 16 | position: absolute; 17 | display: block; 18 | content: ''; 19 | } 20 | 21 | /* magnifying glass */ 22 | .leaflet-control-geosearch a.leaflet-bar-part:before { 23 | top: 15px; 24 | left: 13px; 25 | width: 6px; 26 | border-top: 2px solid #555; 27 | transform: rotateZ(45deg); 28 | } 29 | 30 | .leaflet-control-geosearch a.leaflet-bar-part:after { 31 | top: 8px; 32 | left: 8px; 33 | height: 8px; 34 | width: 8px; 35 | border-radius: 50%; 36 | border: 2px solid #555; 37 | } 38 | 39 | /* resets for pending and error icons */ 40 | .leaflet-control-geosearch.error a.leaflet-bar-part:before, 41 | .leaflet-control-geosearch.pending a.leaflet-bar-part:before { 42 | display: none; 43 | } 44 | 45 | .leaflet-control-geosearch.pending a.leaflet-bar-part:after, 46 | .leaflet-control-geosearch.error a.leaflet-bar-part:after { 47 | left: 50%; 48 | top: 50%; 49 | width: 18px; 50 | height: 18px; 51 | margin: -9px 0 0 -9px; 52 | border-radius: 50%; 53 | } 54 | 55 | /* pending icon */ 56 | .leaflet-control-geosearch.pending a.leaflet-bar-part:after { 57 | content: ''; 58 | border: 2px solid #555; 59 | border-top: 2px solid #f3f3f3; 60 | animation: spin 1s linear infinite; 61 | } 62 | 63 | /* error icon */ 64 | .leaflet-control-geosearch.error a.leaflet-bar-part:after { 65 | content: '!'; 66 | line-height: initial; 67 | font-weight: 600; 68 | font-size: 18px; 69 | border: none; 70 | } 71 | 72 | /* search form styling */ 73 | .leaflet-control-geosearch form { 74 | display: none; 75 | position: absolute; 76 | top: 0; 77 | left: 36px; 78 | border-radius: 0 4px 4px 0; 79 | background-color: #fff; 80 | background-clip: padding-box; 81 | z-index: -1; 82 | height: auto; 83 | margin: 0; 84 | padding: 0 8px; 85 | box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65); 86 | } 87 | 88 | .leaflet-geosearch-button form.open { 89 | border-radius: 0 4px 4px 4px; 90 | } 91 | .leaflet-control-geosearch.active form { 92 | display: block; 93 | } 94 | 95 | .leaflet-geosearch-button.active .leaflet-bar-part { 96 | border-radius: 4px 0 0 4px; 97 | width: 36px; 98 | } 99 | 100 | .leaflet-geosearch-button form { 101 | max-width: 350px; 102 | } 103 | 104 | .leaflet-control-geosearch form input { 105 | min-width: 200px; 106 | width: 100%; 107 | outline: none; 108 | border: none; 109 | margin: 0; 110 | padding: 0; 111 | font-size: 12px; 112 | height: 26px; 113 | border: none; 114 | border-radius: 0 4px 4px 0; 115 | text-indent: 8px; 116 | } 117 | 118 | .leaflet-touch .leaflet-geosearch-bar form { 119 | border: 2px solid rgba(0,0,0,0.2); 120 | box-shadow: none; 121 | } 122 | 123 | .leaflet-touch .leaflet-geosearch-bar form input { 124 | height: 30px; 125 | } 126 | 127 | .leaflet-control-geosearch .results { 128 | background: #fff; 129 | } 130 | 131 | .leaflet-control-geosearch .results > * { 132 | line-height: 24px; 133 | padding: 0 8px; 134 | border: 1px solid transparent; 135 | 136 | white-space: nowrap; 137 | overflow: hidden; 138 | text-overflow: ellipsis; 139 | } 140 | 141 | .leaflet-control-geosearch .results.active { 142 | padding: 8px 0; 143 | border-top: 1px solid #c6c6c6; 144 | } 145 | 146 | .leaflet-control-geosearch .results > .active, 147 | .leaflet-control-geosearch .results > :hover { 148 | background-color: #f8f8f8; 149 | border-color: #c6c6c6; 150 | cursor: pointer; 151 | } 152 | 153 | /* add missing border to form */ 154 | .leaflet-control-geosearch .results.active:after { 155 | content: ''; 156 | display: block; 157 | width: 0; 158 | position: absolute; 159 | left: -2px; 160 | bottom: -2px; 161 | top: 30px; 162 | } 163 | 164 | .leaflet-touch .leaflet-control-geosearch .results.active:after { 165 | border-left: 2px solid rgba(0, 0, 0, .2); 166 | } 167 | 168 | /* animations */ 169 | @keyframes spin { 170 | 0% { transform: rotate(0deg); } 171 | 100% { transform: rotate(360deg); } 172 | } 173 | 174 | .leaflet-top .leaflet-geosearch-bar, 175 | .leaflet-bottom .leaflet-geosearch-bar { 176 | display: none; 177 | } 178 | 179 | .leaflet-geosearch-bar { 180 | position: relative; 181 | display: block; 182 | height: auto; 183 | width: 400px; 184 | max-width: calc(100% - 120px); 185 | margin: 10px auto 0; 186 | cursor: auto; 187 | z-index: 1000; 188 | } 189 | 190 | .leaflet-geosearch-bar form { 191 | position: relative; 192 | top: 0; 193 | left: 0; 194 | display: block; 195 | border-radius: 4px; 196 | } 197 | 198 | .leaflet-geosearch-bar form input { 199 | min-width: 100%; 200 | width: 100%; 201 | } 202 | 203 | .leaflet-geosearch-bar .results.active:after { 204 | opacity: .2; 205 | } 206 | 207 | .leaflet-right .leaflet-control-geosearch form { 208 | right: 28px; 209 | left: initial; 210 | border-radius: 4px 0 0 4px; 211 | border-left: inherit; 212 | border-right: none; 213 | } 214 | 215 | .leaflet-control-geosearch a.reset { 216 | color: black; 217 | font-weight: bold; 218 | position: absolute; 219 | line-height: 26px; 220 | padding: 0 8px; 221 | right: 0; 222 | top: 0; 223 | cursor: pointer; 224 | border: none; 225 | text-decoration: none; 226 | background-color: #fff; 227 | border-radius: 0 4px 4px 0; 228 | } 229 | 230 | .leaflet-touch .leaflet-control-geosearch a.reset { 231 | line-height: 30px; 232 | } 233 | 234 | .leaflet-control-geosearch a.reset:hover { 235 | background: #f5f5f5; 236 | } 237 | -------------------------------------------------------------------------------- /dist/css/leaflet.css: -------------------------------------------------------------------------------- 1 | /* required styles */ 2 | 3 | .leaflet-pane, 4 | .leaflet-tile, 5 | .leaflet-marker-icon, 6 | .leaflet-marker-shadow, 7 | .leaflet-tile-container, 8 | .leaflet-pane > svg, 9 | .leaflet-pane > canvas, 10 | .leaflet-zoom-box, 11 | .leaflet-image-layer, 12 | .leaflet-layer { 13 | position: absolute; 14 | left: 0; 15 | top: 0; 16 | } 17 | .leaflet-container { 18 | overflow: hidden; 19 | } 20 | .leaflet-tile, 21 | .leaflet-marker-icon, 22 | .leaflet-marker-shadow { 23 | -webkit-user-select: none; 24 | -moz-user-select: none; 25 | user-select: none; 26 | -webkit-user-drag: none; 27 | } 28 | /* Prevents IE11 from highlighting tiles in blue */ 29 | .leaflet-tile::selection { 30 | background: transparent; 31 | } 32 | /* Safari renders non-retina tile on retina better with this, but Chrome is worse */ 33 | .leaflet-safari .leaflet-tile { 34 | image-rendering: -webkit-optimize-contrast; 35 | } 36 | /* hack that prevents hw layers "stretching" when loading new tiles */ 37 | .leaflet-safari .leaflet-tile-container { 38 | width: 1600px; 39 | height: 1600px; 40 | -webkit-transform-origin: 0 0; 41 | } 42 | .leaflet-marker-icon, 43 | .leaflet-marker-shadow { 44 | display: block; 45 | } 46 | /* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */ 47 | /* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */ 48 | .leaflet-container .leaflet-overlay-pane svg { 49 | max-width: none !important; 50 | max-height: none !important; 51 | } 52 | .leaflet-container .leaflet-marker-pane img, 53 | .leaflet-container .leaflet-shadow-pane img, 54 | .leaflet-container .leaflet-tile-pane img, 55 | .leaflet-container img.leaflet-image-layer, 56 | .leaflet-container .leaflet-tile { 57 | max-width: none !important; 58 | max-height: none !important; 59 | width: auto; 60 | padding: 0; 61 | } 62 | 63 | .leaflet-container.leaflet-touch-zoom { 64 | -ms-touch-action: pan-x pan-y; 65 | touch-action: pan-x pan-y; 66 | } 67 | .leaflet-container.leaflet-touch-drag { 68 | -ms-touch-action: pinch-zoom; 69 | /* Fallback for FF which doesn't support pinch-zoom */ 70 | touch-action: none; 71 | touch-action: pinch-zoom; 72 | } 73 | .leaflet-container.leaflet-touch-drag.leaflet-touch-zoom { 74 | -ms-touch-action: none; 75 | touch-action: none; 76 | } 77 | .leaflet-container { 78 | -webkit-tap-highlight-color: transparent; 79 | } 80 | .leaflet-container a { 81 | -webkit-tap-highlight-color: rgba(51, 181, 229, 0.4); 82 | } 83 | .leaflet-tile { 84 | filter: inherit; 85 | visibility: hidden; 86 | } 87 | .leaflet-tile-loaded { 88 | visibility: inherit; 89 | } 90 | .leaflet-zoom-box { 91 | width: 0; 92 | height: 0; 93 | -moz-box-sizing: border-box; 94 | box-sizing: border-box; 95 | z-index: 800; 96 | } 97 | /* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */ 98 | .leaflet-overlay-pane svg { 99 | -moz-user-select: none; 100 | } 101 | 102 | .leaflet-pane { z-index: 400; } 103 | 104 | .leaflet-tile-pane { z-index: 200; } 105 | .leaflet-overlay-pane { z-index: 400; } 106 | .leaflet-shadow-pane { z-index: 500; } 107 | .leaflet-marker-pane { z-index: 600; } 108 | .leaflet-tooltip-pane { z-index: 650; } 109 | .leaflet-popup-pane { z-index: 700; } 110 | 111 | .leaflet-map-pane canvas { z-index: 100; } 112 | .leaflet-map-pane svg { z-index: 200; } 113 | 114 | .leaflet-vml-shape { 115 | width: 1px; 116 | height: 1px; 117 | } 118 | .lvml { 119 | behavior: url(#default#VML); 120 | display: inline-block; 121 | position: absolute; 122 | } 123 | 124 | 125 | /* control positioning */ 126 | 127 | .leaflet-control { 128 | position: relative; 129 | z-index: 800; 130 | pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */ 131 | pointer-events: auto; 132 | } 133 | .leaflet-top, 134 | .leaflet-bottom { 135 | position: absolute; 136 | z-index: 1000; 137 | pointer-events: none; 138 | } 139 | .leaflet-top { 140 | top: 0; 141 | } 142 | .leaflet-right { 143 | right: 0; 144 | } 145 | .leaflet-bottom { 146 | bottom: 0; 147 | } 148 | .leaflet-left { 149 | left: 0; 150 | } 151 | .leaflet-control { 152 | float: left; 153 | clear: both; 154 | } 155 | .leaflet-right .leaflet-control { 156 | float: right; 157 | } 158 | .leaflet-top .leaflet-control { 159 | margin-top: 10px; 160 | } 161 | .leaflet-bottom .leaflet-control { 162 | margin-bottom: 10px; 163 | } 164 | .leaflet-left .leaflet-control { 165 | margin-left: 10px; 166 | } 167 | .leaflet-right .leaflet-control { 168 | margin-right: 10px; 169 | } 170 | 171 | 172 | /* zoom and fade animations */ 173 | 174 | .leaflet-fade-anim .leaflet-popup { 175 | opacity: 0; 176 | -webkit-transition: opacity 0.2s linear; 177 | -moz-transition: opacity 0.2s linear; 178 | transition: opacity 0.2s linear; 179 | } 180 | .leaflet-fade-anim .leaflet-map-pane .leaflet-popup { 181 | opacity: 1; 182 | } 183 | .leaflet-zoom-animated { 184 | -webkit-transform-origin: 0 0; 185 | -ms-transform-origin: 0 0; 186 | transform-origin: 0 0; 187 | } 188 | svg.leaflet-zoom-animated { 189 | will-change: transform; 190 | } 191 | 192 | .leaflet-zoom-anim .leaflet-zoom-animated { 193 | -webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1); 194 | -moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1); 195 | transition: transform 0.25s cubic-bezier(0,0,0.25,1); 196 | } 197 | .leaflet-zoom-anim .leaflet-tile, 198 | .leaflet-pan-anim .leaflet-tile { 199 | -webkit-transition: none; 200 | -moz-transition: none; 201 | transition: none; 202 | } 203 | 204 | .leaflet-zoom-anim .leaflet-zoom-hide { 205 | visibility: hidden; 206 | } 207 | 208 | 209 | /* cursors */ 210 | 211 | .leaflet-interactive { 212 | cursor: pointer; 213 | } 214 | .leaflet-grab { 215 | cursor: -webkit-grab; 216 | cursor: -moz-grab; 217 | cursor: grab; 218 | } 219 | .leaflet-crosshair, 220 | .leaflet-crosshair .leaflet-interactive { 221 | cursor: crosshair; 222 | } 223 | .leaflet-popup-pane, 224 | .leaflet-control { 225 | cursor: auto; 226 | } 227 | .leaflet-dragging .leaflet-grab, 228 | .leaflet-dragging .leaflet-grab .leaflet-interactive, 229 | .leaflet-dragging .leaflet-marker-draggable { 230 | cursor: move; 231 | cursor: -webkit-grabbing; 232 | cursor: -moz-grabbing; 233 | cursor: grabbing; 234 | } 235 | 236 | /* marker & overlays interactivity */ 237 | .leaflet-marker-icon, 238 | .leaflet-marker-shadow, 239 | .leaflet-image-layer, 240 | .leaflet-pane > svg path, 241 | .leaflet-tile-container { 242 | pointer-events: none; 243 | } 244 | 245 | .leaflet-marker-icon.leaflet-interactive, 246 | .leaflet-image-layer.leaflet-interactive, 247 | .leaflet-pane > svg path.leaflet-interactive, 248 | svg.leaflet-image-layer.leaflet-interactive path { 249 | pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */ 250 | pointer-events: auto; 251 | } 252 | 253 | /* visual tweaks */ 254 | 255 | .leaflet-container { 256 | background: #ddd; 257 | outline-offset: 1px; 258 | } 259 | .leaflet-container a { 260 | color: #0078A8; 261 | } 262 | .leaflet-zoom-box { 263 | border: 2px dotted #38f; 264 | background: rgba(255,255,255,0.5); 265 | } 266 | 267 | 268 | /* general typography */ 269 | .leaflet-container { 270 | font-family: "Helvetica Neue", Arial, Helvetica, sans-serif; 271 | font-size: 12px; 272 | font-size: 0.75rem; 273 | line-height: 1.5; 274 | } 275 | 276 | 277 | /* general toolbar styles */ 278 | 279 | .leaflet-bar { 280 | box-shadow: 0 1px 5px rgba(0,0,0,0.65); 281 | border-radius: 4px; 282 | } 283 | .leaflet-bar a { 284 | background-color: #fff; 285 | border-bottom: 1px solid #ccc; 286 | width: 26px; 287 | height: 26px; 288 | line-height: 26px; 289 | display: block; 290 | text-align: center; 291 | text-decoration: none; 292 | color: black; 293 | } 294 | .leaflet-bar a, 295 | .leaflet-control-layers-toggle { 296 | background-position: 50% 50%; 297 | background-repeat: no-repeat; 298 | display: block; 299 | } 300 | .leaflet-bar a:hover, 301 | .leaflet-bar a:focus { 302 | background-color: #f4f4f4; 303 | } 304 | .leaflet-bar a:first-child { 305 | border-top-left-radius: 4px; 306 | border-top-right-radius: 4px; 307 | } 308 | .leaflet-bar a:last-child { 309 | border-bottom-left-radius: 4px; 310 | border-bottom-right-radius: 4px; 311 | border-bottom: none; 312 | } 313 | .leaflet-bar a.leaflet-disabled { 314 | cursor: default; 315 | background-color: #f4f4f4; 316 | color: #bbb; 317 | } 318 | 319 | .leaflet-touch .leaflet-bar a { 320 | width: 30px; 321 | height: 30px; 322 | line-height: 30px; 323 | } 324 | .leaflet-touch .leaflet-bar a:first-child { 325 | border-top-left-radius: 2px; 326 | border-top-right-radius: 2px; 327 | } 328 | .leaflet-touch .leaflet-bar a:last-child { 329 | border-bottom-left-radius: 2px; 330 | border-bottom-right-radius: 2px; 331 | } 332 | 333 | /* zoom control */ 334 | 335 | .leaflet-control-zoom-in, 336 | .leaflet-control-zoom-out { 337 | font: bold 18px 'Lucida Console', Monaco, monospace; 338 | text-indent: 1px; 339 | } 340 | 341 | .leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out { 342 | font-size: 22px; 343 | } 344 | 345 | 346 | /* layers control */ 347 | 348 | .leaflet-control-layers { 349 | box-shadow: 0 1px 5px rgba(0,0,0,0.4); 350 | background: #fff; 351 | border-radius: 5px; 352 | } 353 | .leaflet-control-layers-toggle { 354 | background-image: url(images/layers.png); 355 | width: 36px; 356 | height: 36px; 357 | } 358 | .leaflet-retina .leaflet-control-layers-toggle { 359 | background-image: url(images/layers-2x.png); 360 | background-size: 26px 26px; 361 | } 362 | .leaflet-touch .leaflet-control-layers-toggle { 363 | width: 44px; 364 | height: 44px; 365 | } 366 | .leaflet-control-layers .leaflet-control-layers-list, 367 | .leaflet-control-layers-expanded .leaflet-control-layers-toggle { 368 | display: none; 369 | } 370 | .leaflet-control-layers-expanded .leaflet-control-layers-list { 371 | display: block; 372 | position: relative; 373 | } 374 | .leaflet-control-layers-expanded { 375 | padding: 6px 10px 6px 6px; 376 | color: #333; 377 | background: #fff; 378 | } 379 | .leaflet-control-layers-scrollbar { 380 | overflow-y: scroll; 381 | overflow-x: hidden; 382 | padding-right: 5px; 383 | } 384 | .leaflet-control-layers-selector { 385 | margin-top: 2px; 386 | position: relative; 387 | top: 1px; 388 | } 389 | .leaflet-control-layers label { 390 | display: block; 391 | font-size: 13px; 392 | font-size: 1.08333em; 393 | } 394 | .leaflet-control-layers-separator { 395 | height: 0; 396 | border-top: 1px solid #ddd; 397 | margin: 5px -10px 5px -6px; 398 | } 399 | 400 | /* Default icon URLs */ 401 | .leaflet-default-icon-path { /* used only in path-guessing heuristic, see L.Icon.Default */ 402 | background-image: url(images/marker-icon.png); 403 | } 404 | 405 | 406 | /* attribution and scale controls */ 407 | 408 | .leaflet-container .leaflet-control-attribution { 409 | background: #fff; 410 | background: rgba(255, 255, 255, 0.8); 411 | margin: 0; 412 | } 413 | .leaflet-control-attribution, 414 | .leaflet-control-scale-line { 415 | padding: 0 5px; 416 | color: #333; 417 | line-height: 1.4; 418 | } 419 | .leaflet-control-attribution a { 420 | text-decoration: none; 421 | } 422 | .leaflet-control-attribution a:hover, 423 | .leaflet-control-attribution a:focus { 424 | text-decoration: underline; 425 | } 426 | .leaflet-control-attribution svg { 427 | display: inline !important; 428 | } 429 | .leaflet-left .leaflet-control-scale { 430 | margin-left: 5px; 431 | } 432 | .leaflet-bottom .leaflet-control-scale { 433 | margin-bottom: 5px; 434 | } 435 | .leaflet-control-scale-line { 436 | border: 2px solid #777; 437 | border-top: none; 438 | line-height: 1.1; 439 | padding: 2px 5px 1px; 440 | white-space: nowrap; 441 | overflow: hidden; 442 | -moz-box-sizing: border-box; 443 | box-sizing: border-box; 444 | 445 | background: #fff; 446 | background: rgba(255, 255, 255, 0.5); 447 | } 448 | .leaflet-control-scale-line:not(:first-child) { 449 | border-top: 2px solid #777; 450 | border-bottom: none; 451 | margin-top: -2px; 452 | } 453 | .leaflet-control-scale-line:not(:first-child):not(:last-child) { 454 | border-bottom: 2px solid #777; 455 | } 456 | 457 | .leaflet-touch .leaflet-control-attribution, 458 | .leaflet-touch .leaflet-control-layers, 459 | .leaflet-touch .leaflet-bar { 460 | box-shadow: none; 461 | } 462 | .leaflet-touch .leaflet-control-layers, 463 | .leaflet-touch .leaflet-bar { 464 | border: 2px solid rgba(0,0,0,0.2); 465 | background-clip: padding-box; 466 | } 467 | 468 | 469 | /* popup */ 470 | 471 | .leaflet-popup { 472 | position: absolute; 473 | text-align: center; 474 | margin-bottom: 20px; 475 | } 476 | .leaflet-popup-content-wrapper { 477 | padding: 1px; 478 | text-align: left; 479 | border-radius: 12px; 480 | } 481 | .leaflet-popup-content { 482 | margin: 13px 24px 13px 20px; 483 | line-height: 1.3; 484 | font-size: 13px; 485 | font-size: 1.08333em; 486 | min-height: 1px; 487 | } 488 | .leaflet-popup-content p { 489 | margin: 17px 0; 490 | margin: 1.3em 0; 491 | } 492 | .leaflet-popup-tip-container { 493 | width: 40px; 494 | height: 20px; 495 | position: absolute; 496 | left: 50%; 497 | margin-top: -1px; 498 | margin-left: -20px; 499 | overflow: hidden; 500 | pointer-events: none; 501 | } 502 | .leaflet-popup-tip { 503 | width: 17px; 504 | height: 17px; 505 | padding: 1px; 506 | 507 | margin: -10px auto 0; 508 | pointer-events: auto; 509 | 510 | -webkit-transform: rotate(45deg); 511 | -moz-transform: rotate(45deg); 512 | -ms-transform: rotate(45deg); 513 | transform: rotate(45deg); 514 | } 515 | .leaflet-popup-content-wrapper, 516 | .leaflet-popup-tip { 517 | background: white; 518 | color: #333; 519 | box-shadow: 0 3px 14px rgba(0,0,0,0.4); 520 | } 521 | .leaflet-container a.leaflet-popup-close-button { 522 | position: absolute; 523 | top: 0; 524 | right: 0; 525 | border: none; 526 | text-align: center; 527 | width: 24px; 528 | height: 24px; 529 | font: 16px/24px Tahoma, Verdana, sans-serif; 530 | color: #757575; 531 | text-decoration: none; 532 | background: transparent; 533 | } 534 | .leaflet-container a.leaflet-popup-close-button:hover, 535 | .leaflet-container a.leaflet-popup-close-button:focus { 536 | color: #585858; 537 | } 538 | .leaflet-popup-scrolled { 539 | overflow: auto; 540 | border-bottom: 1px solid #ddd; 541 | border-top: 1px solid #ddd; 542 | } 543 | 544 | .leaflet-oldie .leaflet-popup-content-wrapper { 545 | -ms-zoom: 1; 546 | } 547 | .leaflet-oldie .leaflet-popup-tip { 548 | width: 24px; 549 | margin: 0 auto; 550 | 551 | -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)"; 552 | filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678); 553 | } 554 | 555 | .leaflet-oldie .leaflet-control-zoom, 556 | .leaflet-oldie .leaflet-control-layers, 557 | .leaflet-oldie .leaflet-popup-content-wrapper, 558 | .leaflet-oldie .leaflet-popup-tip { 559 | border: 1px solid #999; 560 | } 561 | 562 | 563 | /* div icon */ 564 | 565 | .leaflet-div-icon { 566 | background: #fff; 567 | border: 1px solid #666; 568 | } 569 | 570 | 571 | /* Tooltip */ 572 | /* Base styles for the element that has a tooltip */ 573 | .leaflet-tooltip { 574 | position: absolute; 575 | padding: 6px; 576 | background-color: #fff; 577 | border: 1px solid #fff; 578 | border-radius: 3px; 579 | color: #222; 580 | white-space: nowrap; 581 | -webkit-user-select: none; 582 | -moz-user-select: none; 583 | -ms-user-select: none; 584 | user-select: none; 585 | pointer-events: none; 586 | box-shadow: 0 1px 3px rgba(0,0,0,0.4); 587 | } 588 | .leaflet-tooltip.leaflet-interactive { 589 | cursor: pointer; 590 | pointer-events: auto; 591 | } 592 | .leaflet-tooltip-top:before, 593 | .leaflet-tooltip-bottom:before, 594 | .leaflet-tooltip-left:before, 595 | .leaflet-tooltip-right:before { 596 | position: absolute; 597 | pointer-events: none; 598 | border: 6px solid transparent; 599 | background: transparent; 600 | content: ""; 601 | } 602 | 603 | /* Directions */ 604 | 605 | .leaflet-tooltip-bottom { 606 | margin-top: 6px; 607 | } 608 | .leaflet-tooltip-top { 609 | margin-top: -6px; 610 | } 611 | .leaflet-tooltip-bottom:before, 612 | .leaflet-tooltip-top:before { 613 | left: 50%; 614 | margin-left: -6px; 615 | } 616 | .leaflet-tooltip-top:before { 617 | bottom: 0; 618 | margin-bottom: -12px; 619 | border-top-color: #fff; 620 | } 621 | .leaflet-tooltip-bottom:before { 622 | top: 0; 623 | margin-top: -12px; 624 | margin-left: -6px; 625 | border-bottom-color: #fff; 626 | } 627 | .leaflet-tooltip-left { 628 | margin-left: -6px; 629 | } 630 | .leaflet-tooltip-right { 631 | margin-left: 6px; 632 | } 633 | .leaflet-tooltip-left:before, 634 | .leaflet-tooltip-right:before { 635 | top: 50%; 636 | margin-top: -6px; 637 | } 638 | .leaflet-tooltip-left:before { 639 | right: 0; 640 | margin-right: -12px; 641 | border-left-color: #fff; 642 | } 643 | .leaflet-tooltip-right:before { 644 | left: 0; 645 | margin-left: -12px; 646 | border-right-color: #fff; 647 | } 648 | 649 | /* Printing */ 650 | 651 | @media print { 652 | /* Prevent printers from removing background-images of controls. */ 653 | .leaflet-control { 654 | -webkit-print-color-adjust: exact; 655 | color-adjust: exact; 656 | } 657 | } 658 | -------------------------------------------------------------------------------- /dist/js/geosearch.umd.js: -------------------------------------------------------------------------------- 1 | !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("leaflet")):"function"==typeof define&&define.amd?define(["exports","leaflet"],e):e((t=t||self).GeoSearch={},t.L)}(this,function(t,e){function r(){return(r=Object.assign||function(t){for(var e=1;e0?(c(this.container.parentElement,"open"),c(this.container,"active")):this.notFoundMessage&&(this.container.appendChild(this.notFoundMessage),c(this.container.parentElement,"open")),this.results=t},e.select=function(t){return Array.from(this.container.children).forEach(function(e,r){return r===t?c(e,"active"):h(e,"active")}),this.selected=t,this.results[t]},e.count=function(){return this.results?this.results.length:0},e.clear=function(){for(this.selected=-1;this.container.lastChild;)this.container.removeChild(this.container.lastChild);h(this.container.parentElement,"open"),h(this.container,"active")},t}(),b={position:"topleft",style:"button",showMarker:!0,showPopup:!1,popupFormat:function(t){return""+t.result.label},resultFormat:function(t){return""+t.result.label},marker:{icon:e&&e.Icon?new e.Icon.Default:void 0,draggable:!1},maxMarkers:1,maxSuggestions:5,retainZoomLevel:!1,animateZoom:!0,searchLabel:"Enter address",notFoundMessage:"",messageHideDelay:3e3,zoomLevel:18,classNames:{container:"leaflet-bar leaflet-control leaflet-control-geosearch",button:"leaflet-bar-part leaflet-bar-part-single",resetButton:"reset",msgbox:"leaflet-bar message",form:"",input:"",resultlist:"",item:"",notfound:"leaflet-bar-notfound"},autoComplete:!0,autoCompleteDelay:250,autoClose:!1,keepResult:!1,updateMap:!0},x="Leaflet must be loaded before instantiating the GeoSearch control",E={options:r({},b),classNames:r({},b.classNames),initialize:function(t){var n,o,s,i,u=this;if(!e)throw new Error(x);if(!t.provider)throw new Error("Provider is missing from options");this.options=r({},b,{},t),this.classNames=r({},this.classNames,{},t.classNames),this.markers=new e.FeatureGroup,this.classNames.container+=" leaflet-geosearch-"+this.options.style,this.searchElement=new y({searchLabel:this.options.searchLabel,classNames:{container:this.classNames.container,form:this.classNames.form,input:this.classNames.input},handleSubmit:function(t){return u.onSubmit(t)}}),this.button=a("a",this.classNames.button,this.searchElement.container,{title:this.options.searchLabel,href:"#",onClick:function(t){return u.onClick(t)}}),e.DomEvent.disableClickPropagation(this.button),this.resetButton=a("a",this.classNames.resetButton,this.searchElement.form,{text:"×",href:"#",onClick:function(){return u.clearResults(null,!0)}}),e.DomEvent.disableClickPropagation(this.resetButton),this.options.autoComplete&&(this.resultList=new g({handleClick:function(t){var e=t.result;u.searchElement.input.value=e.label,u.onSubmit({query:e.label,data:e})},classNames:{resultlist:this.classNames.resultlist,item:this.classNames.item,notfound:this.classNames.notfound},notFoundMessage:this.options.notFoundMessage}),this.searchElement.form.appendChild(this.resultList.container),this.searchElement.input.addEventListener("keyup",(n=function(t){return u.autoSearch(t)},void 0===(o=this.options.autoCompleteDelay)&&(o=250),void 0===s&&(s=!1),function(){for(var t=arguments.length,e=new Array(t),r=0;re?0:n);this.searchElement.input.value=o.label}}else{var s=this.resultList.select(this.resultList.selected);this.onSubmit({query:this.searchElement.input.value,data:s})}},clearResults:function(t,e){if(void 0===e&&(e=!1),!t||27===t.keyCode){var r=this.options,n=r.autoComplete;!e&&r.keepResult||(this.searchElement.input.value="",this.markers.clearLayers()),n&&this.resultList.clear()}},autoSearch:function(t){try{var e=this;if(v.indexOf(t.keyCode)>-1)return Promise.resolve();var r=t.target.value,n=e.options.provider,o=function(){if(r.length)return Promise.resolve(n.search({query:r})).then(function(t){t=t.slice(0,e.options.maxSuggestions),e.resultList.render(t,e.options.resultFormat)});e.resultList.clear()}();return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(t){return Promise.reject(t)}},onSubmit:function(t){try{var e=this;return Promise.resolve(e.options.provider.search(t)).then(function(r){r&&r.length>0&&e.showResult(r[0],t)})}catch(t){return Promise.reject(t)}},showResult:function(t,e){var r=this.options,n=r.autoClose,o=r.updateMap,s=this.markers.getLayers();s.length>=this.options.maxMarkers&&this.markers.removeLayer(s[0]);var i=this.addMarker(t,e);o&&this.centerMap(t),this.map.fireEvent("geosearch/showlocation",{location:t,marker:i}),n&&this.closeResults()},closeResults:function(){var t=this.searchElement.container;t.classList.contains("active")&&h(t,"active"),this.clearResults()},addMarker:function(t,r){var n=this,o=this.options,s=o.marker,i=o.showPopup,a=o.popupFormat,u=new e.Marker([t.y,t.x],s),l=t.label;return"function"==typeof a&&(l=a({query:r,result:t})),u.bindPopup(l),this.markers.addLayer(u),i&&u.openPopup(),s.draggable&&u.on("dragend",function(t){n.map.fireEvent("geosearch/marker/dragend",{location:u.getLatLng(),event:t})}),u},centerMap:function(t){var r=this.options,n=r.retainZoomLevel,o=r.animateZoom,s=t.bounds?new e.LatLngBounds(t.bounds):new e.LatLng(t.y,t.x).toBounds(10),i=s.isValid()?s:this.markers.getBounds();!n&&s.isValid()&&!t.bounds||n||!s.isValid()?this.map.setView(i.getCenter(),this.getZoom(),{animate:o}):this.map.fitBounds(i,{animate:o})},getZoom:function(){var t=this.options,e=t.zoomLevel;return t.retainZoomLevel?this.map.getZoom():e}};function L(){if(!e)throw new Error(x);for(var t=e.Control.extend(E),r=arguments.length,n=new Array(r),o=0;o=this.min.x&&e.x<=this.max.x&&i.y>=this.min.y&&e.y<=this.max.y},intersects:function(t){t=f(t);var i=this.min,e=this.max,n=t.min,t=t.max,o=t.x>=i.x&&n.x<=e.x,t=t.y>=i.y&&n.y<=e.y;return o&&t},overlaps:function(t){t=f(t);var i=this.min,e=this.max,n=t.min,t=t.max,o=t.x>i.x&&n.xi.y&&n.y=n.lat&&e.lat<=o.lat&&i.lng>=n.lng&&e.lng<=o.lng},intersects:function(t){t=g(t);var i=this._southWest,e=this._northEast,n=t.getSouthWest(),t=t.getNorthEast(),o=t.lat>=i.lat&&n.lat<=e.lat,t=t.lng>=i.lng&&n.lng<=e.lng;return o&&t},overlaps:function(t){t=g(t);var i=this._southWest,e=this._northEast,n=t.getSouthWest(),t=t.getNorthEast(),o=t.lat>i.lat&&n.lati.lng&&n.lng","http://www.w3.org/2000/svg"===(Wt.firstChild&&Wt.firstChild.namespaceURI));function y(t){return 0<=navigator.userAgent.toLowerCase().indexOf(t)}var P={ie:pt,ielt9:mt,edge:n,webkit:ft,android:gt,android23:vt,androidStock:yt,opera:xt,chrome:wt,gecko:Pt,safari:bt,phantom:Lt,opera12:o,win:Tt,ie3d:zt,webkit3d:Mt,gecko3d:_t,any3d:Ct,mobile:Zt,mobileWebkit:St,mobileWebkit3d:kt,msPointer:Et,pointer:Bt,touch:It,touchNative:At,mobileOpera:Ot,mobileGecko:Rt,retina:Nt,passiveEvents:Dt,canvas:jt,svg:Ht,vml:!Ht&&function(){try{var t=document.createElement("div"),i=(t.innerHTML='',t.firstChild);return i.style.behavior="url(#default#VML)",i&&"object"==typeof i.adj}catch(t){return!1}}(),inlineSvg:Wt},Ft=P.msPointer?"MSPointerDown":"pointerdown",Ut=P.msPointer?"MSPointerMove":"pointermove",Vt=P.msPointer?"MSPointerUp":"pointerup",qt=P.msPointer?"MSPointerCancel":"pointercancel",Gt={touchstart:Ft,touchmove:Ut,touchend:Vt,touchcancel:qt},Kt={touchstart:function(t,i){i.MSPOINTER_TYPE_TOUCH&&i.pointerType===i.MSPOINTER_TYPE_TOUCH&&B(i);ii(t,i)},touchmove:ii,touchend:ii,touchcancel:ii},Yt={},Xt=!1;function Jt(t,i,e){return"touchstart"!==i||Xt||(document.addEventListener(Ft,$t,!0),document.addEventListener(Ut,Qt,!0),document.addEventListener(Vt,ti,!0),document.addEventListener(qt,ti,!0),Xt=!0),Kt[i]?(e=Kt[i].bind(this,e),t.addEventListener(Gt[i],e,!1),e):(console.warn("wrong event specified:",i),L.Util.falseFn)}function $t(t){Yt[t.pointerId]=t}function Qt(t){Yt[t.pointerId]&&(Yt[t.pointerId]=t)}function ti(t){delete Yt[t.pointerId]}function ii(t,i){if(i.pointerType!==(i.MSPOINTER_TYPE_MOUSE||"mouse")){for(var e in i.touches=[],Yt)i.touches.push(Yt[e]);i.changedTouches=[i],t(i)}}var ei=200;function ni(t,e){t.addEventListener("dblclick",e);var n,o=0;function i(t){var i;1!==t.detail?n=t.detail:"mouse"===t.pointerType||t.sourceCapabilities&&!t.sourceCapabilities.firesTouchEvents||((i=Date.now())-o<=ei?2===++n&&e(function(t){var i,e,n={};for(e in t)i=t[e],n[e]=i&&i.bind?i.bind(t):i;return(t=n).type="dblclick",n.detail=2,n.isTrusted=!1,n._simulated=!0,n}(t)):n=1,o=i)}return t.addEventListener("click",i),{dblclick:e,simDblclick:i}}var oi,si,ri,ai,hi,li,ui=wi(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),ci=wi(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),di="webkitTransition"===ci||"OTransition"===ci?ci+"End":"transitionend";function _i(t){return"string"==typeof t?document.getElementById(t):t}function pi(t,i){var e=t.style[i]||t.currentStyle&&t.currentStyle[i];return"auto"===(e=e&&"auto"!==e||!document.defaultView?e:(t=document.defaultView.getComputedStyle(t,null))?t[i]:null)?null:e}function b(t,i,e){t=document.createElement(t);return t.className=i||"",e&&e.appendChild(t),t}function T(t){var i=t.parentNode;i&&i.removeChild(t)}function mi(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function fi(t){var i=t.parentNode;i&&i.lastChild!==t&&i.appendChild(t)}function gi(t){var i=t.parentNode;i&&i.firstChild!==t&&i.insertBefore(t,i.firstChild)}function vi(t,i){if(void 0!==t.classList)return t.classList.contains(i);t=xi(t);return 0this.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,i){this._enforcingBounds=!0;var e=this.getCenter(),t=this._limitCenter(e,this._zoom,g(t));return e.equals(t)||this.panTo(t,i),this._enforcingBounds=!1,this},panInside:function(t,i){var e=_((i=i||{}).paddingTopLeft||i.padding||[0,0]),n=_(i.paddingBottomRight||i.padding||[0,0]),o=this.project(this.getCenter()),t=this.project(t),s=this.getPixelBounds(),e=f([s.min.add(e),s.max.subtract(n)]),s=e.getSize();return e.contains(t)||(this._enforcingBounds=!0,n=t.subtract(e.getCenter()),e=e.extend(t).getSize().subtract(s),o.x+=n.x<0?-e.x:e.x,o.y+=n.y<0?-e.y:e.y,this.panTo(this.unproject(o),i),this._enforcingBounds=!1),this},invalidateSize:function(t){if(!this._loaded)return this;t=l({animate:!1,pan:!0},!0===t?{animate:!0}:t);var i=this.getSize(),e=(this._sizeChanged=!0,this._lastCenter=null,this.getSize()),n=i.divideBy(2).round(),o=e.divideBy(2).round(),n=n.subtract(o);return n.x||n.y?(t.animate&&t.pan?this.panBy(n):(t.pan&&this._rawPanBy(n),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(a(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:i,newSize:e})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=l({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var i=a(this._handleGeolocationResponse,this),e=a(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(i,e,t):navigator.geolocation.getCurrentPosition(i,e,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var i;this._container._leaflet_id&&(i=t.code,t=t.message||(1===i?"permission denied":2===i?"position unavailable":"timeout"),this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:i,message:"Geolocation error: "+t+"."}))},_handleGeolocationResponse:function(t){if(this._container._leaflet_id){var i,e,n=new v(t.coords.latitude,t.coords.longitude),o=n.toBounds(2*t.coords.accuracy),s=this._locateOptions,r=(s.setView&&(i=this.getBoundsZoom(o),this.setView(n,s.maxZoom?Math.min(i,s.maxZoom):i)),{latlng:n,bounds:o,timestamp:t.timestamp});for(e in t.coords)"number"==typeof t.coords[e]&&(r[e]=t.coords[e]);this.fire("locationfound",r)}},addHandler:function(t,i){if(!i)return this;i=this[t]=new i(this);return this._handlers.push(i),this.options[t]&&i.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}for(var t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),T(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(r(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)T(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,i){i=b("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),i||this._mapPane);return t&&(this._panes[t]=i),i},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter:this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new s(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,i,e){t=g(t),e=_(e||[0,0]);var n=this.getZoom()||0,o=this.getMinZoom(),s=this.getMaxZoom(),r=t.getNorthWest(),t=t.getSouthEast(),e=this.getSize().subtract(e),t=f(this.project(t,n),this.project(r,n)).getSize(),r=P.any3d?this.options.zoomSnap:1,a=e.x/t.x,e=e.y/t.y,t=i?Math.max(a,e):Math.min(a,e),n=this.getScaleZoom(t,n);return r&&(n=Math.round(n/(r/100))*(r/100),n=i?Math.ceil(n/r)*r:Math.floor(n/r)*r),Math.max(o,Math.min(s,n))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new p(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,i){t=this._getTopLeftPoint(t,i);return new m(t,t.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,i){var e=this.options.crs;return i=void 0===i?this._zoom:i,e.scale(t)/e.scale(i)},getScaleZoom:function(t,i){var e=this.options.crs,t=(i=void 0===i?this._zoom:i,e.zoom(t*e.scale(i)));return isNaN(t)?1/0:t},project:function(t,i){return i=void 0===i?this._zoom:i,this.options.crs.latLngToPoint(w(t),i)},unproject:function(t,i){return i=void 0===i?this._zoom:i,this.options.crs.pointToLatLng(_(t),i)},layerPointToLatLng:function(t){t=_(t).add(this.getPixelOrigin());return this.unproject(t)},latLngToLayerPoint:function(t){return this.project(w(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(w(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(g(t))},distance:function(t,i){return this.options.crs.distance(w(t),w(i))},containerPointToLayerPoint:function(t){return _(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return _(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){t=this.containerPointToLayerPoint(_(t));return this.layerPointToLatLng(t)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(w(t)))},mouseEventToContainerPoint:function(t){return Ni(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){t=this._container=_i(t);if(!t)throw new Error("Map container not found.");if(t._leaflet_id)throw new Error("Map container is already initialized.");S(t,"scroll",this._onScroll,this),this._containerId=h(t)},_initLayout:function(){var t=this._container,i=(this._fadeAnimated=this.options.fadeAnimation&&P.any3d,z(t,"leaflet-container"+(P.touch?" leaflet-touch":"")+(P.retina?" leaflet-retina":"")+(P.ielt9?" leaflet-oldie":"")+(P.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":"")),pi(t,"position"));"absolute"!==i&&"relative"!==i&&"fixed"!==i&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Z(this._mapPane,new p(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(z(t.markerPane,"leaflet-zoom-hide"),z(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,i){Z(this._mapPane,new p(0,0));var e=!this._loaded,n=(this._loaded=!0,i=this._limitZoom(i),this.fire("viewprereset"),this._zoom!==i);this._moveStart(n,!1)._move(t,i)._moveEnd(n),this.fire("viewreset"),e&&this.fire("load")},_moveStart:function(t,i){return t&&this.fire("zoomstart"),i||this.fire("movestart"),this},_move:function(t,i,e,n){void 0===i&&(i=this._zoom);var o=this._zoom!==i;return this._zoom=i,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),n?e&&e.pinch&&this.fire("zoom",e):((o||e&&e.pinch)&&this.fire("zoom",e),this.fire("move",e)),this},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return r(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){Z(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={};var i=t?E:S;i((this._targets[h(this._container)]=this)._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&i(window,"resize",this._onResize,this),P.any3d&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){r(this._resizeRequest),this._resizeRequest=x(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,i){for(var e,n=[],o="mouseout"===i||"mouseover"===i,s=t.target||t.srcElement,r=!1;s;){if((e=this._targets[h(s)])&&("click"===i||"preclick"===i)&&this._draggableMoved(e)){r=!0;break}if(e&&e.listens(i,!0)){if(o&&!Hi(s,t))break;if(n.push(e),o)break}if(s===this._container)break;s=s.parentNode}return n=n.length||r||o||!this.listens(i,!0)?n:[this]},_isClickDisabled:function(t){for(;t!==this._container;){if(t._leaflet_disable_click)return!0;t=t.parentNode}},_handleDOMEvent:function(t){var i,e=t.target||t.srcElement;!this._loaded||e._leaflet_disable_events||"click"===t.type&&this._isClickDisabled(e)||("mousedown"===(i=t.type)&&zi(e),this._fireDOMEvent(t,i))},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,i,e){"click"===t.type&&((a=l({},t)).type="preclick",this._fireDOMEvent(a,a.type,e));var n=this._findEventTargets(t,i);if(e){for(var o=[],s=0;sthis.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(i),n=this._getCenterOffset(t)._divideBy(1-1/n);return!(!0!==e.animate&&!this.getSize().contains(n))&&(x(function(){this._moveStart(!0,!1)._animateZoom(t,i,!0)},this),!0)},_animateZoom:function(t,i,e,n){this._mapPane&&(e&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=i,z(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:i,noUpdate:n}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(a(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&M(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function Fi(t){return new I(t)}var Ui,I=it.extend({options:{position:"topright"},initialize:function(t){c(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var i=this._map;return i&&i.removeControl(this),this.options.position=t,i&&i.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var i=this._container=this.onAdd(t),e=this.getPosition(),t=t._controlCorners[e];return z(i,"leaflet-control"),-1!==e.indexOf("bottom")?t.insertBefore(i,t.firstChild):t.appendChild(i),this._map.on("unload",this.remove,this),this},remove:function(){return this._map&&(T(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null),this},_refocusOnMap:function(t){this._map&&t&&0",i=document.createElement("div");return i.innerHTML=t,i.firstChild},_addItem:function(t){var i,e=document.createElement("label"),n=this._map.hasLayer(t.layer),n=(t.overlay?((i=document.createElement("input")).type="checkbox",i.className="leaflet-control-layers-selector",i.defaultChecked=n):i=this._createRadioElement("leaflet-base-layers_"+h(this),n),this._layerControlInputs.push(i),i.layerId=h(t.layer),S(i,"click",this._onInputClick,this),document.createElement("span")),o=(n.innerHTML=" "+t.name,document.createElement("span"));return e.appendChild(o),o.appendChild(i),o.appendChild(n),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(e),this._checkDisabledLayers(),e},_onInputClick:function(){var t,i,e=this._layerControlInputs,n=[],o=[];this._handlingClick=!0;for(var s=e.length-1;0<=s;s--)t=e[s],i=this._getLayer(t.layerId).layer,t.checked?n.push(i):t.checked||o.push(i);for(s=0;si.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this}})),qi=I.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(t){var i="leaflet-control-zoom",e=b("div",i+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,i+"-in",e,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,i+"-out",e,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),e},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,i,e,n,o){e=b("a",e,n);return e.innerHTML=t,e.href="#",e.title=i,e.setAttribute("role","button"),e.setAttribute("aria-label",i),Oi(e),S(e,"click",Ri),S(e,"click",o,this),S(e,"click",this._refocusOnMap,this),e},_updateDisabled:function(){var t=this._map,i="leaflet-disabled";M(this._zoomInButton,i),M(this._zoomOutButton,i),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),!this._disabled&&t._zoom!==t.getMinZoom()||(z(this._zoomOutButton,i),this._zoomOutButton.setAttribute("aria-disabled","true")),!this._disabled&&t._zoom!==t.getMaxZoom()||(z(this._zoomInButton,i),this._zoomInButton.setAttribute("aria-disabled","true"))}}),Gi=(A.mergeOptions({zoomControl:!0}),A.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new qi,this.addControl(this.zoomControl))}),I.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var i="leaflet-control-scale",e=b("div",i),n=this.options;return this._addScales(n,i+"-line",e),t.on(n.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),e},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,i,e){t.metric&&(this._mScale=b("div",i,e)),t.imperial&&(this._iScale=b("div",i,e))},_update:function(){var t=this._map,i=t.getSize().y/2,t=t.distance(t.containerPointToLatLng([0,i]),t.containerPointToLatLng([this.options.maxWidth,i]));this._updateScales(t)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var i=this._getRoundNum(t);this._updateScale(this._mScale,i<1e3?i+" m":i/1e3+" km",i/t)},_updateImperial:function(t){var i,e,t=3.2808399*t;5280'+(P.inlineSvg?' ':"")+"Leaflet"},initialize:function(t){c(this,t),this._attributions={}},onAdd:function(t){for(var i in(t.attributionControl=this)._container=b("div","leaflet-control-attribution"),Oi(this._container),t._layers)t._layers[i].getAttribution&&this.addAttribution(t._layers[i].getAttribution());return this._update(),t.on("layeradd",this._addAttribution,this),this._container},onRemove:function(t){t.off("layeradd",this._addAttribution,this)},_addAttribution:function(t){t.layer.getAttribution&&(this.addAttribution(t.layer.getAttribution()),t.layer.once("remove",function(){this.removeAttribution(t.layer.getAttribution())},this))},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t&&(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update()),this},removeAttribution:function(t){return t&&this._attributions[t]&&(this._attributions[t]--,this._update()),this},_update:function(){if(this._map){var t,i=[];for(t in this._attributions)this._attributions[t]&&i.push(t);var e=[];this.options.prefix&&e.push(this.options.prefix),i.length&&e.push(i.join(", ")),this._container.innerHTML=e.join(' ')}}}),n=(A.mergeOptions({attributionControl:!0}),A.addInitHook(function(){this.options.attributionControl&&(new Ki).addTo(this)}),I.Layers=Vi,I.Zoom=qi,I.Scale=Gi,I.Attribution=Ki,Fi.layers=function(t,i,e){return new Vi(t,i,e)},Fi.zoom=function(t){return new qi(t)},Fi.scale=function(t){return new Gi(t)},Fi.attribution=function(t){return new Ki(t)},it.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled&&(this._enabled=!1,this.removeHooks()),this},enabled:function(){return!!this._enabled}})),ft=(n.addTo=function(t,i){return t.addHandler(i,this),this},{Events:i}),Yi=P.touch?"touchstart mousedown":"mousedown",Xi=et.extend({options:{clickTolerance:3},initialize:function(t,i,e,n){c(this,n),this._element=t,this._dragStartTarget=i||t,this._preventOutline=e},enable:function(){this._enabled||(S(this._dragStartTarget,Yi,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Xi._dragging===this&&this.finishDrag(!0),E(this._dragStartTarget,Yi,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){var i,e;this._enabled&&(this._moved=!1,vi(this._element,"leaflet-zoom-anim")||(t.touches&&1!==t.touches.length?Xi._dragging===this&&this.finishDrag():Xi._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||((Xi._dragging=this)._preventOutline&&zi(this._element),Li(),ri(),this._moving||(this.fire("down"),e=t.touches?t.touches[0]:t,i=Ci(this._element),this._startPoint=new p(e.clientX,e.clientY),this._startPos=bi(this._element),this._parentScale=Zi(i),e="mousedown"===t.type,S(document,e?"mousemove":"touchmove",this._onMove,this),S(document,e?"mouseup":"touchend touchcancel",this._onUp,this)))))},_onMove:function(t){var i;this._enabled&&(t.touches&&1i&&(e.push(t[n]),o=n);oi.max.x&&(e|=2),t.yi.max.y&&(e|=8),e}function ee(t,i,e,n){var o=i.x,i=i.y,s=e.x-o,r=e.y-i,a=s*s+r*r;return 0this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()t.y!=n.y>t.y&&t.x<(n.x-e.x)*(t.y-e.y)/(n.y-e.y)+e.x&&(l=!l);return l||fe.prototype._containsPoint.call(this,t,!0)}});var ve=he.extend({initialize:function(t,i){c(this,i),this._layers={},t&&this.addData(t)},addData:function(t){var i,e,n,o=d(t)?t:t.features;if(o){for(i=0,e=o.length;ir.x&&(a=n.x+h-r.x+s.x),n.x-a-o.x<(h=0)&&(a=n.x-o.x),n.y+e+s.y>r.y&&(h=n.y+e-r.y+s.y),n.y-h-o.y<0&&(h=n.y-o.y),(a||h)&&i.fire("autopanstart").panBy([a,h],{animate:t&&"moveend"===t.type}))},_getAnchor:function(){return _(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}})),Ee=(A.mergeOptions({closePopupOnClick:!0}),A.include({openPopup:function(t,i,e){return this._initOverlay(ke,t,i,e).openOn(this),this},closePopup:function(t){return(t=arguments.length?t:this._popup)&&t.close(),this}}),o.include({bindPopup:function(t,i){return this._popup=this._initOverlay(ke,this._popup,t,i),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t){return this._popup&&this._popup._prepareOpen(t)&&this._popup.openOn(this._map),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var i;this._popup&&this._map&&(Ri(t),i=t.layer||t.target,this._popup._source!==i||i instanceof _e?(this._popup._source=i,this.openPopup(t.latlng)):this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}}),O.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(t){O.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(t){O.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var t=O.prototype.getEvents.call(this);return this.options.permanent||(t.preclick=this.close),t},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=b("div",t)},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var i,e=this._map,n=this._container,o=e.latLngToContainerPoint(e.getCenter()),e=e.layerPointToContainerPoint(t),s=this.options.direction,r=n.offsetWidth,a=n.offsetHeight,h=_(this.options.offset),l=this._getAnchor(),e="top"===s?(i=r/2,a):"bottom"===s?(i=r/2,0):(i="center"===s?r/2:"right"===s?0:"left"===s?r:e.xthis.options.maxZoom||nthis.options.maxZoom||void 0!==this.options.minZoom&&oe.max.x)||!i.wrapLat&&(t.ye.max.y))return!1}if(!this.options.bounds)return!0;i=this._tileCoordsToBounds(t);return g(this.options.bounds).overlaps(i)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var i=this._map,e=this.getTileSize(),n=t.scaleBy(e),e=n.add(e);return[i.unproject(n,t.z),i.unproject(e,t.z)]},_tileCoordsToBounds:function(t){t=this._tileCoordsToNwSe(t),t=new s(t[0],t[1]);return t=this.options.noWrap?t:this._map.wrapLatLngBounds(t)},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var t=t.split(":"),i=new p(+t[0],+t[1]);return i.z=+t[2],i},_removeTile:function(t){var i=this._tiles[t];i&&(T(i.el),delete this._tiles[t],this.fire("tileunload",{tile:i.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){z(t,"leaflet-tile");var i=this.getTileSize();t.style.width=i.x+"px",t.style.height=i.y+"px",t.onselectstart=u,t.onmousemove=u,P.ielt9&&this.options.opacity<1&&C(t,this.options.opacity)},_addTile:function(t,i){var e=this._getTilePos(t),n=this._tileCoordsToKey(t),o=this.createTile(this._wrapCoords(t),a(this._tileReady,this,t));this._initTile(o),this.createTile.length<2&&x(a(this._tileReady,this,t,null,o)),Z(o,e),this._tiles[n]={el:o,coords:t,current:!0},i.appendChild(o),this.fire("tileloadstart",{tile:o,coords:t})},_tileReady:function(t,i,e){i&&this.fire("tileerror",{error:i,tile:e,coords:t});var n=this._tileCoordsToKey(t);(e=this._tiles[n])&&(e.loaded=+new Date,this._map._fadeAnimated?(C(e.el,0),r(this._fadeFrame),this._fadeFrame=x(this._updateOpacity,this)):(e.active=!0,this._pruneTiles()),i||(z(e.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:e.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),P.ielt9||!this._map._fadeAnimated?x(this._pruneTiles,this):setTimeout(a(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var i=new p(this._wrapX?H(t.x,this._wrapX):t.x,this._wrapY?H(t.y,this._wrapY):t.y);return i.z=t.z,i},_pxBoundsToTileRange:function(t){var i=this.getTileSize();return new m(t.min.unscaleBy(i).floor(),t.max.unscaleBy(i).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});var Ie=Ae.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(t,i){this._url=t,(i=c(this,i)).detectRetina&&P.retina&&0')}}catch(t){}return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),Mt={_initContainer:function(){this._container=b("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Ne.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var i=t._container=He("shape");z(i,"leaflet-vml-shape "+(this.options.className||"")),i.coordsize="1 1",t._path=He("path"),i.appendChild(t._path),this._updateStyle(t),this._layers[h(t)]=t},_addPath:function(t){var i=t._container;this._container.appendChild(i),t.options.interactive&&t.addInteractiveTarget(i)},_removePath:function(t){var i=t._container;T(i),t.removeInteractiveTarget(i),delete this._layers[h(t)]},_updateStyle:function(t){var i=t._stroke,e=t._fill,n=t.options,o=t._container;o.stroked=!!n.stroke,o.filled=!!n.fill,n.stroke?(i=i||(t._stroke=He("stroke")),o.appendChild(i),i.weight=n.weight+"px",i.color=n.color,i.opacity=n.opacity,n.dashArray?i.dashStyle=d(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):i.dashStyle="",i.endcap=n.lineCap.replace("butt","flat"),i.joinstyle=n.lineJoin):i&&(o.removeChild(i),t._stroke=null),n.fill?(e=e||(t._fill=He("fill")),o.appendChild(e),e.color=n.fillColor||n.color,e.opacity=n.fillOpacity):e&&(o.removeChild(e),t._fill=null)},_updateCircle:function(t){var i=t._point.round(),e=Math.round(t._radius),n=Math.round(t._radiusY||e);this._setPath(t,t._empty()?"M0 0":"AL "+i.x+","+i.y+" "+e+","+n+" 0,23592600")},_setPath:function(t,i){t._path.v=i},_bringToFront:function(t){fi(t._container)},_bringToBack:function(t){gi(t._container)}},We=P.vml?He:ct,Fe=Ne.extend({_initContainer:function(){this._container=We("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=We("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){T(this._container),E(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){var t,i,e;this._map._animatingZoom&&this._bounds||(Ne.prototype._update.call(this),i=(t=this._bounds).getSize(),e=this._container,this._svgSize&&this._svgSize.equals(i)||(this._svgSize=i,e.setAttribute("width",i.x),e.setAttribute("height",i.y)),Z(e,t.min),e.setAttribute("viewBox",[t.min.x,t.min.y,i.x,i.y].join(" ")),this.fire("update"))},_initPath:function(t){var i=t._path=We("path");t.options.className&&z(i,t.options.className),t.options.interactive&&z(i,"leaflet-interactive"),this._updateStyle(t),this._layers[h(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){T(t._path),t.removeInteractiveTarget(t._path),delete this._layers[h(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var i=t._path,t=t.options;i&&(t.stroke?(i.setAttribute("stroke",t.color),i.setAttribute("stroke-opacity",t.opacity),i.setAttribute("stroke-width",t.weight),i.setAttribute("stroke-linecap",t.lineCap),i.setAttribute("stroke-linejoin",t.lineJoin),t.dashArray?i.setAttribute("stroke-dasharray",t.dashArray):i.removeAttribute("stroke-dasharray"),t.dashOffset?i.setAttribute("stroke-dashoffset",t.dashOffset):i.removeAttribute("stroke-dashoffset")):i.setAttribute("stroke","none"),t.fill?(i.setAttribute("fill",t.fillColor||t.color),i.setAttribute("fill-opacity",t.fillOpacity),i.setAttribute("fill-rule",t.fillRule||"evenodd")):i.setAttribute("fill","none"))},_updatePoly:function(t,i){this._setPath(t,dt(t._parts,i))},_updateCircle:function(t){var i=t._point,e=Math.max(Math.round(t._radius),1),n="a"+e+","+(Math.max(Math.round(t._radiusY),1)||e)+" 0 1,0 ",i=t._empty()?"M0 0":"M"+(i.x-e)+","+i.y+n+2*e+",0 "+n+2*-e+",0 ";this._setPath(t,i)},_setPath:function(t,i){t._path.setAttribute("d",i)},_bringToFront:function(t){fi(t._path)},_bringToBack:function(t){gi(t._path)}});function Ue(t){return P.svg||P.vml?new Fe(t):null}P.vml&&Fe.include(Mt),A.include({getRenderer:function(t){t=(t=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer)||(this._renderer=this._createRenderer());return this.hasLayer(t)||this.addLayer(t),t},_getPaneRenderer:function(t){if("overlayPane"===t||void 0===t)return!1;var i=this._paneRenderers[t];return void 0===i&&(i=this._createRenderer({pane:t}),this._paneRenderers[t]=i),i},_createRenderer:function(t){return this.options.preferCanvas&&je(t)||Ue(t)}});var Ve=ge.extend({initialize:function(t,i){ge.prototype.initialize.call(this,this._boundsToLatLngs(t),i)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=g(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});Fe.create=We,Fe.pointsToPath=dt,ve.geometryToLayer=ye,ve.coordsToLatLng=we,ve.coordsToLatLngs=Pe,ve.latLngToCoords=be,ve.latLngsToCoords=Le,ve.getFeature=Te,ve.asFeature=ze,A.mergeOptions({boxZoom:!0});var _t=n.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){S(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){E(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){T(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),ri(),Li(),this._startPoint=this._map.mouseEventToContainerPoint(t),S(document,{contextmenu:Ri,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=b("div","leaflet-zoom-box",this._container),z(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var t=new m(this._point,this._startPoint),i=t.getSize();Z(this._box,t.min),this._box.style.width=i.x+"px",this._box.style.height=i.y+"px"},_finish:function(){this._moved&&(T(this._box),M(this._container,"leaflet-crosshair")),ai(),Ti(),E(document,{contextmenu:Ri,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){1!==t.which&&1!==t.button||(this._finish(),this._moved&&(this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(a(this._resetState,this),0),t=new s(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point)),this._map.fitBounds(t).fire("boxzoomend",{boxZoomBounds:t})))},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._clearDeferredResetState(),this._resetState())}}),Ct=(A.addInitHook("addHandler","boxZoom",_t),A.mergeOptions({doubleClickZoom:!0}),n.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var i=this._map,e=i.getZoom(),n=i.options.zoomDelta,e=t.originalEvent.shiftKey?e-n:e+n;"center"===i.options.doubleClickZoom?i.setZoom(e):i.setZoomAround(t.containerPoint,e)}})),Zt=(A.addInitHook("addHandler","doubleClickZoom",Ct),A.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0}),n.extend({addHooks:function(){var t;this._draggable||(t=this._map,this._draggable=new Xi(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))),z(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){M(this._map._container,"leaflet-grab"),M(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t,i=this._map;i._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity?(t=g(this._map.options.maxBounds),this._offsetLimit=f(this._map.latLngToContainerPoint(t.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(t.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))):this._offsetLimit=null,i.fire("movestart").fire("dragstart"),i.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){var i,e;this._map.options.inertia&&(i=this._lastTime=+new Date,e=this._lastPos=this._draggable._absPos||this._draggable._newPos,this._positions.push(e),this._times.push(i),this._prunePositions(i)),this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;1i.max.x&&(t.x=this._viscousLimit(t.x,i.max.x)),t.y>i.max.y&&(t.y=this._viscousLimit(t.y,i.max.y)),this._draggable._newPos=this._draggable._startPos.add(t))},_onPreDragWrap:function(){var t=this._worldWidth,i=Math.round(t/2),e=this._initialWorldOffset,n=this._draggable._newPos.x,o=(n-i+e)%t+i-e,n=(n+i+e)%t-i-e,t=Math.abs(o+e)i.getMaxZoom()&&1