mapboxgl-tools 2.0.1 → 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,4 +1,5 @@
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";
1
+ import "vue";
2
+ import "@wbiokr/css-class";
2
3
  import { coordListByStr } from "@wbiokr/geo";
3
4
  function createUuid(num) {
4
5
  function S4() {
@@ -38,1384 +39,1960 @@ 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, e2) {
52
- this.options = {
53
- ...options$6,
54
- ...e2
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;
176
- }
177
- function degreesToRadians(degrees) {
178
- var radians = degrees % 360;
179
- return radians * Math.PI / 180;
560
+ return new Selection(subgroups, parents);
180
561
  }
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");
280
- }
281
- }
282
- }
562
+ function matcher(selector2) {
563
+ return function() {
564
+ return this.matches(selector2);
565
+ };
283
566
  }
284
- function geomEach(geojson, callback) {
285
- 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;
286
- for (i2 = 0; i2 < stop; i2++) {
287
- geometryMaybeCollection = isFeatureCollection ? geojson.features[i2].geometry : isFeature ? geojson.geometry : geojson;
288
- featureProperties = isFeatureCollection ? geojson.features[i2].properties : isFeature ? geojson.properties : {};
289
- featureBBox = isFeatureCollection ? geojson.features[i2].bbox : isFeature ? geojson.bbox : void 0;
290
- featureId = isFeatureCollection ? geojson.features[i2].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");
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);
338
603
  }
339
604
  }
340
- featureIndex++;
341
605
  }
606
+ return new Selection(subgroups, this._parents);
342
607
  }
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
- );
359
- }
360
- );
361
- return previousValue;
608
+ function sparse(update) {
609
+ return new Array(update.length);
362
610
  }
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;
378
- }
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;
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);
634
+ }
635
+ };
636
+ function constant(x) {
637
+ return function() {
638
+ return x;
639
+ };
640
+ }
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]);
390
649
  }
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;
650
+ }
651
+ for (; i2 < groupLength; ++i2) {
652
+ if (node = group[i2]) {
653
+ exit[i2] = node;
399
654
  }
400
- });
655
+ }
401
656
  }
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;
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);
439
666
  }
440
- ) === false)
441
- return false;
442
- });
443
- }
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
667
  }
463
- );
464
- return previousValue;
465
- }
466
- function getCoord(coord) {
467
- if (!coord) {
468
- throw new Error("coord is required");
469
668
  }
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;
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]);
476
677
  }
477
678
  }
478
- if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
479
- return coord;
679
+ for (i2 = 0; i2 < groupLength; ++i2) {
680
+ if ((node = group[i2]) && nodeByKeyValue.get(keyValues[i2]) === node) {
681
+ exit[i2] = node;
682
+ }
480
683
  }
481
- throw new Error("coord must be GeoJSON Point or an Array of numbers");
482
684
  }
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 = {};
685
+ function datum(node) {
686
+ return node.__data__;
687
+ }
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
+ }
705
+ }
487
706
  }
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 a2 = 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(a2), Math.sqrt(1 - a2)), options2.units);
707
+ update = new Selection(update, parents);
708
+ update._enter = enter;
709
+ update._exit = exit;
710
+ return update;
496
711
  }
497
- var RADIUS = 6378137;
498
- function area(geojson) {
499
- return geomReduce(geojson, function(value, geom) {
500
- return value + calculateArea(geom);
501
- }, 0);
712
+ function arraylike(data) {
713
+ return typeof data === "object" && "length" in data ? data : Array.from(data);
502
714
  }
503
- function calculateArea(geom) {
504
- var total = 0;
505
- var i2;
506
- switch (geom.type) {
507
- case "Polygon":
508
- return polygonArea(geom.coordinates);
509
- case "MultiPolygon":
510
- for (i2 = 0; i2 < geom.coordinates.length; i2++) {
511
- total += polygonArea(geom.coordinates[i2]);
512
- }
513
- return total;
514
- case "Point":
515
- case "MultiPoint":
516
- case "LineString":
517
- case "MultiLineString":
518
- return 0;
715
+ function selection_exit() {
716
+ return new Selection(this._exit || this._groups.map(sparse), this._parents);
717
+ }
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 + "");
726
+ }
727
+ if (onupdate != null) {
728
+ update = onupdate(update);
729
+ if (update)
730
+ update = update.selection();
731
+ }
732
+ if (onexit == null)
733
+ exit.remove();
734
+ else
735
+ onexit(exit);
736
+ return enter && update ? enter.merge(update).order() : update;
737
+ }
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;
744
+ }
745
+ }
519
746
  }
520
- return 0;
747
+ for (; j < m0; ++j) {
748
+ merges[j] = groups0[j];
749
+ }
750
+ return new Selection(merges, this._parents);
521
751
  }
522
- function polygonArea(coords) {
523
- var total = 0;
524
- if (coords && coords.length > 0) {
525
- total += Math.abs(ringArea(coords[0]));
526
- for (var i2 = 1; i2 < coords.length; i2++) {
527
- total -= Math.abs(ringArea(coords[i2]));
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
+ }
528
760
  }
529
761
  }
530
- return total;
762
+ return this;
531
763
  }
532
- function ringArea(coords) {
533
- var p1;
534
- var p2;
535
- var p3;
536
- var lowerIndex;
537
- var middleIndex;
538
- var upperIndex;
539
- var i2;
540
- var total = 0;
541
- var coordsLength = coords.length;
542
- if (coordsLength > 2) {
543
- for (i2 = 0; i2 < coordsLength; i2++) {
544
- if (i2 === coordsLength - 2) {
545
- lowerIndex = coordsLength - 2;
546
- middleIndex = coordsLength - 1;
547
- upperIndex = 0;
548
- } else if (i2 === coordsLength - 1) {
549
- lowerIndex = coordsLength - 1;
550
- middleIndex = 0;
551
- upperIndex = 1;
552
- } else {
553
- lowerIndex = i2;
554
- middleIndex = i2 + 1;
555
- upperIndex = i2 + 2;
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;
769
+ }
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;
556
774
  }
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
775
  }
562
- total = total * RADIUS * RADIUS / 2;
776
+ sortgroup.sort(compareNode);
563
777
  }
564
- return total;
778
+ return new Selection(sortgroups, this._parents).order();
565
779
  }
566
- function rad(num) {
567
- return num * Math.PI / 180;
780
+ function ascending(a2, b) {
781
+ return a2 < b ? -1 : a2 > b ? 1 : a2 >= b ? 0 : NaN;
568
782
  }
569
- function length(geojson, options2) {
570
- if (options2 === void 0) {
571
- options2 = {};
783
+ function selection_call() {
784
+ var callback = arguments[0];
785
+ arguments[0] = this;
786
+ callback.apply(null, arguments);
787
+ return this;
788
+ }
789
+ function selection_nodes() {
790
+ return Array.from(this);
791
+ }
792
+ function selection_node() {
793
+ for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
794
+ for (var group = groups[j], i2 = 0, n2 = group.length; i2 < n2; ++i2) {
795
+ var node = group[i2];
796
+ if (node)
797
+ return node;
798
+ }
572
799
  }
573
- return segmentReduce(geojson, function(previousValue, segment) {
574
- var coords = segment.geometry.coordinates;
575
- return previousValue + distance(coords[0], coords[1], options2);
576
- }, 0);
800
+ return null;
577
801
  }
578
- var commonCtrols = "";
579
- var control$5 = "";
580
- class CommonCtrol {
581
- _onOpen() {
582
- this._container.className += " wbiokr-ctrl-active";
802
+ function selection_size() {
803
+ let size = 0;
804
+ for (const node of this)
805
+ ++size;
806
+ return size;
807
+ }
808
+ function selection_empty() {
809
+ return !this.node();
810
+ }
811
+ function selection_each(callback) {
812
+ for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
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);
816
+ }
583
817
  }
584
- _onClose() {
585
- this._container.className = this._container.className.replaceAll("wbiokr-ctrl-active", "");
818
+ return this;
819
+ }
820
+ function attrRemove(name) {
821
+ return function() {
822
+ this.removeAttribute(name);
823
+ };
824
+ }
825
+ function attrRemoveNS(fullname) {
826
+ return function() {
827
+ this.removeAttributeNS(fullname.space, fullname.local);
828
+ };
829
+ }
830
+ function attrConstant(name, value) {
831
+ return function() {
832
+ this.setAttribute(name, value);
833
+ };
834
+ }
835
+ function attrConstantNS(fullname, value) {
836
+ return function() {
837
+ this.setAttributeNS(fullname.space, fullname.local, value);
838
+ };
839
+ }
840
+ function attrFunction(name, value) {
841
+ return function() {
842
+ var v = value.apply(this, arguments);
843
+ if (v == null)
844
+ this.removeAttribute(name);
845
+ else
846
+ this.setAttribute(name, v);
847
+ };
848
+ }
849
+ function attrFunctionNS(fullname, value) {
850
+ return function() {
851
+ var v = value.apply(this, arguments);
852
+ if (v == null)
853
+ this.removeAttributeNS(fullname.space, fullname.local);
854
+ else
855
+ this.setAttributeNS(fullname.space, fullname.local, v);
856
+ };
857
+ }
858
+ function selection_attr(name, value) {
859
+ var fullname = namespace(name);
860
+ if (arguments.length < 2) {
861
+ var node = this.node();
862
+ return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname);
586
863
  }
864
+ return this.each((value == null ? fullname.local ? attrRemoveNS : attrRemove : typeof value === "function" ? fullname.local ? attrFunctionNS : attrFunction : fullname.local ? attrConstantNS : attrConstant)(fullname, value));
587
865
  }
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/"
866
+ function defaultView(node) {
867
+ return node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView;
868
+ }
869
+ function styleRemove(name) {
870
+ return function() {
871
+ this.style.removeProperty(name);
872
+ };
873
+ }
874
+ function styleConstant(name, value, priority) {
875
+ return function() {
876
+ this.style.setProperty(name, value, priority);
877
+ };
878
+ }
879
+ function styleFunction(name, value, priority) {
880
+ return function() {
881
+ var v = value.apply(this, arguments);
882
+ if (v == null)
883
+ this.style.removeProperty(name);
884
+ else
885
+ this.style.setProperty(name, v, priority);
886
+ };
887
+ }
888
+ function selection_style(name, value, priority) {
889
+ return arguments.length > 1 ? this.each((value == null ? styleRemove : typeof value === "function" ? styleFunction : styleConstant)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name);
890
+ }
891
+ function styleValue(node, name) {
892
+ return node.style.getPropertyValue(name) || defaultView(node).getComputedStyle(node, null).getPropertyValue(name);
893
+ }
894
+ function propertyRemove(name) {
895
+ return function() {
896
+ delete this[name];
897
+ };
898
+ }
899
+ function propertyConstant(name, value) {
900
+ return function() {
901
+ this[name] = value;
902
+ };
903
+ }
904
+ function propertyFunction(name, value) {
905
+ return function() {
906
+ var v = value.apply(this, arguments);
907
+ if (v == null)
908
+ delete this[name];
909
+ else
910
+ this[name] = v;
911
+ };
912
+ }
913
+ function selection_property(name, value) {
914
+ return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name, value)) : this.node()[name];
915
+ }
916
+ function classArray(string) {
917
+ return string.trim().split(/^|\s+/);
918
+ }
919
+ function classList(node) {
920
+ return node.classList || new ClassList(node);
921
+ }
922
+ function ClassList(node) {
923
+ this._node = node;
924
+ this._names = classArray(node.getAttribute("class") || "");
925
+ }
926
+ ClassList.prototype = {
927
+ add: function(name) {
928
+ var i2 = this._names.indexOf(name);
929
+ if (i2 < 0) {
930
+ this._names.push(name);
931
+ this._node.setAttribute("class", this._names.join(" "));
932
+ }
933
+ },
934
+ remove: function(name) {
935
+ var i2 = this._names.indexOf(name);
936
+ if (i2 >= 0) {
937
+ this._names.splice(i2, 1);
938
+ this._node.setAttribute("class", this._names.join(" "));
939
+ }
940
+ },
941
+ contains: function(name) {
942
+ return this._names.indexOf(name) >= 0;
943
+ }
595
944
  };
596
- function namespace(name) {
597
- var prefix = name += "", i2 = prefix.indexOf(":");
598
- if (i2 >= 0 && (prefix = name.slice(0, i2)) !== "xmlns")
599
- name = name.slice(i2 + 1);
600
- return namespaces.hasOwnProperty(prefix) ? { space: namespaces[prefix], local: name } : name;
945
+ function classedAdd(node, names) {
946
+ var list = classList(node), i2 = -1, n2 = names.length;
947
+ while (++i2 < n2)
948
+ list.add(names[i2]);
601
949
  }
602
- function creatorInherit(name) {
950
+ function classedRemove(node, names) {
951
+ var list = classList(node), i2 = -1, n2 = names.length;
952
+ while (++i2 < n2)
953
+ list.remove(names[i2]);
954
+ }
955
+ function classedTrue(names) {
603
956
  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);
957
+ classedAdd(this, names);
606
958
  };
607
959
  }
608
- function creatorFixed(fullname) {
960
+ function classedFalse(names) {
609
961
  return function() {
610
- return this.ownerDocument.createElementNS(fullname.space, fullname.local);
962
+ classedRemove(this, names);
611
963
  };
612
964
  }
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);
965
+ function classedFunction(names, value) {
966
+ return function() {
967
+ (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
622
968
  };
623
969
  }
624
- function selection_select(select) {
625
- if (typeof select !== "function")
626
- select = selector(select);
627
- for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
628
- for (var group = groups[j], n2 = group.length, subgroup = subgroups[j] = new Array(n2), node, subnode, i2 = 0; i2 < n2; ++i2) {
629
- if ((node = group[i2]) && (subnode = select.call(node, node.__data__, i2, group))) {
630
- if ("__data__" in node)
631
- subnode.__data__ = node.__data__;
632
- subgroup[i2] = subnode;
633
- }
634
- }
970
+ function selection_classed(name, value) {
971
+ var names = classArray(name + "");
972
+ if (arguments.length < 2) {
973
+ var list = classList(this.node()), i2 = -1, n2 = names.length;
974
+ while (++i2 < n2)
975
+ if (!list.contains(names[i2]))
976
+ return false;
977
+ return true;
635
978
  }
636
- return new Selection(subgroups, this._parents);
637
- }
638
- function array(x) {
639
- return x == null ? [] : Array.isArray(x) ? x : Array.from(x);
979
+ return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value));
640
980
  }
641
- function empty() {
642
- return [];
981
+ function textRemove() {
982
+ this.textContent = "";
643
983
  }
644
- function selectorAll(selector2) {
645
- return selector2 == null ? empty : function() {
646
- return this.querySelectorAll(selector2);
984
+ function textConstant(value) {
985
+ return function() {
986
+ this.textContent = value;
647
987
  };
648
988
  }
649
- function arrayAll(select) {
989
+ function textFunction(value) {
650
990
  return function() {
651
- return array(select.apply(this, arguments));
991
+ var v = value.apply(this, arguments);
992
+ this.textContent = v == null ? "" : v;
652
993
  };
653
994
  }
654
- function selection_selectAll(select) {
655
- if (typeof select === "function")
656
- select = arrayAll(select);
657
- else
658
- select = selectorAll(select);
659
- for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
660
- for (var group = groups[j], n2 = group.length, node, i2 = 0; i2 < n2; ++i2) {
661
- if (node = group[i2]) {
662
- subgroups.push(select.call(node, node.__data__, i2, group));
663
- parents.push(node);
664
- }
665
- }
666
- }
667
- return new Selection(subgroups, parents);
995
+ function selection_text(value) {
996
+ return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction : textConstant)(value)) : this.node().textContent;
668
997
  }
669
- function matcher(selector2) {
670
- return function() {
671
- return this.matches(selector2);
672
- };
998
+ function htmlRemove() {
999
+ this.innerHTML = "";
673
1000
  }
674
- function childMatcher(selector2) {
675
- return function(node) {
676
- return node.matches(selector2);
1001
+ function htmlConstant(value) {
1002
+ return function() {
1003
+ this.innerHTML = value;
677
1004
  };
678
1005
  }
679
- var find = Array.prototype.find;
680
- function childFind(match) {
1006
+ function htmlFunction(value) {
681
1007
  return function() {
682
- return find.call(this.children, match);
1008
+ var v = value.apply(this, arguments);
1009
+ this.innerHTML = v == null ? "" : v;
683
1010
  };
684
1011
  }
685
- function childFirst() {
686
- return this.firstElementChild;
1012
+ function selection_html(value) {
1013
+ return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML;
687
1014
  }
688
- function selection_selectChild(match) {
689
- return this.select(match == null ? childFirst : childFind(typeof match === "function" ? match : childMatcher(match)));
1015
+ function raise() {
1016
+ if (this.nextSibling)
1017
+ this.parentNode.appendChild(this);
690
1018
  }
691
- var filter = Array.prototype.filter;
692
- function children() {
693
- return Array.from(this.children);
1019
+ function selection_raise() {
1020
+ return this.each(raise);
694
1021
  }
695
- function childrenFilter(match) {
696
- return function() {
697
- return filter.call(this.children, match);
1022
+ function lower() {
1023
+ if (this.previousSibling)
1024
+ this.parentNode.insertBefore(this, this.parentNode.firstChild);
1025
+ }
1026
+ function selection_lower() {
1027
+ return this.each(lower);
1028
+ }
1029
+ function selection_append(name) {
1030
+ var create = typeof name === "function" ? name : creator(name);
1031
+ return this.select(function() {
1032
+ return this.appendChild(create.apply(this, arguments));
1033
+ });
1034
+ }
1035
+ function constantNull() {
1036
+ return null;
1037
+ }
1038
+ function selection_insert(name, before) {
1039
+ var create = typeof name === "function" ? name : creator(name), select = before == null ? constantNull : typeof before === "function" ? before : selector(before);
1040
+ return this.select(function() {
1041
+ return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);
1042
+ });
1043
+ }
1044
+ function remove() {
1045
+ var parent = this.parentNode;
1046
+ if (parent)
1047
+ parent.removeChild(this);
1048
+ }
1049
+ function selection_remove() {
1050
+ return this.each(remove);
1051
+ }
1052
+ function selection_cloneShallow() {
1053
+ var clone = this.cloneNode(false), parent = this.parentNode;
1054
+ return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
1055
+ }
1056
+ function selection_cloneDeep() {
1057
+ var clone = this.cloneNode(true), parent = this.parentNode;
1058
+ return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
1059
+ }
1060
+ function selection_clone(deep) {
1061
+ return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
1062
+ }
1063
+ function selection_datum(value) {
1064
+ return arguments.length ? this.property("__data__", value) : this.node().__data__;
1065
+ }
1066
+ function contextListener(listener) {
1067
+ return function(event) {
1068
+ listener.call(this, event, this.__data__);
698
1069
  };
699
1070
  }
700
- function selection_selectChildren(match) {
701
- return this.selectAll(match == null ? children : childrenFilter(typeof match === "function" ? match : childMatcher(match)));
1071
+ function parseTypenames(typenames) {
1072
+ return typenames.trim().split(/^|\s+/).map(function(t2) {
1073
+ var name = "", i2 = t2.indexOf(".");
1074
+ if (i2 >= 0)
1075
+ name = t2.slice(i2 + 1), t2 = t2.slice(0, i2);
1076
+ return { type: t2, name };
1077
+ });
702
1078
  }
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], n2 = group.length, subgroup = subgroups[j] = [], node, i2 = 0; i2 < n2; ++i2) {
708
- if ((node = group[i2]) && match.call(node, node.__data__, i2, group)) {
709
- subgroup.push(node);
1079
+ function onRemove(typename) {
1080
+ return function() {
1081
+ var on = this.__on;
1082
+ if (!on)
1083
+ return;
1084
+ for (var j = 0, i2 = -1, m = on.length, o; j < m; ++j) {
1085
+ if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {
1086
+ this.removeEventListener(o.type, o.listener, o.options);
1087
+ } else {
1088
+ on[++i2] = o;
710
1089
  }
711
1090
  }
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);
1091
+ if (++i2)
1092
+ on.length = i2;
1093
+ else
1094
+ delete this.__on;
1095
+ };
720
1096
  }
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;
1097
+ function onAdd(typename, value, options2) {
1098
+ return function() {
1099
+ var on = this.__on, o, listener = contextListener(value);
1100
+ if (on)
1101
+ for (var j = 0, m = on.length; j < m; ++j) {
1102
+ if ((o = on[j]).type === typename.type && o.name === typename.name) {
1103
+ this.removeEventListener(o.type, o.listener, o.options);
1104
+ this.addEventListener(o.type, o.listener = listener, o.options = options2);
1105
+ o.value = value;
1106
+ return;
1107
+ }
1108
+ }
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
+ };
727
1116
  }
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);
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);
741
1146
  }
742
- };
743
- function constant(x) {
1147
+ node.dispatchEvent(event);
1148
+ }
1149
+ function dispatchConstant(type, params) {
744
1150
  return function() {
745
- return x;
1151
+ return dispatchEvent(this, type, params);
746
1152
  };
747
1153
  }
748
- function bindIndex(parent, group, enter, update, exit, data) {
749
- var i2 = 0, node, groupLength = group.length, dataLength = data.length;
750
- for (; i2 < dataLength; ++i2) {
751
- if (node = group[i2]) {
752
- node.__data__ = data[i2];
753
- update[i2] = node;
754
- } else {
755
- enter[i2] = new EnterNode(parent, data[i2]);
756
- }
757
- }
758
- for (; i2 < groupLength; ++i2) {
759
- if (node = group[i2]) {
760
- exit[i2] = node;
761
- }
762
- }
1154
+ function dispatchFunction(type, params) {
1155
+ return function() {
1156
+ return dispatchEvent(this, type, params.apply(this, arguments));
1157
+ };
763
1158
  }
764
- function bindKey(parent, group, enter, update, exit, data, key) {
765
- var i2, node, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue;
766
- for (i2 = 0; i2 < groupLength; ++i2) {
767
- if (node = group[i2]) {
768
- keyValues[i2] = keyValue = key.call(node, node.__data__, i2, group) + "";
769
- if (nodeByKeyValue.has(keyValue)) {
770
- exit[i2] = node;
771
- } else {
772
- nodeByKeyValue.set(keyValue, node);
773
- }
774
- }
775
- }
776
- for (i2 = 0; i2 < dataLength; ++i2) {
777
- keyValue = key.call(parent, data[i2], i2, data) + "";
778
- if (node = nodeByKeyValue.get(keyValue)) {
779
- update[i2] = node;
780
- node.__data__ = data[i2];
781
- nodeByKeyValue.delete(keyValue);
782
- } else {
783
- enter[i2] = new EnterNode(parent, data[i2]);
784
- }
785
- }
786
- for (i2 = 0; i2 < groupLength; ++i2) {
787
- if ((node = group[i2]) && nodeByKeyValue.get(keyValues[i2]) === node) {
788
- exit[i2] = node;
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;
789
1167
  }
790
1168
  }
791
1169
  }
792
- function datum(node) {
793
- return node.__data__;
1170
+ var root$1 = [null];
1171
+ function Selection(groups, parents) {
1172
+ this._groups = groups;
1173
+ this._parents = parents;
794
1174
  }
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;
1175
+ function selection_selection() {
1176
+ return this;
818
1177
  }
819
- function arraylike(data) {
820
- return typeof data === "object" && "length" in data ? data : Array.from(data);
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);
821
1218
  }
822
- function selection_exit() {
823
- return new Selection(this._exit || this._groups.map(sparse), this._parents);
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));
824
1222
  }
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 + "");
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();
833
1228
  }
834
- if (onupdate != null) {
835
- update = onupdate(update);
836
- if (update)
837
- update = update.selection();
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;
838
1231
  }
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], n2 = group0.length, merge = merges[j] = new Array(n2), node, i2 = 0; i2 < n2; ++i2) {
849
- if (node = group0[i2] || group1[i2]) {
850
- merge[i2] = node;
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;
851
1259
  }
1260
+ return n3.metaKey === t3.event.modifiers.metaKey && (!r3 || n3.shiftKey === t3.event.modifiers.shiftKey);
852
1261
  }
853
1262
  }
854
- for (; j < m0; ++j) {
855
- merges[j] = groups0[j];
1263
+ capture(e2) {
1264
+ this.bindings(e2, true);
856
1265
  }
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], i2 = group.length - 1, next = group[i2], node; --i2 >= 0; ) {
862
- if (node = group[i2]) {
863
- if (next && node.compareDocumentPosition(next) ^ 4)
864
- next.parentNode.insertBefore(node, next);
865
- next = node;
866
- }
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]]);
867
1282
  }
1283
+ return this;
868
1284
  }
869
- return this;
870
- }
871
- function selection_sort(compare) {
872
- if (!compare)
873
- compare = ascending;
874
- function compareNode(a2, b) {
875
- return a2 && b ? compare(a2.__data__, b.__data__) : !a2 - !b;
1285
+ unbind() {
1286
+ return this.selection.on(`${this.eventType}.capture.${this.namespace}`, null), this.selection.on(`${this.eventType}.bubble.${this.namespace}`, null), this;
876
1287
  }
877
- for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {
878
- for (var group = groups[j], n2 = group.length, sortgroup = sortgroups[j] = new Array(n2), node, i2 = 0; i2 < n2; ++i2) {
879
- if (node = group[i2]) {
880
- sortgroup[i2] = node;
881
- }
882
- }
883
- sortgroup.sort(compareNode);
1288
+ clear() {
1289
+ return this.bindedKeys = {}, this;
884
1290
  }
885
- return new Selection(sortgroups, this._parents).order();
886
- }
887
- function ascending(a2, b) {
888
- return a2 < b ? -1 : a2 > b ? 1 : a2 >= 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;
895
- }
896
- function selection_nodes() {
897
- return Array.from(this);
898
- }
899
- function selection_node() {
900
- for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
901
- for (var group = groups[j], i2 = 0, n2 = group.length; i2 < n2; ++i2) {
902
- var node = group[i2];
903
- if (node)
904
- return node;
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];
905
1295
  }
1296
+ return this;
906
1297
  }
907
- return null;
908
1298
  }
909
- function selection_size() {
910
- let size = 0;
911
- for (const node of this)
912
- ++size;
913
- return size;
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
+ }
914
1311
  }
915
- function selection_empty() {
916
- return !this.node();
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;
917
1324
  }
918
- function selection_each(callback) {
919
- for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
920
- for (var group = groups[j], i2 = 0, n2 = group.length, node; i2 < n2; ++i2) {
921
- if (node = group[i2])
922
- callback.call(node, node.__data__, i2, group);
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;
923
1454
  }
924
1455
  }
925
- return this;
926
- }
927
- function attrRemove(name) {
928
- return function() {
929
- this.removeAttribute(name);
930
- };
931
- }
932
- function attrRemoveNS(fullname) {
933
- return function() {
934
- this.removeAttributeNS(fullname.space, fullname.local);
935
- };
936
- }
937
- function attrConstant(name, value) {
938
- return function() {
939
- this.setAttribute(name, value);
940
- };
941
- }
942
- function attrConstantNS(fullname, value) {
943
- return function() {
944
- this.setAttributeNS(fullname.space, fullname.local, value);
945
- };
946
- }
947
- function attrFunction(name, value) {
948
- return function() {
949
- var v = value.apply(this, arguments);
950
- if (v == null)
951
- this.removeAttribute(name);
952
- else
953
- this.setAttribute(name, v);
954
- };
955
- }
956
- function attrFunctionNS(fullname, value) {
957
- return function() {
958
- var v = value.apply(this, arguments);
959
- if (v == null)
960
- this.removeAttributeNS(fullname.space, fullname.local);
961
- else
962
- this.setAttributeNS(fullname.space, fullname.local, v);
963
- };
964
1456
  }
965
- function selection_attr(name, value) {
966
- var fullname = namespace(name);
967
- if (arguments.length < 2) {
968
- var node = this.node();
969
- return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname);
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;
970
1514
  }
971
- return this.each((value == null ? fullname.local ? attrRemoveNS : attrRemove : typeof value === "function" ? fullname.local ? attrFunctionNS : attrFunction : fullname.local ? attrConstantNS : attrConstant)(fullname, value));
972
- }
973
- function defaultView(node) {
974
- return node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView;
975
- }
976
- function styleRemove(name) {
977
- return function() {
978
- this.style.removeProperty(name);
979
- };
980
- }
981
- function styleConstant(name, value, priority) {
982
- return function() {
983
- this.style.setProperty(name, value, priority);
984
- };
985
- }
986
- function styleFunction(name, value, priority) {
987
- return function() {
988
- var v = value.apply(this, arguments);
989
- if (v == null)
990
- this.style.removeProperty(name);
991
- else
992
- this.style.setProperty(name, v, priority);
993
- };
994
- }
995
- function selection_style(name, value, priority) {
996
- return arguments.length > 1 ? this.each((value == null ? styleRemove : typeof value === "function" ? styleFunction : styleConstant)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name);
997
- }
998
- function styleValue(node, name) {
999
- return node.style.getPropertyValue(name) || defaultView(node).getComputedStyle(node, null).getPropertyValue(name);
1000
- }
1001
- function propertyRemove(name) {
1002
- return function() {
1003
- delete this[name];
1004
- };
1005
- }
1006
- function propertyConstant(name, value) {
1007
- return function() {
1008
- this[name] = value;
1009
- };
1010
- }
1011
- function propertyFunction(name, value) {
1012
- return function() {
1013
- var v = value.apply(this, arguments);
1014
- if (v == null)
1015
- delete this[name];
1016
- else
1017
- this[name] = v;
1018
- };
1019
- }
1020
- function selection_property(name, value) {
1021
- return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name, value)) : this.node()[name];
1022
- }
1023
- function classArray(string) {
1024
- return string.trim().split(/^|\s+/);
1025
- }
1026
- function classList(node) {
1027
- return node.classList || new ClassList(node);
1028
1515
  }
1029
- function ClassList(node) {
1030
- this._node = node;
1031
- this._names = classArray(node.getAttribute("class") || "");
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;
1032
1548
  }
1033
- ClassList.prototype = {
1034
- add: function(name) {
1035
- var i2 = this._names.indexOf(name);
1036
- if (i2 < 0) {
1037
- this._names.push(name);
1038
- this._node.setAttribute("class", this._names.join(" "));
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.");
1039
1557
  }
1040
- },
1041
- remove: function(name) {
1042
- var i2 = this._names.indexOf(name);
1043
- if (i2 >= 0) {
1044
- this._names.splice(i2, 1);
1045
- this._node.setAttribute("class", this._names.join(" "));
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
+ }
1046
1562
  }
1047
- },
1048
- contains: function(name) {
1049
- return this._names.indexOf(name) >= 0;
1050
1563
  }
1051
- };
1052
- function classedAdd(node, names) {
1053
- var list = classList(node), i2 = -1, n2 = names.length;
1054
- while (++i2 < n2)
1055
- list.add(names[i2]);
1056
- }
1057
- function classedRemove(node, names) {
1058
- var list = classList(node), i2 = -1, n2 = names.length;
1059
- while (++i2 < n2)
1060
- list.remove(names[i2]);
1061
- }
1062
- function classedTrue(names) {
1063
- return function() {
1064
- classedAdd(this, names);
1065
- };
1066
- }
1067
- function classedFalse(names) {
1068
- return function() {
1069
- classedRemove(this, names);
1070
- };
1071
- }
1072
- function classedFunction(names, value) {
1073
- return function() {
1074
- (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
1564
+ var geom = {
1565
+ type: "Polygon",
1566
+ coordinates
1075
1567
  };
1568
+ return feature(geom, properties, options2);
1076
1569
  }
1077
- function selection_classed(name, value) {
1078
- var names = classArray(name + "");
1079
- if (arguments.length < 2) {
1080
- var list = classList(this.node()), i2 = -1, n2 = names.length;
1081
- while (++i2 < n2)
1082
- if (!list.contains(names[i2]))
1083
- return false;
1084
- return true;
1570
+ function lineString(coordinates, properties, options2) {
1571
+ if (options2 === void 0) {
1572
+ options2 = {};
1085
1573
  }
1086
- return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value));
1087
- }
1088
- function textRemove() {
1089
- this.textContent = "";
1090
- }
1091
- function textConstant(value) {
1092
- return function() {
1093
- this.textContent = value;
1094
- };
1095
- }
1096
- function textFunction(value) {
1097
- return function() {
1098
- var v = value.apply(this, arguments);
1099
- this.textContent = v == null ? "" : v;
1100
- };
1101
- }
1102
- function selection_text(value) {
1103
- return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction : textConstant)(value)) : this.node().textContent;
1104
- }
1105
- function htmlRemove() {
1106
- this.innerHTML = "";
1107
- }
1108
- function htmlConstant(value) {
1109
- return function() {
1110
- this.innerHTML = value;
1111
- };
1112
- }
1113
- function htmlFunction(value) {
1114
- return function() {
1115
- var v = value.apply(this, arguments);
1116
- this.innerHTML = v == null ? "" : v;
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
1117
1580
  };
1581
+ return feature(geom, properties, options2);
1118
1582
  }
1119
- function selection_html(value) {
1120
- return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML;
1121
- }
1122
- function raise() {
1123
- if (this.nextSibling)
1124
- this.parentNode.appendChild(this);
1125
- }
1126
- function selection_raise() {
1127
- return this.each(raise);
1128
- }
1129
- function lower() {
1130
- if (this.previousSibling)
1131
- this.parentNode.insertBefore(this, this.parentNode.firstChild);
1132
- }
1133
- function selection_lower() {
1134
- return this.each(lower);
1135
- }
1136
- function selection_append(name) {
1137
- var create = typeof name === "function" ? name : creator(name);
1138
- return this.select(function() {
1139
- return this.appendChild(create.apply(this, arguments));
1140
- });
1141
- }
1142
- function constantNull() {
1143
- return null;
1144
- }
1145
- function selection_insert(name, before) {
1146
- var create = typeof name === "function" ? name : creator(name), select = before == null ? constantNull : typeof before === "function" ? before : selector(before);
1147
- return this.select(function() {
1148
- return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);
1149
- });
1150
- }
1151
- function remove() {
1152
- var parent = this.parentNode;
1153
- if (parent)
1154
- parent.removeChild(this);
1155
- }
1156
- function selection_remove() {
1157
- return this.each(remove);
1158
- }
1159
- function selection_cloneShallow() {
1160
- var clone = this.cloneNode(false), parent = this.parentNode;
1161
- return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
1162
- }
1163
- function selection_cloneDeep() {
1164
- var clone = this.cloneNode(true), parent = this.parentNode;
1165
- return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
1166
- }
1167
- function selection_clone(deep) {
1168
- return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
1169
- }
1170
- function selection_datum(value) {
1171
- return arguments.length ? this.property("__data__", value) : this.node().__data__;
1172
- }
1173
- function contextListener(listener) {
1174
- return function(event) {
1175
- listener.call(this, event, this.__data__);
1176
- };
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;
1177
1592
  }
1178
- function parseTypenames(typenames) {
1179
- return typenames.trim().split(/^|\s+/).map(function(t2) {
1180
- var name = "", i2 = t2.indexOf(".");
1181
- if (i2 >= 0)
1182
- name = t2.slice(i2 + 1), t2 = t2.slice(0, i2);
1183
- return { type: t2, name };
1184
- });
1593
+ function degreesToRadians(degrees) {
1594
+ var radians = degrees % 360;
1595
+ return radians * Math.PI / 180;
1185
1596
  }
1186
- function onRemove(typename) {
1187
- return function() {
1188
- var on = this.__on;
1189
- if (!on)
1190
- return;
1191
- for (var j = 0, i2 = -1, m = on.length, o; j < m; ++j) {
1192
- if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {
1193
- this.removeEventListener(o.type, o.listener, o.options);
1194
- } else {
1195
- on[++i2] = o;
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");
1196
1696
  }
1197
1697
  }
1198
- if (++i2)
1199
- on.length = i2;
1200
- else
1201
- delete this.__on;
1202
- };
1698
+ }
1203
1699
  }
1204
- function onAdd(typename, value, options2) {
1205
- return function() {
1206
- var on = this.__on, o, listener = contextListener(value);
1207
- if (on)
1208
- for (var j = 0, m = on.length; j < m; ++j) {
1209
- if ((o = on[j]).type === typename.type && o.name === typename.name) {
1210
- this.removeEventListener(o.type, o.listener, o.options);
1211
- this.addEventListener(o.type, o.listener = listener, o.options = options2);
1212
- o.value = value;
1213
- return;
1214
- }
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;
1215
1721
  }
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
- };
1223
- }
1224
- function selection_on(typename, value, options2) {
1225
- var typenames = parseTypenames(typename + ""), i2, n2 = 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 (i2 = 0, o = on[j]; i2 < n2; ++i2) {
1231
- if ((t2 = typenames[i2]).type === o.type && t2.name === o.name) {
1232
- return o.value;
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;
1233
1749
  }
1750
+ break;
1234
1751
  }
1752
+ default:
1753
+ throw new Error("Unknown Geometry Type");
1235
1754
  }
1236
- return;
1237
- }
1238
- on = value ? onAdd : onRemove;
1239
- for (i2 = 0; i2 < n2; ++i2)
1240
- this.each(on(typenames[i2], value, options2));
1241
- return this;
1242
- }
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);
1253
- }
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], i2 = 0, n2 = group.length, node; i2 < n2; ++i2) {
1272
- if (node = group[i2])
1273
- yield node;
1274
1755
  }
1756
+ featureIndex++;
1275
1757
  }
1276
1758
  }
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 e(selector2) {
1324
- return typeof selector2 === "string" ? new Selection([[document.querySelector(selector2)]], [document.documentElement]) : new Selection([[selector2]], root$1);
1325
- }
1326
- 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 };
1327
- function a(e2) {
1328
- return Array.from(new Set(e2));
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;
1329
1778
  }
1330
- class i {
1331
- constructor(t2 = "global", r2 = document, n2 = "keydown") {
1332
- if ("keydown" !== n2 && "keyup" !== n2)
1333
- throw new Error(n2, "\u4E8B\u4EF6\u7C7B\u578B\u4EC5\u652F\u6301keydown\u3001keyup");
1334
- 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();
1335
- }
1336
- init() {
1337
- return this.selection.on(`${this.eventType}.capture.${this.namespace}`, this.capture, true), this.selection.on(`${this.eventType}.bubble.${this.namespace}`, this.bubble, false), this;
1338
- }
1339
- bindings(e2, t2) {
1340
- var r2, n2, s2 = false, a2 = Object.keys(this.bindedKeys).map(function(e3) {
1341
- return this.bindedKeys[e3];
1342
- }.bind(this));
1343
- for (r2 = 0; r2 < a2.length; r2++)
1344
- if ((n2 = a2[r2]).event.modifiers.shiftKey && !!n2.capture === t2 && i2(e2, n2, true)) {
1345
- n2.callback(e2), s2 = true, e2.preventDefault();
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";
1346
1805
  break;
1347
- }
1348
- if (!s2) {
1349
- for (r2 = 0; r2 < a2.length; r2++)
1350
- if (!(n2 = a2[r2]).event.modifiers.shiftKey && !!n2.capture === t2 && i2(e2, n2, false)) {
1351
- n2.callback(e2), e2.preventDefault();
1352
- break;
1353
- }
1354
1806
  }
1355
- function i2(e3, t3, r3) {
1356
- var n3 = e3, s3 = false, a3 = true;
1357
- 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) {
1358
- return e4.toLowerCase();
1359
- }).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)
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)
1360
1814
  return false;
1361
- if (!n3.ctrlKey || !n3.altKey) {
1362
- if (n3.ctrlKey !== t3.event.modifiers.ctrlKey)
1363
- return false;
1364
- if (n3.altKey !== t3.event.modifiers.altKey)
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)
1365
1852
  return false;
1853
+ segmentIndex++;
1854
+ previousCoords = currentCoord;
1366
1855
  }
1367
- return n3.metaKey === t3.event.modifiers.metaKey && (!r3 || n3.shiftKey === t3.event.modifiers.shiftKey);
1856
+ ) === false)
1857
+ return false;
1858
+ });
1859
+ }
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;
1368
1878
  }
1879
+ );
1880
+ return previousValue;
1881
+ }
1882
+ function getCoord(coord) {
1883
+ if (!coord) {
1884
+ throw new Error("coord is required");
1369
1885
  }
1370
- capture(e2) {
1371
- this.bindings(e2, true);
1372
- }
1373
- bubble(t2) {
1374
- var r2 = e(t2.target).node().tagName;
1375
- "INPUT" !== r2 && "SELECT" !== r2 && "TEXTAREA" !== r2 && "true" !== String(t2.target.getAttribute("contenteditable")) && this.bindings(t2, false);
1376
- }
1377
- on(e2, i2, o2) {
1378
- if ("function" != typeof i2)
1379
- return this.off(e2, o2);
1380
- for (var c2 = a([].concat(e2)), l = 0; l < c2.length; l++) {
1381
- 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 } } };
1382
- this.bindedKeys[u] && console.warn('warning: duplicate keybinding for "' + u + '"'), this.bindedKeys[u] = p;
1383
- for (var f = c2[l].toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g), d = 0; d < f.length; d++)
1384
- if ("++" === f[d] && (f[d] = "+"), f[d] in t) {
1385
- var h = r[t[f[d]]];
1386
- p.event.modifiers[h] = true;
1387
- } else
1388
- p.event.key = n[f[d]] || f[d], f[d] in s && (p.event.keyCode = s[f[d]]);
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;
1389
1892
  }
1390
- return this;
1391
1893
  }
1392
- unbind() {
1393
- return this.selection.on(`${this.eventType}.capture.${this.namespace}`, null), this.selection.on(`${this.eventType}.bubble.${this.namespace}`, null), this;
1894
+ if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
1895
+ return coord;
1394
1896
  }
1395
- clear() {
1396
- return this.bindedKeys = {}, this;
1897
+ throw new Error("coord must be GeoJSON Point or an Array of numbers");
1898
+ }
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 = {};
1397
1903
  }
1398
- off(e2, t2) {
1399
- for (var r2 = a([].concat(e2)), n2 = 0; n2 < r2.length; n2++) {
1400
- var s2 = r2[n2] + (true === t2 ? "-capture" : "-bubble");
1401
- delete this.bindedKeys[s2];
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);
1912
+ }
1913
+ var RADIUS = 6378137;
1914
+ function area(geojson) {
1915
+ return geomReduce(geojson, function(value, geom) {
1916
+ return value + calculateArea(geom);
1917
+ }, 0);
1918
+ }
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]);
1928
+ }
1929
+ return total;
1930
+ case "Point":
1931
+ case "MultiPoint":
1932
+ case "LineString":
1933
+ case "MultiLineString":
1934
+ return 0;
1935
+ }
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]));
1402
1944
  }
1403
- return this;
1404
1945
  }
1946
+ return total;
1405
1947
  }
1406
- new i("global", document, "keydown");
1407
- new i("global", document, "keyup");
1408
- class KeyboardControl extends CommonCtrol {
1409
- _onBindKeyboards(actions, namespace2) {
1410
- this.keybinding = new i(namespace2);
1411
- actions.forEach((o) => {
1412
- this.keybinding.on(o.code, o.action);
1413
- });
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;
1972
+ }
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;
1414
1979
  }
1415
- _onUnbindKeyboards() {
1416
- this.keybinding.clear();
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 = {};
1417
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);
1418
1993
  }
1994
+ var commonCtrols = "";
1995
+ var control$5 = "";
1419
1996
  const options$5 = {
1420
1997
  title: "\u6D4B\u91CF\u8DDD\u79BB"
1421
1998
  };
@@ -2022,7 +2599,7 @@ class PickCoordControl extends KeyboardControl {
2022
2599
  }
2023
2600
  _renderContent() {
2024
2601
  const main = document.createElement("main");
2025
- 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`;
2026
2603
  this._container.append(main);
2027
2604
  main.addEventListener("click", () => {
2028
2605
  if (!this.text.includes(","))
@@ -3162,4 +3739,4 @@ class LayerTreeControl extends KeyboardControl {
3162
3739
  });
3163
3740
  }
3164
3741
  }
3165
- export { Checkbox, LayerTreeControl, MeasureAreaControl, MeasureDistanceControl, MouseRectControl, PickCoordControl, PositionControl, copyContent, createUuid, mercatorToLnglat, transformRequest4326 };
3742
+ export { Checkbox, ContextMenu, Component$1 as Geoserver, Component as GeoserverAside, LayerTreeControl, MeasureAreaControl, MeasureDistanceControl, MouseRectControl, PickCoordControl, PositionControl, copyContent, createUuid, mercatorToLnglat, transformRequest4326 };