mapboxgl-tools 2.0.0 → 2.1.0

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.
package/dist/ui.es.js CHANGED
@@ -1,5 +1,6 @@
1
- (function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode(".wbiokr-com-checkbox.wbiokr-com-checked .wbiokr-com-checkbox-content{margin-bottom:1px}.wbiokr-com-checkbox .wbiokr-com-checkbox-content.w-5.h-5{width:7px;height:7px}.wbiokr-ctrl-main{transition:all ease .4s;transform:scale(0);opacity:0;background-color:#fff;box-shadow:0 0 3px 1px #8e8e8e;border-radius:4px;overflow:hidden;padding:0 10px}.wbiokr-ctrl-entry path{transition:all ease-in .5s}.wbiokr-ctrl-active .wbiokr-ctrl-main{transform:none;opacity:1}.wbiokr-ctrl-active .wbiokr-ctrl-entry path{fill:#189fff}.wbiokr-ctrl-close{cursor:pointer;background:rgba(241,37,37,.91)!important;color:#fff;font-size:16px}.mapboxgl-ctrl-top-left .wbiokr-ctrl-absolute{position:absolute!important;left:33px;top:0;transform-origin:left top}.mapboxgl-ctrl-bottom-left .wbiokr-ctrl-absolute{position:absolute!important;left:33px;bottom:0;transform-origin:left bottom}.mapboxgl-ctrl-top-right .wbiokr-ctrl-absolute{position:absolute!important;right:33px;top:0;transform-origin:right top}.mapboxgl-ctrl-bottom-right .wbiokr-ctrl-absolute{position:absolute!important;right:33px;bottom:0;transform-origin:right bottom}.wbiokr-control-measureDistance-result,.wbiokr-control-measureArea-result{padding:1px 5px;background:#ffffffe8;border-radius:5px;box-shadow:0 0 4px 1px #999}.wbiokr-control-pick .wbiokr-control-pick-main{min-width:115px;height:29px;display:flex;justify-content:flex-start;align-items:center}.mapboxgl-wbkrect-control .mapboxgl-wbkrect-control-entry{transition:all ease .3s}.mapboxgl-wbkrect-control .mapboxgl-wbkrect-control-entry.wbk-show path{fill:#189fff}.wbiokr-control-positionControl-main textarea{border:1px solid #eee}.wbiokr-control-positionControl-main textarea:hover,.wbiokr-control-positionControl-main textarea:focus{border:1px solid #189fff}.wbiokr-control-positionControl-main textarea:focus{box-shadow:0 0 3px #189fff}.wbiokr-control-positionControl-main ul{max-height:200px}.wbiokr-control-positionControl-main ul li:hover .wbiokr-position-loc{color:#189fff}.wbiokr-control-positionControl-main .wbiokr-position-tag{color:#389e0d;height:24px;min-width:30px;background:#e6f7ff;border:1px solid #b7eb8f;border-radius:3px;padding:0 2px}.wbiokr-control-positionControl-main .wbokr-position-selected .wbiokr-position-tag{color:#096dd9;border-color:#91d5ff}.wbiokr-control-positionControl-main .wbokr-position-selected .wbiokr-position-loc{color:#189fff}.wbiokr-control-layersTree-main{background-color:#fffffff2}.wbiokr-control-layersTree-main-ul li{color:#ccc}.wbiokr-control-layersTree-main-ul li.wbiokr-active{color:#333}.wbiokr-control-layersTree-main-ul li:not(.wbiokr-active) svg{fill:#ccc!important}")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();import "@wbiokr/css-class";
2
- import { coordListByStr } from "gis-plugins";
1
+ import "vue";
2
+ import "@wbiokr/css-class";
3
+ import { coordListByStr } from "@wbiokr/geo";
3
4
  function createUuid(num) {
4
5
  function S4() {
5
6
  return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
@@ -38,868 +39,760 @@ function copyContent(text) {
38
39
  document.execCommand("copy");
39
40
  document.body.removeChild(input);
40
41
  }
41
- var index = "";
42
- const options$6 = {
43
- className: "",
44
- checked: false,
45
- disabled: false,
46
- indeterminate: false,
47
- onChange: () => {
48
- }
49
- };
50
- class Checkbox {
51
- constructor(container, e) {
52
- this.options = {
53
- ...options$6,
54
- ...e
42
+ function e$1(e2 = "WBIOKR-DB", t2 = 1, n2 = "WBIOKR-STORE", r2 = "id") {
43
+ let o;
44
+ const s2 = window.indexedDB || window.webikitIndexedDB || window.mozIndexedDB || window.msIndexedDB;
45
+ if (!s2)
46
+ return u;
47
+ const c = s2 == null ? void 0 : s2.open(e2, t2);
48
+ function u(e3, t3) {
49
+ try {
50
+ return 0 === arguments.length ? new Promise((e4, t4) => {
51
+ const r3 = o.transaction([n2]).objectStore(n2).getAll();
52
+ r3.onsuccess = () => {
53
+ r3.result ? e4(r3.result) : t4("\u83B7\u53D6\u5931\u8D25");
54
+ }, r3.onerror = (e5) => {
55
+ t4(e5);
56
+ };
57
+ }) : 1 === arguments.length ? function(e4) {
58
+ return new Promise((t4, r3) => {
59
+ const s3 = o.transaction([n2]).objectStore(n2).get(e4);
60
+ s3.onsuccess = (e5) => {
61
+ s3.result ? t4(s3.result) : r3(null);
62
+ }, s3.onerror = (e5) => {
63
+ r3(e5);
64
+ };
65
+ });
66
+ }(e3) : 2 === arguments.length ? function(e4, t4) {
67
+ return new Promise((e5, r3) => {
68
+ const s3 = o.transaction([n2], "readwrite").objectStore(n2).put(t4);
69
+ s3.onsuccess = (t5) => {
70
+ e5(t5);
71
+ }, s3.onerror = (e6) => {
72
+ r3(e6);
73
+ };
74
+ });
75
+ }(0, t3) : Promise.reject("\u53C2\u6570\u6709\u95EE\u9898");
76
+ } catch (e4) {
77
+ return Promise.reject(e4);
78
+ }
79
+ }
80
+ return c.onsuccess = function(e3) {
81
+ o = e3.target.result;
82
+ }, c.onerror = function(e3) {
83
+ console.error(e3);
84
+ }, c.onupgradeneeded = function(e3) {
85
+ o = e3.target.result, o.objectStoreNames.contains(n2) || o.createObjectStore(n2, { keyPath: r2 });
86
+ }, u;
87
+ }
88
+ const myDb = new e$1("WBIOKR-MAPBOX-TOOLS", 1, "WBIOKR-STORE", "id");
89
+ function normalizeComponent(scriptExports, render2, staticRenderFns2, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
90
+ var options2 = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
91
+ if (render2) {
92
+ options2.render = render2;
93
+ options2.staticRenderFns = staticRenderFns2;
94
+ options2._compiled = true;
95
+ }
96
+ if (functionalTemplate) {
97
+ options2.functional = true;
98
+ }
99
+ if (scopeId) {
100
+ options2._scopeId = "data-v-" + scopeId;
101
+ }
102
+ var hook;
103
+ if (moduleIdentifier) {
104
+ hook = function(context) {
105
+ context = context || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
106
+ if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") {
107
+ context = __VUE_SSR_CONTEXT__;
108
+ }
109
+ if (injectStyles) {
110
+ injectStyles.call(this, context);
111
+ }
112
+ if (context && context._registeredComponents) {
113
+ context._registeredComponents.add(moduleIdentifier);
114
+ }
55
115
  };
56
- this._container = container;
57
- this._wrapper = null;
58
- this._content = null;
59
- this._render();
116
+ options2._ssrRegister = hook;
117
+ } else if (injectStyles) {
118
+ hook = shadowMode ? function() {
119
+ injectStyles.call(
120
+ this,
121
+ (options2.functional ? this.parent : this).$root.$options.shadowRoot
122
+ );
123
+ } : injectStyles;
124
+ }
125
+ if (hook) {
126
+ if (options2.functional) {
127
+ options2._injectStyles = hook;
128
+ var originalRender = options2.render;
129
+ options2.render = function renderWithStyleInjection(h, context) {
130
+ hook.call(context);
131
+ return originalRender(h, context);
132
+ };
133
+ } else {
134
+ var existing = options2.beforeCreate;
135
+ options2.beforeCreate = existing ? [].concat(existing, hook) : [hook];
136
+ }
60
137
  }
61
- _render() {
62
- const dom = document.createElement("div");
63
- dom.className = this._wrapperClass();
64
- const span = document.createElement("span");
65
- span.className = this._contentClass();
66
- dom.append(span);
67
- this._wrapper = dom;
68
- this._content = span;
69
- dom.onclick = () => {
70
- if (this.options.disabled)
71
- return;
72
- this.options.indeterminate = false;
73
- this.options.checked = !this.options.checked;
74
- dom.className = this._wrapperClass();
75
- span.className = this._contentClass();
76
- this.options.onChange && this.options.onChange(this.options);
138
+ return {
139
+ exports: scriptExports,
140
+ options: options2
141
+ };
142
+ }
143
+ var render$1 = function() {
144
+ var _vm = this;
145
+ var _h = _vm.$createElement;
146
+ var _c = _vm._self._c || _h;
147
+ return _c("div", [_vm._l(_vm.tiles, function(item, index2) {
148
+ return _c("section", {
149
+ key: item.id,
150
+ class: `w-per-100 f-b-c ${_vm.itemClass}`
151
+ }, [_c("Checkbox", {
152
+ staticClass: "d-f-t white-1 f-s-c",
153
+ on: {
154
+ "change": function($event) {
155
+ return _vm.onChangeGeo(item);
156
+ }
157
+ },
158
+ model: {
159
+ value: item.checked,
160
+ callback: function($$v) {
161
+ _vm.$set(item, "checked", $$v);
162
+ },
163
+ expression: "item.checked"
164
+ }
165
+ }, [_c("div", {
166
+ staticClass: "white-1",
167
+ staticStyle: {
168
+ "max-width": "150px"
169
+ },
170
+ attrs: {
171
+ "title": item.name || `\u81EA\u5B9A\u4E49\u56FE\u5C42${index2 + 1}`
172
+ }
173
+ }, [_vm._v(" " + _vm._s(item.name || `\u81EA\u5B9A\u4E49\u56FE\u5C42${index2 + 1}`) + " ")])]), _c("div", {
174
+ staticClass: "f-s-c"
175
+ }, [_c("a", {
176
+ staticClass: "m-l-10",
177
+ attrs: {
178
+ "type": "link"
179
+ },
180
+ on: {
181
+ "click": function($event) {
182
+ return _vm.onEdit(item);
183
+ }
184
+ }
185
+ }, [_vm._v("Edit")]), _c("span", {
186
+ staticClass: "c-red c-p o-hover-70 m-l-10",
187
+ attrs: {
188
+ "danger": ""
189
+ },
190
+ on: {
191
+ "click": function($event) {
192
+ return _vm.onDelete(item);
193
+ }
194
+ }
195
+ }, [_vm._v("Delete")])])], 1);
196
+ }), _c("section", {
197
+ class: `m-t-10 ${_vm.addClass}`
198
+ }, [_c("Button", {
199
+ attrs: {
200
+ "type": _vm.addBtnProps.type || "primary",
201
+ "ghost": _vm.addBtnProps.ghost || false,
202
+ "size": _vm.addBtnProps.size || "small"
203
+ },
204
+ on: {
205
+ "click": _vm.onAdd
206
+ }
207
+ }, [_vm._v(_vm._s(_vm.addBtnProps.text || "\u65B0\u589E\u56FE\u5C42"))])], 1), _c("Tile", {
208
+ ref: "tile",
209
+ on: {
210
+ "confirm": _vm.onConfrim
211
+ }
212
+ })], 2);
213
+ };
214
+ var staticRenderFns$1 = [];
215
+ var index_vue_vue_type_style_index_0_scoped_true_lang$1 = "";
216
+ const WBIOKR_GEOSERVERS_LIST_ALL = "WBIOKR_GEOSERVERS_LIST_ALL";
217
+ const __vue2_script$1 = {
218
+ name: "Geoservers",
219
+ components: {},
220
+ props: {
221
+ map: {
222
+ type: Object,
223
+ default: () => ({}),
224
+ required: true
225
+ },
226
+ itemClass: {
227
+ type: String,
228
+ default: "",
229
+ required: false
230
+ },
231
+ addClass: {
232
+ type: String,
233
+ default: "",
234
+ required: false
235
+ },
236
+ addBtnProps: {
237
+ type: Object,
238
+ default: () => ({}),
239
+ required: false
240
+ }
241
+ },
242
+ data() {
243
+ return {
244
+ tiles: []
77
245
  };
78
- this._container.append(dom);
246
+ },
247
+ mounted() {
248
+ setTimeout(() => {
249
+ this.onInit();
250
+ }, 500);
251
+ },
252
+ methods: {
253
+ onAdd() {
254
+ this.$refs.tile.onAddModal();
255
+ },
256
+ onEdit(item) {
257
+ this.$refs.tile.onEditModal(item);
258
+ },
259
+ onDelete(item) {
260
+ Modal.confirm({
261
+ title: "\u63D0\u793A",
262
+ content: "\u786E\u5B9A\u8981\u5220\u9664\u5417\uFF1F",
263
+ onOk: () => {
264
+ const idx = this.tiles.findIndex((o) => o.id === item.id);
265
+ this.onRemoveGeoserver(this.tiles[idx]);
266
+ this.tiles.splice(idx, 1);
267
+ this.onSyncLocal();
268
+ }
269
+ });
270
+ },
271
+ async onInit() {
272
+ try {
273
+ const allTiles = await myDb(WBIOKR_GEOSERVERS_LIST_ALL);
274
+ this.tiles = allTiles.data || [];
275
+ } catch (error) {
276
+ this.tiles = [];
277
+ }
278
+ const initTiles = () => {
279
+ this.tiles.forEach((o) => {
280
+ if (o.checked) {
281
+ this.onChangeGeo(o);
282
+ }
283
+ });
284
+ };
285
+ try {
286
+ initTiles();
287
+ } catch (error) {
288
+ this.map.on("style.load", () => {
289
+ initTiles();
290
+ });
291
+ }
292
+ },
293
+ onRemoveGeoserver(tileItem) {
294
+ this.map.getLayer(tileItem.id) && this.map.removeLayer(tileItem.id);
295
+ this.map.getSource(tileItem.id) && this.map.removeSource(tileItem.id);
296
+ },
297
+ onChangeGeo(tileItem) {
298
+ if (!tileItem.checked) {
299
+ this.onRemoveGeoserver(tileItem);
300
+ } else {
301
+ const layers = this.map.getStyle().layers.filter((o) => ["fill", "raster", "background", "sky"].includes(o.type));
302
+ layers.length > 0 ? layers[layers.length - 1].id : null;
303
+ !this.map.getSource(tileItem.id) && this.map.addSource(tileItem.id, {
304
+ type: "raster",
305
+ tiles: [tileItem.url.replace(/bbox={bbox}|BBOX={bbox}|BBOX={BBOX}/, "bbox={bbox-epsg-3857}")],
306
+ tileSize: 256
307
+ });
308
+ !this.map.getLayer(tileItem.id) && this.map.addLayer({
309
+ id: tileItem.id,
310
+ type: "raster",
311
+ source: tileItem.id,
312
+ paint: {},
313
+ minZoom: 15
314
+ });
315
+ }
316
+ this.onSyncLocal();
317
+ },
318
+ onConfrim(form, historyList, type) {
319
+ const idx = this.tiles.findIndex((o) => o.id === form.id);
320
+ if (idx > -1) {
321
+ this.tiles.splice(idx, 1, form);
322
+ if (form.checked) {
323
+ form.checked = false;
324
+ this.onChangeGeo(form);
325
+ this.$nextTick(() => {
326
+ this.onChangeGeo(form);
327
+ });
328
+ }
329
+ } else {
330
+ this.tiles.push(form);
331
+ }
332
+ this.onSyncLocal();
333
+ },
334
+ onSyncLocal() {
335
+ myDb(WBIOKR_GEOSERVERS_LIST_ALL, {
336
+ id: WBIOKR_GEOSERVERS_LIST_ALL,
337
+ data: this.tiles
338
+ });
339
+ }
79
340
  }
80
- _updateStatus(args) {
81
- this.options = {
82
- ...this.options,
83
- ...args
341
+ };
342
+ const __cssModules$1 = {};
343
+ var __component__$1 = /* @__PURE__ */ normalizeComponent(
344
+ __vue2_script$1,
345
+ render$1,
346
+ staticRenderFns$1,
347
+ false,
348
+ __vue2_injectStyles$1,
349
+ "15a7d97a",
350
+ null,
351
+ null
352
+ );
353
+ function __vue2_injectStyles$1(context) {
354
+ for (let o in __cssModules$1) {
355
+ this[o] = __cssModules$1[o];
356
+ }
357
+ }
358
+ var Component$1 = /* @__PURE__ */ function() {
359
+ return __component__$1.exports;
360
+ }();
361
+ Component$1.install = (app) => {
362
+ app.component(Component$1.name || "Geoserver", Component$1);
363
+ };
364
+ var render = function() {
365
+ var _vm = this;
366
+ var _h = _vm.$createElement;
367
+ var _c = _vm._self._c || _h;
368
+ return _c("aside", {
369
+ staticClass: "com- p-a-xr-yt d-i z-100",
370
+ style: {
371
+ right: `${_vm.right}px`,
372
+ top: `${_vm.top}px`
373
+ }
374
+ }, [_c("Button", {
375
+ staticClass: "ease-400",
376
+ class: _vm.visible ? "btn-hidden" : "btn-visible",
377
+ attrs: {
378
+ "icon": "global"
379
+ },
380
+ on: {
381
+ "click": function($event) {
382
+ _vm.visible = !_vm.visible;
383
+ }
384
+ }
385
+ }), _c("div", {
386
+ staticClass: "aside-content p-a-xr-yt ease-300 p-lr-20 p-tb-15 bg-color-fff b-r-4",
387
+ class: _vm.visible ? "aside-visible" : "aside-hidden"
388
+ }, [_c("Icon", {
389
+ staticClass: "c-red c-p p-a-xr-yt m-t-5 m-r-5",
390
+ attrs: {
391
+ "type": "close"
392
+ },
393
+ on: {
394
+ "click": function($event) {
395
+ _vm.visible = false;
396
+ }
397
+ }
398
+ }), _c("Geoserver", {
399
+ attrs: {
400
+ "map": _vm.map,
401
+ "itemClass": _vm.itemClass,
402
+ "addClass": _vm.addClass,
403
+ "addBtnProps": _vm.addBtnProps
404
+ }
405
+ })], 1)], 1);
406
+ };
407
+ var staticRenderFns = [];
408
+ var index_vue_vue_type_style_index_0_scoped_true_lang = "";
409
+ const __vue2_script = {
410
+ name: "GeoserverAside",
411
+ components: {},
412
+ props: {
413
+ map: {
414
+ type: Object,
415
+ default: () => ({}),
416
+ required: true
417
+ },
418
+ itemClass: {
419
+ type: String,
420
+ default: "",
421
+ required: false
422
+ },
423
+ addClass: {
424
+ type: String,
425
+ default: "",
426
+ required: false
427
+ },
428
+ addBtnProps: {
429
+ type: Object,
430
+ default: () => ({}),
431
+ required: false
432
+ },
433
+ top: {
434
+ type: Number,
435
+ default: 100,
436
+ required: false
437
+ },
438
+ right: {
439
+ type: Number,
440
+ default: 20,
441
+ required: false
442
+ }
443
+ },
444
+ data() {
445
+ return {
446
+ visible: false
84
447
  };
85
- this._wrapper.className = this._wrapperClass();
86
- this._content.className = this._contentClass();
87
448
  }
88
- _wrapperClass() {
89
- let classname = `wbiokr-com-checkbox w-15 h-15 b-r-2 b-ccc ease-200 border-hover-app f-c c-p`;
90
- classname += !this.options.indeterminate && this.options.checked ? " bg-color-app b-c-app p-r wbiokr-com-checked " : " bg-color-fff b-c-ccc ";
91
- classname += this.options.className;
92
- return classname;
449
+ };
450
+ const __cssModules = {};
451
+ var __component__ = /* @__PURE__ */ normalizeComponent(
452
+ __vue2_script,
453
+ render,
454
+ staticRenderFns,
455
+ false,
456
+ __vue2_injectStyles,
457
+ "6fb8c34c",
458
+ null,
459
+ null
460
+ );
461
+ function __vue2_injectStyles(context) {
462
+ for (let o in __cssModules) {
463
+ this[o] = __cssModules[o];
464
+ }
465
+ }
466
+ var Component = /* @__PURE__ */ function() {
467
+ return __component__.exports;
468
+ }();
469
+ Component.install = (app) => {
470
+ app.component(Component.name || "Geoserver", Component);
471
+ };
472
+ var style = "";
473
+ class CommonCtrol {
474
+ _onOpen() {
475
+ this._container.className += " wbiokr-ctrl-active";
93
476
  }
94
- _contentClass() {
95
- let classname = `wbiokr-com-checkbox-content ease-300 `;
96
- classname += !this.options.indeterminate && this.options.checked ? " top-5 w-5 h-10 b-fff b-w-2 rotate-45 b-no-t b-no-l o-100 " : this.options.indeterminate ? " w-5 h-5 bg-color-app o-100 " : " rotate-reverse-45 b-fff b-w-2 ";
97
- return classname;
477
+ _onClose() {
478
+ this._container.className = this._container.className.replaceAll("wbiokr-ctrl-active", "");
98
479
  }
99
480
  }
100
- var earthRadius = 63710088e-1;
101
- var factors = {
102
- centimeters: earthRadius * 100,
103
- centimetres: earthRadius * 100,
104
- degrees: earthRadius / 111325,
105
- feet: earthRadius * 3.28084,
106
- inches: earthRadius * 39.37,
107
- kilometers: earthRadius / 1e3,
108
- kilometres: earthRadius / 1e3,
109
- meters: earthRadius,
110
- metres: earthRadius,
111
- miles: earthRadius / 1609.344,
112
- millimeters: earthRadius * 1e3,
113
- millimetres: earthRadius * 1e3,
114
- nauticalmiles: earthRadius / 1852,
115
- radians: 1,
116
- yards: earthRadius * 1.0936
481
+ var xhtml = "http://www.w3.org/1999/xhtml";
482
+ var namespaces = {
483
+ svg: "http://www.w3.org/2000/svg",
484
+ xhtml,
485
+ xlink: "http://www.w3.org/1999/xlink",
486
+ xml: "http://www.w3.org/XML/1998/namespace",
487
+ xmlns: "http://www.w3.org/2000/xmlns/"
117
488
  };
118
- function feature(geom, properties, options2) {
119
- if (options2 === void 0) {
120
- options2 = {};
121
- }
122
- var feat = { type: "Feature" };
123
- if (options2.id === 0 || options2.id) {
124
- feat.id = options2.id;
125
- }
126
- if (options2.bbox) {
127
- feat.bbox = options2.bbox;
128
- }
129
- feat.properties = properties || {};
130
- feat.geometry = geom;
131
- return feat;
489
+ function namespace(name) {
490
+ var prefix = name += "", i2 = prefix.indexOf(":");
491
+ if (i2 >= 0 && (prefix = name.slice(0, i2)) !== "xmlns")
492
+ name = name.slice(i2 + 1);
493
+ return namespaces.hasOwnProperty(prefix) ? { space: namespaces[prefix], local: name } : name;
132
494
  }
133
- function polygon(coordinates, properties, options2) {
134
- if (options2 === void 0) {
135
- options2 = {};
136
- }
137
- for (var _i = 0, coordinates_1 = coordinates; _i < coordinates_1.length; _i++) {
138
- var ring = coordinates_1[_i];
139
- if (ring.length < 4) {
140
- throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
141
- }
142
- for (var j = 0; j < ring[ring.length - 1].length; j++) {
143
- if (ring[ring.length - 1][j] !== ring[0][j]) {
144
- throw new Error("First and last Position are not equivalent.");
495
+ function creatorInherit(name) {
496
+ return function() {
497
+ var document2 = this.ownerDocument, uri = this.namespaceURI;
498
+ return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name) : document2.createElementNS(uri, name);
499
+ };
500
+ }
501
+ function creatorFixed(fullname) {
502
+ return function() {
503
+ return this.ownerDocument.createElementNS(fullname.space, fullname.local);
504
+ };
505
+ }
506
+ function creator(name) {
507
+ var fullname = namespace(name);
508
+ return (fullname.local ? creatorFixed : creatorInherit)(fullname);
509
+ }
510
+ function none() {
511
+ }
512
+ function selector(selector2) {
513
+ return selector2 == null ? none : function() {
514
+ return this.querySelector(selector2);
515
+ };
516
+ }
517
+ function selection_select(select) {
518
+ if (typeof select !== "function")
519
+ select = selector(select);
520
+ for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
521
+ for (var group = groups[j], n2 = group.length, subgroup = subgroups[j] = new Array(n2), node, subnode, i2 = 0; i2 < n2; ++i2) {
522
+ if ((node = group[i2]) && (subnode = select.call(node, node.__data__, i2, group))) {
523
+ if ("__data__" in node)
524
+ subnode.__data__ = node.__data__;
525
+ subgroup[i2] = subnode;
145
526
  }
146
527
  }
147
528
  }
148
- var geom = {
149
- type: "Polygon",
150
- coordinates
529
+ return new Selection(subgroups, this._parents);
530
+ }
531
+ function array(x) {
532
+ return x == null ? [] : Array.isArray(x) ? x : Array.from(x);
533
+ }
534
+ function empty() {
535
+ return [];
536
+ }
537
+ function selectorAll(selector2) {
538
+ return selector2 == null ? empty : function() {
539
+ return this.querySelectorAll(selector2);
151
540
  };
152
- return feature(geom, properties, options2);
153
541
  }
154
- function lineString(coordinates, properties, options2) {
155
- if (options2 === void 0) {
156
- options2 = {};
157
- }
158
- if (coordinates.length < 2) {
159
- throw new Error("coordinates must be an array of two or more positions");
160
- }
161
- var geom = {
162
- type: "LineString",
163
- coordinates
542
+ function arrayAll(select) {
543
+ return function() {
544
+ return array(select.apply(this, arguments));
164
545
  };
165
- return feature(geom, properties, options2);
166
546
  }
167
- function radiansToLength(radians, units) {
168
- if (units === void 0) {
169
- units = "kilometers";
170
- }
171
- var factor = factors[units];
172
- if (!factor) {
173
- throw new Error(units + " units is invalid");
547
+ function selection_selectAll(select) {
548
+ if (typeof select === "function")
549
+ select = arrayAll(select);
550
+ else
551
+ select = selectorAll(select);
552
+ for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
553
+ for (var group = groups[j], n2 = group.length, node, i2 = 0; i2 < n2; ++i2) {
554
+ if (node = group[i2]) {
555
+ subgroups.push(select.call(node, node.__data__, i2, group));
556
+ parents.push(node);
557
+ }
558
+ }
174
559
  }
175
- return radians * factor;
560
+ return new Selection(subgroups, parents);
176
561
  }
177
- function degreesToRadians(degrees) {
178
- var radians = degrees % 360;
179
- return radians * Math.PI / 180;
562
+ function matcher(selector2) {
563
+ return function() {
564
+ return this.matches(selector2);
565
+ };
180
566
  }
181
- function coordEach(geojson, callback, excludeWrapCoord) {
182
- if (geojson === null)
183
- return;
184
- var j, k, l, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === "FeatureCollection", isFeature = type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
185
- for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
186
- geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
187
- isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
188
- stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
189
- for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
190
- var multiFeatureIndex = 0;
191
- var geometryIndex = 0;
192
- geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
193
- if (geometry === null)
194
- continue;
195
- coords = geometry.coordinates;
196
- var geomType = geometry.type;
197
- wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
198
- switch (geomType) {
199
- case null:
200
- break;
201
- case "Point":
202
- if (callback(
203
- coords,
204
- coordIndex,
205
- featureIndex,
206
- multiFeatureIndex,
207
- geometryIndex
208
- ) === false)
209
- return false;
210
- coordIndex++;
211
- multiFeatureIndex++;
212
- break;
213
- case "LineString":
214
- case "MultiPoint":
215
- for (j = 0; j < coords.length; j++) {
216
- if (callback(
217
- coords[j],
218
- coordIndex,
219
- featureIndex,
220
- multiFeatureIndex,
221
- geometryIndex
222
- ) === false)
223
- return false;
224
- coordIndex++;
225
- if (geomType === "MultiPoint")
226
- multiFeatureIndex++;
227
- }
228
- if (geomType === "LineString")
229
- multiFeatureIndex++;
230
- break;
231
- case "Polygon":
232
- case "MultiLineString":
233
- for (j = 0; j < coords.length; j++) {
234
- for (k = 0; k < coords[j].length - wrapShrink; k++) {
235
- if (callback(
236
- coords[j][k],
237
- coordIndex,
238
- featureIndex,
239
- multiFeatureIndex,
240
- geometryIndex
241
- ) === false)
242
- return false;
243
- coordIndex++;
244
- }
245
- if (geomType === "MultiLineString")
246
- multiFeatureIndex++;
247
- if (geomType === "Polygon")
248
- geometryIndex++;
249
- }
250
- if (geomType === "Polygon")
251
- multiFeatureIndex++;
252
- break;
253
- case "MultiPolygon":
254
- for (j = 0; j < coords.length; j++) {
255
- geometryIndex = 0;
256
- for (k = 0; k < coords[j].length; k++) {
257
- for (l = 0; l < coords[j][k].length - wrapShrink; l++) {
258
- if (callback(
259
- coords[j][k][l],
260
- coordIndex,
261
- featureIndex,
262
- multiFeatureIndex,
263
- geometryIndex
264
- ) === false)
265
- return false;
266
- coordIndex++;
267
- }
268
- geometryIndex++;
269
- }
270
- multiFeatureIndex++;
271
- }
272
- break;
273
- case "GeometryCollection":
274
- for (j = 0; j < geometry.geometries.length; j++)
275
- if (coordEach(geometry.geometries[j], callback, excludeWrapCoord) === false)
276
- return false;
277
- break;
278
- default:
279
- throw new Error("Unknown Geometry Type");
567
+ function childMatcher(selector2) {
568
+ return function(node) {
569
+ return node.matches(selector2);
570
+ };
571
+ }
572
+ var find = Array.prototype.find;
573
+ function childFind(match) {
574
+ return function() {
575
+ return find.call(this.children, match);
576
+ };
577
+ }
578
+ function childFirst() {
579
+ return this.firstElementChild;
580
+ }
581
+ function selection_selectChild(match) {
582
+ return this.select(match == null ? childFirst : childFind(typeof match === "function" ? match : childMatcher(match)));
583
+ }
584
+ var filter = Array.prototype.filter;
585
+ function children() {
586
+ return Array.from(this.children);
587
+ }
588
+ function childrenFilter(match) {
589
+ return function() {
590
+ return filter.call(this.children, match);
591
+ };
592
+ }
593
+ function selection_selectChildren(match) {
594
+ return this.selectAll(match == null ? children : childrenFilter(typeof match === "function" ? match : childMatcher(match)));
595
+ }
596
+ function selection_filter(match) {
597
+ if (typeof match !== "function")
598
+ match = matcher(match);
599
+ for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
600
+ for (var group = groups[j], n2 = group.length, subgroup = subgroups[j] = [], node, i2 = 0; i2 < n2; ++i2) {
601
+ if ((node = group[i2]) && match.call(node, node.__data__, i2, group)) {
602
+ subgroup.push(node);
280
603
  }
281
604
  }
282
605
  }
606
+ return new Selection(subgroups, this._parents);
283
607
  }
284
- function geomEach(geojson, callback) {
285
- var i, j, g, geometry, stopG, geometryMaybeCollection, isGeometryCollection, featureProperties, featureBBox, featureId, featureIndex = 0, isFeatureCollection = geojson.type === "FeatureCollection", isFeature = geojson.type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
286
- for (i = 0; i < stop; i++) {
287
- geometryMaybeCollection = isFeatureCollection ? geojson.features[i].geometry : isFeature ? geojson.geometry : geojson;
288
- featureProperties = isFeatureCollection ? geojson.features[i].properties : isFeature ? geojson.properties : {};
289
- featureBBox = isFeatureCollection ? geojson.features[i].bbox : isFeature ? geojson.bbox : void 0;
290
- featureId = isFeatureCollection ? geojson.features[i].id : isFeature ? geojson.id : void 0;
291
- isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
292
- stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
293
- for (g = 0; g < stopG; g++) {
294
- geometry = isGeometryCollection ? geometryMaybeCollection.geometries[g] : geometryMaybeCollection;
295
- if (geometry === null) {
296
- if (callback(
297
- null,
298
- featureIndex,
299
- featureProperties,
300
- featureBBox,
301
- featureId
302
- ) === false)
303
- return false;
304
- continue;
305
- }
306
- switch (geometry.type) {
307
- case "Point":
308
- case "LineString":
309
- case "MultiPoint":
310
- case "Polygon":
311
- case "MultiLineString":
312
- case "MultiPolygon": {
313
- if (callback(
314
- geometry,
315
- featureIndex,
316
- featureProperties,
317
- featureBBox,
318
- featureId
319
- ) === false)
320
- return false;
321
- break;
322
- }
323
- case "GeometryCollection": {
324
- for (j = 0; j < geometry.geometries.length; j++) {
325
- if (callback(
326
- geometry.geometries[j],
327
- featureIndex,
328
- featureProperties,
329
- featureBBox,
330
- featureId
331
- ) === false)
332
- return false;
333
- }
334
- break;
335
- }
336
- default:
337
- throw new Error("Unknown Geometry Type");
338
- }
339
- }
340
- featureIndex++;
608
+ function sparse(update) {
609
+ return new Array(update.length);
610
+ }
611
+ function selection_enter() {
612
+ return new Selection(this._enter || this._groups.map(sparse), this._parents);
613
+ }
614
+ function EnterNode(parent, datum2) {
615
+ this.ownerDocument = parent.ownerDocument;
616
+ this.namespaceURI = parent.namespaceURI;
617
+ this._next = null;
618
+ this._parent = parent;
619
+ this.__data__ = datum2;
620
+ }
621
+ EnterNode.prototype = {
622
+ constructor: EnterNode,
623
+ appendChild: function(child) {
624
+ return this._parent.insertBefore(child, this._next);
625
+ },
626
+ insertBefore: function(child, next) {
627
+ return this._parent.insertBefore(child, next);
628
+ },
629
+ querySelector: function(selector2) {
630
+ return this._parent.querySelector(selector2);
631
+ },
632
+ querySelectorAll: function(selector2) {
633
+ return this._parent.querySelectorAll(selector2);
341
634
  }
635
+ };
636
+ function constant(x) {
637
+ return function() {
638
+ return x;
639
+ };
342
640
  }
343
- function geomReduce(geojson, callback, initialValue) {
344
- var previousValue = initialValue;
345
- geomEach(
346
- geojson,
347
- function(currentGeometry, featureIndex, featureProperties, featureBBox, featureId) {
348
- if (featureIndex === 0 && initialValue === void 0)
349
- previousValue = currentGeometry;
350
- else
351
- previousValue = callback(
352
- previousValue,
353
- currentGeometry,
354
- featureIndex,
355
- featureProperties,
356
- featureBBox,
357
- featureId
358
- );
641
+ function bindIndex(parent, group, enter, update, exit, data) {
642
+ var i2 = 0, node, groupLength = group.length, dataLength = data.length;
643
+ for (; i2 < dataLength; ++i2) {
644
+ if (node = group[i2]) {
645
+ node.__data__ = data[i2];
646
+ update[i2] = node;
647
+ } else {
648
+ enter[i2] = new EnterNode(parent, data[i2]);
359
649
  }
360
- );
361
- return previousValue;
650
+ }
651
+ for (; i2 < groupLength; ++i2) {
652
+ if (node = group[i2]) {
653
+ exit[i2] = node;
654
+ }
655
+ }
362
656
  }
363
- function flattenEach(geojson, callback) {
364
- geomEach(geojson, function(geometry, featureIndex, properties, bbox, id) {
365
- var type = geometry === null ? null : geometry.type;
366
- switch (type) {
367
- case null:
368
- case "Point":
369
- case "LineString":
370
- case "Polygon":
371
- if (callback(
372
- feature(geometry, properties, { bbox, id }),
373
- featureIndex,
374
- 0
375
- ) === false)
376
- return false;
377
- return;
657
+ function bindKey(parent, group, enter, update, exit, data, key) {
658
+ var i2, node, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue;
659
+ for (i2 = 0; i2 < groupLength; ++i2) {
660
+ if (node = group[i2]) {
661
+ keyValues[i2] = keyValue = key.call(node, node.__data__, i2, group) + "";
662
+ if (nodeByKeyValue.has(keyValue)) {
663
+ exit[i2] = node;
664
+ } else {
665
+ nodeByKeyValue.set(keyValue, node);
666
+ }
378
667
  }
379
- var geomType;
380
- switch (type) {
381
- case "MultiPoint":
382
- geomType = "Point";
383
- break;
384
- case "MultiLineString":
385
- geomType = "LineString";
386
- break;
387
- case "MultiPolygon":
388
- geomType = "Polygon";
389
- break;
668
+ }
669
+ for (i2 = 0; i2 < dataLength; ++i2) {
670
+ keyValue = key.call(parent, data[i2], i2, data) + "";
671
+ if (node = nodeByKeyValue.get(keyValue)) {
672
+ update[i2] = node;
673
+ node.__data__ = data[i2];
674
+ nodeByKeyValue.delete(keyValue);
675
+ } else {
676
+ enter[i2] = new EnterNode(parent, data[i2]);
390
677
  }
391
- for (var multiFeatureIndex = 0; multiFeatureIndex < geometry.coordinates.length; multiFeatureIndex++) {
392
- var coordinate = geometry.coordinates[multiFeatureIndex];
393
- var geom = {
394
- type: geomType,
395
- coordinates: coordinate
396
- };
397
- if (callback(feature(geom, properties), featureIndex, multiFeatureIndex) === false)
398
- return false;
678
+ }
679
+ for (i2 = 0; i2 < groupLength; ++i2) {
680
+ if ((node = group[i2]) && nodeByKeyValue.get(keyValues[i2]) === node) {
681
+ exit[i2] = node;
399
682
  }
400
- });
401
- }
402
- function segmentEach(geojson, callback) {
403
- flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {
404
- var segmentIndex = 0;
405
- if (!feature2.geometry)
406
- return;
407
- var type = feature2.geometry.type;
408
- if (type === "Point" || type === "MultiPoint")
409
- return;
410
- var previousCoords;
411
- var previousFeatureIndex = 0;
412
- var previousMultiIndex = 0;
413
- var prevGeomIndex = 0;
414
- if (coordEach(
415
- feature2,
416
- function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
417
- if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
418
- previousCoords = currentCoord;
419
- previousFeatureIndex = featureIndex;
420
- previousMultiIndex = multiPartIndexCoord;
421
- prevGeomIndex = geometryIndex;
422
- segmentIndex = 0;
423
- return;
424
- }
425
- var currentSegment = lineString(
426
- [previousCoords, currentCoord],
427
- feature2.properties
428
- );
429
- if (callback(
430
- currentSegment,
431
- featureIndex,
432
- multiFeatureIndex,
433
- geometryIndex,
434
- segmentIndex
435
- ) === false)
436
- return false;
437
- segmentIndex++;
438
- previousCoords = currentCoord;
439
- }
440
- ) === false)
441
- return false;
442
- });
683
+ }
443
684
  }
444
- function segmentReduce(geojson, callback, initialValue) {
445
- var previousValue = initialValue;
446
- var started = false;
447
- segmentEach(
448
- geojson,
449
- function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {
450
- if (started === false && initialValue === void 0)
451
- previousValue = currentSegment;
452
- else
453
- previousValue = callback(
454
- previousValue,
455
- currentSegment,
456
- featureIndex,
457
- multiFeatureIndex,
458
- geometryIndex,
459
- segmentIndex
460
- );
461
- started = true;
462
- }
463
- );
464
- return previousValue;
685
+ function datum(node) {
686
+ return node.__data__;
465
687
  }
466
- function getCoord(coord) {
467
- if (!coord) {
468
- throw new Error("coord is required");
469
- }
470
- if (!Array.isArray(coord)) {
471
- if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
472
- return coord.geometry.coordinates;
473
- }
474
- if (coord.type === "Point") {
475
- return coord.coordinates;
688
+ function selection_data(value, key) {
689
+ if (!arguments.length)
690
+ return Array.from(this, datum);
691
+ var bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups;
692
+ if (typeof value !== "function")
693
+ value = constant(value);
694
+ for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {
695
+ var parent = parents[j], group = groups[j], groupLength = group.length, data = arraylike(value.call(parent, parent && parent.__data__, j, parents)), dataLength = data.length, enterGroup = enter[j] = new Array(dataLength), updateGroup = update[j] = new Array(dataLength), exitGroup = exit[j] = new Array(groupLength);
696
+ bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
697
+ for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
698
+ if (previous = enterGroup[i0]) {
699
+ if (i0 >= i1)
700
+ i1 = i0 + 1;
701
+ while (!(next = updateGroup[i1]) && ++i1 < dataLength)
702
+ ;
703
+ previous._next = next || null;
704
+ }
476
705
  }
477
706
  }
478
- if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
479
- return coord;
480
- }
481
- throw new Error("coord must be GeoJSON Point or an Array of numbers");
707
+ update = new Selection(update, parents);
708
+ update._enter = enter;
709
+ update._exit = exit;
710
+ return update;
482
711
  }
483
- var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
484
- function distance(from, to, options2) {
485
- if (options2 === void 0) {
486
- options2 = {};
487
- }
488
- var coordinates1 = getCoord(from);
489
- var coordinates2 = getCoord(to);
490
- var dLat = degreesToRadians(coordinates2[1] - coordinates1[1]);
491
- var dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);
492
- var lat1 = degreesToRadians(coordinates1[1]);
493
- var lat2 = degreesToRadians(coordinates2[1]);
494
- var a = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
495
- return radiansToLength(2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)), options2.units);
712
+ function arraylike(data) {
713
+ return typeof data === "object" && "length" in data ? data : Array.from(data);
496
714
  }
497
- var RADIUS = 6378137;
498
- function area(geojson) {
499
- return geomReduce(geojson, function(value, geom) {
500
- return value + calculateArea(geom);
501
- }, 0);
715
+ function selection_exit() {
716
+ return new Selection(this._exit || this._groups.map(sparse), this._parents);
502
717
  }
503
- function calculateArea(geom) {
504
- var total = 0;
505
- var i;
506
- switch (geom.type) {
507
- case "Polygon":
508
- return polygonArea(geom.coordinates);
509
- case "MultiPolygon":
510
- for (i = 0; i < geom.coordinates.length; i++) {
511
- total += polygonArea(geom.coordinates[i]);
512
- }
513
- return total;
514
- case "Point":
515
- case "MultiPoint":
516
- case "LineString":
517
- case "MultiLineString":
518
- return 0;
718
+ function selection_join(onenter, onupdate, onexit) {
719
+ var enter = this.enter(), update = this, exit = this.exit();
720
+ if (typeof onenter === "function") {
721
+ enter = onenter(enter);
722
+ if (enter)
723
+ enter = enter.selection();
724
+ } else {
725
+ enter = enter.append(onenter + "");
519
726
  }
520
- return 0;
521
- }
522
- function polygonArea(coords) {
523
- var total = 0;
524
- if (coords && coords.length > 0) {
525
- total += Math.abs(ringArea(coords[0]));
526
- for (var i = 1; i < coords.length; i++) {
527
- total -= Math.abs(ringArea(coords[i]));
528
- }
727
+ if (onupdate != null) {
728
+ update = onupdate(update);
729
+ if (update)
730
+ update = update.selection();
529
731
  }
530
- return total;
732
+ if (onexit == null)
733
+ exit.remove();
734
+ else
735
+ onexit(exit);
736
+ return enter && update ? enter.merge(update).order() : update;
531
737
  }
532
- function ringArea(coords) {
533
- var p1;
534
- var p2;
535
- var p3;
536
- var lowerIndex;
537
- var middleIndex;
538
- var upperIndex;
539
- var i;
540
- var total = 0;
541
- var coordsLength = coords.length;
542
- if (coordsLength > 2) {
543
- for (i = 0; i < coordsLength; i++) {
544
- if (i === coordsLength - 2) {
545
- lowerIndex = coordsLength - 2;
546
- middleIndex = coordsLength - 1;
547
- upperIndex = 0;
548
- } else if (i === coordsLength - 1) {
549
- lowerIndex = coordsLength - 1;
550
- middleIndex = 0;
551
- upperIndex = 1;
552
- } else {
553
- lowerIndex = i;
554
- middleIndex = i + 1;
555
- upperIndex = i + 2;
738
+ function selection_merge(context) {
739
+ var selection = context.selection ? context.selection() : context;
740
+ for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {
741
+ for (var group0 = groups0[j], group1 = groups1[j], n2 = group0.length, merge = merges[j] = new Array(n2), node, i2 = 0; i2 < n2; ++i2) {
742
+ if (node = group0[i2] || group1[i2]) {
743
+ merge[i2] = node;
556
744
  }
557
- p1 = coords[lowerIndex];
558
- p2 = coords[middleIndex];
559
- p3 = coords[upperIndex];
560
- total += (rad(p3[0]) - rad(p1[0])) * Math.sin(rad(p2[1]));
561
745
  }
562
- total = total * RADIUS * RADIUS / 2;
563
746
  }
564
- return total;
565
- }
566
- function rad(num) {
567
- return num * Math.PI / 180;
747
+ for (; j < m0; ++j) {
748
+ merges[j] = groups0[j];
749
+ }
750
+ return new Selection(merges, this._parents);
568
751
  }
569
- function length(geojson, options2) {
570
- if (options2 === void 0) {
571
- options2 = {};
752
+ function selection_order() {
753
+ for (var groups = this._groups, j = -1, m = groups.length; ++j < m; ) {
754
+ for (var group = groups[j], i2 = group.length - 1, next = group[i2], node; --i2 >= 0; ) {
755
+ if (node = group[i2]) {
756
+ if (next && node.compareDocumentPosition(next) ^ 4)
757
+ next.parentNode.insertBefore(node, next);
758
+ next = node;
759
+ }
760
+ }
572
761
  }
573
- return segmentReduce(geojson, function(previousValue, segment) {
574
- var coords = segment.geometry.coordinates;
575
- return previousValue + distance(coords[0], coords[1], options2);
576
- }, 0);
762
+ return this;
577
763
  }
578
- var commonCtrols = "";
579
- var control$5 = "";
580
- class CommonCtrol {
581
- _onOpen() {
582
- this._container.className += " wbiokr-ctrl-active";
764
+ function selection_sort(compare) {
765
+ if (!compare)
766
+ compare = ascending;
767
+ function compareNode(a2, b) {
768
+ return a2 && b ? compare(a2.__data__, b.__data__) : !a2 - !b;
583
769
  }
584
- _onClose() {
585
- this._container.className = this._container.className.replaceAll("wbiokr-ctrl-active", "");
770
+ for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {
771
+ for (var group = groups[j], n2 = group.length, sortgroup = sortgroups[j] = new Array(n2), node, i2 = 0; i2 < n2; ++i2) {
772
+ if (node = group[i2]) {
773
+ sortgroup[i2] = node;
774
+ }
775
+ }
776
+ sortgroup.sort(compareNode);
586
777
  }
778
+ return new Selection(sortgroups, this._parents).order();
587
779
  }
588
- var xhtml = "http://www.w3.org/1999/xhtml";
589
- var namespaces = {
590
- svg: "http://www.w3.org/2000/svg",
591
- xhtml,
592
- xlink: "http://www.w3.org/1999/xlink",
593
- xml: "http://www.w3.org/XML/1998/namespace",
594
- xmlns: "http://www.w3.org/2000/xmlns/"
595
- };
596
- function namespace(name) {
597
- var prefix = name += "", i = prefix.indexOf(":");
598
- if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns")
599
- name = name.slice(i + 1);
600
- return namespaces.hasOwnProperty(prefix) ? { space: namespaces[prefix], local: name } : name;
780
+ function ascending(a2, b) {
781
+ return a2 < b ? -1 : a2 > b ? 1 : a2 >= b ? 0 : NaN;
601
782
  }
602
- function creatorInherit(name) {
603
- return function() {
604
- var document2 = this.ownerDocument, uri = this.namespaceURI;
605
- return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name) : document2.createElementNS(uri, name);
606
- };
607
- }
608
- function creatorFixed(fullname) {
609
- return function() {
610
- return this.ownerDocument.createElementNS(fullname.space, fullname.local);
611
- };
612
- }
613
- function creator(name) {
614
- var fullname = namespace(name);
615
- return (fullname.local ? creatorFixed : creatorInherit)(fullname);
616
- }
617
- function none() {
618
- }
619
- function selector(selector2) {
620
- return selector2 == null ? none : function() {
621
- return this.querySelector(selector2);
622
- };
623
- }
624
- function selection_select(select2) {
625
- if (typeof select2 !== "function")
626
- select2 = selector(select2);
627
- for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
628
- for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {
629
- if ((node = group[i]) && (subnode = select2.call(node, node.__data__, i, group))) {
630
- if ("__data__" in node)
631
- subnode.__data__ = node.__data__;
632
- subgroup[i] = subnode;
633
- }
634
- }
635
- }
636
- return new Selection(subgroups, this._parents);
637
- }
638
- function array(x) {
639
- return x == null ? [] : Array.isArray(x) ? x : Array.from(x);
640
- }
641
- function empty() {
642
- return [];
643
- }
644
- function selectorAll(selector2) {
645
- return selector2 == null ? empty : function() {
646
- return this.querySelectorAll(selector2);
647
- };
648
- }
649
- function arrayAll(select2) {
650
- return function() {
651
- return array(select2.apply(this, arguments));
652
- };
653
- }
654
- function selection_selectAll(select2) {
655
- if (typeof select2 === "function")
656
- select2 = arrayAll(select2);
657
- else
658
- select2 = selectorAll(select2);
659
- for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
660
- for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
661
- if (node = group[i]) {
662
- subgroups.push(select2.call(node, node.__data__, i, group));
663
- parents.push(node);
664
- }
665
- }
666
- }
667
- return new Selection(subgroups, parents);
668
- }
669
- function matcher(selector2) {
670
- return function() {
671
- return this.matches(selector2);
672
- };
673
- }
674
- function childMatcher(selector2) {
675
- return function(node) {
676
- return node.matches(selector2);
677
- };
678
- }
679
- var find = Array.prototype.find;
680
- function childFind(match) {
681
- return function() {
682
- return find.call(this.children, match);
683
- };
684
- }
685
- function childFirst() {
686
- return this.firstElementChild;
687
- }
688
- function selection_selectChild(match) {
689
- return this.select(match == null ? childFirst : childFind(typeof match === "function" ? match : childMatcher(match)));
690
- }
691
- var filter = Array.prototype.filter;
692
- function children() {
693
- return Array.from(this.children);
694
- }
695
- function childrenFilter(match) {
696
- return function() {
697
- return filter.call(this.children, match);
698
- };
699
- }
700
- function selection_selectChildren(match) {
701
- return this.selectAll(match == null ? children : childrenFilter(typeof match === "function" ? match : childMatcher(match)));
702
- }
703
- function selection_filter(match) {
704
- if (typeof match !== "function")
705
- match = matcher(match);
706
- for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
707
- for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
708
- if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
709
- subgroup.push(node);
710
- }
711
- }
712
- }
713
- return new Selection(subgroups, this._parents);
714
- }
715
- function sparse(update) {
716
- return new Array(update.length);
717
- }
718
- function selection_enter() {
719
- return new Selection(this._enter || this._groups.map(sparse), this._parents);
720
- }
721
- function EnterNode(parent, datum2) {
722
- this.ownerDocument = parent.ownerDocument;
723
- this.namespaceURI = parent.namespaceURI;
724
- this._next = null;
725
- this._parent = parent;
726
- this.__data__ = datum2;
727
- }
728
- EnterNode.prototype = {
729
- constructor: EnterNode,
730
- appendChild: function(child) {
731
- return this._parent.insertBefore(child, this._next);
732
- },
733
- insertBefore: function(child, next) {
734
- return this._parent.insertBefore(child, next);
735
- },
736
- querySelector: function(selector2) {
737
- return this._parent.querySelector(selector2);
738
- },
739
- querySelectorAll: function(selector2) {
740
- return this._parent.querySelectorAll(selector2);
741
- }
742
- };
743
- function constant(x) {
744
- return function() {
745
- return x;
746
- };
747
- }
748
- function bindIndex(parent, group, enter, update, exit, data) {
749
- var i = 0, node, groupLength = group.length, dataLength = data.length;
750
- for (; i < dataLength; ++i) {
751
- if (node = group[i]) {
752
- node.__data__ = data[i];
753
- update[i] = node;
754
- } else {
755
- enter[i] = new EnterNode(parent, data[i]);
756
- }
757
- }
758
- for (; i < groupLength; ++i) {
759
- if (node = group[i]) {
760
- exit[i] = node;
761
- }
762
- }
763
- }
764
- function bindKey(parent, group, enter, update, exit, data, key) {
765
- var i, node, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue;
766
- for (i = 0; i < groupLength; ++i) {
767
- if (node = group[i]) {
768
- keyValues[i] = keyValue = key.call(node, node.__data__, i, group) + "";
769
- if (nodeByKeyValue.has(keyValue)) {
770
- exit[i] = node;
771
- } else {
772
- nodeByKeyValue.set(keyValue, node);
773
- }
774
- }
775
- }
776
- for (i = 0; i < dataLength; ++i) {
777
- keyValue = key.call(parent, data[i], i, data) + "";
778
- if (node = nodeByKeyValue.get(keyValue)) {
779
- update[i] = node;
780
- node.__data__ = data[i];
781
- nodeByKeyValue.delete(keyValue);
782
- } else {
783
- enter[i] = new EnterNode(parent, data[i]);
784
- }
785
- }
786
- for (i = 0; i < groupLength; ++i) {
787
- if ((node = group[i]) && nodeByKeyValue.get(keyValues[i]) === node) {
788
- exit[i] = node;
789
- }
790
- }
791
- }
792
- function datum(node) {
793
- return node.__data__;
794
- }
795
- function selection_data(value, key) {
796
- if (!arguments.length)
797
- return Array.from(this, datum);
798
- var bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups;
799
- if (typeof value !== "function")
800
- value = constant(value);
801
- for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {
802
- var parent = parents[j], group = groups[j], groupLength = group.length, data = arraylike(value.call(parent, parent && parent.__data__, j, parents)), dataLength = data.length, enterGroup = enter[j] = new Array(dataLength), updateGroup = update[j] = new Array(dataLength), exitGroup = exit[j] = new Array(groupLength);
803
- bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
804
- for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
805
- if (previous = enterGroup[i0]) {
806
- if (i0 >= i1)
807
- i1 = i0 + 1;
808
- while (!(next = updateGroup[i1]) && ++i1 < dataLength)
809
- ;
810
- previous._next = next || null;
811
- }
812
- }
813
- }
814
- update = new Selection(update, parents);
815
- update._enter = enter;
816
- update._exit = exit;
817
- return update;
818
- }
819
- function arraylike(data) {
820
- return typeof data === "object" && "length" in data ? data : Array.from(data);
821
- }
822
- function selection_exit() {
823
- return new Selection(this._exit || this._groups.map(sparse), this._parents);
824
- }
825
- function selection_join(onenter, onupdate, onexit) {
826
- var enter = this.enter(), update = this, exit = this.exit();
827
- if (typeof onenter === "function") {
828
- enter = onenter(enter);
829
- if (enter)
830
- enter = enter.selection();
831
- } else {
832
- enter = enter.append(onenter + "");
833
- }
834
- if (onupdate != null) {
835
- update = onupdate(update);
836
- if (update)
837
- update = update.selection();
838
- }
839
- if (onexit == null)
840
- exit.remove();
841
- else
842
- onexit(exit);
843
- return enter && update ? enter.merge(update).order() : update;
844
- }
845
- function selection_merge(context) {
846
- var selection = context.selection ? context.selection() : context;
847
- for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {
848
- for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {
849
- if (node = group0[i] || group1[i]) {
850
- merge[i] = node;
851
- }
852
- }
853
- }
854
- for (; j < m0; ++j) {
855
- merges[j] = groups0[j];
856
- }
857
- return new Selection(merges, this._parents);
858
- }
859
- function selection_order() {
860
- for (var groups = this._groups, j = -1, m = groups.length; ++j < m; ) {
861
- for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0; ) {
862
- if (node = group[i]) {
863
- if (next && node.compareDocumentPosition(next) ^ 4)
864
- next.parentNode.insertBefore(node, next);
865
- next = node;
866
- }
867
- }
868
- }
869
- return this;
870
- }
871
- function selection_sort(compare) {
872
- if (!compare)
873
- compare = ascending;
874
- function compareNode(a, b) {
875
- return a && b ? compare(a.__data__, b.__data__) : !a - !b;
876
- }
877
- for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {
878
- for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {
879
- if (node = group[i]) {
880
- sortgroup[i] = node;
881
- }
882
- }
883
- sortgroup.sort(compareNode);
884
- }
885
- return new Selection(sortgroups, this._parents).order();
886
- }
887
- function ascending(a, b) {
888
- return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
889
- }
890
- function selection_call() {
891
- var callback = arguments[0];
892
- arguments[0] = this;
893
- callback.apply(null, arguments);
894
- return this;
783
+ function selection_call() {
784
+ var callback = arguments[0];
785
+ arguments[0] = this;
786
+ callback.apply(null, arguments);
787
+ return this;
895
788
  }
896
789
  function selection_nodes() {
897
790
  return Array.from(this);
898
791
  }
899
792
  function selection_node() {
900
793
  for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
901
- for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {
902
- var node = group[i];
794
+ for (var group = groups[j], i2 = 0, n2 = group.length; i2 < n2; ++i2) {
795
+ var node = group[i2];
903
796
  if (node)
904
797
  return node;
905
798
  }
@@ -917,9 +810,9 @@ function selection_empty() {
917
810
  }
918
811
  function selection_each(callback) {
919
812
  for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
920
- for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {
921
- if (node = group[i])
922
- callback.call(node, node.__data__, i, group);
813
+ for (var group = groups[j], i2 = 0, n2 = group.length, node; i2 < n2; ++i2) {
814
+ if (node = group[i2])
815
+ callback.call(node, node.__data__, i2, group);
923
816
  }
924
817
  }
925
818
  return this;
@@ -1032,16 +925,16 @@ function ClassList(node) {
1032
925
  }
1033
926
  ClassList.prototype = {
1034
927
  add: function(name) {
1035
- var i = this._names.indexOf(name);
1036
- if (i < 0) {
928
+ var i2 = this._names.indexOf(name);
929
+ if (i2 < 0) {
1037
930
  this._names.push(name);
1038
931
  this._node.setAttribute("class", this._names.join(" "));
1039
932
  }
1040
933
  },
1041
934
  remove: function(name) {
1042
- var i = this._names.indexOf(name);
1043
- if (i >= 0) {
1044
- this._names.splice(i, 1);
935
+ var i2 = this._names.indexOf(name);
936
+ if (i2 >= 0) {
937
+ this._names.splice(i2, 1);
1045
938
  this._node.setAttribute("class", this._names.join(" "));
1046
939
  }
1047
940
  },
@@ -1050,14 +943,14 @@ ClassList.prototype = {
1050
943
  }
1051
944
  };
1052
945
  function classedAdd(node, names) {
1053
- var list = classList(node), i = -1, n = names.length;
1054
- while (++i < n)
1055
- list.add(names[i]);
946
+ var list = classList(node), i2 = -1, n2 = names.length;
947
+ while (++i2 < n2)
948
+ list.add(names[i2]);
1056
949
  }
1057
950
  function classedRemove(node, names) {
1058
- var list = classList(node), i = -1, n = names.length;
1059
- while (++i < n)
1060
- list.remove(names[i]);
951
+ var list = classList(node), i2 = -1, n2 = names.length;
952
+ while (++i2 < n2)
953
+ list.remove(names[i2]);
1061
954
  }
1062
955
  function classedTrue(names) {
1063
956
  return function() {
@@ -1077,9 +970,9 @@ function classedFunction(names, value) {
1077
970
  function selection_classed(name, value) {
1078
971
  var names = classArray(name + "");
1079
972
  if (arguments.length < 2) {
1080
- var list = classList(this.node()), i = -1, n = names.length;
1081
- while (++i < n)
1082
- if (!list.contains(names[i]))
973
+ var list = classList(this.node()), i2 = -1, n2 = names.length;
974
+ while (++i2 < n2)
975
+ if (!list.contains(names[i2]))
1083
976
  return false;
1084
977
  return true;
1085
978
  }
@@ -1143,9 +1036,9 @@ function constantNull() {
1143
1036
  return null;
1144
1037
  }
1145
1038
  function selection_insert(name, before) {
1146
- var create = typeof name === "function" ? name : creator(name), select2 = before == null ? constantNull : typeof before === "function" ? before : selector(before);
1039
+ var create = typeof name === "function" ? name : creator(name), select = before == null ? constantNull : typeof before === "function" ? before : selector(before);
1147
1040
  return this.select(function() {
1148
- return this.insertBefore(create.apply(this, arguments), select2.apply(this, arguments) || null);
1041
+ return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);
1149
1042
  });
1150
1043
  }
1151
1044
  function remove() {
@@ -1177,9 +1070,9 @@ function contextListener(listener) {
1177
1070
  }
1178
1071
  function parseTypenames(typenames) {
1179
1072
  return typenames.trim().split(/^|\s+/).map(function(t2) {
1180
- var name = "", i = t2.indexOf(".");
1181
- if (i >= 0)
1182
- name = t2.slice(i + 1), t2 = t2.slice(0, i);
1073
+ var name = "", i2 = t2.indexOf(".");
1074
+ if (i2 >= 0)
1075
+ name = t2.slice(i2 + 1), t2 = t2.slice(0, i2);
1183
1076
  return { type: t2, name };
1184
1077
  });
1185
1078
  }
@@ -1188,15 +1081,15 @@ function onRemove(typename) {
1188
1081
  var on = this.__on;
1189
1082
  if (!on)
1190
1083
  return;
1191
- for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {
1084
+ for (var j = 0, i2 = -1, m = on.length, o; j < m; ++j) {
1192
1085
  if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {
1193
1086
  this.removeEventListener(o.type, o.listener, o.options);
1194
1087
  } else {
1195
- on[++i] = o;
1088
+ on[++i2] = o;
1196
1089
  }
1197
1090
  }
1198
- if (++i)
1199
- on.length = i;
1091
+ if (++i2)
1092
+ on.length = i2;
1200
1093
  else
1201
1094
  delete this.__on;
1202
1095
  };
@@ -1213,216 +1106,893 @@ function onAdd(typename, value, options2) {
1213
1106
  return;
1214
1107
  }
1215
1108
  }
1216
- this.addEventListener(typename.type, listener, options2);
1217
- o = { type: typename.type, name: typename.name, value, listener, options: options2 };
1218
- if (!on)
1219
- this.__on = [o];
1220
- else
1221
- on.push(o);
1222
- };
1109
+ this.addEventListener(typename.type, listener, options2);
1110
+ o = { type: typename.type, name: typename.name, value, listener, options: options2 };
1111
+ if (!on)
1112
+ this.__on = [o];
1113
+ else
1114
+ on.push(o);
1115
+ };
1116
+ }
1117
+ function selection_on(typename, value, options2) {
1118
+ var typenames = parseTypenames(typename + ""), i2, n2 = typenames.length, t2;
1119
+ if (arguments.length < 2) {
1120
+ var on = this.node().__on;
1121
+ if (on)
1122
+ for (var j = 0, m = on.length, o; j < m; ++j) {
1123
+ for (i2 = 0, o = on[j]; i2 < n2; ++i2) {
1124
+ if ((t2 = typenames[i2]).type === o.type && t2.name === o.name) {
1125
+ return o.value;
1126
+ }
1127
+ }
1128
+ }
1129
+ return;
1130
+ }
1131
+ on = value ? onAdd : onRemove;
1132
+ for (i2 = 0; i2 < n2; ++i2)
1133
+ this.each(on(typenames[i2], value, options2));
1134
+ return this;
1135
+ }
1136
+ function dispatchEvent(node, type, params) {
1137
+ var window2 = defaultView(node), event = window2.CustomEvent;
1138
+ if (typeof event === "function") {
1139
+ event = new event(type, params);
1140
+ } else {
1141
+ event = window2.document.createEvent("Event");
1142
+ if (params)
1143
+ event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;
1144
+ else
1145
+ event.initEvent(type, false, false);
1146
+ }
1147
+ node.dispatchEvent(event);
1148
+ }
1149
+ function dispatchConstant(type, params) {
1150
+ return function() {
1151
+ return dispatchEvent(this, type, params);
1152
+ };
1153
+ }
1154
+ function dispatchFunction(type, params) {
1155
+ return function() {
1156
+ return dispatchEvent(this, type, params.apply(this, arguments));
1157
+ };
1158
+ }
1159
+ function selection_dispatch(type, params) {
1160
+ return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type, params));
1161
+ }
1162
+ function* selection_iterator() {
1163
+ for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
1164
+ for (var group = groups[j], i2 = 0, n2 = group.length, node; i2 < n2; ++i2) {
1165
+ if (node = group[i2])
1166
+ yield node;
1167
+ }
1168
+ }
1169
+ }
1170
+ var root$1 = [null];
1171
+ function Selection(groups, parents) {
1172
+ this._groups = groups;
1173
+ this._parents = parents;
1174
+ }
1175
+ function selection_selection() {
1176
+ return this;
1177
+ }
1178
+ Selection.prototype = {
1179
+ constructor: Selection,
1180
+ select: selection_select,
1181
+ selectAll: selection_selectAll,
1182
+ selectChild: selection_selectChild,
1183
+ selectChildren: selection_selectChildren,
1184
+ filter: selection_filter,
1185
+ data: selection_data,
1186
+ enter: selection_enter,
1187
+ exit: selection_exit,
1188
+ join: selection_join,
1189
+ merge: selection_merge,
1190
+ selection: selection_selection,
1191
+ order: selection_order,
1192
+ sort: selection_sort,
1193
+ call: selection_call,
1194
+ nodes: selection_nodes,
1195
+ node: selection_node,
1196
+ size: selection_size,
1197
+ empty: selection_empty,
1198
+ each: selection_each,
1199
+ attr: selection_attr,
1200
+ style: selection_style,
1201
+ property: selection_property,
1202
+ classed: selection_classed,
1203
+ text: selection_text,
1204
+ html: selection_html,
1205
+ raise: selection_raise,
1206
+ lower: selection_lower,
1207
+ append: selection_append,
1208
+ insert: selection_insert,
1209
+ remove: selection_remove,
1210
+ clone: selection_clone,
1211
+ datum: selection_datum,
1212
+ on: selection_on,
1213
+ dispatch: selection_dispatch,
1214
+ [Symbol.iterator]: selection_iterator
1215
+ };
1216
+ function e(selector2) {
1217
+ return typeof selector2 === "string" ? new Selection([[document.querySelector(selector2)]], [document.documentElement]) : new Selection([[selector2]], root$1);
1218
+ }
1219
+ const t = { "\u21E7": 16, shift: 16, "\u2303": 17, ctrl: 17, "\u2325": 18, alt: 18, option: 18, "\u2318": 91, meta: 91, cmd: 91, super: 91, win: 91 }, r = { 16: "shiftKey", 17: "ctrlKey", 18: "altKey", 91: "metaKey" }, n = { "\u232B": "Backspace", backspace: "Backspace", "\u21E5": "Tab", "\u21C6": "Tab", tab: "Tab", "\u21A9": "Enter", "\u21B5": "Enter", "\u23CE": "Enter", return: "Enter", enter: "Enter", "\u2305": "Enter", pause: "Pause", "pause-break": "Pause", "\u21EA": "CapsLock", caps: "CapsLock", "caps-lock": "CapsLock", "\u238B": ["Escape", "Esc"], escape: ["Escape", "Esc"], esc: ["Escape", "Esc"], space: [" ", "Spacebar"], "": "PageUp", pgup: "PageUp", "page-up": "PageUp", "": "PageDown", pgdown: "PageDown", "page-down": "PageDown", "\u21DF": "End", end: "End", "\u21DE": "Home", home: "Home", ins: "Insert", insert: "Insert", "\u2326": ["Delete", "Del"], del: ["Delete", "Del"], delete: ["Delete", "Del"], "\u2190": ["ArrowLeft", "Left"], left: ["ArrowLeft", "Left"], "arrow-left": ["ArrowLeft", "Left"], "\u2191": ["ArrowUp", "Up"], up: ["ArrowUp", "Up"], "arrow-up": ["ArrowUp", "Up"], "\u2192": ["ArrowRight", "Right"], right: ["ArrowRight", "Right"], "arrow-right": ["ArrowRight", "Right"], "\u2193": ["ArrowDown", "Down"], down: ["ArrowDown", "Down"], "arrow-down": ["ArrowDown", "Down"], "*": ["*", "Multiply"], star: ["*", "Multiply"], asterisk: ["*", "Multiply"], multiply: ["*", "Multiply"], "+": ["+", "Add"], plus: ["+", "Add"], "-": ["-", "Subtract"], subtract: ["-", "Subtract"], dash: ["-", "Subtract"], semicolon: ";", equals: "=", comma: ",", period: ".", "full-stop": ".", slash: "/", "forward-slash": "/", tick: "`", "back-quote": "`", "open-bracket": "[", "back-slash": "\\", "close-bracket": "]", quote: "'", apostrophe: "'", "num-0": "0", "num-1": "1", "num-2": "2", "num-3": "3", "num-4": "4", "num-5": "5", "num-6": "6", "num-7": "7", "num-8": "8", "num-9": "9", f1: "F1", f2: "F2", f3: "F3", f4: "F4", f5: "F5", f6: "F6", f7: "F7", f8: "F8", f9: "F9", f10: "F10", f11: "F11", f12: "F12", f13: "F13", f14: "F14", f15: "F15", f16: "F16", f17: "F17", f18: "F18", f19: "F19", f20: "F20", f21: "F21", f22: "F22", f23: "F23", f24: "F24", f25: "F25" }, s = { "\u232B": 8, backspace: 8, "\u21E5": 9, "\u21C6": 9, tab: 9, "\u21A9": 13, "\u21B5": 13, "\u23CE": 13, return: 13, enter: 13, "\u2305": 13, pause: 19, "pause-break": 19, "\u21EA": 20, caps: 20, "caps-lock": 20, "\u238B": 27, escape: 27, esc: 27, space: 32, "": 33, pgup: 33, "page-up": 33, "": 34, pgdown: 34, "page-down": 34, "\u21DF": 35, end: 35, "\u21DE": 36, home: 36, ins: 45, insert: 45, "\u2326": 46, del: 46, delete: 46, "\u2190": 37, left: 37, "arrow-left": 37, "\u2191": 38, up: 38, "arrow-up": 38, "\u2192": 39, right: 39, "arrow-right": 39, "\u2193": 40, down: 40, "arrow-down": 40, ffequals: 61, "*": 106, star: 106, asterisk: 106, multiply: 106, "+": 107, plus: 107, "-": 109, subtract: 109, "|": 124, ffplus: 171, ffminus: 173, ";": 186, semicolon: 186, "=": 187, equals: 187, ",": 188, comma: 188, dash: 189, ".": 190, period: 190, "full-stop": 190, "/": 191, slash: 191, "forward-slash": 191, "`": 192, tick: 192, "back-quote": 192, "[": 219, "open-bracket": 219, "\\": 220, "back-slash": 220, "]": 221, "close-bracket": 221, "'": 222, quote: 222, apostrophe: 222 };
1220
+ function a(e2) {
1221
+ return Array.from(new Set(e2));
1222
+ }
1223
+ class i {
1224
+ constructor(t2 = "global", r2 = document, n2 = "keydown") {
1225
+ if ("keydown" !== n2 && "keyup" !== n2)
1226
+ throw new Error(n2, "\u4E8B\u4EF6\u7C7B\u578B\u4EC5\u652F\u6301keydown\u3001keyup");
1227
+ this.eventType = n2, this.namespace = t2, this.selection = e(r2), this.bindedKeys = [], this.bindings = this.bindings.bind(this), this.capture = this.capture.bind(this), this.bubble = this.bubble.bind(this), this.init();
1228
+ }
1229
+ init() {
1230
+ return this.selection.on(`${this.eventType}.capture.${this.namespace}`, this.capture, true), this.selection.on(`${this.eventType}.bubble.${this.namespace}`, this.bubble, false), this;
1231
+ }
1232
+ bindings(e2, t2) {
1233
+ var r2, n2, s2 = false, a2 = Object.keys(this.bindedKeys).map(function(e3) {
1234
+ return this.bindedKeys[e3];
1235
+ }.bind(this));
1236
+ for (r2 = 0; r2 < a2.length; r2++)
1237
+ if ((n2 = a2[r2]).event.modifiers.shiftKey && !!n2.capture === t2 && i2(e2, n2, true)) {
1238
+ n2.callback(e2), s2 = true, e2.preventDefault();
1239
+ break;
1240
+ }
1241
+ if (!s2) {
1242
+ for (r2 = 0; r2 < a2.length; r2++)
1243
+ if (!(n2 = a2[r2]).event.modifiers.shiftKey && !!n2.capture === t2 && i2(e2, n2, false)) {
1244
+ n2.callback(e2), e2.preventDefault();
1245
+ break;
1246
+ }
1247
+ }
1248
+ function i2(e3, t3, r3) {
1249
+ var n3 = e3, s3 = false, a3 = true;
1250
+ if (void 0 !== n3.key && (a3 = n3.key.charCodeAt(0) > 255, s3 = true, void 0 === t3.event.key ? s3 = false : Array.isArray(t3.event.key) ? -1 === t3.event.key.map(function(e4) {
1251
+ return e4.toLowerCase();
1252
+ }).indexOf(n3.key.toLowerCase()) && (s3 = false) : n3.key.toLowerCase() !== t3.event.key.toLowerCase() && (s3 = false)), s3 || !a3 && !t3.event.modifiers.shiftKey || (s3 = n3.keyCode === t3.event.keyCode), !s3)
1253
+ return false;
1254
+ if (!n3.ctrlKey || !n3.altKey) {
1255
+ if (n3.ctrlKey !== t3.event.modifiers.ctrlKey)
1256
+ return false;
1257
+ if (n3.altKey !== t3.event.modifiers.altKey)
1258
+ return false;
1259
+ }
1260
+ return n3.metaKey === t3.event.modifiers.metaKey && (!r3 || n3.shiftKey === t3.event.modifiers.shiftKey);
1261
+ }
1262
+ }
1263
+ capture(e2) {
1264
+ this.bindings(e2, true);
1265
+ }
1266
+ bubble(t2) {
1267
+ var r2 = e(t2.target).node().tagName;
1268
+ "INPUT" !== r2 && "SELECT" !== r2 && "TEXTAREA" !== r2 && "true" !== String(t2.target.getAttribute("contenteditable")) && this.bindings(t2, false);
1269
+ }
1270
+ on(e2, i2, o2) {
1271
+ if ("function" != typeof i2)
1272
+ return this.off(e2, o2);
1273
+ for (var c2 = a([].concat(e2)), l = 0; l < c2.length; l++) {
1274
+ var u = c2[l] + (o2 ? "-capture" : "-bubble"), p = { id: u, capture: o2, callback: i2, event: { key: void 0, keyCode: 0, modifiers: { shiftKey: false, ctrlKey: false, altKey: false, metaKey: false } } };
1275
+ this.bindedKeys[u] && console.warn('warning: duplicate keybinding for "' + u + '"'), this.bindedKeys[u] = p;
1276
+ for (var f = c2[l].toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g), d = 0; d < f.length; d++)
1277
+ if ("++" === f[d] && (f[d] = "+"), f[d] in t) {
1278
+ var h = r[t[f[d]]];
1279
+ p.event.modifiers[h] = true;
1280
+ } else
1281
+ p.event.key = n[f[d]] || f[d], f[d] in s && (p.event.keyCode = s[f[d]]);
1282
+ }
1283
+ return this;
1284
+ }
1285
+ unbind() {
1286
+ return this.selection.on(`${this.eventType}.capture.${this.namespace}`, null), this.selection.on(`${this.eventType}.bubble.${this.namespace}`, null), this;
1287
+ }
1288
+ clear() {
1289
+ return this.bindedKeys = {}, this;
1290
+ }
1291
+ off(e2, t2) {
1292
+ for (var r2 = a([].concat(e2)), n2 = 0; n2 < r2.length; n2++) {
1293
+ var s2 = r2[n2] + (true === t2 ? "-capture" : "-bubble");
1294
+ delete this.bindedKeys[s2];
1295
+ }
1296
+ return this;
1297
+ }
1298
+ }
1299
+ new i("global", document, "keydown");
1300
+ new i("global", document, "keyup");
1301
+ class KeyboardControl extends CommonCtrol {
1302
+ _onBindKeyboards(actions, namespace2) {
1303
+ this.keybinding = new i(namespace2);
1304
+ actions.forEach((o) => {
1305
+ this.keybinding.on(o.code, o.action);
1306
+ });
1307
+ }
1308
+ _onUnbindKeyboards() {
1309
+ this.keybinding.clear();
1310
+ }
1311
+ }
1312
+ function getChildNodes(menus) {
1313
+ let subNodes = [];
1314
+ menus.forEach((menu) => {
1315
+ if (menu.children && menu.children.length > 0) {
1316
+ menu.children.forEach((subMenu) => {
1317
+ subMenu.code && subNodes.push(subMenu);
1318
+ });
1319
+ } else {
1320
+ menu.code && subNodes.push(menu);
1321
+ }
1322
+ });
1323
+ return subNodes;
1324
+ }
1325
+ class ContextMenu extends KeyboardControl {
1326
+ constructor(container, props) {
1327
+ super();
1328
+ this.container = container;
1329
+ this.props = props;
1330
+ this.tempMenuElement = null;
1331
+ this.onEvents();
1332
+ }
1333
+ onEvents() {
1334
+ document.addEventListener("mouseup", () => {
1335
+ this.onEmpty();
1336
+ });
1337
+ const menus = getChildNodes(this.props.menus);
1338
+ this._onBindKeyboards([
1339
+ ...menus.map((o) => ({
1340
+ code: o.code,
1341
+ action: () => {
1342
+ o.click();
1343
+ this.onEmpty();
1344
+ }
1345
+ })),
1346
+ {
1347
+ code: "Escape",
1348
+ action: () => {
1349
+ this.onEmpty();
1350
+ }
1351
+ }
1352
+ ]);
1353
+ this.container.addEventListener("contextmenu", (e2) => {
1354
+ e2.preventDefault();
1355
+ this.props.left = e2.clientX;
1356
+ this.props.top = e2.clientY;
1357
+ this.render({ left: e2.clientX, top: e2.clientY });
1358
+ console.log(1, e2);
1359
+ });
1360
+ }
1361
+ onEmpty() {
1362
+ if (this.tempMenuElement) {
1363
+ this.tempMenuElement.remove();
1364
+ this.tempMenuElement = null;
1365
+ }
1366
+ }
1367
+ renderChild(fatherEle, record) {
1368
+ const menuItem = document.createElement("div");
1369
+ menuItem.classList.add("wbk-menu-item", "w-per-100", "f-s-c");
1370
+ menuItem.addEventListener("click", () => record.click());
1371
+ if (record.icons) {
1372
+ const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1373
+ svg.classList.add("icon");
1374
+ svg.setAttribute("viewBox", "0 0 1024 1024");
1375
+ svg.setAttribute("version", "1.1");
1376
+ svg.setAttribute("width", "13");
1377
+ svg.setAttribute("height", "13");
1378
+ record.icons.forEach((d) => {
1379
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
1380
+ path.setAttribute("d", d);
1381
+ svg.appendChild(path);
1382
+ });
1383
+ menuItem.appendChild(svg);
1384
+ }
1385
+ const span = document.createElement("span");
1386
+ span.textContent = record.name;
1387
+ menuItem.appendChild(span);
1388
+ fatherEle.appendChild(menuItem);
1389
+ }
1390
+ render({ left, top }) {
1391
+ this.onEmpty();
1392
+ if (this.props.menus.length > 0) {
1393
+ const menuElement = document.createElement("aside");
1394
+ menuElement.classList.add(
1395
+ "wbk-contextmenus",
1396
+ "z-1000",
1397
+ "o-v",
1398
+ "p-tb-5",
1399
+ "p-lr-0",
1400
+ "bg-color-fff",
1401
+ "p-a",
1402
+ "d-b",
1403
+ "c-auto"
1404
+ );
1405
+ menuElement.style.left = `${left}px`;
1406
+ menuElement.style.top = `${top}px`;
1407
+ menuElement.style.display = "block";
1408
+ this.props.menus.forEach((item) => {
1409
+ const itemElement = document.createElement("div");
1410
+ itemElement.classList.add("wbk-contextmenus-item", "p-r", "o-v");
1411
+ itemElement.dataset.id = item.id;
1412
+ if (!item.children || item.children.length === 0) {
1413
+ this.renderChild(itemElement, item);
1414
+ } else {
1415
+ const section = document.createElement("section");
1416
+ section.classList.add("wbk-menu-item", "f-s-c", "w-per-100", "h-30", "f-s-c", "c-p", "ease-400");
1417
+ section.addEventListener("click", (e2) => e2.stopPropagation());
1418
+ if (item.icons) {
1419
+ const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1420
+ svg.classList.add("icon");
1421
+ svg.setAttribute("viewBox", "0 0 1024 1024");
1422
+ svg.setAttribute("version", "1.1");
1423
+ svg.setAttribute("width", "13");
1424
+ svg.setAttribute("height", "13");
1425
+ item.icons.forEach((d) => {
1426
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
1427
+ path.setAttribute("d", d);
1428
+ svg.appendChild(path);
1429
+ });
1430
+ section.appendChild(svg);
1431
+ }
1432
+ const span = document.createElement("span");
1433
+ span.textContent = item.name;
1434
+ section.appendChild(span);
1435
+ itemElement.appendChild(section);
1436
+ const subMenuElement = document.createElement("aside");
1437
+ subMenuElement.setAttribute(
1438
+ "class",
1439
+ "wbk-contextmenus-submenu p-a-xr-yt translateX-100 bg-color-fff shadow-gray animate fadeIn ease-400 p-tb-5 p-lr-0"
1440
+ );
1441
+ subMenuElement.style.display = "none";
1442
+ item.children.forEach((subItem) => {
1443
+ const itemElement2 = document.createElement("div");
1444
+ itemElement2.classList.add("wbk-contextmenus-item", "p-r", "o-v");
1445
+ subMenuElement.appendChild(itemElement2);
1446
+ this.renderChild(itemElement2, subItem);
1447
+ });
1448
+ itemElement.appendChild(subMenuElement);
1449
+ }
1450
+ menuElement.appendChild(itemElement);
1451
+ });
1452
+ this.container.appendChild(menuElement);
1453
+ this.tempMenuElement = menuElement;
1454
+ }
1455
+ }
1456
+ }
1457
+ var index = "";
1458
+ const options$6 = {
1459
+ className: "",
1460
+ checked: false,
1461
+ disabled: false,
1462
+ indeterminate: false,
1463
+ onChange: () => {
1464
+ }
1465
+ };
1466
+ class Checkbox {
1467
+ constructor(container, e2) {
1468
+ this.options = {
1469
+ ...options$6,
1470
+ ...e2
1471
+ };
1472
+ this._container = container;
1473
+ this._wrapper = null;
1474
+ this._content = null;
1475
+ this._render();
1476
+ }
1477
+ _render() {
1478
+ const dom = document.createElement("div");
1479
+ dom.className = this._wrapperClass();
1480
+ const span = document.createElement("span");
1481
+ span.className = this._contentClass();
1482
+ dom.append(span);
1483
+ this._wrapper = dom;
1484
+ this._content = span;
1485
+ dom.onclick = () => {
1486
+ if (this.options.disabled)
1487
+ return;
1488
+ this.options.indeterminate = false;
1489
+ this.options.checked = !this.options.checked;
1490
+ dom.className = this._wrapperClass();
1491
+ span.className = this._contentClass();
1492
+ this.options.onChange && this.options.onChange(this.options);
1493
+ };
1494
+ this._container.append(dom);
1495
+ }
1496
+ _updateStatus(args) {
1497
+ this.options = {
1498
+ ...this.options,
1499
+ ...args
1500
+ };
1501
+ this._wrapper.className = this._wrapperClass();
1502
+ this._content.className = this._contentClass();
1503
+ }
1504
+ _wrapperClass() {
1505
+ let classname = `wbiokr-com-checkbox w-15 h-15 b-r-2 b-ccc ease-200 border-hover-app f-c c-p`;
1506
+ classname += !this.options.indeterminate && this.options.checked ? " bg-color-app b-c-app p-r wbiokr-com-checked " : " bg-color-fff b-c-ccc ";
1507
+ classname += this.options.className;
1508
+ return classname;
1509
+ }
1510
+ _contentClass() {
1511
+ let classname = `wbiokr-com-checkbox-content ease-300 `;
1512
+ classname += !this.options.indeterminate && this.options.checked ? " top-5 w-5 h-10 b-fff b-w-2 rotate-45 b-no-t b-no-l o-100 " : this.options.indeterminate ? " w-5 h-5 bg-color-app o-100 " : " rotate-reverse-45 b-fff b-w-2 ";
1513
+ return classname;
1514
+ }
1515
+ }
1516
+ var earthRadius = 63710088e-1;
1517
+ var factors = {
1518
+ centimeters: earthRadius * 100,
1519
+ centimetres: earthRadius * 100,
1520
+ degrees: earthRadius / 111325,
1521
+ feet: earthRadius * 3.28084,
1522
+ inches: earthRadius * 39.37,
1523
+ kilometers: earthRadius / 1e3,
1524
+ kilometres: earthRadius / 1e3,
1525
+ meters: earthRadius,
1526
+ metres: earthRadius,
1527
+ miles: earthRadius / 1609.344,
1528
+ millimeters: earthRadius * 1e3,
1529
+ millimetres: earthRadius * 1e3,
1530
+ nauticalmiles: earthRadius / 1852,
1531
+ radians: 1,
1532
+ yards: earthRadius * 1.0936
1533
+ };
1534
+ function feature(geom, properties, options2) {
1535
+ if (options2 === void 0) {
1536
+ options2 = {};
1537
+ }
1538
+ var feat = { type: "Feature" };
1539
+ if (options2.id === 0 || options2.id) {
1540
+ feat.id = options2.id;
1541
+ }
1542
+ if (options2.bbox) {
1543
+ feat.bbox = options2.bbox;
1544
+ }
1545
+ feat.properties = properties || {};
1546
+ feat.geometry = geom;
1547
+ return feat;
1548
+ }
1549
+ function polygon(coordinates, properties, options2) {
1550
+ if (options2 === void 0) {
1551
+ options2 = {};
1552
+ }
1553
+ for (var _i = 0, coordinates_1 = coordinates; _i < coordinates_1.length; _i++) {
1554
+ var ring = coordinates_1[_i];
1555
+ if (ring.length < 4) {
1556
+ throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
1557
+ }
1558
+ for (var j = 0; j < ring[ring.length - 1].length; j++) {
1559
+ if (ring[ring.length - 1][j] !== ring[0][j]) {
1560
+ throw new Error("First and last Position are not equivalent.");
1561
+ }
1562
+ }
1563
+ }
1564
+ var geom = {
1565
+ type: "Polygon",
1566
+ coordinates
1567
+ };
1568
+ return feature(geom, properties, options2);
1569
+ }
1570
+ function lineString(coordinates, properties, options2) {
1571
+ if (options2 === void 0) {
1572
+ options2 = {};
1573
+ }
1574
+ if (coordinates.length < 2) {
1575
+ throw new Error("coordinates must be an array of two or more positions");
1576
+ }
1577
+ var geom = {
1578
+ type: "LineString",
1579
+ coordinates
1580
+ };
1581
+ return feature(geom, properties, options2);
1582
+ }
1583
+ function radiansToLength(radians, units) {
1584
+ if (units === void 0) {
1585
+ units = "kilometers";
1586
+ }
1587
+ var factor = factors[units];
1588
+ if (!factor) {
1589
+ throw new Error(units + " units is invalid");
1590
+ }
1591
+ return radians * factor;
1592
+ }
1593
+ function degreesToRadians(degrees) {
1594
+ var radians = degrees % 360;
1595
+ return radians * Math.PI / 180;
1596
+ }
1597
+ function coordEach(geojson, callback, excludeWrapCoord) {
1598
+ if (geojson === null)
1599
+ return;
1600
+ var j, k, l, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === "FeatureCollection", isFeature = type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
1601
+ for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
1602
+ geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
1603
+ isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
1604
+ stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
1605
+ for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
1606
+ var multiFeatureIndex = 0;
1607
+ var geometryIndex = 0;
1608
+ geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
1609
+ if (geometry === null)
1610
+ continue;
1611
+ coords = geometry.coordinates;
1612
+ var geomType = geometry.type;
1613
+ wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
1614
+ switch (geomType) {
1615
+ case null:
1616
+ break;
1617
+ case "Point":
1618
+ if (callback(
1619
+ coords,
1620
+ coordIndex,
1621
+ featureIndex,
1622
+ multiFeatureIndex,
1623
+ geometryIndex
1624
+ ) === false)
1625
+ return false;
1626
+ coordIndex++;
1627
+ multiFeatureIndex++;
1628
+ break;
1629
+ case "LineString":
1630
+ case "MultiPoint":
1631
+ for (j = 0; j < coords.length; j++) {
1632
+ if (callback(
1633
+ coords[j],
1634
+ coordIndex,
1635
+ featureIndex,
1636
+ multiFeatureIndex,
1637
+ geometryIndex
1638
+ ) === false)
1639
+ return false;
1640
+ coordIndex++;
1641
+ if (geomType === "MultiPoint")
1642
+ multiFeatureIndex++;
1643
+ }
1644
+ if (geomType === "LineString")
1645
+ multiFeatureIndex++;
1646
+ break;
1647
+ case "Polygon":
1648
+ case "MultiLineString":
1649
+ for (j = 0; j < coords.length; j++) {
1650
+ for (k = 0; k < coords[j].length - wrapShrink; k++) {
1651
+ if (callback(
1652
+ coords[j][k],
1653
+ coordIndex,
1654
+ featureIndex,
1655
+ multiFeatureIndex,
1656
+ geometryIndex
1657
+ ) === false)
1658
+ return false;
1659
+ coordIndex++;
1660
+ }
1661
+ if (geomType === "MultiLineString")
1662
+ multiFeatureIndex++;
1663
+ if (geomType === "Polygon")
1664
+ geometryIndex++;
1665
+ }
1666
+ if (geomType === "Polygon")
1667
+ multiFeatureIndex++;
1668
+ break;
1669
+ case "MultiPolygon":
1670
+ for (j = 0; j < coords.length; j++) {
1671
+ geometryIndex = 0;
1672
+ for (k = 0; k < coords[j].length; k++) {
1673
+ for (l = 0; l < coords[j][k].length - wrapShrink; l++) {
1674
+ if (callback(
1675
+ coords[j][k][l],
1676
+ coordIndex,
1677
+ featureIndex,
1678
+ multiFeatureIndex,
1679
+ geometryIndex
1680
+ ) === false)
1681
+ return false;
1682
+ coordIndex++;
1683
+ }
1684
+ geometryIndex++;
1685
+ }
1686
+ multiFeatureIndex++;
1687
+ }
1688
+ break;
1689
+ case "GeometryCollection":
1690
+ for (j = 0; j < geometry.geometries.length; j++)
1691
+ if (coordEach(geometry.geometries[j], callback, excludeWrapCoord) === false)
1692
+ return false;
1693
+ break;
1694
+ default:
1695
+ throw new Error("Unknown Geometry Type");
1696
+ }
1697
+ }
1698
+ }
1699
+ }
1700
+ function geomEach(geojson, callback) {
1701
+ var i2, j, g, geometry, stopG, geometryMaybeCollection, isGeometryCollection, featureProperties, featureBBox, featureId, featureIndex = 0, isFeatureCollection = geojson.type === "FeatureCollection", isFeature = geojson.type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
1702
+ for (i2 = 0; i2 < stop; i2++) {
1703
+ geometryMaybeCollection = isFeatureCollection ? geojson.features[i2].geometry : isFeature ? geojson.geometry : geojson;
1704
+ featureProperties = isFeatureCollection ? geojson.features[i2].properties : isFeature ? geojson.properties : {};
1705
+ featureBBox = isFeatureCollection ? geojson.features[i2].bbox : isFeature ? geojson.bbox : void 0;
1706
+ featureId = isFeatureCollection ? geojson.features[i2].id : isFeature ? geojson.id : void 0;
1707
+ isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
1708
+ stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
1709
+ for (g = 0; g < stopG; g++) {
1710
+ geometry = isGeometryCollection ? geometryMaybeCollection.geometries[g] : geometryMaybeCollection;
1711
+ if (geometry === null) {
1712
+ if (callback(
1713
+ null,
1714
+ featureIndex,
1715
+ featureProperties,
1716
+ featureBBox,
1717
+ featureId
1718
+ ) === false)
1719
+ return false;
1720
+ continue;
1721
+ }
1722
+ switch (geometry.type) {
1723
+ case "Point":
1724
+ case "LineString":
1725
+ case "MultiPoint":
1726
+ case "Polygon":
1727
+ case "MultiLineString":
1728
+ case "MultiPolygon": {
1729
+ if (callback(
1730
+ geometry,
1731
+ featureIndex,
1732
+ featureProperties,
1733
+ featureBBox,
1734
+ featureId
1735
+ ) === false)
1736
+ return false;
1737
+ break;
1738
+ }
1739
+ case "GeometryCollection": {
1740
+ for (j = 0; j < geometry.geometries.length; j++) {
1741
+ if (callback(
1742
+ geometry.geometries[j],
1743
+ featureIndex,
1744
+ featureProperties,
1745
+ featureBBox,
1746
+ featureId
1747
+ ) === false)
1748
+ return false;
1749
+ }
1750
+ break;
1751
+ }
1752
+ default:
1753
+ throw new Error("Unknown Geometry Type");
1754
+ }
1755
+ }
1756
+ featureIndex++;
1757
+ }
1758
+ }
1759
+ function geomReduce(geojson, callback, initialValue) {
1760
+ var previousValue = initialValue;
1761
+ geomEach(
1762
+ geojson,
1763
+ function(currentGeometry, featureIndex, featureProperties, featureBBox, featureId) {
1764
+ if (featureIndex === 0 && initialValue === void 0)
1765
+ previousValue = currentGeometry;
1766
+ else
1767
+ previousValue = callback(
1768
+ previousValue,
1769
+ currentGeometry,
1770
+ featureIndex,
1771
+ featureProperties,
1772
+ featureBBox,
1773
+ featureId
1774
+ );
1775
+ }
1776
+ );
1777
+ return previousValue;
1778
+ }
1779
+ function flattenEach(geojson, callback) {
1780
+ geomEach(geojson, function(geometry, featureIndex, properties, bbox, id) {
1781
+ var type = geometry === null ? null : geometry.type;
1782
+ switch (type) {
1783
+ case null:
1784
+ case "Point":
1785
+ case "LineString":
1786
+ case "Polygon":
1787
+ if (callback(
1788
+ feature(geometry, properties, { bbox, id }),
1789
+ featureIndex,
1790
+ 0
1791
+ ) === false)
1792
+ return false;
1793
+ return;
1794
+ }
1795
+ var geomType;
1796
+ switch (type) {
1797
+ case "MultiPoint":
1798
+ geomType = "Point";
1799
+ break;
1800
+ case "MultiLineString":
1801
+ geomType = "LineString";
1802
+ break;
1803
+ case "MultiPolygon":
1804
+ geomType = "Polygon";
1805
+ break;
1806
+ }
1807
+ for (var multiFeatureIndex = 0; multiFeatureIndex < geometry.coordinates.length; multiFeatureIndex++) {
1808
+ var coordinate = geometry.coordinates[multiFeatureIndex];
1809
+ var geom = {
1810
+ type: geomType,
1811
+ coordinates: coordinate
1812
+ };
1813
+ if (callback(feature(geom, properties), featureIndex, multiFeatureIndex) === false)
1814
+ return false;
1815
+ }
1816
+ });
1817
+ }
1818
+ function segmentEach(geojson, callback) {
1819
+ flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {
1820
+ var segmentIndex = 0;
1821
+ if (!feature2.geometry)
1822
+ return;
1823
+ var type = feature2.geometry.type;
1824
+ if (type === "Point" || type === "MultiPoint")
1825
+ return;
1826
+ var previousCoords;
1827
+ var previousFeatureIndex = 0;
1828
+ var previousMultiIndex = 0;
1829
+ var prevGeomIndex = 0;
1830
+ if (coordEach(
1831
+ feature2,
1832
+ function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
1833
+ if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
1834
+ previousCoords = currentCoord;
1835
+ previousFeatureIndex = featureIndex;
1836
+ previousMultiIndex = multiPartIndexCoord;
1837
+ prevGeomIndex = geometryIndex;
1838
+ segmentIndex = 0;
1839
+ return;
1840
+ }
1841
+ var currentSegment = lineString(
1842
+ [previousCoords, currentCoord],
1843
+ feature2.properties
1844
+ );
1845
+ if (callback(
1846
+ currentSegment,
1847
+ featureIndex,
1848
+ multiFeatureIndex,
1849
+ geometryIndex,
1850
+ segmentIndex
1851
+ ) === false)
1852
+ return false;
1853
+ segmentIndex++;
1854
+ previousCoords = currentCoord;
1855
+ }
1856
+ ) === false)
1857
+ return false;
1858
+ });
1223
1859
  }
1224
- function selection_on(typename, value, options2) {
1225
- var typenames = parseTypenames(typename + ""), i, n = typenames.length, t2;
1226
- if (arguments.length < 2) {
1227
- var on = this.node().__on;
1228
- if (on)
1229
- for (var j = 0, m = on.length, o; j < m; ++j) {
1230
- for (i = 0, o = on[j]; i < n; ++i) {
1231
- if ((t2 = typenames[i]).type === o.type && t2.name === o.name) {
1232
- return o.value;
1233
- }
1234
- }
1235
- }
1236
- return;
1237
- }
1238
- on = value ? onAdd : onRemove;
1239
- for (i = 0; i < n; ++i)
1240
- this.each(on(typenames[i], value, options2));
1241
- return this;
1860
+ function segmentReduce(geojson, callback, initialValue) {
1861
+ var previousValue = initialValue;
1862
+ var started = false;
1863
+ segmentEach(
1864
+ geojson,
1865
+ function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {
1866
+ if (started === false && initialValue === void 0)
1867
+ previousValue = currentSegment;
1868
+ else
1869
+ previousValue = callback(
1870
+ previousValue,
1871
+ currentSegment,
1872
+ featureIndex,
1873
+ multiFeatureIndex,
1874
+ geometryIndex,
1875
+ segmentIndex
1876
+ );
1877
+ started = true;
1878
+ }
1879
+ );
1880
+ return previousValue;
1242
1881
  }
1243
- function dispatchEvent(node, type, params) {
1244
- var window2 = defaultView(node), event = window2.CustomEvent;
1245
- if (typeof event === "function") {
1246
- event = new event(type, params);
1247
- } else {
1248
- event = window2.document.createEvent("Event");
1249
- if (params)
1250
- event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;
1251
- else
1252
- event.initEvent(type, false, false);
1882
+ function getCoord(coord) {
1883
+ if (!coord) {
1884
+ throw new Error("coord is required");
1253
1885
  }
1254
- node.dispatchEvent(event);
1255
- }
1256
- function dispatchConstant(type, params) {
1257
- return function() {
1258
- return dispatchEvent(this, type, params);
1259
- };
1260
- }
1261
- function dispatchFunction(type, params) {
1262
- return function() {
1263
- return dispatchEvent(this, type, params.apply(this, arguments));
1264
- };
1265
- }
1266
- function selection_dispatch(type, params) {
1267
- return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type, params));
1268
- }
1269
- function* selection_iterator() {
1270
- for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
1271
- for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {
1272
- if (node = group[i])
1273
- yield node;
1886
+ if (!Array.isArray(coord)) {
1887
+ if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
1888
+ return coord.geometry.coordinates;
1889
+ }
1890
+ if (coord.type === "Point") {
1891
+ return coord.coordinates;
1274
1892
  }
1275
1893
  }
1894
+ if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
1895
+ return coord;
1896
+ }
1897
+ throw new Error("coord must be GeoJSON Point or an Array of numbers");
1276
1898
  }
1277
- var root$1 = [null];
1278
- function Selection(groups, parents) {
1279
- this._groups = groups;
1280
- this._parents = parents;
1281
- }
1282
- function selection_selection() {
1283
- return this;
1284
- }
1285
- Selection.prototype = {
1286
- constructor: Selection,
1287
- select: selection_select,
1288
- selectAll: selection_selectAll,
1289
- selectChild: selection_selectChild,
1290
- selectChildren: selection_selectChildren,
1291
- filter: selection_filter,
1292
- data: selection_data,
1293
- enter: selection_enter,
1294
- exit: selection_exit,
1295
- join: selection_join,
1296
- merge: selection_merge,
1297
- selection: selection_selection,
1298
- order: selection_order,
1299
- sort: selection_sort,
1300
- call: selection_call,
1301
- nodes: selection_nodes,
1302
- node: selection_node,
1303
- size: selection_size,
1304
- empty: selection_empty,
1305
- each: selection_each,
1306
- attr: selection_attr,
1307
- style: selection_style,
1308
- property: selection_property,
1309
- classed: selection_classed,
1310
- text: selection_text,
1311
- html: selection_html,
1312
- raise: selection_raise,
1313
- lower: selection_lower,
1314
- append: selection_append,
1315
- insert: selection_insert,
1316
- remove: selection_remove,
1317
- clone: selection_clone,
1318
- datum: selection_datum,
1319
- on: selection_on,
1320
- dispatch: selection_dispatch,
1321
- [Symbol.iterator]: selection_iterator
1322
- };
1323
- function select(selector2) {
1324
- return typeof selector2 === "string" ? new Selection([[document.querySelector(selector2)]], [document.documentElement]) : new Selection([[selector2]], root$1);
1899
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
1900
+ function distance(from, to, options2) {
1901
+ if (options2 === void 0) {
1902
+ options2 = {};
1903
+ }
1904
+ var coordinates1 = getCoord(from);
1905
+ var coordinates2 = getCoord(to);
1906
+ var dLat = degreesToRadians(coordinates2[1] - coordinates1[1]);
1907
+ var dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);
1908
+ var lat1 = degreesToRadians(coordinates1[1]);
1909
+ var lat2 = degreesToRadians(coordinates2[1]);
1910
+ var a2 = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
1911
+ return radiansToLength(2 * Math.atan2(Math.sqrt(a2), Math.sqrt(1 - a2)), options2.units);
1325
1912
  }
1326
- function t(e) {
1327
- return Array.from(new Set(e));
1913
+ var RADIUS = 6378137;
1914
+ function area(geojson) {
1915
+ return geomReduce(geojson, function(value, geom) {
1916
+ return value + calculateArea(geom);
1917
+ }, 0);
1328
1918
  }
1329
- function r(o, n) {
1330
- var a = {};
1331
- function f(e, t2) {
1332
- var r2, o2, n2 = false, f2 = Object.keys(a).map(function(e2) {
1333
- return a[e2];
1334
- });
1335
- for (r2 = 0; r2 < f2.length; r2++)
1336
- if ((o2 = f2[r2]).event.modifiers.shiftKey && !!o2.capture === t2 && s2(e, o2, true)) {
1337
- o2.callback(e), n2 = true, e.preventDefault();
1338
- break;
1339
- }
1340
- if (!n2) {
1341
- for (r2 = 0; r2 < f2.length; r2++)
1342
- if (!(o2 = f2[r2]).event.modifiers.shiftKey && !!o2.capture === t2 && s2(e, o2, false)) {
1343
- o2.callback(e), e.preventDefault();
1344
- break;
1345
- }
1346
- }
1347
- function s2(e2, t3, r3) {
1348
- var o3 = e2, n3 = false, a2 = true;
1349
- if (void 0 !== o3.key && (a2 = o3.key.charCodeAt(0) > 255, n3 = true, void 0 === t3.event.key ? n3 = false : Array.isArray(t3.event.key) ? -1 === t3.event.key.map(function(e3) {
1350
- return e3.toLowerCase();
1351
- }).indexOf(o3.key.toLowerCase()) && (n3 = false) : o3.key.toLowerCase() !== t3.event.key.toLowerCase() && (n3 = false)), n3 || !a2 && !t3.event.modifiers.shiftKey || (n3 = o3.keyCode === t3.event.keyCode), !n3)
1352
- return false;
1353
- if (!o3.ctrlKey || !o3.altKey) {
1354
- if (o3.ctrlKey !== t3.event.modifiers.ctrlKey)
1355
- return false;
1356
- if (o3.altKey !== t3.event.modifiers.altKey)
1357
- return false;
1919
+ function calculateArea(geom) {
1920
+ var total = 0;
1921
+ var i2;
1922
+ switch (geom.type) {
1923
+ case "Polygon":
1924
+ return polygonArea(geom.coordinates);
1925
+ case "MultiPolygon":
1926
+ for (i2 = 0; i2 < geom.coordinates.length; i2++) {
1927
+ total += polygonArea(geom.coordinates[i2]);
1358
1928
  }
1359
- return o3.metaKey === t3.event.modifiers.metaKey && (!r3 || o3.shiftKey === t3.event.modifiers.shiftKey);
1360
- }
1929
+ return total;
1930
+ case "Point":
1931
+ case "MultiPoint":
1932
+ case "LineString":
1933
+ case "MultiLineString":
1934
+ return 0;
1361
1935
  }
1362
- function s(e) {
1363
- f(e, true);
1936
+ return 0;
1937
+ }
1938
+ function polygonArea(coords) {
1939
+ var total = 0;
1940
+ if (coords && coords.length > 0) {
1941
+ total += Math.abs(ringArea(coords[0]));
1942
+ for (var i2 = 1; i2 < coords.length; i2++) {
1943
+ total -= Math.abs(ringArea(coords[i2]));
1944
+ }
1364
1945
  }
1365
- async function i(t2) {
1366
- var r2 = select(t2.target).node().tagName;
1367
- if ("INPUT" !== r2 && "SELECT" !== r2 && "TEXTAREA" !== r2 && "true" !== String(t2.target.getAttribute("contenteditable"))) {
1368
- if ("function" == typeof n) {
1369
- if (await n(t2))
1370
- return;
1946
+ return total;
1947
+ }
1948
+ function ringArea(coords) {
1949
+ var p1;
1950
+ var p2;
1951
+ var p3;
1952
+ var lowerIndex;
1953
+ var middleIndex;
1954
+ var upperIndex;
1955
+ var i2;
1956
+ var total = 0;
1957
+ var coordsLength = coords.length;
1958
+ if (coordsLength > 2) {
1959
+ for (i2 = 0; i2 < coordsLength; i2++) {
1960
+ if (i2 === coordsLength - 2) {
1961
+ lowerIndex = coordsLength - 2;
1962
+ middleIndex = coordsLength - 1;
1963
+ upperIndex = 0;
1964
+ } else if (i2 === coordsLength - 1) {
1965
+ lowerIndex = coordsLength - 1;
1966
+ middleIndex = 0;
1967
+ upperIndex = 1;
1968
+ } else {
1969
+ lowerIndex = i2;
1970
+ middleIndex = i2 + 1;
1971
+ upperIndex = i2 + 2;
1371
1972
  }
1372
- f(t2, false);
1373
- }
1374
- }
1375
- function c(t2) {
1376
- return (t2 = t2 || select(document)).on("keydown.capture." + o, s, true), t2.on("keydown.bubble." + o, i, false), c;
1377
- }
1378
- return c.unbind = function(t2) {
1379
- return a = [], (t2 = t2 || select(document)).on("keydown.capture." + o, null), t2.on("keydown.bubble." + o, null), c;
1380
- }, c.clear = function() {
1381
- return a = {}, c;
1382
- }, c.off = function(e, r2) {
1383
- for (var o2 = t([].concat(e)), n2 = 0; n2 < o2.length; n2++) {
1384
- var f2 = o2[n2] + (r2 ? "-capture" : "-bubble");
1385
- delete a[f2];
1386
- }
1387
- return c;
1388
- }, c.on = function(e, o2, n2) {
1389
- if ("function" != typeof o2)
1390
- return c.off(e, n2);
1391
- for (var f2 = t([].concat(e)), s2 = 0; s2 < f2.length; s2++) {
1392
- var i2 = f2[s2] + (n2 ? "-capture" : "-bubble"), u = { id: i2, capture: n2, callback: o2, event: { key: void 0, keyCode: 0, modifiers: { shiftKey: false, ctrlKey: false, altKey: false, metaKey: false } } };
1393
- a[i2] && console.warn('warning: duplicate keybinding for "' + i2 + '"'), a[i2] = u;
1394
- for (var l = f2[s2].toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g), p = 0; p < l.length; p++)
1395
- if ("++" === l[p] && (l[p] = "+"), l[p] in r.modifierCodes) {
1396
- var d = r.modifierProperties[r.modifierCodes[l[p]]];
1397
- u.event.modifiers[d] = true;
1398
- } else
1399
- u.event.key = r.keys[l[p]] || l[p], l[p] in r.keyCodes && (u.event.keyCode = r.keyCodes[l[p]]);
1400
- }
1401
- return c;
1402
- }, c;
1403
- }
1404
- r.modifierCodes = { "\u21E7": 16, shift: 16, "\u2303": 17, ctrl: 17, "\u2325": 18, alt: 18, option: 18, "\u2318": 91, meta: 91, cmd: 91, super: 91, win: 91 }, r.modifierProperties = { 16: "shiftKey", 17: "ctrlKey", 18: "altKey", 91: "metaKey" }, r.keys = { "\u232B": "Backspace", backspace: "Backspace", "\u21E5": "Tab", "\u21C6": "Tab", tab: "Tab", "\u21A9": "Enter", "\u21B5": "Enter", "\u23CE": "Enter", return: "Enter", enter: "Enter", "\u2305": "Enter", pause: "Pause", "pause-break": "Pause", "\u21EA": "CapsLock", caps: "CapsLock", "caps-lock": "CapsLock", "\u238B": ["Escape", "Esc"], escape: ["Escape", "Esc"], esc: ["Escape", "Esc"], space: [" ", "Spacebar"], "": "PageUp", pgup: "PageUp", "page-up": "PageUp", "": "PageDown", pgdown: "PageDown", "page-down": "PageDown", "\u21DF": "End", end: "End", "\u21DE": "Home", home: "Home", ins: "Insert", insert: "Insert", "\u2326": ["Delete", "Del"], del: ["Delete", "Del"], delete: ["Delete", "Del"], "\u2190": ["ArrowLeft", "Left"], left: ["ArrowLeft", "Left"], "arrow-left": ["ArrowLeft", "Left"], "\u2191": ["ArrowUp", "Up"], up: ["ArrowUp", "Up"], "arrow-up": ["ArrowUp", "Up"], "\u2192": ["ArrowRight", "Right"], right: ["ArrowRight", "Right"], "arrow-right": ["ArrowRight", "Right"], "\u2193": ["ArrowDown", "Down"], down: ["ArrowDown", "Down"], "arrow-down": ["ArrowDown", "Down"], "*": ["*", "Multiply"], star: ["*", "Multiply"], asterisk: ["*", "Multiply"], multiply: ["*", "Multiply"], "+": ["+", "Add"], plus: ["+", "Add"], "-": ["-", "Subtract"], subtract: ["-", "Subtract"], dash: ["-", "Subtract"], semicolon: ";", equals: "=", comma: ",", period: ".", "full-stop": ".", slash: "/", "forward-slash": "/", tick: "`", "back-quote": "`", "open-bracket": "[", "back-slash": "\\", "close-bracket": "]", quote: "'", apostrophe: "'", "num-0": "0", "num-1": "1", "num-2": "2", "num-3": "3", "num-4": "4", "num-5": "5", "num-6": "6", "num-7": "7", "num-8": "8", "num-9": "9", f1: "F1", f2: "F2", f3: "F3", f4: "F4", f5: "F5", f6: "F6", f7: "F7", f8: "F8", f9: "F9", f10: "F10", f11: "F11", f12: "F12", f13: "F13", f14: "F14", f15: "F15", f16: "F16", f17: "F17", f18: "F18", f19: "F19", f20: "F20", f21: "F21", f22: "F22", f23: "F23", f24: "F24", f25: "F25" }, r.keyCodes = { "\u232B": 8, backspace: 8, "\u21E5": 9, "\u21C6": 9, tab: 9, "\u21A9": 13, "\u21B5": 13, "\u23CE": 13, return: 13, enter: 13, "\u2305": 13, pause: 19, "pause-break": 19, "\u21EA": 20, caps: 20, "caps-lock": 20, "\u238B": 27, escape: 27, esc: 27, space: 32, "": 33, pgup: 33, "page-up": 33, "": 34, pgdown: 34, "page-down": 34, "\u21DF": 35, end: 35, "\u21DE": 36, home: 36, ins: 45, insert: 45, "\u2326": 46, del: 46, delete: 46, "\u2190": 37, left: 37, "arrow-left": 37, "\u2191": 38, up: 38, "arrow-up": 38, "\u2192": 39, right: 39, "arrow-right": 39, "\u2193": 40, down: 40, "arrow-down": 40, ffequals: 61, "*": 106, star: 106, asterisk: 106, multiply: 106, "+": 107, plus: 107, "-": 109, subtract: 109, "|": 124, ffplus: 171, ffminus: 173, ";": 186, semicolon: 186, "=": 187, equals: 187, ",": 188, comma: 188, dash: 189, ".": 190, period: 190, "full-stop": 190, "/": 191, slash: 191, "forward-slash": 191, "`": 192, tick: 192, "back-quote": 192, "[": 219, "open-bracket": 219, "\\": 220, "back-slash": 220, "]": 221, "close-bracket": 221, "'": 222, quote: 222, apostrophe: 222 };
1405
- for (var o = 95, n = 0; ++o < 106; )
1406
- r.keyCodes["num-" + n] = o, ++n;
1407
- for (o = 47, n = 0; ++o < 58; )
1408
- r.keyCodes[n] = o, ++n;
1409
- for (o = 111, n = 1; ++o < 136; )
1410
- r.keyCodes["f" + n] = o, ++n;
1411
- for (o = 64; ++o < 91; )
1412
- r.keyCodes[String.fromCharCode(o).toLowerCase()] = o;
1413
- class KeyboardControl extends CommonCtrol {
1414
- _onBindKeyboards(actions, namespace2) {
1415
- this.keybinding = r(namespace2);
1416
- actions.forEach((o) => {
1417
- this.keybinding.on(o.code, o.action);
1418
- });
1419
- select(document).call(this.keybinding);
1973
+ p1 = coords[lowerIndex];
1974
+ p2 = coords[middleIndex];
1975
+ p3 = coords[upperIndex];
1976
+ total += (rad(p3[0]) - rad(p1[0])) * Math.sin(rad(p2[1]));
1977
+ }
1978
+ total = total * RADIUS * RADIUS / 2;
1420
1979
  }
1421
- _onUnbindKeyboards() {
1422
- this.keybinding.clear();
1423
- select(document).call(this.keybinding.unbind);
1980
+ return total;
1981
+ }
1982
+ function rad(num) {
1983
+ return num * Math.PI / 180;
1984
+ }
1985
+ function length(geojson, options2) {
1986
+ if (options2 === void 0) {
1987
+ options2 = {};
1424
1988
  }
1989
+ return segmentReduce(geojson, function(previousValue, segment) {
1990
+ var coords = segment.geometry.coordinates;
1991
+ return previousValue + distance(coords[0], coords[1], options2);
1992
+ }, 0);
1425
1993
  }
1994
+ var commonCtrols = "";
1995
+ var control$5 = "";
1426
1996
  const options$5 = {
1427
1997
  title: "\u6D4B\u91CF\u8DDD\u79BB"
1428
1998
  };
@@ -1433,13 +2003,13 @@ const WBK_LAYER_POINTS = "WBK_LAYER_POINTS";
1433
2003
  const WBK_LAYER_LINE = "WBK_LAYER_LINE";
1434
2004
  const WBK_LAYER_MOVE = "WBK_LAYER_MOVE";
1435
2005
  class MeasureDistanceControl extends KeyboardControl {
1436
- constructor(e) {
2006
+ constructor(e2) {
1437
2007
  super();
1438
2008
  this.name = "measureDistance";
1439
2009
  this.measureFlag = false;
1440
2010
  this.options = {
1441
2011
  ...options$5,
1442
- ...e
2012
+ ...e2
1443
2013
  };
1444
2014
  this.tooltip = null;
1445
2015
  this.startEle = null;
@@ -1552,18 +2122,18 @@ class MeasureDistanceControl extends KeyboardControl {
1552
2122
  this._resetData();
1553
2123
  }
1554
2124
  _eventMeasure() {
1555
- this._map.on("click", (e) => {
2125
+ this._map.on("click", (e2) => {
1556
2126
  if (!this.flag)
1557
2127
  return;
1558
- const coord = [e.lngLat.lng, e.lngLat.lat];
2128
+ const coord = [e2.lngLat.lng, e2.lngLat.lat];
1559
2129
  this._addMeasurePoint(coord);
1560
2130
  this._addPoint(coord);
1561
2131
  this.points.push(coord);
1562
2132
  });
1563
- this._map.on("dblclick", (e) => {
2133
+ this._map.on("dblclick", (e2) => {
1564
2134
  if (!this.flag)
1565
2135
  return;
1566
- var coords = [e.lngLat.lng, e.lngLat.lat];
2136
+ var coords = [e2.lngLat.lng, e2.lngLat.lat];
1567
2137
  this._addPoint(coords);
1568
2138
  this.measureFlag = false;
1569
2139
  this._map.getCanvas().style.cursor = "";
@@ -1583,10 +2153,10 @@ class MeasureDistanceControl extends KeyboardControl {
1583
2153
  self2._close();
1584
2154
  }.bind(this);
1585
2155
  });
1586
- this._map.on("mousemove", (e) => {
2156
+ this._map.on("mousemove", (e2) => {
1587
2157
  if (!this.flag)
1588
2158
  return;
1589
- const coords = [e.lngLat.lng, e.lngLat.lat];
2159
+ const coords = [e2.lngLat.lng, e2.lngLat.lat];
1590
2160
  if (this.jsonPoint.features.length > 0) {
1591
2161
  var prev = this.jsonPoint.features[this.jsonPoint.features.length - 1];
1592
2162
  var json = {
@@ -1711,13 +2281,13 @@ const WBK_AREA_LAYER_POINTS = "WBK_AREA_LAYER_POINTS";
1711
2281
  const WBK_AREA_LAYER_FILL = "WBK_AREA_LAYER_FILL";
1712
2282
  const WBK_AREA_LAYER_STROKE = "WBK_AREA_LAYER_STROKE";
1713
2283
  class MeasureAreaControl extends KeyboardControl {
1714
- constructor(e) {
2284
+ constructor(e2) {
1715
2285
  super();
1716
2286
  this.name = "measureArea";
1717
2287
  this.measureFlag = false;
1718
2288
  this.options = {
1719
2289
  ...options$4,
1720
- ...e
2290
+ ...e2
1721
2291
  };
1722
2292
  this.tooltip = null;
1723
2293
  this.startEle = null;
@@ -1826,17 +2396,17 @@ class MeasureAreaControl extends KeyboardControl {
1826
2396
  this._resetData();
1827
2397
  }
1828
2398
  _eventMeasure() {
1829
- this._map.on("click", (e) => {
2399
+ this._map.on("click", (e2) => {
1830
2400
  if (!this.flag)
1831
2401
  return;
1832
- const coord = [e.lngLat.lng, e.lngLat.lat];
2402
+ const coord = [e2.lngLat.lng, e2.lngLat.lat];
1833
2403
  this.points.push(coord);
1834
2404
  this._addPoint(coord);
1835
2405
  });
1836
- this._map.on("dblclick", (e) => {
2406
+ this._map.on("dblclick", (e2) => {
1837
2407
  if (!this.flag)
1838
2408
  return;
1839
- const coords = [e.lngLat.lng, e.lngLat.lat];
2409
+ const coords = [e2.lngLat.lng, e2.lngLat.lat];
1840
2410
  this.points.push(coords);
1841
2411
  this.measureFlag = false;
1842
2412
  this._map.getCanvas().style.cursor = "";
@@ -1857,10 +2427,10 @@ class MeasureAreaControl extends KeyboardControl {
1857
2427
  self2._close();
1858
2428
  }.bind(this);
1859
2429
  });
1860
- this._map.on("mousemove", (e) => {
2430
+ this._map.on("mousemove", (e2) => {
1861
2431
  if (!this.flag)
1862
2432
  return;
1863
- const coords = [e.lngLat.lng, e.lngLat.lat];
2433
+ const coords = [e2.lngLat.lng, e2.lngLat.lat];
1864
2434
  const len = this.jsonPoint.features.length;
1865
2435
  if (len === 0) {
1866
2436
  this.startEle.innerHTML = "\u70B9\u51FB\u5730\u56FE\u5F00\u59CB\u6D4B\u91CF";
@@ -1967,13 +2537,13 @@ const options$3 = {
1967
2537
  }
1968
2538
  };
1969
2539
  class PickCoordControl extends KeyboardControl {
1970
- constructor(e) {
2540
+ constructor(e2) {
1971
2541
  super();
1972
2542
  this.name = "pick";
1973
2543
  this.flagValue = false;
1974
2544
  this.options = {
1975
2545
  ...options$3,
1976
- ...e
2546
+ ...e2
1977
2547
  };
1978
2548
  this.text = "\u70B9\u51FB\u67E5\u770B\u7ECF\u7EAC\u5EA6";
1979
2549
  }
@@ -2011,8 +2581,8 @@ class PickCoordControl extends KeyboardControl {
2011
2581
  this._onUnbindKeyboards();
2012
2582
  }
2013
2583
  _eventMeasure() {
2014
- this._map.on("click", (e) => {
2015
- const lngLat = e.lngLat;
2584
+ this._map.on("click", (e2) => {
2585
+ const lngLat = e2.lngLat;
2016
2586
  this.text = `${lngLat.lng},${lngLat.lat}`;
2017
2587
  this._container.querySelector(`.${this.mainClass}-main`).innerHTML = this.text;
2018
2588
  });
@@ -2029,7 +2599,7 @@ class PickCoordControl extends KeyboardControl {
2029
2599
  }
2030
2600
  _renderContent() {
2031
2601
  const main = document.createElement("main");
2032
- main.className = `${this.mainClass}-main wbiokr-ctrl-main wbiokr-ctrl-absolute`;
2602
+ main.className = `${this.mainClass}-main wbiokr-ctrl-main wbiokr-ctrl-absolute d-b l-h-30`;
2033
2603
  this._container.append(main);
2034
2604
  main.addEventListener("click", () => {
2035
2605
  if (!this.text.includes(","))
@@ -2077,14 +2647,14 @@ const options$2 = {
2077
2647
  }
2078
2648
  };
2079
2649
  class MouseRectControl extends KeyboardControl {
2080
- constructor(e) {
2650
+ constructor(e2) {
2081
2651
  super();
2082
2652
  this.name = "mouseRect";
2083
2653
  this.flagValue = false;
2084
2654
  this.moving = false;
2085
2655
  this.options = {
2086
2656
  ...options$2,
2087
- ...e
2657
+ ...e2
2088
2658
  };
2089
2659
  this.startLoc = [];
2090
2660
  this.endLoc = [];
@@ -2122,10 +2692,10 @@ class MouseRectControl extends KeyboardControl {
2122
2692
  this._onUnbindKeyboards();
2123
2693
  }
2124
2694
  _eventMeasure() {
2125
- this._map.on("click", (e) => {
2695
+ this._map.on("click", (e2) => {
2126
2696
  if (!this.flag || !this.moving)
2127
2697
  return;
2128
- const lngLat = e.lngLat;
2698
+ const lngLat = e2.lngLat;
2129
2699
  const newLoc = [lngLat.lng, lngLat.lat];
2130
2700
  let isStart = false;
2131
2701
  if (this.startLoc.length === 0) {
@@ -2141,12 +2711,12 @@ class MouseRectControl extends KeyboardControl {
2141
2711
  this.options.onEnd && this.options.onEnd({ minX, minY, maxX, maxY });
2142
2712
  }
2143
2713
  });
2144
- this._map.on("mousemove", (e) => {
2714
+ this._map.on("mousemove", (e2) => {
2145
2715
  if (!this.flag || !this.moving)
2146
2716
  return;
2147
2717
  if (!this.startLoc || this.startLoc.length === 0)
2148
2718
  return;
2149
- const lngLat = e.lngLat;
2719
+ const lngLat = e2.lngLat;
2150
2720
  const newLoc = [lngLat.lng, lngLat.lat];
2151
2721
  this.endLoc = newLoc;
2152
2722
  const minX = Math.min(this.startLoc[0], this.endLoc[0]);
@@ -2168,7 +2738,7 @@ class MouseRectControl extends KeyboardControl {
2168
2738
  ]
2169
2739
  }
2170
2740
  });
2171
- this.options.onMousemove && this.options.onMousemove(e);
2741
+ this.options.onMousemove && this.options.onMousemove(e2);
2172
2742
  });
2173
2743
  }
2174
2744
  _open() {
@@ -2280,20 +2850,20 @@ const options$1 = {
2280
2850
  }
2281
2851
  };
2282
2852
  class PositionControl extends KeyboardControl {
2283
- constructor(e = {}) {
2853
+ constructor(e2 = {}) {
2284
2854
  super();
2285
2855
  this.name = "positionControl";
2286
2856
  this.flagValue = false;
2287
2857
  this.options = {
2288
2858
  ...options$1,
2289
- ...e,
2859
+ ...e2,
2290
2860
  layout: {
2291
2861
  ...options$1.layout,
2292
- ...e.layout
2862
+ ...e2.layout
2293
2863
  },
2294
2864
  paint: {
2295
2865
  ...options$1.paint,
2296
- ...e.paint
2866
+ ...e2.paint
2297
2867
  }
2298
2868
  };
2299
2869
  this.value = "";
@@ -2498,20 +3068,20 @@ class PositionControl extends KeyboardControl {
2498
3068
  }
2499
3069
  const ul = this._container.querySelector("ul");
2500
3070
  ul.innerHTML = "";
2501
- for (let i = 0; i < newLocs.length; i++) {
3071
+ for (let i2 = 0; i2 < newLocs.length; i2++) {
2502
3072
  const li = document.createElement("li");
2503
3073
  li.className = "f-s-c h-35 c-p w-per-100 white-1";
2504
- li.setAttribute("data-index", i);
2505
- li.setAttribute("title", newLocs[i].toString());
3074
+ li.setAttribute("data-index", i2);
3075
+ li.setAttribute("title", newLocs[i2].toString());
2506
3076
  const tag = document.createElement("span");
2507
- tag.innerText = `\u70B9${i + 1}`;
3077
+ tag.innerText = `\u70B9${i2 + 1}`;
2508
3078
  tag.className = "wbiokr-position-tag f-s-0 m-r-10 ease-400 p-e-none f-c";
2509
- tag.setAttribute("data-index", i);
3079
+ tag.setAttribute("data-index", i2);
2510
3080
  li.append(tag);
2511
3081
  const span = document.createElement("span");
2512
- span.innerText = newLocs[i].toString();
3082
+ span.innerText = newLocs[i2].toString();
2513
3083
  span.className = "wbiokr-position-loc f-1 f-s-c white-1 c-hover-app ease-300 p-e-none";
2514
- span.setAttribute("data-index", i);
3084
+ span.setAttribute("data-index", i2);
2515
3085
  li.append(span);
2516
3086
  ul.append(li);
2517
3087
  }
@@ -2519,7 +3089,7 @@ class PositionControl extends KeyboardControl {
2519
3089
  }
2520
3090
  _coords() {
2521
3091
  const locs = coordListByStr(this.getterValue);
2522
- const newLocs = [...new Set(locs.map((a) => a.join(",")))].map((s) => s.split(","));
3092
+ const newLocs = [...new Set(locs.map((a2) => a2.join(",")))].map((s2) => s2.split(","));
2523
3093
  if (newLocs.length < locs.length)
2524
3094
  this.options.onMini && this.options.onMini();
2525
3095
  return newLocs;
@@ -2543,8 +3113,8 @@ class PositionControl extends KeyboardControl {
2543
3113
  posBtn.innerText = "\u5B9A\u4F4D";
2544
3114
  posBtn.className = "c-app o-hover-70 ease-300";
2545
3115
  const _self = this;
2546
- posBtn.onclick = function(e) {
2547
- e.preventDefault();
3116
+ posBtn.onclick = function(e2) {
3117
+ e2.preventDefault();
2548
3118
  _self._navigate();
2549
3119
  };
2550
3120
  div.append(posBtn);
@@ -2567,8 +3137,8 @@ class PositionControl extends KeyboardControl {
2567
3137
  textarea.className = "w-per-100 h-per-100 p-10 ease-300";
2568
3138
  textarea.placeholder = "\u591A\u4E2A\u5750\u6807\u8BF7\u4F7F\u7528\u6362\u884C\u6216\u5206\u53F7(\u82F1\u6587)\u9694\u5F00, \u652F\u6301\u5EA6\u5750\u6807\u4E0E\u79D2\u5750\u6807";
2569
3139
  const self2 = this;
2570
- textarea.onchange = function(e) {
2571
- self2.getterValue = e.target.value;
3140
+ textarea.onchange = function(e2) {
3141
+ self2.getterValue = e2.target.value;
2572
3142
  };
2573
3143
  section.append(textarea);
2574
3144
  return section;
@@ -2577,8 +3147,8 @@ class PositionControl extends KeyboardControl {
2577
3147
  const ul = document.createElement("ul");
2578
3148
  ul.className = "d-b p-10 o-a h-max-200 ease-300";
2579
3149
  const self2 = this;
2580
- ul.onclick = function(e) {
2581
- const idx = e.target.getAttribute("data-index");
3150
+ ul.onclick = function(e2) {
3151
+ const idx = e2.target.getAttribute("data-index");
2582
3152
  self2.current = idx;
2583
3153
  };
2584
3154
  return ul;
@@ -2822,13 +3392,13 @@ const options = {
2822
3392
  }
2823
3393
  };
2824
3394
  class LayerTreeControl extends KeyboardControl {
2825
- constructor(e) {
3395
+ constructor(e2) {
2826
3396
  super();
2827
3397
  this.name = "layersTree";
2828
3398
  this.flagValue = false;
2829
3399
  this.options = {
2830
3400
  ...options,
2831
- ...e
3401
+ ...e2
2832
3402
  };
2833
3403
  this.layerData = [];
2834
3404
  this._getterLayer = this._getterLayer.bind(this);
@@ -2840,7 +3410,7 @@ class LayerTreeControl extends KeyboardControl {
2840
3410
  get allLayers() {
2841
3411
  let layers = [];
2842
3412
  this.layerData.forEach((o) => layers = [...layers, ...o.children]);
2843
- layers.sort((a, b) => a.zIndex - b.zIndex);
3413
+ layers.sort((a2, b) => a2.zIndex - b.zIndex);
2844
3414
  return layers;
2845
3415
  }
2846
3416
  get flag() {
@@ -2971,7 +3541,7 @@ class LayerTreeControl extends KeyboardControl {
2971
3541
  } else {
2972
3542
  if (((_a = layer.sourceConfig.tiles) == null ? void 0 : _a.length) > 0 && !this._map.getSource(sourceId)) {
2973
3543
  const tiles = layer.sourceConfig.tiles.map(
2974
- (s) => s.replace(/bbox={bbox}|BBOX={bbox}|BBOX={BBOX}|bbox={BBOX}/, "bbox={bbox-epsg-3857}")
3544
+ (s2) => s2.replace(/bbox={bbox}|BBOX={bbox}|BBOX={BBOX}|bbox={BBOX}/, "bbox={bbox-epsg-3857}")
2975
3545
  );
2976
3546
  const beforeId = ["raster", "background"].includes(layer.sourceConfig.type) ? this._firstFactorId() : void 0;
2977
3547
  this._map.addSource(
@@ -3029,8 +3599,8 @@ class LayerTreeControl extends KeyboardControl {
3029
3599
  const children2 = layer.children || [];
3030
3600
  let flagCheck = false;
3031
3601
  let flagNoCheck = false;
3032
- for (let i = 0; i < children2.length; i++) {
3033
- const flag = children2[i].checked;
3602
+ for (let i2 = 0; i2 < children2.length; i2++) {
3603
+ const flag = children2[i2].checked;
3034
3604
  if (flag) {
3035
3605
  flagCheck = true;
3036
3606
  } else {
@@ -3043,8 +3613,8 @@ class LayerTreeControl extends KeyboardControl {
3043
3613
  const children2 = layer.children || [];
3044
3614
  if (children2.length === 0)
3045
3615
  return layer.checked;
3046
- for (let i = 0; i < children2.length; i++) {
3047
- if (!children2[i].checked)
3616
+ for (let i2 = 0; i2 < children2.length; i2++) {
3617
+ if (!children2[i2].checked)
3048
3618
  return false;
3049
3619
  }
3050
3620
  return true;
@@ -3129,7 +3699,7 @@ class LayerTreeControl extends KeyboardControl {
3129
3699
  tag.className = "f-s-12 ";
3130
3700
  tag.innerText = c.title;
3131
3701
  li.append(tag);
3132
- li.onclick = (e) => {
3702
+ li.onclick = (e2) => {
3133
3703
  c.checked = !c.checked;
3134
3704
  if (c.radio && c.checked) {
3135
3705
  o.children.forEach((d, index2) => {
@@ -3169,10 +3739,4 @@ class LayerTreeControl extends KeyboardControl {
3169
3739
  });
3170
3740
  }
3171
3741
  }
3172
- const install = (app) => {
3173
- components.forEach((component) => app.component(component.__name, component));
3174
- };
3175
- const Ui = {
3176
- install
3177
- };
3178
- export { Checkbox, LayerTreeControl, MeasureAreaControl, MeasureDistanceControl, MouseRectControl, PickCoordControl, PositionControl, copyContent, createUuid, Ui as default, mercatorToLnglat, transformRequest4326 };
3742
+ export { Checkbox, ContextMenu, Component$1 as Geoserver, Component as GeoserverAside, LayerTreeControl, MeasureAreaControl, MeasureDistanceControl, MouseRectControl, PickCoordControl, PositionControl, copyContent, createUuid, mercatorToLnglat, transformRequest4326 };