@nextgis/leaflet-map-adapter 1.11.7 → 1.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,26 +1,129 @@
1
- /** Bundle of @nextgis/leaflet-map-adapter; version: 1.11.7; author: NextGIS */
1
+ /** Bundle of @nextgis/leaflet-map-adapter; version: 1.12.1; author: NextGIS */
2
2
  import { EventEmitter } from 'events';
3
- import { Control, DomEvent, GeoJSON, FeatureGroup, DivIcon, Marker, CircleMarker, ImageOverlay as ImageOverlay$1, Layer, Util, CRS, GridLayer, DomUtil, TileLayer as TileLayer$1, Map } from 'leaflet';
4
- import { debounce as debounce$1, defined } from '@nextgis/utils';
3
+ import { Control, DomEvent, GeoJSON, FeatureGroup, DivIcon, Marker, CircleMarker, ImageOverlay as ImageOverlay$1, Util, CRS, Layer, GridLayer, DomUtil, TileLayer as TileLayer$1, Map } from 'leaflet';
4
+ import { defined, debounce as debounce$1 } from '@nextgis/utils';
5
5
  import { isPaintCallback, isPaint } from '@nextgis/paint';
6
6
 
7
+ /*! *****************************************************************************
8
+ Copyright (c) Microsoft Corporation.
9
+
10
+ Permission to use, copy, modify, and/or distribute this software for any
11
+ purpose with or without fee is hereby granted.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
+ PERFORMANCE OF THIS SOFTWARE.
20
+ ***************************************************************************** */
21
+ /* global Reflect, Promise */
22
+
23
+ var extendStatics = function(d, b) {
24
+ extendStatics = Object.setPrototypeOf ||
25
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
27
+ return extendStatics(d, b);
28
+ };
29
+
30
+ function __extends(d, b) {
31
+ if (typeof b !== "function" && b !== null)
32
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
33
+ extendStatics(d, b);
34
+ function __() { this.constructor = d; }
35
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
36
+ }
37
+
38
+ var __assign = function() {
39
+ __assign = Object.assign || function __assign(t) {
40
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
41
+ s = arguments[i];
42
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
43
+ }
44
+ return t;
45
+ };
46
+ return __assign.apply(this, arguments);
47
+ };
48
+
49
+ function __rest(s, e) {
50
+ var t = {};
51
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
52
+ t[p] = s[p];
53
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
54
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
55
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
56
+ t[p[i]] = s[p[i]];
57
+ }
58
+ return t;
59
+ }
60
+
61
+ function __awaiter(thisArg, _arguments, P, generator) {
62
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
63
+ return new (P || (P = Promise))(function (resolve, reject) {
64
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
65
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
66
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
67
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
68
+ });
69
+ }
70
+
71
+ function __generator(thisArg, body) {
72
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
73
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
74
+ function verb(n) { return function (v) { return step([n, v]); }; }
75
+ function step(op) {
76
+ if (f) throw new TypeError("Generator is already executing.");
77
+ while (_) try {
78
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
79
+ if (y = 0, t) op = [op[0] & 2, t.value];
80
+ switch (op[0]) {
81
+ case 0: case 1: t = op; break;
82
+ case 4: _.label++; return { value: op[1], done: false };
83
+ case 5: _.label++; y = op[1]; op = [0]; continue;
84
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
85
+ default:
86
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
87
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
88
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
89
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
90
+ if (t[2]) _.ops.pop();
91
+ _.trys.pop(); continue;
92
+ }
93
+ op = body.call(thisArg, _);
94
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
95
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
96
+ }
97
+ }
98
+
99
+ function __spreadArray(to, from, pack) {
100
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
101
+ if (ar || !(i in from)) {
102
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
103
+ ar[i] = from[i];
104
+ }
105
+ }
106
+ return to.concat(ar || Array.prototype.slice.call(from));
107
+ }
108
+
7
109
  function convertMapClickEvent(evt) {
8
- const coord = evt.containerPoint;
9
- const latLng = evt.latlng;
10
- const { lat, lng } = latLng;
110
+ var coord = evt.containerPoint;
111
+ var latLng = evt.latlng;
112
+ var lat = latLng.lat, lng = latLng.lng;
11
113
  return {
12
- latLng,
114
+ latLng: latLng,
13
115
  lngLat: [lng, lat],
14
116
  pixel: { left: coord.x, top: coord.y },
15
117
  source: evt,
16
118
  };
17
119
  }
18
120
 
19
- function createControl(control, options = {}, map) {
20
- const C = Control.extend({
21
- onAdd() {
22
- const element = document.createElement('div');
23
- const content = control.onAdd(map);
121
+ function createControl(control, options, map) {
122
+ if (options === void 0) { options = {}; }
123
+ var C = Control.extend({
124
+ onAdd: function () {
125
+ var element = document.createElement('div');
126
+ var content = control.onAdd(map);
24
127
  element.classList.add('leaflet-control');
25
128
  if (options.bar) {
26
129
  element.classList.add('leaflet-bar');
@@ -40,7 +143,7 @@ function createControl(control, options = {}, map) {
40
143
  DomEvent.disableClickPropagation(element);
41
144
  return element;
42
145
  },
43
- onRemove() {
146
+ onRemove: function () {
44
147
  control.onRemove();
45
148
  },
46
149
  });
@@ -48,12 +151,15 @@ function createControl(control, options = {}, map) {
48
151
  }
49
152
 
50
153
  function createButtonControl(options, map) {
51
- const link = document.createElement('a');
52
- const title = options.title || '';
154
+ var link = document.createElement('a');
155
+ var title = options.title || '';
53
156
  link.href = '#';
54
157
  link.title = title;
55
158
  link.setAttribute('role', 'button');
56
159
  link.setAttribute('aria-label', title);
160
+ if (options.addClass) {
161
+ link.classList.add(options.addClass);
162
+ }
57
163
  DomEvent.disableClickPropagation(link);
58
164
  DomEvent.on(link, 'click', DomEvent.stop);
59
165
  if (options.html instanceof HTMLElement) {
@@ -62,19 +168,19 @@ function createButtonControl(options, map) {
62
168
  else if (typeof options.html === 'string') {
63
169
  link.innerHTML = options.html;
64
170
  }
65
- const onClick = (e) => {
171
+ var onClick = function (e) {
66
172
  e.stopPropagation();
67
173
  options.onClick();
68
174
  };
69
175
  return createControl({
70
- onAdd() {
176
+ onAdd: function () {
71
177
  if (options.onClick !== undefined) {
72
178
  link.addEventListener('click', onClick);
73
179
  }
74
180
  return link;
75
181
  },
76
- onRemove() {
77
- const parent = link.parentNode;
182
+ onRemove: function () {
183
+ var parent = link.parentNode;
78
184
  if (parent) {
79
185
  parent.removeChild(link);
80
186
  }
@@ -85,31 +191,34 @@ function createButtonControl(options, map) {
85
191
  }, { bar: true }, map);
86
192
  }
87
193
 
88
- class AttributionControl extends Control.Attribution {
194
+ var AttributionControl = /** @class */ (function (_super) {
195
+ __extends(AttributionControl, _super);
89
196
  // options: AttributionControlOptions
90
- constructor(options) {
91
- super(options);
92
- const customAttribution = options && options.customAttribution;
197
+ function AttributionControl(options) {
198
+ var _this = _super.call(this, options) || this;
199
+ var customAttribution = options && options.customAttribution;
93
200
  if (customAttribution) {
94
- let attributions = [];
201
+ var attributions = [];
95
202
  if (Array.isArray(customAttribution)) {
96
203
  attributions = customAttribution;
97
204
  }
98
205
  else if (customAttribution) {
99
206
  attributions = [customAttribution];
100
207
  }
101
- attributions.forEach((x) => this.addAttribution(x));
208
+ attributions.forEach(function (x) { return _this.addAttribution(x); });
102
209
  }
210
+ return _this;
103
211
  }
104
- }
212
+ return AttributionControl;
213
+ }(Control.Attribution));
105
214
 
106
215
  function boundsToArray(bounds) {
107
- const ne = bounds.getNorthEast();
108
- const sw = bounds.getSouthWest();
216
+ var ne = bounds.getNorthEast();
217
+ var sw = bounds.getSouthWest();
109
218
  return [sw.lng, sw.lat, ne.lng, ne.lat];
110
219
  }
111
220
 
112
- const typeAlias = {
221
+ var typeAlias = {
113
222
  Point: 'point',
114
223
  LineString: 'line',
115
224
  MultiPoint: 'point',
@@ -118,79 +227,78 @@ const typeAlias = {
118
227
  MultiPolygon: 'polygon',
119
228
  GeometryCollection: 'polygon',
120
229
  };
121
- const PAINT = {
230
+ var PAINT = {
122
231
  stroke: false,
123
232
  opacity: 1,
124
233
  };
125
- const backAliases = {};
126
- for (const a in typeAlias) {
127
- const layerType = typeAlias[a];
128
- const backAlias = backAliases[layerType] || [];
234
+ var backAliases = {};
235
+ for (var a in typeAlias) {
236
+ var layerType = typeAlias[a];
237
+ var backAlias = backAliases[layerType] || [];
129
238
  backAlias.push(a);
130
239
  backAliases[layerType] = backAlias;
131
240
  }
132
241
  function geometryFilter(geometry, type) {
133
- const geoJsonGeometry = backAliases[type] || [];
242
+ var geoJsonGeometry = backAliases[type] || [];
134
243
  return geoJsonGeometry.indexOf(geometry) !== -1;
135
244
  }
136
245
  function filterGeometries(data, type) {
137
246
  if (data.type === 'FeatureCollection') {
138
- const _data = data;
139
- _data.features = _data.features.filter((f) => geometryFilter(f.geometry.type, type));
247
+ var _data = data;
248
+ _data.features = _data.features.filter(function (f) {
249
+ return geometryFilter(f.geometry.type, type);
250
+ });
140
251
  }
141
252
  else if (data.type === 'Feature') {
142
- const allow = geometryFilter(data.geometry.type, type);
253
+ var allow = geometryFilter(data.geometry.type, type);
143
254
  if (!allow) {
144
255
  return false;
145
256
  }
146
257
  }
147
258
  else if (data.type === 'GeometryCollection') {
148
- const _data = data;
149
- _data.geometries = _data.geometries.filter((g) => geometryFilter(g.type, type));
259
+ var _data = data;
260
+ _data.geometries = _data.geometries.filter(function (g) {
261
+ return geometryFilter(g.type, type);
262
+ });
150
263
  }
151
264
  return data;
152
265
  }
153
266
  function featuresBounds(features) {
154
- const geoJsonLayer = new GeoJSON();
155
- const features_ = Array.isArray(features) ? features : [features];
156
- features_.forEach((f) => geoJsonLayer.addData(f));
267
+ var geoJsonLayer = new GeoJSON();
268
+ var features_ = Array.isArray(features) ? features : [features];
269
+ features_.forEach(function (f) { return geoJsonLayer.addData(f); });
157
270
  return geoJsonLayer.getBounds();
158
271
  }
159
272
  function getFeaturesBounds(features) {
160
273
  return boundsToArray(featuresBounds(features));
161
274
  }
162
275
  function getFeaturesCenter(features) {
163
- const { lat, lng } = featuresBounds(features).getCenter();
276
+ var _a = featuresBounds(features).getCenter(), lat = _a.lat, lng = _a.lng;
164
277
  return [lng, lat];
165
278
  }
166
279
  function createFeaturePositionOptions(features) {
167
280
  return {
168
- getBounds: () => getFeaturesBounds(features),
169
- getCenter: () => getFeaturesCenter(features),
281
+ getBounds: function () { return getFeaturesBounds(features); },
282
+ getCenter: function () { return getFeaturesCenter(features); },
170
283
  };
171
284
  }
172
285
 
173
- function createMouseEvent({ layer, source, }) {
174
- const layer_ = source.target;
175
- const feature = layer_.feature;
176
- const opt = {
177
- layer,
178
- feature,
179
- event: convertMapClickEvent(source),
180
- source,
181
- ...createFeaturePositionOptions(feature),
182
- };
286
+ function createMouseEvent(_a) {
287
+ var layer = _a.layer, source = _a.source;
288
+ var layer_ = source.target;
289
+ var feature = layer_.feature;
290
+ var opt = __assign({ layer: layer, feature: feature, event: convertMapClickEvent(source), source: source }, createFeaturePositionOptions(feature));
183
291
  return opt;
184
292
  }
185
293
 
186
294
  function findMostFrequentGeomType(arr) {
187
- const counts = {};
188
- for (let fry = 0; fry < arr.length; fry++) {
295
+ var counts = {};
296
+ for (var fry = 0; fry < arr.length; fry++) {
189
297
  counts[arr[fry]] = 1 + (counts[arr[fry]] || 0);
190
298
  }
191
- let maxName = '';
192
- for (const c in counts) {
193
- const maxCount = maxName ? counts[maxName] : 0;
299
+ var maxName = '';
300
+ for (var c in counts) {
301
+ var maxCount = maxName ? counts[maxName] : 0;
194
302
  if (counts[c] > maxCount) {
195
303
  maxName = c;
196
304
  }
@@ -198,13 +306,13 @@ function findMostFrequentGeomType(arr) {
198
306
  return maxName;
199
307
  }
200
308
  function detectType(geojson) {
201
- let geometry;
309
+ var geometry;
202
310
  if (geojson.type === 'FeatureCollection') {
203
- const featuresTypes = geojson.features.map((f) => f.geometry.type);
311
+ var featuresTypes = geojson.features.map(function (f) { return f.geometry.type; });
204
312
  geometry = findMostFrequentGeomType(featuresTypes);
205
313
  }
206
314
  else if (geojson.type === 'GeometryCollection') {
207
- const geometryTypes = geojson.geometries.map((g) => g.type);
315
+ var geometryTypes = geojson.geometries.map(function (g) { return g.type; });
208
316
  geometry = findMostFrequentGeomType(geometryTypes);
209
317
  }
210
318
  else if (geojson.type === 'Feature') {
@@ -216,14 +324,14 @@ function detectType(geojson) {
216
324
  return geometry;
217
325
  }
218
326
 
219
- class BaseAdapter {
220
- constructor(map, options) {
327
+ var BaseAdapter = /** @class */ (function () {
328
+ function BaseAdapter(map, options) {
221
329
  this.map = map;
222
330
  this.options = options;
223
331
  this.pane = 'order-0';
224
332
  if (options.order !== undefined) {
225
- const pane = 'order-' + options.order;
226
- let exist = map.getPane(pane);
333
+ var pane = 'order-' + options.order;
334
+ var exist = map.getPane(pane);
227
335
  if (!exist) {
228
336
  exist = map.createPane(pane);
229
337
  }
@@ -231,34 +339,34 @@ class BaseAdapter {
231
339
  this.pane = pane;
232
340
  }
233
341
  }
234
- addLayer(options) {
342
+ BaseAdapter.prototype.addLayer = function (options) {
235
343
  Object.assign(this.options, options);
236
344
  return undefined;
237
- }
238
- }
345
+ };
346
+ return BaseAdapter;
347
+ }());
239
348
 
240
- class GeoJsonAdapter extends BaseAdapter {
241
- constructor(map, options) {
242
- super(map, options);
243
- this.selected = false;
244
- this._layers = [];
245
- this._selectedLayers = [];
246
- this._filteredLayers = [];
247
- this._openedPopup = [];
248
- this.$updateTooltip = debounce$1(() => {
249
- this.updateTooltip();
349
+ var GeoJsonAdapter = /** @class */ (function (_super) {
350
+ __extends(GeoJsonAdapter, _super);
351
+ function GeoJsonAdapter(map, options) {
352
+ var _this = _super.call(this, map, options) || this;
353
+ _this.selected = false;
354
+ _this._layers = [];
355
+ _this._selectedLayers = [];
356
+ _this._filteredLayers = [];
357
+ _this._openedPopup = [];
358
+ _this.$updateTooltip = debounce$1(function () {
359
+ _this.updateTooltip();
250
360
  }, 300);
251
- this.$unselect = () => {
252
- this.unselect();
361
+ _this.$unselect = function () {
362
+ _this.unselect();
253
363
  };
364
+ return _this;
254
365
  }
255
- addLayer(options) {
366
+ GeoJsonAdapter.prototype.addLayer = function (options) {
256
367
  Object.assign(this.options, options);
257
368
  this.paint = options.paint;
258
- this.layer = new FeatureGroup([], {
259
- ...options.nativeOptions,
260
- pane: this.pane,
261
- });
369
+ this.layer = new FeatureGroup([], __assign(__assign({}, options.nativeOptions), { pane: this.pane }));
262
370
  this.selectedPaint = options.selectedPaint;
263
371
  options.paint = this.paint;
264
372
  if (options.data) {
@@ -266,15 +374,16 @@ class GeoJsonAdapter extends BaseAdapter {
266
374
  }
267
375
  this._addMapListener();
268
376
  return this.layer;
269
- }
270
- beforeRemove() {
377
+ };
378
+ GeoJsonAdapter.prototype.beforeRemove = function () {
271
379
  this._removeMapListener();
272
- }
273
- select(findFeatureFun) {
380
+ };
381
+ GeoJsonAdapter.prototype.select = function (findFeatureFun) {
382
+ var _this = this;
274
383
  if (findFeatureFun) {
275
- const def = this._layers.filter(findFeatureFun);
276
- def.forEach((x) => {
277
- this._selectLayer(x, 'api');
384
+ var def = this._layers.filter(findFeatureFun);
385
+ def.forEach(function (x) {
386
+ _this._selectLayer(x, 'api');
278
387
  });
279
388
  }
280
389
  else if (!this.selected) {
@@ -283,16 +392,18 @@ class GeoJsonAdapter extends BaseAdapter {
283
392
  this._setPaintEachLayer(this.selectedPaint);
284
393
  }
285
394
  }
286
- }
287
- unselect(findFeatureFun) {
395
+ };
396
+ GeoJsonAdapter.prototype.unselect = function (findFeatureFun) {
397
+ var _this = this;
288
398
  if (findFeatureFun) {
289
- const feature = this._layers.filter(findFeatureFun);
290
- feature.forEach((x) => {
291
- this._unSelectLayer(x);
399
+ var feature = this._layers.filter(findFeatureFun);
400
+ feature.forEach(function (x) {
401
+ _this._unSelectLayer(x);
292
402
  });
293
403
  }
294
404
  else if (this.selected) {
295
- for (const p of this._openedPopup) {
405
+ for (var _i = 0, _a = this._openedPopup; _i < _a.length; _i++) {
406
+ var p = _a[_i];
296
407
  this._removePopup(p[0]);
297
408
  }
298
409
  if (this.paint) {
@@ -301,83 +412,67 @@ class GeoJsonAdapter extends BaseAdapter {
301
412
  this._selectedLayers.length = 0;
302
413
  this.selected = false;
303
414
  }
304
- }
305
- getSelected() {
306
- return this._selectedLayers.map((x) => {
307
- return {
308
- target: this,
309
- feature: x.feature,
310
- layer: x,
311
- ...createFeaturePositionOptions(x.feature),
312
- };
415
+ };
416
+ GeoJsonAdapter.prototype.getSelected = function () {
417
+ var _this = this;
418
+ return this._selectedLayers.map(function (x) {
419
+ return __assign({ target: _this, feature: x.feature, layer: x }, createFeaturePositionOptions(x.feature));
313
420
  });
314
- }
315
- getFiltered() {
421
+ };
422
+ GeoJsonAdapter.prototype.getFiltered = function () {
316
423
  return this._filteredLayers;
317
- }
318
- filter(fun) {
424
+ };
425
+ GeoJsonAdapter.prototype.filter = function (fun) {
426
+ var _this = this;
319
427
  // Some optimization
320
428
  this._filterFun = fun;
321
- const layer_ = this.layer;
322
- const map = layer_ && layer_._map;
429
+ var layer_ = this.layer;
430
+ var map = layer_ && layer_._map;
323
431
  if (layer_ && map) {
324
432
  layer_.remove();
325
- const filteredLayers = [];
326
- this._layers.forEach(({ feature, layer }) => {
433
+ var filteredLayers_1 = [];
434
+ this._layers.forEach(function (_a) {
435
+ var feature = _a.feature, layer = _a.layer;
327
436
  if (layer) {
328
- const ok = fun
329
- ? fun({
330
- target: this,
331
- feature,
332
- layer,
333
- ...createFeaturePositionOptions(feature),
334
- })
437
+ var ok = fun
438
+ ? fun(__assign({ target: _this, feature: feature, layer: layer }, createFeaturePositionOptions(feature)))
335
439
  : true;
336
440
  if (ok) {
337
441
  layer_.addLayer(layer);
338
- filteredLayers.push({
339
- target: this,
340
- feature,
341
- layer,
342
- ...createFeaturePositionOptions(feature),
343
- });
442
+ filteredLayers_1.push(__assign({ target: _this, feature: feature, layer: layer }, createFeaturePositionOptions(feature)));
344
443
  }
345
444
  else {
346
445
  layer_.removeLayer(layer);
347
446
  }
348
447
  }
349
448
  });
350
- this._filteredLayers = filteredLayers;
449
+ this._filteredLayers = filteredLayers_1;
351
450
  layer_.addTo(map);
352
451
  }
353
452
  return this._filteredLayers;
354
- }
355
- cleanFilter() {
453
+ };
454
+ GeoJsonAdapter.prototype.cleanFilter = function () {
356
455
  this.filter();
357
- }
358
- getLayers() {
359
- return this._layers.map(({ layer, feature }) => {
360
- const visible = layer && !!layer._map;
361
- return {
362
- feature,
363
- layer,
364
- visible,
365
- target: this,
366
- ...createFeaturePositionOptions(feature),
367
- };
456
+ };
457
+ GeoJsonAdapter.prototype.getLayers = function () {
458
+ var _this = this;
459
+ return this._layers.map(function (_a) {
460
+ var layer = _a.layer, feature = _a.feature;
461
+ var visible = layer && !!layer._map;
462
+ return __assign({ feature: feature, layer: layer, visible: visible, target: _this }, createFeaturePositionOptions(feature));
368
463
  });
369
- }
370
- clearLayer(cb) {
464
+ };
465
+ GeoJsonAdapter.prototype.clearLayer = function (cb) {
371
466
  this.unselect();
372
- const layer_ = this.layer;
467
+ var layer_ = this.layer;
373
468
  if (layer_) {
374
469
  if (cb) {
375
- for (let fry = this._layers.length; fry--;) {
376
- const def = this._layers[fry];
470
+ for (var fry = this._layers.length; fry--;) {
471
+ var def = this._layers[fry];
377
472
  if (def) {
378
- const { feature, layer } = def;
473
+ var feature = def.feature, layer = def.layer;
379
474
  if (feature && layer) {
380
- const exist = cb(feature);
475
+ var exist = cb(feature);
381
476
  if (exist) {
382
477
  layer_.removeLayer(layer);
383
478
  this._layers.splice(fry, 1);
@@ -391,19 +486,19 @@ class GeoJsonAdapter extends BaseAdapter {
391
486
  this._layers = [];
392
487
  }
393
488
  }
394
- }
395
- setData(data) {
489
+ };
490
+ GeoJsonAdapter.prototype.setData = function (data) {
396
491
  this.clearLayer();
397
492
  this.addData(data);
398
- }
399
- addData(data) {
400
- const options = this.options;
401
- let geoJsonOptions;
493
+ };
494
+ GeoJsonAdapter.prototype.addData = function (data) {
495
+ var options = this.options;
496
+ var geoJsonOptions;
402
497
  if (options) {
403
498
  if (data) {
404
- let type;
499
+ var type = void 0;
405
500
  if (!options.type) {
406
- const detectedType = detectType(data);
501
+ var detectedType = detectType(data);
407
502
  type = typeAlias[detectedType];
408
503
  }
409
504
  else {
@@ -421,155 +516,166 @@ class GeoJsonAdapter extends BaseAdapter {
421
516
  }
422
517
  new GeoJSON(data || undefined, geoJsonOptions);
423
518
  }
424
- }
425
- openPopup(findFeatureFun, options) {
519
+ };
520
+ GeoJsonAdapter.prototype.openPopup = function (findFeatureFun, options) {
521
+ var _this = this;
426
522
  if (findFeatureFun) {
427
- const def = this._layers.filter(findFeatureFun);
428
- def.forEach((x) => {
429
- this._openPopup(x, options, 'api');
523
+ var def = this._layers.filter(findFeatureFun);
524
+ def.forEach(function (x) {
525
+ _this._openPopup(x, options, 'api');
430
526
  });
431
527
  }
432
- }
433
- closePopup(findFeatureFun) {
434
- const popupToClose = findFeatureFun
435
- ? this._openedPopup.filter((x) => findFeatureFun(x[2]))
528
+ };
529
+ GeoJsonAdapter.prototype.closePopup = function (findFeatureFun) {
530
+ var _this = this;
531
+ var popupToClose = findFeatureFun
532
+ ? this._openedPopup.filter(function (x) { return findFeatureFun(x[2]); })
436
533
  : this._openedPopup;
437
- popupToClose.forEach((x) => {
438
- this._removePopup(x[0]);
534
+ popupToClose.forEach(function (x) {
535
+ _this._removePopup(x[0]);
439
536
  });
440
- }
441
- updateTooltip(layerDef) {
537
+ };
538
+ GeoJsonAdapter.prototype.updateTooltip = function (layerDef) {
539
+ var _this = this;
442
540
  if (layerDef) {
443
541
  this._updateTooltip(layerDef);
444
542
  }
445
543
  else {
446
- this.getLayers().forEach((x) => this._updateTooltip({ feature: x.feature, layer: x.layer }));
544
+ this.getLayers().forEach(function (x) {
545
+ return _this._updateTooltip({ feature: x.feature, layer: x.layer });
546
+ });
447
547
  }
448
- }
548
+ };
449
549
  /** @deprecated use {@link GeoJsonAdapter.getBounds} instead */
450
- getExtent() {
550
+ GeoJsonAdapter.prototype.getExtent = function () {
451
551
  return this.getBounds();
452
- }
453
- getBounds() {
552
+ };
553
+ GeoJsonAdapter.prototype.getBounds = function () {
454
554
  if (this.layer) {
455
- const bounds = this.layer.getBounds();
555
+ var bounds = this.layer.getBounds();
456
556
  if (bounds.isValid()) {
457
557
  return boundsToArray(bounds);
458
558
  }
459
559
  }
460
- }
461
- setOpacity(value) {
560
+ };
561
+ GeoJsonAdapter.prototype.setOpacity = function (value) {
462
562
  this.options.opacity = value;
463
563
  this.setPaint(this.paint);
464
564
  this.setSelectedPaint(this.selectedPaint);
465
- }
466
- setPaint(paint) {
565
+ };
566
+ GeoJsonAdapter.prototype.setPaint = function (paint) {
467
567
  if (paint) {
468
568
  this.paint = paint;
469
- for (const l of this._layers) {
569
+ for (var _i = 0, _a = this._layers; _i < _a.length; _i++) {
570
+ var l = _a[_i];
470
571
  this._setPaint(l, paint);
471
572
  }
472
573
  }
473
- }
474
- setSelectedPaint(paint) {
574
+ };
575
+ GeoJsonAdapter.prototype.setSelectedPaint = function (paint) {
475
576
  if (paint) {
476
577
  this.selectedPaint = paint;
477
- for (const l of this._selectedLayers) {
578
+ for (var _i = 0, _a = this._selectedLayers; _i < _a.length; _i++) {
579
+ var l = _a[_i];
478
580
  this._setPaint(l, paint);
479
581
  }
480
582
  }
481
- }
482
- updatePaint(paint) {
483
- this.paint = { ...this.paint, ...paint };
484
- for (const l of this._layers) {
583
+ };
584
+ GeoJsonAdapter.prototype.updatePaint = function (paint) {
585
+ this.paint = __assign(__assign({}, this.paint), paint);
586
+ for (var _i = 0, _a = this._layers; _i < _a.length; _i++) {
587
+ var l = _a[_i];
485
588
  this._setPaint(l, this.paint);
486
589
  }
487
- }
488
- updateSelectedPaint(paint) {
489
- this.selectedPaint = { ...this.selectedPaint, ...paint };
490
- for (const l of this._selectedLayers) {
590
+ };
591
+ GeoJsonAdapter.prototype.updateSelectedPaint = function (paint) {
592
+ this.selectedPaint = __assign(__assign({}, this.selectedPaint), paint);
593
+ for (var _i = 0, _a = this._selectedLayers; _i < _a.length; _i++) {
594
+ var l = _a[_i];
491
595
  this._setPaint(l, this.selectedPaint);
492
596
  }
493
- }
494
- _updateTooltip(layerDef) {
495
- const { feature, layer } = layerDef;
597
+ };
598
+ GeoJsonAdapter.prototype._updateTooltip = function (layerDef) {
599
+ var feature = layerDef.feature, layer = layerDef.layer;
496
600
  if (feature && layer && feature.properties && this.options.labelField) {
497
601
  layer.unbindTooltip();
498
- const message = feature.properties[this.options.labelField];
602
+ var message = feature.properties[this.options.labelField];
499
603
  if (message !== undefined) {
500
- const permanent = !this.options.labelOnHover;
501
- layer.bindTooltip(String(message), { permanent, sticky: false });
604
+ var permanent = !this.options.labelOnHover;
605
+ layer.bindTooltip(String(message), { permanent: permanent, sticky: false });
502
606
  }
503
607
  }
504
- }
505
- async _openPopup(def, options = {}, type, latLng) {
608
+ };
609
+ GeoJsonAdapter.prototype._openPopup = function (def, options, type, latLng) {
506
610
  var _a, _b;
507
- const { feature, layer } = def;
508
- const { minWidth, autoPan, maxWidth, closeButton: closeButton_, } = {
509
- minWidth: 300,
510
- ...options,
511
- };
512
- const closeButton = closeButton_ !== null && closeButton_ !== void 0 ? closeButton_ : !this.options.selectOnHover;
513
- let popup;
514
- const _closeHandlers = [];
515
- const onClose = (handler) => {
516
- _closeHandlers.push(handler);
517
- };
518
- const close = () => {
519
- if (popup) {
520
- this._removePopup(popup);
521
- }
522
- };
523
- let content;
524
- if (options.createPopupContent) {
525
- content = await options.createPopupContent({
526
- layer,
527
- feature,
528
- target: this,
529
- type,
530
- close,
531
- onClose,
532
- ...createFeaturePositionOptions(feature),
611
+ if (options === void 0) { options = {}; }
612
+ return __awaiter(this, void 0, void 0, function () {
613
+ var feature, layer, _c, minWidth, autoPan, maxWidth, closeButton_, closeButton, popup, _closeHandlers, onClose, close, content, popupOptions, unselectOnClose, p;
614
+ var _this = this;
615
+ return __generator(this, function (_d) {
616
+ switch (_d.label) {
617
+ case 0:
618
+ feature = def.feature, layer = def.layer;
619
+ _c = __assign({ minWidth: 300 }, options), minWidth = _c.minWidth, autoPan = _c.autoPan, maxWidth = _c.maxWidth, closeButton_ = _c.closeButton;
620
+ closeButton = closeButton_ !== null && closeButton_ !== void 0 ? closeButton_ : !this.options.selectOnHover;
621
+ _closeHandlers = [];
622
+ onClose = function (handler) {
623
+ _closeHandlers.push(handler);
624
+ };
625
+ close = function () {
626
+ if (popup) {
627
+ _this._removePopup(popup);
628
+ }
629
+ };
630
+ if (!options.createPopupContent) return [3 /*break*/, 2];
631
+ return [4 /*yield*/, options.createPopupContent(__assign({ layer: layer, feature: feature, target: this, type: type, close: close, onClose: onClose }, createFeaturePositionOptions(feature)))];
632
+ case 1:
633
+ content = _d.sent();
634
+ return [3 /*break*/, 3];
635
+ case 2:
636
+ content = options.popupContent;
637
+ _d.label = 3;
638
+ case 3:
639
+ if (content && layer) {
640
+ popupOptions = {
641
+ minWidth: minWidth,
642
+ autoPan: autoPan,
643
+ // maxWidth,
644
+ closeButton: closeButton,
645
+ closeOnClick: false,
646
+ autoClose: false,
647
+ };
648
+ if (defined(maxWidth)) {
649
+ popupOptions.maxWidth = maxWidth;
650
+ }
651
+ popup = layer.bindPopup(content, popupOptions);
652
+ unselectOnClose = (_b = (_a = this.options.popupOptions) === null || _a === void 0 ? void 0 : _a.unselectOnClose) !== null && _b !== void 0 ? _b : true;
653
+ if (unselectOnClose) {
654
+ p = layer.getPopup();
655
+ p &&
656
+ p.once('remove', function () {
657
+ close();
658
+ }, this);
659
+ }
660
+ this._openedPopup.push([popup, _closeHandlers, def]);
661
+ popup.openPopup(latLng);
662
+ }
663
+ return [2 /*return*/];
664
+ }
533
665
  });
534
- }
535
- else {
536
- content = options.popupContent;
537
- }
538
- if (content && layer) {
539
- const popupOptions = {
540
- minWidth,
541
- autoPan,
542
- // maxWidth,
543
- closeButton,
544
- closeOnClick: false,
545
- autoClose: false,
546
- };
547
- if (defined(maxWidth)) {
548
- popupOptions.maxWidth = maxWidth;
549
- }
550
- popup = layer.bindPopup(content, popupOptions);
551
- const unselectOnClose = (_b = (_a = this.options.popupOptions) === null || _a === void 0 ? void 0 : _a.unselectOnClose) !== null && _b !== void 0 ? _b : true;
552
- if (unselectOnClose) {
553
- const p = layer.getPopup();
554
- p &&
555
- p.once('remove', () => {
556
- close();
557
- }, this);
558
- }
559
- this._openedPopup.push([popup, _closeHandlers, def]);
560
- popup.openPopup(latLng);
561
- }
562
- }
563
- _removePopup(popup) {
666
+ });
667
+ };
668
+ GeoJsonAdapter.prototype._removePopup = function (popup) {
564
669
  var _a, _b;
565
- const map = this.map;
670
+ var map = this.map;
566
671
  if (map) {
567
672
  popup.closePopup().unbindPopup();
568
- const index = this._openedPopup.findIndex((x) => x[0] === popup);
673
+ var index = this._openedPopup.findIndex(function (x) { return x[0] === popup; });
569
674
  if (index !== -1) {
570
- const unselectOnClose = (_b = (_a = this.options.popupOptions) === null || _a === void 0 ? void 0 : _a.unselectOnClose) !== null && _b !== void 0 ? _b : true;
571
- const [, closeHandlers, def] = this._openedPopup[index];
572
- for (const h of closeHandlers) {
675
+ var unselectOnClose = (_b = (_a = this.options.popupOptions) === null || _a === void 0 ? void 0 : _a.unselectOnClose) !== null && _b !== void 0 ? _b : true;
676
+ var _c = this._openedPopup[index], closeHandlers = _c[1], def = _c[2];
677
+ for (var _i = 0, closeHandlers_1 = closeHandlers; _i < closeHandlers_1.length; _i++) {
678
+ var h = closeHandlers_1[_i];
573
679
  h(def);
574
680
  }
575
681
  closeHandlers.length = 0;
@@ -579,15 +685,16 @@ class GeoJsonAdapter extends BaseAdapter {
579
685
  this._openedPopup.splice(index, 1);
580
686
  }
581
687
  }
582
- }
583
- _setPaintEachLayer(paint) {
584
- this._layers.forEach((l) => {
585
- this._setPaint(l, paint);
688
+ };
689
+ GeoJsonAdapter.prototype._setPaintEachLayer = function (paint) {
690
+ var _this = this;
691
+ this._layers.forEach(function (l) {
692
+ _this._setPaint(l, paint);
586
693
  });
587
- }
588
- _setPaint(def, paint) {
589
- let style = undefined;
590
- const { layer, feature } = def;
694
+ };
695
+ GeoJsonAdapter.prototype._setPaint = function (def, paint) {
696
+ var style = undefined;
697
+ var layer = def.layer, feature = def.feature;
591
698
  if (layer && feature) {
592
699
  if (isPaintCallback(paint)) {
593
700
  style = paint(feature);
@@ -597,8 +704,8 @@ class GeoJsonAdapter extends BaseAdapter {
597
704
  }
598
705
  if (style) {
599
706
  if (this.type === 'point' && style.type === 'icon') {
600
- const marker = layer;
601
- const divIcon = this._createDivIcon(style);
707
+ var marker = layer;
708
+ var divIcon = this._createDivIcon(style);
602
709
  marker.setIcon(divIcon);
603
710
  }
604
711
  else if ('setStyle' in layer) {
@@ -606,14 +713,14 @@ class GeoJsonAdapter extends BaseAdapter {
606
713
  }
607
714
  }
608
715
  }
609
- }
610
- _preparePaint(paint) {
716
+ };
717
+ GeoJsonAdapter.prototype._preparePaint = function (paint) {
611
718
  if (paint.type !== 'get-paint') {
612
719
  // const path: CircleMarkerOptions | PathOptions = paint as CircleMarkerOptions | PathOptions;
613
720
  // if (path.opacity) {
614
721
  // path.fillOpacity = path.opacity;
615
722
  // }
616
- const paintAliases = [
723
+ var paintAliases = [
617
724
  // ['color', 'color'],
618
725
  ['color', 'strokeColor'],
619
726
  ['opacity', 'strokeOpacity'],
@@ -623,19 +730,20 @@ class GeoJsonAdapter extends BaseAdapter {
623
730
  ['fill', 'fill'],
624
731
  ['weight', 'weight'],
625
732
  ];
626
- const aliases = this.type === 'line'
733
+ var aliases = this.type === 'line'
627
734
  ? [
628
735
  ['color', 'strokeColor'],
629
736
  ['opacity', 'strokeOpacity'],
630
737
  ['weight', 'weight'],
631
738
  ]
632
739
  : paintAliases;
633
- const readyPaint = {};
740
+ var readyPaint = {};
634
741
  if ('radius' in paint && typeof paint.radius === 'number') {
635
742
  readyPaint.radius = paint.radius;
636
743
  }
637
- for (const [to, from] of aliases) {
638
- let paintProp = paint[from];
744
+ for (var _i = 0, aliases_1 = aliases; _i < aliases_1.length; _i++) {
745
+ var _a = aliases_1[_i], to = _a[0], from = _a[1];
746
+ var paintProp = paint[from];
639
747
  if (defined(this.options.opacity) &&
640
748
  from.toLowerCase().indexOf('opacity') !== -1) {
641
749
  paintProp = Number(paintProp) * this.options.opacity;
@@ -650,27 +758,28 @@ class GeoJsonAdapter extends BaseAdapter {
650
758
  return readyPaint;
651
759
  }
652
760
  return PAINT;
653
- }
654
- _getGeoJsonOptions(options, type) {
655
- const paint = options.paint;
656
- let lopt = {};
761
+ };
762
+ GeoJsonAdapter.prototype._getGeoJsonOptions = function (options, type) {
763
+ var _this = this;
764
+ var paint = options.paint;
765
+ var lopt = {};
657
766
  if (typeof paint === 'function') {
658
767
  if (type === 'point') {
659
768
  // TODO: fix types (@geoman-io/leaflet-geoman-free)
660
- lopt.pointToLayer = (feature, latLng) => {
661
- const iconOpt = paint(feature);
662
- const pointToLayer = this._createPaintToLayer(iconOpt);
769
+ lopt.pointToLayer = function (feature, latLng) {
770
+ var iconOpt = paint(feature);
771
+ var pointToLayer = _this._createPaintToLayer(iconOpt);
663
772
  return pointToLayer(feature, latLng);
664
773
  };
665
774
  }
666
775
  else {
667
776
  lopt = {
668
- style: (feature) => {
777
+ style: function (feature) {
669
778
  if (feature) {
670
- return this._preparePaint({ ...PAINT, ...paint(feature) });
779
+ return _this._preparePaint(__assign(__assign({}, PAINT), paint(feature)));
671
780
  }
672
781
  else {
673
- return this._preparePaint({ ...PAINT, type: 'path' });
782
+ return _this._preparePaint(__assign(__assign({}, PAINT), { type: 'path' }));
674
783
  }
675
784
  },
676
785
  };
@@ -679,106 +788,90 @@ class GeoJsonAdapter extends BaseAdapter {
679
788
  else {
680
789
  lopt = this._createPaintOptions(paint, type);
681
790
  }
682
- lopt.onEachFeature = (feature, layer) => {
683
- this._onEachFeature(feature, layer);
791
+ lopt.onEachFeature = function (feature, layer) {
792
+ _this._onEachFeature(feature, layer);
684
793
  };
685
794
  return lopt;
686
- }
687
- _onEachFeature(feature, layer) {
688
- const layer_ = this.layer;
795
+ };
796
+ GeoJsonAdapter.prototype._onEachFeature = function (feature, layer) {
797
+ var _this = this;
798
+ var layer_ = this.layer;
689
799
  if (layer_) {
690
- const def = {
691
- target: this,
692
- feature,
693
- layer,
694
- ...createFeaturePositionOptions(feature),
695
- };
800
+ var def_1 = __assign({ target: this, feature: feature, layer: layer }, createFeaturePositionOptions(feature));
696
801
  // @ts-ignore
697
802
  layer.options.pane = this.pane;
698
- this._layers.push(def);
699
- let ok = true;
803
+ this._layers.push(def_1);
804
+ var ok = true;
700
805
  if (this._filterFun) {
701
- ok = this._filterFun(def);
806
+ ok = this._filterFun(def_1);
702
807
  }
703
808
  if (ok) {
704
- const { popup, popupOptions, selectable, interactive, selectOnHover } = this.options;
809
+ var _a = this.options, popup_1 = _a.popup, popupOptions_1 = _a.popupOptions, selectable = _a.selectable, interactive = _a.interactive, selectOnHover = _a.selectOnHover;
705
810
  // @ts-ignore
706
811
  layer.options.interactive = defined(interactive) ? interactive : true;
707
812
  layer_.addLayer(layer);
708
813
  if (selectable) {
709
814
  if (selectOnHover) {
710
- layer.on('mouseover', () => {
711
- this._selectLayer(def, 'hover');
815
+ layer.on('mouseover', function () {
816
+ _this._selectLayer(def_1, 'hover');
712
817
  });
713
- layer.on('mouseout', () => {
714
- this._unSelectLayer(def);
818
+ layer.on('mouseout', function () {
819
+ _this._unSelectLayer(def_1);
715
820
  });
716
821
  }
717
822
  else {
718
- layer.on('click', (e) => this._selectOnLayerClick(e), this);
823
+ layer.on('click', function (e) { return _this._selectOnLayerClick(e); }, this);
719
824
  }
720
825
  }
721
826
  this._handleMouseEvents(layer);
722
827
  // The timeout is needed to display the popup immediately when adding a layer to the map.
723
828
  // Without a timeout, the layer may not yet have a _map object
724
- setTimeout(() => {
725
- if (popup) {
726
- this._openPopup({
727
- target: this,
728
- layer,
729
- feature,
730
- ...createFeaturePositionOptions(feature),
731
- }, popupOptions, 'api');
829
+ setTimeout(function () {
830
+ if (popup_1) {
831
+ _this._openPopup(__assign({ target: _this, layer: layer, feature: feature }, createFeaturePositionOptions(feature)), popupOptions_1, 'api');
732
832
  }
733
- this._updateTooltip({ layer, feature });
833
+ _this._updateTooltip({ layer: layer, feature: feature });
734
834
  });
735
835
  }
736
836
  }
737
- }
738
- _handleMouseEvents(layer) {
739
- const { onClick, onLayerClick, onMouseOut, onMouseOver } = this.options;
837
+ };
838
+ GeoJsonAdapter.prototype._handleMouseEvents = function (layer) {
839
+ var _this = this;
840
+ var _a = this.options, onClick = _a.onClick, onLayerClick = _a.onLayerClick, onMouseOut = _a.onMouseOut, onMouseOver = _a.onMouseOver;
740
841
  // TODO: remove backward compatibility for onLayerClick
741
- const onClick_ = onClick || onLayerClick;
842
+ var onClick_ = onClick || onLayerClick;
742
843
  if (onClick_) {
743
- layer.on('click', (e) => {
744
- const selected = !!this._getSelected(layer);
745
- onClick_({
746
- selected,
747
- ...this._createMouseEvent(e),
748
- });
844
+ layer.on('click', function (e) {
845
+ var selected = !!_this._getSelected(layer);
846
+ onClick_(__assign({ selected: selected }, _this._createMouseEvent(e)));
749
847
  }, this);
750
848
  }
751
849
  if (onMouseOut) {
752
- layer.on('mouseout', (e) => {
753
- onMouseOut(this._createMouseEvent(e));
850
+ layer.on('mouseout', function (e) {
851
+ onMouseOut(_this._createMouseEvent(e));
754
852
  }, this);
755
853
  }
756
854
  if (onMouseOver) {
757
- layer.on('mouseover', (e) => {
758
- onMouseOver(this._createMouseEvent(e));
855
+ layer.on('mouseover', function (e) {
856
+ onMouseOver(_this._createMouseEvent(e));
759
857
  }, this);
760
858
  }
761
- }
762
- _createMouseEvent(source) {
859
+ };
860
+ GeoJsonAdapter.prototype._createMouseEvent = function (source) {
763
861
  return createMouseEvent({
764
862
  layer: this,
765
863
  source: source,
766
864
  });
767
- }
768
- _getSelected(layer) {
769
- return this._selectedLayers.find((x) => x.layer === layer);
770
- }
771
- _selectOnLayerClick(e) {
865
+ };
866
+ GeoJsonAdapter.prototype._getSelected = function (layer) {
867
+ return this._selectedLayers.find(function (x) { return x.layer === layer; });
868
+ };
869
+ GeoJsonAdapter.prototype._selectOnLayerClick = function (e) {
772
870
  DomEvent.stopPropagation(e);
773
- const layer = e.target;
774
- const feature = layer.feature;
775
- const def = {
776
- target: this,
777
- layer,
778
- feature,
779
- ...createFeaturePositionOptions(feature),
780
- };
781
- const isSelected = this._getSelected(layer);
871
+ var layer = e.target;
872
+ var feature = layer.feature;
873
+ var def = __assign({ target: this, layer: layer, feature: feature }, createFeaturePositionOptions(feature));
874
+ var isSelected = this._getSelected(layer);
782
875
  if (isSelected) {
783
876
  if (this.options && this.options.unselectOnSecondClick) {
784
877
  this._unSelectLayer(isSelected);
@@ -787,17 +880,18 @@ class GeoJsonAdapter extends BaseAdapter {
787
880
  else {
788
881
  this._selectLayer(def, 'click', e.latlng);
789
882
  }
790
- }
791
- _selectLayer(def, type, latlng) {
792
- this.map._addUnselectCb(() => {
793
- this._unSelectLayer(def);
883
+ };
884
+ GeoJsonAdapter.prototype._selectLayer = function (def, type, latlng) {
885
+ var _this = this;
886
+ this.map._addUnselectCb(function () {
887
+ _this._unSelectLayer(def);
794
888
  });
795
889
  if (this.options && !this.options.multiselect) {
796
- this._selectedLayers.forEach((x) => this._unSelectLayer(x));
890
+ this._selectedLayers.forEach(function (x) { return _this._unSelectLayer(x); });
797
891
  }
798
892
  this._selectedLayers.push(def);
799
893
  this.selected = true;
800
- const { selectedPaint, popupOnSelect, popupOptions } = this.options;
894
+ var _a = this.options, selectedPaint = _a.selectedPaint, popupOnSelect = _a.popupOnSelect, popupOptions = _a.popupOptions;
801
895
  if (selectedPaint && def.layer) {
802
896
  this._setPaint(def, selectedPaint);
803
897
  }
@@ -805,17 +899,12 @@ class GeoJsonAdapter extends BaseAdapter {
805
899
  this._openPopup(def, popupOptions, type, latlng);
806
900
  }
807
901
  if (this.options.onSelect) {
808
- const features = def.feature ? [def.feature] : [];
809
- this.options.onSelect({
810
- type,
811
- layer: this,
812
- features,
813
- ...createFeaturePositionOptions(features),
814
- });
902
+ var features = def.feature ? [def.feature] : [];
903
+ this.options.onSelect(__assign({ type: type, layer: this, features: features }, createFeaturePositionOptions(features)));
815
904
  }
816
- }
817
- _unSelectLayer(def) {
818
- const index = this._selectedLayers.indexOf(def);
905
+ };
906
+ GeoJsonAdapter.prototype._unSelectLayer = function (def) {
907
+ var index = this._selectedLayers.indexOf(def);
819
908
  if (index !== -1) {
820
909
  this._selectedLayers.splice(index, 1);
821
910
  if (this.options) {
@@ -828,40 +917,41 @@ class GeoJsonAdapter extends BaseAdapter {
828
917
  }
829
918
  }
830
919
  this.selected = this._selectedLayers.length > 0;
831
- }
832
- _createDivIcon(icon) {
833
- const { ...toLIconOpt } = icon;
834
- return new DivIcon({ className: '', ...toLIconOpt });
835
- }
836
- _createPaintToLayer(icon) {
920
+ };
921
+ GeoJsonAdapter.prototype._createDivIcon = function (icon) {
922
+ var toLIconOpt = __rest(icon, []);
923
+ return new DivIcon(__assign({ className: '' }, toLIconOpt));
924
+ };
925
+ GeoJsonAdapter.prototype._createPaintToLayer = function (icon) {
926
+ var _this = this;
837
927
  if (icon && icon.type) {
838
928
  if (icon.type === 'icon') {
839
- const iconClassName = icon.className;
840
- const html = icon.html;
929
+ var iconClassName = icon.className;
930
+ var html = icon.html;
841
931
  if (iconClassName || html) {
842
- return (geoJsonPoint, latlng) => {
843
- const divIcon = this._createDivIcon(icon);
932
+ return function (geoJsonPoint, latlng) {
933
+ var divIcon = _this._createDivIcon(icon);
844
934
  return new Marker(latlng, { icon: divIcon });
845
935
  };
846
936
  }
847
937
  }
848
938
  else if (icon.type === 'pin') {
849
- return (geoJsonPoint, latlng) => {
939
+ return function (geoJsonPoint, latlng) {
850
940
  // const divIcon = this.createDivIcon(icon);
851
941
  return new Marker(latlng);
852
942
  };
853
943
  }
854
944
  }
855
- return (geoJsonPoint, latlng) => {
856
- const p = PAINT;
857
- return new CircleMarker(latlng, this._preparePaint({ ...p, ...icon }));
945
+ return function (geoJsonPoint, latlng) {
946
+ var p = PAINT;
947
+ return new CircleMarker(latlng, _this._preparePaint(__assign(__assign({}, p), icon)));
858
948
  };
859
- }
860
- _createPaintOptions(paintOptions, type) {
861
- const geoJsonOptions = {};
862
- const paint = (paintOptions && this._preparePaint(paintOptions)) || {};
949
+ };
950
+ GeoJsonAdapter.prototype._createPaintOptions = function (paintOptions, type) {
951
+ var geoJsonOptions = {};
952
+ var paint = (paintOptions && this._preparePaint(paintOptions)) || {};
863
953
  if (paintOptions) {
864
- geoJsonOptions.style = () => {
954
+ geoJsonOptions.style = function () {
865
955
  return paint;
866
956
  };
867
957
  }
@@ -872,12 +962,12 @@ class GeoJsonAdapter extends BaseAdapter {
872
962
  paint.stroke = true;
873
963
  }
874
964
  return geoJsonOptions;
875
- }
876
- _addMapListener() {
877
- const map = this.map;
965
+ };
966
+ GeoJsonAdapter.prototype._addMapListener = function () {
967
+ var map = this.map;
878
968
  if (map) {
879
- const { labelField, labelOnHover, unselectOnClick } = this.options;
880
- const uoc = unselectOnClick !== null && unselectOnClick !== void 0 ? unselectOnClick : true;
969
+ var _a = this.options, labelField = _a.labelField, labelOnHover = _a.labelOnHover, unselectOnClick = _a.unselectOnClick;
970
+ var uoc = unselectOnClick !== null && unselectOnClick !== void 0 ? unselectOnClick : true;
881
971
  if (uoc) {
882
972
  map.on('click', this.$unselect);
883
973
  }
@@ -886,62 +976,66 @@ class GeoJsonAdapter extends BaseAdapter {
886
976
  map.on('moveend', this.$updateTooltip);
887
977
  }
888
978
  }
889
- }
890
- _removeMapListener() {
979
+ };
980
+ GeoJsonAdapter.prototype._removeMapListener = function () {
891
981
  this.map.off('zoomend', this.$updateTooltip);
892
982
  this.map.off('moveend', this.$updateTooltip);
893
983
  this.map.off('click', this.$unselect);
894
- }
895
- }
984
+ };
985
+ return GeoJsonAdapter;
986
+ }(BaseAdapter));
896
987
 
897
988
  function callAjax(src, callback, headers) {
898
- const xhr = new XMLHttpRequest();
989
+ var xhr = new XMLHttpRequest();
899
990
  xhr.open('GET', src);
900
991
  xhr.responseType = 'arraybuffer';
901
- for (const h in headers) {
992
+ for (var h in headers) {
902
993
  xhr.setRequestHeader(h, headers[h]);
903
994
  }
904
995
  xhr.onload = function () {
905
- const arrayBufferView = new Uint8Array(this.response);
906
- const blob = new Blob([arrayBufferView], { type: 'image/png' });
996
+ var arrayBufferView = new Uint8Array(this.response);
997
+ var blob = new Blob([arrayBufferView], { type: 'image/png' });
907
998
  // @ts-ignore for typedoc
908
- const urlCreator = window.URL || window.webkitURL;
909
- const imageUrl = urlCreator.createObjectURL(blob);
999
+ var urlCreator = window.URL || window.webkitURL;
1000
+ var imageUrl = urlCreator.createObjectURL(blob);
910
1001
  callback(imageUrl);
911
1002
  };
912
1003
  xhr.send();
913
- return () => {
1004
+ return function () {
914
1005
  xhr.abort();
915
1006
  };
916
1007
  }
917
1008
 
918
- class ImageOverlay extends ImageOverlay$1 {
919
- constructor(imageUrl, bounds, options) {
920
- super(imageUrl, bounds, options);
921
- this._abort = [];
922
- }
923
- cancelLoad() {
1009
+ var ImageOverlay = /** @class */ (function (_super) {
1010
+ __extends(ImageOverlay, _super);
1011
+ function ImageOverlay(imageUrl, bounds, options) {
1012
+ var _this = _super.call(this, imageUrl, bounds, options) || this;
1013
+ _this._abort = [];
1014
+ return _this;
1015
+ }
1016
+ ImageOverlay.prototype.cancelLoad = function () {
924
1017
  if (this._abort) {
925
- this._abort.forEach((x) => x());
1018
+ this._abort.forEach(function (x) { return x(); });
926
1019
  this._abort = [];
927
1020
  }
928
- }
929
- _initImage() {
1021
+ };
1022
+ ImageOverlay.prototype._initImage = function () {
930
1023
  // @ts-ignore
931
- super._initImage();
1024
+ _super.prototype._initImage.call(this);
932
1025
  // @ts-ignore
933
- const headers = this.options.headers;
1026
+ var headers = this.options.headers;
934
1027
  if (headers) {
935
1028
  // @ts-ignore
936
- const img = this._image;
937
- const src = img.src;
938
- img.src = '';
939
- this._abort.push(callAjax(src, (response) => {
940
- img.src = response;
1029
+ var img_1 = this._image;
1030
+ var src = img_1.src;
1031
+ img_1.src = '';
1032
+ this._abort.push(callAjax(src, function (response) {
1033
+ img_1.src = response;
941
1034
  }, headers));
942
1035
  }
943
- }
944
- }
1036
+ };
1037
+ return ImageOverlay;
1038
+ }(ImageOverlay$1));
945
1039
 
946
1040
  /*!
947
1041
  * leaflet.wms.js
@@ -955,10 +1049,11 @@ class ImageOverlay extends ImageOverlay$1 {
955
1049
  * Portions of wms.Overlay are directly extracted from L.TileLayer.WMS.
956
1050
  * See Leaflet license.
957
1051
  */
958
- class ImageLayer extends Layer {
959
- constructor(url, options) {
960
- super(options);
961
- this.defaultWmsParams = {
1052
+ var ImageLayer = /** @class */ (function (_super) {
1053
+ __extends(ImageLayer, _super);
1054
+ function ImageLayer(url, options) {
1055
+ var _this = _super.call(this, options) || this;
1056
+ _this.defaultWmsParams = {
962
1057
  service: 'WMS',
963
1058
  request: 'GetMap',
964
1059
  version: '1.1.1',
@@ -967,7 +1062,7 @@ class ImageLayer extends Layer {
967
1062
  format: 'image/jpeg',
968
1063
  transparent: false,
969
1064
  };
970
- this.options = {
1065
+ _this.options = {
971
1066
  crs: null,
972
1067
  uppercase: false,
973
1068
  attribution: '',
@@ -980,34 +1075,35 @@ class ImageLayer extends Layer {
980
1075
  viewPortBuffer: 0,
981
1076
  setViewDelay: 100,
982
1077
  };
983
- this._url = url;
1078
+ _this._url = url;
984
1079
  // Move WMS parameters to params object
985
- const params = {};
986
- const opts = {};
987
- let opt;
1080
+ var params = {};
1081
+ var opts = {};
1082
+ var opt;
988
1083
  for (opt in options) {
989
- if (opt in this.options) {
1084
+ if (opt in _this.options) {
990
1085
  opts[opt] = options[opt];
991
1086
  }
992
1087
  else {
993
1088
  params[opt] = options[opt];
994
1089
  }
995
1090
  }
996
- Util.setOptions(this, opts);
997
- this.wmsParams = Util.extend({}, this.defaultWmsParams, params);
1091
+ Util.setOptions(_this, opts);
1092
+ _this.wmsParams = Util.extend({}, _this.defaultWmsParams, params);
1093
+ return _this;
998
1094
  }
999
- setParams(params) {
1095
+ ImageLayer.prototype.setParams = function (params) {
1000
1096
  Util.extend(this.wmsParams, params);
1001
1097
  this.update();
1002
- }
1003
- getAttribution() {
1098
+ };
1099
+ ImageLayer.prototype.getAttribution = function () {
1004
1100
  return this.options.attribution || '';
1005
- }
1006
- onAdd() {
1101
+ };
1102
+ ImageLayer.prototype.onAdd = function () {
1007
1103
  this.update();
1008
1104
  return this;
1009
- }
1010
- onRemove(map) {
1105
+ };
1106
+ ImageLayer.prototype.onRemove = function (map) {
1011
1107
  if (this._currentOverlay) {
1012
1108
  this._currentOverlay.cancelLoad();
1013
1109
  map.removeLayer(this._currentOverlay);
@@ -1017,28 +1113,29 @@ class ImageLayer extends Layer {
1017
1113
  delete this._currentUrl;
1018
1114
  }
1019
1115
  return this;
1020
- }
1021
- getEvents() {
1116
+ };
1117
+ ImageLayer.prototype.getEvents = function () {
1022
1118
  return {
1023
1119
  moveend: debounce$1(this.update, this.options.setViewDelay),
1024
1120
  };
1025
- }
1026
- update() {
1121
+ };
1122
+ ImageLayer.prototype.update = function () {
1123
+ var _this = this;
1027
1124
  if (!this._map) {
1028
1125
  return;
1029
1126
  }
1030
1127
  // Determine image URL and whether it has changed since last update
1031
1128
  this.updateWmsParams();
1032
- const url = this.getImageUrl();
1129
+ var url = this.getImageUrl();
1033
1130
  if (this._currentUrl === url) {
1034
1131
  return;
1035
1132
  }
1036
1133
  this._currentUrl = url;
1037
1134
  // Keep current image overlay in place until new one loads
1038
1135
  // (inspired by esri.leaflet)
1039
- const viewPortBuffer = this.options.viewPortBuffer || 0;
1040
- const bounds = this._map.getBounds().pad(viewPortBuffer);
1041
- const overlay = new ImageOverlay(url, bounds, {
1136
+ var viewPortBuffer = this.options.viewPortBuffer || 0;
1137
+ var bounds = this._map.getBounds().pad(viewPortBuffer);
1138
+ var overlay = new ImageOverlay(url, bounds, {
1042
1139
  opacity: 0,
1043
1140
  pane: this.options.pane,
1044
1141
  headers: this.options.headers,
@@ -1047,82 +1144,82 @@ class ImageLayer extends Layer {
1047
1144
  if (this._currentOverlay) {
1048
1145
  this._currentOverlay.cancelLoad();
1049
1146
  }
1050
- overlay.once('load', () => {
1051
- if (!this._map) {
1147
+ overlay.once('load', function () {
1148
+ if (!_this._map) {
1052
1149
  return;
1053
1150
  }
1054
1151
  // @ts-ignore
1055
- if (overlay._url !== this._currentUrl) {
1056
- this._map.removeLayer(overlay);
1152
+ if (overlay._url !== _this._currentUrl) {
1153
+ _this._map.removeLayer(overlay);
1057
1154
  return;
1058
1155
  }
1059
- else if (this._currentOverlay) {
1060
- this._map.removeLayer(this._currentOverlay);
1156
+ else if (_this._currentOverlay) {
1157
+ _this._map.removeLayer(_this._currentOverlay);
1061
1158
  }
1062
- this._currentOverlay = overlay;
1063
- overlay.setOpacity(this.options.opacity !== undefined ? this.options.opacity : 1);
1064
- if (this.options.isBack === true) {
1159
+ _this._currentOverlay = overlay;
1160
+ overlay.setOpacity(_this.options.opacity !== undefined ? _this.options.opacity : 1);
1161
+ if (_this.options.isBack === true) {
1065
1162
  overlay.bringToBack();
1066
1163
  }
1067
- if (this.options.isBack === false) {
1164
+ if (_this.options.isBack === false) {
1068
1165
  overlay.bringToFront();
1069
1166
  }
1070
- if (this.options.zIndex !== undefined) {
1071
- overlay.setZIndex(this.options.zIndex);
1167
+ if (_this.options.zIndex !== undefined) {
1168
+ overlay.setZIndex(_this.options.zIndex);
1072
1169
  }
1073
1170
  }, this);
1074
- const { minZoom, maxZoom } = this.options;
1171
+ var _a = this.options, minZoom = _a.minZoom, maxZoom = _a.maxZoom;
1075
1172
  if ((minZoom && this._map.getZoom() < minZoom) ||
1076
1173
  (maxZoom && this._map.getZoom() > maxZoom)) {
1077
1174
  this._map.removeLayer(overlay);
1078
1175
  }
1079
- }
1080
- setOpacity(opacity) {
1176
+ };
1177
+ ImageLayer.prototype.setOpacity = function (opacity) {
1081
1178
  this.options.opacity = opacity;
1082
1179
  if (this._currentOverlay) {
1083
1180
  this._currentOverlay.setOpacity(opacity);
1084
1181
  }
1085
- }
1086
- bringToBack() {
1182
+ };
1183
+ ImageLayer.prototype.bringToBack = function () {
1087
1184
  this.options.isBack = true;
1088
1185
  if (this._currentOverlay) {
1089
1186
  this._currentOverlay.bringToBack();
1090
1187
  }
1091
- }
1092
- bringToFront() {
1188
+ };
1189
+ ImageLayer.prototype.bringToFront = function () {
1093
1190
  this.options.isBack = false;
1094
1191
  if (this._currentOverlay) {
1095
1192
  this._currentOverlay.bringToFront();
1096
1193
  }
1097
- }
1098
- setZIndex(zIndex) {
1194
+ };
1195
+ ImageLayer.prototype.setZIndex = function (zIndex) {
1099
1196
  this.options.zIndex = zIndex;
1100
1197
  if (this._currentOverlay) {
1101
1198
  this._currentOverlay.setZIndex(zIndex);
1102
1199
  }
1103
- }
1200
+ };
1104
1201
  // See L.TileLayer.WMS: onAdd() & getTileUrl()
1105
- updateWmsParams(map) {
1202
+ ImageLayer.prototype.updateWmsParams = function (map) {
1106
1203
  if (!map) {
1107
1204
  map = this._map;
1108
1205
  }
1109
1206
  // Compute WMS options
1110
- const viewPortBuffer = this.options.viewPortBuffer || 0;
1111
- const bounds = map.getBounds().pad(viewPortBuffer);
1112
- const size = map.getSize();
1207
+ var viewPortBuffer = this.options.viewPortBuffer || 0;
1208
+ var bounds = map.getBounds().pad(viewPortBuffer);
1209
+ var size = map.getSize();
1113
1210
  if (this.options.viewPortBuffer !== 0) {
1114
- const factor = viewPortBuffer + 1;
1211
+ var factor = viewPortBuffer + 1;
1115
1212
  size.x = Math.ceil(size.x * factor);
1116
1213
  size.y = Math.ceil(size.y * factor);
1117
1214
  }
1118
- const wmsVersion = parseFloat(this.wmsParams.version);
1119
- const crs = this.options.crs || map.options.crs;
1120
- const projectionKey = wmsVersion >= 1.3 ? 'crs' : 'srs';
1215
+ var wmsVersion = parseFloat(this.wmsParams.version);
1216
+ var crs = this.options.crs || map.options.crs;
1217
+ var projectionKey = wmsVersion >= 1.3 ? 'crs' : 'srs';
1121
1218
  if (crs) {
1122
- const nw = crs.project(bounds.getNorthWest());
1123
- const se = crs.project(bounds.getSouthEast());
1219
+ var nw = crs.project(bounds.getNorthWest());
1220
+ var se = crs.project(bounds.getSouthEast());
1124
1221
  // Assemble WMS parameter string
1125
- const params = {
1222
+ var params = {
1126
1223
  width: size.x,
1127
1224
  height: size.y,
1128
1225
  };
@@ -1132,51 +1229,53 @@ class ImageLayer extends Layer {
1132
1229
  : [nw.x, se.y, se.x, nw.y]).join(',');
1133
1230
  Util.extend(this.wmsParams, params);
1134
1231
  }
1135
- }
1136
- getImageUrl() {
1137
- const uppercase = this.options.uppercase || false;
1138
- const pstr = Util.getParamString(this.wmsParams, this._url, uppercase);
1232
+ };
1233
+ ImageLayer.prototype.getImageUrl = function () {
1234
+ var uppercase = this.options.uppercase || false;
1235
+ var pstr = Util.getParamString(this.wmsParams, this._url, uppercase);
1139
1236
  return this._url + pstr;
1140
- }
1141
- }
1237
+ };
1238
+ return ImageLayer;
1239
+ }(Layer));
1142
1240
 
1143
- class ImageAdapter extends BaseAdapter {
1144
- addLayer(options) {
1145
- const url = options && options.url;
1241
+ var ImageAdapter = /** @class */ (function (_super) {
1242
+ __extends(ImageAdapter, _super);
1243
+ function ImageAdapter() {
1244
+ return _super !== null && _super.apply(this, arguments) || this;
1245
+ }
1246
+ ImageAdapter.prototype.addLayer = function (options) {
1247
+ var url = options && options.url;
1146
1248
  if (url) {
1147
- options = { transparent: true, ...options };
1148
- const updateWmsParamsFromOpt = options.updateWmsParams;
1149
- this.layer = new ImageLayer(url, {
1150
- pane: this.pane,
1151
- headers: options.headers,
1152
- setViewDelay: options.setViewDelay,
1153
- /**
1154
- * TODO: safe remove, use only options.nativeOptions
1155
- */
1156
- ...options,
1157
- ...options.params,
1158
- ...options.nativeOptions,
1159
- });
1160
- if (updateWmsParamsFromOpt) {
1161
- const updateWmsParams = this.layer.updateWmsParams;
1249
+ options = __assign({ transparent: true }, options);
1250
+ var updateWmsParamsFromOpt_1 = options.updateWmsParams;
1251
+ this.layer = new ImageLayer(url, __assign(__assign(__assign({ pane: this.pane, headers: options.headers, setViewDelay: options.setViewDelay }, options), options.params), options.nativeOptions));
1252
+ if (updateWmsParamsFromOpt_1) {
1253
+ var updateWmsParams_1 = this.layer.updateWmsParams;
1162
1254
  this.layer.updateWmsParams = function (map) {
1163
- updateWmsParams.call(this, map);
1164
- this.wmsParams = updateWmsParamsFromOpt(this.wmsParams);
1255
+ updateWmsParams_1.call(this, map);
1256
+ this.wmsParams = updateWmsParamsFromOpt_1(this.wmsParams);
1165
1257
  };
1166
1258
  }
1167
1259
  return this.layer;
1168
1260
  }
1169
- }
1170
- }
1261
+ };
1262
+ return ImageAdapter;
1263
+ }(BaseAdapter));
1171
1264
 
1172
1265
  // based on https://github.com/bvaughn/debounce-decorator
1173
- function debounce(cb, wait = 10) {
1174
- let timeoutId;
1175
- function wrapper(...args) {
1266
+ function debounce(cb, wait) {
1267
+ if (wait === void 0) { wait = 10; }
1268
+ var timeoutId;
1269
+ function wrapper() {
1270
+ var _this = this;
1271
+ var args = [];
1272
+ for (var _i = 0; _i < arguments.length; _i++) {
1273
+ args[_i] = arguments[_i];
1274
+ }
1176
1275
  wrapper.clear();
1177
- timeoutId = setTimeout(() => {
1276
+ timeoutId = setTimeout(function () {
1178
1277
  timeoutId = null;
1179
- cb.apply(this, args);
1278
+ cb.apply(_this, args);
1180
1279
  }, wait);
1181
1280
  }
1182
1281
  wrapper.clear = function () {
@@ -1189,22 +1288,33 @@ function debounce(cb, wait = 10) {
1189
1288
  }
1190
1289
 
1191
1290
  function makeRemote(Base) {
1192
- return class RemoteTileLayer extends Base {
1193
- constructor(...args) {
1194
- super(...args);
1195
- if (this.options.setViewDelay) {
1291
+ return /** @class */ (function (_super) {
1292
+ __extends(RemoteTileLayer, _super);
1293
+ function RemoteTileLayer() {
1294
+ var args = [];
1295
+ for (var _i = 0; _i < arguments.length; _i++) {
1296
+ args[_i] = arguments[_i];
1297
+ }
1298
+ var _this = _super.apply(this, args) || this;
1299
+ if (_this.options.setViewDelay) {
1196
1300
  // @ts-ignore
1197
- this._update = debounce((...a) => {
1301
+ _this._update = debounce(function () {
1302
+ var _a;
1303
+ var a = [];
1304
+ for (var _i = 0; _i < arguments.length; _i++) {
1305
+ a[_i] = arguments[_i];
1306
+ }
1198
1307
  // @ts-ignore
1199
- GridLayer.prototype._update.call(this, ...a);
1200
- }, this.options.setViewDelay);
1308
+ (_a = GridLayer.prototype._update).call.apply(_a, __spreadArray([_this], a, false));
1309
+ }, _this.options.setViewDelay);
1201
1310
  }
1311
+ return _this;
1202
1312
  }
1203
- createTile(coords, done) {
1313
+ RemoteTileLayer.prototype.createTile = function (coords, done) {
1204
1314
  // @ts-ignore
1205
- const url = this.getTileUrl(coords);
1206
- const tile = document.createElement('img');
1207
- tile.abort = callAjax(url, (response) => {
1315
+ var url = this.getTileUrl(coords);
1316
+ var tile = document.createElement('img');
1317
+ tile.abort = callAjax(url, function (response) {
1208
1318
  tile.src = response;
1209
1319
  done(null, tile);
1210
1320
  },
@@ -1217,15 +1327,15 @@ function makeRemote(Base) {
1217
1327
  tile.alt = '';
1218
1328
  tile.setAttribute('role', 'presentation');
1219
1329
  return tile;
1220
- }
1221
- _abortLoading() {
1330
+ };
1331
+ RemoteTileLayer.prototype._abortLoading = function () {
1222
1332
  // @ts-ignore
1223
- const tiles = this._tiles;
1333
+ var tiles = this._tiles;
1224
1334
  // @ts-ignore
1225
- const tileZoom = this._tileZoom;
1226
- for (const i in tiles) {
1335
+ var tileZoom = this._tileZoom;
1336
+ for (var i in tiles) {
1227
1337
  if (tiles[i].coords.z !== tileZoom) {
1228
- const tile = tiles[i].el;
1338
+ var tile = tiles[i].el;
1229
1339
  tile.onload = Util.falseFn;
1230
1340
  tile.onerror = Util.falseFn;
1231
1341
  if (!tile.complete) {
@@ -1238,41 +1348,39 @@ function makeRemote(Base) {
1238
1348
  }
1239
1349
  }
1240
1350
  }
1241
- }
1242
- };
1351
+ };
1352
+ return RemoteTileLayer;
1353
+ }(Base));
1243
1354
  }
1244
1355
 
1245
- class TileLayerBase extends TileLayer$1 {
1246
- constructor(urlTemplate, options) {
1247
- super(urlTemplate, options);
1248
- Object.assign(this.options, options);
1249
- }
1250
- }
1251
- const TileLayer = makeRemote(TileLayerBase);
1356
+ var TileLayerBase = /** @class */ (function (_super) {
1357
+ __extends(TileLayerBase, _super);
1358
+ function TileLayerBase(urlTemplate, options) {
1359
+ var _this = _super.call(this, urlTemplate, options) || this;
1360
+ Object.assign(_this.options, options);
1361
+ return _this;
1362
+ }
1363
+ return TileLayerBase;
1364
+ }(TileLayer$1));
1365
+ var TileLayer = makeRemote(TileLayerBase);
1252
1366
 
1253
- class TileAdapter extends BaseAdapter {
1254
- addLayer(options) {
1367
+ var TileAdapter = /** @class */ (function (_super) {
1368
+ __extends(TileAdapter, _super);
1369
+ function TileAdapter() {
1370
+ return _super !== null && _super.apply(this, arguments) || this;
1371
+ }
1372
+ TileAdapter.prototype.addLayer = function (options) {
1255
1373
  this.options = Object.assign(this.options, options);
1256
1374
  if (options) {
1257
- const { url, ...opt } = options;
1375
+ var url = options.url, opt = __rest(options, ["url"]);
1258
1376
  if (url) {
1259
- const tileLayerOptions = {
1260
- pane: this.pane,
1261
- attribution: opt.attribution,
1262
- minZoom: opt.minZoom,
1263
- maxZoom: opt.maxZoom,
1264
- ...opt.nativeOptions,
1265
- };
1377
+ var tileLayerOptions = __assign({ pane: this.pane, attribution: opt.attribution, minZoom: opt.minZoom, maxZoom: opt.maxZoom }, opt.nativeOptions);
1266
1378
  if (opt.subdomains) {
1267
1379
  tileLayerOptions.subdomains = opt.subdomains;
1268
1380
  }
1269
- let layer;
1381
+ var layer = void 0;
1270
1382
  if (opt.headers) {
1271
- layer = new TileLayer(url, {
1272
- ...tileLayerOptions,
1273
- headers: opt.headers,
1274
- setViewDelay: opt.setViewDelay,
1275
- });
1383
+ layer = new TileLayer(url, __assign(__assign({}, tileLayerOptions), { headers: opt.headers, setViewDelay: opt.setViewDelay }));
1276
1384
  }
1277
1385
  else {
1278
1386
  layer = new TileLayer$1(url, tileLayerOptions);
@@ -1280,57 +1388,57 @@ class TileAdapter extends BaseAdapter {
1280
1388
  return layer;
1281
1389
  }
1282
1390
  }
1283
- }
1284
- }
1391
+ };
1392
+ return TileAdapter;
1393
+ }(BaseAdapter));
1285
1394
 
1286
- class WmsLayerBase extends TileLayer$1.WMS {
1287
- constructor(urlTemplate, options) {
1288
- super(urlTemplate, options);
1289
- }
1290
- }
1291
- const WmsLayer = makeRemote(WmsLayerBase);
1395
+ var WmsLayerBase = /** @class */ (function (_super) {
1396
+ __extends(WmsLayerBase, _super);
1397
+ function WmsLayerBase(urlTemplate, options) {
1398
+ return _super.call(this, urlTemplate, options) || this;
1399
+ }
1400
+ return WmsLayerBase;
1401
+ }(TileLayer$1.WMS));
1402
+ var WmsLayer = makeRemote(WmsLayerBase);
1292
1403
  // applyMixins(WmsLayer, [RemoteTileLayer]);
1293
1404
 
1294
- class WmsAdapter extends BaseAdapter {
1295
- addLayer(options) {
1405
+ var WmsAdapter = /** @class */ (function (_super) {
1406
+ __extends(WmsAdapter, _super);
1407
+ function WmsAdapter() {
1408
+ return _super !== null && _super.apply(this, arguments) || this;
1409
+ }
1410
+ WmsAdapter.prototype.addLayer = function (options) {
1296
1411
  Object.assign(this.options, options);
1297
- const { url, ...opt } = options;
1412
+ var url = options.url, opt = __rest(options, ["url"]);
1298
1413
  if (url) {
1299
- const layerOptions = {
1300
- pane: this.pane,
1301
- attribution: opt.attribution,
1302
- minZoom: opt.minZoom,
1303
- maxZoom: opt.maxZoom,
1304
- layers: options.layers,
1305
- format: options.format,
1306
- ...options.nativeOptions,
1307
- };
1308
- let layer;
1414
+ var layerOptions = __assign({ pane: this.pane, attribution: opt.attribution, minZoom: opt.minZoom, maxZoom: opt.maxZoom, layers: options.layers, format: options.format }, options.nativeOptions);
1415
+ var layer = void 0;
1309
1416
  if (opt.headers) {
1310
- layer = new WmsLayer(url, { ...layerOptions, headers: opt.headers });
1417
+ layer = new WmsLayer(url, __assign(__assign({}, layerOptions), { headers: opt.headers }));
1311
1418
  }
1312
1419
  else {
1313
1420
  layer = new TileLayer$1.WMS(url, layerOptions);
1314
1421
  }
1315
1422
  return layer;
1316
1423
  }
1317
- }
1318
- }
1424
+ };
1425
+ return WmsAdapter;
1426
+ }(BaseAdapter));
1319
1427
 
1320
- class OsmAdapter extends TileAdapter {
1321
- addLayer(options) {
1322
- const url = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
1323
- return super.addLayer({
1324
- name: 'OpenStreetMap',
1325
- attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
1326
- ...options,
1327
- url,
1328
- });
1329
- }
1330
- }
1428
+ var OsmAdapter = /** @class */ (function (_super) {
1429
+ __extends(OsmAdapter, _super);
1430
+ function OsmAdapter() {
1431
+ return _super !== null && _super.apply(this, arguments) || this;
1432
+ }
1433
+ OsmAdapter.prototype.addLayer = function (options) {
1434
+ var url = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
1435
+ return _super.prototype.addLayer.call(this, __assign(__assign({ name: 'OpenStreetMap', attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' }, options), { url: url }));
1436
+ };
1437
+ return OsmAdapter;
1438
+ }(TileAdapter));
1331
1439
 
1332
1440
  function arrayToBoundsExpression(bounds) {
1333
- const e = bounds;
1441
+ var e = bounds;
1334
1442
  // top, left, bottom, right
1335
1443
  return [
1336
1444
  [e[3], e[0]],
@@ -1338,74 +1446,71 @@ function arrayToBoundsExpression(bounds) {
1338
1446
  ];
1339
1447
  }
1340
1448
 
1341
- class LeafletMapAdapter$1 {
1342
- constructor() {
1449
+ var LeafletMapAdapter$1 = /** @class */ (function () {
1450
+ function LeafletMapAdapter() {
1343
1451
  this.options = { target: 'map' };
1344
- this.layerAdapters = LeafletMapAdapter$1.layerAdapters;
1345
- this.controlAdapters = LeafletMapAdapter$1.controlAdapters;
1452
+ this.layerAdapters = LeafletMapAdapter.layerAdapters;
1453
+ this.controlAdapters = LeafletMapAdapter.controlAdapters;
1346
1454
  this.emitter = new EventEmitter();
1347
1455
  this._unselectCb = [];
1348
1456
  this._universalEvents = [
1349
1457
  'move',
1350
1458
  'zoom',
1351
- 'moveend',
1352
1459
  'zoomend',
1353
1460
  'zoomstart',
1461
+ 'moveend',
1354
1462
  'movestart',
1355
1463
  ];
1464
+ this._positionEvents = [
1465
+ 'mousemove',
1466
+ 'mouseout',
1467
+ 'mouseover',
1468
+ ];
1356
1469
  }
1357
- create(options) {
1358
- this.options = { ...options };
1470
+ LeafletMapAdapter.prototype.create = function (options) {
1471
+ var _this = this;
1472
+ this.options = __assign({}, options);
1359
1473
  if (this.options.target) {
1360
- const { zoom, center, maxZoom, minZoom, maxBounds: mb, mapAdapterOptions, } = this.options;
1361
- this.map = new Map(this.options.target, {
1362
- attributionControl: false,
1363
- zoomControl: false,
1364
- maxBounds: mb ? arrayToBoundsExpression(mb) : undefined,
1365
- maxZoom,
1366
- minZoom,
1367
- center: center && [center[1], center[0]],
1368
- zoom,
1369
- ...mapAdapterOptions,
1370
- });
1474
+ var _a = this.options, zoom = _a.zoom, center = _a.center, maxZoom = _a.maxZoom, minZoom = _a.minZoom, mb = _a.maxBounds, mapAdapterOptions = _a.mapAdapterOptions;
1475
+ this.map = new Map(this.options.target, __assign({ attributionControl: false, zoomControl: false, maxBounds: mb ? arrayToBoundsExpression(mb) : undefined, maxZoom: maxZoom, minZoom: minZoom, center: center && [center[1], center[0]], zoom: zoom }, mapAdapterOptions));
1371
1476
  // create default pane
1372
- const defPane = this.map.createPane('order-0');
1373
- this.map._addUnselectCb = (def) => {
1374
- this._addUnselectCb(def);
1477
+ var defPane = this.map.createPane('order-0');
1478
+ this.map._addUnselectCb = function (def) {
1479
+ _this._addUnselectCb(def);
1375
1480
  };
1376
1481
  defPane.style.zIndex = String(0);
1377
1482
  this.emitter.emit('create', this);
1378
1483
  this._addMapListeners();
1379
1484
  }
1380
- }
1381
- destroy() {
1485
+ };
1486
+ LeafletMapAdapter.prototype.destroy = function () {
1382
1487
  if (this.map) {
1383
1488
  this.map.remove();
1384
1489
  }
1385
1490
  this._stopWatchSizeChangeToUpdateMinZoom();
1386
- }
1387
- getContainer() {
1491
+ };
1492
+ LeafletMapAdapter.prototype.getContainer = function () {
1388
1493
  return this.map && this.map.getContainer();
1389
- }
1390
- getControlContainer() {
1391
- const controlContainer = this.map && this.map._controlContainer;
1494
+ };
1495
+ LeafletMapAdapter.prototype.getControlContainer = function () {
1496
+ var controlContainer = this.map && this.map._controlContainer;
1392
1497
  if (controlContainer) {
1393
1498
  return controlContainer;
1394
1499
  }
1395
1500
  throw new Error('Leaflet Map is not initialized yet');
1396
- }
1397
- setCursor(cursor) {
1501
+ };
1502
+ LeafletMapAdapter.prototype.setCursor = function (cursor) {
1398
1503
  if (this.map) {
1399
1504
  this.map.getContainer().style.cursor = cursor;
1400
1505
  }
1401
- }
1402
- setView(lngLatOrOpt, zoom) {
1403
- const map = this.map;
1506
+ };
1507
+ LeafletMapAdapter.prototype.setView = function (lngLatOrOpt, zoom) {
1508
+ var map = this.map;
1404
1509
  if (!map)
1405
1510
  return;
1406
1511
  if (Array.isArray(lngLatOrOpt)) {
1407
- const lngLat = lngLatOrOpt;
1408
- const [lng, lat] = lngLat;
1512
+ var lngLat = lngLatOrOpt;
1513
+ var lng = lngLat[0], lat = lngLat[1];
1409
1514
  if (this.map) {
1410
1515
  if (typeof zoom === 'number') {
1411
1516
  this.map.setView([lat, lng], zoom, { animate: false });
@@ -1416,13 +1521,13 @@ class LeafletMapAdapter$1 {
1416
1521
  }
1417
1522
  }
1418
1523
  else {
1419
- const { zoom, center, maxBounds, bounds, minZoom, maxZoom } = lngLatOrOpt;
1420
- if (center && zoom !== undefined) {
1421
- this.setView(center, zoom);
1524
+ var zoom_1 = lngLatOrOpt.zoom, center = lngLatOrOpt.center, maxBounds = lngLatOrOpt.maxBounds, bounds = lngLatOrOpt.bounds, minZoom = lngLatOrOpt.minZoom, maxZoom = lngLatOrOpt.maxZoom;
1525
+ if (center && zoom_1 !== undefined) {
1526
+ this.setView(center, zoom_1);
1422
1527
  }
1423
1528
  else {
1424
- if (zoom !== undefined) {
1425
- this.setZoom(zoom);
1529
+ if (zoom_1 !== undefined) {
1530
+ this.setZoom(zoom_1);
1426
1531
  }
1427
1532
  if (center) {
1428
1533
  this.setCenter(center);
@@ -1433,7 +1538,7 @@ class LeafletMapAdapter$1 {
1433
1538
  }
1434
1539
  if (maxBounds !== undefined) {
1435
1540
  if (maxBounds) {
1436
- const b = arrayToBoundsExpression(maxBounds);
1541
+ var b = arrayToBoundsExpression(maxBounds);
1437
1542
  map.setMaxBounds(b);
1438
1543
  map.setMinZoom(map.getBoundsZoom(b));
1439
1544
  this._watchSizeChangeToUpdateMinZoom(b);
@@ -1452,42 +1557,43 @@ class LeafletMapAdapter$1 {
1452
1557
  map.setMinZoom(minZoom);
1453
1558
  }
1454
1559
  }
1455
- }
1456
- setCenter(lngLat) {
1457
- const [lng, lat] = lngLat;
1560
+ };
1561
+ LeafletMapAdapter.prototype.setCenter = function (lngLat) {
1562
+ var lng = lngLat[0], lat = lngLat[1];
1458
1563
  if (this.map) {
1459
1564
  this.map.panTo([lat, lng]);
1460
1565
  }
1461
- }
1462
- getCenter() {
1463
- const map = this.map;
1566
+ };
1567
+ LeafletMapAdapter.prototype.getCenter = function () {
1568
+ var map = this.map;
1464
1569
  if (map) {
1465
- const bounds = map.getBounds();
1466
- const center = bounds.getCenter();
1570
+ var bounds = map.getBounds();
1571
+ var center = bounds.getCenter();
1467
1572
  return [center.lng, center.lat];
1468
1573
  }
1469
- }
1470
- setZoom(zoom) {
1574
+ };
1575
+ LeafletMapAdapter.prototype.setZoom = function (zoom) {
1471
1576
  if (this.map) {
1472
1577
  this.map.setZoom(zoom);
1473
1578
  }
1474
- }
1475
- getZoom() {
1579
+ };
1580
+ LeafletMapAdapter.prototype.getZoom = function () {
1476
1581
  return (this.map && this.map.getZoom()) || undefined;
1477
- }
1478
- getBounds() {
1582
+ };
1583
+ LeafletMapAdapter.prototype.getBounds = function () {
1479
1584
  if (!this.map)
1480
1585
  return undefined;
1481
- const b = this.map.getBounds();
1482
- const sw = b.getSouthWest();
1483
- const ne = b.getNorthEast();
1586
+ var b = this.map.getBounds();
1587
+ var sw = b.getSouthWest();
1588
+ var ne = b.getNorthEast();
1484
1589
  return [sw.lng, sw.lat, ne.lng, ne.lat];
1485
- }
1590
+ };
1486
1591
  // [west, south, east, north]
1487
- fitBounds(bounds, options = {}) {
1592
+ LeafletMapAdapter.prototype.fitBounds = function (bounds, options) {
1593
+ if (options === void 0) { options = {}; }
1488
1594
  if (this.map) {
1489
- const { maxZoom, offset, padding } = options;
1490
- const opt = {};
1595
+ var maxZoom = options.maxZoom, offset = options.offset, padding = options.padding;
1596
+ var opt = {};
1491
1597
  if (maxZoom) {
1492
1598
  opt.maxZoom = maxZoom;
1493
1599
  }
@@ -1499,103 +1605,104 @@ class LeafletMapAdapter$1 {
1499
1605
  }
1500
1606
  this.map.fitBounds(arrayToBoundsExpression(bounds), opt);
1501
1607
  }
1502
- }
1503
- getLayerAdapter(name) {
1504
- return LeafletMapAdapter$1.layerAdapters[name];
1505
- }
1506
- createControl(control, options) {
1608
+ };
1609
+ LeafletMapAdapter.prototype.getLayerAdapter = function (name) {
1610
+ return LeafletMapAdapter.layerAdapters[name];
1611
+ };
1612
+ LeafletMapAdapter.prototype.createControl = function (control, options) {
1507
1613
  return createControl(control, options, this);
1508
- }
1509
- createButtonControl(options) {
1614
+ };
1615
+ LeafletMapAdapter.prototype.createButtonControl = function (options) {
1510
1616
  return createButtonControl(options, this);
1511
- }
1512
- addControl(control, position) {
1617
+ };
1618
+ LeafletMapAdapter.prototype.addControl = function (control, position) {
1513
1619
  control.options.position = position.replace('-', '');
1514
1620
  if (this.map) {
1515
1621
  this.map.addControl(control);
1516
1622
  return control;
1517
1623
  }
1518
- }
1519
- removeControl(control) {
1624
+ };
1625
+ LeafletMapAdapter.prototype.removeControl = function (control) {
1520
1626
  if (this.map) {
1521
1627
  this.map.removeControl(control);
1522
1628
  }
1523
- }
1524
- removeLayer(layer) {
1629
+ };
1630
+ LeafletMapAdapter.prototype.removeLayer = function (layer) {
1525
1631
  layer && layer.remove && layer.remove();
1526
- }
1527
- showLayer(layer) {
1632
+ };
1633
+ LeafletMapAdapter.prototype.showLayer = function (layer) {
1528
1634
  if (this.map) {
1529
1635
  layer.addTo(this.map);
1530
1636
  }
1531
- }
1532
- hideLayer(layer) {
1637
+ };
1638
+ LeafletMapAdapter.prototype.hideLayer = function (layer) {
1533
1639
  layer.remove();
1534
- }
1535
- setLayerOpacity(layer, value) {
1640
+ };
1641
+ LeafletMapAdapter.prototype.setLayerOpacity = function (layer, value) {
1536
1642
  if ('setOpacity' in layer) {
1537
1643
  layer.setOpacity(value);
1538
1644
  }
1539
- }
1540
- setLayerOrder(layer, order, layers) {
1645
+ };
1646
+ LeafletMapAdapter.prototype.setLayerOrder = function (layer, order, layers) {
1541
1647
  //
1542
- }
1543
- onMapClick(evt) {
1544
- const converted = convertMapClickEvent(evt);
1648
+ };
1649
+ LeafletMapAdapter.prototype.onMapClick = function (evt) {
1650
+ var converted = convertMapClickEvent(evt);
1545
1651
  this.emitter.emit('preclick', converted);
1546
1652
  this.emitter.emit('click', converted);
1547
- }
1548
- locate(opt, events) {
1549
- const map = this.map;
1653
+ };
1654
+ LeafletMapAdapter.prototype.locate = function (opt, events) {
1655
+ var map = this.map;
1550
1656
  if (map) {
1551
1657
  map.locate(opt);
1552
1658
  if (events) {
1553
- const { locationfound, locationerror } = events;
1554
- const locationFound = (e) => {
1555
- const event = e;
1556
- const lngLat = [event.latlng.lng, event.latlng.lat];
1557
- locationfound({ lngLat });
1659
+ var locationfound_1 = events.locationfound, locationerror_1 = events.locationerror;
1660
+ var locationFound_1 = function (e) {
1661
+ var event = e;
1662
+ var lngLat = [event.latlng.lng, event.latlng.lat];
1663
+ locationfound_1({ lngLat: lngLat });
1558
1664
  };
1559
- if (locationfound !== undefined) {
1560
- map.on('locationfound', locationFound, this);
1665
+ if (locationfound_1 !== undefined) {
1666
+ map.on('locationfound', locationFound_1, this);
1561
1667
  }
1562
- if (locationerror) {
1563
- map.on('locationerror', locationerror, this);
1668
+ if (locationerror_1) {
1669
+ map.on('locationerror', locationerror_1, this);
1564
1670
  }
1565
- const stop = () => {
1566
- if (locationfound !== undefined) {
1567
- map.off('locationfound', locationFound);
1671
+ var stop_1 = function () {
1672
+ if (locationfound_1 !== undefined) {
1673
+ map.off('locationfound', locationFound_1);
1568
1674
  }
1569
- if (locationerror) {
1570
- map.off('locationerror', locationerror);
1675
+ if (locationerror_1) {
1676
+ map.off('locationerror', locationerror_1);
1571
1677
  }
1572
1678
  };
1573
- return { stop };
1679
+ return { stop: stop_1 };
1574
1680
  }
1575
1681
  }
1576
- const stop = () => void 'fake function';
1577
- return { stop };
1578
- }
1579
- _addUnselectCb(cb) {
1580
- for (const p of this._unselectCb) {
1682
+ var stop = function () { return void 'fake function'; };
1683
+ return { stop: stop };
1684
+ };
1685
+ LeafletMapAdapter.prototype._addUnselectCb = function (cb) {
1686
+ for (var _i = 0, _a = this._unselectCb; _i < _a.length; _i++) {
1687
+ var p = _a[_i];
1581
1688
  p();
1582
1689
  }
1583
1690
  this._unselectCb.length = 0;
1584
1691
  this._unselectCb.push(cb);
1585
- }
1586
- _watchSizeChangeToUpdateMinZoom(bounds) {
1692
+ };
1693
+ LeafletMapAdapter.prototype._watchSizeChangeToUpdateMinZoom = function (bounds) {
1587
1694
  this._stopWatchSizeChangeToUpdateMinZoom();
1588
- const container = this.getContainer();
1589
- const map = this.map;
1695
+ var container = this.getContainer();
1696
+ var map = this.map;
1590
1697
  if (container && map && window.ResizeObserver) {
1591
- this._resizeObserver = new ResizeObserver(() => {
1698
+ this._resizeObserver = new ResizeObserver(function () {
1592
1699
  map.setMinZoom(map.getBoundsZoom(bounds));
1593
1700
  });
1594
1701
  this._resizeObserver.observe(container);
1595
1702
  }
1596
- }
1597
- _stopWatchSizeChangeToUpdateMinZoom() {
1598
- const map = this.map;
1703
+ };
1704
+ LeafletMapAdapter.prototype._stopWatchSizeChangeToUpdateMinZoom = function () {
1705
+ var map = this.map;
1599
1706
  if (map) {
1600
1707
  map.setMinZoom(0);
1601
1708
  }
@@ -1603,32 +1710,47 @@ class LeafletMapAdapter$1 {
1603
1710
  this._resizeObserver.disconnect();
1604
1711
  this._resizeObserver = undefined;
1605
1712
  }
1606
- }
1607
- _addMapListeners() {
1608
- const map = this.map;
1713
+ };
1714
+ LeafletMapAdapter.prototype._addMapListeners = function () {
1715
+ var _this = this;
1716
+ var map = this.map;
1609
1717
  if (map) {
1610
- map.on('click', (evt) => {
1611
- this.onMapClick(evt);
1612
- });
1613
- this._universalEvents.forEach((e) => {
1614
- map.on(e, () => this.emitter.emit(e, this), map);
1718
+ map.on('click', function (evt) {
1719
+ _this.onMapClick(evt);
1615
1720
  });
1721
+ var _loop_1 = function (e) {
1722
+ map.on(e, function () { return _this.emitter.emit(e, _this); }, map);
1723
+ };
1724
+ for (var _i = 0, _a = this._universalEvents; _i < _a.length; _i++) {
1725
+ var e = _a[_i];
1726
+ _loop_1(e);
1727
+ }
1728
+ var _loop_2 = function (e) {
1729
+ map.on(e, function (evt) {
1730
+ return _this.emitter.emit(e, convertMapClickEvent(evt));
1731
+ }, map);
1732
+ };
1733
+ for (var _b = 0, _c = this._positionEvents; _b < _c.length; _b++) {
1734
+ var e = _c[_b];
1735
+ _loop_2(e);
1736
+ }
1616
1737
  }
1617
- }
1618
- }
1619
- LeafletMapAdapter$1.layerAdapters = {
1620
- GEOJSON: GeoJsonAdapter,
1621
- IMAGE: ImageAdapter,
1622
- TILE: TileAdapter,
1623
- WMS: WmsAdapter,
1624
- // // MVT: MvtAdapter,
1625
- OSM: OsmAdapter,
1626
- };
1627
- LeafletMapAdapter$1.controlAdapters = {
1628
- ZOOM: Control.Zoom,
1629
- ATTRIBUTION: AttributionControl,
1630
- };
1631
- LeafletMapAdapter$1.Map = Map;
1738
+ };
1739
+ LeafletMapAdapter.layerAdapters = {
1740
+ GEOJSON: GeoJsonAdapter,
1741
+ IMAGE: ImageAdapter,
1742
+ TILE: TileAdapter,
1743
+ WMS: WmsAdapter,
1744
+ // // MVT: MvtAdapter,
1745
+ OSM: OsmAdapter,
1746
+ };
1747
+ LeafletMapAdapter.controlAdapters = {
1748
+ ZOOM: Control.Zoom,
1749
+ ATTRIBUTION: AttributionControl,
1750
+ };
1751
+ LeafletMapAdapter.Map = Map;
1752
+ return LeafletMapAdapter;
1753
+ }());
1632
1754
 
1633
1755
  /**
1634
1756
  * @module leaflet-map-adapter